 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Geoff Soutter Guest
|
Posted: Wed Aug 27, 2003 1:39 pm Post subject: 1.4.1 String.getBytes still broken |
|
|
Hi,
I just came across the String.getBytes() bug that was reported for 1.4.0
in this newsgroup a few months back, which it was said would be fixed
in 1.4.1...
I am using version:
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1)
Classic VM (build 1.4.1, J2RE 1.4.1 IBM build cxia32141-20030522 (JIT
enabled: jitc))
And I have a testcase which looks something like so:
try {
string.getBytes("<bogus encoding>");
catch (UnsupportedEncodingException e) {
// success
}
fail();
This works fine in Sun and IBM 1.3, but breaks in IBM 1.4.
As earlier reported, it throws the new nio IllegalCharsetNameException.
Are IBM intending to fix this bug?
geoff
|
|
| Back to top |
|
 |
Neil Masson Guest
|
Posted: Wed Aug 27, 2003 2:08 pm Post subject: Re: 1.4.1 String.getBytes still broken |
|
|
Geoff Soutter wrote:
| Quote: | Hi,
I just came across the String.getBytes() bug that was reported for 1.4.0
in this newsgroup a few months back, which it was said would be fixed
in 1.4.1...
I am using version:
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1)
Classic VM (build 1.4.1, J2RE 1.4.1 IBM build cxia32141-20030522 (JIT
enabled: jitc))
And I have a testcase which looks something like so:
try {
string.getBytes("<bogus encoding>");
catch (UnsupportedEncodingException e) {
// success
}
fail();
This works fine in Sun and IBM 1.3, but breaks in IBM 1.4.
As earlier reported, it throws the new nio IllegalCharsetNameException.
Are IBM intending to fix this bug?
geoff
|
I never said it would be fixed because I don't accept that it's a bug.
There is a space in "bogus encoding" and therefore it is an illegal
charset name.
Neil
|
|
| Back to top |
|
 |
Geoff Soutter Guest
|
Posted: Thu Aug 28, 2003 9:24 am Post subject: Re: 1.4.1 String.getBytes still broken |
|
|
Neil Masson wrote:
[snip]
| Quote: | I never said it would be fixed because I don't accept that it's a bug.
There is a space in "bogus encoding" and therefore it is an illegal
charset name.
|
I agree it's an illegal charset name. No problem there.
The problem is that the method throws a different exception to what it
used to throw under the previous version of the VM.
This causes a backwards compatibility problem which causes my code to
fail unexpected, which I call a bug.
Generally Java is supposed to be backwards compatible. Is IBM Java
different in this respect?
geoff
|
|
| Back to top |
|
 |
Neil Masson Guest
|
Posted: Fri Aug 29, 2003 2:55 pm Post subject: Re: 1.4.1 String.getBytes still broken |
|
|
Geoff Soutter wrote:
| Quote: | Neil Masson wrote:
[snip]
I never said it would be fixed because I don't accept that it's a bug.
There is a space in "bogus encoding" and therefore it is an illegal
charset name.
I agree it's an illegal charset name. No problem there.
The problem is that the method throws a different exception to what it
used to throw under the previous version of the VM.
This causes a backwards compatibility problem which causes my code to
fail unexpected, which I call a bug.
Generally Java is supposed to be backwards compatible. Is IBM Java
different in this respect?
geoff
|
This is a moot point. Java is not supposed to be backwards compatible,
it is supposed to meet the spec and pass a set of compliance tests.
IBM's java is fully compliant.
It seems to me that IllegalCharsetNameException "Unchecked exception
thrown when a string that is not a legal charset name is used as such."
is more precise than UnsupportedEncodingException. However I also see
that throwing a different exception from a previous release can cause
problems to application writers.
Neil
|
|
| Back to top |
|
 |
Geoff Soutter Guest
|
Posted: Mon Sep 01, 2003 8:53 am Post subject: Re: 1.4.1 String.getBytes still broken |
|
|
Neil Masson wrote:
[snip]
| Quote: | This is a moot point. Java is not supposed to be backwards compatible,
it is supposed to meet the spec and pass a set of compliance tests.
IBM's java is fully compliant.
|
Hmm. Thats not what Sun seem to think - from
http://java.sun.com/j2se/1.4.1/compatibility.html:
"The Java 2 SDK versions 1.2, 1.3, and 1.4 are upwards source-compatible
with JDK software versions 1.0 and 1.1, except for the incompatibilities
listed below. This means that, except for the noted incompatibilities,
source files written to use the language features and APIs defined for
1.0 and 1.1 can be compiled and run in the Java 2 SDK (all versions)."
So, it appears that IBM JDK 1.4 does not live up to this statement, with
regards to the contract for String.getBytes().
| Quote: | It seems to me that IllegalCharsetNameException "Unchecked exception
thrown when a string that is not a legal charset name is used as such."
is more precise than UnsupportedEncodingException.
|
I agree.
| Quote: | However I also see
that throwing a different exception from a previous release can cause
problems to application writers.
|
Yes. These sort of issues are big problems if you want to run the same
class on multiple VMs.
And it is also different to the behaviour of the Sun VM, which is
presumably the reference implementation.
geoff
|
|
| Back to top |
|
 |
Neil Masson Guest
|
Posted: Mon Sep 29, 2003 11:26 am Post subject: Re: 1.4.1 String.getBytes still broken |
|
|
Geoff,
It seems to me that the IllegalCharsetNameException should not
leak out from the nio package. It makes it impossible to
write 1.3.1/1.4.1 neutral code as you point out. I have raised
a defect to get this fixed (though I will have to persuade the
fixer why it should be done).
Neil
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|