Examples of PatternException


Examples of cascading.pattern.PatternException

      {
      return new FileInputStream( getPMMLFile() );
      }
    catch( FileNotFoundException exception )
      {
      throw new PatternException( "could not find pmml file: " + getPMMLFile(), exception );
      }
    }
View Full Code Here

Examples of org.apache.cocoon.sitemap.PatternException

     * @throws PatternException DOCUMENT ME!
     */
    protected REProgram preparePattern(String pattern)
        throws PatternException {
        if (pattern == null) {
            throw new PatternException("null passed as a pattern", null);
        }

        if (pattern.length() == 0) {
            pattern = "^$";

            if (getLogger().isWarnEnabled()) {
                getLogger().warn("The empty pattern string was rewritten to '^$'" +
                    " to match for empty strings.  If you intended" +
                    " to match all strings, please change your" + " pattern to '.*'");
            }
        }

        try {
            RECompiler compiler = new RECompiler();
            REProgram program = compiler.compile(pattern);

            return program;
        } catch (RESyntaxException rse) {
            getLogger().debug("Failed to compile the pattern '" + pattern + "'", rse);
            throw new PatternException(rse.getMessage(), rse);
        }
    }
View Full Code Here

Examples of org.apache.cocoon.sitemap.PatternException

     * @throws PatternException when something went wrong.
     */
    protected REProgram preparePattern(String pattern)
        throws PatternException {
        if (pattern == null) {
            throw new PatternException("null passed as a pattern", null);
        }

        if (pattern.length() == 0) {
            pattern = "^$";

            if (getLogger().isWarnEnabled()) {
                getLogger().warn("The empty pattern string was rewritten to '^$'" +
                    " to match for empty strings.  If you intended" +
                    " to match all strings, please change your" + " pattern to '.*'");
            }
        }

        try {
            RECompiler compiler = new RECompiler();
            REProgram program = compiler.compile(pattern);

            return program;
        } catch (RESyntaxException rse) {
            getLogger().debug("Failed to compile the pattern '" + pattern + "'", rse);
            throw new PatternException(rse.getMessage(), rse);
        }
    }
View Full Code Here

Examples of org.apache.cocoon.sitemap.PatternException

            REProgram program = compiler.compile(pattern);
            return program;
           
        } catch (RESyntaxException rse) {
            getLogger().debug("Failed to compile the pattern '" + pattern + "'", rse);
            throw new PatternException(rse.getMessage(), rse);
        }
    }
View Full Code Here

Examples of org.apache.cocoon.sitemap.PatternException

     * Compile the pattern in a <code>org.apache.regexp.REProgram</code>.
     */
    public Object preparePattern(String pattern) throws PatternException {
        if (pattern == null)
        {
            throw new PatternException("null passed as a pattern", null);
        }

        if (pattern.length() == 0)
        {
            pattern = "^$";
            if (getLogger().isWarnEnabled()) {
                getLogger().warn("The empty pattern string was rewritten to '^$'"
                                 + " to match for empty strings.  If you intended"
                                 + " to match all strings, please change your"
                                 + " pattern to '.*'");
            }
        }

        try {
            RECompiler compiler = new RECompiler();
            REProgram program = compiler.compile(pattern);
            return program;

        } catch (RESyntaxException rse) {
            getLogger().debug("Failed to compile the pattern '" + pattern + "'", rse);
            throw new PatternException(rse.getMessage(), rse);
        }
    }
View Full Code Here

Examples of org.apache.cocoon.sitemap.PatternException

    public Map match(String pattern, Map objectModel, Parameters parameters)
            throws PatternException {

        if (pattern == null) {
            throw new PatternException("No cookie name given.");
        }

        Request request = (Request) objectModel.get(Constants.REQUEST_OBJECT);
        Cookie[] cookies = request.getCookies();
        HashMap result = null;
View Full Code Here

Examples of org.apache.cocoon.sitemap.PatternException

                    pos += "../".length();
                }

                int end = expr.indexOf('}', pos);
                if (end == -1) {
                    throw new PatternException("Unmatched '{' in " + expr);
                }

                stringList.add(expr.substring(pos, end));
                levelList.add(new Integer(level));
View Full Code Here

Examples of org.apache.cocoon.sitemap.PatternException

                if (level == -1) {
                    result.append(this.strings[i]);

                } else {
                    if (level > stackSize) {
                        throw new PatternException("Error while evaluating '" + this.originalExpr +
                            "' : not so many levels");
                    }

                    Object value = ((Map)mapStack.get(stackSize - level)).get(this.strings[i]);
                    if (value != null) {
View Full Code Here

Examples of org.apache.cocoon.sitemap.PatternException

        if (!source.exists()) {
            resolver.release(source);
            if (this.ignoreMissingTables) {
                return Collections.EMPTY_MAP;
            } else {
                throw new PatternException("Mount table does not exist: '" + uri + "'");
            }
        }
       
        // Source exists
        Object[] values = (Object[])this.mountTables.get(uri);
       
        if (values != null) {
            // Check validity
            SourceValidity oldValidity = (SourceValidity)values[1];
           
            int valid = oldValidity != null ? oldValidity.isValid() : SourceValidity.INVALID;
           
            if (valid == SourceValidity.VALID) {
                // Valid without needing the new validity
                return (Map)values[0];
            }
           
            if (valid == SourceValidity.UNKNOWN &&
                oldValidity.isValid(source.getValidity()) == SourceValidity.VALID) {
                // Valid after comparing with the new validity
                return (Map)values[0];
            }
           
            // Invalid: fallback below to read the mount table
        } else {
            values = new Object[2];
        }
       
        // Read the mount table
        Map mounts = new HashMap();
        DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
        Configuration config = builder.build(SourceUtil.getInputSource(source));
        this.resolver.release(source);
       
        Configuration[] children = config.getChildren();
        for (int i = 0; i < children.length; i++) {
            Configuration child = children[i];
            if ("mount".equals(child.getName())) {
                String prefix = children[i].getAttribute("uri-prefix");
                // Append a '/' at the end of a not-empty prefix
                // this avoids flat uri matching which would cause
                // exceptions in the sub sitemap!
                if (!prefix.endsWith("/") && prefix.length() != 0) {
                    prefix = prefix + '/';
                }
                mounts.put(prefix, children[i].getAttribute("src"));
            } else {
                throw new PatternException(
                    "Unexpected element '" + child.getName() + "' (awaiting 'mount'), at " + child.getLocation());
            }
        }
        values[0] = mounts;
        values[1] = source.getValidity();
View Full Code Here

Examples of org.apache.cocoon.sitemap.PatternException

        try {
            mounts = getMountTable(pattern);
        } catch(PatternException pe) {
            throw pe;
        } catch(Exception e) {
            throw new PatternException(e);
        }
       
        // Get the request URI
        Request request = ObjectModelHelper.getRequest(objectModel);
        String uri = request.getSitemapURI();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.