You are viewing a plain text version of this content. The canonical link for it is here.
Posted to kato-commits@incubator.apache.org by mo...@apache.org on 2009/11/25 15:47:37 UTC
svn commit: r884155 -
/incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/harness/TCKJavaRuntimeTestcase.java
Author: monteith
Date: Wed Nov 25 15:47:36 2009
New Revision: 884155
URL: http://svn.apache.org/viewvc?rev=884155&view=rev
Log:
Remove reference to a Java 5.0 methods.
Modified:
incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/harness/TCKJavaRuntimeTestcase.java
Modified: incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/harness/TCKJavaRuntimeTestcase.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/harness/TCKJavaRuntimeTestcase.java?rev=884155&r1=884154&r2=884155&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/harness/TCKJavaRuntimeTestcase.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.harness/src/main/java/org/apache/kato/tck/harness/TCKJavaRuntimeTestcase.java Wed Nov 25 15:47:36 2009
@@ -234,7 +234,7 @@
String packageName=this.getClass().getPackage().getName();
- String thisClassName=this.getClass().getSimpleName();
+ String thisClassName=simpleName(this.getClass());
String testClassName="Setup"+thisClassName.substring(4);
String scenerioReference=packageName+"."+testClassName;
@@ -248,6 +248,27 @@
return null;
}
+ /**
+ * Dumplicates the functionality of JavaClass.getSimpleName().
+ * That method isn't available pre-1.4
+ *
+ * @param clazz
+ * @return The short name of the class, after the last $ and .
+ */
+ private static String simpleName(Class clazz) {
+ String className = clazz.getName();
+ int dotPos = className.lastIndexOf('.');
+ int dolPos = className.lastIndexOf('$');
+
+ if (dotPos == -1 && dolPos == -1) {
+ return className;
+ }
+
+ int cutoff = Math.max(dotPos, dolPos);
+
+ return className.substring(cutoff+1);
+ }
+
public JavaObject getJavaObjectByClassname(String className) {
JavaRuntime run = getJavaRuntime();