Skip to content

Commit de13c4d

Browse files
committed
Issue #279 : Improved error handling to catch NPE.
1 parent 5b9d519 commit de13c4d

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

stroom-core-server/src/main/java/stroom/streamtask/server/ProxyAggregationExecutor.java

+29-25
Original file line numberDiff line numberDiff line change
@@ -118,36 +118,40 @@ public void aggregate(final Task<?> task, final String proxyDir) {
118118

119119
public void aggregate(final Task<?> task, final String proxyDir, final Boolean aggregate,
120120
final Integer maxAggregation, final Long maxStreamSize) {
121-
this.task = task;
122-
if (proxyDir != null) {
123-
this.proxyDir = proxyDir;
124-
}
125-
this.aggregate = aggregate;
126-
if (maxAggregation != null) {
127-
stroomZipRepositoryProcessor.setMaxAggregation(maxAggregation);
128-
}
129-
if (maxStreamSize != null) {
130-
stroomZipRepositoryProcessor.setMaxStreamSize(maxStreamSize);
131-
}
121+
try {
122+
this.task = task;
123+
if (proxyDir != null) {
124+
this.proxyDir = proxyDir;
125+
}
126+
this.aggregate = aggregate;
127+
if (maxAggregation != null) {
128+
stroomZipRepositoryProcessor.setMaxAggregation(maxAggregation);
129+
}
130+
if (maxStreamSize != null) {
131+
stroomZipRepositoryProcessor.setMaxStreamSize(maxStreamSize);
132+
}
132133

133-
taskMonitor.addTerminateHandler(() -> stop());
134+
taskMonitor.addTerminateHandler(() -> stop());
134135

135-
final LogExecutionTime logExecutionTime = new LogExecutionTime();
136-
LOGGER.info("exec() - started");
136+
final LogExecutionTime logExecutionTime = new LogExecutionTime();
137+
LOGGER.info("exec() - started");
137138

138-
boolean complete = false;
139-
while (!complete && !taskMonitor.isTerminated()) {
140-
taskMonitor.info("Aggregate started %s, maxAggregation %s, maxAggregationScan %s, maxStreamSize %s",
141-
DateUtil.createNormalDateTimeString(System.currentTimeMillis()),
142-
ModelStringUtil.formatCsv(stroomZipRepositoryProcessor.getMaxAggregation()),
143-
ModelStringUtil.formatCsv(stroomZipRepositoryProcessor.getMaxFileScan()),
144-
ModelStringUtil.formatIECByteSizeString(stroomZipRepositoryProcessor.getMaxStreamSize()));
139+
boolean complete = false;
140+
while (!complete && !taskMonitor.isTerminated()) {
141+
taskMonitor.info("Aggregate started %s, maxAggregation %s, maxAggregationScan %s, maxStreamSize %s",
142+
DateUtil.createNormalDateTimeString(System.currentTimeMillis()),
143+
ModelStringUtil.formatCsv(stroomZipRepositoryProcessor.getMaxAggregation()),
144+
ModelStringUtil.formatCsv(stroomZipRepositoryProcessor.getMaxFileScan()),
145+
ModelStringUtil.formatIECByteSizeString(stroomZipRepositoryProcessor.getMaxStreamSize()));
145146

146-
final StroomZipRepository stroomZipRepository = new StroomZipRepository(this.proxyDir);
147-
complete = stroomZipRepositoryProcessor.process(stroomZipRepository);
148-
}
147+
final StroomZipRepository stroomZipRepository = new StroomZipRepository(this.proxyDir);
148+
complete = stroomZipRepositoryProcessor.process(stroomZipRepository);
149+
}
149150

150-
LOGGER.info("exec() - completed in %s", logExecutionTime);
151+
LOGGER.info("exec() - completed in %s", logExecutionTime);
152+
} catch (final Exception e) {
153+
LOGGER.error(e.getMessage(), e);
154+
}
151155
}
152156

153157
private List<StreamTargetStroomStreamHandler> openStreamHandlers(final Feed feed) {

0 commit comments

Comments
 (0)