diff --git a/core/src/main/java/hudson/tasks/junit/PackageResult.java b/core/src/main/java/hudson/tasks/junit/PackageResult.java index 16ac48ad8d53..515c0368f474 100644 --- a/core/src/main/java/hudson/tasks/junit/PackageResult.java +++ b/core/src/main/java/hudson/tasks/junit/PackageResult.java @@ -82,15 +82,16 @@ public synchronized String getSafeName() { @Override public TestResult findCorrespondingResult(String id) { String myID = safe(getName()); + int base = id.indexOf(myID); - String className; - String subId = null; + String className = id; // fall back value if (base > 0) { int classNameStart = base + myID.length() + 1; - className = id.substring(classNameStart); - } else { - className = id; - } + if (classNameStart 0) { subId = className.substring(classNameEnd + 1); @@ -106,7 +107,7 @@ public TestResult findCorrespondingResult(String id) { return child.findCorrespondingResult(subId); } else { return child; - } + } } return null; diff --git a/core/src/main/java/hudson/tasks/test/TestObject.java b/core/src/main/java/hudson/tasks/test/TestObject.java index 4138a9c56410..27234996f6a5 100644 --- a/core/src/main/java/hudson/tasks/test/TestObject.java +++ b/core/src/main/java/hudson/tasks/test/TestObject.java @@ -138,7 +138,7 @@ public String getRelativePathFrom(TestObject it) { StringBuilder buf = new StringBuilder(); TestObject next = this; TestObject cur = this; - // Walk up my ancesotors from leaf to root, looking for "it" + // Walk up my ancestors from leaf to root, looking for "it" // and accumulating a relative url as I go while (next!=null && it!=next) { cur = next; @@ -260,7 +260,7 @@ public T getTestAction(Class klazz) { /** * Find the test result corresponding to the one identified by id> - * withint this test result. + * within this test result. * * @param id The path to the original test result * @return A corresponding test result, or null if there is no corresponding