[jira] Commented: (VELOCITY-579) Can not access a member of class X with modifiers public even if method is public
[ https://issues.apache.org/jira/browse/VELOCITY-579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12594595#action_12594595 ] Eric Ballet Baz commented on VELOCITY-579: -- Yes it worked in Velocity 1.4 and stopped working in 1.5. To reproduce the problem : 1) Add to your classpath the library tools.jar which you can find in the lib directory of the Sun JDK 2) In your java test program add these two lines : com.sun.javadoc.MethodDoc methodDoc = new com.sun.tools.javadoc.MethodDocImpl(null, null); context.put(methodDoc, methodDoc); 3) In your .vm template simply define : $methodDoc.tags() 4) Run your test program You should see something like : ASTMethod.execute() : exception invoking method 'tags' in class com.sun.tools.javadoc.MethodDocImpl java.lang.IllegalAccessException: Class org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl can not access a member of class com.sun.tools.javadoc.DocImpl with modifiers public at sun.reflect.Reflection.ensureMemberAccess(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:295) at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:245) at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:203) at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:294) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318) at org.apache.velocity.Template.merge(Template.java:254) at Example.init(Example.java:100) at Example.main(Example.java:129) But the method tags() is very public ! it's defined in the following interface : http://java.sun.com/j2se/1.5.0/docs/guide/javadoc/doclet/spec/com/sun/javadoc/Doc.html#tags() and implemented as a public method in DocImpl. The problem here is that the class DocImpl is not public even if she implements public methods, this class is package protected : abstract class DocImpl implements Doc, Comparable This is exactly the same problem with the Weblogic implementation of javax.servlet.http.HttpSession which is not a public class, even if its methods are public! Can not access a member of class X with modifiers public even if method is public --- Key: VELOCITY-579 URL: https://issues.apache.org/jira/browse/VELOCITY-579 Project: Velocity Issue Type: Bug Components: Engine Affects Versions: 1.5 Reporter: Eric Ballet Baz Priority: Blocker When upgrading from 1.4 to 1.5 none of my template is working anymore. For example : [javadoc] ERROR [console:logVelocityMessage] - ASTMethod.execute() : exception invoking method 'tags' in class com.sun.tools.javadoc.MethodDocImpl [javadoc] ERROR [console:logVelocityMessage] - java.lang.IllegalAccessException: Class org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl can not access a member of class com.sun.tools.javadoc.DocImpl with modifiers public The method 'tags()' is public in com.sun.javadoc.Doc, but the implementation is package protected. So the java.lang.reflect.Method object is well returned by the org.apache.velocity.util.introspection.Introspector but not accessible from templates. The same errors occured for example for javax.servlet.http.HttpSession Weblogic's implementation which is not public, but methods are ! It's not possible to wrap all objects javax.servlet.http.HttpSession into public implementations ... The Introspector could call method.setAccessible(true) before returning Method object : if this method has been found, it is a public method ! -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[EMAIL PROTECTED]: Project velocity-engine-test (in module velocity-engine) failed
To whom it may engage... This is an automated request, but not an unsolicited one. For more information please visit http://gump.apache.org/nagged.html, and/or contact the folk at [EMAIL PROTECTED] Project velocity-engine-test has an issue affecting its community integration. This issue affects 1 projects, and has been outstanding for 4 runs. The current state of this project is 'Failed', with reason 'Build Failed'. For reference only, the following projects are affected by this: - velocity-engine-test : Velocity Templating engine Full details are available at: http://vmgump.apache.org/gump/public/velocity-engine/velocity-engine-test/index.html That said, some information snippets are provided here. The following annotations (debug/informational/warning/error messages) were provided: -INFO- Failed with reason build failed The following work was performed: http://vmgump.apache.org/gump/public/velocity-engine/velocity-engine-test/gump_work/build_velocity-engine_velocity-engine-test.html Work Name: build_velocity-engine_velocity-engine-test (Type: Build) Work ended in a state of : Failed Elapsed: 41 secs Command Line: /usr/lib/jvm/java-1.5.0-sun/bin/java -Djava.awt.headless=true org.apache.tools.ant.Main -Dgump.merge=/srv/gump/public/gump/work/merge.xml -Dbuild.sysclasspath=only -Djar.oro.dir=/srv/gump/public/workspace/jakarta-oro -Ddeprecation=false -Djar.commons-collections.version=06052008 -Dskip.jar.loading=true -Djar.commons-lang.dir=/srv/gump/public/workspace/apache-commons/lang/dist -Dversion=06052008 -Djar.commons-collections.dir=/srv/gump/public/workspace/apache-commons/collections/build -Djar.commons-lang.version=06052008 -Djar.oro.name=jakarta-oro -Djar.oro.version=06052008 test [Working Directory: /srv/gump/public/workspace/velocity-engine/build] CLASSPATH: /usr/lib/jvm/java-1.5.0-sun/lib/tools.jar:/srv/gump/public/workspace/velocity-engine/test:/srv/gump/public/workspace/velocity-engine/bin/test-classes:/srv/gump/public/workspace/velocity-engine/test/cpload/test1.jar:/srv/gump/public/workspace/velocity-engine/test/texen-classpath/test.jar:/srv/gump/public/workspace/velocity-engine/test/multiloader/test1.jar:/srv/gump/public/workspace/velocity-engine/bin/velocity-06052008.jar:/srv/gump/public/workspace/velocity-engine/bin/velocity-dep-06052008.jar:/srv/gump/public/workspace/ant/dist/lib/ant-jmf.jar:/srv/gump/public/workspace/ant/dist/lib/ant-swing.jar:/srv/gump/public/workspace/ant/dist/lib/ant-apache-resolver.jar:/srv/gump/public/workspace/ant/dist/lib/ant-trax.jar:/srv/gump/public/workspace/ant/dist/lib/ant-junit.jar:/srv/gump/public/workspace/ant/dist/lib/ant-launcher.jar:/srv/gump/public/workspace/ant/dist/lib/ant-nodeps.jar:/srv/gump/public/workspace/ant/dist/lib/ant.jar:/srv/gump/packages/junit3.8.1/junit.jar:/s rv/gump/public/workspace/xml-commons/java/build/resolver.jar:/srv/gump/packages/avalon-logkit/avalon-logkit-2.1.jar:/srv/gump/public/workspace/apache-commons/collections/build/commons-collections-06052008.jar:/srv/gump/public/workspace/apache-commons/lang/commons-lang-06052008.jar:/srv/gump/public/workspace/logging-log4j-12/dist/lib/log4j-06052008.jar:/srv/gump/public/workspace/jdom/build/jdom.jar:/srv/gump/public/workspace/jakarta-servletapi-4/lib/servlet.jar:/srv/gump/public/workspace/jakarta-oro/jakarta-oro-06052008.jar:/srv/gump/packages/werken-xpath/werken-xpath-0.9.4.jar:/srv/gump/public/workspace/apache-commons/logging/target/commons-logging-06052008.jar:/srv/gump/public/workspace/apache-commons/logging/target/commons-logging-api-06052008.jar:/srv/gump/packages/antlr-2.7.6/antlr.jar:/srv/gump/public/workspace/hsqldb/lib/hsqldb.jar - [junit] method= doException [junit] throwable = java.lang.NullPointerException [junit] exception = null [junit] Caught MIE (good!) : [junit] reference = woogie [junit] method= getFoo [junit] throwable = java.lang.Exception: Hello from getFoo() [junit] exception = Hello from getFoo() [junit] Caught MIE (good!) : [junit] reference = woogie [junit] method= getFoo [junit] throwable = java.lang.Exception: Hello from getFoo() [junit] exception = Hello from getFoo() [junit] Caught MIE (good!) : [junit] reference = [junit] method= foo [junit] throwable = java.lang.Exception: Hello from setFoo() [junit] exception = Hello from setFoo() [junit] Caught MIE (good!) : [junit] reference = woogie [junit] method= getFoo [junit] throwable = java.lang.Exception: Hello from getFoo() [junit] exception = Hello from getFoo() [junit] Tests run: 5, Failures: 0, Errors: 0, Time elapsed: 0.428 sec [junit] Running org.apache.velocity.test.MethodOverloadingTestCase [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.481 sec [junit] Running org.apache.velocity.test.MiscTestCase [junit] Tests run: 2, Failures: 0,
Re: Expanding Environmental variables patch
Charlei, csanders wrote: Attached is the patch, adding three new functions, expandEnvironmentalVariables( ExtendedProperties ), expandEnvironmentalVariables(Vector ), Any reason not to accept any Collection rather than limiting this to just a Vector? Forgive me if there are API implications coming from ExtendedProperties. + Vector newVector = new Vector(); This should really be: Vectory newVector = new Vector(stringVector.size()); (or an appropriate Collection instance) Better yet, if you are using Vectors, why not use Vector.set() instead of creating a completely new Vector every time? I actually dislike modifying passed-in parameters, but your expandEnvironmentalVariables(ExtendedProperties) method does that already, so what does it matter if the methods that it calls do the same? The expansion should really take place in ExtendedProperties, but this might work in the interim . Then why not patch ExtendedProperties instead? I'm a little curious why this capability needs to be added to Velocity in the first place. Does anybody really use environment variables anymore, anyway? If anything, this should be implemented as a subclass of ExtendedProperties and handled there. There is no need to modify any Velocity code to get this to work. -chris signature.asc Description: OpenPGP digital signature
[jira] Updated: (VELOCITY-588) Provide a an ubespector that allows chaining other uberspectors
[ https://issues.apache.org/jira/browse/VELOCITY-588?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sergiu Dumitriu updated VELOCITY-588: - Attachment: ChainableUberspectorsXWiki.patch This is the first version of the implementation done for XWiki. Please review it, and if it looks good I can make a patch for the velocity trunk. Provide a an ubespector that allows chaining other uberspectors --- Key: VELOCITY-588 URL: https://issues.apache.org/jira/browse/VELOCITY-588 Project: Velocity Issue Type: Improvement Components: Engine Affects Versions: 1.5 Reporter: Vincent Massol Priority: Minor Attachments: ChainableUberspectorsXWiki.patch In XWiki project we're using Velocity and have a need to write several uberspectors that we'd like to chain (see http://jira.xwiki.org/jira/browse/XWIKI-2182). We're writing a custom uberspector that'll allow chaining other uberspectors but we think that uberspector should best be located in the Velocity project if you're interested. Let us know what you think and if you agree we can donate it to you or you could create one from scratch if you agree with the use case. Thanks -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]