Adding work-around for [JACKSON-187], GAE bug that causes problems for class auto-detection
diff --git a/src/mapper/java/org/codehaus/jackson/map/util/ClassUtil.java b/src/mapper/java/org/codehaus/jackson/map/util/ClassUtil.java index 8486816..7ccc758 100644 --- a/src/mapper/java/org/codehaus/jackson/map/util/ClassUtil.java +++ b/src/mapper/java/org/codehaus/jackson/map/util/ClassUtil.java
@@ -82,20 +82,28 @@ public static String isLocalType(Class<?> type) { - // one more: method locals, anonymous, are not good: - if (type.getEnclosingMethod() != null) { - return "local/anonymous"; - } - - /* But how about non-static inner classes? Can't construct - * easily (theoretically, we could try to check if parent - * happens to be enclosing... but that gets convoluted) + /* As per [JACKSON-187], GAE seems to throw SecurityExceptions + * here and there... and GAE itself has a bug, too + * (see []). Bah. */ - if (type.getEnclosingClass() != null) { - if (!Modifier.isStatic(type.getModifiers())) { - return "non-static member class"; + try { + // one more: method locals, anonymous, are not good: + if (type.getEnclosingMethod() != null) { + return "local/anonymous"; + } + + /* But how about non-static inner classes? Can't construct + * easily (theoretically, we could try to check if parent + * happens to be enclosing... but that gets convoluted) + */ + if (type.getEnclosingClass() != null) { + if (!Modifier.isStatic(type.getModifiers())) { + return "non-static member class"; + } } } + catch (SecutiryException e) { } + catch (NullPointerException e) { } return null; }