Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

freemarker is not actually an optional dependency #7

Closed
GoogleCodeExporter opened this issue Mar 21, 2015 · 6 comments
Closed

freemarker is not actually an optional dependency #7

GoogleCodeExporter opened this issue Mar 21, 2015 · 6 comments

Comments

@GoogleCodeExporter
Copy link

STEPS TO REPRODUCE:

1. Have ez-vcard-0.8.0.jar in the classpath, but not freemarker
2. call new VCardReader("").readNext();


EXPECTED OUTPUT:

readNext() should return a null reference


ACTUAL OUTPUT:

    [junit] java.lang.NoClassDefFoundError: freemarker/template/TemplateException
    [junit]     at java.lang.Class.getDeclaredMethods0(Native Method)
    [junit]     at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
    [junit]     at java.lang.Class.getMethod0(Class.java:2685)
    [junit]     at java.lang.Class.getMethod(Class.java:1620)
    [junit]     at ezvcard.types.TypeList.<clinit>(TypeList.java:149)
    [junit]     at ezvcard.io.VCardReader.createTypeObject(VCardReader.java:430)
    [junit]     at ezvcard.io.VCardReader.readNext(VCardReader.java:349)


ez-vcard version 0.8.0

java version "1.7.0_10"
Java(TM) SE Runtime Environment (build 1.7.0_10-b18)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)


Original issue reported on code.google.com by dna...@gmail.com on 15 May 2013 at 8:33

@GoogleCodeExporter
Copy link
Author

It appears as if, when the "Class.getMethod()" method is invoked (line 149 of 
"TypeList"), it iterates over each method in the class.  So in the case of the 
"VCard" class, it is throwing a "NoClassDefFoundError" exception when it gets 
to the "writeHtml" methods, since these methods throw a freemarker exception.

I wasn't able to reproduce it.  I wonder if there is a difference in how the 
"Class.getMethod()" method is implemented in different JVMs.  I've never tried 
running it under of Oracle's 1.7 JVM.  Maybe there is something different about 
it.  Can you try running the attached Java program to see if you get the error 
again?

Original comment by mike.angstadt on 16 May 2013 at 1:19

Attachments:

@GoogleCodeExporter
Copy link
Author

I've went ahead and just removed the exception from the "VCard.writeHtml()" 
methods (see r528).  It shouldn't be there anyway.  The freemarker template 
cannot be modified by the user, so if there's an error with the template, the 
user can't really do anything about it.

Attached is a JAR containing the changes.  Can you test it out?

Original comment by mike.angstadt on 16 May 2013 at 1:16

Attachments:

@GoogleCodeExporter
Copy link
Author

Thanks Mike, that 0.8.1-SNAPSHOT JAR resolves the issue in my environment. 
Looks like a good change!

Original comment by dna...@gmail.com on 16 May 2013 at 5:59

@GoogleCodeExporter
Copy link
Author

Thanks, I'm really glad you were able to catch this.  I'll probably release 
0.8.1 sometime within the next week or so.  Do you mind if I list your full 
name in the credits, or is "dnault" ok?

Original comment by mike.angstadt on 16 May 2013 at 10:54

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Hi Mike,

Sorry for not responding sooner; I don't check my gmail account very often.
Sure, going forward you are welcome to use my full name. Thanks for the
recognition!

Best wishes,
David Nault

Original comment by dna...@gmail.com on 26 May 2013 at 6:38

@GoogleCodeExporter
Copy link
Author

Got it, thanks!

Original comment by mike.angstadt on 27 May 2013 at 2:00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant