Skip to content

Commit 6ee42be

Browse files
committed
add exception handling for #1267
1 parent 69a346c commit 6ee42be

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,10 +492,16 @@ public String getSwaggerType(Property p) {
492492
} else if (p instanceof DecimalProperty) {
493493
datatype = "number";
494494
} else if (p instanceof RefProperty) {
495-
RefProperty r = (RefProperty) p;
496-
datatype = r.get$ref();
497-
if (datatype.indexOf("#/definitions/") == 0) {
498-
datatype = datatype.substring("#/definitions/".length());
495+
try {
496+
RefProperty r = (RefProperty) p;
497+
datatype = r.get$ref();
498+
if (datatype.indexOf("#/definitions/") == 0) {
499+
datatype = datatype.substring("#/definitions/".length());
500+
}
501+
} catch (Exception e) {
502+
LOGGER.warn("Error obtaining the datatype from RefProperty:" + p + ". Datatype default to Object");
503+
datatype = "Object";
504+
e.printStackTrace();
499505
}
500506
} else {
501507
if (p != null) {

0 commit comments

Comments
 (0)