You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "Anne Marie Simmie (JIRA)" <xm...@xml.apache.org> on 2005/02/25 23:28:50 UTC

[jira] Created: (XMLBEANS-111) Upper case conversion of special characters causes javac error

Upper case conversion of special characters causes javac error
--------------------------------------------------------------

         Key: XMLBEANS-111
         URL: http://issues.apache.org/jira/browse/XMLBEANS-111
     Project: XMLBeans
        Type: Bug
  Components: Compiler  
 Environment: Tested with UTF-8 encoding
    Reporter: Anne Marie Simmie
    Priority: Minor


When a character has no Unicode upper case equivalent, and it is mapped to upper case by NameUtil.java, the conversion returns an invalid character.  This causes the compilation of the generated classes to fail.  A sample xsd that causes the error, the javac output, and diff of a suggested fix follow.

Thanks - excellent program - saves tons of time over doing it the old-fashioned way!

----------------------------------------------

Sample XSD that causes the error:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema 
	elementFormDefault="qualified" 
	attributeFormDefault="unqualified" 
	xmlns:xs="http://www.w3.org/2001/XMLSchema">
		<xs:element name="Unit" type="unit_list"/>
		<xs:simpleType name="unit_list">
		<xs:restriction base="xs:string">
			<xs:enumeration value="g/dl"/>
			<xs:enumeration value="µg/dl"/>
			<xs:enumeration value="µg/L"/>
			<xs:enumeration value="g/ml"/>
			<xs:enumeration value="pg/µL"/>
			<xs:enumeration value="No unit"/>
		</xs:restriction>
	</xs:simpleType>
</xs:schema>

-------------------------------------------------

Here's the error from javac after scomp:

C:\>scomp -out test.jar test.xsd
Time to build schema type system: 0.781 seconds
Time to generate code: 0.081 seconds
C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:24: <identifier> expected
    static final Enum ?G_DL = Enum.forString("&#9569;g/dl");
                      ^
C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:24: = expected
    static final Enum ?G_DL = Enum.forString("&#9569;g/dl");
                                                     ^
C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:25: <identifier> expected
    static final Enum ?G_L = Enum.forString("&#9569;g/L");
                      ^
C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:25: = expected
    static final Enum ?G_L = Enum.forString("&#9569;g/L");
                                                   ^
C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:27: = expected
    static final Enum PG_?_L = Enum.forString("pg/&#9569;L");
                         ^
C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:31: = expected
    static final int INT_?G_DL = Enum.INT_?G_DL;
                         ^
C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:32: = expected
    static final int INT_?G_L = Enum.INT_?G_L;
                         ^
C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:34: = expected
    static final int INT_PG_?_L = Enum.INT_PG_?_L;
                            ^
C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:69: ';' expected
        static final int INT_?G_DL = 2;
                             ^
C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:70: ';' expected
        static final int INT_?G_L = 3;
                             ^
C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:72: ';' expected
        static final int INT_PG_?_L = 5;
                                ^
C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:81: : expected
                new Enum("&#9569;g/dl", INT_?G_DL),
                                           ^
C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:86: illegal start of expression
            }
            ^
13 errors

BUILD FAILED

-----------------------------------------------------------

On my own copy of the XMLBeans source I've fixed the problem by altering NameUtil.java to check for a successful conversion to upper case, and replace any offending characters with underscores.  In case it would be useful here's a diff of the changes:

C:\WebsphereStuff\xmlbeans\source\trunk\src\common\org\apache\xmlbeans\impl\comm
on>svn diff
Index: NameUtil.java
===================================================================
--- NameUtil.java       (revision 154882)
+++ NameUtil.java       (working copy)
@@ -555,9 +555,8 @@
         for(int j = 0 ; j < len ; j++)
         {
             char c = buf.charAt(j);
-            buf.setCharAt(j, Character.toUpperCase(c));
-        }
-
+           buf.setCharAt(j, safeToUpperCase(c));
+       }
         return buf.toString();
     }

@@ -638,7 +637,7 @@
             return s;

         StringBuffer buf = new StringBuffer(s);
-        buf.setCharAt(0, Character.toUpperCase(buf.charAt(0)));
+        buf.setCharAt(0, safeToUpperCase(buf.charAt(0)));
         return buf.toString();
     }

@@ -776,4 +775,17 @@
     {
         return javaNames.contains(word);
     }
+
+    public static char safeToUpperCase(char c) {
+       Character upperCaseC = new Character(Character.toUpperCase(c));
+       Character lowerCaseC = new Character(Character.toLowerCase(upperCaseC.charValue()));
+       if(!lowerCaseC.equals(new Character(c)))
+           //if we cannot get back to the lower case, then the character has no upper case form
+           //replace with underscore
+           {
+               upperCaseC = new Character(USCORE);
+           }
+       return upperCaseC.charValue();
+    }
+
 }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


[jira] Updated: (XMLBEANS-111) Upper case conversion of special characters causes javac error

Posted by "Radu Preotiuc-Pietro (JIRA)" <xm...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XMLBEANS-111?page=all ]

Radu Preotiuc-Pietro updated XMLBEANS-111:
------------------------------------------

    Attachment: XMLBEANS-111.patch

> Upper case conversion of special characters causes javac error
> --------------------------------------------------------------
>
>          Key: XMLBEANS-111
>          URL: http://issues.apache.org/jira/browse/XMLBEANS-111
>      Project: XMLBeans
>         Type: Bug
>   Components: Compiler
>  Environment: Tested with UTF-8 encoding
>     Reporter: Anne Marie Simmie
>     Assignee: Radu Preotiuc-Pietro
>     Priority: Minor
>      Fix For: TBD
>  Attachments: XMLBEANS-111.patch
>
> When a character has no Unicode upper case equivalent, and it is mapped to upper case by NameUtil.java, the conversion returns an invalid character.  This causes the compilation of the generated classes to fail.  A sample xsd that causes the error, the javac output, and diff of a suggested fix follow.
> Thanks - excellent program - saves tons of time over doing it the old-fashioned way!
> ----------------------------------------------
> Sample XSD that causes the error:
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema 
> 	elementFormDefault="qualified" 
> 	attributeFormDefault="unqualified" 
> 	xmlns:xs="http://www.w3.org/2001/XMLSchema">
> 		<xs:element name="Unit" type="unit_list"/>
> 		<xs:simpleType name="unit_list">
> 		<xs:restriction base="xs:string">
> 			<xs:enumeration value="g/dl"/>
> 			<xs:enumeration value="µg/dl"/>
> 			<xs:enumeration value="µg/L"/>
> 			<xs:enumeration value="g/ml"/>
> 			<xs:enumeration value="pg/µL"/>
> 			<xs:enumeration value="No unit"/>
> 		</xs:restriction>
> 	</xs:simpleType>
> </xs:schema>
> -------------------------------------------------
> Here's the error from javac after scomp:
> C:\>scomp -out test.jar test.xsd
> Time to build schema type system: 0.781 seconds
> Time to generate code: 0.081 seconds
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:24: <identifier> expected
>     static final Enum ?G_DL = Enum.forString("&#9569;g/dl");
>                       ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:24: = expected
>     static final Enum ?G_DL = Enum.forString("&#9569;g/dl");
>                                                      ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:25: <identifier> expected
>     static final Enum ?G_L = Enum.forString("&#9569;g/L");
>                       ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:25: = expected
>     static final Enum ?G_L = Enum.forString("&#9569;g/L");
>                                                    ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:27: = expected
>     static final Enum PG_?_L = Enum.forString("pg/&#9569;L");
>                          ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:31: = expected
>     static final int INT_?G_DL = Enum.INT_?G_DL;
>                          ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:32: = expected
>     static final int INT_?G_L = Enum.INT_?G_L;
>                          ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:34: = expected
>     static final int INT_PG_?_L = Enum.INT_PG_?_L;
>                             ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:69: ';' expected
>         static final int INT_?G_DL = 2;
>                              ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:70: ';' expected
>         static final int INT_?G_L = 3;
>                              ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:72: ';' expected
>         static final int INT_PG_?_L = 5;
>                                 ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:81: : expected
>                 new Enum("&#9569;g/dl", INT_?G_DL),
>                                            ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:86: illegal start of expression
>             }
>             ^
> 13 errors
> BUILD FAILED
> -----------------------------------------------------------
> On my own copy of the XMLBeans source I've fixed the problem by altering NameUtil.java to check for a successful conversion to upper case, and replace any offending characters with underscores.  In case it would be useful here's a diff of the changes:
> C:\WebsphereStuff\xmlbeans\source\trunk\src\common\org\apache\xmlbeans\impl\comm
> on>svn diff
> Index: NameUtil.java
> ===================================================================
> --- NameUtil.java       (revision 154882)
> +++ NameUtil.java       (working copy)
> @@ -555,9 +555,8 @@
>          for(int j = 0 ; j < len ; j++)
>          {
>              char c = buf.charAt(j);
> -            buf.setCharAt(j, Character.toUpperCase(c));
> -        }
> -
> +           buf.setCharAt(j, safeToUpperCase(c));
> +       }
>          return buf.toString();
>      }
> @@ -638,7 +637,7 @@
>              return s;
>          StringBuffer buf = new StringBuffer(s);
> -        buf.setCharAt(0, Character.toUpperCase(buf.charAt(0)));
> +        buf.setCharAt(0, safeToUpperCase(buf.charAt(0)));
>          return buf.toString();
>      }
> @@ -776,4 +775,17 @@
>      {
>          return javaNames.contains(word);
>      }
> +
> +    public static char safeToUpperCase(char c) {
> +       Character upperCaseC = new Character(Character.toUpperCase(c));
> +       Character lowerCaseC = new Character(Character.toLowerCase(upperCaseC.charValue()));
> +       if(!lowerCaseC.equals(new Character(c)))
> +           //if we cannot get back to the lower case, then the character has no upper case form
> +           //replace with underscore
> +           {
> +               upperCaseC = new Character(USCORE);
> +           }
> +       return upperCaseC.charValue();
> +    }
> +
>  }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


[jira] Updated: (XMLBEANS-111) Upper case conversion of special characters causes javac error

Posted by "Radu Preotiuc-Pietro (JIRA)" <xm...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XMLBEANS-111?page=all ]

Radu Preotiuc-Pietro updated XMLBEANS-111:
------------------------------------------

    Fix Version: TBD

I have looked at this.
Thank you for the patch and the interest in XmlBeans. However, after reviewing the patch, I don't think that it can work, except for what I think is a bug in the patch which results in this particular case not giving the compilation error anymore (the bug that I am referring to is that if the 'c' parameter is already uppercase, it will always be replaced by '_' which is not what we want: a lot of characters would get replaced by underscores, potentially leading to name conflicts). In particular, the 'micro' character has an uppercase version and both of them are valid Java identifiers.

What I think is the problem here is that when we write a Java file to disk using FileWriter, characters which can't be handled by the default platform encoding are replaced with '?' (even though they may be valid Java identifiers).

I will attach a patch that worked for me and has better chances of working in general (like when using scomp).
The only situation in which it won't work is when somebody is using XmlBeans.compileXmlBeans() and the Filer interface to take control over the generation of the Java files. In order to make that case work, we need to address this at an API level.
Also, this patch causes generation of Java files to take 10% longer, which is the second reason I am including in here instead of just checking it in.


> Upper case conversion of special characters causes javac error
> --------------------------------------------------------------
>
>          Key: XMLBEANS-111
>          URL: http://issues.apache.org/jira/browse/XMLBEANS-111
>      Project: XMLBeans
>         Type: Bug
>   Components: Compiler
>  Environment: Tested with UTF-8 encoding
>     Reporter: Anne Marie Simmie
>     Assignee: Radu Preotiuc-Pietro
>     Priority: Minor
>      Fix For: TBD
>  Attachments: XMLBEANS-111.patch
>
> When a character has no Unicode upper case equivalent, and it is mapped to upper case by NameUtil.java, the conversion returns an invalid character.  This causes the compilation of the generated classes to fail.  A sample xsd that causes the error, the javac output, and diff of a suggested fix follow.
> Thanks - excellent program - saves tons of time over doing it the old-fashioned way!
> ----------------------------------------------
> Sample XSD that causes the error:
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema 
> 	elementFormDefault="qualified" 
> 	attributeFormDefault="unqualified" 
> 	xmlns:xs="http://www.w3.org/2001/XMLSchema">
> 		<xs:element name="Unit" type="unit_list"/>
> 		<xs:simpleType name="unit_list">
> 		<xs:restriction base="xs:string">
> 			<xs:enumeration value="g/dl"/>
> 			<xs:enumeration value="µg/dl"/>
> 			<xs:enumeration value="µg/L"/>
> 			<xs:enumeration value="g/ml"/>
> 			<xs:enumeration value="pg/µL"/>
> 			<xs:enumeration value="No unit"/>
> 		</xs:restriction>
> 	</xs:simpleType>
> </xs:schema>
> -------------------------------------------------
> Here's the error from javac after scomp:
> C:\>scomp -out test.jar test.xsd
> Time to build schema type system: 0.781 seconds
> Time to generate code: 0.081 seconds
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:24: <identifier> expected
>     static final Enum ?G_DL = Enum.forString("&#9569;g/dl");
>                       ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:24: = expected
>     static final Enum ?G_DL = Enum.forString("&#9569;g/dl");
>                                                      ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:25: <identifier> expected
>     static final Enum ?G_L = Enum.forString("&#9569;g/L");
>                       ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:25: = expected
>     static final Enum ?G_L = Enum.forString("&#9569;g/L");
>                                                    ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:27: = expected
>     static final Enum PG_?_L = Enum.forString("pg/&#9569;L");
>                          ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:31: = expected
>     static final int INT_?G_DL = Enum.INT_?G_DL;
>                          ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:32: = expected
>     static final int INT_?G_L = Enum.INT_?G_L;
>                          ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:34: = expected
>     static final int INT_PG_?_L = Enum.INT_PG_?_L;
>                             ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:69: ';' expected
>         static final int INT_?G_DL = 2;
>                              ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:70: ';' expected
>         static final int INT_?G_L = 3;
>                              ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:72: ';' expected
>         static final int INT_PG_?_L = 5;
>                                 ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:81: : expected
>                 new Enum("&#9569;g/dl", INT_?G_DL),
>                                            ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:86: illegal start of expression
>             }
>             ^
> 13 errors
> BUILD FAILED
> -----------------------------------------------------------
> On my own copy of the XMLBeans source I've fixed the problem by altering NameUtil.java to check for a successful conversion to upper case, and replace any offending characters with underscores.  In case it would be useful here's a diff of the changes:
> C:\WebsphereStuff\xmlbeans\source\trunk\src\common\org\apache\xmlbeans\impl\comm
> on>svn diff
> Index: NameUtil.java
> ===================================================================
> --- NameUtil.java       (revision 154882)
> +++ NameUtil.java       (working copy)
> @@ -555,9 +555,8 @@
>          for(int j = 0 ; j < len ; j++)
>          {
>              char c = buf.charAt(j);
> -            buf.setCharAt(j, Character.toUpperCase(c));
> -        }
> -
> +           buf.setCharAt(j, safeToUpperCase(c));
> +       }
>          return buf.toString();
>      }
> @@ -638,7 +637,7 @@
>              return s;
>          StringBuffer buf = new StringBuffer(s);
> -        buf.setCharAt(0, Character.toUpperCase(buf.charAt(0)));
> +        buf.setCharAt(0, safeToUpperCase(buf.charAt(0)));
>          return buf.toString();
>      }
> @@ -776,4 +775,17 @@
>      {
>          return javaNames.contains(word);
>      }
> +
> +    public static char safeToUpperCase(char c) {
> +       Character upperCaseC = new Character(Character.toUpperCase(c));
> +       Character lowerCaseC = new Character(Character.toLowerCase(upperCaseC.charValue()));
> +       if(!lowerCaseC.equals(new Character(c)))
> +           //if we cannot get back to the lower case, then the character has no upper case form
> +           //replace with underscore
> +           {
> +               upperCaseC = new Character(USCORE);
> +           }
> +       return upperCaseC.charValue();
> +    }
> +
>  }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


[jira] Resolved: (XMLBEANS-111) Upper case conversion of special characters causes javac error

Posted by "Radu Preotiuc-Pietro (JIRA)" <xm...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XMLBEANS-111?page=all ]
     
Radu Preotiuc-Pietro resolved XMLBEANS-111:
-------------------------------------------

     Resolution: Fixed
    Fix Version: Version 2 Beta 2
                 Version 2
                     (was: TBD)

I have actually found a way to fix it in the 95% case without affecting performance, so I was able to check it in.


> Upper case conversion of special characters causes javac error
> --------------------------------------------------------------
>
>          Key: XMLBEANS-111
>          URL: http://issues.apache.org/jira/browse/XMLBEANS-111
>      Project: XMLBeans
>         Type: Bug
>   Components: Compiler
>  Environment: Tested with UTF-8 encoding
>     Reporter: Anne Marie Simmie
>     Assignee: Radu Preotiuc-Pietro
>     Priority: Minor
>      Fix For: Version 2 Beta 2, Version 2
>  Attachments: XMLBEANS-111.patch
>
> When a character has no Unicode upper case equivalent, and it is mapped to upper case by NameUtil.java, the conversion returns an invalid character.  This causes the compilation of the generated classes to fail.  A sample xsd that causes the error, the javac output, and diff of a suggested fix follow.
> Thanks - excellent program - saves tons of time over doing it the old-fashioned way!
> ----------------------------------------------
> Sample XSD that causes the error:
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema 
> 	elementFormDefault="qualified" 
> 	attributeFormDefault="unqualified" 
> 	xmlns:xs="http://www.w3.org/2001/XMLSchema">
> 		<xs:element name="Unit" type="unit_list"/>
> 		<xs:simpleType name="unit_list">
> 		<xs:restriction base="xs:string">
> 			<xs:enumeration value="g/dl"/>
> 			<xs:enumeration value="µg/dl"/>
> 			<xs:enumeration value="µg/L"/>
> 			<xs:enumeration value="g/ml"/>
> 			<xs:enumeration value="pg/µL"/>
> 			<xs:enumeration value="No unit"/>
> 		</xs:restriction>
> 	</xs:simpleType>
> </xs:schema>
> -------------------------------------------------
> Here's the error from javac after scomp:
> C:\>scomp -out test.jar test.xsd
> Time to build schema type system: 0.781 seconds
> Time to generate code: 0.081 seconds
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:24: <identifier> expected
>     static final Enum ?G_DL = Enum.forString("&#9569;g/dl");
>                       ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:24: = expected
>     static final Enum ?G_DL = Enum.forString("&#9569;g/dl");
>                                                      ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:25: <identifier> expected
>     static final Enum ?G_L = Enum.forString("&#9569;g/L");
>                       ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:25: = expected
>     static final Enum ?G_L = Enum.forString("&#9569;g/L");
>                                                    ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:27: = expected
>     static final Enum PG_?_L = Enum.forString("pg/&#9569;L");
>                          ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:31: = expected
>     static final int INT_?G_DL = Enum.INT_?G_DL;
>                          ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:32: = expected
>     static final int INT_?G_L = Enum.INT_?G_L;
>                          ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:34: = expected
>     static final int INT_PG_?_L = Enum.INT_PG_?_L;
>                             ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:69: ';' expected
>         static final int INT_?G_DL = 2;
>                              ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:70: ';' expected
>         static final int INT_?G_L = 3;
>                              ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:72: ';' expected
>         static final int INT_PG_?_L = 5;
>                                 ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:81: : expected
>                 new Enum("&#9569;g/dl", INT_?G_DL),
>                                            ^
> C:\..\Temp\xbean16323.d\src\noNamespace\UnitList.java:86: illegal start of expression
>             }
>             ^
> 13 errors
> BUILD FAILED
> -----------------------------------------------------------
> On my own copy of the XMLBeans source I've fixed the problem by altering NameUtil.java to check for a successful conversion to upper case, and replace any offending characters with underscores.  In case it would be useful here's a diff of the changes:
> C:\WebsphereStuff\xmlbeans\source\trunk\src\common\org\apache\xmlbeans\impl\comm
> on>svn diff
> Index: NameUtil.java
> ===================================================================
> --- NameUtil.java       (revision 154882)
> +++ NameUtil.java       (working copy)
> @@ -555,9 +555,8 @@
>          for(int j = 0 ; j < len ; j++)
>          {
>              char c = buf.charAt(j);
> -            buf.setCharAt(j, Character.toUpperCase(c));
> -        }
> -
> +           buf.setCharAt(j, safeToUpperCase(c));
> +       }
>          return buf.toString();
>      }
> @@ -638,7 +637,7 @@
>              return s;
>          StringBuffer buf = new StringBuffer(s);
> -        buf.setCharAt(0, Character.toUpperCase(buf.charAt(0)));
> +        buf.setCharAt(0, safeToUpperCase(buf.charAt(0)));
>          return buf.toString();
>      }
> @@ -776,4 +775,17 @@
>      {
>          return javaNames.contains(word);
>      }
> +
> +    public static char safeToUpperCase(char c) {
> +       Character upperCaseC = new Character(Character.toUpperCase(c));
> +       Character lowerCaseC = new Character(Character.toLowerCase(upperCaseC.charValue()));
> +       if(!lowerCaseC.equals(new Character(c)))
> +           //if we cannot get back to the lower case, then the character has no upper case form
> +           //replace with underscore
> +           {
> +               upperCaseC = new Character(USCORE);
> +           }
> +       return upperCaseC.charValue();
> +    }
> +
>  }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org