Re: regression in logger?

2005-07-15 Thread David P Grove
Thanks Mark!

I just tested classpath cvs head against jikes rvm cvs head on SPECjbb2000 
and all is happy again. 

--dave


Mark Wielaard [EMAIL PROTECTED] wrote on 07/15/2005 08:52:44 AM:

 Hi,
 
 On Mon, 2005-07-11 at 07:54 -0400, David P Grove wrote:
  This started showing up in regression tests of Jikes RVM with 
classpath 
  cvs head recently.  I haven't dug deeply, so it could be a latent 
problem 
  in Jikes RVM that was exposed by a classpath change, rather than a 
real 
  classpath bug, but might still be worth mentioning.  The failing 
program 
  is SPECjbb2000.
 
 Unfortunately I don't have a current Jikes RVM setup to test against.
 But I will include this workaround to make the code more robust against
 StackTraceElement[] that are not like it expects (note that
 Throwable.getStackTraceElements() may not contain all frames in general,
 so it isn't a very robust way to walk the stack.)
 
 2005-07-15  Mark Wielaard  [EMAIL PROTECTED]
 
* java/util/logging/Logger.java (getCallerStackFrame):
Make sure index  stackTrace.length and return null otherwise.
(log): Check for caller == null.
 
 Note that this getCallerStackFrame() method is highly inefficient and
 should really use direct runtime support through the VMStackWalker
 methods.
 
 Cheers,
 
 Mark
 
 P.S. Hopefully the last patch before 0.17. Please coordinate on
 irc.gnu.org #classpath if you want some last minute fix in.
 Index: java/util/logging/Logger.java
 ===
 RCS file: /cvsroot/classpath/classpath/java/util/logging/Logger.java,v
 retrieving revision 1.10
 diff -u -r1.10 Logger.java
 --- java/util/logging/Logger.java   14 Jul 2005 13:16:58 -   1.10
 +++ java/util/logging/Logger.java   15 Jul 2005 12:51:12 -
 @@ -585,10 +585,10 @@
  String message,
  Object param)
{
 - StackTraceElement caller = getCallerStackFrame();
 +StackTraceElement caller = getCallerStackFrame();
  logp(level,
 -caller.getClassName(),
 -caller.getMethodName(),
 +caller != null ? caller.getClassName() : unknown,
 +caller != null ? caller.getMethodName() : unknown,
  message,
  param);
}
 @@ -600,8 +600,8 @@
{
  StackTraceElement caller = getCallerStackFrame();
  logp(level,
 -caller.getClassName(),
 -caller.getMethodName(),
 +caller != null ? caller.getClassName() : unknown,
 +caller != null ? caller.getMethodName() : unknown,
  message,
  params);
}
 @@ -611,10 +611,10 @@
  String message,
  Throwable thrown)
{
 -   StackTraceElement caller = getCallerStackFrame(); 
 +StackTraceElement caller = getCallerStackFrame(); 
  logp(level,
 -caller.getClassName(),
 -caller.getMethodName(),
 +caller != null ? caller.getClassName() : unknown,
 +caller != null ? caller.getMethodName() : unknown,
  message,
  thrown);
}
 @@ -1162,19 +1162,25 @@
/**
 * Gets the StackTraceElement of the first class that is not this 
class.
 * That should be the initial caller of a logging method.
 -   * @return caller of the initial looging method
 +   * @return caller of the initial logging method or null if unknown.
 */
private StackTraceElement getCallerStackFrame()
{
  Throwable t = new Throwable();
  StackTraceElement[] stackTrace = t.getStackTrace();
  int index = 0;
 +
  // skip to stackentries until this class
 - 
while(!stackTrace[index].getClassName().equals(getClass().getName())){index++;}
 +while(index  stackTrace.length
 +  !stackTrace[index].getClassName().equals(getClass().getName()))
 +  index++;
 +
  // skip the stackentries of this class
 - 
while(stackTrace[index].getClassName().equals(getClass().getName())){index++;}
 +while(index  stackTrace.length
 +  stackTrace[index].getClassName().equals(getClass().getName()))
 +  index++;
 
 -return stackTrace[index];
 +return index  stackTrace.length ? stackTrace[index] : null;
}
 
/**
 [attachment signature.asc deleted by David P Grove/Watson/IBM] 


___
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath


Re: regression in logger?

2005-07-11 Thread Archie Cobbs

David P Grove wrote:
 This started showing up in regression tests of Jikes RVM with classpath
 cvs head recently.  I haven't dug deeply, so it could be a latent problem
 in Jikes RVM that was exposed by a classpath change, rather than a real
 classpath bug, but might still be worth mentioning.  The failing program
 is SPECjbb2000.

 --dave

 Exception in thread main: java.lang.ArrayIndexOutOfBoundsException:
 Array index out of range: 0
 at java.util.logging.Logger.getCallerStackFrame(Logger.java:1173)

Looks like this can only happen if the VM doesn't return Throwable stack
traces. Is this with 0.16? There were recent changes in the VMThrowable
class (see NEWS) that might need to be followed in Jikes RVM.

-Archie

__
Archie Cobbs  *CTO, Awarix*  http://www.awarix.com


___
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath


Re: regression in logger?

2005-07-11 Thread Casey Marshall

On Jul 11, 2005, at 4:54 AM, David P Grove wrote:

This started showing up in regression tests of Jikes RVM with  
classpath
cvs head recently.  I haven't dug deeply, so it could be a latent  
problem
in Jikes RVM that was exposed by a classpath change, rather than a  
real
classpath bug, but might still be worth mentioning.  The failing  
program

is SPECjbb2000.



This is caused, at least in part, by the recent change I've made to  
the X509Certificate class to use java.util.logging for debugging  
instead of System.err.println. It might be that a certificate is  
being loaded too early for there to be a stack trace?


Anyway, I don't think it is unreasonable to use loggers that early.  
Should loggers perhaps not depend on a full stack trace, if one isn't  
available?



___
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath