Skip to content

Commit

Permalink
Importer: Change Error Msg to Submit User to not include file on disk
Browse files Browse the repository at this point in the history
Change all creation of ProxlImporterDataException in scan file
processing to not include the filename and path of the scan file on disk
since that info is not relevant and should not be shared.
  • Loading branch information
danjasuw committed Oct 17, 2018
1 parent 270549a commit aff5b66
Showing 1 changed file with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
import org.yeastrc.proxl.import_xml_to_db.utils.SHA1SumCalculator;

/**
*
* Ensure all contents of throw new ProxlImporterDataException(...)
* does not contain the scan filename and path on the file system.
*
*/
public class Process_MzML_MzXml_File {
Expand Down Expand Up @@ -140,7 +141,7 @@ public ScanFilenameScanNumberScanIdScanFileId_Mapping processMzMLFileWithScanNum
}

mapOfScanNumbersToScanIds =
processAllScan( scanFileReader, scanNumbersToLoad, scanFileWithPath, scanFileDTO, newScanFileRecord );
processAllScan( scanFileReader, scanNumbersToLoad, scanFileWithPath, scanFileName, scanFileDTO, newScanFileRecord );

// Send scan file to Spectral Storage Service for storage, will update proxl.scan_file record with returned API key
// Send after import to Proxl DB to ensure it is valid first and scans match Proxl Input XML file.
Expand All @@ -164,10 +165,12 @@ public ScanFilenameScanNumberScanIdScanFileId_Mapping processMzMLFileWithScanNum
log.error( msg, e );
throw new ProxlImporterInteralException( msg, e );
} catch ( Exception e ) {
String msg = "Error Exception processing mzML or mzXml Scan file: " + scanFileWithPath.getAbsolutePath()
String msg = "Error Exception processing mzML or mzXml Scan file: "
+ scanFileWithPath.getAbsolutePath()
+ ", scanFileName (possibly different if uploaded) (reported to user submitting upload): " + scanFileName
+ ", Throwing Data error since probably error in file format.";
log.error( msg, e );
String msgForException = "Error processing Scan file: " + scanFileWithPath.getAbsolutePath()
String msgForException = "Error processing Scan file: " + scanFileName
+ ". Please check the file to ensure it contains the correct contents for a scan file based on the suffix of the file ('mzML' or 'mzXML')";
throw new ProxlImporterDataException( msgForException );
} finally {
Expand Down Expand Up @@ -278,7 +281,9 @@ private List<ScanFileHeaderDTO> getHeaders( MzML_MzXmlHeader mzXmlHeader ) {
* @return mapOfScanNumbersToScanIds
* @throws Exception
*/
private Map<Integer,Integer> processAllScan( MzMl_MzXml_FileReader scanFileReader, int[] scanNumbersToLoad, File scanFileWithPath, ScanFileDTO scanFileDTO, boolean newScanFileRecord ) throws Exception {
private Map<Integer,Integer> processAllScan(
MzMl_MzXml_FileReader scanFileReader, int[] scanNumbersToLoad, File scanFileWithPath, String scanFileName_ForErrorMessages,
ScanFileDTO scanFileDTO, boolean newScanFileRecord ) throws Exception {

Map<Integer,Integer> mapOfScanNumbersToScanIds = new HashMap<>();
boolean[] insertedScanNumberAtIndex = null;
Expand Down Expand Up @@ -371,10 +376,13 @@ private Map<Integer,Integer> processAllScan( MzMl_MzXml_FileReader scanFileReade
// log.error( msg, e );
// throw new ProxlImporterInteralException( msg, e );
} catch ( Exception e ) {
String msg = "Error Exception processing mzML or mzXml Scan file: " + scanFileWithPath.getAbsolutePath()
String msg = "Error Exception processing mzML or mzXml Scan file: "
+ scanFileWithPath.getAbsolutePath()
+ ", scanFileName (possibly different if uploaded) (reported to user submitting upload): " + scanFileName_ForErrorMessages
+ scanFileName_ForErrorMessages
+ ", Throwing Data error since probably error in file format.";
log.error( msg, e );
String msgForException = "Error processing Scan file: " + scanFileWithPath.getAbsolutePath()
String msgForException = "Error processing Scan file: " + scanFileName_ForErrorMessages
+ ". Please check the file to ensure it contains the correct contents for "
+ "a scan file based on the suffix of the file ('mzML' or 'mzXML')";
throw new ProxlImporterDataException( msgForException );
Expand All @@ -395,11 +403,17 @@ private Map<Integer,Integer> processAllScan( MzMl_MzXml_FileReader scanFileReade
}
if ( scanNumbersNotInsertedSB != null ) {
String scanNumbersNotInserted = scanNumbersNotInsertedSB.toString();
String msg = "ERROR: For Scan File: " + scanFileReader.getFileName()
String msg = "Error Exception processing mzML or mzXml Scan file: "
+ scanFileWithPath.getAbsolutePath()
+ ", scanFileName (possibly different if uploaded) (reported to user submitting upload): " + scanFileName_ForErrorMessages
+ scanFileName_ForErrorMessages
+ ", the following scan numbers were in the main import XML file but not in the scan file: "
+ scanNumbersNotInserted;
log.error( msg );
throw new ProxlImporterDataException(msg);
String msgForException = "Error processing Scan file: " + scanFileName_ForErrorMessages
+ ", the following scan numbers were in the main import XML file but not in the scan file: "
+ scanNumbersNotInserted;
throw new ProxlImporterDataException(msgForException);
}
}
if ( log.isInfoEnabled() ) {
Expand Down

0 comments on commit aff5b66

Please sign in to comment.