diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/ResourcesItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/ResourcesItemReader.java index 30e9df74c..372c8b90b 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/ResourcesItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/ResourcesItemReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2018 the original author or authors. + * Copyright 2009-2021 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. @@ -48,6 +48,8 @@ import java.util.concurrent.atomic.AtomicInteger; */ public class ResourcesItemReader extends AbstractItemStreamItemReader { + private static final String COUNT_KEY = "COUNT"; + private Resource[] resources = new Resource[0]; private AtomicInteger counter = new AtomicInteger(0); @@ -85,13 +87,13 @@ public class ResourcesItemReader extends AbstractItemStreamItemReader @Override public void open(ExecutionContext executionContext) throws ItemStreamException { super.open(executionContext); - counter.set(executionContext.getInt(getExecutionContextKey("COUNT"), 0)); + counter.set(executionContext.getInt(getExecutionContextKey(COUNT_KEY), 0)); } @Override public void update(ExecutionContext executionContext) throws ItemStreamException { super.update(executionContext); - executionContext.putInt(getExecutionContextKey("COUNT"), counter.get()); + executionContext.putInt(getExecutionContextKey(COUNT_KEY), counter.get()); } }