From cd417519120f47f6026cfb725bc0a29bc8f145bd Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Fri, 28 Aug 2009 16:17:23 -0600 Subject: [PATCH] ensure primitive names are zero-terminated in Class.getName --- classpath/java/lang/Class.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/classpath/java/lang/Class.java b/classpath/java/lang/Class.java index b2464486eb..cb3692ab64 100644 --- a/classpath/java/lang/Class.java +++ b/classpath/java/lang/Class.java @@ -67,23 +67,23 @@ public final class Class implements Type, GenericDeclaration { if (name == null) { if ((vmFlags & PrimitiveFlag) != 0) { if (this == primitiveClass('V')) { - name = "void".getBytes(); + name = "void\0".getBytes(); } else if (this == primitiveClass('Z')) { - name = "boolean".getBytes(); + name = "boolean\0".getBytes(); } else if (this == primitiveClass('B')) { - name = "byte".getBytes(); + name = "byte\0".getBytes(); } else if (this == primitiveClass('C')) { - name = "char".getBytes(); + name = "char\0".getBytes(); } else if (this == primitiveClass('S')) { - name = "short".getBytes(); + name = "short\0".getBytes(); } else if (this == primitiveClass('I')) { - name = "int".getBytes(); + name = "int\0".getBytes(); } else if (this == primitiveClass('F')) { - name = "float".getBytes(); + name = "float\0".getBytes(); } else if (this == primitiveClass('J')) { - name = "long".getBytes(); + name = "long\0".getBytes(); } else if (this == primitiveClass('D')) { - name = "double".getBytes(); + name = "double\0".getBytes(); } else { throw new AssertionError(); }