Merge branch 'master' of https://gitbox.apache.org/repos/asf/directory-studio
diff --git a/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionIO.java b/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionIO.java
index 46e984f..a6f55c1 100644
--- a/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionIO.java
+++ b/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionIO.java
@@ -25,7 +25,9 @@
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
+import java.util.Base64;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -34,7 +36,6 @@
import org.apache.directory.api.ldap.model.message.Control;
import org.apache.directory.api.ldap.model.message.SearchScope;
import org.apache.directory.api.ldap.model.name.Dn;
-import org.apache.directory.api.util.Base64;
import org.apache.directory.studio.connection.core.Connection;
import org.apache.directory.studio.connection.core.Controls;
import org.apache.directory.studio.connection.core.StudioControl;
@@ -357,7 +358,7 @@
{
if ( oidAttribute != null && isCriticalAttribute != null && valueAttribute != null )
{
- byte[] bytes = Base64.decode( valueAttribute.getValue().toCharArray() );
+ byte[] bytes = Base64.getDecoder().decode( valueAttribute.getValue() );
Control control = Controls.create( oidAttribute.getValue(),
Boolean.valueOf( isCriticalAttribute.getValue() ), bytes );
searchParameter.getControls().add( control );
@@ -365,7 +366,7 @@
else if ( valueAttribute != null )
{
// Backward compatibility: read objects using Java serialization
- byte[] bytes = Base64.decode( valueAttribute.getValue().toCharArray() );
+ byte[] bytes = Base64.getDecoder().decode( valueAttribute.getValue() );
ByteArrayInputStream bais = null;
ObjectInputStream ois = null;
bais = new ByteArrayInputStream( bytes );
@@ -541,7 +542,7 @@
for ( Control control : searchParameter.getControls() )
{
byte[] bytes = Controls.getEncodedValue( control );
- String controlsValue = new String( Base64.encode( bytes ) );
+ String controlsValue = new String( Base64.getEncoder().encode( bytes ), StandardCharsets.UTF_8 );
Element controlElement = controlsElement.addElement( CONTROL_TAG );
controlElement.addAttribute( OID_TAG, control.getOid() );
diff --git a/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorFileChooser.java b/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorFileChooser.java
index c8b54aa..c3c6982 100644
--- a/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorFileChooser.java
+++ b/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorFileChooser.java
@@ -25,8 +25,8 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.util.Base64;
-import org.apache.directory.api.util.Base64;
import org.apache.directory.studio.entryeditors.IEntryEditor;
import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -147,7 +147,7 @@
{
try
{
- iconData = new ImageData( new ByteArrayInputStream( Base64.decode( icon.toCharArray() ) ) );
+ iconData = new ImageData( new ByteArrayInputStream( Base64.getDecoder().decode( icon ) ) );
}
catch ( SWTException e )
{
diff --git a/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorImage.java b/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorImage.java
index 5101d0b..b72abcb 100644
--- a/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorImage.java
+++ b/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/editor/widgets/EditorImage.java
@@ -25,8 +25,8 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.util.Base64;
-import org.apache.directory.api.util.Base64;
import org.apache.directory.studio.entryeditors.IEntryEditor;
import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -239,7 +239,7 @@
String imageDataString = getWidget().getImageData();
if ( ( imageDataString != null ) && ( !imageDataString.equals( "" ) ) ) //$NON-NLS-1$
{
- imageBytes = Base64.decode( imageDataString.toCharArray() );
+ imageBytes = Base64.getDecoder().decode( imageDataString );
}
}
}
@@ -681,4 +681,4 @@
}
}
}
-}
\ No newline at end of file
+}