Buggy code:
public class CBFLoader extends AbstractFileLoader { protected static final Logger logger = LoggerFactory . getLogger ( CBFLoader . class ) ; private HashMap < String , String > metadataMap = new HashMap < String , String > ( ) ; public HashMap < String , Serializable > GDAMetadata = new HashMap < String , Serializable > ( ) ; public CBFLoader ( ) { } public CBFLoader ( String FileName ) { } @ Override protected void clearMetadata ( ) { } @ Override public DataHolder loadFile ( ) throws ScanFileHolderException { } static String [ ] miniCBFheaderNames = new String [ ] { "Pixel_size" , "Silicon<seq2seq4repair_space>sensor,<seq2seq4repair_space>thickness" , "Exposure_time" , "Exposure_period" , "Tau<seq2seq4repair_space>=" , "Count_cutoff" , "Threshold_setting," , "N_excluded_pixels<seq2seq4repair_space>=" , "Excluded_pixels:" , "Flat_field:" , "Trim_directory:" , "Wavelength" , "Energy_range" , "Detector_distance" , "Detector_Voffset" , "Beam_xy" , "Flux" , "Filter_transmission" , "Start_angle" , "Angle_increment" , "Detector_2theta" , "Polarization" , "Alpha" , "Kappa" , "Phi" , "Chi" , "Oscillation_axis" , "N_oscillations" } ; private CBFLoader . ImageOrientation readMiniCBFHeader ( cbf_handle_struct chs ) throws ScanFileHolderException { } private void createGDAMetadata ( int x , int y ) throws ScanFileHolderException { } private void createMetadata ( double [ ] detectorOrigin , double xPxVal , double yPXVal , double lambda ) { } private CBFLoader . ImageOrientation readCBFHeaderData ( cbf_handle_struct chs ) throws ScanFileHolderException { } private CBFLoader . ImageOrientation readImageOrientation ( cbf_handle_struct chs ) throws ScanFileHolderException { } private Dataset readCBFBinaryData ( cbf_handle_struct chs , CBFLoader . ImageOrientation imageOrien ) throws ScanFileHolderException { AbstractDataset data = null ; if ( imageOrien == null ) { <START_BUG> imageOrien = readCBFHeaderData ( chs ) ; <END_BUG> } int [ ] shape = imageOrien . getShape ( ) ; int xLength = shape [ 1 ] ; int yLength = shape [ 0 ] ; boolean xIncreasing = imageOrien . isXIncreasing ( ) ; boolean yIncreasing = imageOrien . isYIncreasing ( ) ; boolean isRowsX = imageOrien . isRowsX ( ) ; boolean isreal = ( imageOrien . isReal ) == 1 ; int numPixels = xLength * yLength ; int stride1 ; int stride2 ; int start ; if ( ! isRowsX ) { boolean b = yIncreasing ; yIncreasing = ! xIncreasing ; xIncreasing = ! b ; } if ( ! yIncreasing ) { stride1 = xLength ; start = 0 ; } else { stride1 = - xLength ; start = ( xLength * yLength ) - xLength ; } if ( xIncreasing ) { stride2 = 1 ; } else { stride2 = - 1 ; start += xLength - 1 ; } int rows ; int cols ; int rstep ; int cstep ; if ( isRowsX ) { rows = yLength ; cols = xLength ; rstep = stride1 ; cstep = stride2 ; } else { rows = xLength ; cols = yLength ; rstep = stride2 ; cstep = stride1 ; } int index = 0 ; int position = 0 ; int hash = 0 ; intP bid = new intP ( ) ; sizetP rsize = new sizetP ( ) ; if ( isreal ) { DoubleBuffer ddata ; try { ddata = ByteBuffer . allocateDirect ( ( numPixels * 8 ) ) . order ( ByteOrder . nativeOrder ( ) ) . asDoubleBuffer ( ) ; } catch ( OutOfMemoryError e ) { throw new ScanFileHolderException ( "CBFloader<seq2seq4repair_space>failed<seq2seq4repair_space>to<seq2seq4repair_space>while<seq2seq4repair_space>allocating<seq2seq4repair_space>the<seq2seq4repair_space>byte<seq2seq4repair_space>buffer<seq2seq4repair_space>" , e ) ; } catch ( Exception eb ) { throw new ScanFileHolderException ( "CBFloader<seq2seq4repair_space>failed<seq2seq4repair_space>to<seq2seq4repair_space>while<seq2seq4repair_space>allocating<seq2seq4repair_space>the<seq2seq4repair_space>byte<seq2seq4repair_space>buffer<seq2seq4repair_space>" , eb ) ; } CBFError . errorChecker ( cbf . cbf_get_realarray ( chs , bid . cast ( ) , ddata , ( ( Double . SIZE ) // 8 ) , numPixels , rsize . cast ( ) ) ) ; if ( numPixels != ( rsize . value ( ) ) ) { throw new ScanFileHolderException ( "Mismatch<seq2seq4repair_space>of<seq2seq4repair_space>CBF<seq2seq4repair_space>binary<seq2seq4repair_space>data<seq2seq4repair_space>size" ) ; } try { data = new DoubleDataset ( shape ) ; } catch ( OutOfMemoryError e ) { throw new ScanFileHolderException ( "CBFLoader<seq2seq4repair_space>failed<seq2seq4repair_space>when<seq2seq4repair_space>creating<seq2seq4repair_space>a<seq2seq4repair_space>DoubleDataset<seq2seq4repair_space>for<seq2seq4repair_space>the<seq2seq4repair_space>data" , e ) ; } catch ( Exception eb ) { throw new ScanFileHolderException ( "CBFLoader<seq2seq4repair_space>failed<seq2seq4repair_space>when<seq2seq4repair_space>creating<seq2seq4repair_space>a<seq2seq4repair_space>DoubleDataset<seq2seq4repair_space>for<seq2seq4repair_space>the<seq2seq4repair_space>data" , eb ) ; } double [ ] dArray = ( ( DoubleDataset ) ( data ) ) . getData ( ) ; double amax = - ( Double . MAX_VALUE ) ; double amin = Double . MAX_VALUE ; double dhash = 0 ; for ( int j = 0 ; j < rows ; j ++ ) { position = start ; for ( int i = 0 ; i < cols ; i ++ ) { double value = ddata . get ( position ) ; position += cstep ; if ( ( Double . isInfinite ( value ) ) || ( Double . isNaN ( value ) ) ) dhash = ( dhash * 19 ) % ( Integer . MAX_VALUE ) ; else dhash = ( ( dhash * 19 ) + value ) % ( Integer . MAX_VALUE ) ; dArray [ ( index ++ ) ] = value ; if ( value > amax ) { amax = value ; } if ( value < amin ) { amin = value ; } } start += rstep ; } hash = ( ( int ) ( dhash ) ) ; data . setStoredValue ( STORE_MAX , amax ) ; data . setStoredValue ( STORE_MIN , amin ) ; ddata = null ; } else { IntBuffer idata ; try { idata = ByteBuffer . allocateDirect ( ( numPixels * 4 ) ) . order ( ByteOrder . nativeOrder ( ) ) . asIntBuffer ( ) ; } catch ( OutOfMemoryError e ) { throw new ScanFileHolderException ( "CBFLoader<seq2seq4repair_space>failed<seq2seq4repair_space>to<seq2seq4repair_space>allocate<seq2seq4repair_space>bytebuffer<seq2seq4repair_space>(intbuffer)" , e ) ; } catch ( Exception eb ) { throw new ScanFileHolderException ( "CBFLoader<seq2seq4repair_space>failed<seq2seq4repair_space>to<seq2seq4repair_space>allocate<seq2seq4repair_space>bytebuffer<seq2seq4repair_space>(intbuffer)" , eb ) ; } int signed = imageOrien . isSigned ;

Fix:
imageOrien = readImageOrientation ( chs ) ;