monarch-initiative / loinc2hpo

Java library to map LOINC-encoded test results to Human Phenotype Ontology
http://loinc2hpo.readthedocs.io/en/latest/
Other
30 stars 8 forks source link

Error when using mvn install #151

Open morales-felix opened 3 years ago

morales-felix commented 3 years ago

This is Felix, from Northwestern.

In trying to deploy the library on my Windows 10 machine, I encountered this error:

Test set: org.monarchinitiative.loinc2hpocore.io.LoincTableCoreParserTest

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.114 s <<< FAILURE! - in org.monarchinitiative.loinc2hpocore.io.LoincTableCoreParserTest org.monarchinitiative.loinc2hpocore.io.LoincTableCoreParserTest.testParser Time elapsed: 0.072 s <<< FAILURE! org.opentest4j.AssertionFailedError: expected: <28> but was: <0> at org.monarchinitiative.loinc2hpocore.io.LoincTableCoreParserTest.testParser(LoincTableCoreParserTest.java:33)

When looking at LoincTableCoreParserTest, it seems to read a file. Could it be that such file is empty when I clone the repository?

pnrobinson commented 3 years ago

The test starts with this

 URL url = LoincTableCoreParserTest.class.getClassLoader().getResource("LoincTableCoreTiny.csv");
        if (url==null) {
            throw new Loinc2HpoRuntimeException("Could not get path to \"LoincTableCoreTiny.csv\"");
        }
        LoincTableCoreTinyPath = url.getPath();

It reads a file src/test/resources/LoincTableCoreTiny.csv and if it does not find the file it throws a different exception. Can you see the file on your computer?

morales-felix commented 3 years ago

Just checked that path, and I do have that file. It has 28 lines. The error I get when installing suggests that the file is being read, but for some reason it counts 0 lines present in the file.

pnrobinson commented 3 years ago

Are you using IntelliJ? Any chance you could run this in a debugger? It is working on my side...

morales-felix commented 2 years ago

Will get back to you this week about that.

morales-felix commented 2 years ago

Solved the problem, there was an issue with the path to the directory onto which I cloned this repository. Specifically, my path had the following feature: "...\Northwestern's files...", and the issue was solved by switching to "...\Northwestern_files...". It's working now.

It took me a bit to figure out what was going on in part because of my unfamiliarity with Java and Maven. But I also noticed that once the LoincParser was unable to open the path to the file, code continued executing and printing. Would suggest crashing or stopping execution of the code when reaching line 55 at LoincTableCoreParser.java (the exception catcher).

Edit: I realize the above code could be expected to catch a path error, but in my case, it is likely that the code did find a string representing the path, but could not infer the actual path.