// Path: src/copyleaks/sdk/api/helpers/HttpURLConnection/HttpURLConnectionHelper.java
// public final class HttpURLConnectionHelper
// {
// 	public static String getQuery(Map<String, String> dic) throws UnsupportedEncodingException
// 	{
// 		StringBuilder result = new StringBuilder();
// 		boolean first = true;
// 
// 		for (Map.Entry<String,String> entry : dic.entrySet())
// 		{
// 			if (first)
// 				first = false;
// 			else
// 				result.append("&");
// 
// 			result.append(URLEncoder.encode(entry.getKey(), Settings.Encoding));
// 			result.append("=");
// 			result.append(URLEncoder.encode(entry.getValue(), Settings.Encoding));
// 		}
// 
// 		return result.toString();
// 	}
// 
// 	public static String convertStreamToString(java.io.InputStream is)
// 	{
// 		@SuppressWarnings("resource")
// 		java.util.Scanner s = new Scanner(is).useDelimiter("\\A");
// 		return s.hasNext() ? s.next() : "";
// 
// 	}
// }
// 
// Path: src/copyleaks/sdk/api/models/responses/BadResponse.java
// public class BadResponse {
// 
// 	public String Message;
// 
// 	public String getMessage() {
// 		return Message;
// 	}
// 	
// 	@Override
// 	public String toString()
// 	{
// 		return this.getMessage();
// 	}
// }


import com.google.gson.GsonBuilder;
import com.google.gson.JsonSyntaxException;
import copyleaks.sdk.api.helpers.HttpURLConnection.HttpURLConnectionHelper;
import copyleaks.sdk.api.models.responses.BadResponse;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import com.google.gson.Gson;

		return CopyleaksErrorCode;
	}

	private void setCopyleaksErrorCode(short errorCode)
	{
		CopyleaksErrorCode = errorCode;
	}

	public CommandFailedException(HttpURLConnection conn)
	{
		super(GetMessage(conn));

		try
		{
			this.setHttpErrorCode(conn.getResponseCode());
		}
		catch (IOException e)
		{
			this.setHttpErrorCode(UNDEFINED_HTTP_ERROR_CODE);
		}

		this.setCopyleaksErrorCode(GetCopyleaksErrorCode(conn));
	}

	private static String GetMessage(HttpURLConnection conn)
	{
		Gson gson = new GsonBuilder().create();
		String errorResponse;
		try (InputStream inputStream = new BufferedInputStream(conn.getErrorStream()))
		{

// Path: src/copyleaks/sdk/api/helpers/HttpURLConnection/HttpURLConnectionHelper.java
// public final class HttpURLConnectionHelper
// {
// 	public static String getQuery(Map<String, String> dic) throws UnsupportedEncodingException
// 	{
// 		StringBuilder result = new StringBuilder();
// 		boolean first = true;
// 
// 		for (Map.Entry<String,String> entry : dic.entrySet())
// 		{
// 			if (first)
// 				first = false;
// 			else
// 				result.append("&");
// 
// 			result.append(URLEncoder.encode(entry.getKey(), Settings.Encoding));
// 			result.append("=");
// 			result.append(URLEncoder.encode(entry.getValue(), Settings.Encoding));
// 		}
// 
// 		return result.toString();
// 	}
// 
// 	public static String convertStreamToString(java.io.InputStream is)
// 	{
// 		@SuppressWarnings("resource")
// 		java.util.Scanner s = new Scanner(is).useDelimiter("\\A");
// 		return s.hasNext() ? s.next() : "";
// 
// 	}
// }
// 
// Path: src/copyleaks/sdk/api/models/responses/BadResponse.java
// public class BadResponse {
// 
// 	public String Message;
// 
// 	public String getMessage() {
// 		return Message;
// 	}
// 	
// 	@Override
// 	public String toString()
// 	{
// 		return this.getMessage();
// 	}
// }


// Path: src/copyleaks/sdk/api/exceptions/CommandFailedException.java
import com.google.gson.GsonBuilder;
import com.google.gson.JsonSyntaxException;
import copyleaks.sdk.api.helpers.HttpURLConnection.HttpURLConnectionHelper;
import copyleaks.sdk.api.models.responses.BadResponse;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import com.google.gson.Gson;

		return CopyleaksErrorCode;
	}

	private void setCopyleaksErrorCode(short errorCode)
	{
		CopyleaksErrorCode = errorCode;
	}

	public CommandFailedException(HttpURLConnection conn)
	{
		super(GetMessage(conn));

		try
		{
			this.setHttpErrorCode(conn.getResponseCode());
		}
		catch (IOException e)
		{
			this.setHttpErrorCode(UNDEFINED_HTTP_ERROR_CODE);
		}

		this.setCopyleaksErrorCode(GetCopyleaksErrorCode(conn));
	}

	private static String GetMessage(HttpURLConnection conn)
	{
		Gson gson = new GsonBuilder().create();
		String errorResponse;
		try (InputStream inputStream = new BufferedInputStream(conn.getErrorStream()))
		{

			errorResponse = HttpURLConnectionHelper.convertStreamToString(inputStream);
