diff src/org/tmatesoft/hg/internal/EncodingHelper.java @ 682:f568330dd9c0

Compile with Java5, ensure generics are fine for other compilers, too
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Mon, 22 Jul 2013 22:47:06 +0200
parents fba85bc1dfb8
children
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/EncodingHelper.java	Sun Jul 21 17:48:05 2013 +0200
+++ b/src/org/tmatesoft/hg/internal/EncodingHelper.java	Mon Jul 22 22:47:06 2013 +0200
@@ -180,7 +180,11 @@
 			return utfDecoder.decode(ByteBuffer.wrap(data, start, length)).toString();
 		} catch (CharacterCodingException ex) {
 			// TODO post-1.2 respect ui.fallbackencoding actual setting
-			return new String(data, start, length, Charset.forName("ISO-8859-1"));
+			try {
+				return new String(data, start, length, "ISO-8859-1"); // XXX java5
+			} catch (UnsupportedEncodingException e) {
+				throw new HgInvalidStateException(ex.getMessage());
+			}
 		}
 	}