8049223: RewriteException class exposes public mutable arrays
authorattila
Thu, 03 Jul 2014 11:18:26 +0200
changeset 25254 a56c2713f1a8
parent 25253 61601aa79b10
child 25255 cf56cdc2c663
8049223: RewriteException class exposes public mutable arrays Reviewed-by: hannesw, sundar
nashorn/src/jdk/nashorn/internal/runtime/RewriteException.java
--- a/nashorn/src/jdk/nashorn/internal/runtime/RewriteException.java	Thu Jul 03 11:18:10 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/RewriteException.java	Thu Jul 03 11:18:26 2014 +0200
@@ -331,7 +331,7 @@
      * @return bytecode slot contents.
      */
     public Object[] getByteCodeSlots() {
-        return byteCodeSlots;
+        return byteCodeSlots == null ? null : byteCodeSlots.clone();
     }
 
     /**
@@ -339,7 +339,7 @@
      * function (a rest-of triggering a rest-of triggering a...)
      */
     public int[] getPreviousContinuationEntryPoints() {
-        return previousContinuationEntryPoints;
+        return previousContinuationEntryPoints == null ? null : previousContinuationEntryPoints.clone();
     }
 
     /**
@@ -388,7 +388,7 @@
 
         //slot contents
         if (!isShort) {
-            final Object[] slots = getByteCodeSlots();
+            final Object[] slots = byteCodeSlots;
             if (slots != null) {
                 sb.append("slots=").
                     append(Arrays.asList(slots)).