bugfixes
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Fri, 9 Jun 2017 11:39:12 +0000 (14:39 +0300)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Fri, 9 Jun 2017 11:39:12 +0000 (14:39 +0300)
src/main/java/eu/svjatoslav/inspector/java/structure/FieldDescriptor.java
src/main/java/eu/svjatoslav/inspector/java/structure/MethodDescriptor.java

index b6de871..1213e2d 100755 (executable)
@@ -74,6 +74,7 @@ public class FieldDescriptor implements GraphElement {
                             + "\", color=\"" + classDescriptor.getColor()
                             + "\", style=\"bold\"];\n");
 
+        if (type == null) return result.toString();
         if (!type.isVisible())
             return result.toString();
 
@@ -110,7 +111,7 @@ public class FieldDescriptor implements GraphElement {
         } else {
             result.append("        <TR><td ALIGN=\"right\">");
             result.append("<FONT POINT-SIZE=\"8.0\">");
-            result.append(type.getClassName(true) + "</FONT>");
+            result.append(describeType() + "</FONT>");
             result.append("</td><TD PORT=\"" + name);
             result.append("\" ALIGN=\"left\"><FONT POINT-SIZE=\"11.0\">");
             result.append(name + "</FONT></TD></TR>\n");
@@ -118,6 +119,11 @@ public class FieldDescriptor implements GraphElement {
         return result.toString();
     }
 
+    private String describeType() {
+        if (type == null) return "-null-";
+        return type.getClassName(true);
+    }
+
     @Override
     public String getGraphId() {
         return parentClassDescriptior.getGraphId() + ":" + name;
index efe6992..1929348 100755 (executable)
@@ -98,8 +98,8 @@ public class MethodDescriptor implements GraphElement,
                             + classDescriptor.getColor()
                             + "\", style=\"dotted, bold\"];\n");
 
-        if (!returnType.isVisible())
-            return result.toString();
+        if (returnType == null) return result.toString();
+        if (!returnType.isVisible()) return result.toString();
 
         // main type
         if (returnType.areReferencesShown())
@@ -121,7 +121,7 @@ public class MethodDescriptor implements GraphElement,
         result.append("        // " + methodName + "\n");
 
         result.append("        <TR><td ALIGN=\"right\">"
-                + "<FONT POINT-SIZE=\"8.0\">" + returnType.getClassName(true)
+                + "<FONT POINT-SIZE=\"8.0\">" + describeReturnType()
                 + "</FONT>" + "</td><TD PORT=\"" + getMethodLabel()
                 + "\" ALIGN=\"left\"><FONT COLOR =\"red\" POINT-SIZE=\"11.0\">"
                 + getMethodLabel() + "</FONT></TD></TR>\n");
@@ -129,6 +129,12 @@ public class MethodDescriptor implements GraphElement,
         return result.toString();
     }
 
+    private String describeReturnType() {
+        if (returnType == null) return "-null-";
+
+        return returnType.getClassName(true);
+    }
+
     @Override
     public String getGraphId() {
         return parentClass.getGraphId() + ":" + methodName;