8049223: RewriteException class exposes public mutable arrays
Reviewed-by: hannesw, sundar
--- 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)).