Skip to content
This repository was archived by the owner on Apr 4, 2019. It is now read-only.
Open
Show file tree
Hide file tree
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 @@ -18,7 +18,6 @@

import org.apache.calcite.avatica.ColumnMetaData;

import java.io.Closeable;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
Expand All @@ -41,7 +40,7 @@
* Interface to an iteration that is similar to, and can easily support,
* a JDBC {@link java.sql.ResultSet}, but is simpler to implement.
*/
public interface Cursor extends Closeable {
public interface Cursor extends AutoCloseable {
/**
* Creates a list of accessors, one per column.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
*/
package org.apache.calcite.avatica.util;

import java.io.Closeable;
import java.io.IOException;
import java.util.Iterator;
import java.util.NoSuchElementException;

Expand Down Expand Up @@ -57,10 +55,12 @@ public boolean next() {
public void close() {
current = null;
position = Position.CLOSED;
if (iterator instanceof Closeable) {
if (iterator instanceof AutoCloseable) {
try {
((Closeable) iterator).close();
} catch (IOException e) {
((AutoCloseable) iterator).close();
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Expand Down
Loading