diff --git a/core/src/main/java/org/apache/carbondata/core/reader/ThriftReader.java b/core/src/main/java/org/apache/carbondata/core/reader/ThriftReader.java index d0873237a68..0a54adb73bd 100644 --- a/core/src/main/java/org/apache/carbondata/core/reader/ThriftReader.java +++ b/core/src/main/java/org/apache/carbondata/core/reader/ThriftReader.java @@ -31,6 +31,7 @@ import org.apache.thrift.protocol.TCompactProtocol; import org.apache.thrift.protocol.TProtocol; import org.apache.thrift.transport.TIOStreamTransport; +import org.apache.thrift.transport.TTransportException; /** * A simple class for reading Thrift objects (of a single type) from a fileName. @@ -89,7 +90,11 @@ public ThriftReader(String fileName, Configuration configuration) { */ public ThriftReader(byte[] fileData) { dataInputStream = new DataInputStream(new ByteArrayInputStream(fileData)); - binaryIn = new TCompactProtocol(new TIOStreamTransport(dataInputStream)); + try { + binaryIn = new TCompactProtocol(new TIOStreamTransport(dataInputStream)); + } catch (TTransportException e) { + throw new RuntimeException(e); + } } /** @@ -98,7 +103,11 @@ public ThriftReader(byte[] fileData) { public void open() throws IOException { Configuration conf = configuration != null ? configuration : FileFactory.getConfiguration(); dataInputStream = FileFactory.getDataInputStream(fileName, conf); - binaryIn = new TCompactProtocol(new TIOStreamTransport(dataInputStream)); + try { + binaryIn = new TCompactProtocol(new TIOStreamTransport(dataInputStream)); + } catch (TTransportException e) { + throw new IOException(e); + } } /** diff --git a/core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java b/core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java index 19040cf84ea..bf01c81795f 100644 --- a/core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java +++ b/core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java @@ -1413,8 +1413,8 @@ public static String convertToString(List values) { public static byte[] getByteArray(TBase t) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); byte[] thriftByteArray = null; - TProtocol binaryOut = new TCompactProtocol(new TIOStreamTransport(stream)); try { + TProtocol binaryOut = new TCompactProtocol(new TIOStreamTransport(stream)); t.write(binaryOut); stream.flush(); thriftByteArray = stream.toByteArray(); @@ -1439,9 +1439,9 @@ public static DataChunk3 readDataChunk3(ByteBuffer dataChunkBuffer, int offset, public static DataChunk3 readDataChunk3(InputStream stream) throws IOException { TBaseCreator creator = DataChunk3::new; - TProtocol binaryIn = new TCompactProtocol(new TIOStreamTransport(stream)); TBase t = creator.create(); try { + TProtocol binaryIn = new TCompactProtocol(new TIOStreamTransport(stream)); t.read(binaryIn); } catch (TException e) { throw new IOException(e); @@ -1461,9 +1461,9 @@ public static DataChunk3 readDataChunk3(InputStream stream) throws IOException { private static TBase read(byte[] data, TBaseCreator creator, int offset, int length) throws IOException { ByteArrayInputStream stream = new ByteArrayInputStream(data, offset, length); - TProtocol binaryIn = new TCompactProtocol(new TIOStreamTransport(stream)); TBase t = creator.create(); try { + TProtocol binaryIn = new TCompactProtocol(new TIOStreamTransport(stream)); t.read(binaryIn); } catch (TException e) { throw new IOException(e); diff --git a/core/src/main/java/org/apache/carbondata/core/writer/ThriftWriter.java b/core/src/main/java/org/apache/carbondata/core/writer/ThriftWriter.java index 3314aaf9eb9..bff7eee5746 100644 --- a/core/src/main/java/org/apache/carbondata/core/writer/ThriftWriter.java +++ b/core/src/main/java/org/apache/carbondata/core/writer/ThriftWriter.java @@ -31,6 +31,7 @@ import org.apache.thrift.protocol.TCompactProtocol; import org.apache.thrift.protocol.TProtocol; import org.apache.thrift.transport.TIOStreamTransport; +import org.apache.thrift.transport.TTransportException; /** * Simple class that makes it easy to write Thrift objects to disk. @@ -80,7 +81,11 @@ public ThriftWriter(String fileName, boolean append) { */ public void open() throws IOException { dataOutputStream = FileFactory.getDataOutputStream(fileName, bufferSize, append); - binaryOut = new TCompactProtocol(new TIOStreamTransport(dataOutputStream)); + try { + binaryOut = new TCompactProtocol(new TIOStreamTransport(dataOutputStream)); + } catch (TTransportException e) { + throw new IOException(e); + } } /** @@ -92,7 +97,11 @@ public void open() throws IOException { public void open(FileWriteOperation fileWriteOperation) throws IOException { atomicFileOperationsWriter = AtomicFileOperationFactory.getAtomicFileOperations(fileName); dataOutputStream = atomicFileOperationsWriter.openForWrite(fileWriteOperation); - binaryOut = new TCompactProtocol(new TIOStreamTransport(dataOutputStream)); + try { + binaryOut = new TCompactProtocol(new TIOStreamTransport(dataOutputStream)); + } catch (TTransportException e) { + throw new IOException(e); + } } /** diff --git a/format/pom.xml b/format/pom.xml index 2ba968977c0..143213f659a 100644 --- a/format/pom.xml +++ b/format/pom.xml @@ -37,7 +37,12 @@ org.apache.thrift libthrift - 0.9.3 + 0.20.0 + + + javax.annotation + javax.annotation-api + 1.3.2 @@ -77,4 +82,4 @@ - \ No newline at end of file + diff --git a/pom.xml b/pom.xml index 804b0c8f2f2..de26e2b762d 100644 --- a/pom.xml +++ b/pom.xml @@ -122,6 +122,8 @@ UTF-8 + 8 + 8 1.1.2.6 2.7.2 4.3.4