From 569d6849ccba9ac814969a4accd2a37ca0429de0 Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Mon, 20 Oct 2008 09:55:42 +0000 Subject: [PATCH] Fixed exception when an unknown class dependency is specified. --- doc/ant.xml | 2 +- doc/ver.xml | 5 ++++- src/org/umlgraph/doclet/ClassGraph.java | 6 ++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/ant.xml b/doc/ant.xml index 762e04c..b5fc7e5 100644 --- a/doc/ant.xml +++ b/doc/ant.xml @@ -13,7 +13,7 @@ like the following. - + diff --git a/doc/ver.xml b/doc/ver.xml index 250c500..9aad6d6 100644 --- a/doc/ver.xml +++ b/doc/ver.xml @@ -6,7 +6,10 @@
Version 5.2 Under development
  • Corrected case of the tools.jar filename in the umlgraph shell script. -(Noted by Øyvind Jergan). +(Reported by Øyvind Jergan). +
  • +
  • Fixed exception when an unknown class dependency is specified. +(Reported by Jan Schlüter).
diff --git a/src/org/umlgraph/doclet/ClassGraph.java b/src/org/umlgraph/doclet/ClassGraph.java index 2c08881..9b2a953 100644 --- a/src/org/umlgraph/doclet/ClassGraph.java +++ b/src/org/umlgraph/doclet/ClassGraph.java @@ -1043,7 +1043,8 @@ class ClassGraph { private String getPackageName(String className) { if (this.rootClassdocs.get(className) == null) { - return className.substring(0, className.lastIndexOf('.')); + int idx = className.lastIndexOf('.'); + return idx > 0 ? className.substring(0, idx) : ""; } else { return this.rootClassdocs.get(className).containingPackage().name(); } @@ -1051,7 +1052,8 @@ class ClassGraph { private String getUnqualifiedName(String className) { if (this.rootClassdocs.get(className) == null) { - return className.substring(className.lastIndexOf('.') + 1); + int idx = className.lastIndexOf('.'); + return idx > 0 ? className.substring(idx + 1) : className; } else { return this.rootClassdocs.get(className).name(); }