Skip to content

Commit b8b7c57

Browse files
committed
PooledHttpTransportFactory borrow method should not swallow exception info
Exception info should be wrapped and rethrown. Fixes #1191
1 parent f3bd8ca commit b8b7c57

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

mr/src/main/java/org/elasticsearch/hadoop/rest/pooling/PooledHttpTransportFactory.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,16 @@ private TransportPool getOrCreateTransportPool(String hostInfo, Settings setting
100100
*/
101101
private Transport borrowFrom(TransportPool pool, String hostInfo) {
102102
if (!pool.getJobPoolingKey().equals(jobKey)) {
103-
throw new EsHadoopIllegalArgumentException("PooledTransportFactory found a pool with a different owner than this job. This could be a different job incorrectly polluting the TransportPool. Bailing out...");
103+
throw new EsHadoopIllegalArgumentException("PooledTransportFactory found a pool with a different owner than this job. " +
104+
"This could be a different job incorrectly polluting the TransportPool. Bailing out...");
104105
}
105106
try {
106107
return pool.borrowTransport();
107-
} catch (Exception e) {
108-
throw new EsHadoopException(String.format("Could not get a Transport from the Transport Pool for host [%s]", hostInfo));
108+
} catch (Exception ex) {
109+
throw new EsHadoopException(
110+
String.format("Could not get a Transport from the Transport Pool for host [%s]", hostInfo),
111+
ex
112+
);
109113
}
110114
}
111115

0 commit comments

Comments
 (0)