Example usage for org.apache.commons.lang3 StringUtils deleteWhitespace

List of usage examples for org.apache.commons.lang3 StringUtils deleteWhitespace

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils deleteWhitespace.

Prototype

public static String deleteWhitespace(final String str) 

Source Link

Document

Deletes all whitespaces from a String as defined by Character#isWhitespace(char) .

 StringUtils.deleteWhitespace(null)         = null StringUtils.deleteWhitespace("")           = "" StringUtils.deleteWhitespace("abc")        = "abc" StringUtils.deleteWhitespace("   ab  c  ") = "abc" 

Usage

From source file:org.apache.struts2.EmbeddedJSPResultTest.java

public void testTag0() throws Exception {
    result.setLocation("org/apache/struts2/tag0.jsp");
    result.execute(null);//from   w ww.  jav a  2 s . c  o m

    assertEquals("Thissessionisnotsecure.OtherText",
            StringUtils.deleteWhitespace(response.getContentAsString()));
}

From source file:org.apache.struts2.EmbeddedJSPResultTest.java

public void testIncludeSimple() throws Exception {
    result.setLocation("org/apache/struts2/includes0.jsp");
    result.execute(null);// ww w.  j a va 2 s .  com

    assertEquals("helloTest", StringUtils.deleteWhitespace(response.getContentAsString()));
}

From source file:org.apache.struts2.EmbeddedJSPResultTest.java

public void testIncludeSimpleWithDirective() throws Exception {
    result.setLocation("org/apache/struts2/includes3.jsp");
    result.execute(null);//from ww  w  .jav a  2s. co m

    assertEquals("helloTest", StringUtils.deleteWhitespace(response.getContentAsString()));
}

From source file:org.apache.struts2.EmbeddedJSPResultTest.java

public void testIncludeWithSubdir() throws Exception {
    result.setLocation("org/apache/struts2/includes1.jsp");
    result.execute(null);/*  w w w. j  av  a2  s .  c  om*/

    assertEquals("subTest", StringUtils.deleteWhitespace(response.getContentAsString()));
}

From source file:org.apache.struts2.EmbeddedJSPResultTest.java

public void testIncludeWithParam() throws Exception {
    result.setLocation("org/apache/struts2/includes2.jsp");
    result.execute(null);/*from  ww  w.ja v a 2  s  .c  o  m*/

    assertEquals("JGTest", StringUtils.deleteWhitespace(response.getContentAsString()));
}

From source file:org.apache.struts2.EmbeddedJSPResultTest.java

public void testJSTL() throws Exception {
    result.setLocation("org/apache/struts2/jstl.jsp");
    result.execute(null);//from  ww w  . ja  v  a2 s.com

    assertEquals("XXXXXXXXXXXY", StringUtils.deleteWhitespace(response.getContentAsString()));
}

From source file:org.apache.struts2.EmbeddedJSPResultTest.java

public void testBeans() throws Exception {
    result.setLocation("org/apache/struts2/beans.jsp");
    result.execute(null);/*from   www  .  j  av a 2 s .  c o  m*/

    assertEquals("WhoamI?", StringUtils.deleteWhitespace(response.getContentAsString()));
}

From source file:org.kuali.coeus.common.framework.custom.AuditCustomDataEvent.java

public void reportError(CustomAttribute customAttribute, String propertyName, String errorKey,
        String... errorParams) {//from  w  w w .  ja  v  a2 s  .  com
    String key = "CustomData" + StringUtils.deleteWhitespace(customAttribute.getGroupName()) + "Errors";
    AuditCluster auditCluster = (AuditCluster) GlobalVariables.getAuditErrorMap().get(key);
    if (auditCluster == null) {
        List<AuditError> auditErrors = new ArrayList<AuditError>();
        auditCluster = new AuditCluster(customAttribute.getGroupName(), auditErrors, Constants.AUDIT_ERRORS);
        GlobalVariables.getAuditErrorMap().put(key, auditCluster);
    }
    List<AuditError> auditErrors = auditCluster.getAuditErrorList();
    auditErrors
            .add(new AuditError(propertyName, errorKey,
                    StringUtils.deleteWhitespace(
                            Constants.CUSTOM_ATTRIBUTES_PAGE + "." + customAttribute.getGroupName()),
                    errorParams));

}

From source file:org.kuali.coeus.common.impl.print.PrintingServiceImpl.java

protected String getReportName() {
    String dateString = getDateTimeService().getCurrentDate().toString();
    return StringUtils.deleteWhitespace(dateString);
}

From source file:org.kuali.coeus.common.impl.print.PrintingServiceImpl.java

protected void logPrintDetails(Map<String, byte[]> xmlStreamMap) throws PrintingException {
    byte[] xmlBytes = null;
    String xmlString = null;//from   w  ww . j  a  v  a2s .  co  m
    String loggingDirectory = kualiConfigurationService
            .getPropertyValueAsString(Constants.PRINT_LOGGING_DIRECTORY);
    Iterator<String> it = xmlStreamMap.keySet().iterator();
    if (loggingDirectory != null) {
        BufferedWriter out = null;
        try {
            while (it.hasNext()) {
                String key = (String) it.next();
                xmlBytes = xmlStreamMap.get(key);
                xmlString = new String(xmlBytes);
                String dateString = getDateTimeService().getCurrentTimestamp().toString();
                String reportName = StringUtils.deleteWhitespace(key);
                String createdTime = StringUtils.replaceChars(StringUtils.deleteWhitespace(dateString), ":",
                        "_");
                File dir = new File(loggingDirectory);
                if (!dir.exists() || !dir.isDirectory()) {
                    dir.mkdirs();
                }
                File file = new File(dir, reportName + createdTime + ".xml");

                out = new BufferedWriter(new FileWriter(file));
                out.write(xmlString);
            }
        } catch (IOException e) {
            LOG.error(e.getMessage(), e);
        } finally {
            try {
                if (out != null) {
                    out.flush();
                    out.close();
                }
            } catch (IOException e) {
                LOG.error(e.getMessage(), e);
            }
        }
    }
}