You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Dominique GALLOT <d....@atoseuronext.be> on 2001/07/12 08:37:59 UTC

Bug in LocationInfo.java ?

Hello,

I'm not sure that I'm writting to the correct list, but ...

I am working with a java under a Digital Unix, and I saw that the
LocationInfo class doesn't work on the machine,
If fact it seems that when the class has been compiled with a 'Just In Time
Compiler' the class in unable to get the filename.

Here is why, 
a stack trace under the digital jvm will produce 

        at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java,
Compiled Code)

a stack trace from the windows jvm will produce 

	at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)

Since in the getFileName the code is expecting to get a ':' between the
filename and the line number, it will not 'read' the class file name.
Solution ( work around ? ) , simple after looking unsuccessfully for the
':', the function will try to find a ','.

Regards,

Dominique Gallot


public String getFileName() {
  if(fullInfo == null) return NA;
  if(fileName == null) {
    int iend = fullInfo.lastIndexOf(':');
    if ( iend == -1 ) iend = fullInfo.lastIndexOf(',');
    if(iend == -1)
      fileName = NA;
    else {
      int ibegin = fullInfo.lastIndexOf('(', iend - 1);
      fileName = this.fullInfo.substring(ibegin + 1, iend);
    }
      }
      return fileName;
    }