summaryrefslogtreecommitdiff
path: root/src/fjbg/ch/epfl/lamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/fjbg/ch/epfl/lamp')
-rw-r--r--src/fjbg/ch/epfl/lamp/fjbg/JConstantPool.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JConstantPool.java b/src/fjbg/ch/epfl/lamp/fjbg/JConstantPool.java
index 4fa048177c..0e6b43f1e2 100644
--- a/src/fjbg/ch/epfl/lamp/fjbg/JConstantPool.java
+++ b/src/fjbg/ch/epfl/lamp/fjbg/JConstantPool.java
@@ -383,6 +383,9 @@ public class JConstantPool {
public int getSize() { return 1; }
public void writeContentsTo(DataOutputStream stream) throws IOException {
if (bytes != null) {
+ if (bytes.length > 65535) {
+ throw new IOException("String literal of length " + bytes.length + " does not fit in Classfile");
+ }
stream.writeShort(bytes.length);
stream.write(bytes);
}