diff --git a/spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java b/spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java index 2fc9486c50f6..f41724275445 100644 --- a/spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java +++ b/spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -315,7 +315,7 @@ private Object attemptToConvertStringToEnum(Class requiredType, String trimme } if (convertedValue == currentConvertedValue) { - // Try field lookup as fallback: for JDK 1.5 enum or custom enum + // Try field lookup as fallback: for Java enum or custom enum // with values defined as static fields. Resulting value still needs // to be checked, hence we don't return it right away. try { diff --git a/spring-context/src/main/java/org/springframework/jmx/access/MBeanClientInterceptor.java b/spring-context/src/main/java/org/springframework/jmx/access/MBeanClientInterceptor.java index 1142cfa943e3..063993eb0983 100644 --- a/spring-context/src/main/java/org/springframework/jmx/access/MBeanClientInterceptor.java +++ b/spring-context/src/main/java/org/springframework/jmx/access/MBeanClientInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -439,7 +439,7 @@ protected Object doInvoke(MethodInvocation invocation) throws Throwable { throw ex.getTargetError(); } catch (RuntimeOperationsException ex) { - // This one is only thrown by the JMX 1.2 RI, not by the JDK 1.5 JMX code. + // This one is only thrown by the JMX 1.2 RI, not by the JDK JMX code. RuntimeException rex = ex.getTargetException(); if (rex instanceof RuntimeMBeanException runtimeMBeanException) { throw runtimeMBeanException.getTargetException(); diff --git a/spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderSupport.java b/spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderSupport.java index b7c49c10e431..4bb96f9db875 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderSupport.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,7 +80,7 @@ public void setPropertiesArray(Properties... propertiesArray) { /** * Set a location of a properties file to be loaded. *

Can point to a classic properties file or to an XML file - * that follows JDK 1.5's properties XML format. + * that follows Java's properties XML format. */ public void setLocation(Resource location) { this.locations = new Resource[] {location}; @@ -89,7 +89,7 @@ public void setLocation(Resource location) { /** * Set locations of properties files to be loaded. *

Can point to classic properties files or to XML files - * that follow JDK 1.5's properties XML format. + * that follow Java's properties XML format. *

Note: Properties defined in later files will override * properties defined earlier files, in case of overlapping keys. * Hence, make sure that the most specific files are the last diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java index 56f802155b9a..78ebbda780b9 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -255,9 +255,8 @@ public interface JdbcOperations { *

The results will be mapped to an SqlRowSet which holds the data in a * disconnected fashion. This wrapper will translate any SQLExceptions thrown. *

Note that, for the default implementation, JDBC RowSet support needs to - * be available at runtime: by default, Sun's {@code com.sun.rowset.CachedRowSetImpl} - * class is used, which is part of JDK 1.5+ and also available separately as part of - * Sun's JDBC RowSet Implementations download (rowset.jar). + * be available at runtime: by default, a standard JDBC {@code CachedRowSet} + * is used. * @param sql the SQL query to execute * @return an SqlRowSet representation (possibly a wrapper around a * {@code javax.sql.rowset.CachedRowSet}) @@ -874,9 +873,8 @@ List queryForList(String sql, Object[] args, int[] argTypes, Class ele *

The results will be mapped to an SqlRowSet which holds the data in a * disconnected fashion. This wrapper will translate any SQLExceptions thrown. *

Note that, for the default implementation, JDBC RowSet support needs to - * be available at runtime: by default, Sun's {@code com.sun.rowset.CachedRowSetImpl} - * class is used, which is part of JDK 1.5+ and also available separately as part of - * Sun's JDBC RowSet Implementations download (rowset.jar). + * be available at runtime: by default, a standard JDBC {@code CachedRowSet} + * is used. * @param sql the SQL query to execute * @param args arguments to bind to the query * @param argTypes the SQL types of the arguments @@ -897,9 +895,8 @@ List queryForList(String sql, Object[] args, int[] argTypes, Class ele *

The results will be mapped to an SqlRowSet which holds the data in a * disconnected fashion. This wrapper will translate any SQLExceptions thrown. *

Note that, for the default implementation, JDBC RowSet support needs to - * be available at runtime: by default, Sun's {@code com.sun.rowset.CachedRowSetImpl} - * class is used, which is part of JDK 1.5+ and also available separately as part of - * Sun's JDBC RowSet Implementations download (rowset.jar). + * be available at runtime: by default, a standard JDBC {@code CachedRowSet} + * is used. * @param sql the SQL query to execute * @param args arguments to bind to the query * (leaving it to the PreparedStatement to guess the corresponding SQL type); diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlRowSetResultSetExtractor.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlRowSetResultSetExtractor.java index b4c36b6773fb..d7cccb81bbfc 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlRowSetResultSetExtractor.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlRowSetResultSetExtractor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -79,7 +79,7 @@ protected SqlRowSet createSqlRowSet(ResultSet rs) throws SQLException { /** * Create a new {@link CachedRowSet} instance, to be populated by * the {@code createSqlRowSet} implementation. - *

The default implementation uses JDBC 4.1's {@link RowSetFactory}. + *

The default implementation uses JDBC's {@link RowSetFactory}. * @return a new CachedRowSet instance * @throws SQLException if thrown by JDBC methods * @see #createSqlRowSet diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcOperations.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcOperations.java index c42fc38f5481..2405f5870ba3 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcOperations.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcOperations.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -449,9 +449,8 @@ List queryForList(String sql, Map paramMap, Class elementTy *

The results will be mapped to an SqlRowSet which holds the data in a * disconnected fashion. This wrapper will translate any SQLExceptions thrown. *

Note that, for the default implementation, JDBC RowSet support needs to - * be available at runtime: by default, Sun's {@code com.sun.rowset.CachedRowSetImpl} - * class is used, which is part of JDK 1.5+ and also available separately as part of - * Sun's JDBC RowSet Implementations download (rowset.jar). + * be available at runtime: by default, a standard JDBC {@code CachedRowSet} + * is used. * @param sql the SQL query to execute * @param paramSource container of arguments to bind to the query * @return an SqlRowSet representation (possibly a wrapper around a @@ -469,9 +468,8 @@ List queryForList(String sql, Map paramMap, Class elementTy *

The results will be mapped to an SqlRowSet which holds the data in a * disconnected fashion. This wrapper will translate any SQLExceptions thrown. *

Note that, for the default implementation, JDBC RowSet support needs to - * be available at runtime: by default, Sun's {@code com.sun.rowset.CachedRowSetImpl} - * class is used, which is part of JDK 1.5+ and also available separately as part of - * Sun's JDBC RowSet Implementations download (rowset.jar). + * be available at runtime: by default, a standard JDBC {@code CachedRowSet} + * is used. * @param sql the SQL query to execute * @param paramMap map of parameters to bind to the query * (leaving it to the PreparedStatement to guess the corresponding SQL type) diff --git a/spring-tx/src/main/java/org/springframework/transaction/annotation/AnnotationTransactionAttributeSource.java b/spring-tx/src/main/java/org/springframework/transaction/annotation/AnnotationTransactionAttributeSource.java index 77bed8503088..493fa0192caa 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/annotation/AnnotationTransactionAttributeSource.java +++ b/spring-tx/src/main/java/org/springframework/transaction/annotation/AnnotationTransactionAttributeSource.java @@ -35,13 +35,14 @@ /** * Implementation of the * {@link org.springframework.transaction.interceptor.TransactionAttributeSource} - * interface for working with transaction metadata in JDK 1.5+ annotation format. + * interface for working with transaction metadata from annotations. * - *

This class reads Spring's JDK 1.5+ {@link Transactional} annotation and + *

This class reads Spring's {@link Transactional @Transactional} annotation and * exposes corresponding transaction attributes to Spring's transaction infrastructure. - * Also supports JTA 1.2's {@link jakarta.transaction.Transactional} and EJB3's + * Also supports JTA's {@link jakarta.transaction.Transactional} and EJB's * {@link jakarta.ejb.TransactionAttribute} annotation (if present). - * This class may also serve as base class for a custom TransactionAttributeSource, + * + *

This class may also serve as base class for a custom TransactionAttributeSource, * or get customized through {@link TransactionAnnotationParser} strategies. * * @author Colin Sampaleanu diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/RedirectViewTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/RedirectViewTests.java index acd8f1081d22..4f420215e112 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/RedirectViewTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/RedirectViewTests.java @@ -16,8 +16,6 @@ package org.springframework.web.servlet.view; -import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; @@ -49,8 +47,9 @@ import static org.mockito.Mockito.verify; /** - * Tests for redirect view, and query string construction. - * Doesn't test URL encoding, although it does check that it's called. + * Tests for redirect view and query string construction. + * + *

Doesn't test URL encoding, although it does check that it's called. * * @author Rod Johnson * @author Juergen Hoeller @@ -61,28 +60,24 @@ */ class RedirectViewTests { - private MockHttpServletRequest request; + private MockHttpServletRequest request = new MockHttpServletRequest(); - private MockHttpServletResponse response; + private MockHttpServletResponse response = new MockHttpServletResponse(); @BeforeEach void setUp() { - this.request = new MockHttpServletRequest(); this.request.setContextPath("/context"); this.request.setCharacterEncoding(WebUtils.DEFAULT_CHARACTER_ENCODING); this.request.setAttribute(DispatcherServlet.OUTPUT_FLASH_MAP_ATTRIBUTE, new FlashMap()); this.request.setAttribute(DispatcherServlet.FLASH_MAP_MANAGER_ATTRIBUTE, new SessionFlashMapManager()); - this.response = new MockHttpServletResponse(); - } @Test void noUrlSet() { RedirectView rv = new RedirectView(); - assertThatIllegalArgumentException().isThrownBy( - rv::afterPropertiesSet); + assertThatIllegalArgumentException().isThrownBy(rv::afterPropertiesSet); } @Test @@ -175,7 +170,6 @@ void updateTargetUrl() throws Exception { verify(mockProcessor).processUrl(request, "/path"); } - @Test void updateTargetUrlWithContextLoader() throws Exception { StaticWebApplicationContext wac = new StaticWebApplicationContext(); @@ -214,7 +208,6 @@ public void remoteHost() { assertThat(rv.isRemoteHost("https://url.somewhere.com")).isFalse(); assertThat(rv.isRemoteHost("/path")).isFalse(); assertThat(rv.isRemoteHost("http://somewhereelse.example")).isTrue(); - } @Test // SPR-16752 @@ -247,8 +240,7 @@ void singleParam() throws Exception { String url = "https://url.somewhere.com"; String key = "foo"; String val = "bar"; - Map model = new HashMap<>(); - model.put(key, val); + Map model = Map.of(key, val); String expectedUrlForEncoding = url + "?" + key + "=" + val; doTest(model, url, false, expectedUrlForEncoding); } @@ -256,7 +248,7 @@ void singleParam() throws Exception { @Test void singleParamWithoutExposingModelAttributes() throws Exception { String url = "https://url.somewhere.com"; - Map model = Collections.singletonMap("foo", "bar"); + Map model = Map.of("foo", "bar"); TestRedirectView rv = new TestRedirectView(url, false, model); rv.setExposeModelAttributes(false); @@ -289,18 +281,11 @@ void twoParams() throws Exception { String val = "bar"; String key2 = "thisIsKey2"; String val2 = "andThisIsVal2"; - Map model = new HashMap<>(); + Map model = new LinkedHashMap<>(); model.put(key, val); model.put(key2, val2); - try { - String expectedUrlForEncoding = url + "?" + key + "=" + val + "&" + key2 + "=" + val2; - doTest(model, url, false, expectedUrlForEncoding); - } - catch (AssertionError err) { - // OK, so it's the other order... probably on Sun JDK 1.6 or IBM JDK 1.5 - String expectedUrlForEncoding = url + "?" + key2 + "=" + val2 + "&" + key + "=" + val; - doTest(model, url, false, expectedUrlForEncoding); - } + String expectedUrlForEncoding = url + "?" + key + "=" + val + "&" + key2 + "=" + val2; + doTest(model, url, false, expectedUrlForEncoding); } @Test @@ -308,37 +293,19 @@ void arrayParam() throws Exception { String url = "https://url.somewhere.com"; String key = "foo"; String[] val = new String[] {"bar", "baz"}; - Map model = new HashMap<>(); - model.put(key, val); - try { - String expectedUrlForEncoding = url + "?" + key + "=" + val[0] + "&" + key + "=" + val[1]; - doTest(model, url, false, expectedUrlForEncoding); - } - catch (AssertionError err) { - // OK, so it's the other order... probably on Sun JDK 1.6 or IBM JDK 1.5 - String expectedUrlForEncoding = url + "?" + key + "=" + val[1] + "&" + key + "=" + val[0]; - doTest(model, url, false, expectedUrlForEncoding); - } + Map model = Map.of(key, val); + String expectedUrlForEncoding = url + "?" + key + "=" + val[0] + "&" + key + "=" + val[1]; + doTest(model, url, false, expectedUrlForEncoding); } @Test void collectionParam() throws Exception { String url = "https://url.somewhere.com"; String key = "foo"; - List val = new ArrayList<>(); - val.add("bar"); - val.add("baz"); - Map> model = new HashMap<>(); - model.put(key, val); - try { - String expectedUrlForEncoding = url + "?" + key + "=" + val.get(0) + "&" + key + "=" + val.get(1); - doTest(model, url, false, expectedUrlForEncoding); - } - catch (AssertionError err) { - // OK, so it's the other order... probably on Sun JDK 1.6 or IBM JDK 1.5 - String expectedUrlForEncoding = url + "?" + key + "=" + val.get(1) + "&" + key + "=" + val.get(0); - doTest(model, url, false, expectedUrlForEncoding); - } + List val = List.of("bar", "baz"); + Map> model = Map.of(key, val); + String expectedUrlForEncoding = url + "?" + key + "=" + val.get(0) + "&" + key + "=" + val.get(1); + doTest(model, url, false, expectedUrlForEncoding); } @Test