diff --git a/spring-aop/src/main/java/org/springframework/aop/support/ControlFlowPointcut.java b/spring-aop/src/main/java/org/springframework/aop/support/ControlFlowPointcut.java index c945eb7b03..b8545095c7 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/ControlFlowPointcut.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/ControlFlowPointcut.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 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. @@ -78,8 +78,7 @@ public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher } /** - * Subclasses can override this if it's possible to filter out - * some candidate classes. + * Subclasses can override this if it's possible to filter out some candidate classes. */ @Override public boolean matches(Method method, Class targetClass) { diff --git a/spring-context/src/main/java/org/springframework/instrument/classloading/jboss/JBossLoadTimeWeaver.java b/spring-context/src/main/java/org/springframework/instrument/classloading/jboss/JBossLoadTimeWeaver.java index 8e42e094de..cd458113b4 100644 --- a/spring-context/src/main/java/org/springframework/instrument/classloading/jboss/JBossLoadTimeWeaver.java +++ b/spring-context/src/main/java/org/springframework/instrument/classloading/jboss/JBossLoadTimeWeaver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2019 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. @@ -32,6 +32,7 @@ import org.springframework.util.ReflectionUtils; * Thanks to Ales Justin and Marius Bogoevici for the initial prototype. * *

As of Spring Framework 5.0, this weaver supports WildFly 8+. + * As of Spring Framework 5.1.5, it also supports WildFly 13+. * * @author Costin Leau * @author Juergen Hoeller @@ -41,8 +42,10 @@ public class JBossLoadTimeWeaver implements LoadTimeWeaver { private static final String DELEGATING_TRANSFORMER_CLASS_NAME = "org.jboss.as.server.deployment.module.DelegatingClassFileTransformer"; - - private static final String WRAPPER_TRANSFORMER_CLASS_NAME = "org.jboss.modules.JLIClassTransformer"; + + private static final String WRAPPER_TRANSFORMER_CLASS_NAME = + "org.jboss.modules.JLIClassTransformer"; + private final ClassLoader classLoader; @@ -78,23 +81,21 @@ public class JBossLoadTimeWeaver implements LoadTimeWeaver { transformer.setAccessible(true); Object suggestedTransformer = transformer.get(classLoader); - - if (suggestedTransformer.getClass().getName().equals(WRAPPER_TRANSFORMER_CLASS_NAME)) { - Field wrappedTransformer = ReflectionUtils.findField(suggestedTransformer.getClass(), "transformer"); - if (wrappedTransformer == null) { - throw new IllegalArgumentException("Could not find 'transformer' field on JBoss ClassTransformer: " + - suggestedTransformer.getClass().getName()); - } - wrappedTransformer.setAccessible(true); - suggestedTransformer = wrappedTransformer.get(suggestedTransformer); - } - - if (!suggestedTransformer.getClass().getName().equals(DELEGATING_TRANSFORMER_CLASS_NAME)) { + if (suggestedTransformer.getClass().getName().equals(WRAPPER_TRANSFORMER_CLASS_NAME)) { + Field wrappedTransformer = ReflectionUtils.findField(suggestedTransformer.getClass(), "transformer"); + if (wrappedTransformer == null) { + throw new IllegalArgumentException( + "Could not find 'transformer' field on JBoss JLIClassTransformer: " + + suggestedTransformer.getClass().getName()); + } + wrappedTransformer.setAccessible(true); + suggestedTransformer = wrappedTransformer.get(suggestedTransformer); + } + if (!suggestedTransformer.getClass().getName().equals(DELEGATING_TRANSFORMER_CLASS_NAME)) { throw new IllegalStateException( "Transformer not of the expected type DelegatingClassFileTransformer: " + suggestedTransformer.getClass().getName()); } - this.delegatingTransformer = suggestedTransformer; Method addTransformer = ReflectionUtils.findMethod(this.delegatingTransformer.getClass(), diff --git a/spring-core/src/main/java/org/springframework/core/CollectionFactory.java b/spring-core/src/main/java/org/springframework/core/CollectionFactory.java index 7b67ed34cb..d2a3830d1c 100644 --- a/spring-core/src/main/java/org/springframework/core/CollectionFactory.java +++ b/spring-core/src/main/java/org/springframework/core/CollectionFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 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. @@ -145,7 +145,7 @@ public final class CollectionFactory { * Create the most appropriate collection for the given collection type. *

Delegates to {@link #createCollection(Class, Class, int)} with a * {@code null} element type. - * @param collectionType the desired type of the target collection; never {@code null} + * @param collectionType the desired type of the target collection (never {@code null}) * @param capacity the initial capacity * @return a new collection instance * @throws IllegalArgumentException if the supplied {@code collectionType} @@ -164,7 +164,7 @@ public final class CollectionFactory { * supplied {@code elementType} is an enum type matching type {@code E}. * As an alternative, the caller may wish to treat the return value as a * raw collection or collection of {@link Object}. - * @param collectionType the desired type of the target collection; never {@code null} + * @param collectionType the desired type of the target collection (never {@code null}) * @param elementType the collection's element type, or {@code null} if unknown * (note: only relevant for {@link EnumSet} creation) * @param capacity the initial capacity @@ -280,7 +280,7 @@ public final class CollectionFactory { * may wish to treat the return value as a raw map or map keyed by * {@link Object}. Similarly, type safety cannot be enforced if the * desired {@code mapType} is {@link MultiValueMap}. - * @param mapType the desired type of the target map; never {@code null} + * @param mapType the desired type of the target map (never {@code null}) * @param keyType the map's key type, or {@code null} if unknown * (note: only relevant for {@link EnumMap} creation) * @param capacity the initial capacity diff --git a/spring-core/src/main/java/org/springframework/util/ConcurrentReferenceHashMap.java b/spring-core/src/main/java/org/springframework/util/ConcurrentReferenceHashMap.java index eeb918d197..37c6c584e6 100644 --- a/spring-core/src/main/java/org/springframework/util/ConcurrentReferenceHashMap.java +++ b/spring-core/src/main/java/org/springframework/util/ConcurrentReferenceHashMap.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 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. @@ -575,7 +575,8 @@ public class ConcurrentReferenceHashMap extends AbstractMap implemen * @param allowResize if resizing is permitted */ protected final void restructureIfNecessary(boolean allowResize) { - boolean needsResize = (this.count.get() > 0 && this.count.get() >= this.resizeThreshold); + int currCount = this.count.get(); + boolean needsResize = (currCount > 0 && currCount >= this.resizeThreshold); Reference ref = this.referenceManager.pollForPurge(); if (ref != null || (needsResize && allowResize)) { lock(); diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelExpression.java b/spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelExpression.java index 1c01a49c2a..a62a7ac053 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelExpression.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelExpression.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 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. @@ -16,6 +16,8 @@ package org.springframework.expression.spel.standard; +import java.util.concurrent.atomic.AtomicInteger; + import org.springframework.core.convert.TypeDescriptor; import org.springframework.expression.EvaluationContext; import org.springframework.expression.EvaluationException; @@ -34,8 +36,6 @@ import org.springframework.expression.spel.support.StandardEvaluationContext; import org.springframework.lang.Nullable; import org.springframework.util.Assert; -import java.util.concurrent.atomic.AtomicInteger; - /** * A {@code SpelExpression} represents a parsed (valid) expression that is ready to be * evaluated in a specified context. An expression can be evaluated standalone or in a diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLStateSQLExceptionTranslator.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLStateSQLExceptionTranslator.java index 3178f0c21a..554f4abcf1 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLStateSQLExceptionTranslator.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLStateSQLExceptionTranslator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2019 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. @@ -58,32 +58,32 @@ public class SQLStateSQLExceptionTranslator extends AbstractFallbackSQLException static { - BAD_SQL_GRAMMAR_CODES.add("07"); // Dynamic SQL error - BAD_SQL_GRAMMAR_CODES.add("21"); // Cardinality violation - BAD_SQL_GRAMMAR_CODES.add("2A"); // Syntax error direct SQL - BAD_SQL_GRAMMAR_CODES.add("37"); // Syntax error dynamic SQL - BAD_SQL_GRAMMAR_CODES.add("42"); // General SQL syntax error - BAD_SQL_GRAMMAR_CODES.add("65"); // Oracle: unknown identifier - - DATA_INTEGRITY_VIOLATION_CODES.add("01"); // Data truncation - DATA_INTEGRITY_VIOLATION_CODES.add("02"); // No data found - DATA_INTEGRITY_VIOLATION_CODES.add("22"); // Value out of range - DATA_INTEGRITY_VIOLATION_CODES.add("23"); // Integrity constraint violation - DATA_INTEGRITY_VIOLATION_CODES.add("27"); // Triggered data change violation - DATA_INTEGRITY_VIOLATION_CODES.add("44"); // With check violation - - DATA_ACCESS_RESOURCE_FAILURE_CODES.add("08"); // Connection exception - DATA_ACCESS_RESOURCE_FAILURE_CODES.add("53"); // PostgreSQL: insufficient resources (e.g. disk full) - DATA_ACCESS_RESOURCE_FAILURE_CODES.add("54"); // PostgreSQL: program limit exceeded (e.g. statement too complex) - DATA_ACCESS_RESOURCE_FAILURE_CODES.add("57"); // DB2: out-of-memory exception / database not started - DATA_ACCESS_RESOURCE_FAILURE_CODES.add("58"); // DB2: unexpected system error - - TRANSIENT_DATA_ACCESS_RESOURCE_CODES.add("JW"); // Sybase: internal I/O error - TRANSIENT_DATA_ACCESS_RESOURCE_CODES.add("JZ"); // Sybase: unexpected I/O error - TRANSIENT_DATA_ACCESS_RESOURCE_CODES.add("S1"); // DB2: communication failure - - CONCURRENCY_FAILURE_CODES.add("40"); // Transaction rollback - CONCURRENCY_FAILURE_CODES.add("61"); // Oracle: deadlock + BAD_SQL_GRAMMAR_CODES.add("07"); // Dynamic SQL error + BAD_SQL_GRAMMAR_CODES.add("21"); // Cardinality violation + BAD_SQL_GRAMMAR_CODES.add("2A"); // Syntax error direct SQL + BAD_SQL_GRAMMAR_CODES.add("37"); // Syntax error dynamic SQL + BAD_SQL_GRAMMAR_CODES.add("42"); // General SQL syntax error + BAD_SQL_GRAMMAR_CODES.add("65"); // Oracle: unknown identifier + + DATA_INTEGRITY_VIOLATION_CODES.add("01"); // Data truncation + DATA_INTEGRITY_VIOLATION_CODES.add("02"); // No data found + DATA_INTEGRITY_VIOLATION_CODES.add("22"); // Value out of range + DATA_INTEGRITY_VIOLATION_CODES.add("23"); // Integrity constraint violation + DATA_INTEGRITY_VIOLATION_CODES.add("27"); // Triggered data change violation + DATA_INTEGRITY_VIOLATION_CODES.add("44"); // With check violation + + DATA_ACCESS_RESOURCE_FAILURE_CODES.add("08"); // Connection exception + DATA_ACCESS_RESOURCE_FAILURE_CODES.add("53"); // PostgreSQL: insufficient resources (e.g. disk full) + DATA_ACCESS_RESOURCE_FAILURE_CODES.add("54"); // PostgreSQL: program limit exceeded (e.g. statement too complex) + DATA_ACCESS_RESOURCE_FAILURE_CODES.add("57"); // DB2: out-of-memory exception / database not started + DATA_ACCESS_RESOURCE_FAILURE_CODES.add("58"); // DB2: unexpected system error + + TRANSIENT_DATA_ACCESS_RESOURCE_CODES.add("JW"); // Sybase: internal I/O error + TRANSIENT_DATA_ACCESS_RESOURCE_CODES.add("JZ"); // Sybase: unexpected I/O error + TRANSIENT_DATA_ACCESS_RESOURCE_CODES.add("S1"); // DB2: communication failure + + CONCURRENCY_FAILURE_CODES.add("40"); // Transaction rollback + CONCURRENCY_FAILURE_CODES.add("61"); // Oracle: deadlock }