United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6695609 wmic is called on every method call of RegistrationData.loadFromXML
JDK-6695609 : wmic is called on every method call of RegistrationData.loadFromXML

Details
Type:
Bug
Submit Date:
2008-04-29
Status:
Resolved
Updated Date:
2010-09-24
Project Name:
JDK
Resolved Date:
2008-11-14
Component:
install
OS:
windows
Sub-Component:
servicetags
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
6u5
Fixed Versions:
6u12 (b01)

Related Reports
Relates:

Sub Tasks

Description
It was designed that wmic is called only once to obtain the system environmental data.  Apparently, at every NetBeans IDE startup, wmic is invoked 5 times repeatedly. It is called on every call of RegistrationData.loadFromXML().

       at java.lang.Thread.dumpStack(Thread.java:1206)
       at org.netbeans.modules.servicetag.WindowsSystemEnvironment.getWmicResult(WindowsSystemEnvironment.java:121)
       at org.netbeans.modules.servicetag.WindowsSystemEnvironment.<init>(WindowsSystemEnvironment.java:75)
       at org.netbeans.modules.servicetag.SystemEnvironment.getSystemEnvironment(SystemEnvironment.java:83)
       at org.netbeans.modules.servicetag.RegistrationData.initEnvironment(RegistrationData.java:241)
       at org.netbeans.modules.servicetag.RegistrationData.<init>(RegistrationData.java:235)
       at org.netbeans.modules.servicetag.RegistrationDocument.load(RegistrationDocument.java:125)
       at org.netbeans.modules.servicetag.RegistrationData.loadFromXML(RegistrationData.java:426)
       at org.netbeans.modules.reglib.NbServiceTagSupport.getRegistrationData(NbServiceTagSupport.java:373)
       at org.netbeans.modules.reglib.NbServiceTagSupport.getNbServiceTag(NbServiceTagSupport.java:453)
       at org.netbeans.modules.reglib.NbServiceTagSupport.createNbServiceTag(NbServiceTagSupport.java:171)
       at org.netbeans.modules.registration.NbInstaller.restored(NbInstaller.java:98)
       at org.netbeans.core.startup.NbInstaller.loadCode(NbInstaller.java:419)
       at org.netbeans.core.startup.NbInstaller.load(NbInstaller.java:340)
       at org.netbeans.ModuleManager.enable(ModuleManager.java:936)
       at org.netbeans.core.startup.ModuleList.installNew(ModuleList.java:428)
       at org.netbeans.core.startup.ModuleList.trigger(ModuleList.java:364)
       at org.netbeans.core.startup.ModuleSystem.restore(ModuleSystem.java:276)
       at org.netbeans.core.startup.Main.getModuleSystem(Main.java:163)
       at org.netbeans.core.startup.Main.start(Main.java:314)
       at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:110)
       at java.lang.Thread.run(Thread.java:619)

                                    

Comments
EVALUATION

The RegistrationData() should only call the initEnvironment() method when creating a brand new RegistrationData object but not loading from a XML file.
                                     
2008-04-29
SUGGESTED FIX

------- RegistrationData.java -------
177,178c177,179
<     private final Map<String, String> environment;
<     private final Map<String, ServiceTag> svcTagMap;
---
>     private final Map<String, String> environment = initEnvironment();
>     private final Map<String, ServiceTag> svcTagMap =
>         new LinkedHashMap<String, ServiceTag>();
194c195,205
<         this(Util.generateURN());
---
>         this.urn = Util.generateURN();
>         SystemEnvironment sysEnv = SystemEnvironment.getSystemEnvironment();
>         setEnvironment(ST_NODE_HOSTNAME, sysEnv.getHostname());
>         setEnvironment(ST_NODE_HOST_ID, sysEnv.getHostId());
>         setEnvironment(ST_NODE_OS_NAME, sysEnv.getOsName());
>         setEnvironment(ST_NODE_OS_VERSION, sysEnv.getOsVersion());
>         setEnvironment(ST_NODE_OS_ARCH, sysEnv.getOsArchitecture());
>         setEnvironment(ST_NODE_SYSTEM_MODEL, sysEnv.getSystemModel());
>         setEnvironment(ST_NODE_SYSTEM_MANUFACTURER, sysEnv.getSystemManufacturer());
>         setEnvironment(ST_NODE_CPU_MANUFACTURER, sysEnv.getCpuManufacturer());>         setEnvironment(ST_NODE_SERIAL_NUMBER, sysEnv.getSerialNumber());
200,201d210
<         this.environment = initEnvironment();
<         this.svcTagMap = new LinkedHashMap<String, ServiceTag>();
206,215c215,223
<         SystemEnvironment sysEnv = SystemEnvironment.getSystemEnvironment();
<         map.put(ST_NODE_HOSTNAME, sysEnv.getHostname());
<         map.put(ST_NODE_HOST_ID, sysEnv.getHostId());
<         map.put(ST_NODE_OS_NAME, sysEnv.getOsName());
<         map.put(ST_NODE_OS_VERSION, sysEnv.getOsVersion());
<         map.put(ST_NODE_OS_ARCH, sysEnv.getOsArchitecture());
<         map.put(ST_NODE_SYSTEM_MODEL, sysEnv.getSystemModel());
<         map.put(ST_NODE_SYSTEM_MANUFACTURER, sysEnv.getSystemManufacturer());
<         map.put(ST_NODE_CPU_MANUFACTURER, sysEnv.getCpuManufacturer());
<         map.put(ST_NODE_SERIAL_NUMBER, sysEnv.getSerialNumber());
---
>         map.put(ST_NODE_HOSTNAME, "");
>         map.put(ST_NODE_HOST_ID, "");
>         map.put(ST_NODE_OS_NAME, "");
>         map.put(ST_NODE_OS_VERSION, "");
>         map.put(ST_NODE_OS_ARCH, "");
>         map.put(ST_NODE_SYSTEM_MODEL, "");
>         map.put(ST_NODE_SYSTEM_MANUFACTURER, "");
>         map.put(ST_NODE_CPU_MANUFACTURER, "");
>         map.put(ST_NODE_SERIAL_NUMBER, "");
                                     
2008-09-11



Hardware and Software, Engineered to Work Together