diff --git a/libresonic-main/src/main/java/org/libresonic/player/command/PasswordSettingsCommand.java b/libresonic-main/src/main/java/org/libresonic/player/command/PasswordSettingsCommand.java deleted file mode 100644 index 8f12e554..00000000 --- a/libresonic-main/src/main/java/org/libresonic/player/command/PasswordSettingsCommand.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - This file is part of Libresonic. - - Libresonic is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Libresonic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Libresonic. If not, see . - - Copyright 2016 (C) Libresonic Authors - Based upon Subsonic, Copyright 2009 (C) Sindre Mehus - */ -package org.libresonic.player.command; - -import org.libresonic.player.controller.*; - -/** - * Command used in {@link PasswordSettingsController}. - * - * @author Sindre Mehus - */ -public class PasswordSettingsCommand { - private String username; - private String password; - private String confirmPassword; - private boolean ldapAuthenticated; - private boolean toast; - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getConfirmPassword() { - return confirmPassword; - } - - public void setConfirmPassword(String confirmPassword) { - this.confirmPassword = confirmPassword; - } - - public boolean isLdapAuthenticated() { - return ldapAuthenticated; - } - - public void setLdapAuthenticated(boolean ldapAuthenticated) { - this.ldapAuthenticated = ldapAuthenticated; - } - - public boolean isToast() { - return toast; - } - - public void setToast(boolean toast) { - this.toast = toast; - } -} \ No newline at end of file diff --git a/libresonic-main/src/main/java/org/libresonic/player/command/PremiumSettingsCommand.java b/libresonic-main/src/main/java/org/libresonic/player/command/PremiumSettingsCommand.java deleted file mode 100644 index f20014dc..00000000 --- a/libresonic-main/src/main/java/org/libresonic/player/command/PremiumSettingsCommand.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - This file is part of Libresonic. - - Libresonic is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Libresonic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Libresonic. If not, see . - - Copyright 2016 (C) Libresonic Authors - Based upon Subsonic, Copyright 2009 (C) Sindre Mehus - */ -package org.libresonic.player.command; - -import org.apache.commons.lang.StringUtils; - -import org.libresonic.player.controller.PremiumSettingsController; -import org.libresonic.player.domain.LicenseInfo; -import org.libresonic.player.domain.User; - -/** - * Command used in {@link PremiumSettingsController}. - * - * @author Sindre Mehus - */ -public class PremiumSettingsCommand { - - private String path; - private String brand; - private LicenseInfo licenseInfo; - private String licenseCode; - private boolean forceChange; - private boolean submissionError; - private User user; - private boolean toast; - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } - - public String getBrand() { - return brand; - } - - public void setBrand(String brand) { - this.brand = brand; - } - - public LicenseInfo getLicenseInfo() { - return licenseInfo; - } - - public String getLicenseCode() { - return licenseCode; - } - - public void setLicenseCode(String licenseCode) { - this.licenseCode = StringUtils.trimToNull(licenseCode); - } - - public void setLicenseInfo(LicenseInfo licenseInfo) { - this.licenseInfo = licenseInfo; - } - - public boolean isForceChange() { - return forceChange; - } - - public void setForceChange(boolean forceChange) { - this.forceChange = forceChange; - } - - public boolean isSubmissionError() { - return submissionError; - } - - public void setSubmissionError(boolean submissionError) { - this.submissionError = submissionError; - } - - public void setUser(User user) { - this.user = user; - } - - public User getUser() { - return user; - } - - public void setToast(boolean toast) { - this.toast = toast; - } - - public boolean isToast() { - return toast; - } -} diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/GeneralSettingsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/GeneralSettingsController.java index 6ee010c1..b549ee56 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/GeneralSettingsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/GeneralSettingsController.java @@ -19,21 +19,17 @@ */ package org.libresonic.player.controller; -import java.util.Locale; - -import javax.servlet.http.HttpServletRequest; - +import org.libresonic.player.command.GeneralSettingsCommand; +import org.libresonic.player.domain.Theme; +import org.libresonic.player.service.SettingsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.mvc.SimpleFormController; -import org.libresonic.player.command.GeneralSettingsCommand; -import org.libresonic.player.domain.Theme; -import org.libresonic.player.service.SettingsService; +import java.util.Locale; /** * Controller for the page used to administrate general settings. diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/MusicFolderSettingsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/MusicFolderSettingsController.java index 4c3597f4..47a66562 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/MusicFolderSettingsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/MusicFolderSettingsController.java @@ -20,14 +20,12 @@ package org.libresonic.player.controller; import org.libresonic.player.command.MusicFolderSettingsCommand; -import org.libresonic.player.command.NetworkSettingsCommand; import org.libresonic.player.dao.AlbumDao; import org.libresonic.player.dao.ArtistDao; import org.libresonic.player.dao.MediaFileDao; import org.libresonic.player.domain.MusicFolder; import org.libresonic.player.service.MediaScannerService; import org.libresonic.player.service.SettingsService; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -35,11 +33,7 @@ import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.mvc.SimpleFormController; -import org.springframework.web.servlet.view.RedirectView; -import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; import java.util.List; diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/NetworkSettingsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/NetworkSettingsController.java index ae5129e9..ed341e94 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/NetworkSettingsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/NetworkSettingsController.java @@ -19,24 +19,19 @@ */ package org.libresonic.player.controller; -import java.util.Random; - -import javax.servlet.http.HttpServletRequest; - import org.apache.commons.lang.StringUtils; -import org.apache.tools.ant.taskdefs.ManifestTask; +import org.libresonic.player.command.NetworkSettingsCommand; +import org.libresonic.player.domain.UrlRedirectType; +import org.libresonic.player.service.NetworkService; +import org.libresonic.player.service.SettingsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.mvc.SimpleFormController; -import org.libresonic.player.command.NetworkSettingsCommand; -import org.libresonic.player.domain.UrlRedirectType; -import org.libresonic.player.service.NetworkService; -import org.libresonic.player.service.SettingsService; +import java.util.Random; /** * Controller for the page used to change the network settings. diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/PasswordSettingsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/PasswordSettingsController.java deleted file mode 100644 index 3fb1e1ce..00000000 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/PasswordSettingsController.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - This file is part of Libresonic. - - Libresonic is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Libresonic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Libresonic. If not, see . - - Copyright 2016 (C) Libresonic Authors - Based upon Subsonic, Copyright 2009 (C) Sindre Mehus - */ -package org.libresonic.player.controller; - -import org.springframework.web.servlet.mvc.*; -import org.libresonic.player.service.*; -import org.libresonic.player.command.*; -import org.libresonic.player.domain.*; - -import javax.servlet.http.*; - -/** - * Controller for the page used to change password. - * - * @author Sindre Mehus - */ -public class PasswordSettingsController extends SimpleFormController { - - private SecurityService securityService; - - protected Object formBackingObject(HttpServletRequest request) throws Exception { - PasswordSettingsCommand command = new PasswordSettingsCommand(); - User user = securityService.getCurrentUser(request); - command.setUsername(user.getUsername()); - command.setLdapAuthenticated(user.isLdapAuthenticated()); - return command; - } - - protected void doSubmitAction(Object comm) throws Exception { - PasswordSettingsCommand command = (PasswordSettingsCommand) comm; - User user = securityService.getUserByName(command.getUsername()); - user.setPassword(command.getPassword()); - securityService.updateUser(user); - - command.setPassword(null); - command.setConfirmPassword(null); - command.setToast(true); - } - - public void setSecurityService(SecurityService securityService) { - this.securityService = securityService; - } -} diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/PersonalSettingsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/PersonalSettingsController.java index 433e471d..f09afc82 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/PersonalSettingsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/PersonalSettingsController.java @@ -19,28 +19,21 @@ */ package org.libresonic.player.controller; -import java.util.Date; -import java.util.Locale; - -import javax.servlet.http.HttpServletRequest; - import org.apache.commons.lang.StringUtils; +import org.libresonic.player.command.PersonalSettingsCommand; +import org.libresonic.player.domain.*; +import org.libresonic.player.service.SecurityService; +import org.libresonic.player.service.SettingsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.mvc.SimpleFormController; -import org.libresonic.player.command.PersonalSettingsCommand; -import org.libresonic.player.domain.AlbumListType; -import org.libresonic.player.domain.AvatarScheme; -import org.libresonic.player.domain.Theme; -import org.libresonic.player.domain.User; -import org.libresonic.player.domain.UserSettings; -import org.libresonic.player.service.SecurityService; -import org.libresonic.player.service.SettingsService; +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.Locale; /** * Controller for the page used to administrate per-user settings. diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/PlayerSettingsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/PlayerSettingsController.java index 9dd3df9c..433467bb 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/PlayerSettingsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/PlayerSettingsController.java @@ -19,29 +19,22 @@ */ package org.libresonic.player.controller; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - import org.apache.commons.lang.StringUtils; +import org.libresonic.player.command.PlayerSettingsCommand; +import org.libresonic.player.domain.*; +import org.libresonic.player.service.PlayerService; +import org.libresonic.player.service.SecurityService; +import org.libresonic.player.service.TranscodingService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.mvc.SimpleFormController; -import org.libresonic.player.command.PlayerSettingsCommand; -import org.libresonic.player.domain.Player; -import org.libresonic.player.domain.PlayerTechnology; -import org.libresonic.player.domain.TranscodeScheme; -import org.libresonic.player.domain.Transcoding; -import org.libresonic.player.domain.User; -import org.libresonic.player.service.PlayerService; -import org.libresonic.player.service.SecurityService; -import org.libresonic.player.service.TranscodingService; +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.List; /** * Controller for the player settings page. diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/PodcastSettingsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/PodcastSettingsController.java index 4a1133de..bec26a95 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/PodcastSettingsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/PodcastSettingsController.java @@ -19,18 +19,15 @@ */ package org.libresonic.player.controller; +import org.libresonic.player.command.PodcastSettingsCommand; +import org.libresonic.player.service.PodcastService; +import org.libresonic.player.service.SettingsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.mvc.SimpleFormController; -import org.libresonic.player.service.SettingsService; -import org.libresonic.player.service.PodcastService; -import org.libresonic.player.command.PodcastSettingsCommand; - -import javax.servlet.http.HttpServletRequest; /** * Controller for the page used to administrate the Podcast receiver. diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/PremiumSettingsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/PremiumSettingsController.java deleted file mode 100644 index 39c29a6c..00000000 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/PremiumSettingsController.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - This file is part of Libresonic. - - Libresonic is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Libresonic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Libresonic. If not, see . - - Copyright 2016 (C) Libresonic Authors - Based upon Subsonic, Copyright 2009 (C) Sindre Mehus - */ -package org.libresonic.player.controller; - -import java.util.Date; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.validation.BindException; -import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.mvc.SimpleFormController; - -import org.libresonic.player.command.PremiumSettingsCommand; -import org.libresonic.player.service.SecurityService; -import org.libresonic.player.service.SettingsService; - -/** - * Controller for the Subsonic Premium page. - * - * @author Sindre Mehus - */ -public class PremiumSettingsController extends SimpleFormController { - - private SettingsService settingsService; - private SecurityService securityService; - - protected Object formBackingObject(HttpServletRequest request) throws Exception { - PremiumSettingsCommand command = new PremiumSettingsCommand(); - command.setPath(request.getParameter("path")); - command.setForceChange(request.getParameter("change") != null); - command.setLicenseInfo(settingsService.getLicenseInfo()); - command.setBrand(settingsService.getBrand()); - command.setUser(securityService.getCurrentUser(request)); - return command; - } - - protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object com, BindException errors) - throws Exception { - PremiumSettingsCommand command = (PremiumSettingsCommand) com; - Date now = new Date(); - - settingsService.setLicenseCode(command.getLicenseCode()); - settingsService.setLicenseEmail(command.getLicenseInfo().getLicenseEmail()); - settingsService.setLicenseDate(now); - settingsService.save(); - settingsService.scheduleLicenseValidation(); - - // Reflect changes in view. The validator will validate the license asynchronously. - command.setLicenseInfo(settingsService.getLicenseInfo()); - command.setToast(true); - - return new ModelAndView(getSuccessView(), errors.getModel()); - } - - public void setSettingsService(SettingsService settingsService) { - this.settingsService = settingsService; - } - - public void setSecurityService(SecurityService securityService) { - this.securityService = securityService; - } -} \ No newline at end of file diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/SearchController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/SearchController.java index 7ee3fbe8..197d96b8 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/SearchController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/SearchController.java @@ -19,32 +19,23 @@ */ package org.libresonic.player.controller; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.apache.commons.lang.StringUtils; +import org.libresonic.player.command.SearchCommand; +import org.libresonic.player.domain.*; +import org.libresonic.player.service.PlayerService; +import org.libresonic.player.service.SearchService; +import org.libresonic.player.service.SecurityService; +import org.libresonic.player.service.SettingsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; -import org.springframework.validation.BindException; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.mvc.SimpleFormController; -import org.libresonic.player.command.SearchCommand; -import org.libresonic.player.domain.MusicFolder; -import org.libresonic.player.domain.SearchCriteria; -import org.libresonic.player.domain.SearchResult; -import org.libresonic.player.domain.User; -import org.libresonic.player.domain.UserSettings; -import org.libresonic.player.service.PlayerService; -import org.libresonic.player.service.SearchService; -import org.libresonic.player.service.SecurityService; -import org.libresonic.player.service.SettingsService; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; /** * Controller for the search page. diff --git a/libresonic-main/src/main/java/org/libresonic/player/controller/UserSettingsController.java b/libresonic-main/src/main/java/org/libresonic/player/controller/UserSettingsController.java index 256acf77..02b8c294 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/controller/UserSettingsController.java +++ b/libresonic-main/src/main/java/org/libresonic/player/controller/UserSettingsController.java @@ -19,6 +19,7 @@ */ package org.libresonic.player.controller; +import org.apache.commons.lang.StringUtils; import org.libresonic.player.command.UserSettingsCommand; import org.libresonic.player.domain.MusicFolder; import org.libresonic.player.domain.TranscodeScheme; @@ -28,22 +29,17 @@ import org.libresonic.player.service.SecurityService; import org.libresonic.player.service.SettingsService; import org.libresonic.player.service.TranscodingService; import org.libresonic.player.util.Util; - -import org.apache.commons.lang.StringUtils; import org.libresonic.player.validator.UserSettingsValidator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; -import org.springframework.validation.BindingResult; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.ServletRequestBindingException; import org.springframework.web.bind.ServletRequestUtils; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.*; -import org.springframework.web.servlet.mvc.SimpleFormController; import javax.servlet.http.HttpServletRequest; - import java.util.ArrayList; import java.util.Date; import java.util.List; diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/RatingDao.java b/libresonic-main/src/main/java/org/libresonic/player/dao/RatingDao.java index 6572fac7..2dec6169 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/RatingDao.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/RatingDao.java @@ -107,7 +107,7 @@ public class RatingDao extends AbstractDao { */ public Integer getRatingForUser(String username, MediaFile mediaFile) { try { - return getJdbcTemplate().queryForInt("select rating from user_rating where username=? and path=?", new Object[]{username, mediaFile.getPath()}); + return getJdbcTemplate().queryForObject("select rating from user_rating where username=? and path=?", new Object[]{username, mediaFile.getPath()},Integer.class); } catch (EmptyResultDataAccessException x) { return null; } diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/Schema.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/Schema.java index 4cf63dca..13872a82 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/Schema.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/Schema.java @@ -68,7 +68,7 @@ public abstract class Schema { protected boolean rowExists(JdbcTemplate template, String whereClause, String table) { try { - int rowCount = template.queryForInt("select count(*) from " + table + " where " + whereClause); + int rowCount = template.queryForObject("select count(*) from " + table + " where " + whereClause,Integer.class); return rowCount > 0; } catch (Exception x) { return false; diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema26.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema26.java index 8094e7c2..05413aaf 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema26.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema26.java @@ -35,7 +35,7 @@ public class Schema26 extends Schema { public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 2") == 0) { + if (template.queryForObject("select count(*) from version where version = 2",Integer.class) == 0) { LOG.info("Updating database schema to version 2."); template.execute("insert into version values (2)"); } @@ -99,7 +99,7 @@ public class Schema26 extends Schema { LOG.info("Database column 'player.dynamic_ip' was added successfully."); } - if (template.queryForInt("select count(*) from role where id = 6") == 0) { + if (template.queryForObject("select count(*) from role where id = 6",Integer.class) == 0) { LOG.info("Role 'comment' not found in database. Creating it."); template.execute("insert into role values (6, 'comment')"); template.execute("insert into user_role " + diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema27.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema27.java index baa4672e..08ae2aa4 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema27.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema27.java @@ -35,7 +35,7 @@ public class Schema27 extends Schema { public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 3") == 0) { + if (template.queryForObject("select count(*) from version where version = 3",Integer.class) == 0) { LOG.info("Updating database schema to version 3."); template.execute("insert into version values (3)"); diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema28.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema28.java index c1678f67..515a4c0f 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema28.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema28.java @@ -35,7 +35,7 @@ public class Schema28 extends Schema { public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 4") == 0) { + if (template.queryForObject("select count(*) from version where version = 4",Integer.class) == 0) { LOG.info("Updating database schema to version 4."); template.execute("insert into version values (4)"); } diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema29.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema29.java index 2495af4b..bef298f9 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema29.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema29.java @@ -35,7 +35,7 @@ public class Schema29 extends Schema { public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 5") == 0) { + if (template.queryForObject("select count(*) from version where version = 5",Integer.class) == 0) { LOG.info("Updating database schema to version 5."); template.execute("insert into version values (5)"); } diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema30.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema30.java index 4a72499b..18e73175 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema30.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema30.java @@ -35,7 +35,7 @@ public class Schema30 extends Schema { public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 6") == 0) { + if (template.queryForObject("select count(*) from version where version = 6", Integer.class) == 0) { LOG.info("Updating database schema to version 6."); template.execute("insert into version values (6)"); } diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema31.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema31.java index a8bdc198..6019070c 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema31.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema31.java @@ -35,7 +35,7 @@ public class Schema31 extends Schema { public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 7") == 0) { + if (template.queryForObject("select count(*) from version where version = 7",Integer.class) == 0) { LOG.info("Updating database schema to version 7."); template.execute("insert into version values (7)"); } diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema32.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema32.java index bc134665..85ad7f50 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema32.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema32.java @@ -35,7 +35,7 @@ public class Schema32 extends Schema { public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 8") == 0) { + if (template.queryForObject("select count(*) from version where version = 8",Integer.class) == 0) { LOG.info("Updating database schema to version 8."); template.execute("insert into version values (8)"); } @@ -83,7 +83,7 @@ public class Schema32 extends Schema { LOG.info("Database table 'podcast_episode' was created successfully."); } - if (template.queryForInt("select count(*) from role where id = 7") == 0) { + if (template.queryForObject("select count(*) from role where id = 7",Integer.class) == 0) { LOG.info("Role 'podcast' not found in database. Creating it."); template.execute("insert into role values (7, 'podcast')"); template.execute("insert into user_role " + diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema33.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema33.java index c76376d1..ffb0f4c1 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema33.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema33.java @@ -36,7 +36,7 @@ public class Schema33 extends Schema { public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 9") == 0) { + if (template.queryForObject("select count(*) from version where version = 9",Integer.class) == 0) { LOG.info("Updating database schema to version 9."); template.execute("insert into version values (9)"); } diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema34.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema34.java index 9fb38f88..7f3b09c6 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema34.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema34.java @@ -36,7 +36,7 @@ public class Schema34 extends Schema { public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 10") == 0) { + if (template.queryForObject("select count(*) from version where version = 10",Integer.class) == 0) { LOG.info("Updating database schema to version 10."); template.execute("insert into version values (10)"); } diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema35.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema35.java index c7244686..5ed4b9d5 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema35.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema35.java @@ -58,7 +58,7 @@ public class Schema35 extends Schema { @Override public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 11") == 0) { + if (template.queryForObject("select count(*) from version where version = 11",Integer.class) == 0) { LOG.info("Updating database schema to version 11."); template.execute("insert into version values (11)"); } @@ -75,7 +75,7 @@ public class Schema35 extends Schema { LOG.info("Database column 'user_settings.web_player_default' was added successfully."); } - if (template.queryForInt("select count(*) from role where id = 8") == 0) { + if (template.queryForObject("select count(*) from role where id = 8",Integer.class) == 0) { LOG.info("Role 'stream' not found in database. Creating it."); template.execute("insert into role values (8, 'stream')"); template.execute("insert into user_role select distinct u.username, 8 from user u"); @@ -135,7 +135,7 @@ public class Schema35 extends Schema { } private void createAvatar(JdbcTemplate template, String avatar) { - if (template.queryForInt("select count(*) from system_avatar where name = ?", new Object[]{avatar}) == 0) { + if (template.queryForObject("select count(*) from system_avatar where name = ?", new Object[]{avatar},Integer.class) == 0) { InputStream in = null; try { diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema36.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema36.java index 2c763a77..03c71a7b 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema36.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema36.java @@ -37,7 +37,7 @@ public class Schema36 extends Schema { @Override public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 12") == 0) { + if (template.queryForObject("select count(*) from version where version = 12",Integer.class) == 0) { LOG.info("Updating database schema to version 12."); template.execute("insert into version values (12)"); } diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema37.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema37.java index 25fd2fe4..7d29d7d6 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema37.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema37.java @@ -37,19 +37,19 @@ public class Schema37 extends Schema { @Override public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 13") == 0) { + if (template.queryForObject("select count(*) from version where version = 13",Integer.class) == 0) { LOG.info("Updating database schema to version 13."); template.execute("insert into version values (13)"); } - if (template.queryForInt("select count(*) from role where id = 9") == 0) { + if (template.queryForObject("select count(*) from role where id = 9",Integer.class) == 0) { LOG.info("Role 'settings' not found in database. Creating it."); template.execute("insert into role values (9, 'settings')"); template.execute("insert into user_role select distinct u.username, 9 from user u"); LOG.info("Role 'settings' was created successfully."); } - if (template.queryForInt("select count(*) from role where id = 10") == 0) { + if (template.queryForObject("select count(*) from role where id = 10",Integer.class) == 0) { LOG.info("Role 'jukebox' not found in database. Creating it."); template.execute("insert into role values (10, 'jukebox')"); template.execute("insert into user_role " + diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema38.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema38.java index a2b4a389..a3fdd4d6 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema38.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema38.java @@ -37,7 +37,7 @@ public class Schema38 extends Schema { @Override public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 14") == 0) { + if (template.queryForObject("select count(*) from version where version = 14",Integer.class) == 0) { LOG.info("Updating database schema to version 14."); template.execute("insert into version values (14)"); } diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema40.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema40.java index 73c65737..4beaa679 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema40.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema40.java @@ -37,7 +37,7 @@ public class Schema40 extends Schema { @Override public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 15") == 0) { + if (template.queryForObject("select count(*) from version where version = 15",Integer.class) == 0) { LOG.info("Updating database schema to version 15."); template.execute("insert into version values (15)"); diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema43.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema43.java index 5af5726d..a0422784 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema43.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema43.java @@ -40,12 +40,12 @@ public class Schema43 extends Schema { public void execute(JdbcTemplate template) { // version 16 was used for 4.3.beta1 - if (template.queryForInt("select count(*) from version where version = 16") == 0) { + if (template.queryForObject("select count(*) from version where version = 16",Integer.class) == 0) { LOG.info("Updating database schema to version 16."); template.execute("insert into version values (16)"); } - if (template.queryForInt("select count(*) from version where version = 17") == 0) { + if (template.queryForObject("select count(*) from version where version = 17",Integer.class) == 0) { LOG.info("Updating database schema to version 17."); template.execute("insert into version values (17)"); diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema45.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema45.java index 72cdae1f..e03568ce 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema45.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema45.java @@ -37,12 +37,12 @@ public class Schema45 extends Schema { @Override public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 18") == 0) { + if (template.queryForObject("select count(*) from version where version = 18",Integer.class) == 0) { LOG.info("Updating database schema to version 18."); template.execute("insert into version values (18)"); } - if (template.queryForInt("select count(*) from role where id = 11") == 0) { + if (template.queryForObject("select count(*) from role where id = 11",Integer.class) == 0) { LOG.info("Role 'share' not found in database. Creating it."); template.execute("insert into role values (11, 'share')"); template.execute("insert into user_role " + diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema46.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema46.java index cd002ed2..814467e5 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema46.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema46.java @@ -37,7 +37,7 @@ public class Schema46 extends Schema { @Override public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 19") == 0) { + if (template.queryForObject("select count(*) from version where version = 19",Integer.class) == 0) { LOG.info("Updating database schema to version 19."); template.execute("insert into version values (19)"); } diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema47.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema47.java index 09503566..cb23d28b 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema47.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema47.java @@ -37,7 +37,7 @@ public class Schema47 extends Schema { @Override public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 20") == 0) { + if (template.queryForObject("select count(*) from version where version = 20",Integer.class) == 0) { LOG.info("Updating database schema to version 20."); template.execute("insert into version values (20)"); } diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema49.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema49.java index 8b49511c..59e7b447 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema49.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema49.java @@ -37,7 +37,7 @@ public class Schema49 extends Schema { @Override public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 21") == 0) { + if (template.queryForObject("select count(*) from version where version = 21",Integer.class) == 0) { LOG.info("Updating database schema to version 21."); template.execute("insert into version values (21)"); } diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema50.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema50.java index 8db91f62..6d3c9f52 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema50.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema50.java @@ -37,7 +37,7 @@ public class Schema50 extends Schema { @Override public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 22") == 0) { + if (template.queryForObject("select count(*) from version where version = 22",Integer.class) == 0) { LOG.info("Updating database schema to version 22."); template.execute("insert into version values (22)"); @@ -57,7 +57,7 @@ public class Schema50 extends Schema { } // Added in 5.0.beta2 - if (template.queryForInt("select count(*) from version where version = 23") == 0) { + if (template.queryForObject("select count(*) from version where version = 23",Integer.class) == 0) { LOG.info("Updating database schema to version 23."); template.execute("insert into version values (23)"); template.execute("update transcoding2 set step1='ffmpeg -i %s -map 0:0 -b:a %bk -v 0 -f mp3 -' where name='mp3 audio'"); diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema51.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema51.java index cccd762d..4285d147 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema51.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema51.java @@ -36,7 +36,7 @@ public class Schema51 extends Schema { @Override public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 23") == 0) { + if (template.queryForObject("select count(*) from version where version = 23",Integer.class) == 0) { LOG.info("Updating database schema to version 23."); template.execute("insert into version values (23)"); } diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema52.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema52.java index 2853c256..a0c33dec 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema52.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema52.java @@ -36,7 +36,7 @@ public class Schema52 extends Schema { @Override public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 24") == 0) { + if (template.queryForObject("select count(*) from version where version = 24",Integer.class) == 0) { LOG.info("Updating database schema to version 24."); template.execute("insert into version values (24)"); } diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema53.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema53.java index 9ebead30..caccee78 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema53.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema53.java @@ -38,7 +38,7 @@ public class Schema53 extends Schema { @Override public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 25") == 0) { + if (template.queryForObject("select count(*) from version where version = 25",Integer.class) == 0) { LOG.info("Updating database schema to version 25."); template.execute("insert into version values (25)"); } diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema61.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema61.java index 378d11c3..cf61876a 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema61.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema61.java @@ -34,7 +34,7 @@ public class Schema61 extends Schema { @Override public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 26") == 0) { + if (template.queryForObject("select count(*) from version where version = 26",Integer.class) == 0) { LOG.info("Updating database schema to version 26."); template.execute("insert into version values (26)"); } diff --git a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema62.java b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema62.java index 0e945944..a8a5fb0c 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema62.java +++ b/libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema62.java @@ -34,7 +34,7 @@ public class Schema62 extends Schema { @Override public void execute(JdbcTemplate template) { - if (template.queryForInt("select count(*) from version where version = 27") == 0) { + if (template.queryForObject("select count(*) from version where version = 27",Integer.class) == 0) { LOG.info("Updating database schema to version 27."); template.execute("insert into version values (27)"); } diff --git a/libresonic-main/src/main/java/org/libresonic/player/validator/PasswordSettingsValidator.java b/libresonic-main/src/main/java/org/libresonic/player/validator/PasswordSettingsValidator.java deleted file mode 100644 index 44b5260e..00000000 --- a/libresonic-main/src/main/java/org/libresonic/player/validator/PasswordSettingsValidator.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - This file is part of Libresonic. - - Libresonic is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Libresonic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Libresonic. If not, see . - - Copyright 2016 (C) Libresonic Authors - Based upon Subsonic, Copyright 2009 (C) Sindre Mehus - */ -package org.libresonic.player.validator; - -import org.springframework.validation.*; -import org.libresonic.player.command.*; -import org.libresonic.player.controller.*; - -/** - * Validator for {@link PasswordSettingsController}. - * - * @author Sindre Mehus - */ -public class PasswordSettingsValidator implements Validator { - - public boolean supports(Class clazz) { - return clazz.equals(PasswordSettingsCommand.class); - } - - public void validate(Object obj, Errors errors) { - PasswordSettingsCommand command = (PasswordSettingsCommand) obj; - - if (command.getPassword() == null || command.getPassword().length() == 0) { - errors.rejectValue("password", "usersettings.nopassword"); - } else if (!command.getPassword().equals(command.getConfirmPassword())) { - errors.rejectValue("password", "usersettings.wrongpassword"); - } - } -} diff --git a/libresonic-main/src/main/java/org/libresonic/player/validator/PremiumSettingsValidator.java b/libresonic-main/src/main/java/org/libresonic/player/validator/PremiumSettingsValidator.java deleted file mode 100644 index e4a2438b..00000000 --- a/libresonic-main/src/main/java/org/libresonic/player/validator/PremiumSettingsValidator.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - This file is part of Libresonic. - - Libresonic is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Libresonic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Libresonic. If not, see . - - Copyright 2016 (C) Libresonic Authors - Based upon Subsonic, Copyright 2009 (C) Sindre Mehus - */ -package org.libresonic.player.validator; - -import org.springframework.validation.Errors; -import org.springframework.validation.Validator; - -import org.libresonic.player.command.PremiumSettingsCommand; -import org.libresonic.player.controller.PremiumSettingsController; -import org.libresonic.player.service.SettingsService; - -/** - * Validator for {@link PremiumSettingsController}. - * - * @author Sindre Mehus - */ -public class PremiumSettingsValidator implements Validator { - private SettingsService settingsService; - - public boolean supports(Class clazz) { - return clazz.equals(PremiumSettingsCommand.class); - } - - public void validate(Object obj, Errors errors) { - PremiumSettingsCommand command = (PremiumSettingsCommand) obj; - - if (!settingsService.isLicenseValid(command.getLicenseInfo().getLicenseEmail(), command.getLicenseCode())) { - command.setSubmissionError(true); - errors.rejectValue("licenseCode", "premium.invalidlicense"); - } - } - - public void setSettingsService(SettingsService settingsService) { - this.settingsService = settingsService; - } -} diff --git a/libresonic-main/src/main/webapp/WEB-INF/applicationContext-security.xml b/libresonic-main/src/main/webapp/WEB-INF/applicationContext-security.xml index c9dc232d..e8fe29a1 100644 --- a/libresonic-main/src/main/webapp/WEB-INF/applicationContext-security.xml +++ b/libresonic-main/src/main/webapp/WEB-INF/applicationContext-security.xml @@ -3,9 +3,9 @@ xmlns:security="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/security - http://www.springframework.org/schema/security/spring-security-3.2.xsd"> + http://www.springframework.org/schema/security/spring-security.xsd"> diff --git a/libresonic-main/src/main/webapp/WEB-INF/libresonic-servlet.xml b/libresonic-main/src/main/webapp/WEB-INF/libresonic-servlet.xml index 835583ba..2a8fd8cc 100644 --- a/libresonic-main/src/main/webapp/WEB-INF/libresonic-servlet.xml +++ b/libresonic-main/src/main/webapp/WEB-INF/libresonic-servlet.xml @@ -196,14 +196,6 @@ - - - - - - - - @@ -286,14 +278,6 @@ - - - - - - - - @@ -344,10 +328,6 @@ - - - - @@ -390,8 +370,6 @@ transcodingSettingsController internetRadioSettingsController avatarUploadController - passwordSettingsController - premiumSettingsController allmusicController homeController editTagsController diff --git a/libresonic-main/src/test/java/org/libresonic/player/TestCaseUtils.java b/libresonic-main/src/test/java/org/libresonic/player/TestCaseUtils.java index f6ac5d45..8be3071a 100644 --- a/libresonic-main/src/test/java/org/libresonic/player/TestCaseUtils.java +++ b/libresonic-main/src/test/java/org/libresonic/player/TestCaseUtils.java @@ -88,7 +88,7 @@ public class TestCaseUtils { * @return */ public static Integer recordsInTable(String tableName, DaoHelper daoHelper) { - return daoHelper.getJdbcTemplate().queryForInt("select count(1) from " + tableName); + return daoHelper.getJdbcTemplate().queryForObject("select count(1) from " + tableName,Integer.class); } diff --git a/pom.xml b/pom.xml index 31b9a1da..aea990cd 100644 --- a/pom.xml +++ b/pom.xml @@ -16,8 +16,8 @@ true iso-8859-1 - 2.4.2 - 3.2.17.RELEASE + 3.1.8 + 4.3.4.RELEASE 3.2.9.RELEASE @@ -230,7 +230,6 @@ -