Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 351423 - XML Schema from Java-Class is tried to be exported to a wrong (not existent) path
Summary: XML Schema from Java-Class is tried to be exported to a wrong (not existent) ...
Status: RESOLVED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: JAXB (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.0.1   Edit
Assignee: Tran Le CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-07 07:18 EDT by folkyvolk CLA
Modified: 2011-07-22 16:35 EDT (History)
1 user (show)

See Also:
neil.hauge: review+


Attachments
Proposed patch for 3.0.1 (3.33 KB, patch)
2011-07-21 17:54 EDT, Tran Le CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description folkyvolk CLA 2011-07-07 07:18:59 EDT
Build Identifier: 20110615-0604

To reproduce:
- Install eclipse indigo for java ee developers in linux 64 bit.
- have workspace in /home/username/workspace
- create a project with a JAXB tagged file (@xmlrootelement)
- try to create a XML schema for that file:
a) context-menu on project
b) choose "new" -> "other.."
c) choose "JAXB" -> "Schema from JAXB classes"
d) select your project
e) select your JAXB annotated file

--> an exception is thrown that the file
/home/youprojectname/yourschemaname.xsd does not exist

it can't, because the path should be
/home/username/workspace/youprojectname/yourschemaname.xsd

Reproducible: Always
Comment 1 Tran Le CLA 2011-07-12 10:13:41 EDT
What is the JAXB project platform, Generic or EclipseLink?
Also can you attach the exception stack trace. Thanks.
Comment 2 folkyvolk CLA 2011-07-14 06:35:32 EDT
Plattform is generic.

This is the console output:

loading...
my.class.path

generating schema...

Schema /home/myprojectname/NewXMLSchema1111.xsd generated14.07.2011 12:33:31 com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace writeTo
INFO: java.io.FileNotFoundException: /home/myprojectname/NewXMLSchema1111.xsd (No such file or directory)
com.sun.xml.txw2.TxwException: java.io.FileNotFoundException: /home/myprojectname/NewXMLSchema1111.xsd (No such file or directory)
	at com.sun.xml.txw2.output.StreamSerializer.<init>(StreamSerializer.java:76)
	at com.sun.xml.txw2.output.ResultFactory.createSerializer(ResultFactory.java:55)
	at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.writeTo(XmlSchemaGenerator.java:578)
	at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.access$700(XmlSchemaGenerator.java:474)
	at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator.write(XmlSchemaGenerator.java:456)
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.generateSchema(JAXBContextImpl.java:788)
	at org.eclipse.jpt.jaxb.core.schemagen.Main.generateSchema(Main.java:111)
	at org.eclipse.jpt.jaxb.core.schemagen.Main.generate(Main.java:80)
	at org.eclipse.jpt.jaxb.core.schemagen.Main.execute(Main.java:62)
	at org.eclipse.jpt.jaxb.core.schemagen.Main.main(Main.java:47)
Caused by: java.io.FileNotFoundException: /home/myprojectname/NewXMLSchema1111.xsd (No such file or directory)
	at java.io.FileOutputStream.open(Native Method)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:84)
	at com.sun.xml.txw2.output.StreamSerializer.<init>(StreamSerializer.java:72)
	... 9 more
java.io.IOException: java.io.FileNotFoundException: /home/myprojectname/NewXMLSchema1111.xsd (No such file or directory)
	at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.writeTo(XmlSchemaGenerator.java:679)
	at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.access$700(XmlSchemaGenerator.java:474)
	at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator.write(XmlSchemaGenerator.java:456)
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.generateSchema(JAXBContextImpl.java:788)
	at org.eclipse.jpt.jaxb.core.schemagen.Main.generateSchema(Main.java:111)
	at org.eclipse.jpt.jaxb.core.schemagen.Main.generate(Main.java:80)
	at org.eclipse.jpt.jaxb.core.schemagen.Main.execute(Main.java:62)
	at org.eclipse.jpt.jaxb.core.schemagen.Main.main(Main.java:47)

Also interesting the message

"Schema /home/myprojectname/NewXMLSchema1111.xsd generated"

although it is not generated, because that directory does not exist.
Comment 3 Tran Le CLA 2011-07-21 17:54:23 EDT
Created attachment 200131 [details]
Proposed patch for 3.0.1
Comment 4 Neil Hauge CLA 2011-07-22 09:40:00 EDT
(In reply to comment #3)
> Created attachment 200131 [details]
> Proposed patch for 3.0.1

Did you have a chance to test this change on Windows?
Comment 5 Tran Le CLA 2011-07-22 10:15:57 EDT
(In reply to comment #4)
> Did you have a chance to test this change on Windows?

Yes it was tested on Windows.
Comment 6 Neil Hauge CLA 2011-07-22 13:00:31 EDT
Only 1 minor thing to mention...in NewSchemaFileWizardPage.getFileRelativePath() there is a redundant call to getProject().  Other than that, looks good.
Comment 7 Tran Le CLA 2011-07-22 16:35:13 EDT
Applied to 3.0.1 stream and to head.