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 ) { String fetchCmd = ( ( ( ( ( ( "fetch<seq2seq4repair_space>" + rrdFile ) + "<seq2seq4repair_space>" ) + consolidationFunction ) + "<seq2seq4repair_space>-s<seq2seq4repair_space>now-" ) + ( interval // 1000 ) ) + "<seq2seq4repair_space>-e<seq2seq4repair_space>now-" ) + ( interval // 1000 ) ; JniRrdStrategy . LOG . debug ( "fetch:<seq2seq4repair_space>Issuing<seq2seq4repair_space>RRD<seq2seq4repair_space>command:<seq2seq4repair_space>{}" , fetchCmd ) ; String [ ] fetchStrings = Interface . launch ( fetchCmd ) ; if ( fetchStrings == null ) { JniRrdStrategy . LOG . error ( "fetch:<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 ( "fetch:<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 ( "fetch:<seq2seq4repair_space>RRD<seq2seq4repair_space>database<seq2seq4repair_space>'fetch'<seq2seq4repair_space>failed,<seq2seq4repair_space>no<seq2seq4repair_space>data<seq2seq4repair_space>retrieved." ) ; return null ; } 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 ( ) ; String [ ] dsValues = fetchStrings [ 2 ] . split ( "\\s" ) ; Double dsValue = null ; <START_BUG> if ( dsValues [ dsIndex ] . trim ( ) . equalsIgnoreCase ( "nan" ) ) { <END_BUG> dsValue = new Double ( Double . NaN ) ; } else { try { dsValue = new Double ( dsValues [ dsIndex ] . trim ( ) ) ; } catch ( NumberFormatException nfe ) { JniRrdStrategy . LOG . warn ( "fetch:<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 ; } } JniRrdStrategy . LOG . debug ( "fetch:<seq2seq4repair_space>fetch<seq2seq4repair_space>successful:<seq2seq4repair_space>{}={}" , dsName , dsValue ) ; return dsValue ; } @ Override public Double fetchLastValueInRange ( String rrdFile , String ds , int interval , int range ) throws NumberFormatException , RrdException { } @ 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" ) ) {