StimVinsh / xdocreport

Automatically exported from code.google.com/p/xdocreport
0 stars 0 forks source link

Parsing error #111

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I'm posting this error. I hope this isn't a newbie problem coming from me.

The list function of Freemarker doesn't work for some of my Platform java class 
attributes.

What version of the product are you using? On what operating system?
I'm using xdocreport 0.9.7
freemarker 2.3.19

Please provide any additional information below.

Here is the code i'm using:

// lest create the testPlan report file path
        String testPlanReportFilePath = versionFolderPath.concat("listPlatforms.docx");
        String newtestPlanReportFilePath = versionFolderPath.concat("new_"+"listPlatforms.docx");

        try {
            //Read from a file in the file system
            FileInputStream fis = new FileInputStream(testPlanReportFilePath);
            //Load Docx file by filling Freemarker template engine and cache
            //it to the registry
            IXDocReport report = XDocReportRegistry.getRegistry().loadReport(fis,
                                                        TemplateEngineKind.Freemarker);
            //Create fields metadata to manage lazy loop ([#list])
            //for table row.
            //Create FieldsMetadata by setting Freemarker as template engine
            FieldsMetadata fieldsMetadata = report.createFieldsMetadata();

            //Load fields metadata from Java Class
            fieldsMetadata.addFieldAsList("platforms.name");
        fieldsMetadata.addFieldAsList("platforms.os");
        fieldsMetadata.addFieldAsList("platforms.address");

            // 3) Create context Java model
            IContext context = report.createContext();        

            List<Platform> platforms = new ArrayList<Platform2>();
            platforms.add(new Platform("tii", "192.168.0.1", "aix0.1.2"));
            platforms.add(new Platform("taa", "192.168.0.2", "aix0.1.2"));

            context.put("platforms", platforms);

            OutputStream fos = new FileOutputStream(new File(newtestPlanReportFilePath));
            report.process(context, fos);
            fos.close();
            fis.close();
        } catch (FileNotFoundException e1) {
            e1.printStackTrace();
            return false;
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return false;
        } catch (XDocReportException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return false;
        }

My Platform class is attached and my input docx files are attached too.

In fact for the first docx (the one with platform.name) everything works fine 
but when I use platform.os or platform.address, I have the following error:

freemarker.core.ParseException: Error in template: 
fr.opensagres.xdocreport.document.docx.DocxReport@18603a!word/document.xml
INFO   | jvm 1    | 2012/04/30 10:51:12 | on line 2, column 547
INFO   | jvm 1    | 2012/04/30 10:51:12 | < is not a valid identifier. in 
fr.opensagres.xdocreport.document.docx.DocxReport@18603a!word/document.xml
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.DotVariable(FMParser.java:867)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.AddSubExpression(FMParser.java:722)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.PrimaryExpression(FMParser.java:278)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.UnaryExpression(FMParser.java:324)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.MultiplicativeExpression(FMParser.java:440)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.AdditiveExpression(FMParser.java:390)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.RangeExpression(FMParser.java:561)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.RelationalExpression(FMParser.java:516)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.EqualityExpression(FMParser.java:481)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.AndExpression(FMParser.java:590)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.OrExpression(FMParser.java:613)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.Expression(FMParser.java:226)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.StringOutput(FMParser.java:1066)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.Content(FMParser.java:2580)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.OptionalBlock(FMParser.java:2791)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.List(FMParser.java:1262)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.FreemarkerDirective(FMParser.java:2380)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.Content(FMParser.java:2623)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.OptionalBlock(FMParser.java:2791)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.Escape(FMParser.java:2307)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.FreemarkerDirective(FMParser.java:2450)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.Content(FMParser.java:2623)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.OptionalBlock(FMParser.java:2791)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.core.FMParser.Root(FMParser.java:2963)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.template.Template.<init>(Template.java:171)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.cache.TemplateCache.loadTemplate(TemplateCache.java:447)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:360)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:235)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.template.Configuration.getTemplate(Configuration.java:578)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
freemarker.template.Configuration.getTemplate(Configuration.java:543)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
fr.opensagres.xdocreport.template.freemarker.FreemarkerTemplateEngine.processWit
hCache(FreemarkerTemplateEngine.java:90)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
fr.opensagres.xdocreport.template.AbstractTemplateEngine.process(AbstractTemplat
eEngine.java:110)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
fr.opensagres.xdocreport.template.AbstractTemplateEngine.process(AbstractTemplat
eEngine.java:82)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
fr.opensagres.xdocreport.document.AbstractXDocReport.processTemplateEngine(Abstr
actXDocReport.java:748)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
fr.opensagres.xdocreport.document.AbstractXDocReport.process(AbstractXDocReport.
java:500)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
fr.opensagres.xdocreport.document.AbstractXDocReport.process(AbstractXDocReport.
java:466)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
service.TestPlanManagementService.generateReport(TestPlanManagementService.java:
286)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
java.lang.reflect.Method.invoke(Unknown Source)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.red5.server.service.ServiceInvoker.invoke(ServiceInvoker.java:198)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.red5.server.service.ServiceInvoker.invoke(ServiceInvoker.java:115)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.red5.server.net.rtmp.RTMPHandler.invokeCall(RTMPHandler.java:159)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.red5.server.net.rtmp.RTMPHandler.onInvoke(RTMPHandler.java:401)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.red5.server.net.rtmp.BaseRTMPHandler.messageReceived(BaseRTMPHandler.java:13
3)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.red5.server.net.rtmp.RTMPMinaIoHandler.messageReceived(RTMPMinaIoHandler.jav
a:206)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived
(DefaultIoFilterChain.java:716)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(De
faultIoFilterChain.java:434)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilte
rChain.java:46)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceive
d(DefaultIoFilterChain.java:796)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush
(ProtocolCodecFilter.java:427)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFi
lter.java:245)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(De
faultIoFilterChain.java:434)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilte
rChain.java:46)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceive
d(DefaultIoFilterChain.java:796)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.red5.server.net.rtmpe.RTMPEIoFilter.messageReceived(RTMPEIoFilter.java:124)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(De
faultIoFilterChain.java:434)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilte
rChain.java:46)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceive
d(DefaultIoFilterChain.java:796)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter
.java:119)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(De
faultIoFilterChain.java:434)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(Defaul
tIoFilterChain.java:426)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoPr
ocessor.java:715)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingI
oProcessor.java:668)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingI
oProcessor.java:657)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPolli
ngIoProcessor.java:68)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPo
llingIoProcessor.java:1141)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
INFO   | jvm 1    | 2012/04/30 10:51:12 |   at java.lang.Thread.run(Unknown 
Source)

Original issue reported on code.google.com by kevin.ri...@gmail.com on 30 Apr 2012 at 9:02

Attachments:

GoogleCodeExporter commented 8 years ago
Hi Kevin,

I'm sorry, I have no time to see your problem.
I will see it as soon as possible.

Regards Angelo

Original comment by angelo.z...@gmail.com on 4 May 2012 at 12:35

GoogleCodeExporter commented 8 years ago
I solved this issue, it seems (I'm not sure) that it was a problem with that 
ctrl+f9.
When I enter my fields without ctrl+f9, only my 
fieldsMetadata.addFieldAsList("platforms.name"); is processed right.
but my:
fieldsMetadata.addFieldAsList("platforms.os");
fieldsMetadata.addFieldAsList("platforms.address");
aren't processed right in my docx.

Sorry if it wasn't a real issue.

Regards

Original comment by kevin.ri...@gmail.com on 7 May 2012 at 8:02

GoogleCodeExporter commented 8 years ago
Hi Kevin

I'm happy that you have fixed your problem.
I close this issue.

Regards Angelo

Original comment by angelo.z...@gmail.com on 7 May 2012 at 11:55