This is an automated email from the ASF dual-hosted git repository. elecharny pushed a commit to branch 1.2.X in repository https://gitbox.apache.org/repos/asf/mina-ftpserver.git
The following commit(s) were added to refs/heads/1.2.X by this push: new 0999f6ad o Replaced the use of iterator by a for() o Removed some useless try... catch sections o Fixed a Javadoc typo 0999f6ad is described below commit 0999f6ad5435f485a1a160f418970565ee812289 Author: emmanuel lecharny <elecha...@apache.org> AuthorDate: Mon Jan 6 05:09:19 2025 +0100 o Replaced the use of iterator by a for() o Removed some useless try... catch sections o Fixed a Javadoc typo --- .../usermanager/impl/PropertiesUserManager.java | 33 +++++++++------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/core/src/main/java/org/apache/ftpserver/usermanager/impl/PropertiesUserManager.java b/core/src/main/java/org/apache/ftpserver/usermanager/impl/PropertiesUserManager.java index ef0cc8d8..c79910cd 100644 --- a/core/src/main/java/org/apache/ftpserver/usermanager/impl/PropertiesUserManager.java +++ b/core/src/main/java/org/apache/ftpserver/usermanager/impl/PropertiesUserManager.java @@ -28,7 +28,6 @@ import java.net.URL; import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; -import java.util.Iterator; import java.util.List; import org.apache.ftpserver.FtpServerConfigurationException; @@ -114,9 +113,7 @@ import org.slf4j.LoggerFactory; * @author <a href="http://mina.apache.org">Apache MINA Project</a> */ public class PropertiesUserManager extends AbstractUserManager { - - private final Logger LOG = LoggerFactory - .getLogger(PropertiesUserManager.class); + private final Logger LOG = LoggerFactory.getLogger(PropertiesUserManager.class); private static final String PREFIX = "ftpserver.user."; @@ -190,21 +187,19 @@ public class PropertiesUserManager extends AbstractUserManager { } private void loadFromUrl(URL userDataPath) { - try { - userDataProp = new BaseProperties(); + userDataProp = new BaseProperties(); - if (userDataPath != null) { - LOG.debug("URL configured, will try loading"); + if (userDataPath != null) { + LOG.debug("URL configured, will try loading"); - userUrl = userDataPath; + userUrl = userDataPath; - try (InputStream is = userDataPath.openStream()) { - userDataProp.load(is); - } - } - } catch (IOException e) { - throw new FtpServerConfigurationException( + try (InputStream is = userDataPath.openStream()) { + userDataProp.load(is); + } catch (IOException e) { + throw new FtpServerConfigurationException( "Error loading user data resource : " + userDataPath, e); + } } } @@ -227,7 +222,7 @@ public class PropertiesUserManager extends AbstractUserManager { } /** - * Retrive the file backing this user manager + * Retreive the file backing this user manager * * @return The file */ @@ -336,10 +331,8 @@ public class PropertiesUserManager extends AbstractUserManager { } } - Iterator<String> remKeysIt = remKeys.iterator(); - - while (remKeysIt.hasNext()) { - userDataProp.remove(remKeysIt.next()); + for (String remKey:remKeys) { + userDataProp.remove(remKey); } saveUserData();