Bug 107434 - ReliableFile may throw NumberFormatException on some platforms
Summary: ReliableFile may throw NumberFormatException on some platforms
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Runtime (show other bugs)
Version: 3.1   Edit
Hardware: PC other
: P3 normal (vote)
Target Milestone: 3.1.1   Edit
Assignee: Thomas Watson CLA Friend
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-19 09:45 EDT by Phil Loats CLA Friend
Modified: 2005-09-01 15:19 EDT (History)
1 user (show)

See Also:


Attachments
Patch for fix (962 bytes, patch)
2005-08-19 09:46 EDT, Phil Loats CLA Friend
no flags Details | Diff
New patch (1.08 KB, patch)
2005-08-29 11:49 EDT, Thomas Watson CLA Friend
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Loats CLA Friend 2005-08-19 09:45:48 EDT
ReliableFile may throw a NumberFormatException when parsing the checksum into a
long. This problem was discovered in the SMF version of reliable file and I
verified that Eclipse has a similar problem. The proposed fix is to convert
bytes to string using UTF-8.
Comment 1 Phil Loats CLA Friend 2005-08-19 09:46:28 EDT
Created attachment 26293 [details]
Patch for fix
Comment 2 Thomas Watson CLA Friend 2005-08-19 10:22:42 EDT
should consider for 3.1.1.

It seems this is not a problem on any of the officially supported platforms of 
Eclipse.  We happened to run into this problem on zOS.
Comment 3 Thomas Watson CLA Friend 2005-08-22 17:55:07 EDT
Questions about the patch.

- Should you not catch UnsupportedEncodingException if for some reason UTF-8 
is not supported and use the default encoding then?

- What is the difference between specifying "UTF-8" and "UTF8" (no dash '-') 
encoding.  Is it specified in Java that the two are equivilant?  Seems that we 
use both forms in many different places in Eclipse code.  Which form is 
preferred if any?
Comment 4 Phil Loats CLA Friend 2005-08-23 11:41:13 EDT
I went with the java documentation that states all JVMs must support the
following encodings ( j2se/1.3/docs/api/java/lang/package-summary.html#charenc ):
US-ASCII
ISO-8859-1
UTF-8
UTF-16BE
UTF-16LE
UTF-16

I assumed it would be a JVM issue if UTF-8 was not supported. I went with the
javadoc for "UTF-8" instead of "UTF8". It appears most platforms have several
mappings for the same encoding - I'm don't know the formal rules though.
Comment 5 Thomas Watson CLA Friend 2005-08-29 11:49:14 EDT
Created attachment 26592 [details]
New patch

I released this new patch to head.  I simply added a try-catch just to be extra
safe.
Comment 6 Thomas Watson CLA Friend 2005-08-29 11:50:19 EDT
Pascal, please review last patch for 3.1.1.  Thanks.
Comment 7 Pascal Rapicault CLA Friend 2005-09-01 12:56:47 EDT
good to go. 
Comment 8 Thomas Watson CLA Friend 2005-09-01 15:19:34 EDT
Fixed for 3.1.1.