Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xjc mark-generated sometimes produces a wrong date value #1105

Closed
Tomas-Kraus opened this issue Sep 15, 2016 · 8 comments
Closed

xjc mark-generated sometimes produces a wrong date value #1105

Tomas-Kraus opened this issue Sep 15, 2016 · 8 comments

Comments

@Tomas-Kraus
Copy link
Member

When 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]

@Tomas-Kraus
Copy link
Member Author

@glassfishrobot Commented
Reported by ghusta

@Tomas-Kraus
Copy link
Member Author

@glassfishrobot Commented
Was assigned to yaroska

@Tomas-Kraus
Copy link
Member Author

@glassfishrobot Commented
michael-o said:
There is also another issue here: If the timezone is UTC, there must be a Z and not +00:00, so there are two bugs here.

@Tomas-Kraus
Copy link
Member Author

@glassfishrobot Commented
michael-o said:
The value has actually to be yyyy-MM-dd'T'HH:mm:ssXXX.

@Tomas-Kraus
Copy link
Member Author

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

@Tomas-Kraus
Copy link
Member Author

@volkert-fastned
Copy link

Any news on this? I just encountered this issue.

lukasj added a commit to lukasj/jaxb-ri that referenced this issue Mar 27, 2021
…date value

Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
@lukasj lukasj closed this as completed in 5b27c9f Mar 27, 2021
lukasj added a commit to lukasj/jaxb-ri that referenced this issue Apr 8, 2021
…date value

Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
@lukasj
Copy link
Member

lukasj commented Jun 3, 2021

2.3.4/3.0.1 having the fix are out already

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants