levigo / jbig2-imageio

A Java ImageIO plugin for the JBIG2 bi-level image format
Apache License 2.0
31 stars 19 forks source link

build tests fail if project path has a space #25

Closed THausherr closed 7 years ago

THausherr commented 7 years ago

I wanted to do a local build to test the snapshot with my test sets from work and from home. It worked fine at work but not at home. At home the tests fail at BitmapsChecksumTest.test() at this line

final InputStream inputStream = new FileInputStream(new File(imageUrl.getPath()));

java.io.FileNotFoundException: .....%20....\LevigoJBig2ImageIO\target\test-classes\images\042_1.jb2 (Das System kann den angegebenen Pfad nicht finden) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:195) at java.io.FileInputStream.(FileInputStream.java:138) at com.levigo.jbig2.image.BitmapsChecksumTest.test(BitmapsChecksumTest.java:127)

The reason is that my path has a space. This space is converted to "%20" which doesn't work.

Solutions:

final InputStream inputStream = new FileInputStream(new File(imageUrl.ToURI));

even better:

final InputStream inputStream = imageUrl.openStream();

ultimate:

final InputStream inputStream = JBIG2ImageReaderDemo.class.getResourceAsStream(resourcePath);