// Path: sdk/src/com/kakao/exception/KakaoException.java
// public class KakaoException extends RuntimeException {
//     private static final long serialVersionUID = 3738785191273730776L;
//     private ERROR_TYPE errorType;
// 
//     public enum ERROR_TYPE{
//         ILLEGAL_ARGUMENT,
//         MISS_CONFIGURATION,
//         CANCELED_OPERATiON,
//         AUTHORIZATION_FAILED,
//     }
// 
//     public KakaoException(final ERROR_TYPE errorType, final String msg) {
//         super(msg);
//         this.errorType = errorType;
//     }
// 
//     public boolean isCancledOperation() {
//         return errorType == ERROR_TYPE.CANCELED_OPERATiON;
//     }
// 
//     public KakaoException(final String msg) {
//         super(msg);
//     }
// 
//     public KakaoException(final Throwable t) {
//         super(t);
//     }
// 
//     public KakaoException(final String s, final Throwable t) {
//         super(s, t);
//     }
// 
//     public String getMessage(){
//         if(errorType != null)
//             return errorType.toString() +" : " + super.getMessage();
//         else
//             return super.getMessage();
//     }
// }


import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.Signature;
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.Log;
import com.kakao.exception.KakaoException;
    public static Uri buildUri(final String authority, final String path) {
        Uri.Builder builder = new Uri.Builder();
        builder.scheme(ServerProtocol.URL_SCHEME);
        builder.authority(authority);
        builder.path(path);
        return builder.build();
    }

    public static Uri buildUri(final String authority, final String path, final Bundle parameters) {
        Uri.Builder builder = new Uri.Builder();
        builder.scheme(ServerProtocol.URL_SCHEME);
        builder.authority(authority);
        builder.path(path);
        for (String key : parameters.keySet()) {
            Object parameter = parameters.get(key);
            if (parameter instanceof String) {
                builder.appendQueryParameter(key, (String) parameter);
            }
        }
        return builder.build();
    }

    public static void putObjectInBundle(final Bundle bundle, final String key, final Object value) {
        if (value instanceof String) {
            bundle.putString(key, (String) value);
        } else if (value instanceof Parcelable) {
            bundle.putParcelable(key, (Parcelable) value);
        } else if (value instanceof byte[]) {
            bundle.putByteArray(key, (byte[]) value);
        } else {
// Path: sdk/src/com/kakao/exception/KakaoException.java
// public class KakaoException extends RuntimeException {
//     private static final long serialVersionUID = 3738785191273730776L;
//     private ERROR_TYPE errorType;
// 
//     public enum ERROR_TYPE{
//         ILLEGAL_ARGUMENT,
//         MISS_CONFIGURATION,
//         CANCELED_OPERATiON,
//         AUTHORIZATION_FAILED,
//     }
// 
//     public KakaoException(final ERROR_TYPE errorType, final String msg) {
//         super(msg);
//         this.errorType = errorType;
//     }
// 
//     public boolean isCancledOperation() {
//         return errorType == ERROR_TYPE.CANCELED_OPERATiON;
//     }
// 
//     public KakaoException(final String msg) {
//         super(msg);
//     }
// 
//     public KakaoException(final Throwable t) {
//         super(t);
//     }
// 
//     public KakaoException(final String s, final Throwable t) {
//         super(s, t);
//     }
// 
//     public String getMessage(){
//         if(errorType != null)
//             return errorType.toString() +" : " + super.getMessage();
//         else
//             return super.getMessage();
//     }
// }


// Path: sdk/src/com/kakao/helper/Utility.java
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.Signature;
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.Log;
import com.kakao.exception.KakaoException;

    public static Uri buildUri(final String authority, final String path) {
        Uri.Builder builder = new Uri.Builder();
        builder.scheme(ServerProtocol.URL_SCHEME);
        builder.authority(authority);
        builder.path(path);
        return builder.build();
    }

    public static Uri buildUri(final String authority, final String path, final Bundle parameters) {
        Uri.Builder builder = new Uri.Builder();
        builder.scheme(ServerProtocol.URL_SCHEME);
        builder.authority(authority);
        builder.path(path);
        for (String key : parameters.keySet()) {
            Object parameter = parameters.get(key);
            if (parameter instanceof String) {
                builder.appendQueryParameter(key, (String) parameter);
            }
        }
        return builder.build();
    }

    public static void putObjectInBundle(final Bundle bundle, final String key, final Object value) {
        if (value instanceof String) {
            bundle.putString(key, (String) value);
        } else if (value instanceof Parcelable) {
            bundle.putParcelable(key, (Parcelable) value);
        } else if (value instanceof byte[]) {
            bundle.putByteArray(key, (byte[]) value);
        } else {
            throw new KakaoException("attempted to add unsupported type to Bundle");