Problems with ejbdoclet when there are no files under the merge directory

"Marco Tedone" <[email protected]>
Newsgroups gmane.comp.java.ejb.middlegen.user
Message-ID <004801c4a017$725e9670$0302a8c0@jemoserver>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.