You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ey...@apache.org on 2019/09/17 17:22:21 UTC

[hadoop] branch branch-3.1 updated: YARN-9837. Fixed reading YARN Service JSON spec file larger than 128k. Contributed by Tarun Parimi

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

eyang pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-3.1 by this push:
     new dae22c9  YARN-9837. Fixed reading YARN Service JSON spec file larger than 128k.            Contributed by Tarun Parimi
dae22c9 is described below

commit dae22c962df21f3371b9ad5ed377bc422c833c0e
Author: Eric Yang <ey...@apache.org>
AuthorDate: Tue Sep 17 13:13:35 2019 -0400

    YARN-9837. Fixed reading YARN Service JSON spec file larger than 128k.
               Contributed by Tarun Parimi
---
 .../org/apache/hadoop/yarn/service/utils/JsonSerDeser.java | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/JsonSerDeser.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/JsonSerDeser.java
index 2c27ea7..dbc152d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/JsonSerDeser.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/JsonSerDeser.java
@@ -20,7 +20,6 @@ package org.apache.hadoop.yarn.service.utils;
 
 import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.FSDataOutputStream;
-import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.IOUtils;
@@ -34,7 +33,6 @@ import org.codehaus.jackson.map.SerializationConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.EOFException;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
@@ -177,17 +175,9 @@ public class JsonSerDeser<T> {
    * @throws JsonParseException parse problems
    * @throws JsonMappingException O/J mapping problems
    */
-  public T load(FileSystem fs, Path path)
-    throws IOException, JsonParseException, JsonMappingException {
-    FileStatus status = fs.getFileStatus(path);
-    long len = status.getLen();
-    byte[] b = new byte[(int) len];
+  public T load(FileSystem fs, Path path) throws IOException {
     FSDataInputStream dataInputStream = fs.open(path);
-    int count = dataInputStream.read(b);
-    if (count != len) {
-      throw new EOFException("Read of " + path +" finished prematurely");
-    }
-    return fromBytes(b);
+    return fromStream(dataInputStream);
   }
 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org