Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -549,16 +549,38 @@
@Override
public void close() throws IOException {
LOG.debug("Closing reader after reading {} records.", recordsReturned);
IOException thrown = null;
if (scanner != null) {
scanner.close();
scanner = null;
try {
scanner.close();
} catch (IOException e) {

Check failure on line 556 in sdks/java/io/hbase/src/main/java/org/apache/beam/sdk/io/hbase/HBaseIO.java

View workflow job for this annotation

GitHub Actions / beam_PreCommit_Java_HBase_IO_Direct (Run Java_HBase_IO_Direct PreCommit)

exception IOException is never thrown in body of corresponding try statement
thrown = e;
} finally {
scanner = null;
}
}
if (connection != null) {
connection.close();
connection = null;
try {
connection.close();
} catch (IOException e) {
thrown = addSuppressed(thrown, e);
} finally {
connection = null;
}
}
if (thrown != null) {
throw thrown;
}
}

private static IOException addSuppressed(IOException first, IOException next) {
if (first != null) {
first.addSuppressed(next);
return first;
}
return next;
}

@Override
public synchronized HBaseSource getCurrentSource() {
return source;
Expand Down Expand Up @@ -765,13 +787,34 @@

@Teardown
public void tearDown() throws Exception {
Exception thrown = null;
if (mutator != null) {
mutator.close();
mutator = null;
try {
mutator.close();
} catch (Exception e) {
thrown = e;
} finally {
mutator = null;
}
}
if (connection != null) {
connection.close();
connection = null;
try {
connection.close();
} catch (Exception e) {
if (thrown != null) {
thrown.addSuppressed(e);
} else {
thrown = e;
}
} finally {
connection = null;
}
}
if (thrown != null) {
if (thrown instanceof IOException) {
throw (IOException) thrown;
}
throw thrown;
}
}

Expand Down Expand Up @@ -930,13 +973,31 @@

@Teardown
public void tearDown() throws Exception {

Exception thrown = null;
if (table != null) {
table.close();
table = null;
try {
table.close();
} catch (Exception e) {
thrown = e;
} finally {
table = null;
}
}
try {
HBaseSharedConnection.close(configuration);
} catch (Exception e) {
if (thrown != null) {
thrown.addSuppressed(e);
} else {
thrown = e;
}
}
if (thrown != null) {
if (thrown instanceof IOException) {
throw (IOException) thrown;
}
throw thrown;
}

HBaseSharedConnection.close(configuration);
}

@ProcessElement
Expand Down
Loading