Buggy code:
public class EgiApplianceImageStoragePlugin implements ImageStoragePlugin { private static final String PROP_STATIC_IMAGE_PREFIX = "image_storage_static_" ; private static final Logger LOGGER = Logger . getLogger ( EgiApplianceImageStoragePlugin . class ) ; private static final Executor IMAGE_DOWNLOADER = Executors . newFixedThreadPool ( 5 ) ; private ComputePlugin computePlugin ; private Set < String > pendingImageUploads = Collections . newSetFromMap ( new ConcurrentHashMap < String , Boolean > ( ) ) ; private Map < String , String > globalToLocalIds = new HashMap < String , String > ( ) ; private final String marketPlaceBaseURL ; private final String keystorePath ; private final String tmpStorage ; private final String keystorePassword ; public EgiApplianceImageStoragePlugin ( Properties properties , ComputePlugin computePlugin ) { } private void fillStaticStorage ( Properties properties ) { } @ Override public String getLocalId ( Token token , String globalId ) { } private void scheduleImageDownload ( final Token token , final String imageURL ) { if ( pendingImageUploads . contains ( imageURL ) ) { EgiApplianceImageStoragePlugin . LOGGER . debug ( ( ( "Download<seq2seq4repair_space>of<seq2seq4repair_space>image<seq2seq4repair_space>" + imageURL ) + "<seq2seq4repair_space>is<seq2seq4repair_space>been<seq2seq4repair_space>done." ) ) ; return ; } pendingImageUploads . add ( imageURL ) ; EgiApplianceImageStoragePlugin . IMAGE_DOWNLOADER . execute ( new Runnable ( ) { @ Override public void run ( ) { File downloadTempFile = downloadTempFile ( imageURL ) ; EgiApplianceImageStoragePlugin . LOGGER . debug ( ( ( "Download<seq2seq4repair_space>of<seq2seq4repair_space>image<seq2seq4repair_space>" + imageURL ) + "<seq2seq4repair_space>was<seq2seq4repair_space>done." ) ) ; if ( downloadTempFile != null ) { <START_BUG> String extension = getExtension ( downloadTempFile . getAbsolutePath ( ) ) ; <END_BUG> String diskFormat = null ; if ( extension . equalsIgnoreCase ( OVA ) ) { File outputDir = new File ( ( ( ( tmpStorage ) + "//" ) + ( UUID . randomUUID ( ) ) ) ) ; outputDir . mkdirs ( ) ; try { List < File > files = EgiApplianceImageStoragePlugin . unTar ( downloadTempFile , outputDir ) ; for ( File file : files ) { String ovaExtDisk = getExtension ( file . getAbsolutePath ( ) ) ; if ( isValidDiskFormat ( ovaExtDisk ) ) { try { computePlugin . uploadImage ( token , file . getAbsolutePath ( ) , normalizeImageName ( removeHTTPPrefix ( imageURL ) ) , ovaExtDisk ) ; } catch ( Throwable e ) { EgiApplianceImageStoragePlugin . LOGGER . error ( "Couldn't<seq2seq4repair_space>upload<seq2seq4repair_space>image." , e ) ; } break ; } } for ( File file : outputDir . listFiles ( ) ) { file . delete ( ) ; } outputDir . delete ( ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } catch ( ArchiveException e ) { e . printStackTrace ( ) ; } return ; } if ( ( extension . equalsIgnoreCase ( QCOW2 ) ) || ( extension . equalsIgnoreCase ( IMG ) ) ) { diskFormat = QCOW2 ; } else if ( ( ( ( ( extension . equalsIgnoreCase ( VMDK ) ) || ( extension . equalsIgnoreCase ( VDI ) ) ) || ( extension . equalsIgnoreCase ( ISO ) ) ) || ( extension . equalsIgnoreCase ( RAW ) ) ) || ( extension . equalsIgnoreCase ( VHD ) ) ) { diskFormat = extension . toLowerCase ( ) ; } try { computePlugin . uploadImage ( token , downloadTempFile . getAbsolutePath ( ) , normalizeImageName ( removeHTTPPrefix ( imageURL ) ) , diskFormat ) ; } catch ( Throwable e ) { EgiApplianceImageStoragePlugin . LOGGER . error ( "Couldn't<seq2seq4repair_space>upload<seq2seq4repair_space>image." , e ) ; } } pendingImageUploads . remove ( imageURL ) ; } private boolean isValidDiskFormat ( String extension ) { return ( ( ( ( extension . equalsIgnoreCase ( VMDK ) ) || ( extension . equalsIgnoreCase ( VDI ) ) ) || ( extension . equalsIgnoreCase ( ISO ) ) ) || ( extension . equalsIgnoreCase ( RAW ) ) ) || ( extension . equalsIgnoreCase ( VHD ) ) ; } } ) ; } private String normalizeImageName ( final String imageURL ) { } private File downloadTempFile ( final String imageURL ) { } private String getExtension ( final String imageName ) { } private String removeHTTPPrefix ( String imageURL ) { } private static List < File > unTar ( final File inputFile , final File outputDir ) throws FileNotFoundException , IOException , ArchiveException { } private void injectKeystore ( HttpClient httpclient ) throws Exception { } protected String createURL ( String globalId ) { } }

Fix:
String extension = getExtension ( imageURL ) ;