- update layout/skin
- update raw exceptions in JSON component
- fix format error in changes.xml
git-svn-id: https://svn.apache.org/repos/asf/turbine/fulcrum/trunk/json@1890800 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/gson/src/java/org/apache/fulcrum/json/gson/GSONBuilderService.java b/gson/src/java/org/apache/fulcrum/json/gson/GSONBuilderService.java
index 89ec0ff..6e32a84 100644
--- a/gson/src/java/org/apache/fulcrum/json/gson/GSONBuilderService.java
+++ b/gson/src/java/org/apache/fulcrum/json/gson/GSONBuilderService.java
@@ -299,8 +299,8 @@
adapterClass);
} catch (Exception e) {
- throw new Exception(
- "JsonMapperService: Error instantiating "
+ throw new InstantiationException(
+ "JsonMapperService: Error instantiating one of the adapters: "
+ avClass + " for " + forClass);
}
}
diff --git a/jackson/src/java/org/apache/fulcrum/json/jackson/JacksonMapperService.java b/jackson/src/java/org/apache/fulcrum/json/jackson/JacksonMapperService.java
index 69b3d4b..e2609b5 100644
--- a/jackson/src/java/org/apache/fulcrum/json/jackson/JacksonMapperService.java
+++ b/jackson/src/java/org/apache/fulcrum/json/jackson/JacksonMapperService.java
@@ -409,7 +409,7 @@
primary = (AnnotationIntrospector) Class.forName(avClass).getConstructor()
.newInstance();
} catch (Exception e) {
- throw new Exception(
+ throw new InstantiationException(
"JsonMapperService: Error instantiating " + avClass
+ " for " + key);
}
@@ -418,7 +418,7 @@
secondary = (AnnotationIntrospector) Class.forName(avClass).getConstructor()
.newInstance();
} catch (Exception e) {
- throw new Exception(
+ throw new InstantiationException(
"JsonMapperService: Error instantiating " + avClass
+ " for " + key);
}
@@ -458,7 +458,7 @@
assert mapper.getSerializationConfig().isEnabled(
feature) == featureValue;
} catch (Exception e) {
- throw new Exception(
+ throw new AssertionError(
"JsonMapperService: Error instantiating feature "
+ featureKey + " with " + featureValue,
e);
diff --git a/jackson2/src/java/org/apache/fulcrum/json/jackson/Jackson2MapperService.java b/jackson2/src/java/org/apache/fulcrum/json/jackson/Jackson2MapperService.java
index 68d7d23..878e035 100644
--- a/jackson2/src/java/org/apache/fulcrum/json/jackson/Jackson2MapperService.java
+++ b/jackson2/src/java/org/apache/fulcrum/json/jackson/Jackson2MapperService.java
@@ -219,7 +219,7 @@
"registering module " + module );
mapper.registerModule((Module) module);
} else {
- throw new Exception("expecting module type" + Module.class);
+ throw new ClassCastException("expecting module type " + Module.class);
}
return this;
}
@@ -428,7 +428,7 @@
pf = SimpleBeanPropertyFilter.filterOutAllExcept("dummy");
}
if (filterClasses == null)
- throw new Exception("You have to provide some class to apply the filtering!");
+ throw new AssertionError("You have to provide some class to apply the filtering!");
return filter(src, filterClasses, null, pf, refresh);
}
@@ -673,7 +673,7 @@
try {
characterEscapes = (CharacterEscapes) Class.forName(escapeCharsClass).getConstructor().newInstance();
} catch (Exception e) {
- throw new Exception(
+ throw new InstantiationException(
"JsonMapperService: Error instantiating " + escapeCharsClass + " for " + ESCAPE_CHAR_CLASS);
}
}
@@ -700,7 +700,7 @@
djpw = new DefaultJsonPathWrapper(this.mapper);
getLogger().debug("******** initialized new jsonPath defaults: " + djpw.getJsonPathDefault());
} catch (Exception e) {
- throw new Exception(
+ throw new AssertionError(
"JsonMapperService: Error instantiating " + djpw + " using useJsonPath=" + useJsonPath);
}
@@ -725,12 +725,13 @@
try {
getLogger().debug("initializing featureType: " + featureType);
configFeature = loadClass(featureType);
- } catch (Exception e) {
- throw new RuntimeException("JsonMapperService: Error instantiating " + featureType + " for " + featureKey, e);
+ } catch (ClassNotFoundException e) {
+ throw new AssertionError("JsonMapperService: Error instantiating " + featureType + " for " + featureKey, e);
}
ConfigFeature feature = null;
if (!StringUtils.isEmpty(featureKey) && featureValue != null) {
- try {
+ try
+ {
if (configFeature.equals(SerializationFeature.class)) {
feature = SerializationFeature.valueOf(featureKey);
mapper.configure((SerializationFeature) feature, featureValue);
@@ -764,10 +765,11 @@
getLogger().info("initializing parser feature: " + genFeature + " with " + featureValue);
mapper.configure(genFeature, featureValue);
}
- } catch (Exception e) {
- throw new RuntimeException("JsonMapperService: Error instantiating feature " + featureKey + " with "
- + featureValue, e);
- }
+ } catch (Exception e) {
+ throw new RuntimeException("JsonMapperService: Error instantiating feature " + featureKey + " with "
+ + featureValue , e);
+ }
+
}
});
}
@@ -781,13 +783,13 @@
try {
primary = (AnnotationIntrospector) Class.forName(avClass).getConstructor().newInstance();
} catch (Exception e) {
- throw new Exception("JsonMapperService: Error instantiating " + avClass + " for " + key);
+ throw new InstantiationException("JsonMapperService: Error instantiating " + avClass + " for " + key);
}
} else if (key.equals("secondary") && avClass != null) {
try {
secondary = (AnnotationIntrospector) Class.forName(avClass).getConstructor().newInstance();
} catch (Exception e) {
- throw new Exception("JsonMapperService: Error instantiating " + avClass + " for " + key);
+ throw new InstantiationException("JsonMapperService: Error instantiating " + avClass + " for " + key);
}
}
}