Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 352970 - Adding
Summary: Adding
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-25 03:58 EDT by Jonathan Camilleri CLA
Modified: 2011-07-25 13:32 EDT (History)
1 user (show)

See Also:


Attachments
Source code (21.98 KB, application/octet-stream)
2011-07-25 03:59 EDT, Jonathan Camilleri CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Camilleri CLA 2011-07-25 03:58:49 EDT
Build Identifier: M20110210-1200

Having loaded my source file into Eclipse, and added only a few lines, seems to corrupt the code:
Compare: (<)C:\Documents and Settings\Jon\workspace\MessageDigestTest\MessageDigestTest_orig.java (5109 bytes)
   with: (>)C:\Documents and Settings\Jon\workspace\MessageDigestTest\MessageDigestTest_new.java (4791 bytes)

1a1,2
> package code;
> 
34a36,40
> /**
> 	 * 
> 	 */
> 	private static final long serialVersionUID = 1L;
> /**
171a178
> 	  System.out.println("DEBUG" + hash[i]);
183a192
> 

Output of TextPad 5.4.2 when comparing the differences between the original file sourced from Core Java Vol 2 (7th Ed) ISBN 0-13-111826-9, Chapter 9, and, the new file which was pasted to Eclipse IDE within a new project.

The serialVersionUID line was added as suggested by the IDE, as an error/warning which commonly shows up when I copy and paste code across to Eclipse.


It is noted that:

1. MessageDigestTest.computeDigest(byte[] b) is never read.  This might be a programming error attributed to the original author, however, Eclipse never seems to pass through line 170 to 183, when a breakpoint is set at line 176.

2. An error/warning is displayed indicating that variables message, DEFAULT_WIDTH and DEFAULT_HEIGHT (Lines 186 to 190), are never read locally, whilst these are read within the constructor messageDigestFrame:

DEFAULT_WIDTH and DEFAULT_HEIGHT at line 44
message at line 52


Reproducible: Always

Steps to Reproduce:
1. Create a new Java Project named MessageDigestTest, and, a package, which you could optionally named 'code' or anything you fancy.
2. Open MessageDigestTest_orig.java using a text editor, and, copy across the contents, to a newly created class within the project created in step 1.
The class name should be MessageDigestTest. 
3. Walk through the code in Eclipse, and, you would find that the output has changed from the original output shown by screenshot output_before_eclipse.GIF, and, the output after the code has been altered i.e. output.GIF.

A copy of the file MessageDigestTest_new.java, which should be named as MessageDigest.java, is also available within sub-folder /src within the attached project.  This was named in this fashion to make the comparing of text files more intuitive.
Comment 1 Jonathan Camilleri CLA 2011-07-25 03:59:14 EDT
Created attachment 200252 [details]
Source code
Comment 2 Dani Megert CLA 2011-07-25 06:57:01 EDT
Sorry, but I cannot reproduce this using 3.7 or 4.1.

If you detect a bug then please try to provide exact steps starting with a new workspace. Also verify your steps before sending the bug.
Comment 3 Jonathan Camilleri CLA 2011-07-25 13:32:51 EDT
(In reply to comment #2)
> Sorry, but I cannot reproduce this using 3.7 or 4.1.
> 
> If you detect a bug then please try to provide exact steps starting with a new
> workspace. Also verify your steps before sending the bug.

Okay no problem, I think it was intermittent.