harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eugene S. Ostrovsky (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-3339) [drlvm][EUT] 51 tests fail in jdtcoremodel suit with NullPointerException
Date Tue, 15 May 2007 08:49:16 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-3339?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12495898
] 

Eugene S. Ostrovsky commented on HARMONY-3339:
----------------------------------------------

The bug is in the tests.

org.eclipse.jdt.core.tests.model.CompletionTestsRequestor2.getReversedResults() method contains
incorrect code for array sorting:
......
Arrays.sort(this.proposals, new Comparator() {
    public int compare(Object o1, Object o2) {
        if (o1 instanceof CompletionProposal && o2 instanceof CompletionProposal)
{
            CompletionProposal p1 = (CompletionProposal) o1;
            CompletionProposal p2 = (CompletionProposal) o2;
            int relDif = p2.getRelevance() - p1.getRelevance();
            if(relDif != 0)  return relDif;
            String name1 = getElementName(p1);
            String name2 = getElementName(p2);
            return name1.compareTo(name2);
        }
        return -1;
    }
});
..........

Provided comparator is incorrect for null elements. It returns -1 if any of compared objects
is null.
The array contains null elements and is sorted incorrectly.
RI sorts the array correctly because it uses different algorithm for Arrays.sort() implementation.

Suggestions to fix (one of the following):
1. Use :Arrays.sort(this.proposals, 0, proposalsPtr + 1, new Comparator() {...
2. Fix the comparator


> [drlvm][EUT] 51 tests fail in jdtcoremodel suit with NullPointerException
> -------------------------------------------------------------------------
>
>                 Key: HARMONY-3339
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3339
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Aleksey Ignatenko
>
> EUT: jdtcoremodel suit - 51 tests fails due to NullPointerException.
> Log:
> N/A 
> java.lang.NullPointerException
> at org.eclipse.jdt.core.tests.model.CompletionTestsRequestor2.getElementName(CompletionTestsRequestor2.java)
> at org.eclipse.jdt.core.tests.model.CompletionTestsRequestor2.printProposal(CompletionTestsRequestor2.java:201)
> at org.eclipse.jdt.core.tests.model.CompletionTestsRequestor2.getResultsWithoutSorting(CompletionTestsRequestor2.java:185)
> at org.eclipse.jdt.core.tests.model.CompletionTestsRequestor2.getReversedResults(CompletionTestsRequestor2.java:160)
> at org.eclipse.jdt.core.tests.model.AbstractJavadocCompletionModelTest.assertSortedResults(AbstractJavadocCompletionModelTest.java:209)
> at org.eclipse.jdt.core.tests.model.JavadocBugsCompletionModelTest.testBug118311(JavadocBugsCompletionModelTest.java:713)
> at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
> at org.eclipse.jdt.core.tests.model.SuiteOfTestCases$Suite.runTest(SuiteOfTestCases.java:96)
> at org.eclipse.jdt.core.tests.model.SuiteOfTestCases$Suite.superRun(SuiteOfTestCases.java)
> at org.eclipse.jdt.core.tests.model.SuiteOfTestCases$1.protect(SuiteOfTestCases.java)
> at org.eclipse.jdt.core.tests.model.SuiteOfTestCases$Suite.run(SuiteOfTestCases.java:67)
> at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:326)
> at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:203)
> at org.eclipse.test.CoreTestApplication.runTests(CoreTestApplication.java)
> at org.eclipse.test.CoreTestApplication.run(CoreTestApplication.java:31)
> at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:77)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:66)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:396)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
> at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
> at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
> at org.eclipse.core.launcher.Main.run(Main.java:975)
> at org.eclipse.core.launcher.Main.main(Main.java:952)
> at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
> at org.apache.harmony.vm.JarRunner.main(JarRunner.java:80)

-- 
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