From 5017c05c2380c4a8c34220a780641f58aab27c96 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 10 Feb 2017 10:56:40 +0100 Subject: [PATCH] Polishing (cherry picked from commit e9019cd) --- .../jdbc/core/support/SqlLobValue.java | 5 ++--- .../jdbc/support/lob/package-info.java | 7 ++----- .../connection/ConnectionFactoryUtils.java | 21 ++++++++++--------- .../TransactionCallbackWithoutResult.java | 5 +---- 4 files changed, 16 insertions(+), 22 deletions(-) diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/support/SqlLobValue.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/support/SqlLobValue.java index 8e46d42b75..6845773d55 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/support/SqlLobValue.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/support/SqlLobValue.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -169,8 +169,7 @@ public class SqlLobValue implements DisposableSqlTypeValue { * Set the specified content via the LobCreator. */ @Override - public void setTypeValue(PreparedStatement ps, int paramIndex, int sqlType, String typeName) - throws SQLException { + public void setTypeValue(PreparedStatement ps, int paramIndex, int sqlType, String typeName) throws SQLException { if (sqlType == Types.BLOB) { if (this.content instanceof byte[] || this.content == null) { this.lobCreator.setBlobAsBytes(ps, paramIndex, (byte[]) this.content); diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/lob/package-info.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/lob/package-info.java index ceea8ac1bc..4ae1cfe995 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/lob/package-info.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/lob/package-info.java @@ -1,8 +1,5 @@ /** - * Provides a stategy interface for Large OBject handling, - * with implementations for various databases. - * - *

Can be used independently from jdbc.core and jdbc.object, - * for example in custom JDBC access code. + * Provides a strategy interface for Large OBject handling, + * as well as a customizable default implementation. */ package org.springframework.jdbc.support.lob; diff --git a/spring-jms/src/main/java/org/springframework/jms/connection/ConnectionFactoryUtils.java b/spring-jms/src/main/java/org/springframework/jms/connection/ConnectionFactoryUtils.java index 72f0497453..97fc2997b1 100644 --- a/spring-jms/src/main/java/org/springframework/jms/connection/ConnectionFactoryUtils.java +++ b/spring-jms/src/main/java/org/springframework/jms/connection/ConnectionFactoryUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -131,8 +131,8 @@ public abstract class ConnectionFactoryUtils { * @return the transactional Session, or {@code null} if none found * @throws JMSException in case of JMS failure */ - public static Session getTransactionalSession( - final ConnectionFactory cf, final Connection existingCon, final boolean synchedLocalTransactionAllowed) + public static Session getTransactionalSession(final ConnectionFactory cf, + final Connection existingCon, final boolean synchedLocalTransactionAllowed) throws JMSException { return doGetTransactionalSession(cf, new ResourceFactory() { @@ -173,8 +173,8 @@ public abstract class ConnectionFactoryUtils { * @return the transactional Session, or {@code null} if none found * @throws JMSException in case of JMS failure */ - public static QueueSession getTransactionalQueueSession( - final QueueConnectionFactory cf, final QueueConnection existingCon, final boolean synchedLocalTransactionAllowed) + public static QueueSession getTransactionalQueueSession(final QueueConnectionFactory cf, + final QueueConnection existingCon, final boolean synchedLocalTransactionAllowed) throws JMSException { return (QueueSession) doGetTransactionalSession(cf, new ResourceFactory() { @@ -215,8 +215,8 @@ public abstract class ConnectionFactoryUtils { * @return the transactional Session, or {@code null} if none found * @throws JMSException in case of JMS failure */ - public static TopicSession getTransactionalTopicSession( - final TopicConnectionFactory cf, final TopicConnection existingCon, final boolean synchedLocalTransactionAllowed) + public static TopicSession getTransactionalTopicSession(final TopicConnectionFactory cf, + final TopicConnection existingCon, final boolean synchedLocalTransactionAllowed) throws JMSException { return (TopicSession) doGetTransactionalSession(cf, new ResourceFactory() { @@ -234,7 +234,8 @@ public abstract class ConnectionFactoryUtils { } @Override public Session createSession(Connection con) throws JMSException { - return ((TopicConnection) con).createTopicSession(synchedLocalTransactionAllowed, Session.AUTO_ACKNOWLEDGE); + return ((TopicConnection) con).createTopicSession( + synchedLocalTransactionAllowed, Session.AUTO_ACKNOWLEDGE); } @Override public boolean isSynchedLocalTransactionAllowed() { @@ -339,8 +340,8 @@ public abstract class ConnectionFactoryUtils { } if (resourceHolderToUse != resourceHolder) { TransactionSynchronizationManager.registerSynchronization( - new JmsResourceSynchronization( - resourceHolderToUse, connectionFactory, resourceFactory.isSynchedLocalTransactionAllowed())); + new JmsResourceSynchronization(resourceHolderToUse, connectionFactory, + resourceFactory.isSynchedLocalTransactionAllowed())); resourceHolderToUse.setSynchronizedWithTransaction(true); TransactionSynchronizationManager.bindResource(connectionFactory, resourceHolderToUse); } diff --git a/spring-tx/src/main/java/org/springframework/transaction/support/TransactionCallbackWithoutResult.java b/spring-tx/src/main/java/org/springframework/transaction/support/TransactionCallbackWithoutResult.java index a4b57b3b0b..8088bc2870 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/support/TransactionCallbackWithoutResult.java +++ b/spring-tx/src/main/java/org/springframework/transaction/support/TransactionCallbackWithoutResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,15 +40,12 @@ public abstract class TransactionCallbackWithoutResult implements TransactionCal * context. Does not need to care about transactions itself, although it can retrieve * and influence the status of the current transaction via the given status object, * e.g. setting rollback-only. - * *

A RuntimeException thrown by the callback is treated as application * exception that enforces a rollback. An exception gets propagated to the * caller of the template. - * *

Note when using JTA: JTA transactions only work with transactional * JNDI resources, so implementations need to use such resources if they * want transaction support. - * * @param status associated transaction status * @see TransactionTemplate#execute */