harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r600033 - in /harmony/enhanced/drlvm/trunk: src/test/regression/H5201/ src/test/regression/H5201/JarLauncherTest.java src/test/regression/H5201/run.test.xml vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/vm/JarRunner.java
Date Sat, 01 Dec 2007 01:56:40 GMT
Author: gshimansky
Date: Fri Nov 30 17:56:38 2007
New Revision: 600033

URL: http://svn.apache.org/viewvc?rev=600033&view=rev
Log:
Applied patch and regression test from HARMONY-5201
[drlvm][kernel] Notepad.jar cannot open with "-jar" parameter


Added:
    harmony/enhanced/drlvm/trunk/src/test/regression/H5201/
    harmony/enhanced/drlvm/trunk/src/test/regression/H5201/JarLauncherTest.java   (with props)
    harmony/enhanced/drlvm/trunk/src/test/regression/H5201/run.test.xml   (with props)
Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/vm/JarRunner.java

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H5201/JarLauncherTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H5201/JarLauncherTest.java?rev=600033&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H5201/JarLauncherTest.java (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H5201/JarLauncherTest.java Fri Nov 30
17:56:38 2007
@@ -0,0 +1,67 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.harmony.drlvm.tests.regression.h5201;
+
+
+public class JarLauncherTest 
+{
+	public static void main(String[] s) {
+		System.out.println("PASSED");
+	}
+
+	public static class Test2 {
+		public static void main(String[] s) {
+			System.out.println("PASSED");
+
+		}
+	}
+
+	public static class Test3 {
+		public void main(String[] s) {
+			System.out.println("FAILED");
+
+		}
+	}
+
+	public static class Test4 {
+		public static String main(String[] s) {
+			System.out.println("FAILED");
+			return "OK";
+		}
+	}
+
+	public static class Test5 {
+		static void main(String[] s) {
+			System.out.println("FAILED");
+		}
+	}
+
+	private static class Test6 {
+		public static void main(String[] s) {
+			System.out.println("PASSED");
+
+		}
+	}
+}
+
+class PackagePrivateClass {
+	public static void main(String[] s) {
+		System.out.println("PASSED");
+
+	}
+}

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H5201/JarLauncherTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H5201/run.test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H5201/run.test.xml?rev=600033&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H5201/run.test.xml (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H5201/run.test.xml Fri Nov 30 17:56:38
2007
@@ -0,0 +1,52 @@
+<!-- 
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+     
+         http://www.apache.org/licenses/LICENSE-2.0
+     
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License. -->
+
+<project name="RUN HARMONY-5201 Regression Test">
+    <target name="run-test">
+    	<property name="h5201.pkg" value="org.apache.harmony.drlvm.tests.regression.h5201"/>
+    	<property name="h5201.dir" value="org/apache/harmony/drlvm/tests/regression/h5201"/>
+    	<property name="h5201.man" value="${java.io.tmpdir}/manifest-5201"/>
+
+    	<macrodef name="run-5201">
+    	    <attribute name="cls"/>
+    	    <attribute name="name"/>
+    	    <attribute name="res" default="0"/>
+        	<sequential>
+    			<echo file="${h5201.man}" message="Main-Class: ${h5201.pkg}.@{cls}"/>
+		    	<jar destfile="${reg.test.class.path}/test5201-@{name}.jar" 
+    				 basedir="${reg.test.class.path}"
+    				 includes="${h5201.dir}/*.class"
+    				 manifest="${h5201.man}" />
+   		        <run-pjava-test 
+		             test="org.apache.harmony.drlvm.tests.regression.h5201-@{name}"
+        		     vmarg="-jar ${reg.test.class.path}/test5201-@{name}.jar"
+        		     expected-code="@{res}">
+		        </run-pjava-test>
+        	</sequential>
+    	</macrodef>
+
+    	<run-5201 cls="JarLauncherTest" name="0"/>
+    	<run-5201 cls="PackagePrivateClass" name="1"/>
+    	<run-5201 cls="JarLauncherTest$Test2" name="2"/>
+    	<run-5201 cls="JarLauncherTest$Test3" name="3" res="1"/>
+    	<run-5201 cls="JarLauncherTest$Test4" name="4" res="1"/>
+    	<run-5201 cls="JarLauncherTest$Test5" name="5" res="1"/>
+    	<run-5201 cls="JarLauncherTest$Test6" name="6"/>
+
+    	<delete file="${h5201.man}" quiet="true"/>
+    </target>
+</project>
+

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H5201/run.test.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/vm/JarRunner.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/vm/JarRunner.java?rev=600033&r1=600032&r2=600033&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/vm/JarRunner.java
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/vm/JarRunner.java
Fri Nov 30 17:56:38 2007
@@ -21,6 +21,7 @@
 import java.util.jar.Attributes;
 
 import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
 
 /**
  *  Small class to launch jars.  Used by VM for the 
@@ -70,6 +71,13 @@
         
         Class mainClass = Thread.currentThread().getContextClassLoader().loadClass(className);
              
         Method mainMethod = mainClass.getMethod("main", args.getClass());
+        
+        int mods = mainMethod.getModifiers();
+        if (!Modifier.isStatic(mods) 
+                || !Modifier.isPublic(mods) 
+                || mainMethod.getReturnType() != void.class) {
+            throw new NoSuchMethodError("method main must be public static void: " + mainMethod);
+        }
         mainMethod.setAccessible(true);
 
         String newArgs[] = new String[args.length - 1];



Mime
View raw message