Buggy code:
public class JniRrdStrategy implements RrdStrategy < JniRrdStrategy . CreateCommand , StringBuffer > { private static final Logger LOG = LoggerFactory . getLogger ( JniRrdStrategy . class ) ; private static final String IGNORABLE_LIBART_WARNING_STRING = "***<seq2seq4repair_space>attempt<seq2seq4repair_space>to<seq2seq4repair_space>put<seq2seq4repair_space>segment<seq2seq4repair_space>in<seq2seq4repair_space>horiz<seq2seq4repair_space>list<seq2seq4repair_space>twice" ; private static final String IGNORABLE_LIBART_WARNING_REGEX = "\\*\\*\\*<seq2seq4repair_space>attempt<seq2seq4repair_space>to<seq2seq4repair_space>put<seq2seq4repair_space>segment<seq2seq4repair_space>in<seq2seq4repair_space>horiz<seq2seq4repair_space>list<seq2seq4repair_space>twice\r?\n?" ; private Properties m_configurationProperties ; public static class CreateCommand { private static final String OPERATION = "create" ; String filename ; String parameter ; public CreateCommand ( String filename , String parameter ) { } @ Override public String toString ( ) { } } public Properties getConfigurationProperties ( ) { } @ Override public void setConfigurationProperties ( Properties configurationParameters ) { } @ Override public void closeFile ( StringBuffer rrd ) throws Exception { } @ Override public JniRrdStrategy . CreateCommand createDefinition ( String creator , String directory , String rrdName , int step , List < RrdDataSource > dataSources , List < String > rraList ) throws Exception { } @ Override public void createFile ( JniRrdStrategy . CreateCommand createCommand , Map < String , String > attributeMappings ) throws Exception { } @ Override public StringBuffer openFile ( String fileName ) throws Exception { } @ Override public void updateFile ( StringBuffer rrd , String owner , String data ) throws Exception { } public JniRrdStrategy ( ) throws Exception { } @ Override public Double fetchLastValue ( String rrdFile , String ds , int interval ) throws NumberFormatException , RrdException { } @ Override public Double fetchLastValue ( String rrdFile , String ds , String consolidationFunction , int interval ) { } @ Override public Double fetchLastValueInRange ( String rrdFile , String ds , int interval , int range ) throws NumberFormatException , RrdException { long now = System . currentTimeMillis ( ) ; long latestUpdateTime = ( now - ( now % interval ) ) // 1000L ; long earliestUpdateTime = ( ( now - ( now % interval ) ) - range ) // 1000L ; JniRrdStrategy . LOG . debug ( "fetchInRange:<seq2seq4repair_space>fetching<seq2seq4repair_space>data<seq2seq4repair_space>from<seq2seq4repair_space>{}<seq2seq4repair_space>to<seq2seq4repair_space>{}" , earliestUpdateTime , latestUpdateTime ) ; String fetchCmd = ( ( ( ( "fetch<seq2seq4repair_space>" + rrdFile ) + "<seq2seq4repair_space>AVERAGE<seq2seq4repair_space>-s<seq2seq4repair_space>" ) + earliestUpdateTime ) + "<seq2seq4repair_space>-e<seq2seq4repair_space>" ) + latestUpdateTime ; String [ ] fetchStrings = Interface . launch ( fetchCmd ) ; if ( fetchStrings == null ) { JniRrdStrategy . LOG . error ( "fetchInRange:<seq2seq4repair_space>Unexpected<seq2seq4repair_space>error<seq2seq4repair_space>issuing<seq2seq4repair_space>RRD<seq2seq4repair_space>'fetch'<seq2seq4repair_space>command,<seq2seq4repair_space>no<seq2seq4repair_space>error<seq2seq4repair_space>text<seq2seq4repair_space>available." ) ; return null ; } if ( ( fetchStrings [ 0 ] ) != null ) { JniRrdStrategy . LOG . error ( "fetchInRange:<seq2seq4repair_space>RRD<seq2seq4repair_space>database<seq2seq4repair_space>'fetch'<seq2seq4repair_space>failed,<seq2seq4repair_space>reason:<seq2seq4repair_space>{}" , fetchStrings [ 0 ] ) ; return null ; } if ( ( ( fetchStrings [ 1 ] ) == null ) || ( ( fetchStrings [ 2 ] ) == null ) ) { JniRrdStrategy . LOG . error ( "fetchInRange:<seq2seq4repair_space>RRD<seq2seq4repair_space>database<seq2seq4repair_space>'fetch'<seq2seq4repair_space>failed,<seq2seq4repair_space>no<seq2seq4repair_space>data<seq2seq4repair_space>retrieved." ) ; return null ; } int numFetched = fetchStrings . length ; JniRrdStrategy . LOG . debug ( "fetchInRange:<seq2seq4repair_space>got<seq2seq4repair_space>{}<seq2seq4repair_space>strings<seq2seq4repair_space>from<seq2seq4repair_space>RRD" , numFetched ) ; String [ ] dsNames = fetchStrings [ 1 ] . split ( "\\s" ) ; int dsIndex = 0 ; for ( int i = 0 ; i < ( dsNames . length ) ; i ++ ) { if ( dsNames [ i ] . equals ( ds ) ) dsIndex = i ; } String dsName = dsNames [ dsIndex ] . trim ( ) ; Double dsValue ; for ( int i = ( fetchStrings . length ) - 2 ; i > 1 ; i -- ) { String [ ] dsValues = fetchStrings [ i ] . split ( "\\s" ) ; <START_BUG> if ( dsValues [ dsIndex ] . trim ( ) . equalsIgnoreCase ( "nan" ) ) { <END_BUG> JniRrdStrategy . LOG . debug ( "fetchInRange:<seq2seq4repair_space>Got<seq2seq4repair_space>a<seq2seq4repair_space>NaN<seq2seq4repair_space>value<seq2seq4repair_space>-<seq2seq4repair_space>continuing<seq2seq4repair_space>back<seq2seq4repair_space>in<seq2seq4repair_space>time" ) ; } else { try { dsValue = new Double ( dsValues [ dsIndex ] . trim ( ) ) ; JniRrdStrategy . LOG . debug ( "fetchInRange:<seq2seq4repair_space>fetch<seq2seq4repair_space>successful:<seq2seq4repair_space>{}=<seq2seq4repair_space>{}" , dsName , dsValue ) ; return dsValue ; } catch ( NumberFormatException nfe ) { JniRrdStrategy . LOG . warn ( "fetchInRange:<seq2seq4repair_space>Unable<seq2seq4repair_space>to<seq2seq4repair_space>convert<seq2seq4repair_space>fetched<seq2seq4repair_space>value<seq2seq4repair_space>({})<seq2seq4repair_space>to<seq2seq4repair_space>Double<seq2seq4repair_space>for<seq2seq4repair_space>data<seq2seq4repair_space>source<seq2seq4repair_space>{}" , dsValues [ dsIndex ] . trim ( ) , dsName ) ; throw nfe ; } } } return null ; } @ Override public InputStream createGraph ( String command , File workDir ) throws IOException , RrdException { } private byte [ ] createGraphAsByteArray ( String command , File workDir ) throws IOException , RrdException { } @ Override public String getStats ( ) { } @ Override public int getGraphLeftOffset ( ) { } @ Override public int getGraphRightOffset ( ) { } @ Override public int getGraphTopOffsetWithText ( ) { } @ Override public String getDefaultFileExtension ( ) { } @ Override public RrdGraphDetails createGraphReturnDetails ( String command , File workDir ) throws IOException , RrdException { } @ Override public void promoteEnqueuedFiles ( Collection < String > rrdFiles ) { } }

Fix:
if ( dsValues [ dsIndex ] . trim ( ) . toLowerCase ( ) . endsWith ( "nan" ) ) {