changeset 2338:8766826a4282

8033686: Internal error for zero indent Reviewed-by: ksrini
author kizune
date Wed, 19 Feb 2014 15:07:47 +0400
parents a174f015171d
children b06e33ab7f61
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	Tue Feb 18 19:27:19 2014 +0400
+++ b/src/share/classes/com/sun/tools/javap/JavapTask.java	Wed Feb 19 15:07:47 2014 +0400
@@ -309,7 +309,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) {
                 }
             }
@@ -325,7 +327,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	Tue Feb 18 19:27:19 2014 +0400
+++ b/src/share/classes/com/sun/tools/javap/Options.java	Wed Feb 19 15:07:47 2014 +0400
@@ -86,8 +86,8 @@
     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
 
     public boolean compat;             // bug-for-bug compatibility mode with old javap
 }