FileDocCategorySizeDatePackage
URLPatternContainsCRLF.javaAPI DocGlassfish v2 API4621Fri May 04 22:34:10 BST 2007com.sun.enterprise.tools.verifier.tests.web

URLPatternContainsCRLF

public class URLPatternContainsCRLF extends URLPattern
url-pattern element must not contain New Line (NL) or Carriage Return (CR) In the schema j2ee_1_4.xsd it states that The url-patternType contains the url pattern of the mapping. It must follow the rules specified in Section 11.2 of the Servlet API Specification. This pattern is assumed to be in URL-decoded form and must not contain CR(#xD) or LF(#xA). If it contains those characters, the container must inform the developer with a descriptive error message.

Fields Summary
Constructors Summary
Methods Summary
protected voidcheckUrlPatternAndSetResult(java.lang.String urlPattern, Descriptor descriptor, Result result, ComponentNameConstructor compName)

        if (urlPattern == null) return; //some other test takes care of this.
        // In Ascii table, Line Feed (LF) decimal value is 10 and Carriage Return (CR) decimal value is 13
        final int LF = 10, CR = 13;
        if (urlPattern.indexOf(CR)!=-1 || urlPattern.indexOf(LF)!=-1) { 
            oneFailed=true;
            result.failed(smh.getLocalString
                                   ("tests.componentNameConstructor",
                                    "For [ {0} ]",
                                    new Object[] {compName.toString()}));
            result.addErrorDetails (smh.getLocalString
                                         (getClass().getName() + ".failed",
                                          "url-pattern [ {0} ] within [ {1} ] contains a carriage return or line feed char",
                                          new Object[] {urlPattern, descriptor.getName()}));
        } else {
            result.passed(smh.getLocalString
                                  ("tests.componentNameConstructor",
                                   "For [ {0} ]",
                                   new Object[] {compName.toString()}));
            result.addGoodDetails (smh.getLocalString
                                    (getClass().getName() + ".passed",
                                     "url-pattern [ {0} ] within [ {1} ] does not contain carriage return or line feed char",
                                     new Object[] {urlPattern, descriptor.getName()}));
        }