eclipse-ee4j / jaxb-ri

Jaxb RI
https://eclipse-ee4j.github.io/jaxb-ri/
BSD 3-Clause "New" or "Revised" License
202 stars 110 forks source link

Namespace with # not getting replaced to _ in 2.2 as it was in 2.1 #907

Open Tomas-Kraus opened 12 years ago

Tomas-Kraus commented 12 years ago

If the namespace has '#' in it, JAXB RI 2,1 used to convert it to "", but in 2,2 it is just removing and replace to "" is not happening.

Testcase:

You can reproduce by compiling the following schema with XJC:

<?xml version='1.0' encoding='UTF-8'?> <xs:schema targetNamespace='http://example.com/abc#' xmlns:xs='http://www.w3.org/2001/XMLSchema'>

Output from JAXB 2.1 tools: D:\schemas\example>xjc example.xsd parsing a schema... compiling a schema... com\example\abc_\ExampleType.java com\example\abc_\ObjectFactory.java com\example\abc_\package-info.java Output from JAXB 2.2 tools: D:\schemas\example>xjc example.xsd parsing a schema... compiling a schema... com\example\abc\ExampleType.java com\example\abc\ObjectFactory.java com\example\abc\package-info.java Notice that the underscore '_' was removed from the package name. SPEC * * * Here is what SPEC talks about handling namespaces in such a scenario. From Section D.5.1 Mapping from a Namespace URI " a. If the sting component contains a hyphen, or any other special character not allowed in an identifier, convert it into an underscore. b. If any of the resulting package name components are keywords then append underscore to them. c. If any of the resulting package name components start with a digit, or any other character that is not allowed as an initial character of an identifier, have an underscore prefixed to the component. " Problem Analysis: Upon analysis, Identified that the problem is because of Issue 709. [http://java.net/jira/browse/JAXB-709](http://java.net/jira/browse/JAXB-709) , Core problem as described in the link "com.sun.istack.SAXParseException2: The package name 'org.etsi.uri.trstsvc.svcinfoext.esigdir_1999_93_ec_trustedlist.__#' used for this schema is not a valid package name. where the namespace on the schema is: targetNamespace="http://uri.etsi.org/TrstSvc/SvcInfoExt/eSigDir-1999-93-EC-TrustedList/#"" Here for addressing this, according to SPEC above I think namespace needs to convert the package name in targetNamespace="http://uri.etsi.org/TrstSvc/SvcInfoExt/eSigDir-1999-93-EC-TrustedList/#" from "#" to "http://uri.etsi.org/TrstSvc/SvcInfoExt/eSigDir-1999-93-EC-TrustedList/__", according to SPEC definition. But instead, the fix for Issue - 709 addresses this by removing of special character "#", which is not correct as per SPEC. #### Affected Versions [2.2.5]
Tomas-Kraus commented 6 years ago
Tomas-Kraus commented 12 years ago

@glassfishrobot Commented Reported by jayashree_viswanathan

Tomas-Kraus commented 12 years ago

@glassfishrobot Commented jayashree_viswanathan said: Attached file has the fix for this issue

Tomas-Kraus commented 12 years ago

@glassfishrobot Commented jayashree_viswanathan said: Hi can you please look at this patch .

Tomas-Kraus commented 12 years ago

@glassfishrobot Commented snajper said: Yardo, would you please review this?

Tomas-Kraus commented 12 years ago

@glassfishrobot Commented yaroska said: Hi, Jayashree,

Can you please sign Oracle Contributor Agreement (OCA). We need it to start working with your code. Here are some links:

FAQ: http://www.oracle.com/technetwork/oca-faq-405384.pdf OCA: http://glassfish.java.net/public/GovernancePolicy.html

Thanks a lot.

Tomas-Kraus commented 12 years ago

@glassfishrobot Commented jayashree_viswanathan said: Yardo ,

Thanks for the response . I have mailed you the details .

Jayashree V

Tomas-Kraus commented 12 years ago

@glassfishrobot Commented jayashree_viswanathan said: Hi Yardo ,

Any updates here ?

Tomas-Kraus commented 12 years ago

@glassfishrobot Commented yaroska said: Hi, Jayashree,

These changes were integrated. But we can't release them yet. "Buggy" behavior is in JDK now, so for backwards compatibility we have to implement switch which will allow to choose.

Tomas-Kraus commented 11 years ago

@glassfishrobot Commented jayashree_viswanathan said: Can you please share more information on what is the buggy behavior ?

Tomas-Kraus commented 11 years ago

@glassfishrobot Commented yaroska said: I meant that this bug is in JDK.

Tomas-Kraus commented 11 years ago

@glassfishrobot Commented jayashree_viswanathan said: Have sent another patch with backward compatibility for JDK purposes , not able to attach the diff though to the same work-item as the Attachment option is disabled for this item now for me .

Tomas-Kraus commented 12 years ago

@glassfishrobot Commented File: diff.patch Attached By: jayashree_viswanathan

Tomas-Kraus commented 12 years ago

@glassfishrobot Commented Was assigned to yaroska

Tomas-Kraus commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA JAXB-907