This is an automated email from the ASF dual-hosted git repository.

hefengen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new c25dc204c3 fix: replace deprecated Base64 class with java.util.Base64  
(#6132)
c25dc204c3 is described below

commit c25dc204c33f229ccc82cd23f4232f834ba0ba68
Author: aias00 <liuhon...@apache.org>
AuthorDate: Wed Sep 3 18:56:02 2025 +0800

    fix: replace deprecated Base64 class with java.util.Base64  (#6132)
    
    * fix: replace deprecated Base64 class with java.util.Base64 in 
PluginServiceImpl
    
    * fix: replace deprecated Base64 class with java.util.Base64 in 
PluginServiceImpl
---
 .../apache/shenyu/admin/service/impl/PluginServiceImpl.java   | 11 +++--------
 .../org/apache/shenyu/admin/service/PluginServiceTest.java    |  5 +----
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/PluginServiceImpl.java
 
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/PluginServiceImpl.java
index 7b5b1e58de..2bcea4503b 100644
--- 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/PluginServiceImpl.java
+++ 
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/PluginServiceImpl.java
@@ -32,7 +32,6 @@ import 
org.apache.shenyu.admin.model.query.PluginQueryCondition;
 import org.apache.shenyu.admin.model.result.ConfigImportResult;
 import org.apache.shenyu.admin.model.vo.PluginSnapshotVO;
 import org.apache.shenyu.admin.model.vo.PluginVO;
-import org.apache.shenyu.admin.service.PluginHandleService;
 import org.apache.shenyu.admin.service.PluginService;
 import org.apache.shenyu.admin.service.configs.ConfigsImportContext;
 import org.apache.shenyu.admin.service.publish.PluginEventPublisher;
@@ -48,12 +47,12 @@ import org.apache.shenyu.common.utils.JarDependencyUtils;
 import org.apache.shenyu.common.utils.ListUtil;
 import org.apache.shenyu.common.utils.LogUtils;
 import org.apache.shenyu.common.utils.UUIDUtils;
-import org.opengauss.util.Base64;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.Base64;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -77,17 +76,13 @@ public class PluginServiceImpl implements PluginService {
 
     private final PluginEventPublisher pluginEventPublisher;
 
-    private final PluginHandleService pluginHandleService;
-
     private final NamespacePluginRelMapper namespacePluginRelMapper;
 
     public PluginServiceImpl(final PluginMapper pluginMapper,
                              final PluginEventPublisher pluginEventPublisher,
-                             final PluginHandleService pluginHandleService,
                              final NamespacePluginRelMapper 
namespacePluginRelMapper) {
         this.pluginMapper = pluginMapper;
         this.pluginEventPublisher = pluginEventPublisher;
-        this.pluginHandleService = pluginHandleService;
         this.namespacePluginRelMapper = namespacePluginRelMapper;
     }
 
@@ -298,7 +293,7 @@ public class PluginServiceImpl implements PluginService {
     private String create(final PluginDTO pluginDTO) {
         Assert.isNull(pluginMapper.nameExisted(pluginDTO.getName()), "create" 
+ AdminConstants.PLUGIN_NAME_IS_EXIST + pluginDTO.getName());
         if (Objects.nonNull(pluginDTO.getFile())) {
-            Assert.isTrue(checkFile(Base64.decode(pluginDTO.getFile())), 
AdminConstants.THE_PLUGIN_JAR_FILE_IS_NOT_CORRECT_OR_EXCEEDS_16_MB);
+            
Assert.isTrue(checkFile(Base64.getDecoder().decode(pluginDTO.getFile())), 
AdminConstants.THE_PLUGIN_JAR_FILE_IS_NOT_CORRECT_OR_EXCEEDS_16_MB);
         }
         PluginDO pluginDO = PluginDO.buildPluginDO(pluginDTO);
         if (pluginMapper.insertSelective(pluginDO) > 0) {
@@ -318,7 +313,7 @@ public class PluginServiceImpl implements PluginService {
     private String update(final PluginDTO pluginDTO) {
         Assert.isNull(pluginMapper.nameExistedExclude(pluginDTO.getName(), 
Collections.singletonList(pluginDTO.getId())), 
AdminConstants.PLUGIN_NAME_IS_EXIST + pluginDTO.getName());
         if (Objects.nonNull(pluginDTO.getFile())) {
-            Assert.isTrue(checkFile(Base64.decode(pluginDTO.getFile())), 
AdminConstants.THE_PLUGIN_JAR_FILE_IS_NOT_CORRECT_OR_EXCEEDS_16_MB);
+            
Assert.isTrue(checkFile(Base64.getDecoder().decode(pluginDTO.getFile())), 
AdminConstants.THE_PLUGIN_JAR_FILE_IS_NOT_CORRECT_OR_EXCEEDS_16_MB);
         }
         final PluginDO before = pluginMapper.selectById(pluginDTO.getId());
         PluginDO pluginDO = PluginDO.buildPluginDO(pluginDTO);
diff --git 
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/service/PluginServiceTest.java
 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/service/PluginServiceTest.java
index 531d779b7d..2579e15597 100644
--- 
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/service/PluginServiceTest.java
+++ 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/service/PluginServiceTest.java
@@ -83,15 +83,12 @@ public final class PluginServiceTest {
     @Mock
     private PluginEventPublisher modelDataEventPublisher;
 
-    @Mock
-    private PluginHandleService pluginHandleService;
-
     @Mock
     private NamespacePluginRelMapper namespacePluginRelMapper;
 
     @BeforeEach
     public void setUp() {
-        pluginService = new PluginServiceImpl(pluginMapper, 
modelDataEventPublisher, pluginHandleService, namespacePluginRelMapper);
+        pluginService = new PluginServiceImpl(pluginMapper, 
modelDataEventPublisher, namespacePluginRelMapper);
     }
 
     @Test

Reply via email to