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.

View | Details | Raw Unified | Return to bug 164228
Collapse All | Expand All

(-)a/editor.lib/src/org/netbeans/editor/Formatter.java (-4 / +11 lines)
Lines 574-585 Link Here
574
            try {
574
            try {
575
                CharArrayWriter cw = new CharArrayWriter();
575
                CharArrayWriter cw = new CharArrayWriter();
576
                Writer w = createWriter(doc, startOffset, cw);
576
                Writer w = createWriter(doc, startOffset, cw);
577
                w.write(doc.getChars(startOffset, endOffset - startOffset));
577
                char[] originalString =doc.getChars(startOffset, endOffset - startOffset);
578
                w.write(originalString);
578
                w.close();
579
                w.close();
579
                String out = new String(cw.toCharArray());
580
                String out = new String(cw.toCharArray());
580
                doc.remove(startOffset, endOffset - startOffset);
581
                String in = new String(originalString);
581
                doc.insertString(startOffset, out, null);
582
                if(!out.equals(in)){
582
                return out.length();
583
                    doc.remove(startOffset, endOffset - startOffset);
584
                    doc.insertString(startOffset, out, null);
585
                    return out.length();
586
                }else{
587
                    //nothing changed
588
                    return 0;
589
                }
583
            } catch (IOException e) {
590
            } catch (IOException e) {
584
                Utilities.annotateLoggable(e);
591
                Utilities.annotateLoggable(e);
585
                return 0;
592
                return 0;

Return to bug 164228