File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
core/src/main/java/org/apache/spark/io Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -83,13 +83,11 @@ public synchronized int read() throws IOException {
8383
8484 @ Override
8585 public synchronized int read (byte [] b , int offset , int len ) throws IOException {
86- if (!refill ()) {
87- return -1 ;
88- }
8986 if ((offset | len | (offset + len ) | (b .length - (offset + len ))) < 0 ) {
9087 throw new IndexOutOfBoundsException ();
91- } else if (len == 0 ) {
92- return 0 ;
88+ }
89+ if (!refill ()) {
90+ return -1 ;
9391 }
9492 len = Math .min (len , byteBuffer .remaining ());
9593 byteBuffer .get (b , offset , len );
@@ -132,8 +130,13 @@ private long skipFromFileChannel(long n) throws IOException {
132130 }
133131
134132 @ Override
135- public void close () throws IOException {
133+ public synchronized void close () throws IOException {
136134 fileChannel .close ();
137135 StorageUtils .dispose (byteBuffer );
138136 }
137+
138+ @ Override
139+ protected void finalize () throws IOException {
140+ close ();
141+ }
139142}
You can’t perform that action at this time.
0 commit comments