Example usage for org.apache.commons.codec EncoderException printStackTrace

List of usage examples for org.apache.commons.codec EncoderException printStackTrace

Introduction

In this page you can find the example usage for org.apache.commons.codec EncoderException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:es.jamisoft.comun.utils.cipher.CifradoPBE3DES.java

License:asdf

public static void main(String args[]) {
    try {//from  w ww .  j  av  a2  s . co m
        CifradoPBE crypt = new CifradoPBE("dgsadfasdfasdfasdfasdfasdf".toCharArray());
        String encrypted = crypt.cifra("hola");

        System.out.println("Encrypted: " + encrypted);
        System.out.println("Decrypted: " + crypt.descifra(encrypted));
    } catch (EncoderException ex) {
        ex.printStackTrace();
    }
}

From source file:com.palo_it.com.myapplication.speech.text.match.SoundsLikeWordMatcher.java

private static String encode(String in) {
    String encoded = in;/*w  w w .j  av  a2  s  .  c  om*/
    try {
        encoded = encoder.encode(in);
    } catch (EncoderException e) {
        //for weird characters that encoder doesn't understand
        e.printStackTrace();
    }
    return encoded;
}

From source file:com.bugclipse.fogbugz.api.client.FogBugzClient.java

private static String encode(String str) {
    try {/*from  w ww.j a  v a2 s . co m*/
        return new URLCodec().encode(str);
    } catch (EncoderException e) {
        e.printStackTrace();
        return str;
    }
}

From source file:com.centurylink.mdw.common.translator.impl.EncodedStringTranslator.java

/**
 * Converts the passed in object to a string
 * @param pObject//  w  ww.  j a v  a 2s  .  co  m
 * @return String
 */
public String toString(Object pObject) {
    String encoded = null;
    try {
        encoded = encoder.encode((String) pObject);
    } catch (EncoderException ex) {
        ex.printStackTrace();
        throw new TranslationException(ex.getMessage());
    }
    return encoded;
}

From source file:eu.seaclouds.platform.planner.core.HttpHelper.java

private String prepareRequestURL(String restPath, List<NameValuePair> params) {
    StringBuilder operationBuilder = new StringBuilder();
    operationBuilder.append(serviceURL);
    operationBuilder.append(restPath);/*from w  ww  .  j  a va  2  s . c o  m*/

    if (params.size() > 0) {
        operationBuilder.append("?");
        URLCodec coded = new URLCodec();
        try {
            for (NameValuePair p : params)
                operationBuilder.append(p.getName() + "=" + coded.encode(p.getValue()));

        } catch (EncoderException e) {
            e.printStackTrace();
            return null;
        }
    }
    return operationBuilder.toString();
}

From source file:jp.igapyon.selecrawler.SeleCrawlerWebContentGetter.java

public File getFileHtml(final String deviceName, final String urlLookup) throws IOException {
    final URL url = new URL(urlLookup);
    final String serverhostname = url.getHost();
    String path = url.getPath();//from w ww .  j a v  a2s .  c  om
    if (path.length() == 0 || path.equals("/") || path.endsWith("/")) {
        path = path + "/index.html";
    }

    if (url.getQuery() != null) {
        try {
            path += new URLCodec().encode("?" + url.getQuery());
        } catch (EncoderException e) {
            e.printStackTrace();
        }

    }

    return new File(settings.getPathTargetDir() + deviceName + "/" + serverhostname + path);
}

From source file:de.lazyzero.kkMulticopterFlashTool.utils.XmlWriterFirmwares.java

public XmlWriterFirmwares(String uri, Vector<Firmware> firmwares) {

    this.uri = uri + "test";
    this.firmwares = firmwares;

    try {//from   w  ww  .j  a va  2 s.co m
        xmlData = createXML();
    } catch (EncoderException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:edu.lternet.pasta.portal.HarvestReport.java

private String getQualityReportLink(String packageId, String localPath) {
    String link = "";
    URLCodec urlCodec = new URLCodec();

    try {//from   w w  w  .  j  a  v a2 s .co  m
        if (packageId != null && packageId.length() > 0) {
            link = "<a class=\"searchsubcat\" href=\"./reportviewer?packageid=" + packageId;

            if (localPath != null) {
                String encodedPath = urlCodec.encode(localPath);
                link += "&localPath=" + encodedPath;
            }

            link += "\" target=\"_blank\">view</a>";
        }
    } catch (EncoderException e) {
        e.printStackTrace();
        logger.error(e.getMessage());
    }

    return link;
}

From source file:org.mitre.opensextant.phonetic.Phoneticizer.java

/**
 * Invoke an encoder and return the results.
 * @param word The word to encode./*from  www.j a  va2 s .co  m*/
 * @param method A key for selecting the desired encoder.
 * @return The output from the encoder.
 */
public String phoneticForm(String word, String method) {

    String tmpMeth = method;
    // if unknown method requested, force to default rather then failing
    if (!(this.supportedAlgorithms().contains(tmpMeth))) {
        tmpMeth = "Simple_Phonetic0";
        // need to log something here to identify parameter change
    }

    String tmpResult = "";

    try {
        tmpResult = algorithms.get(tmpMeth).encode(word);
    } catch (EncoderException e) {
        e.printStackTrace();
    }

    return tmpResult;
}

From source file:org.talend.dataquality.record.linkage.attribute.SoundexMatcher.java

public double getWeight(String str1, String str2) {
    try {/*from  w w  w .j a  v a 2s.  com*/
        int diff = soundex.difference(str1, str2);
        return diff / MAX;
    } catch (EncoderException e) {
        e.printStackTrace();
        return 0;
    }
}