From 3650eabff054cd3c6b3670d248ffeb04e0b76478 Mon Sep 17 00:00:00 2001
From: Jiri Vanek <jvanek@redhat.com>
Date: Thu, 18 Jul 2013 08:53:46 +0200
Subject: IcedTea-Web is now following XDG .config and .cache
 specification(RH947647)

---
 .../net/sourceforge/jnlp/ProcessWrapper.java       | 10 +++++---
 .../net/sourceforge/jnlp/ServerAccess.java         | 30 +++++-----------------
 2 files changed, 13 insertions(+), 27 deletions(-)

(limited to 'tests/test-extensions/net')

diff --git a/tests/test-extensions/net/sourceforge/jnlp/ProcessWrapper.java b/tests/test-extensions/net/sourceforge/jnlp/ProcessWrapper.java
index 49d58ea..9b2dbbb 100644
--- a/tests/test-extensions/net/sourceforge/jnlp/ProcessWrapper.java
+++ b/tests/test-extensions/net/sourceforge/jnlp/ProcessWrapper.java
@@ -64,8 +64,12 @@ public class ProcessWrapper {
     public ProcessWrapper() {
     }
 
-    public ProcessWrapper(String toBeExecuted, List<String> otherargs, URL u){
-        Assert.assertNotNull(u);
+    public ProcessWrapper(String toBeExecuted, List<String> otherargs, URL u) {
+        this(toBeExecuted, otherargs, u.toString());
+    }
+
+    public ProcessWrapper(String toBeExecuted, List<String> otherargs, String s) {
+        Assert.assertNotNull(s);
         Assert.assertNotNull(toBeExecuted);
         Assert.assertTrue(toBeExecuted.trim().length() > 1);
         if (otherargs == null) {
@@ -73,7 +77,7 @@ public class ProcessWrapper {
         }
         List<String> urledArgs = new ArrayList(otherargs);
         urledArgs.add(0, toBeExecuted);
-        urledArgs.add(u.toString());
+        urledArgs.add(s);
         this.args = urledArgs;
         this.vars=null;
     }
diff --git a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java
index 7d3b3d7..e9f4238 100644
--- a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java
+++ b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java
@@ -60,6 +60,7 @@ import net.sourceforge.jnlp.browsertesting.BrowserFactory;
 import net.sourceforge.jnlp.browsertesting.Browsers;
 import net.sourceforge.jnlp.closinglisteners.AutoErrorClosingListener;
 import net.sourceforge.jnlp.closinglisteners.AutoOkClosingListener;
+import net.sourceforge.jnlp.util.FileUtils;
 import org.junit.Assert;
 
 /**
@@ -417,23 +418,8 @@ public class ServerAccess {
      * @return stream as string
      * @throws IOException if connection can't be established or resource does not exist
      */
-    public static String getContentOfStream(InputStream is,String encoding) throws IOException {
-        try {
-            BufferedReader br = new BufferedReader(new InputStreamReader(is, encoding));
-            StringBuilder sb = new StringBuilder();
-            while (true) {
-                String s = br.readLine();
-                if (s == null) {
-                    break;
-                }
-                sb.append(s).append("\n");
-
-            }
-            return sb.toString();
-        } finally {
-            is.close();
-        }
-
+    public static String getContentOfStream(InputStream is, String encoding) throws IOException {
+        return FileUtils.getContentOfStream(is, encoding);
     }
 
     /**
@@ -444,8 +430,7 @@ public class ServerAccess {
      * @throws IOException if connection can't be established or resource does not exist
      */
     public static String getContentOfStream(InputStream is) throws IOException {
-        return getContentOfStream(is, "UTF-8");
-
+        return FileUtils.getContentOfStream(is);
     }
 
     /**
@@ -491,13 +476,10 @@ public class ServerAccess {
      * @throws IOException
      */
     public static void saveFile(String content, File f) throws IOException {
-        saveFile(content, f, "utf-8");
+        FileUtils.saveFile(content, f);
     }
     public static void saveFile(String content, File f,String encoding) throws IOException {
-        Writer output = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f),encoding));
-        output.write(content);
-        output.flush();
-        output.close();
+        FileUtils.saveFile(content, f, encoding);
     }
 
     /**
-- 
cgit v1.2.3