bean/com/sun/star/beans/LocalOfficeConnection.java |   33 ++++++++++++++++-----
 1 file changed, 26 insertions(+), 7 deletions(-)

New commits:
commit bd21a82ea4c7499dd8401687f641d44a7593dc44
Author: Robert Antoni Buj i Gelonch <robert....@gmail.com>
Date:   Tue Sep 16 18:15:12 2014 +0200

    bean: encode(String) in URLEncoder has been deprecated
    
    Change-Id: Ife3eaaaad199e79aeb6886a146324ffb145c7bc3
    Reviewed-on: https://gerrit.libreoffice.org/11476
    Reviewed-by: Noel Grandin <noelgran...@gmail.com>
    Tested-by: Noel Grandin <noelgran...@gmail.com>

diff --git a/bean/com/sun/star/beans/LocalOfficeConnection.java 
b/bean/com/sun/star/beans/LocalOfficeConnection.java
index af2be37..e972e2b 100644
--- a/bean/com/sun/star/beans/LocalOfficeConnection.java
+++ b/bean/com/sun/star/beans/LocalOfficeConnection.java
@@ -20,6 +20,7 @@ package com.sun.star.beans;
 
 import java.awt.Container;
 import java.io.File;
+import java.io.UnsupportedEncodingException;
 import java.util.Iterator;
 import java.util.List;
 import java.util.ArrayList;
@@ -72,7 +73,17 @@ public class LocalOfficeConnection
             setUnoUrl( "uno:pipe,name=" + getPipeName() + 
";urp;StarOffice.ServiceManager" );
         }
         catch ( java.net.MalformedURLException e )
-        {}
+        {
+            com.sun.star.uno.RuntimeException e2 = new 
com.sun.star.uno.RuntimeException();
+            e2.initCause(e);
+            throw e2;
+        }
+        catch ( UnsupportedEncodingException e)
+        {
+            com.sun.star.uno.RuntimeException e2 = new 
com.sun.star.uno.RuntimeException();
+            e2.initCause(e);
+            throw e2;
+        }
 
         // load libofficebean.so/officebean.dll
         String aSharedLibName = getProgramPath() + java.io.File.separator +
@@ -525,12 +536,12 @@ public class LocalOfficeConnection
 
     /** creates a unique pipe name.
     */
-    static String getPipeName()
+    static String getPipeName() throws UnsupportedEncodingException
     {
         // turn user name into a URL and file system safe name (% chars will 
not work)
         String aPipeName = System.getProperty("user.name") + OFFICE_ID_SUFFIX;
         aPipeName = aPipeName.replace( "_", "%B7" );
-        return java.net.URLEncoder.encode(aPipeName).replace( "\\+", "%20" 
).replace( "%", "_" );
+        return java.net.URLEncoder.encode(aPipeName, "UTF-8").replace( "\\+", 
"%20" ).replace( "%", "_" );
     }
 
     /**
@@ -547,10 +558,18 @@ public class LocalOfficeConnection
          */
         public String getIdentifier()
         {
-            if ( mPipe == null)
-                return getPipeName();
-            else
-                return mPipe;
+            String identifier = null;
+            try
+            {
+                identifier = ( mPipe == null) ? getPipeName() : mPipe;
+            }
+            catch (UnsupportedEncodingException e)
+            {
+                com.sun.star.uno.RuntimeException e2 = new 
com.sun.star.uno.RuntimeException();
+                e2.initCause(e);
+                throw e2;
+            }
+            return identifier;
         }
 
         /**
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to