harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Petrashkova, Vera Y" <vera.y.petrashk...@intel.com>
Subject Regression on Harmony-r549489
Date Fri, 22 Jun 2007 04:24:59 GMT
Hello,

If VM starts without -Xverify option it thwows ClassFormatError instead of  UnsupportedClassVersionError
 

when class contains incorrect Major version number.

 

But Harmony-r548657 throws correct UnsupportedClassVersionError in both cases (with or without
-Xverify).

RI always throws UnsupportedClassVersionError for such incorrect class.

 

To reproduce use the following test and synthetic class v1

----------------test.java--------------

import java.io.*;

public class test {

     

    public static void main(String[] args) {

        try {

            Class.forName("v1");

            System.err.println("Test failed: UnsupportedClassVersionError was not
thrown");

        } catch (UnsupportedClassVersionError  e) {

            System.err.println("Test passed: "+e);

         

        } catch (Throwable e) {

             System.err.println("Test failed: unexcpected error");

             e.printStackTrace();

        }

    }

}

-----------------------v1.ccode----------------

magic = xCAFEBABE

minor_version = 3

major_version = 450 // wrong major version

constant_pool_count = 13

constant_pool {

  /* #1 */ Method = #12 #7

  /* #2 */ Class = #11

  /* #3 */ UTF8 = "java/lang/Object"

  /* #4 */ UTF8 = "SourceFile"

  /* #5 */ UTF8 = "<init>"

  /* #6 */ UTF8 = "v1.ccode"

  /* #7 */ NameAndType = #5 #10

  /* #8 */ UTF8 = "Code"

  /* #9 */ UTF8 = "test"

  /* #10 */ UTF8 = "()V"

  /* #11 */ UTF8 = "v1"

  /* #12 */ Class = #3

}

access_flags = PUBLIC SUPER  // x21

this_class = #2  // "v1"

super_class = #12  // "java/lang/Object"

interfaces_count = 0

interfaces {

}

fields_count = 0

methods_count = 1

methods {

  method {

    access_flag = PUBLIC  // x01

    name_index = #5  // "<init>"

    descriptor_index = #10  // "()V"

    attributes_count = 1

      attributes {

        attribute Code {

          attribute_name_index = #8  // "Code"

          attribute_length = 17

          max_stack = 1

          max_locals = 1

          code_length = 5

          code asm {

          0:           aload_0

          1:           invokespecial #1

          4:           return

          }

          exception_table_length = 0

          attributes_count = 0

        }

      }

  }

}

attributes_count = 0

 

----------------------

 

Output on Harmony-r548657

=====================

 

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 = r548657, (Jun 19 2007), Windows/ia32/msvc 1310, release build

http://harmony.apache.org

Test passed: java.lang.UnsupportedClassVersionError: class has version number 450

 

Output on Harmony- r549489

=====================

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 = r549489, (Jun 21 2007), Windows/ia32/msvc 1310, release build

http://harmony.apache.org

Test failed: unexcpected error

java.lang.ClassFormatError: v1 : class has version number 450

        at java.lang.ClassLoader.defineClass0(ClassLoader.java)

        at java.lang.ClassLoader.defineClass(ClassLoader.java:438)

        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:70)

        at java.net.URLClassLoader.access$3(URLClassLoader.java:1)

        at java.net.URLClassLoader$URLHandler.createClass(URLClassLoader.java:261)

        at java.net.URLClassLoader$URLFileHandler.findClass(URLClassLoader.java:560)

        at java.net.URLClassLoader.findClassImpl(URLClassLoader.java:1194)

        at java.net.URLClassLoader$4.run(URLClassLoader.java:889)

        at java.net.URLClassLoader$4.run(URLClassLoader.java:1)

        at java.security.AccessController.doPrivilegedImpl(AccessController.java:171)

        at java.security.AccessController.doPrivileged(AccessController.java:64)

        at java.net.URLClassLoader.findClass(URLClassLoader.java:891)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:575)

        at java.lang.ClassLoader$SystemClassLoader.loadClass(ClassLoader.java:963)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:319)

        at java.lang.Class.forName(Class.java:146)

        at java.lang.Class.forName(Class.java:103)

        at test.main(test.java:6)

 

Thank you,

Vera Petrashkova

 

 

 


Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message