You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ni...@apache.org on 2017/05/12 03:23:54 UTC

ambari git commit: AMBARI-20990 : writing query properly to hdfs file for handling unicode characters. (nitirajrathore)

Repository: ambari
Updated Branches:
  refs/heads/trunk 461209a90 -> fffd07c75


AMBARI-20990 : writing query properly to hdfs file for handling unicode characters. (nitirajrathore)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/fffd07c7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fffd07c7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fffd07c7

Branch: refs/heads/trunk
Commit: fffd07c75ba1af09b0ba3fec347bd7a6fff87807
Parents: 461209a
Author: Nitiraj Singh Rathore <ni...@gmail.com>
Authored: Fri May 12 08:52:02 2017 +0530
Committer: Nitiraj Singh Rathore <ni...@gmail.com>
Committed: Fri May 12 08:53:38 2017 +0530

----------------------------------------------------------------------
 .../ambari/view/hive2/resources/files/FileService.java       | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fffd07c7/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/files/FileService.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/files/FileService.java b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/files/FileService.java
index 64880bb..88f8df1 100644
--- a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/files/FileService.java
+++ b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/files/FileService.java
@@ -185,9 +185,9 @@ public class FileService extends BaseService {
     try {
       filePath = sanitizeFilePath(filePath);
       LOG.debug("Rewriting file " + filePath);
-      FSDataOutputStream output = getSharedObjectsFactory().getHdfsApi().create(filePath, true);
-      output.writeBytes(request.file.getFileContent());
-      output.close();
+      HdfsApi hdfsApi = getSharedObjectsFactory().getHdfsApi();
+      HdfsUtil.putStringToFile(hdfsApi, filePath,
+          request.file.getFileContent());
       return Response.status(204).build();
     } catch (WebApplicationException ex) {
       throw ex;
@@ -209,7 +209,7 @@ public class FileService extends BaseService {
       try {
         FSDataOutputStream output = getSharedObjectsFactory().getHdfsApi().create(request.file.getFilePath(), false);
         if (request.file.getFileContent() != null) {
-          output.writeBytes(request.file.getFileContent());
+          output.write(request.file.getFileContent().getBytes());
         }
         output.close();
       } catch (FileAlreadyExistsException ex) {