OpenPojo / openpojo

POJO Testing & Identity Management Made Trivial
http://openpojo.com
Apache License 2.0
156 stars 40 forks source link

Exception for illegal character in path when having space in path (PojoClassFactory.getPojoClassesRecursively) #38

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a directory on Windows with one or more spaces in its namn.
2. Create a file that calls 
PojoClassFactory.getPojoClassesRecursively(packageName, null) with the package 
the same as the class. The file should be in a directory with a path containing 
a space. (Example file included: TriggerUriExceptionTest.java)
3. Run this first as a stand alone java program, as a test program in TestNG 
started from Maven and then using the exec-maven-plugin to execute it as a 
stand alone test program.

What is the expected output? What do you see instead?
It should be the same result in all cases but get an exception about "Illegal 
character in path" indicating problems to create URI in the exec-maven-plugin 
case. It is not clear that it is an Openpojo problem but the exception trace 
(see err) indicate that it might be.

What version of the product are you using? On what operating system?
Openpojo 0.4.3
exec-maven-plugin 1.1
Java 1.7.0_25
Apache Maven 3.0.5
Windows 7

Please provide any additional information below.

The same Maven execution was performed on a directory path that did not contain 
any spaces in its name and the problem did not occur.
This means that I have a workaround I could use.

Original issue reported on code.google.com by LHCper on 4 Sep 2013 at 2:54

Attachments:

GoogleCodeExporter commented 9 years ago
I tried to generate the error and I was unable, attached is a full eclipse 
project that I used.

Here is the output from the run I did locally:

[trimmed output just to highlight environement used]
java.runtime.name=Java(TM) SE Runtime Environment
java.vm.vendor=Oracle Corporation
java.vm.name=Java HotSpot(TM) 64-Bit Server VM
os.name=Windows 7
java.version=1.7.0_25
java.class.path=C:\Code\workspace\Test OpenPojo With 
Spaces\bin;C:\Apps\eclipse-java-indigo-SR1-win32\eclipse\plugins\org.junit_4.8.2
.v4_8_2_v20110321-1705\junit.jar;C:\Apps\eclipse-java-indigo-SR1-win32\eclipse\p
lugins\org.hamcrest.core_1.1.0.v20090501071000.jar;C:\Code\workspace\Test 
OpenPojo With 
Spaces\lib\openpojo-0.4.3.jar;/C:/Apps/eclipse-java-indigo-SR1-win32/eclipse/con
figuration/org.eclipse.osgi/bundles/169/1/.cp/;/C:/Apps/eclipse-java-indigo-SR1-
win32/eclipse/configuration/org.eclipse.osgi/bundles/167/1/.cp/;/C:/Apps/eclipse
-java-indigo-SR1-win32/eclipse/configuration/org.eclipse.osgi/bundles/168/1/.cp/

file:/C:/Code/workspace/Test%20OpenPojo%20With%20Spaces/bin/test/TestCase.class
file:/C:/Code/workspace/Test%20OpenPojo%20With%20Spaces/bin/test/sample/EmptyCla
ss.class
file:/C:/Code/workspace/Test%20OpenPojo%20With%20Spaces/bin/test/sample/EmptyInt
erface.class

Can you please try with the attached zip project on eclipse and let me know if 
you still have an issue... (I am wondering if the directory path had some 
special character other than space that broke the run).

Original comment by oshou...@gmail.com on 8 Sep 2013 at 10:13

Attachments:

GoogleCodeExporter commented 9 years ago
It seems the "%20" is not added to the paths when executing from Maven?

I imported your project into an Eclipse workspace that I had in the directory 
"C:\some dir".  It worked fine and the output I have put into the file 
output20130912.txt that I have attached.

In the same workspace I created a minimal Maven project that uses a Maven 
plugin to execute the java program. (This program works nice to execute 
separately, but crashes when executed via the Maven plugin.)
When executing it gives:
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.1:java 
(trigger_uri_exception) on project issue: An exception occured while executing 
the Java class. null: InvocationTargetException: Illegal character in path at 
index 13: file:/C:/some dir/issue/target/classes/openpojo/issue -> [Help 1]

As can be seen, it does point at the space in "some dir", and no other strange 
characters is involved (unless there is some problem with slashes). But I got 
the same output in both MINGW32 and windows Command shell.

I include that eclipse project as well. Maybe you could test?  
Just do "mvn package" och "mvn -e package" in a MINGW32 bash or a Windows 
command shell.

I use:
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 
14:51:28+0100)
Maven home: c:\Maven\apache-maven-3.0.5
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: c:\Java\32\jdk1.7.0_25\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"

BTW, when incorporating TestCase in "my" project it works (after changing 
package name and asserts) from Eclipse as well.

Original comment by LHCper on 12 Sep 2013 at 11:46

Attachments:

GoogleCodeExporter commented 9 years ago
I have checked in a new version for the file system handling that should 
hopefully handle this issue once and for all... 

I am attaching the openpojo-0.5.1-SNAPSHOT.jar, if you can validate that this 
resolved the issue fully on your end, I can close this issue and make this part 
of the next formal release.

Thank you!

Original comment by oshou...@gmail.com on 14 May 2014 at 1:09

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by oshou...@gmail.com on 8 Jul 2014 at 7:05

GoogleCodeExporter commented 9 years ago
Fixed in release OpenPojo-0.5.1.

Original comment by oshou...@gmail.com on 8 Jul 2014 at 7:06