Log Message
Cache class name lookup failures (XSTR-724).
Modified Paths
- trunk/xstream/src/java/com/thoughtworks/xstream/mapper/CachingMapper.java
- trunk/xstream-distribution/src/content/changes.html
Diff
Modified: trunk/xstream/src/java/com/thoughtworks/xstream/mapper/CachingMapper.java (2035 => 2036)
--- trunk/xstream/src/java/com/thoughtworks/xstream/mapper/CachingMapper.java 2013-03-13 17:24:14 UTC (rev 2035)
+++ trunk/xstream/src/java/com/thoughtworks/xstream/mapper/CachingMapper.java 2013-03-13 18:18:42 UTC (rev 2036)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2005 Joe Walnes.
- * Copyright (C) 2006, 2007, 2008, 2009, 2011 XStream Committers.
+ * Copyright (C) 2006, 2007, 2008, 2009, 2011, 2013 XStream Committers.
* All rights reserved.
*
* The software in this package is published under the terms of the BSD
@@ -11,7 +11,6 @@
*/
package com.thoughtworks.xstream.mapper;
-import java.lang.ref.WeakReference;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -34,17 +33,22 @@
}
public Class realClass(String elementName) {
- WeakReference reference = (WeakReference) realClassCache.get(elementName);
- if (reference != null) {
- Class cached = (Class) reference.get();
- if (cached != null) {
- return cached;
+ Object cached = realClassCache.get(elementName);
+ if (cached != null) {
+ if (cached instanceof Class) {
+ return (Class)cached;
}
+ throw (CannotResolveClassException)cached;
}
-
- Class result = super.realClass(elementName);
- realClassCache.put(elementName, new WeakReference(result));
- return result;
+
+ try {
+ Class result = super.realClass(elementName);
+ realClassCache.put(elementName, result);
+ return result;
+ } catch (CannotResolveClassException e) {
+ realClassCache.put(elementName, e);
+ throw e;
+ }
}
public void flushCache() {
Modified: trunk/xstream-distribution/src/content/changes.html (2035 => 2036)
--- trunk/xstream-distribution/src/content/changes.html 2013-03-13 17:24:14 UTC (rev 2035)
+++ trunk/xstream-distribution/src/content/changes.html 2013-03-13 18:18:42 UTC (rev 2036)
@@ -58,6 +58,7 @@
<li>JIRA:XSTR-719: Support replacement of default converter in any case.</li>
<li>JIRA:XSTR-725: processAnnotation performance improvement in concurrent situation.</li>
<li>JIRA:XSTR-721: EnumConverter is more lenient while parsing constants.</li>
+ <li>JIRA:XSTR-724: Cache class name lookup failures.</li>
<li>Current IBM JDK for Java 1.4.2 no longer has a reverse field ordering.</li>
</ul>
To unsubscribe from this list please visit:
