ROP and exceptions

From: Marcin Skladaniec (marci..sh.com.au)
Date: Sat Nov 03 2007 - 23:06:12 EDT

  • Next message: Andrus Adamchik: "Re: 2.0.4: child DataContext & localObject"

    Hi

    I have a problem which is bothering me for quite a long time. It is
    about the exception messages being munched on the server, an example :

    Simple one to many relationship : Student -< Enrolments, there is a
    deny rule on the student side.

    Because of some bug the fact that the student has enrolments slipped
    during the custom validation on client, therefore the change against
    the deny rule is to be made. On server the validation kicks in,
    producing a ValidationException. When the logging level is set to WARN
    all I see is :

    on client:
      [java] Exception in thread "AWT-EventQueue-0"
    org.apache.cayenne.CayenneRuntimeException: [v.3.0-SNAPSHOT Oct 08
    2007 17:00:01] Remote error. URL - http://10.29.64.41:8181/angel-server-cayenne
          [java] at
    org
    .apache
    .cayenne
    .remote.hessian.HessianConnection.doSendMessage(HessianConnection.java:
    145)
          [java] at
    org
    .apache.cayenne.remote.BaseConnection.sendMessage(BaseConnection.java:
    73)
          [java] at
    org.apache.cayenne.remote.ClientChannel.send(ClientChannel.java:276)
          [java] at
    org.apache.cayenne.remote.ClientChannel.onSync(ClientChannel.java:171)
          [java] at
    org.apache.cayenne.CayenneContext.doCommitChanges(CayenneContext.java:
    244)
          [java] at
    org.apache.cayenne.CayenneContext.commitChanges(CayenneContext.java:203)
          [java] at
    ish.oncourse.cayenne.CayenneContext.commitChanges(CayenneContext.java:
    80)

    on server :
      [java] WARNING: org.apache.cayenne.CayenneRuntimeException: [v.$
    {project.version} ${project.build.date} ${project.build.time}]
    Exception processing message org.apache.cayenne.remote.SyncMessage of
    type flush-cascade-sync
          [java] org.apache.cayenne.CayenneRuntimeException: [v.$
    {project.version} ${project.build.date} ${project.build.time}]
    Exception processing message org.apache.cayenne.remote.SyncMessage of
    type flush-cascade-sync
          [java] at
    org
    .apache
    .cayenne
    .remote
    .service.BaseRemoteService.processMessage(BaseRemoteService.java:178)
          [java] at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown
    Source)
          [java] at
    sun
    .reflect
    .DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    25)
          [java] at java.lang.reflect.Method.invoke(Method.java:585)
          [java] at
    com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:
    157)
          [java] at
    com.caucho.hessian.server.HessianServlet.service(HessianServlet.java:
    365)
          [java] at
    ish.oncourse.server.CayenneServlet.service(CayenneServlet.java:89)

    Those logs does not say me at all about the reason of the problem. I
    have to switch to log level INFO to get this on server :

    [java] 12:41:30,422 [btpool0-1 ] INFO
    org.apache.cayenne.remote.service.BaseRemoteService :157 - error
    processing message
          [java] org.apache.cayenne.validation.ValidationException: [v.$
    {project.version} ${project.build.date} ${project.build.time}]
    Validation failures: Validation failure for
    ish.oncourse.server.cayenne.Student.enrolments: There are enrolments
    for this student.
          [java] Validation failure for
    ish.oncourse.server.cayenne.Student.enrolments: There are enrolments
    for this student.
          [java] at
    org
    .apache
    .cayenne
    .access
    .ObjectStoreGraphDiff.validateAndCheckNoop(ObjectStoreGraphDiff.java:
    115)
          [java] at
    org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:
    1160)
          [java] at
    org.apache.cayenne.access.DataContext.onContextFlush(DataContext.java:
    1135)
          [java] at
    org.apache.cayenne.access.DataContext.onSync(DataContext.java:1113)
          [java] at
    org
    .apache
    .cayenne.access.ClientServerChannel.onSync(ClientServerChannel.java:106)

    It is not a big drama, I can do that every time I see the "Exception
    processing message org.apache.cayenne.remote.SyncMessage of type flush-
    cascade-sync" message I can change the log level and repeat the test,
    but wouldn't that be nice if the exception be more descriptive on WARN
    level ? In fact I would love if the exception made all the way back to
    client, where it could be processed and shown to the user in nicer
    form than "Save failed".

    I'm using cayenne build from trunk 3 weeks ago.

    Marcin
    PS. Low level exceptions, like the one thrown when there is an attempt
    to write String to INT field when cayenne model and db schema does not
    match also do not give any meaningful logs on log level WARN.





    This archive was generated by hypermail 2.0.0 : Sat Nov 03 2007 - 23:07:16 EDT