Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] broken resources?

I am trying to come up with a logging aspect.
But somehow my aspect breaks the code.
It is running just fine without it.

It's very strange ...I am getting a

java.io.IOException: Bad file descriptor
        at java.io.FileInputStream.read(Native Method)
at org.apache.xerces.impl.XMLEntityManager $RewindableInputStream.read(Unknown Source) at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity (Unknown Source) at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse (Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

when parsing a xml configuration file read
via getResourceAsInputStream() when the aspect
is applied.

Can anyone spot a problem in this little aspect?

cheers
--
Torsten

----
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.Signature;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public aspect LogAspect
{
    declare precedence : LogAspect, *;

    private Log getLog(final Signature pSignature) {
        return LogFactory.getLog(pSignature.getDeclaringType());
    }

    pointcut returnCalls() :
        !within(LogAspect) &&
        (
          execution(* org.whatever..*(..))
          || execution(* org.whatever..*())
        ) && (
(execution(public static * *.*(..)) && !execution(public static void *.*(..))) || (execution(public static * *.*()) && !execution(public static void *.*())) || (execution(public * *.*(..)) && !execution(public void *.*(..))) || (execution(public * *.*()) && !execution(public void *.* ()))
        );

    pointcut voidCalls() :
        !within(LogAspect) &&
        (
          execution(* org.whatever..*(..))
          || execution(* org.whatever..*())
        ) && (
          execution(public static void *.*(..))
          || execution(public static void *.*())
          || execution(public void *.*(..))
          || execution(public void *.*())
          || execution(new(..))
          || execution(new())
        );

after() throwing(Throwable pThrowable) : voidCalls() || returnCalls()
    {
    }

    Object around() : voidCalls()
    {
        final Object result = proceed();
        return result;
    }

    Object around() : returnCalls()
    {
        final Object result = proceed();
        return proceed();
    }
}

Attachment: PGP.sig
Description: This is a digitally signed message part


Back to the top