if ( ret.isEmpty( ) ) {
throw new NotEnoughResourcesAvailable( "Failed to find a free network index: " + ret );</BUG>
} else {
<BUG>PrivateNetworkIndex idx = ret.get( 0 );</BUG>
db.commit( );
<BUG>return idx;
</BUG>
}
} catch ( Exception ex ) {
db.rollback( );

@SuppressWarnings( "unchecked" )
private static PrivateNetworkIndex getNextIndex( ExtantNetwork exNet ) throws ResourceAllocationException {
EntityWrapper<PrivateNetworkIndex> db = Entities.get( PrivateNetworkIndex.class );
try {
Example ex = Example.create( PrivateNetworkIndex.free( exNet ) ).enableLike( MatchMode.EXACT );
PrivateNetworkIndex ret = ( PrivateNetworkIndex ) db.createCriteria( PrivateNetworkIndex.class ).setCacheable( true ).add( ex ).setMaxResults( 1 ).setFetchSize( 1 ).uniqueResult( );
if ( ret == null ) {
throw new NotEnoughResourcesAvailable( "Failed to find a free network index: " + ret );
} else {
db.commit( );
return ret;
}
} catch ( Exception ex ) {
db.rollback( );
