changeset 14818:cb9d90339d43

Fix for 8136699, jlink: Exception thrown on unknown class optimization strategy
author jfdenise
date Wed, 23 Dec 2015 09:13:07 +0100
parents fcafe96a3cda
children b8d6539ab73b
files src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OptimizationPlugin.java
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OptimizationPlugin.java	Wed Dec 23 09:13:06 2015 +0100
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OptimizationPlugin.java	Wed Dec 23 09:13:07 2015 +0100
@@ -51,6 +51,7 @@
 import jdk.tools.jlink.internal.plugins.asm.AsmModulePool;
 import jdk.tools.jlink.internal.plugins.optim.ForNameFolding;
 import jdk.tools.jlink.internal.plugins.optim.ReflectionOptimizer.TypeResolver;
+import jdk.tools.jlink.plugin.PluginException;
 
 /**
  *
@@ -185,7 +186,7 @@
                     try {
                         w = optimize(pools, p, reader, resolver);
                     } catch (IOException ex) {
-                        throw new RuntimeException("Problem optimizing "
+                        throw new PluginException("Problem optimizing "
                                 + reader.getClassName(), ex);
                     }
                     return w;
@@ -217,7 +218,7 @@
                             optimized = true;
                         }
                     } catch (Throwable ex) {
-                        throw new RuntimeException("Exception optimizing "
+                        throw new PluginException("Exception optimizing "
                                 + reader.getClassName(), ex);
                     }
                 } else {
@@ -234,7 +235,7 @@
                                     optimized = true;
                                 }
                             } catch (Throwable ex) {
-                                throw new RuntimeException("Exception optimizing "
+                                throw new PluginException("Exception optimizing "
                                         + reader.getClassName() + "." + m.name, ex);
                             }
 
@@ -250,7 +251,7 @@
                     CheckClassAdapter ca = new CheckClassAdapter(writer);
                     cn.accept(ca);
                 } catch (Exception ex) {
-                    throw new RuntimeException("Exception optimizing class " + cn.name, ex);
+                    throw new PluginException("Exception optimizing class " + cn.name, ex);
                 }
             }
         }
@@ -274,7 +275,7 @@
             } else if (s.equals(FORNAME_REMOVAL)) {
                 optimizers.add(new ForNameFolding());
             } else {
-                throw new RuntimeException("Unknown optimization");
+                throw new PluginException("Unknown optimization");
             }
         }
         String f = config.get(LOG_OPTION);