You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ma...@apache.org on 2012/09/06 20:35:37 UTC
svn commit: r1381710 - in /db/derby/code/branches/10.7: ./
java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
Author: mamta
Date: Thu Sep 6 18:35:37 2012
New Revision: 1381710
URL: http://svn.apache.org/viewvc?rev=1381710&view=rev
Log:
DERBY-5240 (Log Operating system information to derby.log on boot )
Backporting to 10.7
Modified:
db/derby/code/branches/10.7/ (props changed)
db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
Propchange: db/derby/code/branches/10.7/
------------------------------------------------------------------------------
Merged /db/derby/code/trunk:r1371041
Modified: db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java?rev=1381710&r1=1381709&r2=1381710&view=diff
==============================================================================
--- db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java (original)
+++ db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java Thu Sep 6 18:35:37 2012
@@ -134,6 +134,8 @@ public class BaseDataFileFactory
private String jvmVersion;
+ private String osInfo;
+
private String jarCPath;
private RawStoreFactory rawStoreFactory; // associated raw store factory
@@ -262,6 +264,8 @@ public class BaseDataFileFactory
jvmVersion = buildJvmVersion();
+ osInfo = buildOSinfo();
+
jarCPath = jarClassPath(getClass());
dataDirectory = startParams.getProperty(PersistentService.ROOT);
@@ -369,6 +373,9 @@ public class BaseDataFileFactory
//Log the JVM version info
logMsg(jvmVersion);
+ //Log the OS info
+ logMsg(osInfo);
+
//Log derby.system.home It will have null value if user didn't set it
logMsg(Property.SYSTEM_HOME_PROPERTY+"=" +
PropertyUtil.getSystemProperty(Property.SYSTEM_HOME_PROPERTY));
@@ -2201,6 +2208,32 @@ public class BaseDataFileFactory
});
}
+ /**
+ * Return values of system properties that identify the OS.
+ * Will catch SecurityExceptions and note them for displaying information.
+ * @return the Java system property value for the OS or a string capturing a
+ * security exception.
+ */
+ private static String buildOSinfo () {
+ return (String)AccessController.doPrivileged(new PrivilegedAction(){
+ public Object run() {
+ String osInfo = "";
+ try {
+ String currentProp = PropertyUtil.getSystemProperty("os.name");
+ if (currentProp != null)
+ osInfo = "os.name="+currentProp+"\n";
+ if ((currentProp = PropertyUtil.getSystemProperty("os.arch")) != null)
+ osInfo += "os.arch="+currentProp+"\n";
+ if ((currentProp = PropertyUtil.getSystemProperty("os.version")) != null)
+ osInfo += "os.version="+currentProp;
+ }
+ catch(SecurityException se){
+ return se.getMessage();
+ }
+ return osInfo;
+ }
+ });
+ }
/**
* Return values of system properties that identify the JVM.