try {
//get Runtime status
Runtime jvm = Runtime.getRuntime();
table.addElement( new TR()
.addElement( new TD("Free Memory (in bytes)") )
.addElement( new TD( Long.toString( jvm.freeMemory() ) ) ) );
table.addElement( new TR()
.addElement( new TD("Total Memory (in bytes)") )
.addElement( new TD( Long.toString( jvm.totalMemory() ) ) ) );
//get the system properties (It can throw a SecurityException)
Properties props = System.getProperties();
Enumeration enum1 = props.propertyNames();
while( enum1.hasMoreElements() ) {
Object key = enum1.nextElement();
if ( ! ( key instanceof String ) ) {
continue;
}
Object value = props.getProperty( key.toString() );
table.addElement( new TR()
.addElement( new TD( key.toString() ) )
.addElement( new TD( value.toString() ) ) );
}
} catch (Throwable t) {
logger.error("Throwable", t);
table.addElement( new TR()
.addElement( new TD( "Error" ) )
.addElement( new TD( "Could not read system properties" ) ) );
}
return table;
}