cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject git commit: updated refs/heads/master to 34d097f
Date Mon, 15 Jun 2015 18:50:05 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 5fe06962a -> 34d097f34


Fix 4 findbugs warnings in JuniperSrxResource Data should be read and written in UTF-8 to
the SRX Buffers were being used for reading but not for writing, PrintWriter was auto-flushing
and code was explicitly flushing again, causing unnecessary operation to be performed.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #399


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

Branch: refs/heads/master
Commit: 34d097f34936d65bdf00a3152acfdca770578cb5
Parents: 5fe0696
Author: Rafael da Fonseca <rsafonseca@gmail.com>
Authored: Sat Jun 13 01:19:39 2015 +0200
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Mon Jun 15 21:49:43 2015 +0300

----------------------------------------------------------------------
 .../cloud/network/resource/JuniperSrxResource.java | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/34d097f3/plugins/network-elements/juniper-srx/src/com/cloud/network/resource/JuniperSrxResource.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/network/resource/JuniperSrxResource.java
b/plugins/network-elements/juniper-srx/src/com/cloud/network/resource/JuniperSrxResource.java
index d3a3f1b..d60ccb6 100644
--- a/plugins/network-elements/juniper-srx/src/com/cloud/network/resource/JuniperSrxResource.java
+++ b/plugins/network-elements/juniper-srx/src/com/cloud/network/resource/JuniperSrxResource.java
@@ -20,7 +20,8 @@ import java.io.BufferedReader;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
-import java.io.PrintWriter;
+import java.io.OutputStreamWriter;
+import java.io.BufferedWriter;
 import java.io.StringReader;
 import java.net.Socket;
 import java.net.SocketTimeoutException;
@@ -83,9 +84,9 @@ public class JuniperSrxResource implements ServerResource {
     private String _password;
     private String _guid;
     private String _objectNameWordSep;
-    private PrintWriter _toSrx;
+    private BufferedWriter _toSrx;
     private BufferedReader _fromSrx;
-    private PrintWriter _UsagetoSrx;
+    private BufferedWriter _UsagetoSrx;
     private BufferedReader _UsagefromSrx;
     private Integer _numRetries;
     private Integer _timeoutInSeconds;
@@ -538,8 +539,8 @@ public class JuniperSrxResource implements ServerResource {
             Socket s = new Socket(_ip, 3221);
             s.setKeepAlive(true);
             s.setSoTimeout(_timeoutInSeconds * 1000);
-            _toSrx = new PrintWriter(s.getOutputStream(), true);
-            _fromSrx = new BufferedReader(new InputStreamReader(s.getInputStream()));
+            _toSrx = new BufferedWriter(new OutputStreamWriter(s.getOutputStream(),"UTF-8"));
+            _fromSrx = new BufferedReader(new InputStreamReader(s.getInputStream(),"UTF-8"));
             return true;
         } catch (IOException e) {
             s_logger.error(e);
@@ -580,8 +581,8 @@ public class JuniperSrxResource implements ServerResource {
             Socket s = new Socket(_ip, 3221);
             s.setKeepAlive(true);
             s.setSoTimeout(_timeoutInSeconds * 1000);
-            _UsagetoSrx = new PrintWriter(s.getOutputStream(), true);
-            _UsagefromSrx = new BufferedReader(new InputStreamReader(s.getInputStream()));
+            _UsagetoSrx = new BufferedWriter(new OutputStreamWriter(s.getOutputStream(),"UTF-8"));
+            _UsagefromSrx = new BufferedReader(new InputStreamReader(s.getInputStream(),"UTF-8"));
             return usageLogin();
         } catch (IOException e) {
             s_logger.error(e);
@@ -3383,7 +3384,7 @@ public class JuniperSrxResource implements ServerResource {
      * XML API commands
      */
 
-    private String sendRequestPrim(PrintWriter sendStream, BufferedReader recvStream, String
xmlRequest) throws ExecutionException {
+    private String sendRequestPrim(BufferedWriter sendStream, BufferedReader recvStream,
String xmlRequest) throws ExecutionException {
         if (!xmlRequest.contains("request-login")) {
             s_logger.debug("Sending request: " + xmlRequest);
         } else {


Mime
View raw message