Example usage for org.apache.commons.lang StringUtils EMPTY

List of usage examples for org.apache.commons.lang StringUtils EMPTY

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils EMPTY.

Prototype

String EMPTY

To view the source code for org.apache.commons.lang StringUtils EMPTY.

Click Source Link

Document

The empty String "".

Usage

From source file:com.mmj.app.web.tools.SystemInfos.java

private static String getDBIP(String dburl) {
    if (dburl == null || dburl.length() == 0) {
        return StringUtils.EMPTY;
    }//  w w  w  . j a  v  a 2 s  .c o  m
    int index = dburl.indexOf('@');
    if (index < 0) {
        return StringUtils.EMPTY;
    }
    String t = dburl.substring(index + 1);
    if (t == null || t.length() == 0) {
        return StringUtils.EMPTY;
    }
    index = t.indexOf(':');
    return t.substring(0, index);
}

From source file:com.photon.phresco.commons.CIPasswordScrambler.java

public static String unmask(String secret) throws PhrescoException {
    if (StringUtils.isEmpty(secret)) {
        return StringUtils.EMPTY;
    }/*from   w w  w  .j a va2 s.  com*/

    try {
        return new String(Base64.decode(secret.toCharArray()), "UTF-8");
    } catch (IOException e) {
        throw new PhrescoException(e);
    }
}

From source file:me.smoe.adar.utils.cam.o.common.SentenceAnalyzer.java

public static Set<String> analyzer(String sentence) throws Exception {
    if (StringUtils.isEmpty(sentence)) {
        return Collections.emptySet();
    }// w  w w.  j av a  2s.c o m

    Analyzer analyzer = new StandardAnalyzer();
    try {
        TokenStream tokenStream = analyzer.tokenStream(StringUtils.EMPTY, new StringReader(sentence));
        tokenStream.addAttribute(CharTermAttribute.class);
        tokenStream.reset();

        Set<String> words = new LinkedHashSet<>();
        while (tokenStream.incrementToken()) {
            String word = ((CharTermAttribute) tokenStream.getAttribute(CharTermAttribute.class)).toString();

            if (word.length() <= 1) {
                continue;
            }

            words.add(word);
        }

        return words;
    } finally {
        analyzer.close();
    }
}

From source file:com.nec.harvest.util.StringUtil.java

/**
 * Check a string is empty or null//from  www  . jav  a 2  s. c om
 * 
 * @param text
 * @return
 */
public static String value(String text) {
    return StringUtils.isEmpty(text) ? StringUtils.EMPTY : text;
}

From source file:com.laex.cg2d.model.model.ResourceFile.java

/**
 * Empty resource file./*from www  . j a  va  2s .c o  m*/
 * 
 * @return the resource file
 */
public static ResourceFile emptyResourceFile() {
    return ResourceFile.create(StringUtils.EMPTY, StringUtils.EMPTY);
}

From source file:com.mmj.app.common.authority.AuthorityHelper.java

/**
 * ???/*from  w  w w.j a v  a2  s  .c om*/
 * 
 * @param akey
 * @param session
 * @return
 */
public static boolean hasAuthority(int akey, String rc) {
    if (rc == null || StringUtils.EMPTY.equals(rc)) {
        return false;
    }
    if (rc.length() <= akey) {
        return false;
    }
    char value = rc.charAt(akey);
    if (value == '1') {
        return true;
    }
    return false;
}

From source file:com.amalto.core.save.SaveException.java

public SaveException(Throwable cause) {
    this(StringUtils.EMPTY, cause);
}

From source file:net.rim.ejde.internal.util.RIAUtils.java

/**
 * Gets valid jde home based on the given <code>path</code>. The given <code>path</code> should not contain <b>"bin"</b>.
 *
 * @param path/* w  w  w.  j  a  va 2s .  c o  m*/
 *            of jde home
 * @return if the give <code>path</code> is a valid jde home, returns the full path of the jde home; otherwise, returns empty
 *         string.
 */
static public String getValidJDEHome(String path) {
    String root = path;
    if (StringUtils.isEmpty(root)) {
        return StringUtils.EMPTY;
    }
    // if "/bin" is already appended, we do not append it again
    if (!path.endsWith(IConstants.BIN_FOLD_NAME))
        root = String.format("%s%s%s", root, File.separator, IConstants.BIN_FOLD_NAME); //$NON-NLS-1$
    if (RIA.validateHomePath(root))
        return root;
    return StringUtils.EMPTY;
}

From source file:com.amalto.core.save.PartialUpdateSaverContext.java

public static DocumentSaverContext decorate(DocumentSaverContext context, String pivot, String key, int index,
        boolean overwrite, boolean delete) {
    if (pivot == null) {
        pivot = StringUtils.EMPTY;
    }//from   ww  w.  j  a va  2s.  c o m
    if (key == null) {
        key = StringUtils.EMPTY;
    }
    if (delete) {
        return new PartialUpdateSaverContext(context, pivot, key, index, overwrite, UserAction.PARTIAL_DELETE);
    } else if (pivot.length() > 1) {
        return new PartialUpdateSaverContext(context, pivot, key, index, overwrite, UserAction.PARTIAL_UPDATE);
    } else {
        return new PartialUpdateSaverContext(context, pivot, key, index, overwrite, UserAction.UPDATE);
    }
}

From source file:com.linkedin.camus.etl.kafka.coders.StringMessageDecoder.java

@Override
public CamusWrapper<String> decode(byte[] payload) {
    String event = StringUtils.EMPTY;
    try {//from  w ww . j a va2  s .c  om
        event = new String(payload, "UTF-8");
    } catch (UnsupportedEncodingException ex) {
        throw new MessageDecoderException("Unable to deserialize event: " + event, ex);
    }
    CamusWrapper<String> wrapper = new CamusWrapper<String>(event);
    return wrapper;
}