Re: Update Center fails to parse updates.xml generated by maven based application

Tim Boudreau <[email protected]>
Newsgroups gmane.comp.java.netbeans.modules.openide.devel
Message-ID <CA+qecRPrv55EvHyxotOEUVrzLLL8upti9jhLwU=e=gpaioT6_Q@mail.gmail.com>
I'd say download the actual XML in a browser, copy/paste it into NetBeans,
save as an XML file, and then right click and run Validate XML and see what
it says.

There's a good chance you're onto something with encoding issues.

In general, I'd say, don't try to do this in PHP.  Actually, don't try to
do anything in PHP.

FWIW, this might work better for you:
https://github.com/timboudreau/meta-update-center

-Tim



On Sun, Feb 28, 2016 at 4:09 AM, Asterix45 <[email protected]>
wrote:

> Hi all,
>
> I'm trying to correctly set a dynamic update center server which provide
> an xml on application request based on some information provided through
> url invocation.
>
> This server is PHP-based and running in local for now.
>
> In my maven application I generated the updates.xml and all the .nbm files
> running maven with the goal nbm:autoupdate. All the files were generated in
> a folder of my application.
>
> As first step I'm trying to provide the full updates.xml file, in order to
> test my architecture.
>
> I made this tests:
>
> 1. the application calls directly the updates.xml file by url
> Code:
> eg. http://localhost/.../updates.xml
>
>
> 2. the application calls a .php script which echos a string with the .xml
> content
> Code:
> eg. die('<?xml version="1.0" encoding="UTF-8" ?>
>             <!DOCTYPE module_updates PUBLIC "-//NetBeans//DTD .....');
>
>
> 3. same as point 2 but with this line (xml header) before the "die" command
> Code:
>  header('Content-Type: application/xml');
>
>  or
> Code:
> header('Content-Type: application/xml; charset=utf-8');
>
>
>
> In all of this test I have the same error in my application due to xml
> content parsing:
>
> Code:
>
> WARNING
> [org.netbeans.modules.autoupdate.updateprovider.AutoupdateCatalogParser]:
> http://localhost/WorkersCall-PHP/WebSuit-PHP/updateXML/updates.xml:1:1:
> Il contenuto non è consentito nel prologo.
> INFO [org.netbeans.modules.autoupdate.services.UpdateUnitFactory]: Cannot
> read UpdateItem from UpdateProvider Default Update
> Center[xyz_myorg_workerscall_WorkersCallStartup_update_center] to
> http://localhost/WorkersCall-PHP/WebSuit-PHP/updateXML/updates.xml
> org.xml.sax.SAXParseException; systemId:
> http://localhost/WorkersCall-PHP/WebSuit-PHP/updateXML/updates.xml;
> lineNumber: 1; columnNumber: 1; Il contenuto non è consentito nel prologo.
>         at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1239)
>         at
> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:642)
>         at
> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:326)
>         at
> org.netbeans.modules.autoupdate.updateprovider.AutoupdateCatalogParser.getUpdateItems(AutoupdateCatalogParser.java:197)
> Caused: java.io.IOException: Failed to parse
> http://localhost/WorkersCall-PHP/WebSuit-PHP/updateXML/updates.xml
>         at
> org.netbeans.modules.autoupdate.updateprovider.AutoupdateCatalogParser.getUpdateItems(AutoupdateCatalogParser.java:199)
>         at
> org.netbeans.modules.autoupdate.updateprovider.AutoupdateCatalogProvider.getUpdateItems(AutoupdateCatalogProvider.java:143)
> [catch] at
> org.netbeans.modules.autoupdate.services.UpdateUnitFactory.appendUpdateItems(UpdateUnitFactory.java:173)
>         at
> org.netbeans.modules.autoupdate.services.UpdateUnitFactory.getUpdateUnits(UpdateUnitFactory.java:143)
>         at
> org.netbeans.modules.autoupdate.services.UpdateManagerImpl$Cache.<init>(UpdateManagerImpl.java:271)
>         at
> org.netbeans.modules.autoupdate.services.UpdateManagerImpl.getCache(UpdateManagerImpl.java:231)
>         at
> org.netbeans.modules.autoupdate.services.UpdateManagerImpl.getUpdateUnits(UpdateManagerImpl.java:190)
>         at
> org.netbeans.api.autoupdate.UpdateManager.getUpdateUnits(UpdateManager.java:92)
>         at
> xyz.myorg.workerscall.startup.updateCenter.UpdateCenterManager.doRealCheck(UpdateCenterManager.java:70)
>         at
> xyz.myorg.workerscall.startup.updateCenter.UpdateCenterManager.updateApplication(UpdateCenterManager.java:46)
>         at
> xyz.myorg.workerscall.startup.installer.Installer$2.run(Installer.java:42)
>         at
> org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
>         at
> org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
>         at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
>         at
> org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)
>
>
>
>
> Also I can say I'm sure that the content of the xml is correctly retrieved
> because this line of log:
>
> Code:
>
> FINEST [mainLogger]:
> xyz.myorg.workerscall.startup.updateCenter.GeneraUpdateLink::getLink xml
> |<?xml version="1.0" encoding="UTF-8" ?>            <!DOCTYPE
> module_updates PUBLIC "-//NetBeans//DTD Autoupdate Catalog 2.5//EN" "
> http://www.netbeans.org/dtds/autoupdate-catalog-2_5.dtd">
> <module_updates timestamp="13/11/10/27/02/2016">                <module
> codenamebase="xyz.myorg.jwebsuitclient.JWebSuitClient" distribution="....|
>
>
>
> (I added the pipe chars in the log command to understand where the xml
> content starts)
>
>
> Reading posts I understand that this could be a problem of xml encoding,
> regarding BOM characters, so I add some filters in my php script to delete
> this character and I opened the xml file with an hex editor to understand
> if it has some "dirty" chars. I remove that chars also but the problem
> still remains (picture in attachment).
>
>
> I added the updates.xml file in attachment so that you can use it.
>
> Thanks for any help,
> Regards,
> Asterix
>
>
>
>
> Attachments:
> http://forums.netbeans.org//files/updatesxml_148.zip
> http://forums.netbeans.org//files/xml_on_hex_editor_151.png
>
>


-- 
http://timboudreau.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.