ari-ban / test2

0 stars 0 forks source link

NPE in ManagedJMSConnectionFactory when no PasswordCredential is provided #7

Closed arinban closed 14 years ago

arinban commented 19 years ago

This issue has already been discussed on the mailing list, but i submit it here so that we can track it.

When no PasswordCredential can be retrieved in AbstractManagedConnectionFactory#createManagedConnection, the ManagedJMSConnectionFactory throws a NullPointerException in createXAConnection / createConnection. This can appear when the ra is used with jencks/spring outside any app server.

Here is a patch that makes it work:

protected javax.jms.XAConnection createXAConnection(PasswordCredential pc, javax.jms.ConnectionFactory cf ) throws JMSException { if (pc != null)

{ return ((XAConnectionFactory)cf).createXAConnection( pc.getUserName(), new String(pc.getPassword())); }

else

{ return ((XAConnectionFactory)cf).createXAConnection(); }

}

protected javax.jms.Connection createConnection(PasswordCredential pc, javax.jms.ConnectionFactory cf ) throws JMSException { if (pc != null)

{ return ((javax.jms.ConnectionFactory)cf).createConnection( pc.getUserName(), new String(pc.getPassword())); }

else

{ return ((javax.jms.ConnectionFactory)cf).createConnection(); }

}

Cheers, Guillaume Nodet

Environment

Operating System: All Platform: All

Affected Versions

[current]

arinban commented 6 years ago
arinban commented 6 years ago

@arinban Commented

arinban commented 6 years ago

@arinban Commented @arinban Commented

arinban commented 19 years ago

@arinban Commented @arinban Commented @glassfishrobot Commented Reported by gnt@java.net

arinban commented 18 years ago

@arinban Commented @arinban Commented @glassfishrobot Commented binod said: Added null checks for all types of ManagedConnectionFactories.

arinban commented 18 years ago

@arinban Commented @arinban Commented @glassfishrobot Commented binod said: Adding fixed1.0 keyword

arinban commented 19 years ago

@arinban Commented @arinban Commented @glassfishrobot Commented Was assigned to binod

arinban commented 7 years ago

@arinban Commented @arinban Commented @glassfishrobot Commented This issue was imported from java.net JIRA GENERICJMSRA-7

arinban commented 14 years ago

@arinban Commented @arinban Commented @glassfishrobot Commented Marked as fixed on Sunday, September 5th 2010, 8:21:08 pm