Examples of StripesRuntimeException


Examples of net.sourceforge.stripes.exception.StripesRuntimeException

        }
        else if (this.formatType.equalsIgnoreCase("percentage")) {
            this.format = NumberFormat.getPercentInstance(locale);
        }
        else {
            throw new StripesRuntimeException("Invalid format type supplied for formatting a " +
                "number: " + this.formatType + ". Valid values are 'number', 'currency' " +
                "and 'percentage'.");
        }

        // Do any extra configuration
        if (this.formatPattern.equalsIgnoreCase("plain")) {
            this.format.setGroupingUsed(false);
        }
        else if (this.formatPattern.equalsIgnoreCase("integer")) {
            this.format.setMaximumFractionDigits(0);
        }
        else if (this.formatPattern.equalsIgnoreCase(("decimal"))) {
            this.format.setMinimumFractionDigits(2);
            this.format.setMaximumFractionDigits(6);
        }
        else {
            try {
                ((DecimalFormat) this.format).applyPattern(this.formatPattern);
            }
            catch (Exception e) {
                throw new StripesRuntimeException("Custom pattern could not be applied to " +
                    "NumberFormat instance.  Pattern was: " + this.formatPattern,  e);
            }
        }
    }
View Full Code Here

Examples of net.sourceforge.stripes.exception.StripesRuntimeException

    public static String urlEncode(String value) {
        try {
            return URLEncoder.encode(value, "UTF-8");
        }
        catch (UnsupportedEncodingException e) {
            throw new StripesRuntimeException("Unsupported encoding?  UTF-8?  That's unpossible.");
        }
    }
View Full Code Here

Examples of net.sourceforge.stripes.exception.StripesRuntimeException

    public static String urlDecode(String value) {
        try {
            return URLDecoder.decode(value, "UTF-8");
        }
        catch (UnsupportedEncodingException e) {
            throw new StripesRuntimeException("Unsupported encoding?  UTF-8?  That's unpossible.");
        }
    }
View Full Code Here

Examples of net.sourceforge.stripes.exception.StripesRuntimeException

            TagErrorRenderer renderer = this.rendererClass.newInstance();
            renderer.init(tag);
            return renderer;
        }
        catch (Exception e) {
            throw new StripesRuntimeException("Could not create an instance of the configured " +
                "TagErrorRenderer class '" + this.rendererClass.getName() + "'. Please check " +
                "that the class is public and has a no-arg public constructor.", e);
        }
    }
View Full Code Here

Examples of net.sourceforge.stripes.exception.StripesRuntimeException

            // Then base64 encode the bytes
            return Base64.encodeBytes(output, BASE64_OPTIONS);
        }
        catch (Exception e) {
            throw new StripesRuntimeException("Could not encrypt value.", e);
        }
    }
View Full Code Here

Examples of net.sourceforge.stripes.exception.StripesRuntimeException

            Cipher cipher = Cipher.getInstance(key.getAlgorithm());
            cipher.init(mode, key);
            return cipher;
        }
        catch (Exception e) {
            throw new StripesRuntimeException("Could not generate a Cipher.", e);
        }
    }
View Full Code Here

Examples of net.sourceforge.stripes.exception.StripesRuntimeException

                SecretKeyFactory factory = SecretKeyFactory.getInstance(CryptoUtil.ALGORITHM);
                CryptoUtil.secretKey = factory.generateSecret(new DESedeKeySpec(material));
            }
        }
        catch (Exception e) {
            throw new StripesRuntimeException("Could not generate a secret key.", e);
        }

        return CryptoUtil.secretKey;
    }
View Full Code Here

Examples of net.sourceforge.stripes.exception.StripesRuntimeException

        Configuration configuration = StripesFilter.getConfiguration();
        if (configuration != null) {
            this.baseUrl = configuration.getActionResolver().getUrlBinding(beanType);
        }
        else {
            throw new StripesRuntimeException("Unable to lookup URL binding for ActionBean class "
                    + "because there is no Configuration object available.");
        }
    }
View Full Code Here

Examples of net.sourceforge.stripes.exception.StripesRuntimeException

            propertyDescriptors.put(clazz, map);

            return pds;
        }
        catch (IntrospectionException ie) {
            throw new StripesRuntimeException("Could not examine class '" + clazz.getName()
                    + "' using Introspector.getBeanInfo() to determine property information.", ie);
        }
    }
View Full Code Here

Examples of net.sourceforge.stripes.exception.StripesRuntimeException

                String eventName = getHandledEvent(method);

                // look for duplicate event names within the current class
                if (classMappings.containsKey(eventName)
                        && clazz.equals(classMappings.get(eventName).getDeclaringClass())) {
                    throw new StripesRuntimeException("The ActionBean " + clazz
                            + " declares multiple event handlers for event '" + eventName + "'");
                }

                DefaultHandler defaultMapping = method.getAnnotation(DefaultHandler.class);
                if (eventName != null) {
                    classMappings.put(eventName, method);
                }
                if (defaultMapping != null) {
                    // look for multiple default handlers within the current class
                    if (classMappings.containsKey(DEFAULT_HANDLER_KEY)
                            && clazz.equals(classMappings.get(DEFAULT_HANDLER_KEY).getDeclaringClass())) {
                        throw new StripesRuntimeException("The ActionBean " + clazz
                                + " declares multiple default event handlers");
                    }

                    // Makes sure we catch the default handler
                    classMappings.put(DEFAULT_HANDLER_KEY, method);
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.