Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 312428

Summary: Generate jaxb schema without EclipseLink Moxy with spaces in a directory fails
Product: [WebTools] Dali JPA Tools Reporter: Karen Butzke <karenfbutzke>
Component: JAXBAssignee: Tran Le <tranle1>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: neil.hauge
Version: 2.3Flags: neil.hauge: review+
Target Milestone: 2.3.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
proposed patch
none
proposed patch none

Description Karen Butzke CLA 2010-05-11 10:02:04 EDT
Create a jpa project that does not have eclipselink moxy on the classpath. Select 'New' -> 'JAXB' -> 'Schema from JAXB Classes' and choose some classes.  You will see the 'Use EclipseLink MOXy as the JAXB implementation' checkbox unchecked.  Choose a schema location that has spaces in it on the Windows platform and press OK.

I generated to the C:\Documents and Settings\foo.xsd location and it generated a schema named Documents on the C drive.



If the workspace is in a location with spaces in the directories and you generate directly in to the workspace, the generation fails with:

java.io.FileNotFoundException: C:\Documents%20and%20Settings\kamoore\workspace\Foo\Foo.xsd (The system cannot find the path specified)

We need double quotes around the file name passed to the schema generator, at least on the windows platform
Comment 1 Tran Le CLA 2010-05-17 20:08:06 EDT
Created attachment 168842 [details]
proposed patch
Comment 2 Karen Butzke CLA 2010-05-18 16:42:00 EDT
I am still getting a file not found exception with this patch:

java.io.IOException: java.io.FileNotFoundException: C:\Eclipse\runtime-New_configuration\aaa\..\..\..\Documents%20and%20Settings\kamoore\My%20Documents\aaa.xsd (The system cannot find the path specified)
	at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.writeTo(XmlSchemaGenerator.java:698)
Comment 3 Karen Butzke CLA 2010-05-18 16:44:14 EDT
i spoke too soon, forgot i can't just apply the patch to my workspace and test it
Comment 4 Karen Butzke CLA 2010-05-18 17:04:38 EDT
Ok, now that I'm actually testing the patch, it looks good to me. Only testing on the windows platform
Comment 5 Neil Hauge CLA 2010-05-18 20:18:20 EDT
I've reproduced the same errors on Linux regarding spaces.  I've also tested the patch on Linux and unfortunately the Generic JAXB schema generation does not appear to work (with or without spaces) with the patch applied.  Everything appears to complete normally (with or without spaces, but the XSD file is never created to disk.

I removed the patch to ensure that the function worked in a non-space environment and have confirmed that it does, so this patch does appear to degrade a working scenario on Linux.  I'll do some more testing to confirm these results.
Comment 6 Tran Le CLA 2010-06-24 14:35:51 EDT
Created attachment 172661 [details]
proposed patch
Comment 7 Neil Hauge CLA 2010-06-30 13:10:44 EDT
New patch doesn't regress functionality on Linux.

Patch committed for 2.3.1 and head.