Community
Participate
Working Groups
Steps to reproduce: Debug the following JUnit4 testcase in Eclipse: * The test will fail: org.junit.ComparisonFailure: expected:<[xxx]> but was: <[X * The remaining "\0Y]>" is missing in the "Failure Trace" view. * Double clicking to get the "Result Comparison" window shows the same issue. * The output of System.out.println seems to miss the rest of the String, beginning from the null byte. * When debugging, editing char values in variables behaves strange as long as there is a \0 value inside. * It is not possible to enter a \0 value in a char variable when debugging. Expected behaviour: * ASCII-0x00 characters should be displayed as \0 and following String parts should not be missing when displayed. Test Code: pre.. @Test public void testEclipseBug() throws Exception { final String value = "\0"; assertEquals( 1, value.length() ); assertEquals( 0, value.charAt( 0 ) ); String logmessage = "X"+ value+"Y"; assertEquals(3, logmessage.length()); System.out.println( logmessage); assertEquals("xxx", logmessage); // This will fail. Look at the comparison view. Also use Eclipse for debugging. } pre..
Created attachment 227438 [details] Screenshot of Eclipse running UnitTest to reproduce the issue Can be reproduced with Eclipse Version: 3.8.1, Build id: M20120914-1540
Is still an issue with Eclipse SDK Version: 3.8.2 - Build id: M20130131-0800
Hi Stephan, could you please have a look at this?
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.
This is still an issue with Eclipse IDE for Enterprise Java Developers. Version: 2018-12 (4.10.0) Build id: 20181214-0600 As it should be fixed, I reopen this bug.
@Paul, will you be able to look into this?
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.
Did anyone even try to reproduce the issue?
(In reply to Michael Meß from comment #8) > Did anyone even try to reproduce the issue? Yes, I tried reproducing it. It's not only while debugging but even printing it is not handled. System.out.println(logmessage); It prints "XY".
System.out.println(logmessage) seems to print only "X" in my eclipse Console. But System.out.println(logmessage) prints all characters, even the "Y" which can be verified by executing the test on a Linux console, see Attachment. The 0-character is a non-printable control character which is "executed" by the console but usually does nothing. There are other control characters which are also executed by the console and for example move the curser, delete characters, etc. If I modify the test to use a newline ("\n"), the newline is printed in the test comparison result followed the "Y" as well as in the Console from System.out.println(logmessage), which is OK. Maybe the eclipse Console (Probably the dialog showing the comparison result is also using something like a console to display text) uses the 0-character as a terminating character, maybe e.g. in C/C++ native method where strings usually are handled as char* terminated by 0-characters.
Created attachment 288504 [details] Console window showing test result of failed test containing 0-character
Created attachment 288505 [details] When using 01-Characters, Eclipse displays the comparison result and console output as expected