harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gregory Shimansky (JIRA)" <j...@apache.org>
Subject [jira] Closed: (HARMONY-1957) [drlvm] Harmony returns 0 when class file which should be run or used library is not available but RI returns 1
Date Wed, 08 Nov 2006 13:14:54 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-1957?page=all ]

Gregory Shimansky closed HARMONY-1957.
--------------------------------------

    Resolution: Duplicate
      Assignee: Gregory Shimansky

Closing this issue as duplicate of HARMONY-2006 because it has a patch in it which should
fix the problem.

> [drlvm] Harmony returns 0 when class file which should be run or used library is not
available but RI returns 1
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1957
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1957
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows and Linux
>            Reporter: Vera Petrashkova
>         Assigned To: Gregory Shimansky
>         Attachments: testExec.zip
>
>
> When running class is not available Harmony throws NoClassDefFoundError and it returns
exit code 0..
> Harmony also returns 0 if used library is not reached.
>  
> Process which starts jvm using java.lang.Runtime.exec(...) method  and terminates because
class file or library 
> is not reached return exit value 0. 
> But according to J2SE API specification of java.lang.Process class:
> "
> public abstract int waitFor() throws InterruptedException
>    Returns: the exit value of the process. By convention, 0 indicates normal termination.
> "
> In all this cases RI returns exit code 1.
>  
> 1) Start jvm using some nonexistent class, 
>     java -showversion -cp .  unknown_class_file
> Output on RI:
> ============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Exception in thread "main" java.lang.NoClassDefFoundError: unknown_class_file
> $ echo $?
> 1
> Output on Harmony:
> ==============
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or
its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r466303, (Oct 23 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> Uncaught exception in main:
> java.lang.NoClassDefFoundError: unknown_class_file
> Caused by: java.lang.ClassNotFoundException: unknown_class_file
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:625)
>         at java.lang.ClassLoader.loadClass(Unknown Source)
>         at java.lang.ClassLoader$SystemClassLoader.loadClass(Unknown Source)
>         at java.lang.ClassLoader.loadClass(Unknown Source) 
> $ echo $?
> 0
>  
> 2) Start jvm using some nonexistent library and existent class
>    java -showversion -cp . -agentlib:unknown_library test
> Output on RI:
> =============
> Error occurred during initialization of VM
> Could not find agent library on the library path or in the local directory: unknown_library
> $ echo $?
> 1
>  
> Output on Harmony:
> =================
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or
its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r466303, (Oct 23 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> Failed to open agent library unknown_library.dll : The specified module could not be
found
> .
> Failed to open agent library unknown_library.dll
> Failed to initialize JVMTI.
> HMYEXEL062E Internal VM error: Failed to create Java VM
> FAILED to invoke JVM.
> $ echo $?
> 0
>  
> 3) Run test from attachment
> -----------testExec.java------------
> import junit.framework.TestCase;
> import java.io.*;
> public class testExec extends TestCase {
>    
>     public void testExecUnknownClassFile() {
>         String [] cmdL = new String[4];
>         cmdL[0] = System.getProperty("java.home")+File.separator+"bin"+File.separator+"java";
>         cmdL[1] = "-classpath";
>         cmdL[2] = ".";
>         cmdL[3] = "unknown_class_file"; 
>         try {
>             Process p = Runtime.getRuntime().exec(cmdL);
>             p.waitFor();
>             int ans = p.exitValue();
>             if (ans != 1) {
>                 assertEquals("Incorrect exitValue", 1, ans);
>             }                        
>         } catch (Throwable e) {
>             fail("Unexpected error: "+e);
>         }
>      }
>  
>     public void testExecUnknownLibrary() {
>         String [] cmdL = new String[5];
>         cmdL[0] = System.getProperty("java.home")+File.separator+"bin"+File.separator+"java";
>         cmdL[1] = "-classpath";
>         cmdL[2] = ".";
>         cmdL[3] = "-agentpath:unknown_library"; 
>         cmdL[4] = "testExec"; 
>         try {
>             Process p = Runtime.getRuntime().exec(cmdL);
>             p.waitFor();
>             int ans = p.exitValue();
>             if (ans != 1) {
>                 assertEquals("Incorrect exitValue", 1, ans);
>             }                        
>         } catch (Throwable e) {
>             fail("Unexpected error: "+e);
>         }
>      }
>  
> }
> -------------------
>     java -cp .:junit.jar junit.textui.TestRunner testExec
>  
> Output on RI:
> ===========
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Server VM (build 1.5.0_06-b05, mixed mode)
>  
> ..
> Time: 0.146
> OK (2 tests)
>  
> Output on Harmony:
> =============== 
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or
its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = r464471, (Oct 20 2006), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> .F.F
> Time: 0.699
> There were 2 failures:
> 1) testExecUnknownClassFile(testExec)junit.framework.AssertionFailedError: Unexpected
error: junit.framework.AssertionFailedError: Incorrect exitValue expected:<1> but was:<0>
>         at testExec.testExecUnknownClassFile(testExec.java:19)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> 2) testExecUnknownLibrary(testExec)junit.framework.AssertionFailedError: Unexpected error:
junit.framework.AssertionFailedError: Incorrect exitValue expected:<1> but was:<129>
>         at testExec.testExecUnknownLibrary(testExec.java:38)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>  
> FAILURES!!!
> Tests run: 2,  Failures: 2,  Errors: 0

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message