HRM documents that include a # (hash) in the generated filename fail to load silently

Preconditions

Have HRM enabled

Steps to Reproduce

1. Receive a HRM document that includes a # in the username such as:

20180724174840910_123412345_4265_MR_GI90#eScript_3004675_20180724174800_0400000_P__F_11111111111_46_90772.xml

Expected Result

The file is parsed and added to OSCAR, including the patient's inbox.

Observed Result

This error is thrown instead:

[HRMReportParser:111] error
javax.xml.bind.UnmarshalException

  • with linked exception:
    [java.io.FileNotFoundException: C:\Tomcat8.5\webapps\OscarDocument\oscar\document\20180724174840910_123412345_4265_MR_GI90 (The system cannot find the file specified)]

...

org.oscarehr.hospitalReportManager.HRMReportParser.parseReport(HRMReportParser.java:101)
at org.oscarehr.hospitalReportManager.SFTPConnector.startAutoFetch(SFTPConnector.java:625)

Most importantly, the file does not appear in the patient's chart.

Additional Comments

In looking at the function public static HRMReport parseReport(LoggedInInfo loggedInInfo, String hrmReportFileLocation) we think hrmReportFileLocation contains the full file location, including the #.

At line 101 (below), when a file with a filename including a # is passed, it seems to break.

root = (OmdCds) u.unmarshal(tmpXMLholder);

We created a proof of concept to isolate this bug where we created a small program where we passed a file with a # in the filename to create a similar error, and once the # was removed from the filename, the error resolved.

We are testing a patch in line with the suggestion here: https://stackoverflow.com/questions/30920810/jaxb-unmarshalexception-filename-containing - of passing a FileInputStream into the unmarshal function, instead of the File directly. i.e.

try (FileInputStream fis = new FileInputStream(tmpXMLholder)) {
root = (OmdCds) u.unmarshal(fis);
}

ONE final note:

Our main investigation / testing was done on a Windows Service machine. We do NOT think this is specific to windows, but we ran the following code on a ubuntu 16.04 LTS machine with default-jdk installed.

import java.io.*;
import javax.xml.bind.*;

public class A {
public static void main(String[] args) throws Exception {

File f = new File("~/abc#abc.txt");

JAXBContext jc = JAXBContext.newInstance();
Unmarshaller u = jc.createUnmarshaller();
u.unmarshal(f);

}
}

We got a very similar error showing a similar truncation problem:

Exception in thread "main" javax.xml.bind.UnmarshalException

  • with linked exception:
    [java.io.FileNotFoundException: /home/chimeadmin/~/abc (No such file or directory)]

Assignee

Unassigned

Reporter

Keith Chung

Labels

None

OSCAR Build Date

2018/06/16

OSCAR Build Tag

800

Client Browser

Firefox

Client OS

Windows 10

Are you or your organization planning on submitting a fix for this bug in the next 30 days?

No

Validated by Reporter

No

SourceForge Link

None

SourceForge Reporter

None

SourceForge Assigned To

None

SourceForge Date Created

None

SourceForge ID

None

Affects versions

Priority

8
Configure