Skip to content

Commit ebcd1e8

Browse files
author
Lauri Wiljami Ahonen
committed
Improve test code quality
1 parent 67f17f1 commit ebcd1e8

File tree

1 file changed

+243
-7
lines changed

1 file changed

+243
-7
lines changed

contrib/platform/test/com/sun/jna/platform/win32/COM/OaIdlRandomErrors.java

Lines changed: 243 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,265 @@
2323
*/
2424
package com.sun.jna.platform.win32.COM;
2525

26-
import java.io.File;
27-
import java.util.Arrays;
28-
import java.util.HashSet;
29-
import java.util.Set;
30-
3126
import com.sun.jna.platform.win32.OaIdl.FUNCDESC;
3227
import com.sun.jna.platform.win32.OaIdl.TLIBATTR;
3328
import com.sun.jna.platform.win32.OaIdl.TYPEATTR;
3429
import com.sun.jna.platform.win32.OaIdl.VARDESC;
3530

31+
import java.io.File;
32+
import java.util.Arrays;
33+
import java.util.HashSet;
34+
import java.util.Set;
35+
3636
public class OaIdlRandomErrors {
3737
static Set<String> includedFilenames = new HashSet<>();
3838

3939
public static void main(String[] args) {
40-
String[] filenames = {"accessibilitycpl.dll", "activeds.tlb", "adprovider.dll", "amcompat.tlb", "apds.dll", "AppIdPolicyEngineApi.dll", "atl.dll", "atl100.dll", "atl110.dll", "AuditPolicyGPInterop.dll", "azroles.dll", "bcdsrv.dll", "capiprovider.dll", "catsrvut.dll", "cdosys.dll", "certcli.dll", "certenc.dll", "CertEnroll.dll", "certmgr.dll", "cic.dll", "clbcatq.dll", "cngprovider.dll", "comrepl.dll", "comsnap.dll", "comsvcs.dll", "connect.dll", "correngine.dll", "cryptext.dll", "DefaultPrinterProvider.dll", "DevicePairing.dll", "DevicePairingProxy.dll", "DfsShlEx.dll", "DiagCpl.dll", "dmocx.dll", "DMRServer.dll", "dnshc.dll", "dot3dlg.dll", "dot3hc.dll", "dpapiprovider.dll", "dskquota.dll", "dtsh.dll", "dxtmsft.dll", "dxtrans.dll", "EditionUpgradeHelper.dll", "EditionUpgradeManagerObj.dll", "EhStorAPI.dll", "EhStorShell.dll", "es.dll", "eventcls.dll", "expsrv.dll", "findnetprinters.dll", "FirewallAPI.dll", "FirewallControlPanel.dll", "fphc.dll", "FXSCOM.dll", "FXSCOMEX.dll", "gpprefcl.dll", "Groupinghc.dll", "HelpPaneProxy.dll", "hnetcfg.dll", "iasads.dll", "iasdatastore.dll", "iashlpr.dll", "iasnap.dll", "iasrad.dll", "iassam.dll", "iassdo.dll", "iassvcs.dll", "icsvc.dll", "ieframe.dll", "iepeers.dll", "igdDiag.dll", "imapi2.dll", "imapi2fs.dll", "inetcomm.dll", "InkEd.dll", "InkObjCore.dll", "ipnathlp.dll", "JavaScriptCollectionAgent.dll", "jscript.dll", "L2SecHC.dll", "LocationApi.dll", "MbaeApi.dll", "mmcndmgr.dll", "msaatext.dll", "msdatsrc.tlb", "msdtcuiu.dll", "msdxm.tlb", "msfeeds.dll", "msftedit.dll", "mshtml.tlb", "mshtmled.dll", "msi.dll", "msjtes40.dll", "MsraLegacy.tlb", "MsRdpWebAccess.dll", "mssitlb.dll", "mssrch.dll", "mstscax.dll", "msvbvm60.dll", "MSVidCtl.dll", "mswmdm.dll", "msxml3.dll", "msxml4.dll", "msxml6.dll", "mycomput.dll", "NaturalLanguage6.dll", "ndfapi.dll", "ndishc.dll", "netcenter.dll", "netcorehc.dll", "netprofm.dll", "NetworkCollectionAgent.dll", "nlahc.dll", "odbcconf.dll", "officecsp.dll", "oleacc.dll", "oleprn.dll", "pla.dll", "PNPXAssoc.dll", "PNPXAssocPrx.dll", "Pnrphc.dll", "PortableDeviceApi.dll", "PortableDeviceClassExtension.dll", "PortableDeviceConnectApi.dll", "PortableDeviceTypes.dll", "PrintConfig.dll", "printui.dll", "prnntfy.dll", "provcore.dll", "psisdecd.dll", "pstorec.dll", "puiapi.dll", "puiobj.dll", "qedit.dll", "quartz.dll", "rasdiag.dll", "rasgcw.dll", "rdpcorets.dll", "rdpencom.dll", "RdpRelayTransport.dll", "rdpsharercom.dll", "rdpviewerax.dll", "RegCtrl.dll", "rendezvousSession.tlb", "riched20.dll", "RoamingSecurity.dll", "RotMgr.dll", "scripto.dll", "scrobj.dll", "scrrun.dll", "sdiageng.dll", "sdohlp.dll", "Sens.dll", "shdocvw.dll", "shell32.dll", "shgina.dll", "signdrv.dll", "simpdata.tlb", "SMBHelperClass.dll", "SmiEngine.dll", "sppcomapi.dll", "sppwmi.dll", "SRH.dll", "srm.dll", "stclient.dll", "stdole2.tlb", "stdole32.tlb", "swprv.dll", "SysFxUI.dll", "TabbtnEx.dll", "tapi3.dll", "taskschd.dll", "termmgr.dll", "TransportDSA.dll", "TSWorkspace.dll", "tvratings.dll", "ucmhc.dll", "UIAnimation.dll", "UIAutomationCore.dll", "uicom.dll", "upnp.dll", "usbmon.dll", "VAN.dll", "vbscript.dll", "WaaSMedicPS.dll", "wavemsp.dll", "WfHC.dll", "wiaaut.dll", "wiascanprofiles.dll", "win32spl.dll", "wincredprovider.dll", "windowslivelogin.dll", "winethc.dll", "winhttpcom.dll", "WinMsoIrmProtector.dll", "WinOpcIrmProtector.dll", "WinSATAPI.dll", "wisp.dll", "wkspbrokerAx.dll", "WLanConn.dll", "wlandlg.dll", "WLanHC.dll", "wlanpref.dll", "wlanui.dll", "wlidcli.dll", "wlidprov.dll", "wmdmlog.dll", "WMNetMgr.dll", "wmp.dll", "wmpdxm.dll", "wmpshell.dll", "WorkFoldersShell.dll", "workfolderssvc.dll", "WPDSp.dll", "wscapi.dll", "wshcon.dll", "wshext.dll", "WsmAuto.dll", "wuapi.dll", "wvc.dll", "WWanAPI.dll", "WWanHC.dll", "xwizards.dll", "xwreg.dll", "xwtpdui.dll", "xwtpw32.dll"};
40+
String[] filenames = new String[] {
41+
"accessibilitycpl.dll",
42+
"activeds.tlb",
43+
"adprovider.dll",
44+
"amcompat.tlb",
45+
"apds.dll",
46+
"AppIdPolicyEngineApi.dll",
47+
"atl.dll",
48+
"atl100.dll",
49+
"atl110.dll",
50+
"AuditPolicyGPInterop.dll",
51+
"azroles.dll",
52+
"bcdsrv.dll",
53+
"capiprovider.dll",
54+
"catsrvut.dll",
55+
"cdosys.dll",
56+
"certcli.dll",
57+
"certenc.dll",
58+
"CertEnroll.dll",
59+
"certmgr.dll",
60+
"cic.dll",
61+
"clbcatq.dll",
62+
"cngprovider.dll",
63+
"comrepl.dll",
64+
"comsnap.dll",
65+
"comsvcs.dll",
66+
"connect.dll",
67+
"correngine.dll",
68+
"cryptext.dll",
69+
"DefaultPrinterProvider.dll",
70+
"DevicePairing.dll",
71+
"DevicePairingProxy.dll",
72+
"DfsShlEx.dll",
73+
"DiagCpl.dll",
74+
"dmocx.dll",
75+
"DMRServer.dll",
76+
"dnshc.dll",
77+
"dot3dlg.dll",
78+
"dot3hc.dll",
79+
"dpapiprovider.dll",
80+
"dskquota.dll",
81+
"dtsh.dll",
82+
"dxtmsft.dll",
83+
"dxtrans.dll",
84+
"EditionUpgradeHelper.dll",
85+
"EditionUpgradeManagerObj.dll",
86+
"EhStorAPI.dll",
87+
"EhStorShell.dll",
88+
"es.dll",
89+
"eventcls.dll",
90+
"expsrv.dll",
91+
"findnetprinters.dll",
92+
"FirewallAPI.dll",
93+
"FirewallControlPanel.dll",
94+
"fphc.dll",
95+
"FXSCOM.dll",
96+
"FXSCOMEX.dll",
97+
"gpprefcl.dll",
98+
"Groupinghc.dll",
99+
"HelpPaneProxy.dll",
100+
"hnetcfg.dll",
101+
"iasads.dll",
102+
"iasdatastore.dll",
103+
"iashlpr.dll",
104+
"iasnap.dll",
105+
"iasrad.dll",
106+
"iassam.dll",
107+
"iassdo.dll",
108+
"iassvcs.dll",
109+
"icsvc.dll",
110+
"ieframe.dll",
111+
"iepeers.dll",
112+
"igdDiag.dll",
113+
"imapi2.dll",
114+
"imapi2fs.dll",
115+
"inetcomm.dll",
116+
"InkEd.dll",
117+
"InkObjCore.dll",
118+
"ipnathlp.dll",
119+
"JavaScriptCollectionAgent.dll",
120+
"jscript.dll",
121+
"L2SecHC.dll",
122+
"LocationApi.dll",
123+
"MbaeApi.dll",
124+
"mmcndmgr.dll",
125+
"msaatext.dll",
126+
"msdatsrc.tlb",
127+
"msdtcuiu.dll",
128+
"msdxm.tlb",
129+
"msfeeds.dll",
130+
"msftedit.dll",
131+
"mshtml.tlb",
132+
"mshtmled.dll",
133+
"msi.dll",
134+
"msjtes40.dll",
135+
"MsraLegacy.tlb",
136+
"MsRdpWebAccess.dll",
137+
"mssitlb.dll",
138+
"mssrch.dll",
139+
"mstscax.dll",
140+
"msvbvm60.dll",
141+
"MSVidCtl.dll",
142+
"mswmdm.dll",
143+
"msxml3.dll",
144+
"msxml4.dll",
145+
"msxml6.dll",
146+
"mycomput.dll",
147+
"NaturalLanguage6.dll",
148+
"ndfapi.dll",
149+
"ndishc.dll",
150+
"netcenter.dll",
151+
"netcorehc.dll",
152+
"netprofm.dll",
153+
"NetworkCollectionAgent.dll",
154+
"nlahc.dll",
155+
"odbcconf.dll",
156+
"officecsp.dll",
157+
"oleacc.dll",
158+
"oleprn.dll",
159+
"pla.dll",
160+
"PNPXAssoc.dll",
161+
"PNPXAssocPrx.dll",
162+
"Pnrphc.dll",
163+
"PortableDeviceApi.dll",
164+
"PortableDeviceClassExtension.dll",
165+
"PortableDeviceConnectApi.dll",
166+
"PortableDeviceTypes.dll",
167+
"PrintConfig.dll",
168+
"printui.dll",
169+
"prnntfy.dll",
170+
"provcore.dll",
171+
"psisdecd.dll",
172+
"pstorec.dll",
173+
"puiapi.dll",
174+
"puiobj.dll",
175+
"qedit.dll",
176+
"quartz.dll",
177+
"rasdiag.dll",
178+
"rasgcw.dll",
179+
"rdpcorets.dll",
180+
"rdpencom.dll",
181+
"RdpRelayTransport.dll",
182+
"rdpsharercom.dll",
183+
"rdpviewerax.dll",
184+
"RegCtrl.dll",
185+
"rendezvousSession.tlb",
186+
"riched20.dll",
187+
"RoamingSecurity.dll",
188+
"RotMgr.dll",
189+
"scripto.dll",
190+
"scrobj.dll",
191+
"scrrun.dll",
192+
"sdiageng.dll",
193+
"sdohlp.dll",
194+
"Sens.dll",
195+
"shdocvw.dll",
196+
"shell32.dll",
197+
"shgina.dll",
198+
"signdrv.dll",
199+
"simpdata.tlb",
200+
"SMBHelperClass.dll",
201+
"SmiEngine.dll",
202+
"sppcomapi.dll",
203+
"sppwmi.dll",
204+
"SRH.dll",
205+
"srm.dll",
206+
"stclient.dll",
207+
"stdole2.tlb",
208+
"stdole32.tlb",
209+
"swprv.dll",
210+
"SysFxUI.dll",
211+
"TabbtnEx.dll",
212+
"tapi3.dll",
213+
"taskschd.dll",
214+
"termmgr.dll",
215+
"TransportDSA.dll",
216+
"TSWorkspace.dll",
217+
"tvratings.dll",
218+
"ucmhc.dll",
219+
"UIAnimation.dll",
220+
"UIAutomationCore.dll",
221+
"uicom.dll",
222+
"upnp.dll",
223+
"usbmon.dll",
224+
"VAN.dll",
225+
"vbscript.dll",
226+
"WaaSMedicPS.dll",
227+
"wavemsp.dll",
228+
"WfHC.dll",
229+
"wiaaut.dll",
230+
"wiascanprofiles.dll",
231+
"win32spl.dll",
232+
"wincredprovider.dll",
233+
"windowslivelogin.dll",
234+
"winethc.dll",
235+
"winhttpcom.dll",
236+
"WinMsoIrmProtector.dll",
237+
"WinOpcIrmProtector.dll",
238+
"WinSATAPI.dll",
239+
"wisp.dll",
240+
"wkspbrokerAx.dll",
241+
"WLanConn.dll",
242+
"wlandlg.dll",
243+
"WLanHC.dll",
244+
"wlanpref.dll",
245+
"wlanui.dll",
246+
"wlidcli.dll",
247+
"wlidprov.dll",
248+
"wmdmlog.dll",
249+
"WMNetMgr.dll",
250+
"wmp.dll",
251+
"wmpdxm.dll",
252+
"wmpshell.dll",
253+
"WorkFoldersShell.dll",
254+
"workfolderssvc.dll",
255+
"WPDSp.dll",
256+
"wscapi.dll",
257+
"wshcon.dll",
258+
"wshext.dll",
259+
"WsmAuto.dll",
260+
"wuapi.dll",
261+
"wvc.dll",
262+
"WWanAPI.dll",
263+
"WWanHC.dll",
264+
"xwizards.dll",
265+
"xwreg.dll",
266+
"xwtpdui.dll",
267+
"xwtpw32.dll"
268+
};
41269
includedFilenames.addAll(Arrays.asList(filenames));
42270
processDir(new File("C:\\Windows\\System32"));
43271
processDir(new File("C:\\Windows\\SysWOW64"));
44272
System.out.println("Finished.");
45273
}
46274

47275
protected static void processDir(File dir) {
48-
for (File file : dir.listFiles()) {
276+
if (dir == null || !dir.exists()) {
277+
return;
278+
}
279+
File[] files = dir.listFiles();
280+
if (files == null) {
281+
// Could not list files (not a directory or I/O error)
282+
return;
283+
}
284+
for (File file : files) {
49285
if (includedFilenames.contains(file.getName())) {
50286
processFile(file);
51287
}

0 commit comments

Comments
 (0)