You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Sunitha Kambhampati <ks...@gmail.com> on 2005/05/09 18:47:51 UTC

[PATCH] Derby 237 Boot errror stack traces from store must not be lost

http://issues.apache.org/jira/browse/DERBY-237?page=all

This patch fixes derby-237: Boot errors from store must not lose error messages/stack traces in between.

Actually nested exceptions from the boot error were not lost but their stack traces were not being written out into error stream which is why the entire stack traces of exceptions was not printed out to derby.log

svn stat
M      java\engine\org\apache\derby\impl\store\raw\log\LogToFile.java


-- I tested it with a corrupted database (from derby 241) that resulted in boot error and the stack traces are printed out ok in derby.log.
-- I ran derbyall suite and all tests passed.

Please review it and if there are no comments, can a committer please commit it. 

Thanks, 
Sunitha. 


Re: [PATCH] Derby 237 Boot errror stack traces from store must not be lost

Posted by Mike Matrigali <mi...@sbcglobal.net>.
I committed this patch with svn  169501.

Sunitha Kambhampati wrote:
> http://issues.apache.org/jira/browse/DERBY-237?page=all
> 
> This patch fixes derby-237: Boot errors from store must not lose error 
> messages/stack traces in between.
> 
> Actually nested exceptions from the boot error were not lost but their 
> stack traces were not being written out into error stream which is why 
> the entire stack traces of exceptions was not printed out to derby.log
> 
> svn stat
> M      java\engine\org\apache\derby\impl\store\raw\log\LogToFile.java
> 
> 
> -- I tested it with a corrupted database (from derby 241) that resulted 
> in boot error and the stack traces are printed out ok in derby.log.
> -- I ran derbyall suite and all tests passed.
> 
> Please review it and if there are no comments, can a committer please 
> commit it.
> Thanks, Sunitha.
> 
> 
> ------------------------------------------------------------------------
> 
> Index: java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
> ===================================================================
> --- java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java	(revision 168348)
> +++ java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java	(working copy)
> @@ -3951,14 +3951,18 @@
>  		}
>  	}
>  
> +    /**
> +     * print stack trace from the Throwable including
> +     * its nested exceptions 
> +     * @param t trace starts from this error
> +     */
>  	private void printErrorStack(Throwable t)
>  	{
> -		Monitor.logMessage("-------------------------\n");
> -		t.printStackTrace(Monitor.getStream().getPrintWriter());
> -		Monitor.logMessage("-------------------------\n");
>  		ErrorStringBuilder esb = new ErrorStringBuilder(Monitor.getStream().getHeader());
>  		esb.stackTrace(t);
> -	}
> +        Monitor.logMessage(esb.get().toString());
> +        esb.reset();
> +    }
>  
>  
>  	/**