xjc mark-generated sometimes produces a wrong date value
See original GitHub issueWhen using the parameter “-mark-generated” to generate the @Generated annotation, the content of the date attribute may be wrong.
In fact, the PM dates are wrong as they stay at the AM format.
It’s because the date pattern used for generating the ISO-8601 string is wrong. It’s “yyyy-MM-dd’T’hh:mm:ssZ” but it should be “yyyy-MM-dd’T’HH:mm:ssZ”
The code to fix is in com.sun.tools.xjc.addon.at_generated.PluginImpl
private String getISO8601Date() {
if(date==null) {
StringBuffer tstamp = new StringBuffer();
tstamp.append((new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ssZ")).format(new Date()));
// hack to get ISO 8601 style timezone - is there a better way that doesn't require
// a bunch of timezone offset calculations?
tstamp.insert(tstamp.length()-2, ':');
date = tstamp.toString();
}
return date;
}
Maven artifact : com.sun.xml.bind:jaxb-xjc:2.2.11
Thanks.
Environment
JDK 8, JDK 7
Affected Versions
[2.2.11]
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
2. XJC Ant Task - Java EE
A change in a schema or an external binding file often results in a Java file that stops being generated. To avoid such...
Read more >Getting Wrong Date Using XMLGregorianCalender
Calendar.YEAR is a contanst that represents the year field, not the year value (and its value is 1, that's why you're getting year...
Read more >Apache CXF Development Guide Red Hat Fuse 7.3
This element is where specifics such as parameter order and return values are ... However, the message in Example 10.2, “Invalid XML Binding...
Read more >Part III Web Services (The Java EE 5 Tutorial)
A client creates a proxy (a local object representing the service) and then simply invokes ... @XmlAnyElement ( lax = false, value =...
Read more >JAXB Release Documentation | Manualzz
JAXB-598 [https://github.com/javaee/jaxb-v2/issues/598]: XJC generates ordered ... wrong default value for "target" parameter for xjc ant task.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
2.3.4/3.0.1 having the fix are out already
Any news on this? I just encountered this issue.