Buggy code:
public class MultipartRequestHandler { public static List < FileItem > getUploadRequestFileItems ( HttpServletRequest request ) throws FileUploadException { } public static String getDatasetName ( List < FileItem > items ) { } public static List < FileUploadRequest > uploadByApacheFileUpload ( List < FileItem > items , File datadir , Session session ) throws IOException { List < FileUploadRequest > files = new LinkedList < FileUploadRequest > ( ) ; FileUploadRequest temp = null ; String datasetName = null ; String datasetLabel = null ; String datasetApp = null ; String operation = null ; String inputCsv = null ; String inputJson = null ; for ( FileItem item : items ) { if ( item . isFormField ( ) ) { if ( item . getFieldName ( ) . equals ( "DatasetName" ) ) { datasetName = item . getString ( ) ; if ( ( datasetName != null ) && ( ! ( datasetName . isEmpty ( ) ) ) ) { datasetLabel = datasetName ; datasetName = ExternalFileSchema . createDevName ( datasetName , "Dataset" , 1 ) ; } } if ( item . getFieldName ( ) . equals ( "DatasetApp" ) ) datasetApp = item . getString ( ) ; if ( item . getFieldName ( ) . equals ( "Operation" ) ) operation = item . getString ( ) ; if ( item . getFieldName ( ) . equals ( "inputCsv" ) ) inputCsv = item . getString ( ) ; if ( item . getFieldName ( ) . equals ( "inputJson" ) ) inputJson = item . getString ( ) ; } else { if ( ( ( item . getSize ( ) ) > 0 ) && ( ( item . getInputStream ( ) ) != null ) ) { temp = new FileUploadRequest ( ) ; temp . setInputFileName ( item . getName ( ) ) ; temp . inputFileStream = item . getInputStream ( ) ; temp . setInputFileSize ( ( ( item . getSize ( ) ) + "" ) ) ; files . add ( temp ) ; } } } File parent = new File ( datadir , datasetName ) ; FileUtils . forceMkdir ( parent ) ; for ( FileUploadRequest fm : files ) { fm . setDatasetName ( datasetName ) ; fm . setDatasetLabel ( datasetLabel ) ; fm . setDatasetApp ( datasetApp ) ; fm . setOperation ( operation ) ; fm . setInputCsv ( inputCsv ) ; fm . setInputJson ( inputJson ) ; <START_BUG> File outFile = new File ( parent , ( ( session . getId ( ) ) + ".csv" ) ) ; <END_BUG> if ( fm . getInputFileName ( ) . equalsIgnoreCase ( inputJson ) ) { ExternalFileSchema schema = ExternalFileSchema . load ( fm . inputFileStream , Charset . forName ( "UTF-8" ) , System . out ) ; fm . setInputFileName ( ExternalFileSchema . getSchemaFile ( outFile , System . out ) . getName ( ) ) ; fm . setInputJson ( fm . getInputFileName ( ) ) ; outFile = new File ( parent , fm . getInputFileName ( ) ) ; ExternalFileSchema . save ( outFile , schema , System . out ) ; } else { FileOutputStream fos = null ; BufferedOutputStream bos = null ; try { fos = new FileOutputStream ( outFile ) ; bos = new BufferedOutputStream ( fos , DatasetUtilConstants . DEFAULT_BUFFER_SIZE ) ; IOUtils . copy ( fm . inputFileStream , bos ) ; } finally { if ( bos != null ) IOUtils . closeQuietly ( bos ) ; if ( fos != null ) IOUtils . closeQuietly ( fos ) ; } fm . setInputFileName ( outFile . getName ( ) ) ; fm . setInputCsv ( outFile . getName ( ) ) ; } fm . savedFile = outFile ; fm . setInputFileSize ( ( ( outFile . length ( ) ) + "" ) ) ; if ( ( outFile . length ( ) ) == 0 ) { throw new IllegalArgumentException ( ( ( "Input<seq2seq4repair_space>File<seq2seq4repair_space>{" + ( outFile . getName ( ) ) ) + "}<seq2seq4repair_space>is<seq2seq4repair_space>of<seq2seq4repair_space>zero<seq2seq4repair_space>length" ) ) ; } } return files ; } }

Fix:
File outFile = new File ( parent , ( ( ( datasetName + "_" ) + ( session . getId ( ) ) ) + ".csv" ) ) ;