cannot generate classes with JAXB

前端 未结 2 974
無奈伤痛
無奈伤痛 2021-01-29 00:52

i try to generate classes using JAXB but I a get an exception : IllegalArgumentException: Illegal pattern character \'g\' I\'using a complex XSD file and a binding file as

相关标签:
2条回答
  • 2021-01-29 01:40

    I might guess that one of your xsd files have a regexp-based restriction attached to a type/element. Have you validated those files?

    0 讨论(0)
  • 2021-01-29 01:49

    At last I found the answer. The problem is due to a mistake in the class Options in the package com.sun.tools.xjc. In the method getPrologComment the class builds a localized message taking parameter fot date and time from a localized resource bundle, but then formats the date using a fixed Locale.ENGLISH. This behavior is inside JAXB 2.2.6. I solved the problem simply updating the file MessageBundle_it.properties (in my case for italian) in the package com\sun\tools\xjc\ of the jar file jaxb-xjc.jar. The changes I made was : Driver.DateFormat = aaaa.MM.gg (original) to Driver.DateFormat = yyyy/MM/dd (new) and Driver.TimeFormat = hh:mm:ss a z (original) to Driver.TimeFormat = HH:mm:ss (new) With those changes I was able to generate the classes as needed. HTH Flavio

    0 讨论(0)
提交回复
热议问题