[ 
https://issues.apache.org/jira/browse/DERBY-3814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12730773#action_12730773
 ] 

Myrna van Lunteren commented on DERBY-3814:
-------------------------------------------

Actually, I can make the same failure happen with sane jars and sun's jdk142.

I think it's because of this characteristic of PrintWriter.println:
 (from the api doc:)
 println() methods use the platform's own notion of line separator rather than 
the newline character

println is used in this section in 
org.apache.derby.shared.common.sanity.AssertFailure:
        } catch (NoSuchMethodException e) {
            p.println("(Skipping thread dump because it is not " +
            "supported on JVM 1.4)");
And then the comparison in AssertFailureTest fails on the windows platform 
because the line separator is different from what's given as expected:
            String expected = "(Skipping thread dump because it is not " +
                        "supported on JVM 1.4)\n";
Using \r\n in the expected string makes the assertEquals pass on windows.

A similar check for correct string returned passes for 1.5 and higher because 
the comparison there is using s.startsWith().

The easiest solution is to trim() s before doing the comparison.

> failure in testAssertFailureThreadDump with weme 6.1 / JSR 169
> --------------------------------------------------------------
>
>                 Key: DERBY-3814
>                 URL: https://issues.apache.org/jira/browse/DERBY-3814
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.5.1.1
>         Environment: using weme6.1 / J2ME / JSR169 / CDCFoundation 1.1
>            Reporter: Myrna van Lunteren
>
> suites.All resulted in (1 error and) 2 failures:
> 1) 
> testAssertFailureThreadDump(org.apache.derbyTesting.unitTests.junit.AssertFailureTest)junit.framework.ComparisonFailure:
>  String not correct. expected:<......> but was:<...
> ...>
>       at 
> org.apache.derbyTesting.unitTests.junit.AssertFailureTest.testAssertFailureThreadDump(AssertFailureTest.java:102)
>       at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205)
>       at 
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:104)
>       at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
>       at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
>       at junit.extensions.TestSetup.run(TestSetup.java:23)
> 2) 
> testAssertFailureNoThreadDump(org.apache.derbyTesting.unitTests.junit.AssertFailureTest)junit.framework.ComparisonFailure:
>  String not correct. expected:<......> but was:<...
> ...>
>       at 
> org.apache.derbyTesting.unitTests.junit.AssertFailureTest.testAssertFailureNoThreadDump(AssertFailureTest.java:130)
>       at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:205)
>       at 
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:104)
>       at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
>       at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
>       at junit.extensions.TestSetup.run(TestSetup.java:23)

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

Reply via email to