Merge remote-tracking branch 'origin/pr/1103'

master
Andrew DeMaria 5 years ago
commit 7a769d57cf
No known key found for this signature in database
GPG Key ID: 0A3F5E91F8364EDF
  1. 2
      airsonic-main/src/main/java/org/airsonic/player/controller/MoreController.java
  2. 2
      airsonic-main/src/main/java/org/airsonic/player/controller/UploadController.java
  3. 4
      airsonic-main/src/main/java/org/airsonic/player/security/JWTAuthenticationProvider.java
  4. 2
      airsonic-main/src/main/java/org/airsonic/player/service/SettingsService.java
  5. 2
      airsonic-main/src/main/java/org/airsonic/player/service/metadata/MetaDataParser.java
  6. 2
      airsonic-main/src/main/java/org/airsonic/player/util/StringUtil.java
  7. 2
      airsonic-main/src/main/java/org/airsonic/player/util/Util.java
  8. 2
      airsonic-main/src/main/java/org/airsonic/player/validator/PasswordSettingsValidator.java
  9. 2
      airsonic-main/src/main/java/org/airsonic/player/validator/UserSettingsValidator.java

@ -67,7 +67,7 @@ public class MoreController {
String uploadDirectory = null;
List<MusicFolder> musicFolders = settingsService.getMusicFoldersForUser(user.getUsername());
if (musicFolders.size() > 0) {
if (!musicFolders.isEmpty()) {
uploadDirectory = new File(musicFolders.get(0).getPath(), "Incoming").getPath();
}

@ -122,7 +122,7 @@ public class UploadController {
if (!item.isFormField()) {
String fileName = item.getName();
if (fileName.trim().length() > 0) {
if (!fileName.trim().isEmpty()) {
File targetFile = new File(dir, new File(fileName).getName());

@ -78,8 +78,8 @@ public class JWTAuthenticationProvider implements AuthenticationProvider {
MapDifference<String, List<String>> difference = Maps.difference(expected.getQueryParams(),
requested.getQueryParams());
if(difference.entriesDiffering().size() != 0 ||
difference.entriesOnlyOnLeft().size() != 0 ||
if(!difference.entriesDiffering().isEmpty() ||
!difference.entriesOnlyOnLeft().isEmpty() ||
difference.entriesOnlyOnRight().size() != 1 ||
difference.entriesOnlyOnRight().get(JWTSecurityService.JWT_PARAM_NAME) == null) {
logger.debug("False: expected query params [{}] do not match requested query params [{}]", expected.getQueryParams(), requested.getQueryParams());

@ -764,7 +764,7 @@ public class SettingsService {
}
private void compileExcludePattern() {
if (getExcludePatternString() != null && getExcludePatternString().trim().length() > 0) {
if (getExcludePatternString() != null && !getExcludePatternString().trim().isEmpty()) {
excludePattern = Pattern.compile(getExcludePatternString());
} else {
excludePattern = null;

@ -164,6 +164,6 @@ public abstract class MetaDataParser {
}
String result = title.replaceFirst("^\\d{2}[. -]+", "");
return result.length() == 0 ? title : result;
return result.isEmpty() ? title : result;
}
}

@ -285,7 +285,7 @@ public final class StringUtil {
List<String> result = new ArrayList<String>();
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
line = line.trim();
if (!line.startsWith("#") && line.length() > 0) {
if (!line.startsWith("#") && !line.isEmpty()) {
result.add(line);
}
}

@ -132,7 +132,7 @@ public final class Util {
public static String getURLForRequest(HttpServletRequest request) {
String url = request.getRequestURL().toString();
String queryString = request.getQueryString();
if (queryString != null && queryString.length() > 0) url += "?" + queryString;
if (queryString != null && !queryString.isEmpty()) url += "?" + queryString;
return url;
}

@ -40,7 +40,7 @@ public class PasswordSettingsValidator implements Validator {
public void validate(Object obj, Errors errors) {
PasswordSettingsCommand command = (PasswordSettingsCommand) obj;
if (command.getPassword() == null || command.getPassword().length() == 0) {
if (command.getPassword() == null || command.getPassword().isEmpty()) {
errors.rejectValue("password", "usersettings.nopassword");
} else if (!command.getPassword().equals(command.getConfirmPassword())) {
errors.rejectValue("password", "usersettings.wrongpassword");

@ -60,7 +60,7 @@ public class UserSettingsValidator implements Validator {
String confirmPassword = command.getConfirmPassword();
if (command.isNewUser()) {
if (username == null || username.length() == 0) {
if (username == null || username.isEmpty()) {
errors.rejectValue("username", "usersettings.nousername");
} else if (securityService.getUserByName(username) != null) {
errors.rejectValue("username", "usersettings.useralreadyexists");

Loading…
Cancel
Save