You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Joerg Schoenfisch <jo...@informatik.uni-mannheim.de> on 2015/12/16 18:27:21 UTC

Illegal unicode escape in file generated with schemagen on Windows

Hi everybody,

I'm trying to generate some Java files with schemagen 3.0.1 on Windows. 
Unfortunately, schemagen includes the full path to the file in the 
JavaDoc, including backslashes, e.g "D:\Documents\uni[...]". This 
results in a compilation error because of an illegal unicode escape.

Furthermore, when I try to change the file header in the POM 
configuration a BadBooleanException is thrown (only seen when running 
Maven in debug. Standard error message is quite bad).
The relevant configuration looks like this:

<fileOptions>
   <source>
     <input>default</input>
     <header>foobar</header>
   </source>
</fileOptions>

Is there any way to work around this? Am I using the configuration in 
Maven wrong?


Best

Re: Illegal unicode escape in file generated with schemagen on Windows

Posted by Joerg Schoenfisch <jo...@informatik.uni-mannheim.de>.
On 22.12.2015 13:31, Andy Seaborne wrote:
> On 22/12/15 11:07, Joerg Schoenfisch wrote:
>> So, apparently there is some code in the method setGlobalReplacements()
>> in the schemagen class that should prevent this error. However, it does
>> not seem to work.
>>
>> I tried to do some debugging, but when cloning the repository and
>> importing the Maven projects in Eclipse I get a lot of errors because of
>> references to the missing import org.apache.jena.ext
>
> which is in jena-shaded-guava
>
>>
>> Any hints on how to resolve that missing import? Should I report that
>> Windows problem as a bug?
>
> What might be happening is that it can't find the snapshot build.


Thanks, Eclipse really was confused. It tries to resolve 
jena-shaded-guava from the workspace, which is of course empty. Removing 
that project fixed it.



>
> jena-shaded-guava does confuse Eclipse sometime.  It is more stable to
> build it outside Eclipse.
>
> Either:
>
> 1/
> Run "mvn install -Pdev" and it should build and install the modules
> locally.
>
> Or:
> 2/
> (avoids building it locally but needs maven setup magic):
> Add the Apache snapshot repo to your maven settings.xml:
>
>       <repositories>
>          <repository>
>            <id>apache.snapshots</id>
>            <name>Apache Snapshot Repository</name>
>            <url>https://repository.apache.org/snapshots</url>
>            <releases>
>              <enabled>false</enabled>
>            </releases>
>            <snapshots>
>              <enabled>true</enabled>
>            </snapshots>
>          </repository>
>        </repositories>
> and do
>
> mvn dependencies:resolve dependency:sources
>
>
>
>
> Then you should be able to:
>
> Import the project modules you want.
> Do not import jena-shaded-guava
>
>
>      Andy
>
>
>
>
>

Re: Illegal unicode escape in file generated with schemagen on Windows

Posted by Andy Seaborne <an...@apache.org>.
On 22/12/15 11:07, Joerg Schoenfisch wrote:
> So, apparently there is some code in the method setGlobalReplacements()
> in the schemagen class that should prevent this error. However, it does
> not seem to work.
>
> I tried to do some debugging, but when cloning the repository and
> importing the Maven projects in Eclipse I get a lot of errors because of
> references to the missing import org.apache.jena.ext

which is in jena-shaded-guava

>
> Any hints on how to resolve that missing import? Should I report that
> Windows problem as a bug?

What might be happening is that it can't find the snapshot build.

jena-shaded-guava does confuse Eclipse sometime.  It is more stable to 
build it outside Eclipse.

Either:

1/
Run "mvn install -Pdev" and it should build and install the modules locally.

Or:
2/
(avoids building it locally but needs maven setup magic):
Add the Apache snapshot repo to your maven settings.xml:

      <repositories>
         <repository>
           <id>apache.snapshots</id>
           <name>Apache Snapshot Repository</name>
           <url>https://repository.apache.org/snapshots</url>
           <releases>
             <enabled>false</enabled>
           </releases>
           <snapshots>
             <enabled>true</enabled>
           </snapshots>
         </repository>
       </repositories>
and do

mvn dependencies:resolve dependency:sources




Then you should be able to:

Import the project modules you want.
Do not import jena-shaded-guava


	Andy





Re: Illegal unicode escape in file generated with schemagen on Windows

Posted by Joerg Schoenfisch <jo...@informatik.uni-mannheim.de>.
I created a minimal example that shows the error:

https://github.com/joe776/u-in-name



On 22.12.2015 13:08, Joerg Schoenfisch wrote:
> The method can be found here:
> https://github.com/apache/jena/blob/master/jena-core/src/main/java/jena/schemagen.java#L349
>
>
> The sources from which we generate the Java files are located in a tree
> where one folder starts with the letter u resulting in a String in the
> JavaDoc that is interpreted as Unicode escape and causes an error in the
> Maven compiler.
> The method above should prevent that, but somehow does not.
>
>
> On 22.12.2015 12:58, Jonathan Camilleri wrote:
>> Where is the class documented, I have not heard of this problem?
>>
>> On 22 December 2015 at 12:07, Joerg Schoenfisch <
>> joerg@informatik.uni-mannheim.de> wrote:
>>
>>> So, apparently there is some code in the method
>>> setGlobalReplacements() in
>>> the schemagen class that should prevent this error. However, it does not
>>> seem to work.
>>>
>>> I tried to do some debugging, but when cloning the repository and
>>> importing the Maven projects in Eclipse I get a lot of errors because of
>>> references to the missing import org.apache.jena.ext
>>>
>>> Any hints on how to resolve that missing import? Should I report that
>>> Windows problem as a bug?
>>>
>>>
>>> Best
>>>
>>>
>>>
>>>
>>> On 16.12.2015 18:27, Joerg Schoenfisch wrote:
>>>
>>>> Hi everybody,
>>>>
>>>> I'm trying to generate some Java files with schemagen 3.0.1 on Windows.
>>>> Unfortunately, schemagen includes the full path to the file in the
>>>> JavaDoc, including backslashes, e.g "D:\Documents\uni[...]". This
>>>> results in a compilation error because of an illegal unicode escape.
>>>>
>>>> Furthermore, when I try to change the file header in the POM
>>>> configuration a BadBooleanException is thrown (only seen when running
>>>> Maven in debug. Standard error message is quite bad).
>>>> The relevant configuration looks like this:
>>>>
>>>> <fileOptions>
>>>>     <source>
>>>>       <input>default</input>
>>>>       <header>foobar</header>
>>>>     </source>
>>>> </fileOptions>
>>>>
>>>> Is there any way to work around this? Am I using the configuration in
>>>> Maven wrong?
>>>>
>>>>
>>>> Best
>>>>
>>>>
>>
>>
>

Re: Illegal unicode escape in file generated with schemagen on Windows

Posted by Joerg Schoenfisch <jo...@informatik.uni-mannheim.de>.
The method can be found here: 
https://github.com/apache/jena/blob/master/jena-core/src/main/java/jena/schemagen.java#L349

The sources from which we generate the Java files are located in a tree 
where one folder starts with the letter u resulting in a String in the 
JavaDoc that is interpreted as Unicode escape and causes an error in the 
Maven compiler.
The method above should prevent that, but somehow does not.


On 22.12.2015 12:58, Jonathan Camilleri wrote:
> Where is the class documented, I have not heard of this problem?
>
> On 22 December 2015 at 12:07, Joerg Schoenfisch <
> joerg@informatik.uni-mannheim.de> wrote:
>
>> So, apparently there is some code in the method setGlobalReplacements() in
>> the schemagen class that should prevent this error. However, it does not
>> seem to work.
>>
>> I tried to do some debugging, but when cloning the repository and
>> importing the Maven projects in Eclipse I get a lot of errors because of
>> references to the missing import org.apache.jena.ext
>>
>> Any hints on how to resolve that missing import? Should I report that
>> Windows problem as a bug?
>>
>>
>> Best
>>
>>
>>
>>
>> On 16.12.2015 18:27, Joerg Schoenfisch wrote:
>>
>>> Hi everybody,
>>>
>>> I'm trying to generate some Java files with schemagen 3.0.1 on Windows.
>>> Unfortunately, schemagen includes the full path to the file in the
>>> JavaDoc, including backslashes, e.g "D:\Documents\uni[...]". This
>>> results in a compilation error because of an illegal unicode escape.
>>>
>>> Furthermore, when I try to change the file header in the POM
>>> configuration a BadBooleanException is thrown (only seen when running
>>> Maven in debug. Standard error message is quite bad).
>>> The relevant configuration looks like this:
>>>
>>> <fileOptions>
>>>     <source>
>>>       <input>default</input>
>>>       <header>foobar</header>
>>>     </source>
>>> </fileOptions>
>>>
>>> Is there any way to work around this? Am I using the configuration in
>>> Maven wrong?
>>>
>>>
>>> Best
>>>
>>>
>
>

Re: Illegal unicode escape in file generated with schemagen on Windows

Posted by Jonathan Camilleri <ca...@gmail.com>.
Where is the class documented, I have not heard of this problem?

On 22 December 2015 at 12:07, Joerg Schoenfisch <
joerg@informatik.uni-mannheim.de> wrote:

> So, apparently there is some code in the method setGlobalReplacements() in
> the schemagen class that should prevent this error. However, it does not
> seem to work.
>
> I tried to do some debugging, but when cloning the repository and
> importing the Maven projects in Eclipse I get a lot of errors because of
> references to the missing import org.apache.jena.ext
>
> Any hints on how to resolve that missing import? Should I report that
> Windows problem as a bug?
>
>
> Best
>
>
>
>
> On 16.12.2015 18:27, Joerg Schoenfisch wrote:
>
>> Hi everybody,
>>
>> I'm trying to generate some Java files with schemagen 3.0.1 on Windows.
>> Unfortunately, schemagen includes the full path to the file in the
>> JavaDoc, including backslashes, e.g "D:\Documents\uni[...]". This
>> results in a compilation error because of an illegal unicode escape.
>>
>> Furthermore, when I try to change the file header in the POM
>> configuration a BadBooleanException is thrown (only seen when running
>> Maven in debug. Standard error message is quite bad).
>> The relevant configuration looks like this:
>>
>> <fileOptions>
>>    <source>
>>      <input>default</input>
>>      <header>foobar</header>
>>    </source>
>> </fileOptions>
>>
>> Is there any way to work around this? Am I using the configuration in
>> Maven wrong?
>>
>>
>> Best
>>
>>


-- 
Jonathan Camilleri

Mobile (MT): ++356 7982 7113
E-mail: camilleri.jon@gmail.com
Please consider your environmental responsibility before printing this
e-mail.

I usually reply to emails within 2 business days.  If it's urgent, give me
a call.

Re: Illegal unicode escape in file generated with schemagen on Windows

Posted by Joerg Schoenfisch <jo...@informatik.uni-mannheim.de>.
So, apparently there is some code in the method setGlobalReplacements() 
in the schemagen class that should prevent this error. However, it does 
not seem to work.

I tried to do some debugging, but when cloning the repository and 
importing the Maven projects in Eclipse I get a lot of errors because of 
references to the missing import org.apache.jena.ext

Any hints on how to resolve that missing import? Should I report that 
Windows problem as a bug?


Best




On 16.12.2015 18:27, Joerg Schoenfisch wrote:
> Hi everybody,
>
> I'm trying to generate some Java files with schemagen 3.0.1 on Windows.
> Unfortunately, schemagen includes the full path to the file in the
> JavaDoc, including backslashes, e.g "D:\Documents\uni[...]". This
> results in a compilation error because of an illegal unicode escape.
>
> Furthermore, when I try to change the file header in the POM
> configuration a BadBooleanException is thrown (only seen when running
> Maven in debug. Standard error message is quite bad).
> The relevant configuration looks like this:
>
> <fileOptions>
>    <source>
>      <input>default</input>
>      <header>foobar</header>
>    </source>
> </fileOptions>
>
> Is there any way to work around this? Am I using the configuration in
> Maven wrong?
>
>
> Best
>