diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRepository.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRepository.java index c9325db25..688c7c8c5 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRepository.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-2013 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. @@ -119,7 +119,7 @@ public interface JobRepository { void add(StepExecution stepExecution); /** - * Save a collection of {@link StepExecution}s and each {@link ExecutionContext}. The + * Save a collection of {@link StepExecution}s and each {@link ExecutionContext}. The * StepExecution ID will be assigned - it is not permitted that an ID be assigned before calling * this method. Instead, it should be left blank, to be assigned by {@link JobRepository}. * diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/ExecutionContextDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/ExecutionContextDao.java index 1fc5a37ee..601777120 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/ExecutionContextDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/ExecutionContextDao.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-2013 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. @@ -55,7 +55,7 @@ public interface ExecutionContextDao { * @param stepExecution */ void saveExecutionContext(final StepExecution stepExecution); - + /** * Persist the execution context associated with each stepExecution in a given collection, * persistent entry for the context should not exist yet. diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcExecutionContextDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcExecutionContextDao.java index cc41fb5bc..10a84984b 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcExecutionContextDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcExecutionContextDao.java @@ -113,7 +113,8 @@ public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implem new ExecutionContextRowMapper(), executionId); if (results.size() > 0) { return results.get(0); - } else { + } + else { return new ExecutionContext(); } } @@ -127,7 +128,8 @@ public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implem new ExecutionContextRowMapper(), executionId); if (results.size() > 0) { return results.get(0); - } else { + } + else { return new ExecutionContext(); } } @@ -219,7 +221,8 @@ public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implem // 2-byte chars shortContext = serializedContext.substring(0, shortContextLength - 8) + " ..."; longContext = serializedContext; - } else { + } + else { shortContext = serializedContext; longContext = null; } @@ -230,7 +233,8 @@ public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implem ps.setString(1, shortContext); if (longContext != null) { lobHandler.getLobCreator().setClobAsString(ps, 2, longContext); - } else { + } + else { ps.setNull(2, getClobTypeToUse()); } ps.setLong(3, executionId); @@ -259,14 +263,16 @@ public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implem // 2-byte chars shortContext = serializedContext.substring(0, shortContextLength - 8) + " ..."; longContext = serializedContext; - } else { + } + else { shortContext = serializedContext; longContext = null; } ps.setString(1, shortContext); if (longContext != null) { lobHandler.getLobCreator().setClobAsString(ps, 2, longContext); - } else { + } + else { ps.setNull(2, getClobTypeToUse()); } ps.setLong(3, executionId); @@ -292,7 +298,8 @@ public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implem try { serializer.serialize(m, out); results = new String(out.toByteArray(), "ISO-8859-1"); - } catch (IOException ioe) { + } + catch (IOException ioe) { throw new IllegalArgumentException("Could not serialize the execution context", ioe); } @@ -314,7 +321,8 @@ public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implem try { ByteArrayInputStream in = new ByteArrayInputStream(serializedContext.getBytes("ISO-8859-1")); map = (Map) serializer.deserialize(in); - } catch (IOException ioe) { + } + catch (IOException ioe) { throw new IllegalArgumentException("Unable to deserialize the execution context", ioe); } for (Map.Entry entry : map.entrySet()) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/SimpleJobRepository.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/SimpleJobRepository.java index da8c4d8b3..a54a95255 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/SimpleJobRepository.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/SimpleJobRepository.java @@ -125,11 +125,12 @@ public class SimpleJobRepository implements JobRepository { if (status == BatchStatus.COMPLETED || status == BatchStatus.ABANDONED) { throw new JobInstanceAlreadyCompleteException( "A job instance already exists and is complete for parameters=" + jobParameters - + ". If you want to run this job again, change the parameters."); + + ". If you want to run this job again, change the parameters."); } } executionContext = ecDao.getExecutionContext(jobExecutionDao.getLastJobExecution(jobInstance)); - } else { + } + else { // no job found, create one jobInstance = jobInstanceDao.createJobInstance(jobName, jobParameters); executionContext = new ExecutionContext(); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/TaskletStepExceptionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/TaskletStepExceptionTests.java index 01eb0bcb8..922d18f8c 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/TaskletStepExceptionTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/TaskletStepExceptionTests.java @@ -1,6 +1,3 @@ -/** - * - */ package org.springframework.batch.core.step.item; import static org.junit.Assert.assertEquals; @@ -187,7 +184,7 @@ public class TaskletStepExceptionTests { taskletStep.setStreams(new ItemStream[] { new ItemStreamSupport() { @Override public void close() throws ItemStreamException { - super.close(); + super.close(); throw exception; } } });