diff options
author | Geoffrey Washburn <geoffrey.washburn@epfl.ch> | 2008-08-12 11:04:01 +0000 |
---|---|---|
committer | Geoffrey Washburn <geoffrey.washburn@epfl.ch> | 2008-08-12 11:04:01 +0000 |
commit | d789698f45023a19b4ae4d5802d64690268b74bb (patch) | |
tree | 8b341fdd1758c7d9b5dbca1dd601e4ea833ff5c0 /src | |
parent | 13fddf993cb528a32a29e28986630462f5a5fcd5 (diff) | |
download | scala-d789698f45023a19b4ae4d5802d64690268b74bb.tar.gz scala-d789698f45023a19b4ae4d5802d64690268b74bb.tar.bz2 scala-d789698f45023a19b4ae4d5802d64690268b74bb.zip |
Correction to Sean's decoding fix.
Added a simple test for the unicode decoding stuff.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/util/NameTransformer.scala | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/util/NameTransformer.scala b/src/compiler/scala/tools/nsc/util/NameTransformer.scala index 855b2d563d..f57334e362 100644 --- a/src/compiler/scala/tools/nsc/util/NameTransformer.scala +++ b/src/compiler/scala/tools/nsc/util/NameTransformer.scala @@ -109,11 +109,12 @@ object NameTransformer { } /* Handle the decoding of Unicode glyphs that are * not valid Java/JVM identifiers */ - } else if (ch1 == 'u' && - (Character.isDigit(ch2)) || - ('A' <= ch2 && ch2 <= 'F')) { + } else if ((len - i) >= 6 && // Check that there are enough characters left + ch1 == 'u' && + (Character.isDigit(ch2)) || + ('A' <= ch2 && ch2 <= 'F')) { /* Skip past "$u", next four should be hexadecimal */ - val hex = name.substring(i+2, if (i+6 <= len) i+6 else len) + val hex = name.substring(i+2, i+6) try { val str = Integer.parseInt(hex, 16).toChar if (buf eq null) { |