Project: Birt
Bug 287781 NPE when add style in XML outline and save report[1401]
Reported: 2009-08-27 02:45:01 | Status: closed fixed

Description: NPE when add style after switch to xml source outline and then save Build number:2.5.1v20090827 steps to reproduce: 1. New a report, go to XML Source view 2. In outline, switch to xml source outline, select style node and use context menu to add Child->style 3. Back to Layout 4. in the popup dialog about xml source change, click save Expected result: No Exception. Actual result: NPE Error log: java.lang.NullPointerException at java.util.regex.Matcher.getTextLength(Matcher.java:1140) at java.util.regex.Matcher.reset(Matcher.java:291) at java.util.regex.Matcher.<init>(Matcher.java:211) at java.util.regex.Pattern.matcher(Pattern.java:885) at org.eclipse.birt.report.model.parser.ReportElementState.addToNamespace(ReportElementState.java:508) at org.eclipse.birt.report.model.parser.ReportElementState.addToSlot(ReportElementState.java:295) at org.eclipse.birt.report.model.parser.ReportElementState.initSimpleElement(ReportElementState.java:446) at org.eclipse.birt.report.model.parser.ReportElementState.initElement(ReportElementState.java:341) at org.eclipse.birt.report.model.parser.StyleState.parseAttrs(StyleState.java:90) at org.eclipse.birt.report.model.parser.ModuleParserHandler.startElement(ModuleParserHandler.java:245) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1357) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2740) 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 org.eclipse.birt.report.model.parser.ModuleReader.readModule(ModuleReader.java:94) at org.eclipse.birt.report.model.parser.DesignReader.read(DesignReader.java:88) at org.eclipse.birt.report.model.core.DesignSessionImpl.openDesign(DesignSessionImpl.java:315) at org.eclipse.birt.report.model.core.DesignSessionImpl.openDesign(DesignSessionImpl.java:286) at org.eclipse.birt.report.model.api.SessionHandleImpl.openDesign(SessionHandleImpl.java:269) at org.eclipse.birt.report.designer.ui.editor.pages.xml.ReportXMLSourceEditorFormPage.getErrorLIine(ReportXMLSourceEditorFormPage.java:192) at org.eclipse.birt.report.designer.ui.editor.pages.xml.ReportXMLSourceEditorFormPage.clearDirtyFlag(ReportXMLSourceEditorFormPage.java:782) at org.eclipse.birt.report.designer.ui.editor.pages.xml.ReportXMLSourceEditorFormPage.access$1(ReportXMLSourceEditorFormPage.java:779) at org.eclipse.birt.report.designer.ui.editor.pages.xml.ReportXMLSourceEditorFormPage$1.doSave(ReportXMLSourceEditorFormPage.java:131) at org.eclipse.birt.report.designer.ui.editor.pages.xml.ReportXMLSourceEditorFormPage.doSave(ReportXMLSourceEditorFormPage.java:772) at org.eclipse.birt.report.designer.ui.editors.MultiPageReportEditor.doSave(MultiPageReportEditor.java:502) at org.eclipse.birt.report.designer.ui.editors.IDEMultiPageReportEditor.doSave(IDEMultiPageReportEditor.java:415) at org.eclipse.birt.report.designer.ui.editor.pages.xml.ReportXMLSourceEditorFormPage.canLeaveThePage(ReportXMLSourceEditorFormPage.java:278) at org.eclipse.birt.report.designer.ui.editors.MultiPageReportEditor.pageChange(MultiPageReportEditor.java:809) at org.eclipse.ui.part.MultiPageEditorPart$2.widgetSelected(MultiPageEditorPart.java:291) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1027) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:770) at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3256) at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:2045) at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:323) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3880) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3473) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514) at org.eclipse.equinox.launcher.Main.run(Main.java:1311)

Files changed in fix:
model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/parser/ReportElementState.java