diff options
author | emmanuel lecharny <elecharny@apache.org> | 2022-01-06 20:11:12 +0300 |
---|---|---|
committer | emmanuel lecharny <elecharny@apache.org> | 2022-01-06 20:11:12 +0300 |
commit | 54f0962b2626e9ae8604bf8e7b2f153a406542cd (patch) | |
tree | 1a4d4d903b71b05559e3c33fac3de1d78abe5518 | |
parent | 155e5cf5f89c40b6fed452bbf92a05bd70fa787c (diff) |
Get rid of the LDAP API Base64 class, using the java.util.Base64 class2.0.0.v20200411-M15-prepare
instead.
3 files changed, 9 insertions, 8 deletions
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 46e984fb5..a6f55c1b5 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.IOException; 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.exception.LdapInvalidDnException; 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 @@ public class BrowserConnectionIO { 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 @@ public class BrowserConnectionIO 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 @@ public class BrowserConnectionIO 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 c8b54aa80..c3c6982c5 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.ByteArrayOutputStream; 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 @@ public class EditorFileChooser extends EditorWidget<TemplateFileChooser> { 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 5101d0bf2..aeddf3a4f 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.ByteArrayOutputStream; 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 @@ public class EditorImage extends EditorWidget<TemplateImage> String imageDataString = getWidget().getImageData(); if ( ( imageDataString != null ) && ( !imageDataString.equals( "" ) ) ) //$NON-NLS-1$ { - imageBytes = Base64.decode( imageDataString.toCharArray() ); + imageBytes = Base64.getDecoder().decode( imageDataString ); } } } |