[
https://issues.apache.org/jira/browse/OPENJPA-2697?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Richard Zowalla resolved OPENJPA-2697.
--------------------------------------
Resolution: Fixed
Already fixed on master: bcda87c67 (on master) stores parsed.toString() for
criteria queries (QueryKey.java:246-250). Those are the only writes to _query,
so the (String) cast in readExternal at :467 is safe. Closing; please reopen if
this still happens with OpenJPA 4.x.
> QueryCache doesn't work when use external cache storages
> --------------------------------------------------------
>
> Key: OPENJPA-2697
> URL: https://issues.apache.org/jira/browse/OPENJPA-2697
> Project: OpenJPA
> Issue Type: Bug
> Components: datacache
> Affects Versions: 2.2.0, 2.2.2, 2.3.0, 2.4.0, 2.4.1, 2.4.2
> Reporter: Zane Zhang
> Priority: Major
>
> When query object is de-serialized from external cache storage, it report
> error when de-serialized QueryKey. Check following code in QueryKey (2.2.0).
> _query is assumed to be String in readExternal(), but _query is not always
> String object.
> private static QueryKey createKey(QueryContext q, boolean packed,
> Class<?> candidateClass, boolean subclasses, long startIdx, long
> endIdx, Object parsed) {
> ...
> key._query = q.getQueryString();
> if (key._query == null) {
> // this can be a criteria query
> key._query = parsed;
> }
> }
> public void readExternal(ObjectInput in)
> throws IOException, ClassNotFoundException {
> _candidateClassName = (String) in.readObject();
> _subclasses = in.readBoolean();
> _accessPathClassNames = (Set<String>) in.readObject();
> _query = (String) in.readObject();
> _ignoreChanges = in.readBoolean();
> _params = (Map<Object,Object>) in.readObject();
> _rangeStart = in.readLong();
> _rangeEnd = in.readLong ();
> _timeout = in.readInt ();
> }
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)