harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vera Petrashkova (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-4426) [buildtest][func] Test F_ClassLoaderTest_01 uses wrong argument
Date Thu, 12 Jul 2007 05:06:04 GMT
[buildtest][func] Test F_ClassLoaderTest_01 uses wrong argument
---------------------------------------------------------------

                 Key: HARMONY-4426
                 URL: https://issues.apache.org/jira/browse/HARMONY-4426
             Project: Harmony
          Issue Type: Bug
          Components: build - test - ci
            Reporter: Vera Petrashkova
            Priority: Minor
         Attachments: F_ClassLoaderTest_01.xml

The following test 
   functional/org/apache/harmony/test/func/api/java/lang/F_ClassLoaderTest_01/F_ClassLoaderTest_01.xml
fails on Harmony and RI because its description defines incorrect argument.
See F_ClassLoaderTest_01.xml:
----------	
        <Runner ID="Runtime">
            <Option name="-cp" value="$CP$PathSeparator$TestSuiteRoot$FileSeparatorsrc$FileSeparatortest"/>
               <<<<<<<<<<<<<<<<<<
            <Param name="toRun" value="org.apache.harmony.test.func.api.java.lang.F_ClassLoaderTest_01.F_ClassLoaderTest_01">
            </Param>
        </Runner> 
----------

In fact this test  uses class org.apache.harmony.test.func.api.java.lang.F_ClassLoaderTest_02.auxiliary.F_LongTest
See source code 
--------F_ClassLoaderTest_01/F_ClassLoaderTest_01.java---------
    private boolean task4() {
        try {
            getClass(ClassLoader.getSystemClassLoader(),
                "F_ClassLoaderTest_01.auxiliary.F_LongTest");    <<<<<<<<<<<<<<<
        } catch (ClassNotFoundException e) {
            if (stat == 1) {
                log.info("OK");
                return true;
            }
        }

        return false;
    }

    private Class getClass(ClassLoader loader, String name)
        throws ClassNotFoundException {
        TestClassLoader clsLoader = new TestClassLoader(loader);               <<<<<<<<<<<<<
        Class cls = null;

        try {
            cls = clsLoader.loadClass(name);//from
            // org.apache.harmony.test.func.api.java.lang.
        } catch (ClassNotFoundException e) {
            stat = clsLoader.loadTracker;
            throw e;
        }
        stat = clsLoader.loadTracker;

        return cls;
    }
-----------share/TestClassLoader.java-----------
    public Class findClass(String name) throws ClassNotFoundException {
        loadTracker += 1;
        String fileName = convertName(name);
        Class cls = null;
        try {
            System.err.println("org/apache/harmony/test/func/api/java/lang/" + fileName);
   <<<<<<<<<<<<<<<<<
            InputStream source = getResourceAsStream("org/apache/harmony/test/func/api/java/lang/"
+ fileName);
            DataInputStream dataStream = new DataInputStream(source);
            int size = dataStream.available(); 
            byte[] classData = new byte[size];
            dataStream.readFully(classData);
            String packageName = "org.apache.harmony.test.func.api.java.lang." + extractPackage(name);
            if (getPackage(packageName) == null) {
                definePackage(packageName, "", "", "", "", "", "", null);
            }
            cls = defineClass("org.apache.harmony.test.func.api.java.lang." + name, classData,
0, size, this.getClass().getProtectionDomain());
            if (getPackage(packageName).isSealed()) {
                System.err.println("package mustn't be sealed.");
            }
        } catch (NullPointerException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassFormatError e) {
            e.printStackTrace();
        } catch (NoClassDefFoundError e) {
            e.printStackTrace();
        }
...
---------------


So this class should be loaded from 
stc/test/org/apache/harmony/test/func/api/java/lang/F_ClassLoaderTest_02/auxiliary/F_LongTest
but it is placed in 
stc/test/functional/org/apache/harmony/test/func/api/java/lang/F_ClassLoaderTest_02/auxiliary/F_LongTest


The test description should be fixed:
            <Option name="-cp" value="$CP$PathSeparator$TestSuiteRoot$FileSeparatorsrc$FileSeparatortest"/>
             should be changed to
            <Option name="-cp" value="$CP$PathSeparator$TestSuiteRoot$FileSeparatorsrc$FileSeparatortest$FileSeparatorfunctional"/>
               

See correct description file in attachment.

Please, change the original
stc/test/functional/org/apache/harmony/test/func/api/java/lang/F_ClassLoaderTest_02/F_ClassLoaderTest_02.xml

by the attached file



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message