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.
Summary: | Unable to save JSP with characters incompatible with undeclared default encoding | ||
---|---|---|---|
Product: | platform | Reporter: | Vladimir Riha <vriha> |
Component: | Data Systems | Assignee: | Svata Dedic <sdedic> |
Status: | VERIFIED FIXED | ||
Severity: | normal | CC: | mikey_ebor, vriha |
Priority: | P2 | Keywords: | REGRESSION |
Version: | 7.2.1 | ||
Hardware: | PC | ||
OS: | Windows 7 | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: |
sample file
IDE log |
Created attachment 120762 [details]
IDE log
Sorry, I forgot to mention text in the error dialog: "There were some problems while saving newjsp1.jsp. Cause: Input length=1" Happens even if the JSP contains contentType: <%@page contentType="text/html" contentType="text/html;charset=ISO-8859-2" info="šěšě+šáýí"%> This file can't be saved. Personally I think it should be fixed for 7.2 Another observation: If you try to save the file and confirm both dialogs (first standard warning and 2nd with the "...Cause: Input length=1"), the file is unsaved. Now if you close the file (discard changes) and reopen, the file is empty! Product Version: NetBeans IDE 7.2 RC1 (Build 201206252201) Java: 1.7.0_06-ea; Java HotSpot(TM) Client VM 23.2-b05 System: Linux version 3.0.0-21-generic-pae running on i386; UTF-8; en_US (nb) This has been introduced by this changeset: http://hg.netbeans.org/main-silver/rev/88c8987cbaa0 The trouble is that if an error happens during saveFromKitToStream (i.e. disk error, ...), the file will be truncated as well. Before the mentioned change, the file was saved, but unmappable characters were garbled: all characters not representable by the file|project character set were written as "?". I agree that not handling the situation gracefully is even worse. (In reply to comment #6) > The trouble is that if an error happens during saveFromKitToStream (i.e. disk > error, ...), the file will be truncated as well. Before the mentioned change, > the file was saved, but unmappable characters were garbled: all characters not > representable by the file|project character set were written as "?". FYI that was expected as dialog notified user about that just before the save. > > I agree that not handling the situation gracefully is even worse. (In reply to comment #7) > FYI that was expected as dialog notified user about that just before the save. > Yes, for those DES subclasses, which take care and do the detection in their saveDocument(). Some file types do not; I believe the unsupported encoding handling should be centralized. Changeset: 03dbe99d2ae8 Author: Svata Dedic <sdedic@netbeans.org> Date: 2012-06-27 21:49 Message: Issue #214092 - Unable to save JSP with characters incompatible with undeclared default encoding: fixed Reverted back the reporting in DES; Aligned XML saveDocument() handling with the other editor supports. Integrated into 'main-golden', will be available in build *201206290002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/03dbe99d2ae8 User: Svata Dedic <sdedic@netbeans.org> Log: Issue #214092 - Unable to save JSP with characters incompatible with undeclared default encoding: fixed Reverted back the reporting in DES; Aligned XML saveDocument() handling with the other editor supports. verified, thanks Product Version: NetBeans IDE Dev (Build 201206290002) Java: 1.7.0_05; Java HotSpot(TM) Client VM 23.1-b03 System: Linux version 3.0.0-21-generic-pae running on i386; UTF-8; en_US (nb) Transplanted as http://hg.netbeans.org/releases/rev/a3ee9eccd948 Integrated into 'releases', will be available in build *201209010822* or newer. Wait for official and publicly available build. Changeset: http://hg.netbeans.org/releases/rev/a3ee9eccd948 User: Svata Dedic <sdedic@netbeans.org> Log: Issue #214092 - Unable to save JSP with characters incompatible with undeclared default encoding: fixed Reverted back the reporting in DES; Aligned XML saveDocument() handling with the other editor supports. works fine in patch1 Product Version: NetBeans IDE 7.2 (Build 201207171143) Java: 1.7.0_07; Java HotSpot(TM) Client VM 23.3-b01 System: Linux version 3.2.0-29-generic-pae running on i386; UTF-8; en_US (nb) What seems to be this same bug caused significant data loss in the following scenario: 1. Editing a java file 2. Cut&Paste from Chrome browser some documentation that includes the   special character into the java file 3. Save the file - message "There were some problems while saving XXX.java Cause: Input length = 1" pops up 4. File has been truncated on disk (it's possible to re-edit the file to remove the changes and re-save in the IDE, but if you instead close the IDE then everything after the offending character is gone). For example Cut&Paste the section: The Distance Matrix API has the following limits in place: 100 elements per query. 100 elements per 10 seconds. 2 500 elements per 24 hour period. from this URL https://developers.google.com/maps/documentation/distancematrix/ into a java file in the IDE and press save - everything after the 2 in "2500" will be truncated on disk. I should also note that the offending character does not show in the IDE even with View->Show Non Printable Characters selected. Product Version: NetBeans IDE 7.2 (Build 201207171143) |
Created attachment 120761 [details] sample file When a JSP file is missing pageEncoding or contentType and it contains some for instance czech characters (diacritics), it cannot be saved. - To reproduce, try to save the attached sample file - NetBeans shows warning that suggested encoding (e.g. ISO-8859-1) may break some characters, confirm it to continue saving => the error is shown Sometimes a dialog window saying that the file was modified externally and asking if I want to overwrite it, is opened after the first dialog (the one with encoding warning). Also after I add the pageEncoding or/and contentType to the "<%page", it doesn't help and the file still cannot be saved. I have to remove the diacritic characters and then save it. Product Version: NetBeans IDE Dev (Build 201206110001) Java: 1.7.0_04; Java HotSpot(TM) Client VM 23.0-b21 System: Windows 7 version 6.1 running on x86; Cp1252; en_US (nb)