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.
In order to use proper encoding by guards impl it seems to be necessary to change GuardedSectionsProvider to accept encoding in better way then as String. I would propose to replace present methods Reader createGuardedReader(InputStream stream, String encoding) throws UnsupportedEncodingException; Writer createGuardedWriter(OutputStream stream, String encoding) throws UnsupportedEncodingException; with Reader createGuardedReader(InputStream stream, Charset encoding) Writer createGuardedWriter(OutputStream stream, Charset encoding) or with Reader createGuardedReader(Reader r) Writer createGuardedWriter(Writer w) This will ensure that e.g. in case of XML files client of API would not be forced to parse file for encoding and later create a new stream using proper encoding. The change is incompatible but since the API has not been released yet I guess it is acceptable to change the interface this way. I will update clients.
I think you should take it to apireviews@, at least to let people know about the change. I guess nobody will object the change if the api hasn't been published yet.
I know. I wanted this to be filed. There are higher priority issues to solve now.
Created attachment 43989 [details] proposed api change
Created attachment 43991 [details] impl of the api change + modified clients
I have implemented the first option replacing 'String encoding' with 'Charset charset' in GuardedSectionsProvider. I also changed the API category level from Under Development to Official (org.netbeans.modules.editor.guards/1 spec 1.0).
I would like to ask for fast review of this issue. The change is really simple and I hope it would be still possible to integrate this to 6.0M10.
Integrate it to M10, it is an incompatible change and the sooner it is done, the better. No changes in tests? That looks like your API is not much tested.
The second patch looks ok for Mobility Pack needs.
Thanks for review I will integrate it.
fixed in RCS file: /cvs/editor/guards/apichanges.xml,v done Checking in editor/guards/apichanges.xml; /cvs/editor/guards/apichanges.xml,v <-- apichanges.xml initial revision: 1.1 done Checking in editor/guards/arch.xml; /cvs/editor/guards/arch.xml,v <-- arch.xml new revision: 1.5; previous revision: 1.4 done Checking in editor/guards/manifest.mf; /cvs/editor/guards/manifest.mf,v <-- manifest.mf new revision: 1.3; previous revision: 1.2 done Checking in editor/guards/nbproject/project.properties; /cvs/editor/guards/nbproject/project.properties,v <-- project.properties new revision: 1.3; previous revision: 1.2 done Checking in editor/guards/src/org/netbeans/modules/editor/guards/GuardedReader.java; /cvs/editor/guards/src/org/netbeans/modules/editor/guards/GuardedReader.java,v <-- GuardedReader.java new revision: 1.3; previous revision: 1.2 done Checking in editor/guards/src/org/netbeans/modules/editor/guards/GuardedSectionsImpl.java; /cvs/editor/guards/src/org/netbeans/modules/editor/guards/GuardedSectionsImpl.java,v <-- GuardedSectionsImpl.java new revision: 1.5; previous revision: 1.4 done Checking in editor/guards/src/org/netbeans/modules/editor/guards/GuardedWriter.java; /cvs/editor/guards/src/org/netbeans/modules/editor/guards/GuardedWriter.java,v <-- GuardedWriter.java new revision: 1.4; previous revision: 1.3 done Checking in editor/guards/src/org/netbeans/spi/editor/guards/GuardedSectionsProvider.java; /cvs/editor/guards/src/org/netbeans/spi/editor/guards/GuardedSectionsProvider.java,v <-- GuardedSectionsProvider.java new revision: 1.4; previous revision: 1.3 done Checking in editor/guards/src/org/netbeans/spi/editor/guards/support/AbstractGuardedSectionsProvider.java; /cvs/editor/guards/src/org/netbeans/spi/editor/guards/support/AbstractGuardedSectionsProvider.java,v <-- AbstractGuardedSectionsProvider.java new revision: 1.6; previous revision: 1.5 done Checking in i18n/form/nbproject/project.xml; /cvs/i18n/form/nbproject/project.xml,v <-- project.xml new revision: 1.18; previous revision: 1.17 done Checking in java/guards/nbproject/project.xml; /cvs/java/guards/nbproject/project.xml,v <-- project.xml new revision: 1.4; previous revision: 1.3 done Checking in javadoc/nbproject/project.xml; /cvs/javadoc/nbproject/project.xml,v <-- project.xml new revision: 1.24; previous revision: 1.23 done Checking in form/nbproject/project.xml; /cvs/form/nbproject/project.xml,v <-- project.xml new revision: 1.44; previous revision: 1.43 done Checking in form/src/org/netbeans/modules/form/FormEditorSupport.java; /cvs/form/src/org/netbeans/modules/form/FormEditorSupport.java,v <-- FormEditorSupport.java new revision: 1.210; previous revision: 1.209 done Checking in form/swingapp/nbproject/project.xml; /cvs/form/swingapp/nbproject/project.xml,v <-- project.xml new revision: 1.8; previous revision: 1.7 done Checking in refactoring/api/nbproject/project.xml; /cvs/refactoring/api/nbproject/project.xml,v <-- project.xml new revision: 1.12; previous revision: 1.11 done Checking in mobility/designer/nbproject/project.xml; /cvs/mobility/designer/nbproject/project.xml,v <-- project.xml new revision: 1.11; previous revision: 1.10 done Checking in mobility/designer2/codegen/nbproject/project.xml; /cvs/mobility/designer2/codegen/nbproject/project.xml,v <-- project.xml new revision: 1.4; previous revision: 1.3 done Checking in mobility/designer2/io/nbproject/project.xml; /cvs/mobility/designer2/io/nbproject/project.xml,v <-- project.xml new revision: 1.5; previous revision: 1.4 done Checking in mobility/designer2/iojavame/nbproject/project.xml; /cvs/mobility/designer2/iojavame/nbproject/project.xml,v <-- project.xml new revision: 1.7; previous revision: 1.6 done Checking in mobility/designer2/midp/nbproject/project.xml; /cvs/mobility/designer2/midp/nbproject/project.xml,v <-- project.xml new revision: 1.16; previous revision: 1.15 done Checking in mobility/editor/src/org/netbeans/modules/mobility/editor/pub/J2MEDataObject.java; /cvs/mobility/editor/src/org/netbeans/modules/mobility/editor/pub/J2MEDataObject.java,v <-- J2MEDataObject.java new revision: 1.7; previous revision: 1.6 done