You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2016/07/03 22:54:23 UTC

svn commit: r1751176 - /commons/proper/bcel/trunk/src/test/java/org/apache/bcel/generic/JDKGenericDumpTestCase.java

Author: ggregory
Date: Sun Jul  3 22:54:23 2016
New Revision: 1751176

URL: http://svn.apache.org/viewvc?rev=1751176&view=rev
Log:
Fix test that breaks in a RC reviewer's Windows 10 set up. 

Modified:
    commons/proper/bcel/trunk/src/test/java/org/apache/bcel/generic/JDKGenericDumpTestCase.java

Modified: commons/proper/bcel/trunk/src/test/java/org/apache/bcel/generic/JDKGenericDumpTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/test/java/org/apache/bcel/generic/JDKGenericDumpTestCase.java?rev=1751176&r1=1751175&r2=1751176&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/test/java/org/apache/bcel/generic/JDKGenericDumpTestCase.java (original)
+++ commons/proper/bcel/trunk/src/test/java/org/apache/bcel/generic/JDKGenericDumpTestCase.java Sun Jul  3 22:54:23 2016
@@ -45,8 +45,9 @@ import org.junit.runners.Parameterized.P
 import com.sun.jna.platform.win32.Advapi32Util;
 
 /**
- * Test that the generic dump() methods work on the JDK classes Reads each class into an instruction list and then dumps
- * the instructions. The output bytes should be the same as the input.
+ * Test that the generic dump() methods work on the JDK classes Reads each class
+ * into an instruction list and then dumps the instructions. The output bytes
+ * should be the same as the input.
  */
 @RunWith(Parameterized.class)
 public class JDKGenericDumpTestCase {
@@ -81,11 +82,13 @@ public class JDKGenericDumpTestCase {
     private static Set<String> findJavaHomesOnWindows(final String[] keys) {
         final Set<String> javaHomes = new HashSet<>(keys.length);
         for (final String key : keys) {
-            final String javaHome = Advapi32Util.registryGetStringValue(HKEY_LOCAL_MACHINE, KEY_JRE + "\\" + key,
-                    "JavaHome");
-            if (StringUtils.isNoneBlank(javaHome)) {
-                if (new File(javaHome).exists()) {
-                    javaHomes.add(javaHome);
+            if (Advapi32Util.registryKeyExists(HKEY_LOCAL_MACHINE, KEY_JRE + "\\" + key)) {
+                final String javaHome = Advapi32Util.registryGetStringValue(HKEY_LOCAL_MACHINE, KEY_JRE + "\\" + key,
+                        "JavaHome");
+                if (StringUtils.isNoneBlank(javaHome)) {
+                    if (new File(javaHome).exists()) {
+                        javaHomes.add(javaHome);
+                    }
                 }
             }
         }