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

Summary: IllegalArgumentException: Illegal replacement
Product: platform Reporter: hindermath
Component: -- Other --Assignee: issues@platform <issues>
Status: NEW ---    
Severity: normal CC: sdedic, tzezula, zmirc
Priority: P3    
Version: 7.3   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 200346
Attachments: stacktrace

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.




Stacktrace: 
java.lang.IllegalArgumentException: Illegal replacement
   at java.nio.charset.CharsetEncoder.replaceWith(CharsetEncoder.java:285)
   at org.netbeans.api.queries.FileEncodingQuery$ProxyCharset$ProxyEncoder.encodeHead(FileEncodingQuery.java:397)
   at org.netbeans.api.queries.FileEncodingQuery$ProxyCharset$ProxyEncoder.encodeLoop(FileEncodingQuery.java:368)
   at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:561)
   at sun.nio.cs.StreamEncoder.flushLeftoverChar(StreamEncoder.java:242)
   at sun.nio.cs.StreamEncoder.implClose(StreamEncoder.java:301)
Comment 1 hindermath 2013-05-02 13:31:56 UTC
Created attachment 134039 [details]
stacktrace
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 
see http://statistics.netbeans.org/exceptions/detail.do?id=200346