You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Marcus Crafter <cr...@fztig938.bank.dresdner.net> on 2001/07/02 14:28:41 UTC

RE: [C2 patch] Jikes 1.14

Hi Vadim,

On Fri, 29 Jun 2001, Vadim Gritsenko wrote:

> Just one quick question: does this patch breaks backward compatibility,
> or not? I could apply it stright away if I would know that it does not break
> anything :)

	:-)

	I've just tested it on my system (Debian GNU/Linux i386 unstable) with
	Jikes 1.13 and 1.14 and everything works fine. What versions were
	people previously using ? Perhaps we should document which versions of
	Jikes we support ?

> PS: Especially line 
> +                if (line.length() == 0) {
> because IIRC line can be null on the end of stream...

	Yes, good point. Attached is an updated diff with a check for null.

	Thanks for your email and feedback mate. Much appreciated. :-)

	Cheers,

	Marcus

-- 
        .....
     ,,$$$$$$$$$,      Marcus Crafter
    ;$'      '$$$$:    Computer Systems Engineer
    $:         $$$$:   Open Software Associates GmbH
     $       o_)$$$:   82-84 Mainzer Landstrasse
     ;$,    _/\ &&:'   60327 Frankfurt Germany
       '     /( &&&
           \_&&&&'     Email : Marcus.Crafter@osa.de
          &&&&.        Business Hours : +49 69 9757 200
    &&&&&&&:           After Hours    : +49 69 49086750

RE: [C2 patch] Jikes 1.14

Posted by Vadim Gritsenko <vg...@hns.com>.
Hi Marcus,

> 
> Hi Vadim,
> 
> On Thu, 5 Jul 2001, Vadim Gritsenko wrote:
> 
> > I think I found the problem: I overlooked that fact that when printing the error, jikes sometimes
> > inserts empty string. This should be fixed now. Please test - hope last time.
> 
> 	Looks good. I get the same output.
> 
> > > 	I had explicitly set 'line' to null so the first readline would always
> > > 	be executed (check the attached patch).
> > 
> > This should not be done as line may contain first line of the next error, and every
> > error is parsed into separate CompileError object.
> 
> 	My understanding of the code was different. I thought that:
> 
> // first line is not space-starting
> if (line == null) line = input.readLine();
> 
> 	always reads the first line of every error message (if existing), and

Not exactly.. Only for the first error (see below..)


> 	that:
> 
> while (true) {
>     line = input.readLine();
>     ....
>     buffer.append(line);
>     buffer.append('\n');
> }
> 
> 	reads the rest of the lines for that particular error message.
> 
> 	On my system, I always have an empty string of length 0 between each
> 	error message, and at the end of all the error messages.

Here I generally do not have empty strings between errors. They only appears
if there is no rt.jar in classpath.


> 	
> 	Hence setting 'line' to null kept everything in sync, as it only
> 	dropped the zero sized string, and broke control flow out the inner
> 	while loop - causing the first line of the next error message (if
> 	existing) to be read by the first statement above.
> 
> 	Perhaps that's where we were seeing some platform differences ?

Yep. I have checked in change to report whole error, please check :)

> 
> 	But everything looks good now. Thanks very much for your help. :-)

You are welcome. Otherwise I would need to install Linux :)

Vadim

> 
> 	Cheers,
> 
> 	Marcus
> 
> -- 
>         .....
>      ,,$$$$$$$$$,      Marcus Crafter
>     ;$'      '$$$$:    Computer Systems Engineer
>     $:         $$$$:   Open Software Associates GmbH
>      $       o_)$$$:   82-84 Mainzer Landstrasse
>      ;$,    _/\ &&:'   60327 Frankfurt Germany
>        '     /( &&&
>            \_&&&&'     Email : Marcus.Crafter@osa.de
>           &&&&.        Business Hours : +49 69 9757 200
>     &&&&&&&:           After Hours    : +49 69 49086750
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
> 

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


RE: [C2 patch] Jikes 1.14

Posted by Marcus Crafter <cr...@fztig938.bank.dresdner.net>.
Hi Vadim,

On Thu, 5 Jul 2001, Vadim Gritsenko wrote:

> I think I found the problem: I overlooked that fact that when printing the error, jikes sometimes
> inserts empty string. This should be fixed now. Please test - hope last time.

	Looks good. I get the same output.

> > 	I had explicitly set 'line' to null so the first readline would always
> > 	be executed (check the attached patch).
> 
> This should not be done as line may contain first line of the next error, and every
> error is parsed into separate CompileError object.

	My understanding of the code was different. I thought that:

// first line is not space-starting
if (line == null) line = input.readLine();

	always reads the first line of every error message (if existing), and
	that:

while (true) {
    line = input.readLine();
    ....
    buffer.append(line);
    buffer.append('\n');
}

	reads the rest of the lines for that particular error message.

	On my system, I always have an empty string of length 0 between each
	error message, and at the end of all the error messages.
	
	Hence setting 'line' to null kept everything in sync, as it only
	dropped the zero sized string, and broke control flow out the inner
	while loop - causing the first line of the next error message (if
	existing) to be read by the first statement above.

	Perhaps that's where we were seeing some platform differences ?

	But everything looks good now. Thanks very much for your help. :-)

	Cheers,

	Marcus

-- 
        .....
     ,,$$$$$$$$$,      Marcus Crafter
    ;$'      '$$$$:    Computer Systems Engineer
    $:         $$$$:   Open Software Associates GmbH
     $       o_)$$$:   82-84 Mainzer Landstrasse
     ;$,    _/\ &&:'   60327 Frankfurt Germany
       '     /( &&&
           \_&&&&'     Email : Marcus.Crafter@osa.de
          &&&&.        Business Hours : +49 69 9757 200
    &&&&&&&:           After Hours    : +49 69 49086750


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


RE: [C2 patch] Jikes 1.14

Posted by Vadim Gritsenko <vg...@hns.com>.
Marcus,

I think I found the problem: I overlooked that fact that when printing the error, jikes sometimes
inserts empty string. This should be fixed now. Please test - hope last time.


> 	I had explicitly set 'line' to null so the first readline would always
> 	be executed (check the attached patch).

This should not be done as line may contain first line of the next error, and every
error is parsed into separate CompileError object. My result now looks like:
----------------------------------
org.apache.cocoon.components.language.LanguageException: Error compiling sitemap_xmap:
Line 0, column 0: Could not find package "java/util" in:                C:\Work\homepage\WEB-INF\work
Line 0, column 0: Could not find package "java/lang" in:                C:\Work\homepage\WEB-INF\work
----------------------------------
(that's when rt.jar is not in the path)

Vadim

> -----Original Message-----
> From: Marcus Crafter [mailto:crafterm@fztig938.bank.dresdner.net]
> Sent: Thursday, July 05, 2001 13:04
> To: cocoon-dev@xml.apache.org
> Subject: RE: [C2 patch] Jikes 1.14
> 
> 
> Hi Vadim,
> 
> On Thu, 5 Jul 2001, Vadim Gritsenko wrote:
> 
> > Done. 
> > 
> > Marcus, would you mind testing it one more time?
> 	
> 	No problem. We'll get there eventually! :-)
> 
> ERROR   14921   [cocoon  ] (Thread-25): Error compiling sitemap
> java.util.NoSuchElementException
>         at java.util.StringTokenizer.nextToken(StringTokenizer.java:235)
>         at org.apache.cocoon.components.language.programming.java.Jikes.parseError(Jikes.java:201)
>         at org.apache.cocoon.components.language.programming.java.Jikes.parseStream(Jikes.java:189)
>         at 
> org.apache.cocoon.components.language.programming.java.AbstractJavaCompiler.getErrors(AbstractJavaCompiler.java:114)
>         at org.apache.cocoon.components.language.programming.java.JavaLanguage.compile(JavaLanguage.java:191)
>         at 
> org.apache.cocoon.components.language.programming.CompiledProgrammingLanguage.load(CompiledProgrammingLanguage
> .java:131)
> 
> 	From my observations, I think the problem lies in fact that 'line' is
> 	not set to null, when encountering the end of the first message.
> 
> 	This causes the first readline to be skipped, on my system pushing
> 	an empty (non-null) string onto the buffer. The second set of readlines
> 	immediately breaks because it actually reads the first line of the
> 	next error, not the rest of the error (which contain leading spaces).
> 
> 	This results in parseError being called with an empty string - and
> 	hence causing the exception above.
> 
> 	I had explicitly set 'line' to null so the first readline would always
> 	be executed (check the attached patch).
> 
> 	I also noticed that parseError does not build a complete error message
> 	on my system as nextToken() is only called once (delimited by newline).
> 	I've also added a test and loop to get all of the message in the
> 	attached patch.
> 
> 	Could it be that jikes is behaving differently between our systems ?
> 	Sounds like it.
> 
> 	I've also attached how my logfile, to compare against how it looks
> 	against your system.
> 
> 	Hope that helps.
> 
> 	Cheers,
> 
> 	Marcus
> 	
> -- 
>         .....
>      ,,$$$$$$$$$,      Marcus Crafter
>     ;$'      '$$$$:    Computer Systems Engineer
>     $:         $$$$:   Open Software Associates GmbH
>      $       o_)$$$:   82-84 Mainzer Landstrasse
>      ;$,    _/\ &&:'   60327 Frankfurt Germany
>        '     /( &&&
>            \_&&&&'     Email : Marcus.Crafter@osa.de
>           &&&&.        Business Hours : +49 69 9757 200
>     &&&&&&&:           After Hours    : +49 69 49086750
> 

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


RE: [C2 patch] Jikes 1.14

Posted by Marcus Crafter <cr...@fztig938.bank.dresdner.net>.
Hi Vadim,

On Thu, 5 Jul 2001, Vadim Gritsenko wrote:

> Done. 
> 
> Marcus, would you mind testing it one more time?
	
	No problem. We'll get there eventually! :-)

ERROR   14921   [cocoon  ] (Thread-25): Error compiling sitemap
java.util.NoSuchElementException
        at java.util.StringTokenizer.nextToken(StringTokenizer.java:235)
        at org.apache.cocoon.components.language.programming.java.Jikes.parseError(Jikes.java:201)
        at org.apache.cocoon.components.language.programming.java.Jikes.parseStream(Jikes.java:189)
        at org.apache.cocoon.components.language.programming.java.AbstractJavaCompiler.getErrors(AbstractJavaCompiler.java:114)
        at org.apache.cocoon.components.language.programming.java.JavaLanguage.compile(JavaLanguage.java:191)
        at org.apache.cocoon.components.language.programming.CompiledProgrammingLanguage.load(CompiledProgrammingLanguage.java:131)

	From my observations, I think the problem lies in fact that 'line' is
	not set to null, when encountering the end of the first message.

	This causes the first readline to be skipped, on my system pushing
	an empty (non-null) string onto the buffer. The second set of readlines
	immediately breaks because it actually reads the first line of the
	next error, not the rest of the error (which contain leading spaces).

	This results in parseError being called with an empty string - and
	hence causing the exception above.

	I had explicitly set 'line' to null so the first readline would always
	be executed (check the attached patch).

	I also noticed that parseError does not build a complete error message
	on my system as nextToken() is only called once (delimited by newline).
	I've also added a test and loop to get all of the message in the
	attached patch.

	Could it be that jikes is behaving differently between our systems ?
	Sounds like it.

	I've also attached how my logfile, to compare against how it looks
	against your system.

	Hope that helps.

	Cheers,

	Marcus
	
-- 
        .....
     ,,$$$$$$$$$,      Marcus Crafter
    ;$'      '$$$$:    Computer Systems Engineer
    $:         $$$$:   Open Software Associates GmbH
     $       o_)$$$:   82-84 Mainzer Landstrasse
     ;$,    _/\ &&:'   60327 Frankfurt Germany
       '     /( &&&
           \_&&&&'     Email : Marcus.Crafter@osa.de
          &&&&.        Business Hours : +49 69 9757 200
    &&&&&&&:           After Hours    : +49 69 49086750

RE: [C2 patch] Jikes 1.14

Posted by Vadim Gritsenko <vg...@hns.com>.
Done. 

Marcus, would you mind testing it one more time?

Thanks,
Vadim

> -----Original Message-----
> From: Carsten Ziegeler [mailto:cziegeler@sundn.de]
> Sent: Wednesday, July 04, 2001 8:08
> To: cocoon-dev@xml.apache.org
> Subject: AW: [C2 patch] Jikes 1.14
> 
> 
> > Marcus Crafter wrote:
> >
> > Hi Vadim,
> >
> > On Mon, 2 Jul 2001, Vadim Gritsenko wrote:
> >
> > > I patched Jikes compiler, it works fine for me know. Please
> > test and get back
> > > if you need to modify something more.
> >
> > 	I've just tested the updated code. On my setup I'm receiving an
> > 	exception at sitemap compilation time (when I don't include
> > the rt.jar
> > 	and are intentially forcing jikes to report compile errors)
> >
> > ERROR   99424   [cocoon  ] (Thread-32): Error compiling sitemap
> > java.lang.StringIndexOutOfBoundsException: String index out of range: 0
> >         at java.lang.String.charAt(String.java:507)
> >         at
> > org.apache.cocoon.components.language.programming.java.Jikes.parse
> > Stream(Jikes.java:179)
> >         at
> > org.apache.cocoon.components.language.programming.java.AbstractJav
> > aCompiler.getErrors(AbstractJavaCompiler.java:114)
> >         at
> > org.apache.cocoon.components.language.programming.java.JavaLanguag
> > e.compile(JavaLanguage.java:191)
> >         at
> > org.apache.cocoon.components.language.programming.CompiledProgramm
> > ingLanguage.load(CompiledProgrammingLanguage.java:131)
> >         at
> > org.apache.cocoon.components.language.generator.ProgramGeneratorIm
> > pl.generateResource(ProgramGeneratorImpl.java:250)
> >         at
> > org.apache.cocoon.components.language.generator.ProgramGeneratorIm
> > pl.load(ProgramGeneratorImpl.java:159)
> >         at org.apache.cocoon.sitemap.Handler.run(Handler.java:191)
> >         at java.lang.Thread.run(Thread.java:484)
> > ERROR   99424   [cocoon  ] (Thread-10): Problem with servlet
> >
> > 	The line of code is:
> >
> > 	if ((line == null) || (line.charAt(0) != ' ')) break;
> >
> > 	On my system (x86 Debian GNU/Linux, jdk 1.3.0, jikes 1.14) the input
> > 	being parsed when the exception is thrown is actually a string of
> > 	length zero (in my patch I replaced this test with a test for
> > 	line.length() == 0).
> >
> > 	Is this different on your system - are we seeing some platform
> > 	discrepancies here ??
> >
> Why not combining both tests?
> 
> if ((line == null) || (line.length() == 0) || (line.charAt(0) != ' '))
> break;
> 
> Carsten
> 
> > 	Cheers,
> >
> > 	Marcus
> >
> >
> > --
> >         .....
> >      ,,$$$$$$$$$,      Marcus Crafter
> >     ;$'      '$$$$:    Computer Systems Engineer
> >     $:         $$$$:   Open Software Associates GmbH
> >      $       o_)$$$:   82-84 Mainzer Landstrasse
> >      ;$,    _/\ &&:'   60327 Frankfurt Germany
> >        '     /( &&&
> >            \_&&&&'     Email : Marcus.Crafter@osa.de
> >           &&&&.        Business Hours : +49 69 9757 200
> >     &&&&&&&:           After Hours    : +49 69 49086750
> >
> >


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


AW: [C2 patch] Jikes 1.14

Posted by Carsten Ziegeler <cz...@sundn.de>.
> Marcus Crafter wrote:
>
> Hi Vadim,
>
> On Mon, 2 Jul 2001, Vadim Gritsenko wrote:
>
> > I patched Jikes compiler, it works fine for me know. Please
> test and get back
> > if you need to modify something more.
>
> 	I've just tested the updated code. On my setup I'm receiving an
> 	exception at sitemap compilation time (when I don't include
> the rt.jar
> 	and are intentially forcing jikes to report compile errors)
>
> ERROR   99424   [cocoon  ] (Thread-32): Error compiling sitemap
> java.lang.StringIndexOutOfBoundsException: String index out of range: 0
>         at java.lang.String.charAt(String.java:507)
>         at
> org.apache.cocoon.components.language.programming.java.Jikes.parse
> Stream(Jikes.java:179)
>         at
> org.apache.cocoon.components.language.programming.java.AbstractJav
> aCompiler.getErrors(AbstractJavaCompiler.java:114)
>         at
> org.apache.cocoon.components.language.programming.java.JavaLanguag
> e.compile(JavaLanguage.java:191)
>         at
> org.apache.cocoon.components.language.programming.CompiledProgramm
> ingLanguage.load(CompiledProgrammingLanguage.java:131)
>         at
> org.apache.cocoon.components.language.generator.ProgramGeneratorIm
> pl.generateResource(ProgramGeneratorImpl.java:250)
>         at
> org.apache.cocoon.components.language.generator.ProgramGeneratorIm
> pl.load(ProgramGeneratorImpl.java:159)
>         at org.apache.cocoon.sitemap.Handler.run(Handler.java:191)
>         at java.lang.Thread.run(Thread.java:484)
> ERROR   99424   [cocoon  ] (Thread-10): Problem with servlet
>
> 	The line of code is:
>
> 	if ((line == null) || (line.charAt(0) != ' ')) break;
>
> 	On my system (x86 Debian GNU/Linux, jdk 1.3.0, jikes 1.14) the input
> 	being parsed when the exception is thrown is actually a string of
> 	length zero (in my patch I replaced this test with a test for
> 	line.length() == 0).
>
> 	Is this different on your system - are we seeing some platform
> 	discrepancies here ??
>
Why not combining both tests?

if ((line == null) || (line.length() == 0) || (line.charAt(0) != ' '))
break;

Carsten

> 	Cheers,
>
> 	Marcus
>
>
> --
>         .....
>      ,,$$$$$$$$$,      Marcus Crafter
>     ;$'      '$$$$:    Computer Systems Engineer
>     $:         $$$$:   Open Software Associates GmbH
>      $       o_)$$$:   82-84 Mainzer Landstrasse
>      ;$,    _/\ &&:'   60327 Frankfurt Germany
>        '     /( &&&
>            \_&&&&'     Email : Marcus.Crafter@osa.de
>           &&&&.        Business Hours : +49 69 9757 200
>     &&&&&&&:           After Hours    : +49 69 49086750
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>


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


RE: [C2 patch] Jikes 1.14

Posted by Marcus Crafter <cr...@fztig938.bank.dresdner.net>.
Hi Vadim,

On Mon, 2 Jul 2001, Vadim Gritsenko wrote:

> I patched Jikes compiler, it works fine for me know. Please test and get back
> if you need to modify something more.

	I've just tested the updated code. On my setup I'm receiving an
	exception at sitemap compilation time (when I don't include the rt.jar
	and are intentially forcing jikes to report compile errors)

ERROR   99424   [cocoon  ] (Thread-32): Error compiling sitemap
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
        at java.lang.String.charAt(String.java:507)
        at org.apache.cocoon.components.language.programming.java.Jikes.parseStream(Jikes.java:179)
        at org.apache.cocoon.components.language.programming.java.AbstractJavaCompiler.getErrors(AbstractJavaCompiler.java:114)
        at org.apache.cocoon.components.language.programming.java.JavaLanguage.compile(JavaLanguage.java:191)
        at org.apache.cocoon.components.language.programming.CompiledProgrammingLanguage.load(CompiledProgrammingLanguage.java:131)
        at org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.generateResource(ProgramGeneratorImpl.java:250)
        at org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.load(ProgramGeneratorImpl.java:159)
        at org.apache.cocoon.sitemap.Handler.run(Handler.java:191)
        at java.lang.Thread.run(Thread.java:484)
ERROR   99424   [cocoon  ] (Thread-10): Problem with servlet

	The line of code is:

	if ((line == null) || (line.charAt(0) != ' ')) break;

	On my system (x86 Debian GNU/Linux, jdk 1.3.0, jikes 1.14) the input
	being parsed when the exception is thrown is actually a string of
	length zero (in my patch I replaced this test with a test for
	line.length() == 0).

	Is this different on your system - are we seeing some platform
	discrepancies here ??

	Cheers,

	Marcus
	

-- 
        .....
     ,,$$$$$$$$$,      Marcus Crafter
    ;$'      '$$$$:    Computer Systems Engineer
    $:         $$$$:   Open Software Associates GmbH
     $       o_)$$$:   82-84 Mainzer Landstrasse
     ;$,    _/\ &&:'   60327 Frankfurt Germany
       '     /( &&&
           \_&&&&'     Email : Marcus.Crafter@osa.de
          &&&&.        Business Hours : +49 69 9757 200
    &&&&&&&:           After Hours    : +49 69 49086750


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


RE: [C2 patch] Jikes 1.14

Posted by Vadim Gritsenko <vg...@hns.com>.
Marcus,

I patched Jikes compiler, it works fine for me know. Please test and get back
if you need to modify something more.

PS. the problem with your patch was (as I see it) that it would parse only first error,
appending all other errors (if any) to the message of first error.

Vadim

> -----Original Message-----
> From: Marcus Crafter [mailto:crafterm@fztig938.bank.dresdner.net]
> Sent: Monday, July 02, 2001 8:29
> To: cocoon-dev@xml.apache.org
> Subject: RE: [C2 patch] Jikes 1.14
> 
> 
> Hi Vadim,
> 
> On Fri, 29 Jun 2001, Vadim Gritsenko wrote:
> 
> > Just one quick question: does this patch breaks backward compatibility,
> > or not? I could apply it stright away if I would know that it does not break
> > anything :)
> 
> 	:-)
> 
> 	I've just tested it on my system (Debian GNU/Linux i386 unstable) with
> 	Jikes 1.13 and 1.14 and everything works fine. What versions were
> 	people previously using ? Perhaps we should document which versions of
> 	Jikes we support ?
> 
> > PS: Especially line 
> > +                if (line.length() == 0) {
> > because IIRC line can be null on the end of stream...
> 
> 	Yes, good point. Attached is an updated diff with a check for null.
> 
> 	Thanks for your email and feedback mate. Much appreciated. :-)
> 
> 	Cheers,
> 
> 	Marcus
> 
> -- 
>         .....
>      ,,$$$$$$$$$,      Marcus Crafter
>     ;$'      '$$$$:    Computer Systems Engineer
>     $:         $$$$:   Open Software Associates GmbH
>      $       o_)$$$:   82-84 Mainzer Landstrasse
>      ;$,    _/\ &&:'   60327 Frankfurt Germany
>        '     /( &&&
>            \_&&&&'     Email : Marcus.Crafter@osa.de
>           &&&&.        Business Hours : +49 69 9757 200
>     &&&&&&&:           After Hours    : +49 69 49086750
> 

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