[jboss-jira] [JBoss JIRA] Commented: (JBPM-556) Problems with Exception longer 4000 characters in AtcionLog

Tom Baeyens (JIRA) jira-events at lists.jboss.org
Thu Mar 1 07:32:09 EST 2007


    [ http://jira.jboss.com/jira/browse/JBPM-556?page=comments#action_12354689 ] 
            
Tom Baeyens commented on JBPM-556:
----------------------------------

taking a second look, i might have a solution that works with the current codebase.  please evaluate if this would be a good solution:

in the file hibernate.queries.hbm.xml there is the following line:

  <typedef class="org.jbpm.db.hibernate.StringMax" name="string_max" />

the type string max will be just like the string type, except that it will truncate the value to 4000 in case it is longer.  the type string_max is referenced in many locations.  so by customizing this single class name, you can configure the columns types and handling of all the long text fields in jbpm.

it should be possible to change the class org.jbpm.db.hibernate.StringMax to any of the existing hibernate types.

or am i missing something ?

please, be quick to reply as this case will be closed soon if there is no problem reported.

regards, tom.

> Problems with Exception longer 4000 characters in AtcionLog
> -----------------------------------------------------------
>
>                 Key: JBPM-556
>                 URL: http://jira.jboss.com/jira/browse/JBPM-556
>             Project: JBoss jBPM
>          Issue Type: Bug
>          Components: Core Engine
>    Affects Versions: jBPM 3.0.2, jBPM 3.1 beta 3
>            Reporter: Bernd Ruecker
>         Assigned To: Tom Baeyens
>             Fix For: jBPM jPDL 3.2
>
>   Original Estimate: 5 minutes
>  Remaining Estimate: 5 minutes
>
> In the ActionLog
>   public void setException(Throwable exception) {
>     StringWriter stringWriter = new StringWriter();
>     exception.printStackTrace(new PrintWriter(stringWriter));
>     this.exception = stringWriter.toString();
>   }
> a exception is thrown if the exception has more than 4000 characters (at least with Oracle). This code can be fixed easyly:
>   public void setException(Throwable exception) {
>     StringWriter stringWriter = new StringWriter();
>     exception.printStackTrace(new PrintWriter(stringWriter));
>     String st = stringWriter.toString();
>     
>     // perhaps can not write more tha 4000 chars to database field (e.g. Oracle)
>     if (st.length()>4000) 
>     	st = st.substring(0, 4000);
>     this.exception = st;
>   }
> By the way, this is already done correctly in Timers (Timer.java) :-) Perhaps some refactoring to centralize thi issue would be nice (for example a String getExceptionAsString(Throwble t) helper-method).
>         if (t!=null) {
>           log.error("unhandled timer exception", t);
>           // this means an unhandled exception occurred in this timer
>           StringWriter sw = new StringWriter();
>           actionException.printStackTrace(new PrintWriter(sw));
>           exception = sw.toString();
>           if (exception.length()>4000) exception = exception.substring(0, 4000);
>         }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list