Skip to content

VCF to HTML conversion is throwing exception with partial conversion #16

@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?
            ParserChainTextReader reader = Ezvcard.parse(new File(fileName
                    + ".vcf"));
            List<VCard> cards = reader.all();
            Iterator<VCard> iter = cards.iterator();

            Ezvcard.writeHtml(cards).go(new File(fileName + "new.html"));


NOTE: No Error when converting to XML, JSON.


What is the expected output?
HTML file all the data

What is the actual output?
Partial HTML 

What version of ez-vcard are you using?
latest, just downloaded

What version of Java are you using?
1.6 and 1.7

Please provide any additional information below.

Apr 22, 2014 2:50:43 PM freemarker.log._JDK14LoggerFactory$JDK14Logger error
SEVERE: Error executing FreeMarker template
FreeMarker template error:
The following has evaluated to null or missing:
==> org  [in template "hcard-template.html" at line 407, column 107]

Tip: If the failing expression is known to be legally null/missing, either 
specify a default value with myOptionalVar!myDefault, or use <#if 
myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the 
last step of the expression; to cover the whole expression, use parenthessis: 
(myOptionVar.foo)!myDefault, (myOptionVar.foo)??

The failing instruction (FTL stack trace):
----------
==> ${org}  [in template "hcard-template.html" at line 407, column 105]
    #if org_index == 0  [in template "hcard-template.html" at line 406, column 65]
----------

Java stack trace (for programmers):
----------
freemarker.core.InvalidReferenceException: [... Exception message was already 
printed; see it above ...]
    at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:98)
    at freemarker.core.EvalUtil.coerceModelToString(EvalUtil.java:382)
    at freemarker.core.Expression.evalAndCoerceToString(Expression.java:115)
    at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
    at freemarker.core.Environment.visit(Environment.java:265)
    at freemarker.core.MixedContent.accept(MixedContent.java:93)
    at freemarker.core.Environment.visit(Environment.java:265)
    at freemarker.core.IfBlock.accept(IfBlock.java:84)
    at freemarker.core.Environment.visitByHiddingParent(Environment.java:286)
    at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:193)
    at freemarker.core.Environment.visitIteratorBlock(Environment.java:509)
    at freemarker.core.IteratorBlock.accept(IteratorBlock.java:103)
    at freemarker.core.Environment.visit(Environment.java:265)
    at freemarker.core.MixedContent.accept(MixedContent.java:93)
    at freemarker.core.Environment.visitByHiddingParent(Environment.java:286)
    at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:86)
    at freemarker.core.Environment.visit(Environment.java:265)
    at freemarker.core.MixedContent.accept(MixedContent.java:93)
    at freemarker.core.Environment.visitByHiddingParent(Environment.java:286)
    at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:193)
    at freemarker.core.Environment.visitIteratorBlock(Environment.java:509)
    at freemarker.core.IteratorBlock.accept(IteratorBlock.java:103)
    at freemarker.core.Environment.visit(Environment.java:265)
    at freemarker.core.MixedContent.accept(MixedContent.java:93)
    at freemarker.core.Environment.visit(Environment.java:265)
    at freemarker.core.Environment.process(Environment.java:243)
    at freemarker.template.Template.process(Template.java:277)
    at ezvcard.io.html.HCardPage.write(HCardPage.java:158)
    at ezvcard.Ezvcard$WriterChainHtml.go(Ezvcard.java:1691)
    at ezvcard.Ezvcard$WriterChainHtml.go(Ezvcard.java:1675)
    at MyVCard.main(MyVCard.java:25)

Exception in thread "main" java.lang.RuntimeException: 
freemarker.core.InvalidReferenceException: The following has evaluated to null 
or missing:
==> org  [in template "hcard-template.html" at line 407, column 107]

Tip: If the failing expression is known to be legally null/missing, either 
specify a default value with myOptionalVar!myDefault, or use <#if 
myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the 
last step of the expression; to cover the whole expression, use parenthessis: 
(myOptionVar.foo)!myDefault, (myOptionVar.foo)??

The failing instruction (print stack trace for 1 more):
==> ${org}  [in template "hcard-template.html" at line 407, column 105]
    at ezvcard.io.html.HCardPage.write(HCardPage.java:161)
    at ezvcard.Ezvcard$WriterChainHtml.go(Ezvcard.java:1691)
    at ezvcard.Ezvcard$WriterChainHtml.go(Ezvcard.java:1675)
    at MyVCard.main(MyVCard.java:25)
Caused by: freemarker.core.InvalidReferenceException: The following has 
evaluated to null or missing:
==> org  [in template "hcard-template.html" at line 407, column 107]

Tip: If the failing expression is known to be legally null/missing, either 
specify a default value with myOptionalVar!myDefault, or use <#if 
myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the 
last step of the expression; to cover the whole expression, use parenthessis: 
(myOptionVar.foo)!myDefault, (myOptionVar.foo)??

The failing instruction (print stack trace for 1 more):
==> ${org}  [in template "hcard-template.html" at line 407, column 105]
    at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:98)
    at freemarker.core.EvalUtil.coerceModelToString(EvalUtil.java:382)
    at freemarker.core.Expression.evalAndCoerceToString(Expression.java:115)
    at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
    at freemarker.core.Environment.visit(Environment.java:265)
    at freemarker.core.MixedContent.accept(MixedContent.java:93)
    at freemarker.core.Environment.visit(Environment.java:265)
    at freemarker.core.IfBlock.accept(IfBlock.java:84)
    at freemarker.core.Environment.visitByHiddingParent(Environment.java:286)
    at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:193)
    at freemarker.core.Environment.visitIteratorBlock(Environment.java:509)
    at freemarker.core.IteratorBlock.accept(IteratorBlock.java:103)
    at freemarker.core.Environment.visit(Environment.java:265)
    at freemarker.core.MixedContent.accept(MixedContent.java:93)
    at freemarker.core.Environment.visitByHiddingParent(Environment.java:286)
    at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:86)
    at freemarker.core.Environment.visit(Environment.java:265)
    at freemarker.core.MixedContent.accept(MixedContent.java:93)
    at freemarker.core.Environment.visitByHiddingParent(Environment.java:286)
    at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:193)
    at freemarker.core.Environment.visitIteratorBlock(Environment.java:509)
    at freemarker.core.IteratorBlock.accept(IteratorBlock.java:103)
    at freemarker.core.Environment.visit(Environment.java:265)
    at freemarker.core.MixedContent.accept(MixedContent.java:93)
    at freemarker.core.Environment.visit(Environment.java:265)
    at freemarker.core.Environment.process(Environment.java:243)
    at freemarker.template.Template.process(Template.java:277)
    at ezvcard.io.html.HCardPage.write(HCardPage.java:158)
    ... 3 more

Original issue reported on code.google.com by amarna...@gmail.com on 22 Apr 2014 at 9:25

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions