diff src/org/tmatesoft/hg/internal/EncodingHelper.java @ 456:909306e412e2

Refactor LogFacility and SessionContext, better API for both
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Mon, 18 Jun 2012 16:54:00 +0200
parents 528b6780a8bd
children 0be5be8d57e9
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/EncodingHelper.java	Wed Jun 13 21:07:39 2012 +0200
+++ b/src/org/tmatesoft/hg/internal/EncodingHelper.java	Mon Jun 18 16:54:00 2012 +0200
@@ -16,6 +16,8 @@
  */
 package org.tmatesoft.hg.internal;
 
+import static org.tmatesoft.hg.util.LogFacility.Severity.Error;
+
 import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
 import java.nio.charset.CharacterCodingException;
@@ -71,7 +73,7 @@
 			bb.get(rv, 0, rv.length);
 			return rv;
 		} catch (CharacterCodingException ex) {
-			sessionContext.getLog().error(getClass(), ex, String.format("Use of charset %s failed, resort to system default", charset().name()));
+			sessionContext.getLog().dump(getClass(), Error, ex, String.format("Use of charset %s failed, resort to system default", charset().name()));
 			// resort to system-default
 			return s.getBytes();
 		}
@@ -88,7 +90,7 @@
 		try {
 			return decoder.decode(ByteBuffer.wrap(data, start, length)).toString();
 		} catch (CharacterCodingException ex) {
-			sessionContext.getLog().error(getClass(), ex, String.format("Use of charset %s failed, resort to system default", charset().name()));
+			sessionContext.getLog().dump(getClass(), Error, ex, String.format("Use of charset %s failed, resort to system default", charset().name()));
 			// resort to system-default
 			return new String(data, start, length);
 		}