Package org.codehaus.aspectwerkz.exception

Examples of org.codehaus.aspectwerkz.exception.WrappedRuntimeException


        try {
            InputStream classStream = loader.getResourceAsStream(classFileName);
            ClassParser classParser = new ClassParser(classStream, classFileName);
            javaClass = classParser.parse();
        } catch (IOException e) {
            throw new WrappedRuntimeException(e);
        }

        List attributes = getAspectAttributes(javaClass);
        if (attributes.size() == 0) {
            return; // not an AspectJ aspect
        }

        aspectDef.setAspectModel(getAspectModelType());

        for (Iterator it = attributes.iterator(); it.hasNext();) {
            AjAttribute attr = (AjAttribute) it.next();
            if (attr instanceof AjAttribute.PointcutDeclarationAttribute) {
                AjAttribute.PointcutDeclarationAttribute pcAttr = (AjAttribute.PointcutDeclarationAttribute) attr;
                Pointcut pointcut = pcAttr.reify().getPointcut();
                if (pointcut instanceof KindedPointcut) {
                    try {
                        Field sigField = KindedPointcut.class.getDeclaredField("signature");
                        sigField.setAccessible(true);
                        SignaturePattern signature = (SignaturePattern) sigField.get(pointcut);
                        DefinitionParserHelper.createAndAddPointcutDefToAspectDef(
                                signature.getName().toString(), pointcut.toString(), aspectDef
                        );
                    } catch (Exception e) {
                        throw new WrappedRuntimeException(e);
                    }
                }
            }
        }
        for (Iterator iterator = getAroundAdviceInfo(javaClass).iterator(); iterator.hasNext();) {
View Full Code Here


                            try {
                                ConstructorInfo c1 = (ConstructorInfo) o1;
                                ConstructorInfo c2 = (ConstructorInfo) o2;
                                return c1.getSignature().compareTo(c2.getSignature());
                            } catch (Exception e) {
                                throw new WrappedRuntimeException(e);
                            }
                        }
                    }
            );
            for (int i = 0; i < constructors.length; i++) {
                ConstructorInfo constructor = constructors[i];
                int mods = constructor.getModifiers();
                if ((mods & Constants.ACC_PRIVATE) == 0) {
                    out.writeUTF(INIT_METHOD_NAME);
                    out.writeInt(mods);
                    out.writeUTF(constructor.getSignature().replace('/', '.'));
                }
            }

            // handle regular methods.
            Arrays.sort(
                    methods, new Comparator() {
                        public int compare(Object o1, Object o2) {
                            try {
                                MethodInfo m1 = (MethodInfo) o1;
                                MethodInfo m2 = (MethodInfo) o2;
                                int value = m1.getName().compareTo(m2.getName());
                                if (value == 0) {
                                    value = m1.getSignature().compareTo(m2.getSignature());
                                }
                                return value;
                            } catch (Exception e) {
                                throw new WrappedRuntimeException(e);
                            }
                        }
                    }
            );
            for (int i = 0; i < methods.length; i++) {
                MethodInfo method = methods[i];
                int mods = method.getModifiers();
                if ((mods & Constants.ACC_PRIVATE) == 0) {
                    out.writeUTF(method.getName());
                    out.writeInt(mods & filterSynthetic());
                    out.writeUTF(method.getSignature().replace('/', '.'));
                }
            }

            // calculate hash.
            out.flush();
            MessageDigest digest = MessageDigest.getInstance("SHA");
            byte[] digested = digest.digest(bout.toByteArray());
            long hash = 0;
            for (int i = Math.min(digested.length, 8) - 1; i >= 0; i--) {
                hash = (hash << 8) | (digested[i] & 0xFF);
            }
            return hash;
        } catch (Exception e) {
            e.printStackTrace();
            throw new WrappedRuntimeException(e);
        }
    }
View Full Code Here

                        " [" + AnnotationInfo.class.getClassLoader().toString() + " / " +
                        userAnnotation.getClass().getClassLoader()
                );
            }
        } catch (Exception e) {
            throw new WrappedRuntimeException(e);
        }
    }
View Full Code Here

                dump(loader);
            } catch (Throwable t) {
                t.printStackTrace();
            }
        } catch (InterruptedException e) {
            throw new WrappedRuntimeException(e);
        } finally {
            //downgrade lock by releasing directly
            writeLock.release();
        }
    }
View Full Code Here

            // update
            Set defs = (Set) s_classLoaderSystemDefinitions.get(loader);
            defs.addAll(definitions);
            dump(loader);
        } catch (InterruptedException e) {
            throw new WrappedRuntimeException(e);
        } finally {
            lock.release();
        }
    }
View Full Code Here

                    return def;
                }
            }
            return null;
        } catch (InterruptedException e) {
            throw new WrappedRuntimeException(e);
        } finally {
            lock.release();
        }
    }
View Full Code Here

        Sync lock = s_lock.readLock();
        try {
            lock.acquire();
            return getHierarchicalDefinitionsFor(loader);
        } catch (InterruptedException e) {
            throw new WrappedRuntimeException(e);
        } finally {
            lock.release();
        }
    }
View Full Code Here

            lock.acquire();
            // make sure the classloader is registered
            registerClassLoader(loader);
            return (Set) s_classLoaderSystemDefinitions.get(loader);
        } catch (InterruptedException e) {
            throw new WrappedRuntimeException(e);
        } finally {
            lock.release();
        }
    }
View Full Code Here

                    return defs;
                } else {
                    return ((Set) s_classLoaderHierarchicalSystemDefinitions.get(loader));
                }
            } catch (InterruptedException e) {
                throw new WrappedRuntimeException(e);
            } finally {
                // downgrade lock
                writeLock.release(); // release write, still hold read
            }
        } else {
View Full Code Here

                             final Class annotationClass) {
        try {
            ASTRoot root = PARSER.parse(annotationRepresentation);
            new AnnotationVisitor(annotationElements, annotationClass).visit(root, null);
        } catch (ParseException e) {
            throw new WrappedRuntimeException("cannot parse annotation [" + annotationRepresentation + "]", e);
        }
    }
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.exception.WrappedRuntimeException

Copyright © 2018 www.massapicom. 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.