Buggy code:
public abstract class LocalPDBDirectory implements StructureIOFile { private static final Logger logger = LoggerFactory . getLogger ( LocalPDBDirectory . class ) ; public static final String DEFAULT_PDB_FILE_SERVER = "http:////ftp.wwpdb.org" ; public static final String PDB_FILE_SERVER_PROPERTY = "PDB.FILE.SERVER" ; public static enum ObsoleteBehavior { FETCH_CURRENT , FETCH_OBSOLETE , THROW_EXCEPTION ; public static final LocalPDBDirectory . ObsoleteBehavior DEFAULT = LocalPDBDirectory . ObsoleteBehavior . THROW_EXCEPTION ; } public static enum FetchBehavior { LOCAL_ONLY , FETCH_FILES , FETCH_IF_OUTDATED , FETCH_REMEDIATED , FORCE_DOWNLOAD ; public static final LocalPDBDirectory . FetchBehavior DEFAULT = LocalPDBDirectory . FetchBehavior . FETCH_REMEDIATED ; } public static final long LAST_REMEDIATION_DATE ; private static final String LAST_REMEDIATION_DATE_STRING = "2011//07//12" ; protected static final String lineSplit = System . getProperty ( "file.separator" ) ; private File path ; private List < String > extensions ; private String serverName ; private FileParsingParameters params ; private LocalPDBDirectory . ObsoleteBehavior obsoleteBehavior ; private LocalPDBDirectory . FetchBehavior fetchBehavior ; private String splitDirURL ; private String obsoleteDirURL ; private File splitDirPath ; private File obsoleteDirPath ; public LocalPDBDirectory ( String path ) { } public LocalPDBDirectory ( ) { } public void setPath ( String p ) { } public String getPath ( ) { } @ Override public void addExtension ( String s ) { } @ Override public List < String > getExtensions ( ) { } public void clearExtensions ( ) { } @ Deprecated public boolean isAutoFetch ( ) { } @ Deprecated public void setAutoFetch ( boolean autoFetch ) { } @ Override public void setFileParsingParameters ( FileParsingParameters params ) { } @ Override public FileParsingParameters getFileParsingParameters ( ) { } public void setObsoleteBehavior ( LocalPDBDirectory . ObsoleteBehavior behavior ) { } public LocalPDBDirectory . ObsoleteBehavior getObsoleteBehavior ( ) { } public LocalPDBDirectory . FetchBehavior getFetchBehavior ( ) { } public void setFetchBehavior ( LocalPDBDirectory . FetchBehavior fetchBehavior ) { } @ Override public Structure getStructure ( String filename ) throws IOException { } public Structure getStructure ( URL u ) throws IOException { } @ Override public Structure getStructure ( File filename ) throws IOException { } @ Override public Structure getStructureById ( String pdbId ) throws IOException { } public abstract Structure getStructure ( InputStream inStream ) throws IOException { } protected InputStream getInputStream ( String pdbId ) throws IOException { } public void prefetchStructure ( String pdbId ) throws IOException { } public boolean deleteStructure ( String pdbId ) { } @ SuppressWarnings ( "deprecation" ) protected File downloadStructure ( String pdbId ) throws IOException { } private File downloadStructure ( String pdbId , String pathOnServer , boolean obsolete , File existingFile ) throws IOException { } private Date getLastModifiedTime ( URL url ) { } protected File getDir ( String pdbId , boolean obsolete ) { } public File getLocalFile ( String pdbId ) { LinkedList < File > searchdirs = new LinkedList < File > ( ) ; String middle = pdbId . substring ( 1 , 3 ) . toLowerCase ( ) ; File splitdir = new File ( splitDirPath , middle ) ; searchdirs . add ( splitdir ) ; if ( ( getObsoleteBehavior ( ) ) == ( LocalPDBDirectory . ObsoleteBehavior . FETCH_OBSOLETE ) ) { File obsdir = new File ( obsoleteDirPath , middle ) ; searchdirs . add ( obsdir ) ; } String [ ] prefixes = new String [ ] { "" , "pdb" } ; for ( File searchdir : searchdirs ) { for ( String prefix : prefixes ) { for ( String ex : getExtensions ( ) ) { <START_BUG> File f = new File ( searchdir , ( ( prefix + pdbId ) + ex ) ) ; <END_BUG> if ( f . exists ( ) ) { return f ; } } } } return null ; } protected boolean checkFileExists ( String pdbId ) { } public static String getServerName ( ) { } protected void initPaths ( ) { } protected abstract String getFilename ( String pdbId ) { } protected abstract String [ ] getSplitDirPath ( ) { } protected abstract String [ ] getObsoleteDirPath ( ) { } }

Fix:
File f = new File ( searchdir , ( ( prefix + ( pdbId . toLowerCase ( ) ) ) + ex ) ) ;