This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 182984 - Model files generated by xjc stop a build on cp936 locale Windows
Summary: Model files generated by xjc stop a build on cp936 locale Windows
Status: VERIFIED FIXED
Alias: None
Product: webservices
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: PC Windows 7 x64
: P3 normal (vote)
Assignee: Denis Anisimov
URL:
Keywords: NETFIX
: 214830 216899 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-03-27 08:47 UTC by johnsonlau
Modified: 2013-02-12 09:23 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Patch for nbbuild ant script (resolving build error on cp936 windows) (7.05 KB, patch)
2010-03-29 15:33 UTC, johnsonlau
Details | Diff
Fix for build script (1.44 KB, patch)
2012-07-02 17:44 UTC, ramis
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description johnsonlau 2010-03-27 08:47:21 UTC
Model files generated by xjc contain localized generating timestamps,
like a Chinese word indicating AM/PM is used on a Chinese environment.

// Generated on: 2010.03.27 at 09:18:24 上午 CST 

Encodings of the generated files will be the default system locale,
and It's known that the default locale is localized-specified on Windows,
so the characters above are GB2312/GBK (cp936) characters but UTF-8.
If you compiles the files in UTF-8, you might get an error complaining about
the unmappable character encountered.

It will stop a build on a cp936 Windows system,
and actually it causes me failed to build the websvc.saas.api module.

compile target in websvc.saas.api simply calls a global compile target in nbbuild/templates/common.xml.
This compile target prefers UTF-8 in general

    <target name="compile" depends="init,up-to-date" unless="is.jar.uptodate">
        <mkdir dir="${build.classes.dir}"/>
        ...
        <nb-javac srcdir="${src.dir}" destdir="${build.classes.dir}" debug="${build.compiler.debug}" debuglevel="${build.compiler.debuglevel}" encoding="UTF-8"
                deprecation="${build.compiler.deprecation}" optimize="${build.compiler.optimize}" source="${javac.source}" target="${javac.target}" includeantruntime="false">
            <classpath refid="cp"/>
            <compilerarg line="${javac.compilerargs}"/>
            <processorpath refid="processor.cp"/>
        </nb-javac>
        ...
    </target>
which will cause the compile error.

This problem can be solved in two ways - to change the generated file's encoding to UTF-8, or simply compile the file in the default encoding but UTF-8.

Since xjc doesn't provide a way to modify the encoding
(I searched online and got nothing about this),
I think it is better and much simplier to define a target to compile files in default encoding.

I will be working on this issue if this solution has been approved.
Comment 1 johnsonlau 2010-03-29 15:32:23 UTC
I added a macrodef javac-compile to handle all java file compling invocations in template/common.xml.

The current compile and compile-single target is changed to call the javac-compile macro to perform a compile task in UTF-8 encoding.

Then two new target compile-file-encoding and compile-single-file-encoding added to perform the same thing except that in the system encoding (${file.encoding}).

In websvc.saas.api module, the compile target depends on compile-file-encoding instead of compile target.
Comment 2 johnsonlau 2010-03-29 15:33:16 UTC
Created attachment 96241 [details]
Patch for nbbuild ant script (resolving build error on cp936 windows)
Comment 3 Jesse Glick 2010-03-31 03:49:40 UTC
Do not use nbbuild for product bugs.
Comment 4 Milan Kuchtiak 2010-03-31 08:57:04 UTC
Martin, is there any way to specify encoding of generated classes for xjc?
Comment 5 Martin Grebac 2010-03-31 09:30:55 UTC
Hi, JAXB does not have an encoding attribute for xjc specifically. Feel free to file RFE for JAXB at jaxb.dev.java.net.
Comment 6 Milan Kuchtiak 2010-04-01 09:08:20 UTC
I've reported JAXB bug:
https://jaxb.dev.java.net/issues/show_bug.cgi?id=747

As far as websvc.saas.api module, I doubt we can do anything unless xjc supports the encoding.
Comment 7 Denis Anisimov 2010-10-26 11:37:34 UTC
As already discussed xjc is external utility and xjc is the source of the
issue.
Comment 8 ramis 2012-07-02 17:44:45 UTC
Created attachment 121666 [details]
Fix for build script
Comment 9 ramis 2012-07-02 17:46:43 UTC
The bug is fixed in JAXB: the xjc task now supports the encoding attribute.
I modified the build script to use the encoding attribute.
Comment 10 markiewb 2012-08-29 19:11:14 UTC
*** Bug 216899 has been marked as a duplicate of this bug. ***
Comment 11 markiewb 2012-08-29 19:17:55 UTC
(In reply to comment #9)
> I modified the build script to use the encoding attribute.

@ramis: Is it already committed? If done, please set the target version and this issue to resolved.
Comment 12 Denis Anisimov 2012-09-03 06:56:41 UTC
web-main#b73c2b941746
Comment 13 Denis Anisimov 2012-09-03 06:57:34 UTC
*** Bug 214830 has been marked as a duplicate of this bug. ***
Comment 14 Quality Engineering 2012-09-04 01:11:00 UTC
Integrated into 'main-golden', will be available in build *201209040001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/b73c2b941746
User: Denis Anisimov <ads@netbeans.org>
Log: Fix for BZ#182984 - Model files generated by xjc stop a build on cp936 locale Windows
Comment 15 lcourtin 2012-11-29 10:29:30 UTC
We still have problem with NetBeans 7.3 Beta 2 :

Product Version: NetBeans IDE 7.3 Beta 2 (Build 201211062253)
Java: 1.7.0_09; Java HotSpot(TM) Client VM 23.5-b02
Runtime: Java(TM) SE Runtime Environment 1.7.0_09-b05
System: Windows 7 version 6.1 running on x86; Cp1252; fr_FR (nb)
User directory: C:\Work-SVN\HEAD3\JAVA\netbeans
Cache directory: C:\Work-SVN\HEAD3\JAVA\netbeans\var\cache

Here the output trace :
wsimport-client-generate:
Created dir: C:\Checkout-SVN\HEAD3\java\RCSDMTestWebServices\build\classes
Created dir: C:\Checkout-SVN\HEAD3\java\RCSDMTestWebServices\build\empty
Created dir: C:\Checkout-SVN\HEAD3\java\RCSDMTestWebServices\build\generated-sources\ap-source-output
Compiling 199 source files to C:\Checkout-SVN\HEAD3\java\RCSDMTestWebServices\build\classes
C:\Checkout-SVN\HEAD3\java\RCSDMTestWebServices\build\generated-sources\jax-ws\com\cadwin\service\rcsdm\Accessory.java:15: error: unmappable character for encoding UTF-8
 * <p>Le fragment de sch?ma suivant indique le contenu attendu figurant dans cette classe.
C:\Checkout-SVN\HEAD3\java\RCSDMTestWebServices\build\generated-sources\jax-ws\com\cadwin\service\rcsdm\Accessory.java:78: error: unmappable character for encoding UTF-8
     * Obtient la valeur de la propri?t? id.
C:\Checkout-SVN\HEAD3\java\RCSDMTestWebServices\build\generated-sources\jax-ws\com\cadwin\service\rcsdm\Accessory.java:78: error: unmappable character for encoding UTF-8
Comment 16 Denis Anisimov 2012-11-29 11:47:06 UTC
(In reply to comment #15)
> We still have problem with NetBeans 7.3 Beta 2 :
> 
> Product Version: NetBeans IDE 7.3 Beta 2 (Build 201211062253)
> Java: 1.7.0_09; Java HotSpot(TM) Client VM 23.5-b02
> Runtime: Java(TM) SE Runtime Environment 1.7.0_09-b05
> System: Windows 7 version 6.1 running on x86; Cp1252; fr_FR (nb)
> User directory: C:\Work-SVN\HEAD3\JAVA\netbeans
> Cache directory: C:\Work-SVN\HEAD3\JAVA\netbeans\var\cache
> 
> Here the output trace :
> wsimport-client-generate:
> Created dir: C:\Checkout-SVN\HEAD3\java\RCSDMTestWebServices\build\classes
> Created dir: C:\Checkout-SVN\HEAD3\java\RCSDMTestWebServices\build\empty
> Created dir:
> C:\Checkout-SVN\HEAD3\java\RCSDMTestWebServices\build\generated-sources\ap-source-output
> Compiling 199 source files to
> C:\Checkout-SVN\HEAD3\java\RCSDMTestWebServices\build\classes
> C:\Checkout-SVN\HEAD3\java\RCSDMTestWebServices\build\generated-sources\jax-ws\com\cadwin\service\rcsdm\Accessory.java:15:
> error: unmappable character for encoding UTF-8
>  * <p>Le fragment de sch?ma suivant indique le contenu attendu figurant dans
> cette classe.
> C:\Checkout-SVN\HEAD3\java\RCSDMTestWebServices\build\generated-sources\jax-ws\com\cadwin\service\rcsdm\Accessory.java:78:
> error: unmappable character for encoding UTF-8
>      * Obtient la valeur de la propri?t? id.
> C:\Checkout-SVN\HEAD3\java\RCSDMTestWebServices\build\generated-sources\jax-ws\com\cadwin\service\rcsdm\Accessory.java:78:
> error: unmappable character for encoding UTF-8

What kind of problem do you have exactly ?
The original issue is about NB build procedure. Exact module with the issue is
websvc.saas.api.
I don't see from your description how it relates to NB build procedure.
Comment 17 aeros 2012-11-29 13:14:13 UTC
(In reply to comment #16)
> (In reply to comment #15)
> > We still have problem with NetBeans 7.3 Beta 2 :
> > 
> > Product Version: NetBeans IDE 7.3 Beta 2 (Build 201211062253)
> > Java: 1.7.0_09; Java HotSpot(TM) Client VM 23.5-b02
> > Runtime: Java(TM) SE Runtime Environment 1.7.0_09-b05
> > System: Windows 7 version 6.1 running on x86; Cp1252; fr_FR (nb)
> > User directory: C:\Work-SVN\HEAD3\JAVA\netbeans
> > Cache directory: C:\Work-SVN\HEAD3\JAVA\netbeans\var\cache
> > 
> > Here the output trace :
> > wsimport-client-generate:
> > Created dir: C:\Checkout-SVN\HEAD3\java\RCSDMTestWebServices\build\classes
> > Created dir: C:\Checkout-SVN\HEAD3\java\RCSDMTestWebServices\build\empty
> > Created dir:
> > C:\Checkout-SVN\HEAD3\java\RCSDMTestWebServices\build\generated-sources\ap-source-output
> > Compiling 199 source files to
> > C:\Checkout-SVN\HEAD3\java\RCSDMTestWebServices\build\classes
> > C:\Checkout-SVN\HEAD3\java\RCSDMTestWebServices\build\generated-sources\jax-ws\com\cadwin\service\rcsdm\Accessory.java:15:
> > error: unmappable character for encoding UTF-8
> >  * <p>Le fragment de sch?ma suivant indique le contenu attendu figurant dans
> > cette classe.
> > C:\Checkout-SVN\HEAD3\java\RCSDMTestWebServices\build\generated-sources\jax-ws\com\cadwin\service\rcsdm\Accessory.java:78:
> > error: unmappable character for encoding UTF-8
> >      * Obtient la valeur de la propri?t? id.
> > C:\Checkout-SVN\HEAD3\java\RCSDMTestWebServices\build\generated-sources\jax-ws\com\cadwin\service\rcsdm\Accessory.java:78:
> > error: unmappable character for encoding UTF-8
> 
> What kind of problem do you have exactly ?
> The original issue is about NB build procedure. Exact module with the issue is
> websvc.saas.api.
> I don't see from your description how it relates to NB build procedure.

We have the same problem as origin, nb build crash because of "unmappable character for encoding UTF-8" when build execute "wsimport-client-generate" task
Comment 18 Denis Anisimov 2012-11-29 13:49:46 UTC
(In reply to comment #17)

> 
> We have the same problem as origin, nb build crash because of "unmappable
> character for encoding UTF-8" when build execute "wsimport-client-generate"
> task

What sources do you use ?
The bug is fixed in the 7.3 dev version.
Have you checked the issue with recent state of the source/build procedure ?
Comment 19 aeros 2012-11-29 13:54:04 UTC
(In reply to comment #18)
> (In reply to comment #17)
> 
> > 
> > We have the same problem as origin, nb build crash because of "unmappable
> > character for encoding UTF-8" when build execute "wsimport-client-generate"
> > task
> 
> What sources do you use ?
> The bug is fixed in the 7.3 dev version.
> Have you checked the issue with recent state of the source/build procedure ?

As we said we use NetBeans IDE 7.3 Beta 2 (Build 201211062253), that we download from http://download.netbeans.org/netbeans/7.3/beta2/ it is the dev version you are speaking about?
Comment 20 Denis Anisimov 2012-11-29 14:00:33 UTC
(In reply to comment #19)
> 
> As we said we use NetBeans IDE 7.3 Beta 2 (Build 201211062253), that we
> download from http://download.netbeans.org/netbeans/7.3/beta2/ it is the dev
> version you are speaking about?

I don't understand how do you use binary NB 7.3 beta but are speaking about 
nb build crash ?

How do you get an issue ? What is your usecase ? What is the steps ti reproduce ?
It seems you mixes two different issues.
Comment 21 aeros 2012-11-29 14:08:20 UTC
(In reply to comment #20)
> (In reply to comment #19)
> > 
> > As we said we use NetBeans IDE 7.3 Beta 2 (Build 201211062253), that we
> > download from http://download.netbeans.org/netbeans/7.3/beta2/ it is the dev
> > version you are speaking about?
> 
> I don't understand how do you use binary NB 7.3 beta but are speaking about 
> nb build crash ?
> 
> How do you get an issue ? What is your usecase ? What is the steps ti reproduce
> ?
> It seems you mixes two different issues.

We installed 'NetBeans IDE 7.3 Beta 2 (Build 201211062253)' to check if the error that we have with Netbeans IDE 7.2.1 is corrected.

So the error, when we build Java project (swing or fx), who use webservices when ant task named 'wsimport-client-generate' is played(generation of java sources classes from wsdl file) we have this error : 'error: unmappable character for encoding UTF-8'.
Comment 22 Denis Anisimov 2012-11-29 14:15:29 UTC
(In reply to comment #21)

> 
> We installed 'NetBeans IDE 7.3 Beta 2 (Build 201211062253)' to check if the
> error that we have with Netbeans IDE 7.2.1 is corrected.
> 
> So the error, when we build Java project (swing or fx), who use webservices
> when ant task named 'wsimport-client-generate' is played(generation of java
> sources classes from wsdl file) we have this error : 'error: unmappable
> character for encoding UTF-8'.

Once again : THIS BUG is about NB build procedure.
More precisely NB module "websvc.saas.api" which have had the issue.
Your case doesn't relate to NB sources/build procedure.
It is about user project. Please read carefully issue before 
comment/update/reopen.
You issue is duplicate of issue #216526,  which is also fixed in the 7.3 dev branch but 7.3 beta doesn't contain the fix I suppose.
Comment 23 aeros 2012-11-29 16:24:51 UTC
ok thanks, sorry for the mistake.