changeset 16:559c6d8df174

Fixed output when jdis with the -g option is started: ToHex(0) method returned 0x instead of 0x0 Product version increased to 7, contributed by: leonid.kuskov@oracle.com
author afedorch
date Tue, 07 Nov 2017 15:26:12 -0800
parents 0a3b4ceeaaed
children e3e13e71f94d
files build/productinfo.properties src/org/openjdk/asmtools/asmutils/HexUtils.java src/org/openjdk/asmtools/jdis/StackMapData.java
diffstat 3 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/build/productinfo.properties	Fri Nov 03 14:44:43 2017 -0700
+++ b/build/productinfo.properties	Tue Nov 07 15:26:12 2017 -0800
@@ -25,7 +25,7 @@
 # Product info
 PRODUCT_NAME        = asmtools
 PRODUCT_JAR_NAME    = asmtools.jar
-PRODUCT_VERSION     = 6.0
-PRODUCT_MILESTONE   = fcs
+PRODUCT_VERSION     = 7.0
+PRODUCT_MILESTONE   = beta
 PRODUCT_BUILDNUMBER = b01
 PRODUCT_NAME_LONG   = Java Assembler Tools
--- a/src/org/openjdk/asmtools/asmutils/HexUtils.java	Fri Nov 03 14:44:43 2017 -0700
+++ b/src/org/openjdk/asmtools/asmutils/HexUtils.java	Tue Nov 07 15:26:12 2017 -0800
@@ -37,11 +37,12 @@
     private static final char hexTable[] = hexString.toCharArray();
 
     public static String toHex(long val, int width) {
-        StringBuffer s = new StringBuffer();
+        StringBuffer sb = new StringBuffer();
         for (int i = width - 1; i >= 0; i--) {
-            s.append(hexTable[((int) (val >> (4 * i))) & 0xF]);
+            sb.append(hexTable[((int) (val >> (4 * i))) & 0xF]);
         }
-        return "0x" + s.toString();
+        String s = sb.toString();
+        return "0x" + (s.isEmpty() ? "0" : s);
     }
 
     public static String toHex(long val) {
--- a/src/org/openjdk/asmtools/jdis/StackMapData.java	Fri Nov 03 14:44:43 2017 -0700
+++ b/src/org/openjdk/asmtools/jdis/StackMapData.java	Tue Nov 07 15:26:12 2017 -0800
@@ -25,6 +25,7 @@
 import org.openjdk.asmtools.asmutils.HexUtils;
 import static org.openjdk.asmtools.jasm.Tables.*;
 import java.io.DataInputStream;
+import java.io.EOFException;
 import java.io.IOException;
 
 /**
@@ -143,7 +144,13 @@
     private int[] readMapElements(CodeData code, DataInputStream in, int num) throws IOException {
         int[] map = new int[num];
         for (int k = 0; k < num; k++) {
-            int mt_val = in.readUnsignedByte();
+            int mt_val = 0;
+            try {
+                mt_val = in.readUnsignedByte();
+            } catch (EOFException eofe) {
+                TraceUtils.traceln("");
+                throw eofe;
+            }
             StackMapType maptype = stackMapType(mt_val, null);
             switch (maptype) {
                 case ITEM_Object: