faa-swim / fns-client

The System Wide Information Service (SWIM) Federal NOTAM System (FNS) Java Messaging Service (JMS) Reference Implementation (FnsClient) provides an example implementation on how to establish and maintain a local instance of the FNS NOTAM Database through the use of the FNS Initial Load (FIL) and SWIM FNS JMS services. FIL provides all active NOTAMS, via SFTP, that is required to initialize a NOTAM database and the SWIM JMS service provides, via JMS, NOTAM updates to keep the NOTAM database current. FIL also provides for re-initialization of a NOTAM database in the case of JMS service interruption.
Apache License 2.0
12 stars 6 forks source link

Error while parsing xml file from SFTP server #4

Closed rhishirajnema closed 3 years ago

rhishirajnema commented 3 years ago

Looks like there is some issue while parsing xml file during Notam db initialization.

java.io.IOException error ChannelSftp.java:1448 com.jcraft.jsch.ChannelSftp$2.read InflaterInputStream.java:243 java.util.zip.InflaterInputStream.fill InflaterInputStream.java:159 java.util.zip.InflaterInputStream.read GZIPInputStream.java:118 java.util.zip.GZIPInputStream.read XMLEntityManager.java:3064 com.sun.org.apache.xerces.internal.impl.XMLEntityManager$RewindableInputStream.read UTF8Reader.java:303 com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read XMLEntityScanner.java:1904 com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load XMLEntityScanner.java:1560 com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipChar XMLDocumentFragmentScannerImpl.java:2746 com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next XMLDocumentScannerImpl.java:605 com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next XMLNSDocumentScannerImpl.java:112 com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next XMLDocumentFragmentScannerImpl.java:534 com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument XML11Configuration.java:888 com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse XML11Configuration.java:824 com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse XMLParser.java:141 com.sun.org.apache.xerces.internal.parsers.XMLParser.parse AbstractSAXParser.java:1216 com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse SAXParserImpl.java:635 com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse FilParser.java:53 com.soschat.notam.source.fil.FilParser.parseFilFile FnsClient.java:259 com.soschat.notam.source.fns.FnsClient.loadNotams FnsClient.java:188 com.soschat.notam.source.fns.FnsClient.initalizeNotamDbFromFil FnsClient.java:105 com.soschat.notam.source.fns.FnsClient$2.onMissed MissedMessageTracker.java:161 us.dot.faa.swim.utilities.MissedMessageTracker.run

armFAActr commented 3 years ago

The FilClient provides an inputstream to the FIL file parser. If the config contains a filFIleSavePath then the FIL file is downloaded and a FileInputStream is provided. If no filFileSavePath is set then the inputstream returned is the sftp stream for the file. The later prevents the need to store the fil file before processing but does lead to the potential of an IO error if the sftp stream is interrupted before processing of the file is complete which is likely the cause here.

if (this.config.filFileSavePath != null && !this.config.filFileSavePath.isEmpty()) {
    filFileLocalPath = this.config.filFileSavePath.concat(this.config.filFileName);
    sftpChannel.get(this.config.filFileName, filFileLocalPath);
    return new GZIPInputStream(new FileInputStream(filFileLocalPath));
} else {
    return new GZIPInputStream(sftpChannel.get(this.config.filFileName));
}
rhishirajnema commented 3 years ago

Thank you, I will try that.

rhishirajnema commented 3 years ago

This looks like to be resolved. Thanks!