javacommons/utils/javasrc.cdc/com/ibm/oti/nokiaextcdc/SystemPropertyExtension.java
changeset 80 d6dafc5d983f
parent 21 2a9601315dfc
equal deleted inserted replaced
78:71ad690e91f5 80:d6dafc5d983f
    22 
    22 
    23 import com.ibm.oti.util.SystemPropertiesHook;
    23 import com.ibm.oti.util.SystemPropertiesHook;
    24 
    24 
    25 import com.nokia.mj.impl.rt.SystemPropertyProperties;
    25 import com.nokia.mj.impl.rt.SystemPropertyProperties;
    26 import com.nokia.mj.impl.rt.JvmPort;
    26 import com.nokia.mj.impl.rt.JvmPort;
       
    27 import com.nokia.mj.impl.utils.Logger;
    27 
    28 
    28 /**
    29 /**
    29  * A class that implements a system property extension mechanism provided
    30  * A class that implements a system property extension mechanism provided
    30  * by J9 for CDC. The idea is that the VM provides the original system
    31  * by J9 for CDC. The idea is that the VM provides the original system
    31  * properties in a Hashtable object as an argument in extendSystemProperties
    32  * properties in a Hashtable object as an argument in extendSystemProperties
    44      */
    45      */
    45     public Hashtable extendSystemProperties(Hashtable originalProperties)
    46     public Hashtable extendSystemProperties(Hashtable originalProperties)
    46     {
    47     {
    47         // Create a new object extending jva.util.Properties and fill with the
    48         // Create a new object extending jva.util.Properties and fill with the
    48         // original properties.
    49         // original properties.
    49         SystemPropertyProperties newProperties =
    50         SystemPropertyProperties newProperties = null;
    50             new SystemPropertyProperties(originalProperties);
       
    51 
    51 
    52         // Store the hashtable to be able to add properties during runtime.
    52         try
    53         JvmPort.setPropertiesContainer(newProperties);
    53         {
    54 
    54             newProperties = new SystemPropertyProperties(originalProperties);
    55         //Override existing line.separator
    55             // Store the hashtable to be able to add properties during runtime.
    56         newProperties.put("line.separator", "\n");
    56             JvmPort.setPropertiesContainer(newProperties);
       
    57     
       
    58             // Override existing line.separator
       
    59             newProperties.put("line.separator", "\n");
       
    60         }
       
    61         catch (Throwable t)
       
    62         {
       
    63             Logger.LOG(Logger.EUtils, Logger.EInfo, 
       
    64                "Failed to init system properties", t);
       
    65             // In case of error, return original properties.
       
    66             return originalProperties;
       
    67         }
    57 
    68 
    58         return newProperties;
    69         return newProperties;
    59     }
    70     }
    60 }
    71 }