findbugs fixes
This commit is contained in:
@@ -77,13 +77,13 @@ public class Entity implements Serializable {
|
||||
*/
|
||||
public void incrementVersion() {
|
||||
if (version == null) {
|
||||
version = new Integer(0);
|
||||
version = 0;
|
||||
} else {
|
||||
version = new Integer(version.intValue() + 1);
|
||||
version = version + 1;
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
@Override
|
||||
public String toString() {
|
||||
return ClassUtils.getShortName(getClass()) + ": id=" + getId();
|
||||
}
|
||||
@@ -94,6 +94,7 @@ public class Entity implements Serializable {
|
||||
*
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == this) {
|
||||
return true;
|
||||
|
||||
@@ -78,7 +78,7 @@ public class SimpleMethodInvoker implements MethodInvoker {
|
||||
public Object invokeMethod(Object... args) {
|
||||
|
||||
Class<?>[] parameterTypes = method.getParameterTypes();
|
||||
Object[] invokeArgs = new Object[parameterTypes.length];
|
||||
Object[] invokeArgs;
|
||||
if(parameterTypes.length == 0){
|
||||
invokeArgs = new Object[]{};
|
||||
}
|
||||
|
||||
@@ -41,10 +41,10 @@ public class SimpleJvmExitCodeMapper implements ExitCodeMapper {
|
||||
|
||||
public SimpleJvmExitCodeMapper() {
|
||||
mapping = new HashMap<String, Integer>();
|
||||
mapping.put(ExitStatus.FINISHED.getExitCode(), new Integer(JVM_EXITCODE_COMPLETED));
|
||||
mapping.put(ExitStatus.FAILED.getExitCode(), new Integer(JVM_EXITCODE_GENERIC_ERROR));
|
||||
mapping.put(ExitCodeMapper.JOB_NOT_PROVIDED, new Integer(JVM_EXITCODE_JOB_ERROR));
|
||||
mapping.put(ExitCodeMapper.NO_SUCH_JOB, new Integer(JVM_EXITCODE_JOB_ERROR));
|
||||
mapping.put(ExitStatus.FINISHED.getExitCode(), JVM_EXITCODE_COMPLETED);
|
||||
mapping.put(ExitStatus.FAILED.getExitCode(), JVM_EXITCODE_GENERIC_ERROR);
|
||||
mapping.put(ExitCodeMapper.JOB_NOT_PROVIDED, JVM_EXITCODE_JOB_ERROR);
|
||||
mapping.put(ExitCodeMapper.NO_SUCH_JOB, JVM_EXITCODE_JOB_ERROR);
|
||||
}
|
||||
|
||||
public Map<String, Integer> getMapping() {
|
||||
|
||||
@@ -114,7 +114,7 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements
|
||||
|
||||
jobExecution.incrementVersion();
|
||||
|
||||
jobExecution.setId(new Long(jobExecutionIncrementer.nextLongValue()));
|
||||
jobExecution.setId(jobExecutionIncrementer.nextLongValue());
|
||||
Object[] parameters = new Object[] { jobExecution.getId(), jobExecution.getJobId(),
|
||||
jobExecution.getStartTime(), jobExecution.getEndTime(), jobExecution.getStatus().toString(),
|
||||
jobExecution.getExitStatus().getExitCode(), jobExecution.getExitStatus().getExitDescription(),
|
||||
@@ -278,7 +278,7 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements
|
||||
}
|
||||
|
||||
public JobExecution mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
Long id = new Long(rs.getLong(1));
|
||||
Long id = rs.getLong(1);
|
||||
JobExecution jobExecution;
|
||||
|
||||
if (jobInstance == null) {
|
||||
|
||||
@@ -82,7 +82,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
|
||||
|
||||
Assert.state(getJobInstance(jobName, jobParameters) == null, "JobInstance must not already exist");
|
||||
|
||||
Long jobId = new Long(jobIncrementer.nextLongValue());
|
||||
Long jobId = jobIncrementer.nextLongValue();
|
||||
|
||||
JobInstance jobInstance = new JobInstance(jobId, jobParameters, jobName);
|
||||
jobInstance.incrementVersion();
|
||||
@@ -131,16 +131,16 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
|
||||
Types.BIGINT, Types.DOUBLE };
|
||||
|
||||
if (type == ParameterType.STRING) {
|
||||
args = new Object[] { jobId, key, type, value, new Timestamp(0L), new Long(0), new Double(0) };
|
||||
args = new Object[] { jobId, key, type, value, new Timestamp(0L), 0L, 0D };
|
||||
}
|
||||
else if (type == ParameterType.LONG) {
|
||||
args = new Object[] { jobId, key, type, "", new Timestamp(0L), value, new Double(0) };
|
||||
}
|
||||
else if (type == ParameterType.DOUBLE) {
|
||||
args = new Object[] { jobId, key, type, "", new Timestamp(0L), new Long(0), value };
|
||||
args = new Object[] { jobId, key, type, "", new Timestamp(0L), 0L, value };
|
||||
}
|
||||
else if (type == ParameterType.DATE) {
|
||||
args = new Object[] { jobId, key, type, "", value, new Long(0), new Double(0) };
|
||||
args = new Object[] { jobId, key, type, "", value, 0L, 0D };
|
||||
}
|
||||
|
||||
getJdbcTemplate().getJdbcOperations().update(getQuery(CREATE_JOB_PARAMETERS), args, argTypes);
|
||||
@@ -317,7 +317,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
|
||||
if(jobParameters == null){
|
||||
jobParameters = getJobParameters(id);
|
||||
}
|
||||
JobInstance jobInstance = new JobInstance(new Long(rs.getLong(1)), jobParameters, rs.getString(2));
|
||||
JobInstance jobInstance = new JobInstance(rs.getLong(1), jobParameters, rs.getString(2));
|
||||
// should always be at version=0 because they never get updated
|
||||
jobInstance.incrementVersion();
|
||||
return jobInstance;
|
||||
|
||||
Reference in New Issue
Block a user