From 6214776d2ff4c10de27add89d5de0be8999da146 Mon Sep 17 00:00:00 2001 From: Rafael Guterres Date: Thu, 5 Nov 2015 22:39:00 -0200 Subject: Change class Base64 to support current java --- src/org/traccar/helper/Authorization.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/org/traccar/helper/Authorization.java b/src/org/traccar/helper/Authorization.java index 992254d04..0dc27fe5d 100644 --- a/src/org/traccar/helper/Authorization.java +++ b/src/org/traccar/helper/Authorization.java @@ -15,10 +15,13 @@ */ package org.traccar.helper; -import java.util.Base64; import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; +import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.buffer.ChannelBuffers; +import org.jboss.netty.handler.codec.base64.Base64; +import org.jboss.netty.util.CharsetUtil; public final class Authorization { @@ -36,7 +39,8 @@ public final class Authorization { public static Map parse(String authorization) { Map authMap = new HashMap<>(); final String encodedUsernameAndPassword = authorization.replaceFirst(REGEX, REPLACEMENT); - String usernameAndPassword = new String(Base64.getDecoder().decode(encodedUsernameAndPassword)); + ChannelBuffer buffer = ChannelBuffers.copiedBuffer(encodedUsernameAndPassword,CharsetUtil.UTF_8); + String usernameAndPassword = Base64.decode(buffer).toString(CharsetUtil.UTF_8); final StringTokenizer tokenizer = new StringTokenizer(usernameAndPassword, TOKENIZER); authMap.put(USERNAME, tokenizer.nextToken()); authMap.put(PASSWORD, tokenizer.nextToken()); -- cgit v1.2.3