Skip to content

Commit

Permalink
backport fixes from spring-6 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcom committed Sep 28, 2024
1 parent 4ffa955 commit 89bb62d
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 20 deletions.
5 changes: 3 additions & 2 deletions src/main/java/ru/org/linux/exception/ExceptionController.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1998-2016 Linux.org.ru
* Copyright 1998-2024 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -20,6 +20,7 @@
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;

import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

Expand All @@ -34,7 +35,7 @@ public ModelAndView defaultExceptionHandler(
HttpServletResponse response,
Object handler
) {
Throwable ex = (Throwable) request.getAttribute("javax.servlet.error.exception");
Throwable ex = (Throwable) request.getAttribute(RequestDispatcher.ERROR_EXCEPTION);
if (ex == null) {
return new ModelAndView(new RedirectView("/"));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1998-2016 Linux.org.ru
* Copyright 1998-2024 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -16,7 +16,6 @@
package ru.org.linux.search;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
Expand All @@ -34,7 +33,6 @@ public class SearchControlController {
private TopicDao messageDao;

@Autowired
@Required
public void setSearchQueueSender(SearchQueueSender searchQueueSender) {
this.searchQueueSender = searchQueueSender;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/ru/org/linux/user/EditRegisterController.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1998-2023 Linux.org.ru
* Copyright 1998-2024 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand Down Expand Up @@ -76,7 +76,7 @@ public EditRegisterController(RememberMeServices rememberMeServices,
@RequestMapping(method = RequestMethod.GET)
public ModelAndView show(
@ModelAttribute("form") EditRegisterRequest form,
@PathVariable String nick,
@PathVariable("nick") String nick,
HttpServletResponse response
) {
Template tmpl = Template.getTemplate();
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/ru/org/linux/user/ResetPasswordController.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1998-2023 Linux.org.ru
* Copyright 1998-2024 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -18,7 +18,6 @@
import com.google.common.collect.ImmutableMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/ru/org/linux/util/LorHttpUtils.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1998-2022 Linux.org.ru
* Copyright 1998-2024 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -18,11 +18,9 @@
import com.google.common.base.Joiner;
import com.google.common.net.HttpHeaders;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Properties;

public final class LorHttpUtils {
private LorHttpUtils() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import org.springframework.web.servlet.view.RedirectView
import ru.org.linux.auth.AuthUtil.AuthorizedOnly
import ru.org.linux.auth.{AuthUtil, IPBlockDao, IPBlockInfo}
import ru.org.linux.csrf.CSRFNoAuto
import ru.org.linux.markup.{MarkupType, MessageTextService}
import ru.org.linux.markup.MessageTextService
import ru.org.linux.search.SearchQueueSender
import ru.org.linux.site.Template
import ru.org.linux.spring.dao.{MessageText, MsgbaseDao}
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/ru/org/linux/help/HelpController.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1998-2023 Linux.org.ru
* Copyright 1998-2024 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -26,7 +26,7 @@ import org.springframework.web.servlet.ModelAndView
import ru.org.linux.util.markdown.MarkdownFormatter

import java.nio.charset.StandardCharsets
import scala.jdk.CollectionConverters._
import scala.jdk.CollectionConverters.*

@Controller
class HelpController(renderService: MarkdownFormatter) extends StrictLogging {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1998-2023 Linux.org.ru
* Copyright 1998-2024 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand Down Expand Up @@ -28,6 +28,7 @@ import org.testcontainers.utility.DockerImageName
import ru.org.linux.AkkaConfiguration
import ru.org.linux.auth.FloodProtector
import ru.org.linux.search.ElasticsearchIndexService.MessageIndex
import ru.org.linux.spring.SiteConfig

@ContextConfiguration(classes = Array(classOf[SearchIntegrationTestConfiguration],
classOf[AkkaConfiguration]))
Expand Down Expand Up @@ -57,11 +58,11 @@ class ElasticsearchIndexServiceIntegrationSpec extends SpecificationWithJUnit {
basePackages = Array("ru.org.linux"),
lazyInit = true,
useDefaultFilters = false,
excludeFilters = Array(
new ComponentScan.Filter(`type` = FilterType.ASSIGNABLE_TYPE, value = Array(classOf[SiteConfig]))
),
includeFilters = Array(
new ComponentScan.Filter(
`type` = FilterType.ANNOTATION,
value = Array(classOf[Service], classOf[Repository])))
)
new ComponentScan.Filter(`type` = FilterType.ANNOTATION, value = Array(classOf[Service], classOf[Repository]))))
class SearchIntegrationTestConfiguration {
@Bean(destroyMethod="close")
def elasticClient: ElasticClient = {
Expand Down

0 comments on commit 89bb62d

Please sign in to comment.