Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

logging version number at runtime

 
mohana konakanchi
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have developement, staging, production environments which uses
apache xerces on each box. We had error while tranforming XML to HTML in staging and working fine in others (not able to trace the error message due to high volume data). Same code is deployed in all boxes.

Is there as way to know the version number of Xerces used on runtime? so that we can make sure different boxes running same version of Xerces.
 
mohana konakanchi
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got this code from web.

You can use the org.apache.xerces.impl.Version class in Xerces. For
instance, this is the code that XOM's Builder class uses to check the
version:

try {
String versionString = Version.getVersion();
versionString = versionString.substring(9, 12);
xercesVersion = Double.valueOf(versionString).doubleValue();
}
catch (Exception ex) {
// The version string format changed so presumably it's
// 2.6 or later
}
catch (Error err) {
// Xerces not installed, so none of this matters
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic