Example usage for org.springframework.util Assert doesNotContain

List of usage examples for org.springframework.util Assert doesNotContain

Introduction

In this page you can find the example usage for org.springframework.util Assert doesNotContain.

Prototype

public static void doesNotContain(@Nullable String textToSearch, String substring,
        Supplier<String> messageSupplier) 

Source Link

Document

Assert that the given text does not contain the given substring.

Usage

From source file:org.springframework.aop.interceptor.CustomizableTraceInterceptor.java

/**
 * Set the template used for method entry log messages.
 * This template can contain any of the following placeholders:
 * <ul>//  ww w .  ja v a2 s  . com
 * <li>{@code $[targetClassName]}</li>
 * <li>{@code $[targetClassShortName]}</li>
 * <li>{@code $[argumentTypes]}</li>
 * <li>{@code $[arguments]}</li>
 * </ul>
 */
public void setEnterMessage(String enterMessage) throws IllegalArgumentException {
    Assert.hasText(enterMessage, "enterMessage must not be empty");
    checkForInvalidPlaceholders(enterMessage);
    Assert.doesNotContain(enterMessage, PLACEHOLDER_RETURN_VALUE,
            "enterMessage cannot contain placeholder " + PLACEHOLDER_RETURN_VALUE);
    Assert.doesNotContain(enterMessage, PLACEHOLDER_EXCEPTION,
            "enterMessage cannot contain placeholder " + PLACEHOLDER_EXCEPTION);
    Assert.doesNotContain(enterMessage, PLACEHOLDER_INVOCATION_TIME,
            "enterMessage cannot contain placeholder " + PLACEHOLDER_INVOCATION_TIME);
    this.enterMessage = enterMessage;
}

From source file:org.springframework.aop.interceptor.CustomizableTraceInterceptor.java

/**
 * Set the template used for method exit log messages.
 * This template can contain any of the following placeholders:
 * <ul>//from   w w  w  . j av a  2s .c  o m
 * <li>{@code $[targetClassName]}</li>
 * <li>{@code $[targetClassShortName]}</li>
 * <li>{@code $[argumentTypes]}</li>
 * <li>{@code $[arguments]}</li>
 * <li>{@code $[returnValue]}</li>
 * <li>{@code $[invocationTime]}</li>
 * </ul>
 */
public void setExitMessage(String exitMessage) {
    Assert.hasText(exitMessage, "exitMessage must not be empty");
    checkForInvalidPlaceholders(exitMessage);
    Assert.doesNotContain(exitMessage, PLACEHOLDER_EXCEPTION,
            "exitMessage cannot contain placeholder" + PLACEHOLDER_EXCEPTION);
    this.exitMessage = exitMessage;
}

From source file:org.springframework.aop.interceptor.CustomizableTraceInterceptor.java

/**
 * Set the template used for method exception log messages.
 * This template can contain any of the following placeholders:
 * <ul>//from  w w w.ja  v  a 2 s  .c  om
 * <li>{@code $[targetClassName]}</li>
 * <li>{@code $[targetClassShortName]}</li>
 * <li>{@code $[argumentTypes]}</li>
 * <li>{@code $[arguments]}</li>
 * <li>{@code $[exception]}</li>
 * </ul>
 */
public void setExceptionMessage(String exceptionMessage) {
    Assert.hasText(exceptionMessage, "exceptionMessage must not be empty");
    checkForInvalidPlaceholders(exceptionMessage);
    Assert.doesNotContain(exceptionMessage, PLACEHOLDER_RETURN_VALUE,
            "exceptionMessage cannot contain placeholder " + PLACEHOLDER_RETURN_VALUE);
    this.exceptionMessage = exceptionMessage;
}

From source file:org.springframework.osgi.web.extender.internal.activator.WarLoaderListener.java

/**
 * Checks if the given bundle is a war - if it is, deploy it.
 * /*  w  ww.  ja v a 2 s.c o  m*/
 * @param bundle
 */
private void maybeDeployWar(Bundle bundle) {
    synchronized (lock) {
        // first check if the bundle has been stopped or not
        if (destroyed)
            return;

        // exclude special bundles (such as the framework or this bundle)
        if (OsgiBundleUtils.isSystemBundle(bundle) || bundle.getBundleId() == bundleId)
            return;
    }

    WarScanner localWarScanner;
    ContextPathStrategy localCPS;

    synchronized (lock) {
        localWarScanner = warScanner;
        localCPS = contextPathStrategy;
    }

    // check if the bundle is a war
    if (localWarScanner.isWar(bundle)) {
        // get bundle name
        String contextPath = localCPS.getContextPath(bundle);
        // make sure it doesn't contain spaces (causes subtle problems with Tomcat Jasper)
        Assert.doesNotContain(contextPath, " ", "context path should not contain whitespaces");
        String msg = OsgiStringUtils.nullSafeNameAndSymName(bundle)
                + " is a WAR, scheduling war deployment on context path [" + contextPath + "] (";

        URL webXML = getWebXml(bundle);

        if (webXML != null) {
            msg = msg + "web.xml found at [" + webXML + "])";
        } else
            msg = msg + "no web.xml detected)";

        log.info(msg);

        // mark the bundle as managed
        managedBundles.put(bundle, contextPath);
        deploymentManager.deployBundle(bundle, contextPath);
    }
}