Discussion:
[Middlegen-user] Problems with ejbdoclet when there are no files under the merge directory
Marco Tedone
2004-09-21 18:14:13 UTC
Permalink
Dear all,

I'm using middlegen to generate entity beans from a db connection. Inside
the middlegen ant task, I've got the following nested element:

<cmp20
destination="${build.gen-src.dir}"
package="${name}.ejb"
interfacepackage="${name}.intf"
jndiprefix="${unique.name}"
pkclass="true"
dataobject="false"
valueobject="true"
mergedir="${basedir}/src/middlegen"
sessionfacade="false"
viewtype="local"
readonly="false"
fkcmp="true"
guid="true"
Please notice the 'mergedir' attrribute. In the case I haven't got any files
under the merge directory, each entity bean is generated with the following
comment
as last line:

// No
D:\OPENSOURCES\middlegen-2.0-vo\umo/src/middlegen/cmp20-countries-class-code.txt
found.

Except from the names that are local to my computer, the substance doesn't
change. When ejbdoclet executes on the entity bean source which contains the
above comment as last line, it fails with the error show below:


ejbdoclet:
[mkdir] Created dir: D:\OPENSOURCES\middlegen-2.0-vo\umo\build\ejb-meta
[ejbdoclet] java.lang.Error: Invalid escape character at line 328 column 42.
[ejbdoclet] at xjavadoc.JavaCharStream.readChar(JavaCharStream.java:320)
[ejbdoclet] at
xjavadoc.SimpleParserTokenManager.getNextToken(SimpleParserTokenManager.java:1675)
[ejbdoclet] at
xjavadoc.SimpleParser.jj_consume_token(SimpleParser.java:7740)
[ejbdoclet] at
xjavadoc.SimpleParser.Method_Block(SimpleParser.java:2866)
[ejbdoclet] at
xjavadoc.SimpleParser.MethodDeclaration(SimpleParser.java:1164)
[ejbdoclet] at
xjavadoc.SimpleParser.ClassBodyDeclaration(SimpleParser.java:474)
[ejbdoclet] at xjavadoc.SimpleParser.ClassBody(SimpleParser.java:393)
[ejbdoclet] at
xjavadoc.SimpleParser.UnmodifiedClassDeclaration(SimpleParser.java:350)
[ejbdoclet] at
xjavadoc.SimpleParser.ClassDeclaration(SimpleParser.java:302)
[ejbdoclet] at
xjavadoc.SimpleParser.TypeDeclaration(SimpleParser.java:228)
[ejbdoclet] at
xjavadoc.SimpleParser.CompilationUnit(SimpleParser.java:184)
[ejbdoclet] at xjavadoc.SimpleParser.populate(SimpleParser.java:127)
[ejbdoclet] at xjavadoc.SourceClass.parse(SourceClass.java:745)
[ejbdoclet] at xjavadoc.SourceClass.<init>(SourceClass.java:113)
[ejbdoclet] at xjavadoc.XJavaDoc.scanAndPut(XJavaDoc.java:918)
[ejbdoclet] at xjavadoc.XJavaDoc.getXClass(XJavaDoc.java:429)
[ejbdoclet] at
xjavadoc.XJavaDoc.getOuterSourceClasses(XJavaDoc.java:793)
[ejbdoclet] at xjavadoc.XJavaDoc.getSourceClasses(XJavaDoc.java:346)
[ejbdoclet] at xjavadoc.XJavaDoc.getSourceClasses(XJavaDoc.java:302)
[ejbdoclet] at xjavadoc.XJavaDoc.getSourceClasses(XJavaDoc.java:321)
[ejbdoclet] at
xdoclet.TemplateSubTask.startProcessPerClass(TemplateSubTask.java:655)
[ejbdoclet] at
xdoclet.TemplateSubTask.startProcess(TemplateSubTask.java:592)
[ejbdoclet] at xdoclet.TemplateSubTask.execute(TemplateSubTask.java:485)
[ejbdoclet] at xdoclet.XDocletMain.start(XDocletMain.java:48)
[ejbdoclet] at xdoclet.DocletTask.start(DocletTask.java:458)
[ejbdoclet] at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:96)
[ejbdoclet] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:193)
[ejbdoclet] at org.apache.tools.ant.Task.perform(Task.java:341)
[ejbdoclet] at org.apache.tools.ant.Target.execute(Target.java:309)
[ejbdoclet] at org.apache.tools.ant.Target.performTasks(Target.java:336)
[ejbdoclet] at
org.apache.tools.ant.Project.executeTarget(Project.java:1339)
[ejbdoclet] at
org.apache.tools.ant.Project.executeTargets(Project.java:1255)
[ejbdoclet] at org.apache.tools.ant.Main.runBuild(Main.java:609)
[ejbdoclet] at org.apache.tools.ant.Main.start(Main.java:196)
[ejbdoclet] at org.apache.tools.ant.Main.main(Main.java:235)


I found that a possible solution is to eliminate the mergedir attribute from
the cmp subelement. However, this doesn't seem to me the optimal solution,
especially in the case where I *need* a merge dir for some files but not for
others. It would help if the comment which gets autogenerated would be
written without Java escape symbols ('\').

If you tell me where this line gets generated, I may update the code and
submit a patch.

Regards,

Marco
D***@de.gi-de.com
2004-09-22 06:52:22 UTC
Permalink
Hi,

your problem seems to have a simple solution to me: The directory you
specify probably does not exist at all. Middlegen is pright then. Note the
use of "/" and "\" in the path
D:\OPENSOURCES\middlegen-2.0-vo\umo/src/middlegen/cmp20-countries-class-code.txt

Middlegen probably checks the mergedir for matching mergefiles for every
Bean Class. It does then not find the directory and warns you with this
message. Xdoclet somehow gets upset with the "\" in the comment.
So it should work if you specify the right path.

Cheers.




"Marco Tedone" <***@jemos.co.uk>
Gesendet von: middlegen-user-***@lists.sourceforge.net
21.09.2004 22:13
Bitte antworten an middlegen-user

An: "Middlegen-users" <middlegen-***@lists.sourceforge.net>
Kopie:
Thema: [Middlegen-user] Problems with ejbdoclet when there are no
files under the merge directory


Dear all,

I'm using middlegen to generate entity beans from a db connection. Inside
the middlegen ant task, I've got the following nested element:

<cmp20
destination="${build.gen-src.dir}"
package="${name}.ejb"
interfacepackage="${name}.intf"
jndiprefix="${unique.name}"
pkclass="true"
dataobject="false"
valueobject="true"
mergedir="${basedir}/src/middlegen"
sessionfacade="false"
viewtype="local"
readonly="false"
fkcmp="true"
guid="true"
Please notice the 'mergedir' attrribute. In the case I haven't got any
files
under the merge directory, each entity bean is generated with the
following
comment
as last line:

// No
D:\OPENSOURCES\middlegen-2.0-vo\umo/src/middlegen/cmp20-countries-class-code.txt

found.

Except from the names that are local to my computer, the substance doesn't

change. When ejbdoclet executes on the entity bean source which contains
the
above comment as last line, it fails with the error show below:


ejbdoclet:
[mkdir] Created dir:
D:\OPENSOURCES\middlegen-2.0-vo\umo\build\ejb-meta
[ejbdoclet] java.lang.Error: Invalid escape character at line 328 column
42.
[ejbdoclet] at
xjavadoc.JavaCharStream.readChar(JavaCharStream.java:320)
[ejbdoclet] at
xjavadoc.SimpleParserTokenManager.getNextToken(SimpleParserTokenManager.java:1675)
[ejbdoclet] at
xjavadoc.SimpleParser.jj_consume_token(SimpleParser.java:7740)
[ejbdoclet] at
xjavadoc.SimpleParser.Method_Block(SimpleParser.java:2866)
[ejbdoclet] at
xjavadoc.SimpleParser.MethodDeclaration(SimpleParser.java:1164)
[ejbdoclet] at
xjavadoc.SimpleParser.ClassBodyDeclaration(SimpleParser.java:474)
[ejbdoclet] at xjavadoc.SimpleParser.ClassBody(SimpleParser.java:393)
[ejbdoclet] at
xjavadoc.SimpleParser.UnmodifiedClassDeclaration(SimpleParser.java:350)
[ejbdoclet] at
xjavadoc.SimpleParser.ClassDeclaration(SimpleParser.java:302)
[ejbdoclet] at
xjavadoc.SimpleParser.TypeDeclaration(SimpleParser.java:228)
[ejbdoclet] at
xjavadoc.SimpleParser.CompilationUnit(SimpleParser.java:184)
[ejbdoclet] at xjavadoc.SimpleParser.populate(SimpleParser.java:127)
[ejbdoclet] at xjavadoc.SourceClass.parse(SourceClass.java:745)
[ejbdoclet] at xjavadoc.SourceClass.<init>(SourceClass.java:113)
[ejbdoclet] at xjavadoc.XJavaDoc.scanAndPut(XJavaDoc.java:918)
[ejbdoclet] at xjavadoc.XJavaDoc.getXClass(XJavaDoc.java:429)
[ejbdoclet] at
xjavadoc.XJavaDoc.getOuterSourceClasses(XJavaDoc.java:793)
[ejbdoclet] at xjavadoc.XJavaDoc.getSourceClasses(XJavaDoc.java:346)
[ejbdoclet] at xjavadoc.XJavaDoc.getSourceClasses(XJavaDoc.java:302)
[ejbdoclet] at xjavadoc.XJavaDoc.getSourceClasses(XJavaDoc.java:321)
[ejbdoclet] at
xdoclet.TemplateSubTask.startProcessPerClass(TemplateSubTask.java:655)
[ejbdoclet] at
xdoclet.TemplateSubTask.startProcess(TemplateSubTask.java:592)
[ejbdoclet] at
xdoclet.TemplateSubTask.execute(TemplateSubTask.java:485)
[ejbdoclet] at xdoclet.XDocletMain.start(XDocletMain.java:48)
[ejbdoclet] at xdoclet.DocletTask.start(DocletTask.java:458)
[ejbdoclet] at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:96)
[ejbdoclet] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:193)
[ejbdoclet] at org.apache.tools.ant.Task.perform(Task.java:341)
[ejbdoclet] at org.apache.tools.ant.Target.execute(Target.java:309)
[ejbdoclet] at
org.apache.tools.ant.Target.performTasks(Target.java:336)
[ejbdoclet] at
org.apache.tools.ant.Project.executeTarget(Project.java:1339)
[ejbdoclet] at
org.apache.tools.ant.Project.executeTargets(Project.java:1255)
[ejbdoclet] at org.apache.tools.ant.Main.runBuild(Main.java:609)
[ejbdoclet] at org.apache.tools.ant.Main.start(Main.java:196)
[ejbdoclet] at org.apache.tools.ant.Main.main(Main.java:235)


I found that a possible solution is to eliminate the mergedir attribute
from
the cmp subelement. However, this doesn't seem to me the optimal solution,

especially in the case where I *need* a merge dir for some files but not
for
others. It would help if the comment which gets autogenerated would be
written without Java escape symbols ('\').

If you tell me where this line gets generated, I may update the code and
submit a patch.

Regards,

Marco




-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
Marco Tedone
2004-09-22 16:21:19 UTC
Permalink
The fact is that I *don't* specify the path, if not in the last part
(src/middlegen), which doesn't contain escape characters. The magic is done
by ${basedir}, which resolves in the path to the current folder, using the
system file separator, and this is where the problem is. There could be two
possible solutions:

a) XDoclet-patch. XDoclet shouldn't parse lines which begins with //

b) Middlegen-patch. Middlegen shouldn't be generating any line with Java
escape characters.

Personally I'd say that the second could be better.

Marco

----- Original Message -----
From: ***@de.gi-de.com
To: middlegen-***@lists.sourceforge.net
Sent: Wednesday, September 22, 2004 9:51 AM
Subject: Re: [Middlegen-user] Problems with ejbdoclet when there are no
files under the merge directory



Hi,

your problem seems to have a simple solution to me: The directory you
specify probably does not exist at all. Middlegen is pright then. Note the
use of "/" and "\" in the path
D:\OPENSOURCES\middlegen-2.0-vo\umo/src/middlegen/cmp20-countries-class-code.txt
Middlegen probably checks the mergedir for matching mergefiles for every
Bean Class. It does then not find the directory and warns you with this
message. Xdoclet somehow gets upset with the "\" in the comment.
So it should work if you specify the right path.

Cheers.


"Marco Tedone" <***@jemos.co.uk>
Gesendet von: middlegen-user-***@lists.sourceforge.net
21.09.2004 22:13
Bitte antworten an middlegen-user
An: "Middlegen-users" <middlegen-***@lists.sourceforge.net>
Kopie:
Thema: [Middlegen-user] Problems with ejbdoclet when there
are no files under the merge directory



Dear all,

I'm using middlegen to generate entity beans from a db connection. Inside
the middlegen ant task, I've got the following nested element:

<cmp20
destination="${build.gen-src.dir}"
package="${name}.ejb"
interfacepackage="${name}.intf"
jndiprefix="${unique.name}"
pkclass="true"
dataobject="false"
valueobject="true"
mergedir="${basedir}/src/middlegen"
sessionfacade="false"
viewtype="local"
readonly="false"
fkcmp="true"
guid="true"
Please notice the 'mergedir' attrribute. In the case I haven't got any files
under the merge directory, each entity bean is generated with the following
comment
as last line:

// No
D:\OPENSOURCES\middlegen-2.0-vo\umo/src/middlegen/cmp20-countries-class-code.txt
found.

Except from the names that are local to my computer, the substance doesn't
change. When ejbdoclet executes on the entity bean source which contains the
above comment as last line, it fails with the error show below:


ejbdoclet:
[mkdir] Created dir: D:\OPENSOURCES\middlegen-2.0-vo\umo\build\ejb-meta
[ejbdoclet] java.lang.Error: Invalid escape character at line 328 column 42.
[ejbdoclet] at xjavadoc.JavaCharStream.readChar(JavaCharStream.java:320)
[ejbdoclet] at
xjavadoc.SimpleParserTokenManager.getNextToken(SimpleParserTokenManager.java:1675)
[ejbdoclet] at
xjavadoc.SimpleParser.jj_consume_token(SimpleParser.java:7740)
[ejbdoclet] at
xjavadoc.SimpleParser.Method_Block(SimpleParser.java:2866)
[ejbdoclet] at
xjavadoc.SimpleParser.MethodDeclaration(SimpleParser.java:1164)
[ejbdoclet] at
xjavadoc.SimpleParser.ClassBodyDeclaration(SimpleParser.java:474)
[ejbdoclet] at xjavadoc.SimpleParser.ClassBody(SimpleParser.java:393)
[ejbdoclet] at
xjavadoc.SimpleParser.UnmodifiedClassDeclaration(SimpleParser.java:350)
[ejbdoclet] at
xjavadoc.SimpleParser.ClassDeclaration(SimpleParser.java:302)
[ejbdoclet] at
xjavadoc.SimpleParser.TypeDeclaration(SimpleParser.java:228)
[ejbdoclet] at
xjavadoc.SimpleParser.CompilationUnit(SimpleParser.java:184)
[ejbdoclet] at xjavadoc.SimpleParser.populate(SimpleParser.java:127)
[ejbdoclet] at xjavadoc.SourceClass.parse(SourceClass.java:745)
[ejbdoclet] at xjavadoc.SourceClass.<init>(SourceClass.java:113)
[ejbdoclet] at xjavadoc.XJavaDoc.scanAndPut(XJavaDoc.java:918)
[ejbdoclet] at xjavadoc.XJavaDoc.getXClass(XJavaDoc.java:429)
[ejbdoclet] at
xjavadoc.XJavaDoc.getOuterSourceClasses(XJavaDoc.java:793)
[ejbdoclet] at xjavadoc.XJavaDoc.getSourceClasses(XJavaDoc.java:346)
[ejbdoclet] at xjavadoc.XJavaDoc.getSourceClasses(XJavaDoc.java:302)
[ejbdoclet] at xjavadoc.XJavaDoc.getSourceClasses(XJavaDoc.java:321)
[ejbdoclet] at
xdoclet.TemplateSubTask.startProcessPerClass(TemplateSubTask.java:655)
[ejbdoclet] at
xdoclet.TemplateSubTask.startProcess(TemplateSubTask.java:592)
[ejbdoclet] at xdoclet.TemplateSubTask.execute(TemplateSubTask.java:485)
[ejbdoclet] at xdoclet.XDocletMain.start(XDocletMain.java:48)
[ejbdoclet] at xdoclet.DocletTask.start(DocletTask.java:458)
[ejbdoclet] at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:96)
[ejbdoclet] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:193)
[ejbdoclet] at org.apache.tools.ant.Task.perform(Task.java:341)
[ejbdoclet] at org.apache.tools.ant.Target.execute(Target.java:309)
[ejbdoclet] at org.apache.tools.ant.Target.performTasks(Target.java:336)
[ejbdoclet] at
org.apache.tools.ant.Project.executeTarget(Project.java:1339)
[ejbdoclet] at
org.apache.tools.ant.Project.executeTargets(Project.java:1255)
[ejbdoclet] at org.apache.tools.ant.Main.runBuild(Main.java:609)
[ejbdoclet] at org.apache.tools.ant.Main.start(Main.java:196)
[ejbdoclet] at org.apache.tools.ant.Main.main(Main.java:235)


I found that a possible solution is to eliminate the mergedir attribute from
the cmp subelement. However, this doesn't seem to me the optimal solution,
especially in the case where I *need* a merge dir for some files but not for
others. It would help if the comment which gets autogenerated would be
written without Java escape symbols ('\').

If you tell me where this line gets generated, I may update the code and
submit a patch.

Regards,

Marco




-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php

Loading...