*
* @param obj instance to report on
* @return string
*/
final public static String report(Object obj) {
StringWriter result = new StringWriter();
PrintWriter report = new PrintWriter(result, true);
try {
if (obj != null) {
report.print("Class: ");
report.println(obj.getClass().getName());
report.print("Location: ");
CodeSource cs = obj.getClass().getProtectionDomain().getCodeSource();
if (cs != null)
report.println(cs.getLocation().toString());
else
report.println("unknown");
}
else {
report.print("Null object supplied");
}
report.print("Version: ");
report.println(versionString);
report.print("Build timestamp: ");
report.println(buildTimestamp);
report.print("Java version: ");
report.println(System.getProperty("java.version"));
report.print("CLASSPATH: ");
report.println(System.getProperty("java.class.path"));
report.print("OS name: ");
report.println(System.getProperty("os.name"));
report.print("OS arch: ");
report.println(System.getProperty("os.arch"));
report.print("OS version: ");
report.println(System.getProperty("os.version"));
}
catch (Throwable ex) {
report.println("Could not obtain version details: " + ex.getMessage());
}
return result.toString();
}