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 119820 - Malformed XML stored in response to some actions
Summary: Malformed XML stored in response to some actions
Status: RESOLVED FIXED
Alias: None
Product: ide
Classification: Unclassified
Component: Logger (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Jaroslav Tulach
URL:
Keywords:
Depends on: 120151
Blocks:
  Show dependency tree
 
Reported: 2007-10-23 17:35 UTC by Jesse Glick
Modified: 2007-10-29 20:01 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2007-10-23 17:35:39 UTC
<message>Invoking copy-to-clipboard implemented as org.netbeans.editor.BaseKit$CopyAction@32509b thru
java.awt.event.ActionEvent[ACTION_PERFORMED,cmd=,when=1193156841540,modifiers=Ctrl] on
org.openide.text.QuietEditorPane[,0,0,1318x902,layout=javax.swing.plaf.basic.BasicTextUI$UpdateHandler,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.basic.BasicBorders$MarginBorder@2889a0,flags=296,maximumSize=,minimumSize=,preferredSize=,caretColor=java.awt.Color[r=0,g=0,b=0],disabledTextColor=javax.swing.plaf.ColorUIResource[r=184,g=207,b=229],editable=true,margin=java.awt.Insets[top=0,left=0,bottom=0,right=0],selectedTextColor=sun.swing.PrintColorUIResource[r=51,g=51,b=51],selectionColor=javax.swing.plaf.ColorUIResource[r=184,g=207,b=229],kit=org.netbeans.modules.editor.plain.PlainKit@580d8f,typeHandlers=]</message>

resulting later in

org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x3) was found in the element content of the document.
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
	at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1411)
	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2879)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:645)
	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:508)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:198)
	at org.netbeans.lib.uihandler.LogRecords.scan(LogRecords.java:142)
Caused: java.io.IOException: An invalid XML character (Unicode: 0x3) was found in the element content of the document.
	at org.netbeans.lib.uihandler.LogRecords.scan(LogRecords.java:145)
[catch] at org.netbeans.modules.uihandler.Installer.getLogs(Installer.java:271)
	at org.netbeans.modules.uihandler.Installer.getThrown(Installer.java:406)
	at org.netbeans.modules.uihandler.Installer$SubmitInteractive.createDialog(Installer.java:1116)
	at org.netbeans.modules.uihandler.Installer$Submit.run(Installer.java:859)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:561)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:986)
Comment 1 Jesse Glick 2007-10-23 18:45:46 UTC
I am getting this error so often I cannot use the exception reporter at all.

org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x2) was found in the element content of the document.

etc. You need to be careful not to store control characters. See XMLUtil.toElementContent.
Comment 3 Jesse Glick 2007-10-23 19:17:15 UTC
Please review fix (seems to work):

Checking in LogFormatter.java;
/shared/data/ccvs/repository/logger/uihandlerlib/src/org/netbeans/lib/uihandler/LogFormatter.java,v  <--  LogFormatter.java
new revision: 1.7; previous revision: 1.6
done

Will now store e.g. ^C (as two ASCII chars) for Copy action.
Comment 4 Jesse Glick 2007-10-29 15:38:18 UTC
Refinement not to escape \t\r\n:

Checking in LogFormatter.java;
/shared/data/ccvs/repository/logger/uihandlerlib/src/org/netbeans/lib/uihandler/LogFormatter.java,v  <--  LogFormatter.java
new revision: 1.8; previous revision: 1.7
done
Comment 5 Jesse Glick 2007-10-29 15:39:22 UTC
Strictly speaking there are other characters which should be excluded, but I think it is the control characters which
are the likely offenders. Reference:

http://www.w3.org/TR/2006/REC-xml11-20060816/#charsets
Comment 6 Jindrich Sedek 2007-10-29 18:02:29 UTC
*** Issue 120151 has been marked as a duplicate of this issue. ***