Issue Details (XML | Word | Printable)

Key: GLASSFISH-16816
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: marina vatkina
Reporter: christopherrued
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
glassfish

static creation of exception hides actual call location in OTSResourceImpl.java

Created: 07/Jun/11 02:19 PM   Updated: 02/Dec/11 07:23 PM   Resolved: 08/Jun/11 10:58 AM
Component/s: jts
Affects Version/s: 3.1.1_b06
Fix Version/s: 3.1.1_b07 , 4.0

Time Tracking:
Not Specified

File Attachments: 1. Text File OTSResourceImpl.java.patch (3 kB) 07/Jun/11 02:43 PM - christopherrued

Environment:

Windows Server 2003, JDK 1.6


Tags: 3_1_1-approved
Participants: christopherrued, marina vatkina and scatari


 Description  « Hide

I encountered a problem that I'm trying to track down, but I'm having some difficulty. Along the way, I noticed the following in transaction/jts/src/main/java/com/sun/jts/jtsxa/OTSResourceImpl.java (revision 47353) :

488.private static org.omg.CORBA.NO_IMPLEMENT no_implement =
489.new org.omg.CORBA.NO_IMPLEMENT("This is a locally constrained object.");
490.
491.
492.public org.omg.CORBA.Object _duplicate() { 493.throw no_implement; 494.} ...

So the class statically instantiates an Exception and then throws this exception in various unimplemented methods (presumably to avoid the cost of instantiating a new exception?). This makes debugging difficult, though, since the stack trace that results from this exception gives the stack for the instantiation of this exception, not where the exception really occurred:

org.omg.CORBA.NO_IMPLEMENT: This is a locally constrained object. vmcid: 0x0 minor code: 0 completed: No
at com.sun.jts.jtsxa.OTSResourceImpl.<clinit>(OTSResourceImpl.java:488)
at com.sun.jts.jta.TransactionState.startAssociation(TransactionState.java:285)
at com.sun.jts.jta.TransactionImpl.enlistResource(TransactionImpl.java:212)
at com.sun.enterprise.transaction.JavaEETransactionImpl.enlistResource(JavaEETransactionImpl.java:641)
at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.enlistXAResource(JavaEETransactionManagerSimplified.java:1300)
at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.enlistResource(JavaEETransactionManagerSimplified.java:360)
at com.sun.enterprise.resource.rm.SystemResourceManagerImpl.enlistResource(SystemResourceManagerImpl.java:103)
at com.sun.enterprise.resource.pool.PoolManagerImpl.getResource(PoolManagerImpl.java:208)
...
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:117)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:97)
at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:55)

Granted, this is an internal class that end-user developers needn't know much about, but the stack trace doesn't help provide me with a clue about how the system came to call the method that caused the exception to be thrown.



christopherrued added a comment - 07/Jun/11 02:43 PM

Patch to change all exceptions to be instantiated at the time they are thrown


marina vatkina added a comment - 07/Jun/11 02:48 PM

Fixed on trunk with

Sending src/main/java/com/sun/jts/CosTransactions/ControlImpl.java
Sending src/main/java/com/sun/jts/CosTransactions/CoordinatorImpl.java
Sending src/main/java/com/sun/jts/jta/SynchronizationImpl.java
Sending src/main/java/com/sun/jts/jtsxa/OTSResourceImpl.java
Transmitting file data ....
Committed revision 47356.

Please approve for 3.1.1

  • Why fix this issue in 3.1.1?

Easy fix. Helps users identify the problem

  • Which is the targeted build of 3.1.1 for this fix?

3.1.1 b07

  • Do regression tests exist for this issue?

There is no need to because the fix is this:

  • throw no_implement;
    + throw new org.omg.CORBA.NO_IMPLEMENT("This is a locally constrained object.");
  • Which tests should QA (re)run to verify the fix did not destabilize GlassFish?

Regular regression tests


marina vatkina added a comment - 07/Jun/11 02:49 PM

Thanks for the patch. There are 4 classes with this problem.


scatari added a comment - 07/Jun/11 03:46 PM

Approved for 3.1.1. Please make sure that you update the "Fix in version" to reflect 3.1.1 b07.


marina vatkina added a comment - 08/Jun/11 10:58 AM

Fixed in 3.1.1 with
Sending jts/src/main/java/com/sun/jts/CosTransactions/ControlImpl.java
Sending jts/src/main/java/com/sun/jts/CosTransactions/CoordinatorImpl.java
Sending jts/src/main/java/com/sun/jts/jta/SynchronizationImpl.java
Sending jts/src/main/java/com/sun/jts/jtsxa/OTSResourceImpl.java
Transmitting file data ....
Committed revision 47369.