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

master
Andrew DeMaria 6 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; String uploadDirectory = null;
List<MusicFolder> musicFolders = settingsService.getMusicFoldersForUser(user.getUsername()); List<MusicFolder> musicFolders = settingsService.getMusicFoldersForUser(user.getUsername());
if (musicFolders.size() > 0) { if (!musicFolders.isEmpty()) {
uploadDirectory = new File(musicFolders.get(0).getPath(), "Incoming").getPath(); uploadDirectory = new File(musicFolders.get(0).getPath(), "Incoming").getPath();
} }

@ -122,7 +122,7 @@ public class UploadController {
if (!item.isFormField()) { if (!item.isFormField()) {
String fileName = item.getName(); String fileName = item.getName();
if (fileName.trim().length() > 0) { if (!fileName.trim().isEmpty()) {
File targetFile = new File(dir, new File(fileName).getName()); 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(), MapDifference<String, List<String>> difference = Maps.difference(expected.getQueryParams(),
requested.getQueryParams()); requested.getQueryParams());
if(difference.entriesDiffering().size() != 0 || if(!difference.entriesDiffering().isEmpty() ||
difference.entriesOnlyOnLeft().size() != 0 || !difference.entriesOnlyOnLeft().isEmpty() ||
difference.entriesOnlyOnRight().size() != 1 || difference.entriesOnlyOnRight().size() != 1 ||
difference.entriesOnlyOnRight().get(JWTSecurityService.JWT_PARAM_NAME) == null) { difference.entriesOnlyOnRight().get(JWTSecurityService.JWT_PARAM_NAME) == null) {
logger.debug("False: expected query params [{}] do not match requested query params [{}]", expected.getQueryParams(), requested.getQueryParams()); 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() { private void compileExcludePattern() {
if (getExcludePatternString() != null && getExcludePatternString().trim().length() > 0) { if (getExcludePatternString() != null && !getExcludePatternString().trim().isEmpty()) {
excludePattern = Pattern.compile(getExcludePatternString()); excludePattern = Pattern.compile(getExcludePatternString());
} else { } else {
excludePattern = null; excludePattern = null;

@ -164,6 +164,6 @@ public abstract class MetaDataParser {
} }
String result = title.replaceFirst("^\\d{2}[. -]+", ""); 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>(); List<String> result = new ArrayList<String>();
for (String line = reader.readLine(); line != null; line = reader.readLine()) { for (String line = reader.readLine(); line != null; line = reader.readLine()) {
line = line.trim(); line = line.trim();
if (!line.startsWith("#") && line.length() > 0) { if (!line.startsWith("#") && !line.isEmpty()) {
result.add(line); result.add(line);
} }
} }

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

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

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

Loading…
Cancel
Save