Skip to content

Commit

Permalink
[hotfix] Refactor to use multi-catch
Browse files Browse the repository at this point in the history
This closes apache#3866
  • Loading branch information
rbonifacio authored and greghogan committed May 11, 2017
1 parent 3ee8c69 commit 7040987
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ public void open(int taskNumber, int numTasks) throws IOException {
datumWriter = new SpecificDatumWriter<E>(avroValueType);
try {
schema = ((org.apache.avro.specific.SpecificRecordBase)avroValueType.newInstance()).getSchema();
} catch (InstantiationException e) {
throw new RuntimeException(e.getMessage());
} catch (IllegalAccessException e) {
} catch (InstantiationException | IllegalAccessException e) {
throw new RuntimeException(e.getMessage());
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,7 @@ private PojoComparator(PojoComparator<T> toClone) {
try {
this.serializer = (TypeSerializer<T>) InstantiationUtil.deserializeObject(
InstantiationUtil.serializeObject(toClone.serializer), Thread.currentThread().getContextClassLoader());
} catch (IOException e) {
throw new RuntimeException("Cannot copy serializer", e);
} catch (ClassNotFoundException e) {
} catch (IOException | ClassNotFoundException e) {
throw new RuntimeException("Cannot copy serializer", e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ public BlockingBackChannel(SerializedUpdateBuffer buffer) {
public DataInputView getReadEndAfterSuperstepEnded() {
try {
return queue.take().switchBuffers();
} catch (InterruptedException e) {
throw new RuntimeException(e);
} catch (IOException e) {
} catch (InterruptedException | IOException e) {
throw new RuntimeException(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,8 @@ private long insertRecordIntoPartition(T record, InMemoryPartition<T> partition,
this.compactionMemory.allocateSegments((int)(newPointer >> this.pageSizeInBits));
}
return newPointer;
}
catch (EOFException ex) {
throw new RuntimeException("Memory ran out. Compaction failed. " +
getMemoryConsumptionString() + " Message: " + ex.getMessage());
}
catch (IndexOutOfBoundsException ex) {
}
catch (EOFException | IndexOutOfBoundsException ex) {
throw new RuntimeException("Memory ran out. Compaction failed. " +
getMemoryConsumptionString() + " Message: " + ex.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,7 @@ public void setStubWrapper(UserCodeWrapper<?> wrapper) {
public <T> UserCodeWrapper<T> getStubWrapper(ClassLoader cl) {
try {
return (UserCodeWrapper<T>) InstantiationUtil.readObjectFromConfig(this.config, STUB_OBJECT, cl);
} catch (ClassNotFoundException e) {
throw new CorruptConfigurationException("Could not read the user code wrapper: " + e.getMessage(), e);
} catch (IOException e) {
} catch (ClassNotFoundException | IOException e) {
throw new CorruptConfigurationException("Could not read the user code wrapper: " + e.getMessage(), e);
}
}
Expand Down

0 comments on commit 7040987

Please sign in to comment.