Examples of InvalidParameterException


Examples of java.security.InvalidParameterException

        this.methodStore = methodStore;
    }

    public String generateKey(final Object keyObject) {
        if (keyObject == null) {
            throw new InvalidParameterException("keyObject must be defined");
        }
        try {
            final Method keyMethod = getKeyMethod(keyObject);
            return generateObjectId(keyMethod, keyObject);
        } catch (Exception ex) {
View Full Code Here

Examples of java.security.InvalidParameterException

        }
    }

    public List<String> generateKeys(final List<Object> keyObjects) {
        if (keyObjects == null || keyObjects.size() < 1) {
            throw new InvalidParameterException("The key objects must be defined.");
        }
        final List<String> results = new ArrayList<String>(keyObjects.size());
        for (final Object keyObject : keyObjects) {
            results.add(generateKey(keyObject));
        }
View Full Code Here

Examples of java.security.InvalidParameterException

                            InvalidateAssignCache.class,
                            methodToCache);
           
            final String cacheKey = buildCacheKey(annotationData.getAssignedKey(), annotationData);
            if (cacheKey == null || cacheKey.trim().length() == 0) {
                throw new InvalidParameterException("Unable to find a cache key");
            }
            cache.delete(cacheKey);
        } catch (Throwable ex) {
            LOG.warn("Caching on " + pjp.toShortString() + " aborted due to an error.", ex);
        }
View Full Code Here

Examples of java.security.InvalidParameterException

                final Method keyMethod = getKeyMethod(result);
                final String objectId = generateObjectId(keyMethod, result);
                cacheKey = buildCacheKey(objectId, annotationData);
            }
            if (cacheKey == null || cacheKey.trim().length() == 0) {
                throw new InvalidParameterException("Unable to find a cache key");
            }
            cache.delete(cacheKey);
        } catch (Throwable ex) {
            LOG.warn("Caching on " + pjp.toShortString() + " aborted due to an error.", ex);
        }
View Full Code Here

Examples of java.security.InvalidParameterException

            final Method assignKeyMethod = expectedAnnotationClass.getDeclaredMethod("assignedKey", null);
            final String assignKey = (String) assignKeyMethod.invoke(annotation, null);
            if (AnnotationConstants.DEFAULT_STRING.equals(assignKey)
                    || assignKey == null
                    || assignKey.length() < 1) {
                throw new InvalidParameterException(String.format(
                        "AssignedKey for annotation [%s] must be defined on [%s]",
                        expectedAnnotationClass.getName(),
                        targetMethodName
                ));
            }
View Full Code Here

Examples of java.security.InvalidParameterException

        final Method namespaceMethod = expectedAnnotationClass.getDeclaredMethod("namespace", null);
        final String namespace = (String) namespaceMethod.invoke(annotation, null);
        if (AnnotationConstants.DEFAULT_STRING.equals(namespace)
                || namespace == null
                || namespace.length() < 1) {
            throw new InvalidParameterException(String.format(
                    "Namespace for annotation [%s] must be defined on [%s]",
                    expectedAnnotationClass.getName(),
                    targetMethodName
            ));
        }
View Full Code Here

Examples of java.security.InvalidParameterException

            throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
        if (!INVALIDATES.contains(expectedAnnotationClass)) {
            final Method expirationMethod = expectedAnnotationClass.getDeclaredMethod("expiration", null);
            final int expiration = (Integer) expirationMethod.invoke(annotation, null);
            if (expiration < 0) {
                throw new InvalidParameterException(String.format(
                        "Expiration for annotation [%s] must be 0 or greater on [%s]",
                        expectedAnnotationClass.getName(),
                        targetMethodName
                ));
            }
View Full Code Here

Examples of java.security.InvalidParameterException

                if (paramAnnotations != null && paramAnnotations.length > 0) {
                    for (int jx = 0; jx < paramAnnotations.length; jx++) {
                        final Annotation paramAnnotation = paramAnnotations[jx];
                        if (ParameterDataUpdateContent.class.equals(paramAnnotation.annotationType())) {
                            if (foundIndex >= 0) {
                                throw new InvalidParameterException(String.format(
                                        "Multiple annotations of type [%s] found on method [%s]",
                                        ParameterDataUpdateContent.class.getName(),
                                        targetMethod.getName()
                                ));
                            }
                            foundIndex = ix;
                        }
                    }
                }
            }
        }

        if (foundIndex < 0) {
            throw new InvalidParameterException(String.format(
                    "No KeyProvider annotation found method [%s]",
                    targetMethod.getName()
            ));
        }
View Full Code Here

Examples of java.security.InvalidParameterException

        final ReturnValueKeyProvider returnAnnotation = targetMethod.getAnnotation(ReturnValueKeyProvider.class);
        if (returnAnnotation != null) {
            final Method beanMethod = ReturnValueKeyProvider.class.getDeclaredMethod("keyProviderBeanName", null);
            final String beanName = (String) beanMethod.invoke(returnAnnotation, null);
            if (beanName == null || beanName.length() < 1) {
                throw new InvalidParameterException(String.format(
                        "No valid keyIndexBeanName defined in annotation [%s] on method [%s]",
                        ReturnValueKeyProvider.class.getName(),
                        targetMethod.getName()
                ));
            }
            data.setKeyIndex(-1);
            data.setKeyProviderBeanName(beanName);
            return;
        }

        final Annotation[][] paramAnnotationArrays = targetMethod.getParameterAnnotations();
        int foundIndex = Integer.MIN_VALUE;
        Annotation foundAnnotation = null;

        if (paramAnnotationArrays != null && paramAnnotationArrays.length > 0) {
            for (int ix = 0; ix < paramAnnotationArrays.length; ix++) {
                final Annotation[] paramAnnotations = paramAnnotationArrays[ix];
                if (paramAnnotations != null && paramAnnotations.length > 0) {
                    for (int jx = 0; jx < paramAnnotations.length; jx++) {
                        final Annotation paramAnnotation = paramAnnotations[jx];
                        if (ParameterValueKeyProvider.class.equals(paramAnnotation.annotationType())) {
                            if (foundIndex >= 0) {
                                throw new InvalidParameterException(String.format(
                                        "Multiple annotations of type [%s] found on method [%s]",
                                        ParameterValueKeyProvider.class.getName(),
                                        targetMethod.getName()
                                ));
                            }
                            foundAnnotation = paramAnnotation;
                            foundIndex = ix;
                        }
                    }
                }
            }
        }

        if (foundIndex < 0 || foundAnnotation == null) {
            throw new InvalidParameterException(String.format(
                    "No KeyProvider annotation found method [%s]",
                    targetMethod.getName()
            ));
        }


        final Method beanMethod = ParameterValueKeyProvider.class.getDeclaredMethod("keyProviderBeanName", null);
        final String beanName = (String) beanMethod.invoke(foundAnnotation, null);
        if (beanName == null || beanName.length() < 1) {
            throw new InvalidParameterException(String.format(
                    "No valid keyIndexBeanName defined in annotation [%s] on method [%s]",
                    ParameterValueKeyProvider.class.getName(),
                    targetMethod.getName()
            ));
        }
View Full Code Here

Examples of java.security.InvalidParameterException

    static void populateClassName(final AnnotationData data,
                                   final Annotation annotation,
                                   final Class expectedAnnotationClass) {
        if (annotation == null) {
            throw new InvalidParameterException(String.format(
                    "No annotation of type [%s] found.",
                    expectedAnnotationClass.getName()
            ));
        }

        final Class clazz = annotation.annotationType();
        if (!expectedAnnotationClass.equals(clazz)) {
            throw new InvalidParameterException(String.format(
                    "No annotation of type [%s] found, class was of type [%s].",
                    expectedAnnotationClass.getName(),
                    clazz.getName()
            ));
        }
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.