You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by dk...@apache.org on 2020/05/21 15:27:40 UTC

[avro] branch master updated (7347e25 -> 8c15c12)

This is an automated email from the ASF dual-hosted git repository.

dkulp pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git.


    from 7347e25  AVRO-2648: Incorrect validation of numeric default values
     new cb0d6e8  AVRO-2762:Unkown resource closed
     new 8c15c12  Improve comments

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/avro/file/DataFileReader.java  | 34 ++++++++++++++++++----
 1 file changed, 29 insertions(+), 5 deletions(-)


[avro] 01/02: AVRO-2762:Unkown resource closed

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dkulp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git

commit cb0d6e88a4f0c985a2ecceab3be77dadd874e3cb
Author: zeshuai007 <51...@qq.com>
AuthorDate: Wed Feb 26 15:07:24 2020 +0800

    AVRO-2762:Unkown resource closed
---
 .../src/main/java/org/apache/avro/file/DataFileReader.java     | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java
index 280511b..dc4206c 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java
@@ -32,7 +32,7 @@ import static org.apache.avro.file.DataFileConstants.MAGIC;
 
 /**
  * Random access to files written with {@link DataFileWriter}.
- * 
+ *
  * @see DataFileWriter
  */
 public class DataFileReader<D> extends DataFileStream<D> implements FileReader<D> {
@@ -73,7 +73,7 @@ public class DataFileReader<D> extends DataFileStream<D> implements FileReader<D
   /**
    * Construct a reader for a file at the current position of the input, without
    * reading the header.
-   * 
+   *
    * @param sync True to read forward to the next sync point after opening, false
    *             to assume that the input is already at a valid sync point.
    */
@@ -88,17 +88,17 @@ public class DataFileReader<D> extends DataFileStream<D> implements FileReader<D
     return dreader;
   }
 
-  /** Construct a reader for a file. */
+  /** Construct a reader for a file. Please close resource files yourself. */
   public DataFileReader(File file, DatumReader<D> reader) throws IOException {
     this(new SeekableFileInput(file), reader, true);
   }
 
-  /** Construct a reader for a file. */
+  /** Construct a reader for a file. Please close resource files yourself. */
   public DataFileReader(SeekableInput sin, DatumReader<D> reader) throws IOException {
     this(sin, reader, false);
   }
 
-  /** Construct a reader for a file. */
+  /** Construct a reader for a file. Please close resource files yourself. */
   protected DataFileReader(SeekableInput sin, DatumReader<D> reader, boolean closeOnError) throws IOException {
     super(reader);
     try {


[avro] 02/02: Improve comments

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dkulp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git

commit 8c15c1241fb52f3ce6eb480bbe16ff70d3bc426a
Author: zeshuai007 <51...@qq.com>
AuthorDate: Thu Mar 5 10:27:52 2020 +0800

    Improve comments
---
 .../java/org/apache/avro/file/DataFileReader.java  | 28 ++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java
index dc4206c..3c343f2 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java
@@ -88,12 +88,36 @@ public class DataFileReader<D> extends DataFileStream<D> implements FileReader<D
     return dreader;
   }
 
-  /** Construct a reader for a file. Please close resource files yourself. */
+  /**
+   * Construct a reader for a file. For example,if you want to read a file
+   * record,you need to close the resource. You can use try-with-resource as
+   * follows:
+   * 
+   * <pre>
+   * try (FileReader<User> dataFileReader =
+   * DataFileReader.openReader(file,datumReader)) { //Consume the reader } catch
+   * (IOException e) { throw new RunTimeIOException(e,"Failed to read metadata for
+   * file: %s", file); }
+   * 
+   * <pre/>
+   */
   public DataFileReader(File file, DatumReader<D> reader) throws IOException {
     this(new SeekableFileInput(file), reader, true);
   }
 
-  /** Construct a reader for a file. Please close resource files yourself. */
+  /**
+   * Construct a reader for a file. For example,if you want to read a file
+   * record,you need to close the resource. You can use try-with-resource as
+   * follows:
+   * 
+   * <pre>
+   * try (FileReader<User> dataFileReader =
+   * DataFileReader.openReader(file,datumReader)) { //Consume the reader } catch
+   * (IOException e) { throw new RunTimeIOException(e,"Failed to read metadata for
+   * file: %s", file); }
+   * 
+   * <pre/>
+   */
   public DataFileReader(SeekableInput sin, DatumReader<D> reader) throws IOException {
     this(sin, reader, false);
   }