Examples of ProcessException


Examples of net.sourceforge.jwbf.core.actions.util.ProcessException

        if (oldtitle == null || oldtitle.length() == 0 || newtitle == null || newtitle.length() == 0) {
            throw new IllegalArgumentException("The arguments 'oldtitle' and 'newtitle' must not be null or empty");
        }

        if (!bot.getUserinfo().getRights().contains("move")) {
            throw new ProcessException(
                    "The given user doesn't have the rights to move. "
                    + "Add '$wgGroupPermissions['bot']['move'] = true;' "
                    + "to your MediaWiki's LocalSettings.php might solve this problem.");
        }

        if (withsubpages && !bot.getUserinfo().getRights().contains("move-subpages")) {
            throw new ProcessException(
                    "The given user doesn't have the rights to move subpages. "
                    + "Add '$wgGroupPermissions['bot']['move-subpages'] = true;' "
                    + "to your MediaWiki's LocalSettings.php might solve this problem.");
        }
    }
View Full Code Here

Examples of net.sourceforge.jwbf.core.actions.util.ProcessException

  throws ProcessException {
    if (s.contains("error")) {
      if (s.length() > 700) {
        s = s.substring(0, 700);
      }
      throw new ProcessException(s);
    }
    if (initOldGet != null && hm.getRequest().equals(initOldGet.getRequest())) {
      getWpValues(s, tab);
      if (log.isDebugEnabled()) {
        log.debug(tab);
View Full Code Here

Examples of net.sourceforge.jwbf.core.actions.util.ProcessException

      root = doc.getRootElement();
      findContent(root);
    } catch (JDOMException e) {
      log.error(e.getClass().getName() + e.getLocalizedMessage());
      log.error(xml);
      throw new ProcessException(e.getLocalizedMessage());
    } catch (IOException e) {
      log.error(e.getClass().getName() + e.getLocalizedMessage());
      throw new ProcessException(e.getLocalizedMessage());
    }
  }
View Full Code Here

Examples of net.sourceforge.jwbf.core.actions.util.ProcessException

    }
    try {
      new URL(urlOfImage);
    } catch (MalformedURLException e) {
      if (bot.getHostUrl().length() <= 0) {
        throw new ProcessException("please use the constructor with hostUrl; "
            + urlOfImage);
      }
      urlOfImage = bot.getHostUrl() + urlOfImage;
    }
    return urlOfImage;
View Full Code Here

Examples of net.sourceforge.jwbf.core.actions.util.ProcessException

      LOGGER.warn("", e);
    }
    if (root != null)
      findContent(root);
    if (urlOfImage.length() < 1)
      throw new ProcessException("Could not find this image");
  }
View Full Code Here

Examples of org.apache.slide.projector.ProcessException

    public Result process(Map parameter, Context context) throws Exception {
        String fragment = ((StringValue)parameter.get(FRAGMENT)).toString();
        Template template = getRequiredFragment(fragment);
        parameter.remove(FRAGMENT);
        if ( template == null ) throw new ProcessException(new ErrorMessage("templateArrayRenderer/fragmentNotFound", new String[] { fragment }));
        StringBuffer buffer = new StringBuffer(template.getLength());
        for ( int i = 0; i < getMaxIndex(parameter); i++ ) {
            template.evaluate(buffer, parameter, i);
        }
        return new Result(OK, OUTPUT, new StringValue(buffer.toString(), template.getContentType(), false));
View Full Code Here

Examples of org.apache.slide.projector.ProcessException

    public Result process(Map parameter, Context context) throws Exception {
        String statemenet = parameter.get(STATEMENT).toString();
        Value []values = ((ArrayValue)parameter.get(VALUES)).getArray();
        javax.naming.Context ctx = new InitialContext();

        if ( ctx == null ) throw new ProcessException(new ErrorMessage("noInitialContextAvailable"));

        DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/TestDB");
        Result result = new Result(StateDescriptor.OK);
        if (ds != null) {
            ResultSet resultSet = null;
            PreparedStatement preparedStatement = null;
            Connection conn = null;
            try {
                conn = ds.getConnection();
                if(conn != null)  {
                    preparedStatement = conn.prepareStatement(statemenet);
                    for ( int i = 0; i < values.length; i++ ) {
                        // FIXME: We need a mapping for every sql type that should be supported
                        if ( values[i] instanceof StringValue ) {
                            preparedStatement.setString(i+1, values[i].toString());
                        } else if ( values[i] instanceof NumberValue ) {
                            preparedStatement.setInt(i+1, ((NumberValue)values[i]).getNumber().intValue());
                        } else if ( values[i] instanceof StreamableValue ) {
                            preparedStatement.setBinaryStream(i+1, ((StreamableValue)values[i]).getInputStream(), ((StreamableValue)values[i]).getContentLength());
                        }
                    }
                    if ( preparedStatement.execute() ) {
                        resultSet = preparedStatement.getResultSet();
                        List resultSetResources = new ArrayList();
                        ResultSetMetaData metaData = resultSet.getMetaData();
                        while ( resultSet.next() ) {
                            Map rowMap = new HashMap();
                            int columnCount = metaData.getColumnCount();
                            for ( int i = 0; i < columnCount; i++ ) {
                                String key = metaData.getColumnLabel(i+1);
                                Object object = resultSet.getObject(i+1);
                                if ( object instanceof String ) {
                                    rowMap.put(key, new StringValue((String)object));
                                } else if ( object instanceof Integer ) {
                                    rowMap.put(key, new NumberValue((Integer)object));
                                }
                            }
                            resultSetResources.add(new MapValue(rowMap));
                        }
                        Value[] resultEntries = new Value[resultSetResources.size()];
                        result.addResultEntry(RESULT, new ArrayValue((Value[] )resultSetResources.toArray(resultEntries)));
                    } else {
                        result.addResultEntry(ROW_COUNT, new NumberValue(new BigDecimal(preparedStatement.getUpdateCount())));
                    }
                    conn.close();
                }
            } catch (SQLException e) {
                throw new ProcessException(new ErrorMessage("sqlException"), e);
            } finally {
                // Always make sure result sets and statements are closed,
                // and the connection is returned to the pool
                if (resultSet != null) {
                    try { resultSet.close(); } catch (SQLException e) { ; }
View Full Code Here

Examples of org.apache.slide.projector.ProcessException

        template.evaluate(buffer, parameter);
    }

    protected Template getRequiredFragment(String fragment) throws ProcessException {
        Template template = (Template)templates.get(fragment);
        if ( template == null ) throw new ProcessException(new ErrorMessage("templateArrayRenderer/fragmentNotFound", new String[] { fragment }));
        return template;
    }
View Full Code Here

Examples of org.apache.slide.projector.ProcessException

    public Result process(Map parameter, Context context) throws Exception {
        String name = ((StringValue)parameter.get(STORE)).toString();
        String key = ((StringValue)parameter.get(KEY)).toString();
        Store store = context.getStore(StoreHelper.getStoreByName(name));
        if ( store == null ) {
            throw new ProcessException(new ErrorMessage("storeNotAvailable", new String[] {name}));
        }
        store.dispose(key);
        return new Result( StateDescriptor.OK );
    }
View Full Code Here

Examples of org.apache.slide.projector.ProcessException

                } else {
                    variableValue = array[index];
                }
            }
            if ( (required && variableValue instanceof NullValue )) {
                throw new ProcessException(new ErrorMessage("templateRenderer/unsetValueNotAllowed", new Object[] { name }));
            }
            if ( allowedContentTypes != null && !ContentType.matches(allowedContentTypes, ((Value)variableValue).getContentType())) {
                throw new ProcessException(new ErrorMessage("templateRenderer/contentTypeMismatch", new Object[] { name, ContentType.getContentTypesAsString(allowedContentTypes), ((Value)variableValue).getContentType() }));
            }
            if ( variableValue instanceof PrintableValue ) {
                ((PrintableValue)variableValue).print(buffer);
            } else {
                buffer.append(variableValue);
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.