When I run the command line utility from Linux (with any argument) I get a null pointer exception. I get the same if I use a command file as well.
~ > java -jar ./CSVComparator/CSVComparatorCLI_java8.jar -config.loglevel.console=ALL -config.loglevel.file=OFF –older.file=./temp/compareold/CompFile.tab -older.delimiter=',' -older.label=old –younger.file=./temp/comparenew/CompFile.tab -younger.delimiter=',' -younger.label=new -column.identifier=ID,ID -result.file=./temp/compareout.txt -result.delimiter=';' -result.comparediff=false -result.comparediff%=false -result.comparestring=true
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.NullPointerException
at java.io.File.<init>(File.java:277)
at com.csvapi.compare.CSVAPICompare.compareCSVWriteResult(CSVAPICompare.java:48)
at com.csvcomparator.cli.main.CSVComparatorCLI.main(CSVComparatorCLI.java:55)
... 5 more
~ > ll ./temp/comparenew/CompFile.tab
-rwxr-xr-x 1 nobody nobody 84 Nov 11 22:03 ./temp/comparenew/CompFile.tab
~ > ll ./temp/compareold/CompFile.tab
-rwxr-xr-x 1 nobody nobody 94 Nov 11 22:04 ./temp/compareold/CompFile.tab
~ > ll ./temp/compareout.txt
-rw-r--r-- 1 nobody nobody 0 Nov 11 22:48 ./temp/compareout.txt</init>
~ > ll csvapi.log
-rw-r--r-- 1 nobody nobody 0 Nov 12 10:04 csvapi.log
java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
~/temp > echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-oracle-1.8.0.45-1jpp.2.el7_1.x86_64/jre
I have tried three different versions of Java 8 with the same result. Any ideas? Thanks!
FYI, the below gives the same error, so it seems not to be due to the file or other config parameters.
Hi Martin,
this is thrown by the following line in the code:
//-------------------------------------
// Compare if both file exists and are readable
//-------------------------------------
if(new File(olderFile).canRead() && new File(youngerFile).canRead()){
Just to be sure that everything is okay with the paths, can you try to copy the .jar and the files you want to compare all in the same directory and try it again?
Cheers
xresch
Hi xresch
Both files are readable from the same bash command line as the utility:
~ > if [[ -r ./temp/comparenew/CompFile.tab ]] ; then echo "File is
readable"; else "file is not readable"; fi;
File is readable
~ > if [[ -r ./temp/compareold/CompFile.tab ]] ; then echo "File is
readable"; else "file is not readable"; fi;
File is readable
Martin.
On Mon, Nov 13, 2017 at 5:09 PM, xresch xresch@users.sf.net wrote:
Related
Tickets:
#2I also ran a basic java program and it can read the file too
~ > java Test
canRead ./temp/comparenew/CompFile.tab
ID,Data 1,Data 2
1,ABC,123
2,DEF,456
3,HIJ,789
4,KJM,012
7,RST,678
5,OPQ,345
8,UVW,910
See attached for the program
On Mon, Nov 13, 2017 at 7:05 PM, Martin Le Brun martinlebrun3141@gmail.com
wrote:
Related
Tickets:
#2I can reproduce the exception with
import java.io.*;
public class Test {
public static void main(String [] args) {
}
~ > javac Test.java && java Test
Exception in thread "main" java.lang.NullPointerException
at java.io.File.<init>(File.java:277)
at Test.main(Test.java:9)</init>
Have I got the names of the attributes correct - and the format of their
values?
–younger.file=./temp/comparenew/CompFile.tab
–older.file=./temp/compareold/CompFile.tab
(The same error occurs if I put the attributes into a configuration file)
Thanks again for your help,
Martin
On Mon, Nov 13, 2017 at 7:29 PM, Martin Le Brun martinlebrun3141@gmail.com
wrote:
Related
Tickets:
#2Hi Martin,
I was not able to reproduce this issue, also when I googled for the exception message / stacktrace this seems to be something that happens from time to time for a unknown reason(most probably some various environmental factors.)
I saw your 4 star review(thanks for the first review =) ) and it seems you got what you need through the GUI, so I wil close this defect.
Thank you for looking at this, xresh. I tend to agree that is is probably
some environmental issue. I will try other environments and configurations,
and will let you know if I figure anything out that would help make your
utility even better.
Regards,
Martin Le Brun.
On Sat, Nov 25, 2017 at 3:59 AM, xresch xresch@users.sf.net wrote:
Related
Tickets:
#2