changeset 3194:bd6e1d99d942

8033686: Internal error for zero indent Reviewed-by: ksrini
author jjg
date Thu, 06 Feb 2014 10:58:51 -0800
parents 997092ef35e3
children 95f9e1175e13
files src/share/classes/com/sun/tools/javap/JavapTask.java src/share/classes/com/sun/tools/javap/Options.java
diffstat 2 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javap/JavapTask.java	Thu Feb 06 18:49:01 2014 +0000
+++ b/src/share/classes/com/sun/tools/javap/JavapTask.java	Thu Feb 06 10:58:51 2014 -0800
@@ -273,7 +273,9 @@
             void process(JavapTask task, String opt, String arg) throws BadArgs {
                 int sep = opt.indexOf(":");
                 try {
-                    task.options.indentWidth = Integer.valueOf(opt.substring(sep + 1));
+                    int i = Integer.valueOf(opt.substring(sep + 1));
+                    if (i > 0) // silently ignore invalid values
+                        task.options.indentWidth = i;
                 } catch (NumberFormatException e) {
                 }
             }
@@ -289,7 +291,9 @@
             void process(JavapTask task, String opt, String arg) throws BadArgs {
                 int sep = opt.indexOf(":");
                 try {
-                    task.options.tabColumn = Integer.valueOf(opt.substring(sep + 1));
+                    int i = Integer.valueOf(opt.substring(sep + 1));
+                    if (i > 0) // silently ignore invalid values
+                        task.options.tabColumn = i;
                 } catch (NumberFormatException e) {
                 }
             }
--- a/src/share/classes/com/sun/tools/javap/Options.java	Thu Feb 06 18:49:01 2014 +0000
+++ b/src/share/classes/com/sun/tools/javap/Options.java	Thu Feb 06 10:58:51 2014 -0800
@@ -86,6 +86,6 @@
     public boolean showConstants;
     public boolean sysInfo;
     public boolean showInnerClasses;
-    public int indentWidth = 2;   // #spaces per indentWidth level
-    public int tabColumn = 40;    // column number for comments
+    public int indentWidth = 2;   // #spaces per indentWidth level; must be > 0
+    public int tabColumn = 40;    // column number for comments; must be > 0
 }