BATCH-1908: Minor cleanup/formatting
This commit is contained in:
@@ -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}.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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<String, Object>) serializer.deserialize(in);
|
||||
} catch (IOException ioe) {
|
||||
}
|
||||
catch (IOException ioe) {
|
||||
throw new IllegalArgumentException("Unable to deserialize the execution context", ioe);
|
||||
}
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
} });
|
||||
|
||||
Reference in New Issue
Block a user