Hi "Mi",
On 23.02.2012 21:39, Mi wrote:
Under some circumstances, wpkg.js tries to parse non-existing .xml files, and
writes an "ERROR" into the log file. This is misleading in situations where it
is normal that the file does not exist.
For example, when using a "packages" directory of .xml files instead of a single
packages.xml file, wpkg.js still tries to parse the non-existing packages.xml.
It's correct that these database files (packages.xml, profiles.xml, hosts.xml)
are entirely optional. So I agree that printing an error-severity message if
they do not exist is not appropriate.
For now, I patched loadXml() to only try to load the xml if the file actually
exists. Otherwise, print debug info and skip it. Now I have this in the log,
which seems better:
2012-02-23 21:00:29, DEBUG : Reading XML file:
//192.168.44.1/install/wpkg/packages/twixtel.xml
2012-02-23 21:00:29, DEBUG : Reading XML file:
//192.168.44.1/install/wpkg/packages/user-settings.xml
2012-02-23 21:00:29, *DEBUG : Skipping non-existing XML file:
//192.168.44.1/install/wpkg/packages.xml*
I think it's the wrong approach to patch loadXml(). The loadXml() function is
supposed to perform the XML loading task. If it's instructed to load a certain
XML file then it shall actually really print errors if the XML file cannot be
loaded.
However the call of loadXml() shall be sanitized. WPKG shall not try to load
files which do not exist.
Therefore I've implemented the check whether the database file exists on the
call to loadXml(). In addition at this location in the code there is already an
FS object which can be used for the file existence check.
Maybe the line
var fso = new ActiveXObject("Scripting.FileSystemObject")
should be moved before the for loop for efficiency?
Yes, that would be advisable. However any change to loadXml() is completely
obsolete by the change I have implemented now:
Now it prints the following debug message:
Combined package database does not exist, skipping '<file-path>'.
Changelog:
MOD: Omit error message printed if any of the combined database files do not
exist (packages.xml, hosts.xml, profiles.xml). As these files are
completely optional WPKG shall not print error if they do not exist.
Thanks to "Mi" for reporting.
Download version 1.3.1-RC6 here:
<http://wpkg.svn.sourceforge.net/viewvc/wpkg/wpkg/stable/src/main/resources/wpkg/>
br,
Rainer
-------------------------------------------------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
_______________________________________________
wpkg-users mailing list
wpkg-users@lists.wpkg.org
http://lists.wpkg.org/mailman/listinfo/wpkg-users