Skip to content

Commit 79c3658

Browse files
committed
HHH-8238 OsgiJtaPlatform null pointer exception
Conflicts: hibernate-osgi/src/main/java/org/hibernate/osgi/OsgiJtaPlatform.java
1 parent 920ba36 commit 79c3658

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

hibernate-osgi/src/main/java/org/hibernate/osgi/OsgiJtaPlatform.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ public OsgiJtaPlatform(BundleContext bundleContext) {
4949

5050
@Override
5151
public TransactionManager retrieveTransactionManager() {
52-
ServiceReference sr = bundleContext.getServiceReference( TransactionManager.class.getName() );
53-
return (TransactionManager) bundleContext.getService( sr );
52+
final ServiceReference sr = bundleContext.getServiceReference( TransactionManager.class.getName() );
53+
return sr == null ? null : (TransactionManager) bundleContext.getService( sr );
5454
}
5555

5656
@Override
5757
public UserTransaction retrieveUserTransaction() {
58-
ServiceReference sr = bundleContext.getServiceReference( UserTransaction.class.getName() );
59-
return (UserTransaction) bundleContext.getService( sr );
58+
final ServiceReference sr = bundleContext.getServiceReference( UserTransaction.class.getName() );
59+
return sr == null ? null : (UserTransaction) bundleContext.getService( sr );
6060
}
6161

6262
@Override

0 commit comments

Comments
 (0)