You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2019/12/17 23:12:57 UTC
[royale-compiler] branch develop updated: GoogDepsWriter: uses more
backwards compatible utf8 encoding for remove-circulars
This is an automated email from the ASF dual-hosted git repository.
joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
The following commit(s) were added to refs/heads/develop by this push:
new a307343 GoogDepsWriter: uses more backwards compatible utf8 encoding for remove-circulars
a307343 is described below
commit a307343199c9a8bf3fe8e847096a13df73a66407
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Tue Dec 17 15:12:50 2019 -0800
GoogDepsWriter: uses more backwards compatible utf8 encoding for remove-circulars
---
.../compiler/internal/graph/GoogDepsWriter.java | 24 ++++------------------
1 file changed, 4 insertions(+), 20 deletions(-)
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/graph/GoogDepsWriter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/graph/GoogDepsWriter.java
index 82ca452..442c3ba 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/graph/GoogDepsWriter.java
@@ -20,11 +20,9 @@ package org.apache.royale.compiler.internal.graph;
import java.io.File;
import java.io.FileNotFoundException;
-import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.io.PrintWriter;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
@@ -610,19 +608,12 @@ public class GoogDepsWriter {
sourceMapConsumer = addLineToSourceMap(sourceMapConsumer, mainFile.getName(), main.fileInfo.googProvideLine + 1);
}
- PrintWriter out = new PrintWriter(new FileWriter(mainFile, Charset.forName("utf8")));
- for (String s : fileLines)
- {
- out.println(s);
- }
- out.close();
+ FileUtils.writeLines(mainFile, "utf8", fileLines);
if (sourceMapConsumer != null)
{
String newSourceMap = sourceMapConsumerToString(sourceMapConsumer, mainFile.getName());
- PrintWriter sourceMapOut = new PrintWriter(new FileWriter(sourceMapFile, Charset.forName("utf8")));
- sourceMapOut.print(newSourceMap);
- sourceMapOut.close();
+ FileUtils.write(mainFile, newSourceMap, "utf8");
}
} catch (IOException e) {
// TODO Auto-generated catch block
@@ -882,19 +873,12 @@ public class GoogDepsWriter {
finalLines.add(gd.fileInfo.googProvideLine + 1, sb.toString());
sourceMapConsumer = addLineToSourceMap(sourceMapConsumer, depFile.getName(), gd.fileInfo.googProvideLine + 1);
- PrintWriter out = new PrintWriter(new FileWriter(depFile, Charset.forName("utf8")));
- for (String s : finalLines)
- {
- out.println(s);
- }
- out.close();
+ FileUtils.writeLines(depFile, "utf8", finalLines);
if (sourceMapConsumer != null)
{
String newSourceMap = sourceMapConsumerToString(sourceMapConsumer, depFile.getName());
- PrintWriter sourceMapOut = new PrintWriter(new FileWriter(sourceMapFile, Charset.forName("utf8")));
- sourceMapOut.print(newSourceMap);
- sourceMapOut.close();
+ FileUtils.write(sourceMapFile, newSourceMap, "utf8");
}
}
catch (IOException e)