harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r439248 - in /incubator/harmony/enhanced/classlib/trunk/modules/instrument/src: main/native/instrument/shared/inst_agt.c test/java/org/apache/harmony/tests/java/lang/instrument/InstrumentTest.java
Date Fri, 01 Sep 2006 09:30:51 GMT
Author: pyang
Date: Fri Sep  1 02:30:50 2006
New Revision: 439248

URL: http://svn.apache.org/viewvc?rev=439248&view=rev
Log:
Patch applied for HARMONY-1343 ([classlib][instrument]strlwr in linux does not exist.)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/instrument/src/main/native/instrument/shared/inst_agt.c
    incubator/harmony/enhanced/classlib/trunk/modules/instrument/src/test/java/org/apache/harmony/tests/java/lang/instrument/InstrumentTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/instrument/src/main/native/instrument/shared/inst_agt.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/instrument/src/main/native/instrument/shared/inst_agt.c?rev=439248&r1=439247&r2=439248&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/instrument/src/main/native/instrument/shared/inst_agt.c
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/instrument/src/main/native/instrument/shared/inst_agt.c
Fri Sep  1 02:30:50 2006
@@ -211,10 +211,14 @@
     
     pos = manifest+ (strstr(lwrmanifest,target) - lwrmanifest);
 	pos += strlen(target)+2;//": "
-	end = strchr(pos, '\r');
+	end = strchr(pos, '\n');	
 	if(NULL == end){
 		end = manifest + strlen(manifest);
 	}
+	/* in windows, has '\r\n' in the end of line, omit '\r' */
+	if (*(end - 1) == '\r'){
+		end--;
+	}
 	length = end - pos;
 	
 	value = (char *)hymem_allocate_memory(sizeof(char)*(length+1));
@@ -223,8 +227,15 @@
 	return value;
 }
 
+char* strlower(char * str){
+     char *temp = str;
+     while(*temp = tolower(*temp))
+         temp++;
+     return str;
+}
+
 int str2bol(char *str){	
-	return 0 == strcmp("true", strlwr(str));
+	return 0 == strcmp("true", strlower(str));
 }
 
 jint Parse_Options(JavaVM *vm, JNIEnv *env, jvmtiEnv *jvmti,  const char *agent){
@@ -259,7 +270,7 @@
 	manifest = Read_Manifest(vm,env, jar_name);	
 	lwrmanifest = (char *)hymem_allocate_memory(sizeof(char) * (strlen(manifest)+1));
 	strcpy(lwrmanifest,manifest);
-	strlwr(lwrmanifest);
+	strlower(lwrmanifest);
 	
 	//jar itself added to bootclasspath
 	check_jvmti_error(env, (*jvmti)->GetSystemProperty(jvmti,"java.class.path",&classpath),"Failed
to get classpath.");

Modified: incubator/harmony/enhanced/classlib/trunk/modules/instrument/src/test/java/org/apache/harmony/tests/java/lang/instrument/InstrumentTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/instrument/src/test/java/org/apache/harmony/tests/java/lang/instrument/InstrumentTest.java?rev=439248&r1=439247&r2=439248&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/instrument/src/test/java/org/apache/harmony/tests/java/lang/instrument/InstrumentTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/instrument/src/test/java/org/apache/harmony/tests/java/lang/instrument/InstrumentTest.java
Fri Sep  1 02:30:50 2006
@@ -22,44 +22,44 @@
 public class InstrumentTest extends TestCase {
 
     /**
-     * @tests try to add a null Transformer 
+     * @tests try to add a null Transformer
      */
     public void test_addTransformer_null() throws Exception {
         String[] arg = new String[2];
         arg[0] = "-javaagent:src/test/resources/jars/org/apache/harmony/tests/instrument/Premain_addTransformer_null.jar";
         arg[1] = "org/apache/harmony/tests/java/lang/instrument/TestMain";
         String[] path = new String[1];
-        path[0] = "";
+        path[0] = "src/test/resources/jars/org/apache/harmony/tests/instrument/Premain_addTransformer_null.jar";
         String result = Support_Exec.execJava(arg, path, true);
         assertEquals("", result);
     }
 
     /**
-     * @tests try to remove a null Transformer 
+     * @tests try to remove a null Transformer
      */
     public void test_removeTransformer_null() throws Exception {
         String[] arg = new String[2];
         arg[0] = "-javaagent:src/test/resources/jars/org/apache/harmony/tests/instrument/Premain_removeTransformer_null.jar";
         arg[1] = "org/apache/harmony/tests/java/lang/instrument/TestMain";
         String[] path = new String[1];
-        path[0] = "";
+        path[0] = "src/test/resources/jars/org/apache/harmony/tests/instrument/Premain_removeTransformer_null.jar";
         String result = Support_Exec.execJava(arg, path, true);
         assertEquals("", result);
     }
 
     /**
-     * @tests try to remove a non-exists Transformer 
+     * @tests try to remove a non-exists Transformer
      */
     public void test_removeTransformer_notExists() throws Exception {
         String[] arg = new String[2];
         arg[0] = "-javaagent:src/test/resources/jars/org/apache/harmony/tests/instrument/Premain_removeTransformer_notExists.jar";
         arg[1] = "org/apache/harmony/tests/java/lang/instrument/TestMain";
         String[] path = new String[1];
-        path[0] = "";
+        path[0] = "src/test/resources/jars/org/apache/harmony/tests/instrument/Premain_removeTransformer_notExists.jar";
         String result = Support_Exec.execJava(arg, path, true);
         assertEquals("", result);
     }
-    
+
     /**
      * @tests try to load a class that does not exist
      */
@@ -68,29 +68,29 @@
         arg[0] = "-javaagent:src/test/resources/jars/org/apache/harmony/tests/instrument/loading_class.jar";
         arg[1] = "org/apache/harmony/tests/java/lang/instrument/TestMain";
         String[] path = new String[1];
-        path[0] = "";
-        try{
+        path[0] = "src/test/resources/jars/org/apache/harmony/tests/instrument/loading_class.jar";
+        try {
             Support_Exec.execJava(arg, path, true);
             fail("Should fail here!");
-        } catch (AssertionFailedError e){
+        } catch (AssertionFailedError e) {
             // class loader changes, can not load classes
             assertTrue(-1 != e.getMessage().indexOf("NoClassDefFoundError"));
         }
     }
-    
+
     /**
-     * @tests try to use a new ClassLoader 
+     * @tests try to use a new ClassLoader
      */
     public void test_new_classLoader_Exists() throws Exception {
         String[] arg = new String[2];
         arg[0] = "-javaagent:src/test/resources/jars/org/apache/harmony/tests/instrument/new_classloader.jar";
         arg[1] = "org/apache/harmony/tests/java/lang/instrument/TestMain";
         String[] path = new String[1];
-        path[0] = "";
+        path[0] = "src/test/resources/jars/org/apache/harmony/tests/instrument/new_classloader.jar";
         String result = Support_Exec.execJava(arg, path, true);
         assertNotNull(result);
     }
-    
+
     /**
      * @tests test if attribute of "Premain-Class" is null
      */
@@ -99,31 +99,33 @@
         arg[0] = "-javaagent:src/test/resources/jars/org/apache/harmony/tests/instrument/Property_Premain_null.jar";
         arg[1] = "org/apache/harmony/tests/java/lang/instrument/TestMain";
         String[] path = new String[1];
-        path[0] = "";
-        try{
+        path[0] = "src/test/resources/jars/org/apache/harmony/tests/instrument/Property_Premain_null.jar";
+        try {
             Support_Exec.execJava(arg, path, true);
             fail("Should fail here!");
-        } catch (AssertionFailedError e){
+        } catch (AssertionFailedError e) {
             // expected
-            assertTrue(-1 != e.getMessage().indexOf("Failed") || -1 != e.getMessage().indexOf("error")
);
+            assertTrue(-1 != e.getMessage().indexOf("Failed")
+                    || -1 != e.getMessage().indexOf("error"));
             assertTrue(-1 != e.getMessage().indexOf("Premain-Class"));
             assertTrue(-1 != e.getMessage().indexOf("attribute"));
         }
     }
 
     /**
-     * @tests test if attributes of "Can-Redefine-Classes" and "Boot-Class-Path" is null
+     * @tests test if attributes of "Can-Redefine-Classes" and "Boot-Class-Path"
+     *        is null
      */
     public void test_Property_other_null() throws Exception {
         String[] arg = new String[2];
         arg[0] = "-javaagent:src/test/resources/jars/org/apache/harmony/tests/instrument/Property_other_null.jar";
         arg[1] = "org/apache/harmony/tests/java/lang/instrument/TestMain";
         String[] path = new String[1];
-        path[0] = "";
+        path[0] = "src/test/resources/jars/org/apache/harmony/tests/instrument/Property_other_null.jar";
         String result = Support_Exec.execJava(arg, path, true);
         assertNotNull(result);
     }
-    
+
     /**
      * @tests test if the attributes is case-sensitive
      */
@@ -132,31 +134,32 @@
         arg[0] = "-javaagent:src/test/resources/jars/org/apache/harmony/tests/instrument/Properity_case_sensitive.jar";
         arg[1] = "org/apache/harmony/tests/java/lang/instrument/TestMain";
         String[] path = new String[1];
-        path[0] = "";
+        path[0] = "src/test/resources/jars/org/apache/harmony/tests/instrument/Properity_case_sensitive.jar";
         String result = Support_Exec.execJava(arg, path, true);
-        assertEquals("",result);
+        assertEquals("", result);
     }
-    
+
     /**
      * @tests test if the jar file is bad
      */
     public void test_BadFormatJar() throws Exception {
         String[] arg = new String[2];
         arg[0] = "-javaagent:src/test/resources/jars/org/apache/harmony/tests/instrument/BadFormatJar.jar";
-        arg[1] = "org/apache/harmony/tests/java/lang/instrument/TestMain";
+        arg[1] = "";
         String[] path = new String[1];
-        path[0] = "";
-        try{
+        path[0] = "src/test/resources/jars/org/apache/harmony/tests/instrument/BadFormatJar.jar";
+        try {
             Support_Exec.execJava(arg, path, true);
             fail("Should fail here!");
-        } catch (AssertionFailedError e){
+        } catch (AssertionFailedError e) {
             // expected
-            assertTrue(-1 != e.getMessage().indexOf("error") || -1 != e.getMessage().indexOf("Error")
);
+            assertTrue(-1 != e.getMessage().indexOf("error")
+                    || -1 != e.getMessage().indexOf("Error"));
             assertTrue(-1 != e.getMessage().indexOf("open"));
             assertTrue(-1 != e.getMessage().indexOf("file"));
         }
     }
-    
+
     /**
      * @tests test if premain class is null
      */
@@ -165,16 +168,16 @@
         arg[0] = "-javaagent:src/test/resources/jars/org/apache/harmony/tests/instrument/Premain_Class_null.jar";
         arg[1] = "org/apache/harmony/tests/java/lang/instrument/TestMain";
         String[] path = new String[1];
-        path[0] = "";
-        try{
+        path[0] = "src/test/resources/jars/org/apache/harmony/tests/instrument/Premain_Class_null.jar";
+        try {
             Support_Exec.execJava(arg, path, true);
             fail("Should fail here!");
-        } catch (AssertionFailedError e){
+        } catch (AssertionFailedError e) {
             // expected
             assertTrue(-1 != e.getMessage().indexOf("ClassNotFoundException"));
         }
     }
-    
+
     /**
      * @tests test transforming all classes to a zero byte
      */
@@ -183,11 +186,11 @@
         arg[0] = "-javaagent:src/test/resources/jars/org/apache/harmony/tests/instrument/zero_byte_class.jar";
         arg[1] = "org/apache/harmony/tests/java/lang/instrument/TestMain";
         String[] path = new String[1];
-        path[0] = "";
+        path[0] = "src/test/resources/jars/org/apache/harmony/tests/instrument/zero_byte_class.jar";
         String result = Support_Exec.execJava(arg, path, true);
-        assertEquals("",result);
+        assertEquals("", result);
     }
-    
+
     /**
      * @tests test if complied by version 1.4
      */
@@ -196,8 +199,8 @@
         arg[0] = "-javaagent:src/test/resources/jars/org/apache/harmony/tests/instrument/old_version_class.jar";
         arg[1] = "org/apache/harmony/tests/java/lang/instrument/TestMain";
         String[] path = new String[1];
-        path[0] = "";
+        path[0] = "src/test/resources/jars/org/apache/harmony/tests/instrument/old_version_class.jar";
         String result = Support_Exec.execJava(arg, path, true);
-        assertEquals("",result);
+        assertEquals("", result);
     }
 }



Mime
View raw message