wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Why does java not report exception line numbers sometimes? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Why does java not report exception line numbers sometimes?" Watch "Why does java not report exception line numbers sometimes?" New topic
Author

Why does java not report exception line numbers sometimes?

Ben Ethridge
Ranch Hand

Joined: Jul 28, 2003
Posts: 108
This may make me look a bit silly but I gotta ask coz I don't see the pattern in my code yet:

Notice in this stacktrace below, about the 5th and 6th elements in the stack, how the java line number is missing.

Why does java do that sometimes? i.e. under what circumstances java NOT report the line number that caused the exception?


-----------------------------------------------------------------

Here's the stdout log:

[8/13/04 9:03:08:586 CDT] 58275827 ExceptionUtil E CNTR0020E: Non-application exception occurred while processing method "transformCommStmt" on bean "BeanId(ExtInterfaces#ExtInterfacesEJB.jar#TFGExternalInterfaceService, null)". Exception data: java.lang.IllegalArgumentException: Cannot format given Object as a Date
at java.lang.Throwable.<init>(Throwable.java)
at java.lang.Throwable.<init>(Throwable.java)
at java.text.DateFormat.format(DateFormat.java:290)
at java.text.Format.format(Format.java:144)
at com.republic.externalinterface.commisStmtExport.TFGCommStmtExport.deleteOldXmlArchives(TFGCommStmtExport.java)
at com.republic.externalinterface.commisStmtExport.TFGCommStmtExport.transformCommStmtXMLsToAFlatFile(TFGCommStmtExport.java)
at com.republic.externalinterface.service.TFGExternalInterfaceServiceBean.transformCommStmt(TFGExternalInterfaceServiceBean.java:29)
at com.republic.externalinterface.service.EJSRemoteStatelessTFGExternalInterfaceService_945f7a13.transformCommStmt(EJSRemoteStatelessTFGExternalInterfaceService_945f7a13.java:76)
at com.republic.externalinterface.service._EJSRemoteStatelessTFGExternalInterfaceService_945f7a13_Tie.transformCommStmt(_EJSRemoteStatelessTFGExternalInterfaceService_945f7a13_Tie.java:160)
at com.republic.externalinterface.service._EJSRemoteStatelessTFGExternalInterfaceService_945f7a13_Tie._invoke(_EJSRemoteStatelessTFGExternalInterfaceService_945f7a13_Tie.java:99)
at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:602)
at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:455)
at com.ibm.rmi.iiop.ORB.process(ORB.java:402)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:1685)
at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2173)
at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:64)
at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:95)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java)


----------------------------------------------------


(I thinking this is java doing it, and not something specific to WebSphere.)

Here is an edited version of the code that exhibits this behavior:

protected void deleteOldXmlArchives(String dB_Comm_XML_Arc_Path) throws TFGNestingException {

SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/MM/dd");
String processDateString = getProcessDate();//Returns String in form yyyyMMdd.
String s = sdf1.format(processDateString);//This line causes the exception.
}
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Some class files don't have line numbers in them. The line number table isn't generated if "-O" is passed to javac. In other cases, HotSpot/JIT compilation makes it impossible to report line numbers in some cases -- although this happens far less often then it used to.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why does java not report exception line numbers sometimes?
 
Similar Threads
Parsing date..?
When does java stack trace show the offending line number?
date format conversion to MM/dd/yyyy hh:mm a
Applying logic tags for DATE
Deploying EJB in WSAD 5.0