This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 229277 - IllegalArgumentException: Illegal replacement
Summary: IllegalArgumentException: Illegal replacement
Status: NEW
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 7.3
Hardware: All All
: P3 normal (vote)
Assignee: issues@platform
Depends on:
Reported: 2013-05-02 13:31 UTC by hindermath
Modified: 2014-09-25 12:55 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 200346

stacktrace (2.77 KB, text/plain)
2013-05-02 13:31 UTC, hindermath

Note You need to log in before you can comment on or make changes to this bug.
Description hindermath 2013-05-02 13:31:55 UTC
Build: NetBeans IDE 7.3 (Build 201302132200)
VM: Java HotSpot(TM) 64-Bit Server VM, 23.7-b01, Java(TM) SE Runtime Environment, 1.7.0_15-b03
OS: Mac OS X

User Comments:
GUEST: Attempt to save all files and build.

hindermath: Want to rename the project name.

java.lang.IllegalArgumentException: Illegal replacement
   at java.nio.charset.CharsetEncoder.replaceWith(
   at org.netbeans.api.queries.FileEncodingQuery$ProxyCharset$ProxyEncoder.encodeHead(
   at org.netbeans.api.queries.FileEncodingQuery$ProxyCharset$ProxyEncoder.encodeLoop(
   at java.nio.charset.CharsetEncoder.encode(
   at sun.nio.cs.StreamEncoder.flushLeftoverChar(
   at sun.nio.cs.StreamEncoder.implClose(
Comment 1 hindermath 2013-05-02 13:31:56 UTC
Created attachment 134039 [details]
Comment 2 Milos Kleint 2013-05-09 09:09:39 UTC
adding tzezula and sdedic on CC, I'm fairly clueless what the error means. You seem to have participated in the affected code in FileEncodingQuery.ProxyEncoder
thanks for any hints.
Comment 3 Tomas Zezula 2013-05-09 09:32:06 UTC
The problem seems to be that the delagate encoder does not support  given replacement.
In the time the replaceWith([B)V was called the delegate was not yet known, the replacement was stored for future when the delegate will be known. When the delegate was found the ProxyEncoder tries to set the replacement but it fails as the delegate does not support given replacement. The issue belongs to Platform/other (queries).

There are two possibilities how this may happen:
1st) The caller of the replaceWith([B)V does not checked isLegalReplacement([B)Z.
2nd) The isLegalReplacement([B)Z ended with different CharsetEncoder.

It may be probably safe to ignore the replacement in some cases, I will need to check if this is the case.
Comment 4 Exceptions Reporter 2014-09-25 12:55:58 UTC
This bug already has 5 duplicates