Refine contribution #4167

The documentation generation change introduced
in #4167 seems to scan more files than previously
WRT checking the code formatting style.

This commit fixes the formatting of the files
that do not conform to the Spring style.
This commit is contained in:
Mahmoud Ben Hassine
2022-08-21 09:52:35 +02:00
parent f89aa20861
commit fe40370f39
12 changed files with 167 additions and 167 deletions

View File

@@ -538,15 +538,15 @@ public class CommandLineJobRunner {
}
else {
switch (count) {
case 0:
jobPath = arg;
break;
case 1:
jobIdentifier = arg;
break;
default:
params.add(arg);
break;
case 0:
jobPath = arg;
break;
case 1:
jobIdentifier = arg;
break;
default:
params.add(arg);
break;
}
count++;
}

View File

@@ -185,22 +185,22 @@ public class Jackson2ExecutionContextStringSerializer implements ExecutionContex
JsonNode value = node.get(VALUE_KEY_NAME);
Object parameterValue;
switch (JobParameter.ParameterType.valueOf(type)) {
case STRING: {
parameterValue = value.asText();
return new JobParameter((String) parameterValue, identifying);
}
case DATE: {
parameterValue = new Date(value.get(1).asLong());
return new JobParameter((Date) parameterValue, identifying);
}
case LONG: {
parameterValue = value.get(1).asLong();
return new JobParameter((Long) parameterValue, identifying);
}
case DOUBLE: {
parameterValue = value.asDouble();
return new JobParameter((Double) parameterValue, identifying);
}
case STRING: {
parameterValue = value.asText();
return new JobParameter((String) parameterValue, identifying);
}
case DATE: {
parameterValue = new Date(value.get(1).asLong());
return new JobParameter((Date) parameterValue, identifying);
}
case LONG: {
parameterValue = value.get(1).asLong();
return new JobParameter((Long) parameterValue, identifying);
}
case DOUBLE: {
parameterValue = value.asDouble();
return new JobParameter((Double) parameterValue, identifying);
}
}
return null;
}

View File

@@ -174,27 +174,27 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
Integer[] parameterTypes = (Integer[]) parameters.get(1);
for (int indx = 0; indx < parameterValues.length; indx++) {
switch (parameterTypes[indx]) {
case Types.INTEGER:
ps.setInt(indx + 1, (Integer) parameterValues[indx]);
break;
case Types.VARCHAR:
ps.setString(indx + 1, (String) parameterValues[indx]);
break;
case Types.TIMESTAMP:
if (parameterValues[indx] != null) {
ps.setTimestamp(indx + 1,
new Timestamp(((java.util.Date) parameterValues[indx]).getTime()));
}
else {
ps.setNull(indx + 1, Types.TIMESTAMP);
}
break;
case Types.BIGINT:
ps.setLong(indx + 1, (Long) parameterValues[indx]);
break;
default:
throw new IllegalArgumentException(
"unsupported SQL parameter type for step execution field index " + i);
case Types.INTEGER:
ps.setInt(indx + 1, (Integer) parameterValues[indx]);
break;
case Types.VARCHAR:
ps.setString(indx + 1, (String) parameterValues[indx]);
break;
case Types.TIMESTAMP:
if (parameterValues[indx] != null) {
ps.setTimestamp(indx + 1,
new Timestamp(((java.util.Date) parameterValues[indx]).getTime()));
}
else {
ps.setNull(indx + 1, Types.TIMESTAMP);
}
break;
case Types.BIGINT:
ps.setLong(indx + 1, (Long) parameterValues[indx]);
break;
default:
throw new IllegalArgumentException(
"unsupported SQL parameter type for step execution field index " + i);
}
}
}

View File

@@ -37,7 +37,7 @@ class ChunkContextTests {
private final ChunkContext context = new ChunkContext(new StepContext(new JobExecution(new JobInstance(0L, "job"),
1L, new JobParameters(Collections.singletonMap("foo", new JobParameter("bar"))))
.createStepExecution("foo")));
.createStepExecution("foo")));
@Test
void testGetStepContext() {

View File

@@ -252,26 +252,26 @@ public class ExtendedConnectionDataSourceProxy implements SmartDataSource, Initi
// Invocation on ConnectionProxy interface coming in...
switch (method.getName()) {
case "equals":
// Only consider equal when proxies are identical.
return (proxy == args[0] ? Boolean.TRUE : Boolean.FALSE);
case "hashCode":
// Use hashCode of Connection proxy.
return System.identityHashCode(proxy);
case "close":
// Handle close method: don't pass the call on if we are
// suppressing close calls.
if (dataSource.completeCloseCall((Connection) proxy)) {
return null;
}
else {
target.close();
return null;
}
case "getTargetConnection":
// Handle getTargetConnection method: return underlying
// Connection.
return this.target;
case "equals":
// Only consider equal when proxies are identical.
return (proxy == args[0] ? Boolean.TRUE : Boolean.FALSE);
case "hashCode":
// Use hashCode of Connection proxy.
return System.identityHashCode(proxy);
case "close":
// Handle close method: don't pass the call on if we are
// suppressing close calls.
if (dataSource.completeCloseCall((Connection) proxy)) {
return null;
}
else {
target.close();
return null;
}
case "getTargetConnection":
// Handle getTargetConnection method: return underlying
// Connection.
return this.target;
}
// Invoke method on target Connection.

View File

@@ -336,45 +336,45 @@ public class JdbcPagingItemReaderBuilder<T> {
switch (databaseType) {
case DERBY:
provider = new DerbyPagingQueryProvider();
break;
case DB2:
case DB2VSE:
case DB2ZOS:
case DB2AS400:
provider = new Db2PagingQueryProvider();
break;
case H2:
provider = new H2PagingQueryProvider();
break;
case HANA:
provider = new HanaPagingQueryProvider();
break;
case HSQL:
provider = new HsqlPagingQueryProvider();
break;
case SQLSERVER:
provider = new SqlServerPagingQueryProvider();
break;
case MYSQL:
provider = new MySqlPagingQueryProvider();
break;
case ORACLE:
provider = new OraclePagingQueryProvider();
break;
case POSTGRES:
provider = new PostgresPagingQueryProvider();
break;
case SYBASE:
provider = new SybasePagingQueryProvider();
break;
case SQLITE:
provider = new SqlitePagingQueryProvider();
break;
default:
throw new IllegalArgumentException(
"Unable to determine PagingQueryProvider type " + "from database type: " + databaseType);
case DERBY:
provider = new DerbyPagingQueryProvider();
break;
case DB2:
case DB2VSE:
case DB2ZOS:
case DB2AS400:
provider = new Db2PagingQueryProvider();
break;
case H2:
provider = new H2PagingQueryProvider();
break;
case HANA:
provider = new HanaPagingQueryProvider();
break;
case HSQL:
provider = new HsqlPagingQueryProvider();
break;
case SQLSERVER:
provider = new SqlServerPagingQueryProvider();
break;
case MYSQL:
provider = new MySqlPagingQueryProvider();
break;
case ORACLE:
provider = new OraclePagingQueryProvider();
break;
case POSTGRES:
provider = new PostgresPagingQueryProvider();
break;
case SYBASE:
provider = new SybasePagingQueryProvider();
break;
case SQLITE:
provider = new SqlitePagingQueryProvider();
break;
default:
throw new IllegalArgumentException(
"Unable to determine PagingQueryProvider type " + "from database type: " + databaseType);
}
provider.setSelectClause(this.selectClause);

View File

@@ -130,14 +130,14 @@ public class User extends org.apache.avro.specific.SpecificRecordBase
// Used by DatumWriter. Applications should not call.
public Object get(int field$) {
switch (field$) {
case 0:
return name;
case 1:
return favorite_number;
case 2:
return favorite_color;
default:
throw new org.apache.avro.AvroRuntimeException("Bad index");
case 0:
return name;
case 1:
return favorite_number;
case 2:
return favorite_color;
default:
throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
@@ -145,17 +145,17 @@ public class User extends org.apache.avro.specific.SpecificRecordBase
@SuppressWarnings(value = "unchecked")
public void put(int field$, Object value$) {
switch (field$) {
case 0:
name = (CharSequence) value$;
break;
case 1:
favorite_number = (Integer) value$;
break;
case 2:
favorite_color = (CharSequence) value$;
break;
default:
throw new org.apache.avro.AvroRuntimeException("Bad index");
case 0:
name = (CharSequence) value$;
break;
case 1:
favorite_number = (Integer) value$;
break;
case 2:
favorite_color = (CharSequence) value$;
break;
default:
throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
@@ -510,33 +510,33 @@ public class User extends org.apache.avro.specific.SpecificRecordBase
else {
for (int i = 0; i < 3; i++) {
switch (fieldOrder[i].pos()) {
case 0:
this.name = in.readString(this.name instanceof Utf8 ? (Utf8) this.name : null);
break;
case 0:
this.name = in.readString(this.name instanceof Utf8 ? (Utf8) this.name : null);
break;
case 1:
if (in.readIndex() != 0) {
in.readNull();
this.favorite_number = null;
}
else {
this.favorite_number = in.readInt();
}
break;
case 1:
if (in.readIndex() != 0) {
in.readNull();
this.favorite_number = null;
}
else {
this.favorite_number = in.readInt();
}
break;
case 2:
if (in.readIndex() != 0) {
in.readNull();
this.favorite_color = null;
}
else {
this.favorite_color = in
.readString(this.favorite_color instanceof Utf8 ? (Utf8) this.favorite_color : null);
}
break;
case 2:
if (in.readIndex() != 0) {
in.readNull();
this.favorite_color = null;
}
else {
this.favorite_color = in.readString(
this.favorite_color instanceof Utf8 ? (Utf8) this.favorite_color : null);
}
break;
default:
throw new java.io.IOException("Corrupt ResolvingDecoder.");
default:
throw new java.io.IOException("Corrupt ResolvingDecoder.");
}
}
}

View File

@@ -142,7 +142,7 @@ class Neo4jItemReaderTests {
when(this.sessionFactory.openSession()).thenReturn(this.session);
when(this.session.query(String.class,
"START n=node(*) MATCH n -- m WHERE has(n.name) RETURN m ORDER BY n.age SKIP 0 LIMIT 50", null))
.thenReturn(result);
.thenReturn(result);
when(result.iterator()).thenReturn(Arrays.asList("foo", "bar", "baz").iterator());
assertTrue(itemReader.doPageRead().hasNext());
@@ -162,7 +162,7 @@ class Neo4jItemReaderTests {
when(this.sessionFactory.openSession()).thenReturn(this.session);
when(this.session.query(String.class,
"START n=node(*) MATCH n -- m WHERE has(n.name) RETURN m ORDER BY n.age SKIP 0 LIMIT 50", params))
.thenReturn(result);
.thenReturn(result);
when(result.iterator()).thenReturn(Arrays.asList("foo", "bar", "baz").iterator());
assertTrue(itemReader.doPageRead().hasNext());

View File

@@ -59,7 +59,7 @@ class Neo4jItemReaderBuilderTests {
when(this.sessionFactory.openSession()).thenReturn(this.session);
when(this.session.query(String.class,
"START n=node(*) MATCH n -- m WHERE has(n.name) RETURN m ORDER BY n.age SKIP 0 LIMIT 50", null))
.thenReturn(result);
.thenReturn(result);
when(result.iterator()).thenReturn(Arrays.asList("foo", "bar", "baz").iterator());
assertEquals("foo", itemReader.read(), "The expected value was not returned by reader.");
@@ -94,7 +94,7 @@ class Neo4jItemReaderBuilderTests {
when(this.sessionFactory.openSession()).thenReturn(this.session);
when(this.session.query(String.class,
"START n=node(*) MATCH n -- m WHERE has(n.name) RETURN m ORDER BY n.age SKIP 0 LIMIT 50", params))
.thenReturn(result);
.thenReturn(result);
when(result.iterator()).thenReturn(Arrays.asList("foo", "bar", "baz").iterator());
assertEquals("foo", itemReader.read(), "The expected value was not returned by reader.");

View File

@@ -120,7 +120,7 @@ public class JdbcBatchItemWriterNamedParameterTests {
when(namedParameterJdbcOperations.batchUpdate(eq(sql),
eqSqlParameterSourceArray(
new SqlParameterSource[] { new BeanPropertySqlParameterSource(new Foo("bar")) })))
.thenReturn(new int[] { 1 });
.thenReturn(new int[] { 1 });
writer.write(Chunk.of(new Foo("bar")));
}
@@ -172,7 +172,7 @@ public class JdbcBatchItemWriterNamedParameterTests {
when(namedParameterJdbcOperations.batchUpdate(eq(sql),
eqSqlParameterSourceArray(
new SqlParameterSource[] { new BeanPropertySqlParameterSource(new Foo("bar")) })))
.thenReturn(new int[] { 0 });
.thenReturn(new int[] { 0 });
Exception exception = assertThrows(EmptyResultDataAccessException.class,
() -> writer.write(Chunk.of(new Foo("bar"))));
String message = exception.getMessage();
@@ -185,7 +185,7 @@ public class JdbcBatchItemWriterNamedParameterTests {
when(namedParameterJdbcOperations.batchUpdate(eq(sql),
eqSqlParameterSourceArray(
new SqlParameterSource[] { new BeanPropertySqlParameterSource(new Foo("bar")) })))
.thenThrow(ex);
.thenThrow(ex);
Exception exception = assertThrows(RuntimeException.class, () -> writer.write(Chunk.of(new Foo("bar"))));
assertEquals("ERROR", exception.getMessage());
}

View File

@@ -159,7 +159,7 @@ class RemoteChunkingManagerStepBuilderTests {
// given
RemoteChunkingManagerStepBuilder<String, String> builder = new RemoteChunkingManagerStepBuilder<String, String>(
"step").inputChannel(this.inputChannel).outputChannel(new DirectChannel())
.messagingTemplate(new MessagingTemplate());
.messagingTemplate(new MessagingTemplate());
// when
final Exception expectedException = assertThrows(IllegalStateException.class, builder::build);

View File

@@ -36,16 +36,16 @@ class AggregateItemReaderTests {
@Override
public AggregateItem<String> read() {
switch (count++) {
case 0:
return AggregateItem.getHeader();
case 1:
case 2:
case 3:
return new AggregateItem<>("line");
case 4:
return AggregateItem.getFooter();
default:
return null;
case 0:
return AggregateItem.getHeader();
case 1:
case 2:
case 3:
return new AggregateItem<>("line");
case 4:
return AggregateItem.getFooter();
default:
return null;
}
}