Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why does java not report exception line numbers sometimes?

 
Ben Ethridge
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic