You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Durrant, Peter" <Pe...@COGNOS.com> on 2002/01/04 12:25:51 UTC

Logic and Java

I'm trying to resolve a problem with java generated from logicsheets.

Suppose I have the following code in a logicsheet
<xsp:logic>
	double small_value = 1e-10;
	double large_value = 1e10;
	double other_value = 1e+10;
</xsp:logic>

then Cocoon will generate a java file with the following code in it
	double small_value = 1e - 10;
	double large_value = 1e10;
	double other_value = 1e + 10;

This is obviously incorrect - it should produce "1e-10" and "1e+10" not "1e
- 10" and "1e + 10". The spaces introduced into these numbers produces a
syntax error during compilation since the numbers are incorrectly formatted.
Cocoon returns an "org.apache.cocoon.ProcessingException":

org.apache.cocoon.ProcessingException: Language Exception:
org.apache.cocoon.components.language.LanguageException: Error compiling
double_xsp: Line 95, column 52: Invalid floating point format

where Line 95, column 52 corresponds to the first "1" character in the "1e -
10".

I'm not entirely sure of the underlying process that generates the java file
prior to compilation -- I'm guessing this is caused by JstyleFormatter?
(from the following parameter in my cocoon.xconf)
	   <parameter name="code-formatter"
value="org.apache.cocoon.components.language.programming.java.JstyleFormatte
r"/>

If this is the case then are there other code formatters that could be used?

Or perhaps this is a known bug that has been fixed since the release of
Cocoon 2.

Any light shed on this problem will be gratefully received.

Pete

(I originally posted a similar question to the users group, but we were
unable to resolve the problem. After a further examination of the problem I
think this may be a bug, so I'm bringing it to the attention of the
developers group.)
---
Cognos, London, UK

This message may contain privileged and/or confidential information.  If you
have received this e-mail in error or are not the intended recipient, you
may not use, copy, disseminate, or distribute it; do not open any
attachments, delete it immediately from your system and notify the sender by
e-mail promptly that you have done so.  Thank You.

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


Re: Logic and Java

Posted by giacomo <gi...@apache.org>.
On Fri, 4 Jan 2002, Durrant, Peter wrote:

> I'm trying to resolve a problem with java generated from logicsheets.
>
> Suppose I have the following code in a logicsheet
> <xsp:logic>
> 	double small_value = 1e-10;
> 	double large_value = 1e10;
> 	double other_value = 1e+10;
> </xsp:logic>
>
> then Cocoon will generate a java file with the following code in it
> 	double small_value = 1e - 10;
> 	double large_value = 1e10;
> 	double other_value = 1e + 10;
>
> This is obviously incorrect - it should produce "1e-10" and "1e+10" not "1e
> - 10" and "1e + 10". The spaces introduced into these numbers produces a
> syntax error during compilation since the numbers are incorrectly formatted.
> Cocoon returns an "org.apache.cocoon.ProcessingException":
>
> org.apache.cocoon.ProcessingException: Language Exception:
> org.apache.cocoon.components.language.LanguageException: Error compiling
> double_xsp: Line 95, column 52: Invalid floating point format
>
> where Line 95, column 52 corresponds to the first "1" character in the "1e -
> 10".
>
> I'm not entirely sure of the underlying process that generates the java file
> prior to compilation -- I'm guessing this is caused by JstyleFormatter?
> (from the following parameter in my cocoon.xconf)
> 	   <parameter name="code-formatter"
> value="org.apache.cocoon.components.language.programming.java.JstyleFormatte
> r"/>

It might be the case that Jstyle is formatting the wrong way. IIRC the
code-formatter is optional. You should be able to put it into a comment
(or delete it entirely from the cocoon.xconf.

Giacomo


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