Example usage for java.io UnsupportedEncodingException getMessage

List of usage examples for java.io UnsupportedEncodingException getMessage

Introduction

In this page you can find the example usage for java.io UnsupportedEncodingException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:at.bitfire.davdroid.webdav.HttpReport.java

HttpReport(URI uri, String entity) {
    setURI(uri);//from   w  ww . jav  a2 s .c om

    setHeader("Content-Type", "text/xml; charset=UTF-8");
    setHeader("Depth", "0");

    try {
        setEntity(new StringEntity(entity, "UTF-8"));

        Log.d(TAG, "Prepared REPORT request for " + uri + ": " + entity);
    } catch (UnsupportedEncodingException e) {
        Log.e(TAG, e.getMessage());
    }
}

From source file:biblivre3.marcutils.MarcUtils.java

public static String recordToIso2709(Record record) {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    MarcWriter writer = new MarcStreamWriter(baos, "UTF-8");
    writer.write(record);/*ww  w  .  j av  a2 s . co  m*/
    writer.close();
    try {
        return new String(baos.toByteArray(), "UTF-8");
    } catch (UnsupportedEncodingException uee) {
        log.error(uee.getMessage(), uee);
        return baos.toString();
    }
}

From source file:com.dubsar_dictionary.Dubsar.model.Autocompleter.java

/**import java.net.URLEncoder;
        /*from  w  ww.j a  v  a 2 s.c  o  m*/
 * Request suggestions for the specified term.
 * @param term the term, as typed by the user so far
 */
public Autocompleter(String term) {
    mTerm = new String(term);

    // DEBT: Take from strings file
    try {
        mPath = new String("/os?term=") + URLEncoder.encode(mTerm, "UTF-8");
    } catch (UnsupportedEncodingException e) {
        setErrorMessage(e.getMessage());
    }
}

From source file:org.paxml.core.InMemoryResource.java

/**
 * Construct from a file.// w w  w . ja  v a  2 s .  c  om
 * 
 * @param file
 *            the file
 */
public InMemoryResource(String content) {

    super("");

    try {
        this.array = content.getBytes("UTF-8");
    } catch (UnsupportedEncodingException e) {
        throw new PaxmlParseException(e.getMessage());
    }
}

From source file:org.openmidaas.library.common.network.AndroidNetworkTransport.java

@Override
public void doPostRequest(boolean withSSL, String url, HashMap<String, String> headers, JSONObject data,
        AsyncHttpResponseHandler responseHandler) {
    try {//ww w  . j ava 2  s.  c om
        AsyncHttpClient client = new AsyncHttpClient();
        if (headers != null) {
            if (headers.size() > 0) {
                MIDaaS.logDebug(TAG, "Headers: ");
                MIDaaS.logDebug(TAG, "Key: Value");
                for (String key : headers.keySet()) {
                    client.addHeader(key, headers.get(key));
                    MIDaaS.logDebug(TAG, "" + key + " : " + headers.get(key));
                }
            }
        }
        MIDaaS.logDebug(TAG, "Data: " + data.toString());
        client.post(null, mHostUrl + url, new StringEntity(data.toString()), "application/json",
                responseHandler);
    } catch (UnsupportedEncodingException e) {
        MIDaaS.logError(TAG, e.getMessage());
        responseHandler.onFailure(e, e.getMessage());
    }
}

From source file:org.musicbrainz.picard.barcodescanner.util.PicardClient.java

@SuppressWarnings("deprecation")
private String uriEncode(String releaseId) {
    try {//from   w w  w .  jav  a2  s  .co m
        return URLEncoder.encode(releaseId, "UTF-8");
    } catch (UnsupportedEncodingException e) {
        Log.e(this.getClass().getName(), e.getMessage(), e);
        return URLEncoder.encode(releaseId);
    }
}

From source file:be.fedict.eid.applet.service.impl.tlv.SpecialOrganisationConvertor.java

public SpecialOrganisation convert(byte[] value) throws DataConvertorException {
    if (null == value) {
        return SpecialOrganisation.UNSPECIFIED;
    }/*from  w  w w . j  a  v a 2s  . co  m*/
    String key;
    try {
        key = new String(value, "UTF-8");
    } catch (UnsupportedEncodingException e) {
        throw new DataConvertorException("string error: " + e.getMessage());
    }
    LOG.debug("key: \"" + key + "\"");
    SpecialOrganisation specialOrganisation = SpecialOrganisation.toSpecialOrganisation(key);
    return specialOrganisation;
}

From source file:com.vcredit.lrh.backend.message.listener.receiver.APPLogMessageReceiver.java

public void receiveMessage(byte[] message) {
    try {//from   ww w  .j  a  va  2s .co m
        RabbitMessage messageObject = extractMessage(message);
        switch (messageObject.getType()) {
        case MessageType.VBS_ACCESS_LOG:
            //                    VBSAccessLog accessLog = messageObject.getContent(VBSAccessLog.class);
            //                    logsClient.saveVBSAccessLog(accessLog);
            break;
        case MessageType.APP_CLIENT_LOG:
            //                    AppClientLog clientLog = messageObject.getContent(AppClientLog.class);
            //                    logsClient.saveAppClientLog(clientLog);
            break;
        case MessageType.THIRD_PARTY_ACCESS_LOG:
            //                    ThirdpartyAccessLog thirdpartyAccessLog = messageObject.getContent(ThirdpartyAccessLog.class);
            //                    logsClient.saveThirdpartyLog(thirdpartyAccessLog);
            break;
        case MessageType.APP_LOGIN_LOG:
            //                    APPLoginLog loginLog = messageObject.getContent(APPLoginLog.class);
            //                    logsClient.recordUserOperation(loginLog);
            break;
        case MessageType.CREDIT_QUERY_LOG:
            //                    CreditQueryLog queryLog = messageObject.getContent(CreditQueryLog.class);
            //                    logsClient.saveCreditQueryLog(queryLog);
            break;
        default:
            getLogger().error("unknown message type '" + messageObject.getType() + "'");
        }

    } catch (UnsupportedEncodingException ex) {
        getLogger().error(ex.getMessage(), ex);
    } catch (IOException ex) {
        getLogger().error(ex.getMessage(), ex);
    } catch (Exception e) {
        getLogger().error(e.getMessage(), e);
    }
}

From source file:hh.learnj.test.license.test.alps.base64.ApacheBaseCoder.java

@Override
public String encode(byte[] src) {
    try {/*from   w w  w.j  a v a  2  s.com*/
        return new String(Base64.encodeBase64(src), CODE);
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
        throw new UnsupportedOperationException(e.getMessage());
    }
}

From source file:hh.learnj.test.license.test.alps.base64.ApacheBaseCoder.java

@Override
public byte[] decode(String src) {
    try {//from w  w  w  . j av a 2s .c o  m
        return Base64.decodeBase64(src.getBytes(CODE));
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
        throw new UnsupportedOperationException(e.getMessage());
    }
}