Skip to content

Commit d425d17

Browse files
committed
code conventions
removed trailing spaces/empty lines minor format
1 parent aab2320 commit d425d17

File tree

6 files changed

+32
-23
lines changed

6 files changed

+32
-23
lines changed

src/main/java/org/mybatis/spring/MyBatisExceptionTranslator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,5 @@ public DataAccessException translateExceptionIfPossible(RuntimeException e) {
7979
private void initExceptionTranslator() {
8080
this.exceptionTranslator = new SQLErrorCodeSQLExceptionTranslator(this.dataSource);
8181
}
82+
8283
}

src/main/java/org/mybatis/spring/SqlSessionFactoryBean.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public void afterPropertiesSet() throws Exception {
217217
Assert.notNull(sqlSessionFactoryBuilder, "Property 'sqlSessionFactoryBuilder' is required");
218218
Assert.notNull(transactionFactoryClass, "Property 'transactionFactoryClass' is required");
219219

220-
sqlSessionFactory = buildSqlSessionFactory();
220+
this.sqlSessionFactory = buildSqlSessionFactory();
221221
}
222222

223223
/**
@@ -246,10 +246,11 @@ protected SqlSessionFactory buildSqlSessionFactory() throws IOException, Illegal
246246
reader = new InputStreamReader(this.configLocation.getInputStream());
247247
// Null environment causes the configuration to use the default.
248248
// This will be overwritten below regardless.
249-
xmlConfigBuilder = new XMLConfigBuilder(reader, null, configurationProperties);
249+
xmlConfigBuilder = new XMLConfigBuilder(reader, null, this.configurationProperties);
250250
configuration = xmlConfigBuilder.parse();
251251
} catch (IOException ex) {
252-
throw new NestedIOException("Failed to parse config resource: " + this.configLocation, ex);
252+
throw new NestedIOException("Failed to parse config resource: "
253+
+ this.configLocation, ex);
253254
} finally {
254255
if (reader != null) {
255256
try {
@@ -261,7 +262,9 @@ protected SqlSessionFactory buildSqlSessionFactory() throws IOException, Illegal
261262
}
262263

263264
if (this.logger.isDebugEnabled()) {
264-
this.logger.debug("Parsed configuration file: '" + this.configLocation + "'");
265+
this.logger.debug("Parsed configuration file: '"
266+
+ this.configLocation
267+
+ "'");
265268
}
266269
} else {
267270
if (this.logger.isDebugEnabled()) {
@@ -309,7 +312,9 @@ protected SqlSessionFactory buildSqlSessionFactory() throws IOException, Illegal
309312
XMLMapperBuilder xmlMapperBuilder = new XMLMapperBuilder(reader, configuration, path, sqlFragments);
310313
xmlMapperBuilder.parse();
311314
} catch (Exception e) {
312-
throw new NestedIOException("Failed to parse mapping resource: '" + mapperLocation + "'", e);
315+
throw new NestedIOException("Failed to parse mapping resource: '"
316+
+ mapperLocation
317+
+ "'", e);
313318
} finally {
314319
if (reader != null) {
315320
try {
@@ -320,7 +325,9 @@ protected SqlSessionFactory buildSqlSessionFactory() throws IOException, Illegal
320325
}
321326

322327
if (this.logger.isDebugEnabled()) {
323-
this.logger.debug("Parsed mapper file: '" + mapperLocation + "'");
328+
this.logger.debug("Parsed mapper file: '"
329+
+ mapperLocation
330+
+ "'");
324331
}
325332
}
326333
} else {

src/main/java/org/mybatis/spring/SqlSessionTemplate.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,7 @@ public Connection getConnection() {
330330
* Proxy needed to route MyBatis method calls to the proper SqlSession got
331331
* from String's Transaction Manager
332332
* It also unwraps exceptions thrown by {@link Method#invoke(Object, Object...)} to
333-
* pass a {@link PersistenceException} to the {@link PersistenceExceptionTranslator}
334-
*
333+
* pass a {@link PersistenceException} to the {@link PersistenceExceptionTranslator}.
335334
*/
336335
private class SqlSessionInterceptor implements InvocationHandler {
337336
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

src/main/java/org/mybatis/spring/mapper/MapperScannerConfigurer.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -202,42 +202,44 @@ public boolean match(MetadataReader metadataReader, MetadataReaderFactory metada
202202
@Override
203203
protected Set<BeanDefinitionHolder> doScan(String... basePackages) {
204204
Set<BeanDefinitionHolder> beanDefinitions = super.doScan(basePackages);
205-
205+
206206
if (beanDefinitions.isEmpty()) {
207207
if (logger.isDebugEnabled()) {
208208
logger.debug("No MyBatis mapper was found in '"
209209
+ MapperScannerConfigurer.this.basePackage
210210
+ "' package. Please check your configuration");
211211
}
212-
} else {
212+
} else {
213213
for (BeanDefinitionHolder holder : beanDefinitions) {
214214
ScannedGenericBeanDefinition definition = (ScannedGenericBeanDefinition) holder.getBeanDefinition();
215-
215+
216216
if (logger.isDebugEnabled()) {
217-
logger.debug("Creating MapperFactoryBean with '"
218-
+ holder.getBeanName() + "' name and '"
219-
+ definition.getBeanClassName() + "' mapperInterface");
217+
logger.debug("Creating MapperFactoryBean with '"
218+
+ holder.getBeanName()
219+
+ "' name and '"
220+
+ definition.getBeanClassName()
221+
+ "' mapperInterface");
220222
}
221-
223+
222224
// the mapper interface is the original class of the bean
223225
// but, the actual class of the bean is MapperFactoryBean
224226
definition.getPropertyValues().add("mapperInterface", definition.getBeanClassName());
225227
definition.setBeanClass(MapperFactoryBean.class);
226-
228+
227229
definition.getPropertyValues().add("addToConfig", MapperScannerConfigurer.this.addToConfig);
228-
230+
229231
if (MapperScannerConfigurer.this.sqlSessionFactory != null) {
230232
definition.getPropertyValues().add("sqlSessionFactory",
231233
MapperScannerConfigurer.this.sqlSessionFactory);
232234
}
233-
235+
234236
if (MapperScannerConfigurer.this.sqlSessionTemplate != null) {
235237
definition.getPropertyValues().add("sqlSessionTemplate",
236238
MapperScannerConfigurer.this.sqlSessionTemplate);
237239
}
238240
}
239241
}
240-
242+
241243
return beanDefinitions;
242244
}
243245

src/main/java/org/mybatis/spring/support/SqlSessionDaoSupport.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
import org.springframework.util.Assert;
2424

2525
/**
26-
* Convenient super class for MyBatis SqlSession data access objects.
26+
* Convenient super class for MyBatis SqlSession data access objects.
2727
* It gives you access to the template which can then be used to execute SQL methods.
2828
* <p>
29-
* This class needs a SqlSessionTemplate or a SqlSessionFactory.
29+
* This class needs a SqlSessionTemplate or a SqlSessionFactory.
3030
* If both are set the SqlSessionFactory will be ignored.
3131
*
3232
* @see #setSqlSessionFactory

src/main/java/org/mybatis/spring/transaction/SpringManagedTransaction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131
import org.springframework.util.Assert;
3232

3333
/**
34-
* MyBatis has two TransactionManagers out of the box: The {@link JdbcTransaction} and the
34+
* MyBatis has two TransactionManagers out of the box: The {@link JdbcTransaction} and the
3535
* {@link ManagedTransaction}. When MyBatis runs under a Spring transaction none of them
3636
* will work well because {@link JdbcTransaction} would commit/rollback/close and it should not.
3737
* And {@link ManagedTransaction} would close the connection and it should not.
3838
* {@link SpringManagedTransaction} looks if the current connection is been managed by Spring. In that case
39-
* it will not commit/rollback/close. Otherwise it will behave like {@link JdbcTransaction}
39+
* it will not commit/rollback/close. Otherwise it will behave like {@link JdbcTransaction}.
4040
*
4141
* @version $Id$
4242
*/

0 commit comments

Comments
 (0)