AMBARI-18284. Ambari PigView stores the script in HDFS in non UTF-8 format (Jay SenSharma via pallavkul)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e82d03c8 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e82d03c8 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e82d03c8 Branch: refs/heads/branch-dev-patch-upgrade Commit: e82d03c8a66100ec9c2ceb91d4c5a9cc6e427847 Parents: 3638a5b Author: Pallav Kulshreshtha <[email protected]> Authored: Tue Sep 13 14:14:57 2016 +0530 Committer: Pallav Kulshreshtha <[email protected]> Committed: Tue Sep 13 14:14:57 2016 +0530 ---------------------------------------------------------------------- .../org/apache/ambari/view/pig/resources/files/FileService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/e82d03c8/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/files/FileService.java ---------------------------------------------------------------------- diff --git a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/files/FileService.java b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/files/FileService.java index 9dea2a2..509b20e 100644 --- a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/files/FileService.java +++ b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/files/FileService.java @@ -164,7 +164,7 @@ public class FileService extends BaseService { filePath = sanitizeFilePath(filePath); LOG.info("Rewriting file {}", filePath); FSDataOutputStream output = getHdfsApi().create(filePath, true); - output.writeBytes(request.file.getFileContent()); + output.write(request.file.getFileContent().getBytes("UTF-8")); output.close(); return Response.status(204).build(); } catch (WebApplicationException ex) { @@ -189,7 +189,7 @@ public class FileService extends BaseService { try { FSDataOutputStream output = getHdfsApi().create(request.file.getFilePath(), false); if (request.file.getFileContent() != null) { - output.writeBytes(request.file.getFileContent()); + output.write(request.file.getFileContent().getBytes("UTF-8")); } output.close(); } catch (FileAlreadyExistsException ex) {
