Enable checkstyle's Indentation module
This commit is contained in:
@@ -11,36 +11,36 @@ public class TomcatApplication {
|
||||
|
||||
public static void configure(TomcatEmbeddedServletContainerFactory tomcatFactory) {
|
||||
|
||||
tomcatFactory.addContextCustomizers((TomcatContextCustomizer) context -> {
|
||||
tomcatFactory.addContextCustomizers((TomcatContextCustomizer) context -> {
|
||||
|
||||
StandardJarScanFilter standardJarScanFilter = new StandardJarScanFilter();
|
||||
standardJarScanFilter.setTldScan("dwr-*.jar,jstl-*.jar,spring-security-taglibs-*.jar,spring-web-*.jar,spring-webmvc-*.jar,string-*.jar,taglibs-standard-impl-*.jar,tomcat-annotations-api-*.jar,tomcat-embed-jasper-*.jar");
|
||||
standardJarScanFilter.setTldSkip("*");
|
||||
context.getJarScanner().setJarScanFilter(standardJarScanFilter);
|
||||
StandardJarScanFilter standardJarScanFilter = new StandardJarScanFilter();
|
||||
standardJarScanFilter.setTldScan("dwr-*.jar,jstl-*.jar,spring-security-taglibs-*.jar,spring-web-*.jar,spring-webmvc-*.jar,string-*.jar,taglibs-standard-impl-*.jar,tomcat-annotations-api-*.jar,tomcat-embed-jasper-*.jar");
|
||||
standardJarScanFilter.setTldSkip("*");
|
||||
context.getJarScanner().setJarScanFilter(standardJarScanFilter);
|
||||
|
||||
boolean development = (System.getProperty("airsonic.development") != null);
|
||||
boolean development = (System.getProperty("airsonic.development") != null);
|
||||
|
||||
// Increase the size and time before eviction of the Tomcat
|
||||
// cache so that resources aren't uncompressed too often.
|
||||
// See https://github.com/jhipster/generator-jhipster/issues/3995
|
||||
// Increase the size and time before eviction of the Tomcat
|
||||
// cache so that resources aren't uncompressed too often.
|
||||
// See https://github.com/jhipster/generator-jhipster/issues/3995
|
||||
|
||||
StandardRoot resources = new StandardRoot();
|
||||
if (development) {
|
||||
resources.setCachingAllowed(false);
|
||||
} else {
|
||||
resources.setCacheMaxSize(100000);
|
||||
resources.setCacheObjectMaxSize(4000);
|
||||
resources.setCacheTtl(24 * 3600 * 1000); // 1 day, in milliseconds
|
||||
}
|
||||
context.setResources(resources);
|
||||
StandardRoot resources = new StandardRoot();
|
||||
if (development) {
|
||||
resources.setCachingAllowed(false);
|
||||
} else {
|
||||
resources.setCacheMaxSize(100000);
|
||||
resources.setCacheObjectMaxSize(4000);
|
||||
resources.setCacheTtl(24 * 3600 * 1000); // 1 day, in milliseconds
|
||||
}
|
||||
context.setResources(resources);
|
||||
|
||||
// Put Jasper in production mode so that JSP aren't recompiled
|
||||
// on each request.
|
||||
// See http://stackoverflow.com/questions/29653326/spring-boot-application-slow-because-of-jsp-compilation
|
||||
Container jsp = context.findChild("jsp");
|
||||
if (jsp instanceof Wrapper) {
|
||||
((Wrapper) jsp).addInitParameter("development", Boolean.toString(development));
|
||||
}
|
||||
});
|
||||
// Put Jasper in production mode so that JSP aren't recompiled
|
||||
// on each request.
|
||||
// See http://stackoverflow.com/questions/29653326/spring-boot-application-slow-because-of-jsp-compilation
|
||||
Container jsp = context.findChild("jsp");
|
||||
if (jsp instanceof Wrapper) {
|
||||
((Wrapper) jsp).addInitParameter("development", Boolean.toString(development));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class HelpController {
|
||||
String current;
|
||||
while((current = reader.readLine()) != null) {
|
||||
if (lines.size() >= LOG_LINES_TO_SHOW) {
|
||||
break;
|
||||
break;
|
||||
}
|
||||
lines.add(0, current);
|
||||
}
|
||||
|
||||
+3
-3
@@ -57,8 +57,8 @@ public class ImportPlaylistController {
|
||||
|
||||
@PostMapping
|
||||
protected String handlePost(RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request
|
||||
) throws Exception {
|
||||
HttpServletRequest request
|
||||
) throws Exception {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
try {
|
||||
@@ -79,7 +79,7 @@ public class ImportPlaylistController {
|
||||
String format = StringUtils.lowerCase(FilenameUtils.getExtension(item.getName()));
|
||||
String username = securityService.getCurrentUsername(request);
|
||||
Playlist playlist = playlistService.importPlaylist(username, playlistName, fileName,
|
||||
item.getInputStream(), null);
|
||||
item.getInputStream(), null);
|
||||
map.put("playlist", playlist);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ public class MainController {
|
||||
}
|
||||
|
||||
return new ModelAndView(view, "model", map);
|
||||
}
|
||||
}
|
||||
|
||||
private <T> boolean trimToSize(Boolean showAll, List<T> list, int userPaginationPreference) {
|
||||
boolean trimmed = false;
|
||||
|
||||
@@ -75,8 +75,8 @@ public class RecoverController {
|
||||
} else {
|
||||
StringBuilder sb = new StringBuilder(PASSWORD_LENGTH);
|
||||
for(int i=0; i<PASSWORD_LENGTH; i++) {
|
||||
int index = random.nextInt(SYMBOLS.length());
|
||||
sb.append(SYMBOLS.charAt(index));
|
||||
int index = random.nextInt(SYMBOLS.length());
|
||||
sb.append(SYMBOLS.charAt(index));
|
||||
}
|
||||
String password = sb.toString();
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class SettingsController {
|
||||
@Autowired
|
||||
private SecurityService securityService;
|
||||
|
||||
@GetMapping
|
||||
@GetMapping
|
||||
protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception {
|
||||
|
||||
User user = securityService.getCurrentUser(request);
|
||||
@@ -51,6 +51,6 @@ public class SettingsController {
|
||||
String view = user.isAdminRole() ? "musicFolderSettings" : "personalSettings";
|
||||
|
||||
return new ModelAndView(new RedirectView(view));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ public class UploadController {
|
||||
ZipEntry entry = (ZipEntry) entries.nextElement();
|
||||
File entryFile = new File(file.getParentFile(), entry.getName());
|
||||
if (!entryFile.toPath().normalize().startsWith(file.getParentFile().toPath())) {
|
||||
throw new Exception("Bad zip filename: " + StringUtil.toHtml(entryFile.getPath()));
|
||||
throw new Exception("Bad zip filename: " + StringUtil.toHtml(entryFile.getPath()));
|
||||
}
|
||||
|
||||
if (!entry.isDirectory()) {
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ public class UserSettingsController {
|
||||
protected String displayForm(HttpServletRequest request, Model model) throws Exception {
|
||||
UserSettingsCommand command;
|
||||
if(!model.containsAttribute("command")) {
|
||||
command = new UserSettingsCommand();
|
||||
command = new UserSettingsCommand();
|
||||
|
||||
User user = getUser(request);
|
||||
if (user != null) {
|
||||
|
||||
@@ -60,8 +60,8 @@ public class AbstractDao {
|
||||
}
|
||||
|
||||
protected String questionMarks(String columns) {
|
||||
int numberOfColumns = StringUtils.countMatches(columns, ",") + 1;
|
||||
return StringUtils.repeat("?", ", ", numberOfColumns);
|
||||
int numberOfColumns = StringUtils.countMatches(columns, ",") + 1;
|
||||
return StringUtils.repeat("?", ", ", numberOfColumns);
|
||||
}
|
||||
|
||||
protected String prefix(String columns, String prefix) {
|
||||
|
||||
@@ -51,10 +51,10 @@ public class RatingDao extends AbstractDao {
|
||||
}
|
||||
|
||||
Map<String, Object> args = new HashMap<>();
|
||||
args.put("type", MediaFile.MediaType.ALBUM.name());
|
||||
args.put("folders", MusicFolder.toPathList(musicFolders));
|
||||
args.put("count", count);
|
||||
args.put("offset", offset);
|
||||
args.put("type", MediaFile.MediaType.ALBUM.name());
|
||||
args.put("folders", MusicFolder.toPathList(musicFolders));
|
||||
args.put("count", count);
|
||||
args.put("offset", offset);
|
||||
|
||||
String sql = "select user_rating.path from user_rating, media_file " +
|
||||
"where user_rating.path=media_file.path and media_file.present and media_file.type = :type and media_file.folder in (:folders) " +
|
||||
|
||||
@@ -59,11 +59,11 @@ public class SearchResult {
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public int getTotalHits() {
|
||||
public int getTotalHits() {
|
||||
return totalHits;
|
||||
}
|
||||
|
||||
public void setTotalHits(int totalHits) {
|
||||
this.totalHits = totalHits;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,9 +74,9 @@ public class GlobalSecurityConfig extends GlobalAuthenticationConfigurerAdapter
|
||||
}
|
||||
|
||||
private static String generateRememberMeKey() {
|
||||
byte[] array = new byte[32];
|
||||
new SecureRandom().nextBytes(array);
|
||||
return new String(array);
|
||||
byte[] array = new byte[32];
|
||||
new SecureRandom().nextBytes(array);
|
||||
return new String(array);
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
+1
-3
@@ -46,9 +46,7 @@ public class JWTAuthenticationProvider implements AuthenticationProvider {
|
||||
// TODO:AD This is super unfortunate, but not sure there is a better way when using JSP
|
||||
if(StringUtils.contains(authentication.getRequestedPath(), "/WEB-INF/jsp/")) {
|
||||
logger.warn("BYPASSING AUTH FOR WEB-INF page");
|
||||
} else
|
||||
|
||||
if(!roughlyEqual(path.asString(), authentication.getRequestedPath())) {
|
||||
} else if(!roughlyEqual(path.asString(), authentication.getRequestedPath())) {
|
||||
throw new InsufficientAuthenticationException("Credentials not valid for path " + authentication
|
||||
.getRequestedPath() + ". They are valid for " + path.asString());
|
||||
}
|
||||
|
||||
+5
-5
@@ -31,11 +31,11 @@ public class JWTRequestParameterProcessingFilter implements Filter {
|
||||
}
|
||||
|
||||
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException {
|
||||
Optional<JWTAuthenticationToken> token = findToken(request);
|
||||
if(token.isPresent()) {
|
||||
return authenticationManager.authenticate(token.get());
|
||||
}
|
||||
throw new AuthenticationServiceException("Invalid auth method");
|
||||
Optional<JWTAuthenticationToken> token = findToken(request);
|
||||
if(token.isPresent()) {
|
||||
return authenticationManager.authenticate(token.get());
|
||||
}
|
||||
throw new AuthenticationServiceException("Invalid auth method");
|
||||
}
|
||||
|
||||
private static Optional<JWTAuthenticationToken> findToken(HttpServletRequest request) {
|
||||
|
||||
@@ -74,10 +74,10 @@ public class PodcastService {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(PodcastService.class);
|
||||
private static final DateFormat[] RSS_DATE_FORMATS = {new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US),
|
||||
new SimpleDateFormat("dd MMM yyyy HH:mm:ss Z", Locale.US)};
|
||||
new SimpleDateFormat("dd MMM yyyy HH:mm:ss Z", Locale.US)};
|
||||
|
||||
private static final Namespace[] ITUNES_NAMESPACES = {Namespace.getNamespace("http://www.itunes.com/DTDs/Podcast-1.0.dtd"),
|
||||
Namespace.getNamespace("http://www.itunes.com/dtds/podcast-1.0.dtd")};
|
||||
Namespace.getNamespace("http://www.itunes.com/dtds/podcast-1.0.dtd")};
|
||||
|
||||
private final ExecutorService refreshExecutor;
|
||||
private final ExecutorService downloadExecutor;
|
||||
@@ -704,7 +704,7 @@ public class PodcastService {
|
||||
File channelDir = new File(podcastDir, StringUtil.fileSystemSafe(channel.getTitle()));
|
||||
|
||||
if (!podcastDir.canWrite()) {
|
||||
throw new RuntimeException("The podcasts directory " + podcastDir + " isn't writeable.");
|
||||
throw new RuntimeException("The podcasts directory " + podcastDir + " isn't writeable.");
|
||||
}
|
||||
|
||||
if (!channelDir.exists()) {
|
||||
|
||||
+3
-3
@@ -168,7 +168,7 @@ public class SearchServiceImpl implements SearchService {
|
||||
|
||||
Query query = queryFactory.getRandomSongs(criteria);
|
||||
return createRandomDocsList(criteria.getCount(), searcher, query,
|
||||
(dist, id) -> util.addIgnoreNull(dist, SONG, id));
|
||||
(dist, id) -> util.addIgnoreNull(dist, SONG, id));
|
||||
|
||||
} catch (IOException e) {
|
||||
LOG.error("Failed to search or random songs.", e);
|
||||
@@ -191,7 +191,7 @@ public class SearchServiceImpl implements SearchService {
|
||||
|
||||
Query query = queryFactory.getRandomAlbums(musicFolders);
|
||||
return createRandomDocsList(count, searcher, query,
|
||||
(dist, id) -> util.addIgnoreNull(dist, ALBUM, id));
|
||||
(dist, id) -> util.addIgnoreNull(dist, ALBUM, id));
|
||||
|
||||
} catch (IOException e) {
|
||||
LOG.error("Failed to search for random albums.", e);
|
||||
@@ -214,7 +214,7 @@ public class SearchServiceImpl implements SearchService {
|
||||
|
||||
Query query = queryFactory.getRandomAlbumsId3(musicFolders);
|
||||
return createRandomDocsList(count, searcher, query,
|
||||
(dist, id) -> util.addIgnoreNull(dist, ALBUM_ID3, id));
|
||||
(dist, id) -> util.addIgnoreNull(dist, ALBUM_ID3, id));
|
||||
|
||||
} catch (IOException e) {
|
||||
LOG.error("Failed to search for random albums.", e);
|
||||
|
||||
+14
-14
@@ -153,20 +153,20 @@ public class DispatchingContentDirectory extends CustomContentDirectory {
|
||||
|
||||
private UpnpContentProcessor findProcessor(String type) {
|
||||
switch(type) {
|
||||
case CONTAINER_ID_ROOT:
|
||||
return getRootProcessor();
|
||||
case CONTAINER_ID_PLAYLIST_PREFIX:
|
||||
return getPlaylistProcessor();
|
||||
case CONTAINER_ID_FOLDER_PREFIX:
|
||||
return getMediaFileProcessor();
|
||||
case CONTAINER_ID_ALBUM_PREFIX:
|
||||
return getAlbumProcessor();
|
||||
case CONTAINER_ID_RECENT_PREFIX:
|
||||
return getRecentAlbumProcessor();
|
||||
case CONTAINER_ID_ARTIST_PREFIX:
|
||||
return getArtistProcessor();
|
||||
case CONTAINER_ID_GENRE_PREFIX:
|
||||
return getGenreProcessor();
|
||||
case CONTAINER_ID_ROOT:
|
||||
return getRootProcessor();
|
||||
case CONTAINER_ID_PLAYLIST_PREFIX:
|
||||
return getPlaylistProcessor();
|
||||
case CONTAINER_ID_FOLDER_PREFIX:
|
||||
return getMediaFileProcessor();
|
||||
case CONTAINER_ID_ALBUM_PREFIX:
|
||||
return getAlbumProcessor();
|
||||
case CONTAINER_ID_RECENT_PREFIX:
|
||||
return getRecentAlbumProcessor();
|
||||
case CONTAINER_ID_ARTIST_PREFIX:
|
||||
return getArtistProcessor();
|
||||
case CONTAINER_ID_GENRE_PREFIX:
|
||||
return getGenreProcessor();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -140,13 +140,7 @@ public final class FileUtil {
|
||||
}
|
||||
|
||||
private static <T> T timed(FileTask<T> task) {
|
||||
// long t0 = System.nanoTime();
|
||||
// try {
|
||||
return task.execute();
|
||||
// } finally {
|
||||
// long t1 = System.nanoTime();
|
||||
// LOG.debug((t1 - t0) / 1000L + " microsec, " + task);
|
||||
// }
|
||||
return task.execute();
|
||||
}
|
||||
|
||||
private abstract static class FileTask<T> {
|
||||
@@ -166,4 +160,4 @@ public final class FileUtil {
|
||||
return name + ", " + file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<module name="EmptyStatement"/>
|
||||
<module name="EqualsAvoidNull"/>
|
||||
<module name="EqualsHashCode"/>
|
||||
<module name="Indentation"/>
|
||||
<module name="InnerAssignment"/>
|
||||
<module name="RedundantImport"/>
|
||||
<module name="StringLiteralEquality"/>
|
||||
|
||||
Reference in New Issue
Block a user