add exception handling for #1267

This commit is contained in:
wing328
2015-10-08 23:31:57 +08:00
parent 69a346cb57
commit 6ee42bebe6

View File

@@ -492,10 +492,16 @@ public class DefaultCodegen {
} else if (p instanceof DecimalProperty) {
datatype = "number";
} else if (p instanceof RefProperty) {
RefProperty r = (RefProperty) p;
datatype = r.get$ref();
if (datatype.indexOf("#/definitions/") == 0) {
datatype = datatype.substring("#/definitions/".length());
try {
RefProperty r = (RefProperty) p;
datatype = r.get$ref();
if (datatype.indexOf("#/definitions/") == 0) {
datatype = datatype.substring("#/definitions/".length());
}
} catch (Exception e) {
LOGGER.warn("Error obtaining the datatype from RefProperty:" + p + ". Datatype default to Object");
datatype = "Object";
e.printStackTrace();
}
} else {
if (p != null) {