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 2020/10/29 18:06:25 UTC
[royale-compiler] branch develop updated: COMPJSC: fix bad
toString(Charset) method call that doesn't exist in older Java
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 f40b9c7 COMPJSC: fix bad toString(Charset) method call that doesn't exist in older Java
f40b9c7 is described below
commit f40b9c71e87fd9e1d1b4aceeca685618fbf666af
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Thu Oct 29 11:06:17 2020 -0700
COMPJSC: fix bad toString(Charset) method call that doesn't exist in older Java
---
.../apache/royale/compiler/clients/COMPJSC.java | 34 +++++++++++++++-------
.../royale/compiler/clients/COMPJSCNative.java | 34 +++++++++++++++-------
.../royale/compiler/clients/COMPJSCRoyale.java | 34 +++++++++++++++-------
3 files changed, 69 insertions(+), 33 deletions(-)
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSC.java b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSC.java
index e367473..d010412 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSC.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSC.java
@@ -26,6 +26,7 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -688,28 +689,39 @@ public class COMPJSC extends MXMLJSC
String sourceMapSourceRoot = project.config.getSourceMapSourceRoot();
if(sourceMapSourceRoot != null && sourceMapSourceRoot.length() > 0)
{
- String sourceMapContents = sourceMapTemp.toString(Charset.forName("utf8"));
- SourceMapConsumerV3 sourceMapConsumer = new SourceMapConsumerV3();
+ String sourceMapContents = null;
try
{
- sourceMapConsumer.parse(sourceMapContents);
+ sourceMapContents = sourceMapTemp.toString("utf8");
}
- catch(SourceMapParseException e)
+ catch(UnsupportedEncodingException e)
{
- sourceMapConsumer = null;
+ sourceMapContents = null;
}
- if (sourceMapConsumer != null && !sourceMapSourceRoot.equals(sourceMapConsumer.getSourceRoot()))
+ if(sourceMapContents != null)
{
- SourceMapGeneratorV3 sourceMapGenerator = SourceMapUtils.sourceMapConsumerToGeneratorWithRemappedSourceRoot(sourceMapConsumer, sourceMapSourceRoot, symbol);
- String newSourceMapContents = SourceMapUtils.sourceMapGeneratorToString(sourceMapGenerator, outputClassFile.getName());
+ SourceMapConsumerV3 sourceMapConsumer = new SourceMapConsumerV3();
try
{
- IOUtils.write(newSourceMapContents, baos, Charset.forName("utf8"));
+ sourceMapConsumer.parse(sourceMapContents);
}
- catch(IOException e)
+ catch(SourceMapParseException e)
{
+ sourceMapConsumer = null;
+ }
+ if (sourceMapConsumer != null && !sourceMapSourceRoot.equals(sourceMapConsumer.getSourceRoot()))
+ {
+ SourceMapGeneratorV3 sourceMapGenerator = SourceMapUtils.sourceMapConsumerToGeneratorWithRemappedSourceRoot(sourceMapConsumer, sourceMapSourceRoot, symbol);
+ String newSourceMapContents = SourceMapUtils.sourceMapGeneratorToString(sourceMapGenerator, outputClassFile.getName());
+ try
+ {
+ IOUtils.write(newSourceMapContents, baos, Charset.forName("utf8"));
+ }
+ catch(IOException e)
+ {
+ }
+ return;
}
- return;
}
}
try
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSCNative.java b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSCNative.java
index 7f0f662..a01843b 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSCNative.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSCNative.java
@@ -26,6 +26,7 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -485,28 +486,39 @@ public class COMPJSCNative extends MXMLJSCNative
String sourceMapSourceRoot = project.config.getSourceMapSourceRoot();
if(sourceMapSourceRoot != null && sourceMapSourceRoot.length() > 0)
{
- String sourceMapContents = sourceMapTemp.toString(Charset.forName("utf8"));
- SourceMapConsumerV3 sourceMapConsumer = new SourceMapConsumerV3();
+ String sourceMapContents = null;
try
{
- sourceMapConsumer.parse(sourceMapContents);
+ sourceMapContents = sourceMapTemp.toString("utf8");
}
- catch(SourceMapParseException e)
+ catch(UnsupportedEncodingException e)
{
- sourceMapConsumer = null;
+ sourceMapContents = null;
}
- if (sourceMapConsumer != null && !sourceMapSourceRoot.equals(sourceMapConsumer.getSourceRoot()))
+ if(sourceMapContents != null)
{
- SourceMapGeneratorV3 sourceMapGenerator = SourceMapUtils.sourceMapConsumerToGeneratorWithRemappedSourceRoot(sourceMapConsumer, sourceMapSourceRoot, symbol);
- String newSourceMapContents = SourceMapUtils.sourceMapGeneratorToString(sourceMapGenerator, outputClassFile.getName());
+ SourceMapConsumerV3 sourceMapConsumer = new SourceMapConsumerV3();
try
{
- IOUtils.write(newSourceMapContents, baos, Charset.forName("utf8"));
+ sourceMapConsumer.parse(sourceMapContents);
}
- catch(IOException e)
+ catch(SourceMapParseException e)
{
+ sourceMapConsumer = null;
+ }
+ if (sourceMapConsumer != null && !sourceMapSourceRoot.equals(sourceMapConsumer.getSourceRoot()))
+ {
+ SourceMapGeneratorV3 sourceMapGenerator = SourceMapUtils.sourceMapConsumerToGeneratorWithRemappedSourceRoot(sourceMapConsumer, sourceMapSourceRoot, symbol);
+ String newSourceMapContents = SourceMapUtils.sourceMapGeneratorToString(sourceMapGenerator, outputClassFile.getName());
+ try
+ {
+ IOUtils.write(newSourceMapContents, baos, Charset.forName("utf8"));
+ }
+ catch(IOException e)
+ {
+ }
+ return;
}
- return;
}
}
try
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSCRoyale.java b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSCRoyale.java
index a16bfd5..0cf1e50 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSCRoyale.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSCRoyale.java
@@ -26,6 +26,7 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -552,28 +553,39 @@ public class COMPJSCRoyale extends MXMLJSCRoyale
String sourceMapSourceRoot = project.config.getSourceMapSourceRoot();
if(sourceMapSourceRoot != null && sourceMapSourceRoot.length() > 0)
{
- String sourceMapContents = sourceMapTemp.toString(Charset.forName("utf8"));
- SourceMapConsumerV3 sourceMapConsumer = new SourceMapConsumerV3();
+ String sourceMapContents = null;
try
{
- sourceMapConsumer.parse(sourceMapContents);
+ sourceMapContents = sourceMapTemp.toString("utf8");
}
- catch(SourceMapParseException e)
+ catch(UnsupportedEncodingException e)
{
- sourceMapConsumer = null;
+ sourceMapContents = null;
}
- if (sourceMapConsumer != null && !sourceMapSourceRoot.equals(sourceMapConsumer.getSourceRoot()))
+ if(sourceMapContents != null)
{
- SourceMapGeneratorV3 sourceMapGenerator = SourceMapUtils.sourceMapConsumerToGeneratorWithRemappedSourceRoot(sourceMapConsumer, sourceMapSourceRoot, symbol);
- String newSourceMapContents = SourceMapUtils.sourceMapGeneratorToString(sourceMapGenerator, outputClassFile.getName());
+ SourceMapConsumerV3 sourceMapConsumer = new SourceMapConsumerV3();
try
{
- IOUtils.write(newSourceMapContents, baos, Charset.forName("utf8"));
+ sourceMapConsumer.parse(sourceMapContents);
}
- catch(IOException e)
+ catch(SourceMapParseException e)
{
+ sourceMapConsumer = null;
+ }
+ if (sourceMapConsumer != null && !sourceMapSourceRoot.equals(sourceMapConsumer.getSourceRoot()))
+ {
+ SourceMapGeneratorV3 sourceMapGenerator = SourceMapUtils.sourceMapConsumerToGeneratorWithRemappedSourceRoot(sourceMapConsumer, sourceMapSourceRoot, symbol);
+ String newSourceMapContents = SourceMapUtils.sourceMapGeneratorToString(sourceMapGenerator, outputClassFile.getName());
+ try
+ {
+ IOUtils.write(newSourceMapContents, baos, Charset.forName("utf8"));
+ }
+ catch(IOException e)
+ {
+ }
+ return;
}
- return;
}
}
try