我在工作OpenBravoPOS v2.30
,有人知道吗?这是一个免费许可的 POS。我正在尝试改进它,但在我的一台测试计算机中,它失败了。
毕竟,我在 stackoverflow 中读到过类似的案例,但他们都束手无策。
这是完整的异常输出:
WARNING: Analysis error. Invalid XML file.
org.xml.sax.SAXParseException: Premature end of file.
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:1427)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1056)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
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:119)
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 com.openbravo.pos.sales.JTicketLines.<init>(JTicketLines.java:70)
at com.openbravo.pos.sales.JTicketLinesMRB.<init>(JTicketLinesMRB.java:22)
at com.openbravo.pos.sales.JRefundLinesMRB.loadTicketLines(JRefundLinesMRB.java:97)
at com.openbravo.pos.sales.JRefundLines.<init>(JRefundLines.java:42)
at com.openbravo.pos.sales.JRefundLinesMRB.<init>(JRefundLinesMRB.java:44)
at com.openbravo.pos.sales.JTicketCatalogLinesMRB.newRefundLines(JTicketCatalogLinesMRB.java:23)
at com.openbravo.pos.sales.JTicketCatalogLines.<init>(JTicketCatalogLines.java:48)
at com.openbravo.pos.sales.JTicketCatalogLinesMRB.<init>(JTicketCatalogLinesMRB.java:17)
at com.openbravo.pos.sales.JPanelTicketEditsMRB.getSouthComponent(JPanelTicketEditsMRB.java:52)
at com.openbravo.pos.sales.JPanelTicket.init(JPanelTicket.java:272)
at com.openbravo.pos.sales.JPanelTicketEditsMRB.init(JPanelTicketEditsMRB.java:77)
at com.openbravo.pos.forms.JRootApp.getBean(JRootApp.java:409)
at com.openbravo.pos.forms.JPrincipalApp.showTask(JPrincipalApp.java:378)
at com.openbravo.pos.forms.MenuPanelAction.actionPerformed(MenuPanelAction.java:46)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at org.jdesktop.swingx.JXHyperlink.fireActionPerformed(JXHyperlink.java:244)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6290)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6055)
at java.awt.Container.processEvent(Container.java:2039)
at java.awt.Component.dispatchEventImpl(Component.java:4653)
at java.awt.Container.dispatchEventImpl(Container.java:2097)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4575)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4236)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4166)
at java.awt.Container.dispatchEventImpl(Container.java:2083)
at java.awt.Window.dispatchEventImpl(Window.java:2482)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:648)
at java.awt.EventQueue.access$000(EventQueue.java:84)
at java.awt.EventQueue$1.run(EventQueue.java:607)
at java.awt.EventQueue$1.run(EventQueue.java:605)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:621)
at java.awt.EventQueue$2.run(EventQueue.java:619)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:618)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
它指向那行代码:
private static SAXParser m_sp = null;
public JTicketLines(String ticketline) {
initComponents();
ColumnTicket[] acolumns = new ColumnTicket[0];
if (ticketline != null) {
try {
if (m_sp == null) {
SAXParserFactory spf = SAXParserFactory.newInstance();
m_sp = spf.newSAXParser();
}
ColumnsHandler columnshandler = new ColumnsHandler();
m_sp.parse(new InputSource(new StringReader(ticketline)), columnshandler);
acolumns = columnshandler.getColumns();
} catch (ParserConfigurationException ePC) {
logger.log(Level.WARNING, LocalRes.getIntString("exception.parserconfig"), ePC);
} catch (SAXException eSAX) {
logger.log(Level.WARNING, LocalRes.getIntString("exception.xmlfile"), eSAX);
} catch (IOException eIO) {
logger.log(Level.WARNING, LocalRes.getIntString("exception.iofile"), eIO);
}
}
initColumns(acolumns);
}
为什么它会抛出这个异常?这是XML文件的问题吗?它应该是不同计算机上的相同 XML。
LoadTicketLines:
protected void loadTicketLines(DataLogicSystem dlSystem) {
ticketlines = new JTicketLines(dlSystem.getResourceAsXML("Ticket.Line"));
}
和 XML 文件:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Openbravo POS is a point of sales application designed for touch screens.
Copyright (C) 2007-2009 Openbravo, S.L.
http://sourceforge.net/projects/openbravopos
This file is part of Openbravo POS.
Openbravo POS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Openbravo POS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Openbravo POS. If not, see <http://www.gnu.org/licenses/>.
-->
<line>
<!-- <column name="label.item" width="125" align="left" value="<html>#if ($ticketline.isProductCom()) <i>*&nbsp;&nbsp;${ticketline.printNameAndDiscount()}</i> #else ${ticketline.printNameAndDiscount()} #end<br>${ticketline.getProductAttSetInstDesc()}"/> -->
<column name="label.item" fontsize="16" width="125" align="left" value="${ticketline.printName()}"/>
<column name="label.units" fontsize="16" width="50" align="right" value="x${ticketline.printMultiply()}"/>
<!-- PARTY -->
<column name="label.pvp" fontsize="16" width="50" align="right" value="${ticketline.printPVP()}"/>
<column name="label.discount" fontsize="16" width="50" align="right" value="${ticketline.printDicountPercent()}"/>
<column name="label.TotalLine" fontsize="16" width="80" align="right" value="${ticketline.printValue()}"/>
</line>
对不起,如果它包含很多代码,不知道如何更好地解释它