Skip to content

Commit

Permalink
fix sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
qiaojialin committed Mar 12, 2020
1 parent 5bb734b commit 351cb50
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Expand Up @@ -107,7 +107,6 @@ private void putExceptionBatchData(Exception e, String logMessage) {
reader.setHasRemaining(false);
blockingQueue.put(new ExceptionBatchData(e));
} catch (InterruptedException ex) {
ex.printStackTrace();
LOGGER.error("Interrupted while putting ExceptionBatchData into the blocking queue: ", ex);
Thread.currentThread().interrupt();
}
Expand Down Expand Up @@ -356,11 +355,11 @@ private void fillCache(int seriesIndex) throws IOException, InterruptedException
} else if (batchData instanceof ExceptionBatchData) {
// exception happened in producer thread
ExceptionBatchData exceptionBatchData = (ExceptionBatchData) batchData;
LOGGER.error("exception happened in producer thread", exceptionBatchData.exception);
if (exceptionBatchData.exception instanceof IOException) {
throw (IOException)exceptionBatchData.exception;
} else if (exceptionBatchData.exception instanceof RuntimeException) {
throw (RuntimeException)exceptionBatchData.exception;
LOGGER.error("exception happened in producer thread", exceptionBatchData.getException());
if (exceptionBatchData.getException() instanceof IOException) {
throw (IOException)exceptionBatchData.getException();
} else if (exceptionBatchData.getException() instanceof RuntimeException) {
throw (RuntimeException)exceptionBatchData.getException();
}

} else { // there are more batch data in this time series queue
Expand Down
Expand Up @@ -20,7 +20,7 @@

public class ExceptionBatchData extends BatchData {

public Exception exception;
private Exception exception;

public ExceptionBatchData(Exception exception) {
this.exception = exception;
Expand All @@ -30,4 +30,8 @@ public ExceptionBatchData(Exception exception) {
public boolean hasCurrent() {
throw new UnsupportedOperationException("hasCurrent is not supported for ExceptionBatchData");
}

public Exception getException() {
return exception;
}
}

0 comments on commit 351cb50

Please sign in to comment.