Userdatabase conversion#
During the past few years the format of the JSPWiki userdatabase (userdatabase.xml) has changed a bit.
- The passwords were first in plain text, later on they were (SHA) hashed.
- The format of the date fields have changed.
If you want to upgrade to a newer version of JSPWiki you might have to change the contents of your userdatabase.
There is now a prototype conversion utility available that does this for you.
Usage#
- You give it your userdatabase.xml file, and it will create a new one for you in the new format, with both hashed passwords and correct dateformats.
- The input userdatabase file will first be validated against an XML Schema, it will stop when the validation fails.
- If your passwords were already hashed, they will not be changed.
- The conversion utility will try to parse the dates with three different patterns:
public static final String c_oldLinuxFormat = "dd/MM/yyyy HH:mm:ss"; public static final String c_oldWin32Format = "MMM dd, yyyy hh:mm:ss aa"; public static final String c_NewFormat = "yyyy.MM.dd 'at' HH:mm:ss:SSS z";So, if you have a mixture of different date formats, they will automatically be transformed to the new one.
You can start it as follows :
java -cp udbconversion.jar:jdom.jar com.ecyrd.jspwiki.converter.UserDBConverter userdatabase.xml myWonderfullNewUserdatabase.xml
I have tested it with all userdatabase that I had available, please let me know what your experiences are.
Here is an example output of this utility:
metskem@bismarck:~/workspace/work$ java -cp /tmp/converter.jar:/home/metskem/java_libs/jdom.jar com.ecyrd.jspwiki.converter.UserDBConverter userdatabase.xml userdatabase-new.xml
validating xml document userdatabase.xml
Schema validation completed in 0 seconds
fatal errors occured:false
errors occured:false
warnings occured:false
starting conversion: /home/metskem/workspace/work/userdatabase.xml ==> /home/metskem/workspace/work/userdatabase-new.xml
XML Document built, writing to file userdatabase-new.xml
8 users processed in 0 seconds
metskem@bismarck:~/workspace/work$
Download#
Attached you find the necessary code to run it, it also contains the source so that you can verify first what it will do :-) .
You can here download the udbconversion.jar
and jdom.jar
