[
https://issues.apache.org/jira/browse/VELOCITY-858?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claude Brisson resolved VELOCITY-858.
-------------------------------------
Resolution: Fixed
Assignee: Claude Brisson
Fix Version/s: 2.0
Already done for 2.0.
> Class org.apache.velocity.util.introspection.UberspectImpl can not access a
> member of class com.google.common.collect.Iterables$8 with modifiers "public"
> ---------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: VELOCITY-858
> URL: https://issues.apache.org/jira/browse/VELOCITY-858
> Project: Velocity
> Issue Type: Bug
> Affects Versions: 1.7
> Environment: Java 8, guava
> Reporter: Andrey Chursin
> Assignee: Claude Brisson
> Priority: Major
> Fix For: 2.0
>
>
> Probably related issue:
> https://issues.apache.org/jira/browse/VELOCITY-579
> I am passing result of guava's Iterables.transform() to velocity.
> Attempt to iterate over it throws access exception, as UberspectImpl tries to
> access method iterator on object's class
> Class type = obj.getClass();
> ...
> Method iter = type.getMethod("iterator", null);
> Problem is, that while iterator() method is public, class
> com.google.common.collect.Iterables$8 is private, so velocity can't access
> it's method through reflection.
> I suggest call Iterable::iterator() for classes implementing Iterable,
> instead of trying to access method through reflection, as you already do for
> Collection implementations.
> Basically, replace (in UberspectImpl::getIterator(Object, Info))
> else if (obj instanceof Collection)
> {
> return ((Collection) obj).iterator();
> }
> with
> else if (obj instanceof Iterable)
> {
> return ((Iterable) obj).iterator();
> }
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]