Merge remote-tracking branch 'origin/pr/1103'
This commit is contained in:
@@ -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());
|
||||
|
||||
|
||||
+2
-2
@@ -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;
|
||||
|
||||
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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");
|
||||
|
||||
+1
-1
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user