Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -30,13 +30,14 @@ public class AdviceEntry implements ParseState.Entry {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of the {@link AdviceEntry} class.
|
* Create a new {@code AdviceEntry} instance.
|
||||||
* @param kind the kind of advice represented by this entry (before, after, around, etc.)
|
* @param kind the kind of advice represented by this entry (before, after, around)
|
||||||
*/
|
*/
|
||||||
public AdviceEntry(String kind) {
|
public AdviceEntry(String kind) {
|
||||||
this.kind = kind;
|
this.kind = kind;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Advice (" + this.kind + ")";
|
return "Advice (" + this.kind + ")";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -30,13 +30,14 @@ public class AdvisorEntry implements ParseState.Entry {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of the {@link AdvisorEntry} class.
|
* Create a new {@code AdvisorEntry} instance.
|
||||||
* @param name the bean name of the advisor
|
* @param name the bean name of the advisor
|
||||||
*/
|
*/
|
||||||
public AdvisorEntry(String name) {
|
public AdvisorEntry(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Advisor '" + this.name + "'";
|
return "Advisor '" + this.name + "'";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2007 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -34,7 +34,7 @@ public class AspectEntry implements ParseState.Entry {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new AspectEntry.
|
* Create a new {@code AspectEntry} instance.
|
||||||
* @param id the id of the aspect element
|
* @param id the id of the aspect element
|
||||||
* @param ref the bean name referenced by this aspect element
|
* @param ref the bean name referenced by this aspect element
|
||||||
*/
|
*/
|
||||||
@@ -43,6 +43,7 @@ public class AspectEntry implements ParseState.Entry {
|
|||||||
this.ref = ref;
|
this.ref = ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Aspect: " + (StringUtils.hasLength(this.id) ? "id='" + this.id + "'" : "ref='" + this.ref + "'");
|
return "Aspect: " + (StringUtils.hasLength(this.id) ? "id='" + this.id + "'" : "ref='" + this.ref + "'");
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -28,14 +28,16 @@ public class PointcutEntry implements ParseState.Entry {
|
|||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of the {@link PointcutEntry} class.
|
* Create a new {@code PointcutEntry} instance.
|
||||||
* @param name the bean name of the pointcut
|
* @param name the bean name of the pointcut
|
||||||
*/
|
*/
|
||||||
public PointcutEntry(String name) {
|
public PointcutEntry(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Pointcut '" + this.name + "'";
|
return "Pointcut '" + this.name + "'";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2006 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -24,18 +24,17 @@ package org.springframework.beans.factory.parsing;
|
|||||||
*/
|
*/
|
||||||
public class BeanEntry implements ParseState.Entry {
|
public class BeanEntry implements ParseState.Entry {
|
||||||
|
|
||||||
private String beanDefinitionName;
|
private final String beanDefinitionName;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of {@link BeanEntry} class.
|
* Create a new {@code BeanEntry} instance.
|
||||||
* @param beanDefinitionName the name of the associated bean definition
|
* @param beanDefinitionName the name of the associated bean definition
|
||||||
*/
|
*/
|
||||||
public BeanEntry(String beanDefinitionName) {
|
public BeanEntry(String beanDefinitionName) {
|
||||||
this.beanDefinitionName = beanDefinitionName;
|
this.beanDefinitionName = beanDefinitionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Bean '" + this.beanDefinitionName + "'";
|
return "Bean '" + this.beanDefinitionName + "'";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -22,23 +22,17 @@ import org.springframework.lang.Nullable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple {@link LinkedList}-based structure for tracking the logical position during
|
* Simple {@link LinkedList}-based structure for tracking the logical position during
|
||||||
* a parsing process. {@link Entry entries} are added to the LinkedList at
|
* a parsing process. {@link Entry entries} are added to the LinkedList at each point
|
||||||
* each point during the parse phase in a reader-specific manner.
|
* during the parse phase in a reader-specific manner.
|
||||||
*
|
*
|
||||||
* <p>Calling {@link #toString()} will render a tree-style view of the current logical
|
* <p>Calling {@link #toString()} will render a tree-style view of the current logical
|
||||||
* position in the parse phase. This representation is intended for use in
|
* position in the parse phase. This representation is intended for use in error messages.
|
||||||
* error messages.
|
|
||||||
*
|
*
|
||||||
* @author Rob Harrop
|
* @author Rob Harrop
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public final class ParseState {
|
public final class ParseState {
|
||||||
|
|
||||||
/**
|
|
||||||
* Tab character used when rendering the tree-style representation.
|
|
||||||
*/
|
|
||||||
private static final char TAB = '\t';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal {@link LinkedList} storage.
|
* Internal {@link LinkedList} storage.
|
||||||
*/
|
*/
|
||||||
@@ -53,8 +47,8 @@ public final class ParseState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new {@code ParseState} whose {@link LinkedList} is a {@link Object#clone clone}
|
* Create a new {@code ParseState} whose {@link LinkedList} is a clone
|
||||||
* of that of the passed in {@code ParseState}.
|
* of the state in the passed in {@code ParseState}.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private ParseState(ParseState other) {
|
private ParseState(ParseState other) {
|
||||||
@@ -99,16 +93,18 @@ public final class ParseState {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder(64);
|
||||||
for (int x = 0; x < this.state.size(); x++) {
|
int i = 0;
|
||||||
if (x > 0) {
|
for (ParseState.Entry entry : this.state) {
|
||||||
|
if (i > 0) {
|
||||||
sb.append('\n');
|
sb.append('\n');
|
||||||
for (int y = 0; y < x; y++) {
|
for (int j = 0; j < i; j++) {
|
||||||
sb.append(TAB);
|
sb.append('\t');
|
||||||
}
|
}
|
||||||
sb.append("-> ");
|
sb.append("-> ");
|
||||||
}
|
}
|
||||||
sb.append(this.state.get(x));
|
sb.append(entry);
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
@@ -118,7 +114,6 @@ public final class ParseState {
|
|||||||
* Marker interface for entries into the {@link ParseState}.
|
* Marker interface for entries into the {@link ParseState}.
|
||||||
*/
|
*/
|
||||||
public interface Entry {
|
public interface Entry {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -30,14 +30,12 @@ public class PropertyEntry implements ParseState.Entry {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of the {@link PropertyEntry} class.
|
* Create a new {@code PropertyEntry} instance.
|
||||||
* @param name the name of the JavaBean property represented by this instance
|
* @param name the name of the JavaBean property represented by this instance
|
||||||
* @throws IllegalArgumentException if the supplied {@code name} is {@code null}
|
|
||||||
* or consists wholly of whitespace
|
|
||||||
*/
|
*/
|
||||||
public PropertyEntry(String name) {
|
public PropertyEntry(String name) {
|
||||||
if (!StringUtils.hasText(name)) {
|
if (!StringUtils.hasText(name)) {
|
||||||
throw new IllegalArgumentException("Invalid property name '" + name + "'.");
|
throw new IllegalArgumentException("Invalid property name '" + name + "'");
|
||||||
}
|
}
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -26,16 +26,21 @@ import org.springframework.util.StringUtils;
|
|||||||
*/
|
*/
|
||||||
public class QualifierEntry implements ParseState.Entry {
|
public class QualifierEntry implements ParseState.Entry {
|
||||||
|
|
||||||
private String typeName;
|
private final String typeName;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new {@code QualifierEntry} instance.
|
||||||
|
* @param typeName the name of the qualifier type
|
||||||
|
*/
|
||||||
public QualifierEntry(String typeName) {
|
public QualifierEntry(String typeName) {
|
||||||
if (!StringUtils.hasText(typeName)) {
|
if (!StringUtils.hasText(typeName)) {
|
||||||
throw new IllegalArgumentException("Invalid qualifier type '" + typeName + "'.");
|
throw new IllegalArgumentException("Invalid qualifier type '" + typeName + "'");
|
||||||
}
|
}
|
||||||
this.typeName = typeName;
|
this.typeName = typeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Qualifier '" + this.typeName + "'";
|
return "Qualifier '" + this.typeName + "'";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2019 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -38,7 +38,7 @@ public class ReplaceOverride extends MethodOverride {
|
|||||||
|
|
||||||
private final String methodReplacerBeanName;
|
private final String methodReplacerBeanName;
|
||||||
|
|
||||||
private List<String> typeIdentifiers = new LinkedList<>();
|
private final List<String> typeIdentifiers = new LinkedList<>();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -69,6 +69,7 @@ public class ReplaceOverride extends MethodOverride {
|
|||||||
this.typeIdentifiers.add(identifier);
|
this.typeIdentifiers.add(identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(Method method) {
|
public boolean matches(Method method) {
|
||||||
if (!method.getName().equals(getMethodName())) {
|
if (!method.getName().equals(getMethodName())) {
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ public class SimpleNamingContext implements Context {
|
|||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("Static JNDI lookup: [" + name + "]");
|
logger.debug("Static JNDI lookup: [" + name + "]");
|
||||||
}
|
}
|
||||||
if ("".equals(name)) {
|
if (name.isEmpty()) {
|
||||||
return new SimpleNamingContext(this.root, this.boundObjects, this.environment);
|
return new SimpleNamingContext(this.root, this.boundObjects, this.environment);
|
||||||
}
|
}
|
||||||
Object found = this.boundObjects.get(name);
|
Object found = this.boundObjects.get(name);
|
||||||
@@ -300,10 +300,10 @@ public class SimpleNamingContext implements Context {
|
|||||||
|
|
||||||
private abstract static class AbstractNamingEnumeration<T> implements NamingEnumeration<T> {
|
private abstract static class AbstractNamingEnumeration<T> implements NamingEnumeration<T> {
|
||||||
|
|
||||||
private Iterator<T> iterator;
|
private final Iterator<T> iterator;
|
||||||
|
|
||||||
private AbstractNamingEnumeration(SimpleNamingContext context, String proot) throws NamingException {
|
private AbstractNamingEnumeration(SimpleNamingContext context, String proot) throws NamingException {
|
||||||
if (!"".equals(proot) && !proot.endsWith("/")) {
|
if (!proot.isEmpty() && !proot.endsWith("/")) {
|
||||||
proot = proot + "/";
|
proot = proot + "/";
|
||||||
}
|
}
|
||||||
String root = context.root + proot;
|
String root = context.root + proot;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -291,7 +291,7 @@ public class FastByteArrayOutputStream extends OutputStream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new buffer and store it in the LinkedList
|
* Create a new buffer and store it in the LinkedList.
|
||||||
* <p>Adds a new buffer that can store at least {@code minCapacity} bytes.
|
* <p>Adds a new buffer that can store at least {@code minCapacity} bytes.
|
||||||
*/
|
*/
|
||||||
private void addBuffer(int minCapacity) {
|
private void addBuffer(int minCapacity) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2019 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -76,7 +76,7 @@ public abstract class StringUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the given object (possibly a {@code String}) is empty.
|
* Check whether the given object (possibly a {@code String}) is empty.
|
||||||
* This is effectly a shortcut for {@code !hasLength(String)}.
|
* This is effectively a shortcut for {@code !hasLength(String)}.
|
||||||
* <p>This method accepts any Object as an argument, comparing it to
|
* <p>This method accepts any Object as an argument, comparing it to
|
||||||
* {@code null} and the empty String. As a consequence, this method
|
* {@code null} and the empty String. As a consequence, this method
|
||||||
* will never return {@code true} for a non-null non-String object.
|
* will never return {@code true} for a non-null non-String object.
|
||||||
@@ -639,6 +639,9 @@ public abstract class StringUtils {
|
|||||||
* inner simple dots.
|
* inner simple dots.
|
||||||
* <p>The result is convenient for path comparison. For other uses,
|
* <p>The result is convenient for path comparison. For other uses,
|
||||||
* notice that Windows separators ("\") are replaced by simple slashes.
|
* notice that Windows separators ("\") are replaced by simple slashes.
|
||||||
|
* <p><strong>NOTE</strong> that {@code cleanPath} should not be depended
|
||||||
|
* upon in a security context. Other mechanisms should be used to prevent
|
||||||
|
* path-traversal issues.
|
||||||
* @param path the original path
|
* @param path the original path
|
||||||
* @return the normalized path
|
* @return the normalized path
|
||||||
*/
|
*/
|
||||||
@@ -688,18 +691,18 @@ public abstract class StringUtils {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Normal path element found.
|
// Normal path element found.
|
||||||
pathElements.add(0, element);
|
pathElements.addFirst(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remaining top paths need to be retained.
|
// Remaining top paths need to be retained.
|
||||||
for (int i = 0; i < tops; i++) {
|
for (int i = 0; i < tops; i++) {
|
||||||
pathElements.add(0, TOP_PATH);
|
pathElements.addFirst(TOP_PATH);
|
||||||
}
|
}
|
||||||
// If nothing else left, at least explicitly point to current path.
|
// If nothing else left, at least explicitly point to current path.
|
||||||
if (pathElements.size() == 1 && "".equals(pathElements.getLast()) && !prefix.endsWith(FOLDER_SEPARATOR)) {
|
if (pathElements.size() == 1 && pathElements.getLast().isEmpty() && !prefix.endsWith(FOLDER_SEPARATOR)) {
|
||||||
pathElements.add(0, CURRENT_PATH);
|
pathElements.addFirst(CURRENT_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
return prefix + collectionToDelimitedString(pathElements, FOLDER_SEPARATOR);
|
return prefix + collectionToDelimitedString(pathElements, FOLDER_SEPARATOR);
|
||||||
@@ -737,7 +740,7 @@ public abstract class StringUtils {
|
|||||||
}
|
}
|
||||||
Assert.notNull(charset, "Charset must not be null");
|
Assert.notNull(charset, "Charset must not be null");
|
||||||
|
|
||||||
ByteArrayOutputStream bos = new ByteArrayOutputStream(length);
|
ByteArrayOutputStream baos = new ByteArrayOutputStream(length);
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
int ch = source.charAt(i);
|
int ch = source.charAt(i);
|
||||||
@@ -750,7 +753,7 @@ public abstract class StringUtils {
|
|||||||
if (u == -1 || l == -1) {
|
if (u == -1 || l == -1) {
|
||||||
throw new IllegalArgumentException("Invalid encoded sequence \"" + source.substring(i) + "\"");
|
throw new IllegalArgumentException("Invalid encoded sequence \"" + source.substring(i) + "\"");
|
||||||
}
|
}
|
||||||
bos.write((char) ((u << 4) + l));
|
baos.write((char) ((u << 4) + l));
|
||||||
i += 2;
|
i += 2;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@@ -759,10 +762,10 @@ public abstract class StringUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bos.write(ch);
|
baos.write(ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (changed ? new String(bos.toByteArray(), charset) : source);
|
return (changed ? new String(baos.toByteArray(), charset) : source);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -995,8 +998,8 @@ public abstract class StringUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trim the elements of the given {@code String} array,
|
* Trim the elements of the given {@code String} array, calling
|
||||||
* calling {@code String.trim()} on each of them.
|
* {@code String.trim()} on each non-null element.
|
||||||
* @param array the original {@code String} array (potentially empty)
|
* @param array the original {@code String} array (potentially empty)
|
||||||
* @return the resulting array (of the same size) with trimmed elements
|
* @return the resulting array (of the same size) with trimmed elements
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -64,10 +64,10 @@ class JmsListenerContainerParser extends AbstractListenerContainerParser {
|
|||||||
|
|
||||||
String containerType = containerEle.getAttribute(CONTAINER_TYPE_ATTRIBUTE);
|
String containerType = containerEle.getAttribute(CONTAINER_TYPE_ATTRIBUTE);
|
||||||
String containerClass = containerEle.getAttribute(CONTAINER_CLASS_ATTRIBUTE);
|
String containerClass = containerEle.getAttribute(CONTAINER_CLASS_ATTRIBUTE);
|
||||||
if (!"".equals(containerClass)) {
|
if (StringUtils.hasLength(containerClass)) {
|
||||||
return null; // Not supported
|
return null; // not supported
|
||||||
}
|
}
|
||||||
else if ("".equals(containerType) || containerType.startsWith("default")) {
|
else if (!StringUtils.hasLength(containerType) || containerType.startsWith("default")) {
|
||||||
factoryDef.setBeanClassName("org.springframework.jms.config.DefaultJmsListenerContainerFactory");
|
factoryDef.setBeanClassName("org.springframework.jms.config.DefaultJmsListenerContainerFactory");
|
||||||
}
|
}
|
||||||
else if (containerType.startsWith("simple")) {
|
else if (containerType.startsWith("simple")) {
|
||||||
@@ -91,10 +91,10 @@ class JmsListenerContainerParser extends AbstractListenerContainerParser {
|
|||||||
|
|
||||||
String containerType = containerEle.getAttribute(CONTAINER_TYPE_ATTRIBUTE);
|
String containerType = containerEle.getAttribute(CONTAINER_TYPE_ATTRIBUTE);
|
||||||
String containerClass = containerEle.getAttribute(CONTAINER_CLASS_ATTRIBUTE);
|
String containerClass = containerEle.getAttribute(CONTAINER_CLASS_ATTRIBUTE);
|
||||||
if (!"".equals(containerClass)) {
|
if (StringUtils.hasLength(containerClass)) {
|
||||||
containerDef.setBeanClassName(containerClass);
|
containerDef.setBeanClassName(containerClass);
|
||||||
}
|
}
|
||||||
else if ("".equals(containerType) || containerType.startsWith("default")) {
|
else if (!StringUtils.hasLength(containerType) || containerType.startsWith("default")) {
|
||||||
containerDef.setBeanClassName("org.springframework.jms.listener.DefaultMessageListenerContainer");
|
containerDef.setBeanClassName("org.springframework.jms.listener.DefaultMessageListenerContainer");
|
||||||
}
|
}
|
||||||
else if (containerType.startsWith("simple")) {
|
else if (containerType.startsWith("simple")) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -63,7 +63,7 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
|||||||
|
|
||||||
private final List<String> mappingFileNames = new LinkedList<>();
|
private final List<String> mappingFileNames = new LinkedList<>();
|
||||||
|
|
||||||
private List<URL> jarFileUrls = new LinkedList<>();
|
private final List<URL> jarFileUrls = new LinkedList<>();
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private URL persistenceUnitRootUrl;
|
private URL persistenceUnitRootUrl;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -23,7 +23,6 @@ import java.lang.reflect.Member;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
@@ -417,8 +416,7 @@ public class PersistenceAnnotationBeanPostProcessor
|
|||||||
Class<?> targetClass = clazz;
|
Class<?> targetClass = clazz;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
final LinkedList<InjectionMetadata.InjectedElement> currElements =
|
final List<InjectionMetadata.InjectedElement> currElements = new ArrayList<>();
|
||||||
new LinkedList<>();
|
|
||||||
|
|
||||||
ReflectionUtils.doWithLocalFields(targetClass, field -> {
|
ReflectionUtils.doWithLocalFields(targetClass, field -> {
|
||||||
if (field.isAnnotationPresent(PersistenceContext.class) ||
|
if (field.isAnnotationPresent(PersistenceContext.class) ||
|
||||||
@@ -473,7 +471,7 @@ public class PersistenceAnnotationBeanPostProcessor
|
|||||||
unitNameForLookup = this.defaultPersistenceUnitName;
|
unitNameForLookup = this.defaultPersistenceUnitName;
|
||||||
}
|
}
|
||||||
String jndiName = this.persistenceUnits.get(unitNameForLookup);
|
String jndiName = this.persistenceUnits.get(unitNameForLookup);
|
||||||
if (jndiName == null && "".equals(unitNameForLookup) && this.persistenceUnits.size() == 1) {
|
if (jndiName == null && unitNameForLookup.isEmpty() && this.persistenceUnits.size() == 1) {
|
||||||
jndiName = this.persistenceUnits.values().iterator().next();
|
jndiName = this.persistenceUnits.values().iterator().next();
|
||||||
}
|
}
|
||||||
if (jndiName != null) {
|
if (jndiName != null) {
|
||||||
@@ -506,7 +504,7 @@ public class PersistenceAnnotationBeanPostProcessor
|
|||||||
unitNameForLookup = this.defaultPersistenceUnitName;
|
unitNameForLookup = this.defaultPersistenceUnitName;
|
||||||
}
|
}
|
||||||
String jndiName = contexts.get(unitNameForLookup);
|
String jndiName = contexts.get(unitNameForLookup);
|
||||||
if (jndiName == null && "".equals(unitNameForLookup) && contexts.size() == 1) {
|
if (jndiName == null && unitNameForLookup.isEmpty() && contexts.size() == 1) {
|
||||||
jndiName = contexts.values().iterator().next();
|
jndiName = contexts.values().iterator().next();
|
||||||
}
|
}
|
||||||
if (jndiName != null) {
|
if (jndiName != null) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -123,7 +123,7 @@ public class SimpleNamingContext implements Context {
|
|||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("Static JNDI lookup: [" + name + "]");
|
logger.debug("Static JNDI lookup: [" + name + "]");
|
||||||
}
|
}
|
||||||
if ("".equals(name)) {
|
if (name.isEmpty()) {
|
||||||
return new SimpleNamingContext(this.root, this.boundObjects, this.environment);
|
return new SimpleNamingContext(this.root, this.boundObjects, this.environment);
|
||||||
}
|
}
|
||||||
Object found = this.boundObjects.get(name);
|
Object found = this.boundObjects.get(name);
|
||||||
@@ -300,10 +300,10 @@ public class SimpleNamingContext implements Context {
|
|||||||
|
|
||||||
private abstract static class AbstractNamingEnumeration<T> implements NamingEnumeration<T> {
|
private abstract static class AbstractNamingEnumeration<T> implements NamingEnumeration<T> {
|
||||||
|
|
||||||
private Iterator<T> iterator;
|
private final Iterator<T> iterator;
|
||||||
|
|
||||||
private AbstractNamingEnumeration(SimpleNamingContext context, String proot) throws NamingException {
|
private AbstractNamingEnumeration(SimpleNamingContext context, String proot) throws NamingException {
|
||||||
if (!"".equals(proot) && !proot.endsWith("/")) {
|
if (!proot.isEmpty() && !proot.endsWith("/")) {
|
||||||
proot = proot + "/";
|
proot = proot + "/";
|
||||||
}
|
}
|
||||||
String root = context.root + proot;
|
String root = context.root + proot;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2019 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -64,9 +64,7 @@ public abstract class AbstractGenericContextLoader extends AbstractContextLoader
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a Spring ApplicationContext from the supplied {@link MergedContextConfiguration}.
|
* Load a Spring ApplicationContext from the supplied {@link MergedContextConfiguration}.
|
||||||
*
|
|
||||||
* <p>Implementation details:
|
* <p>Implementation details:
|
||||||
*
|
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Calls {@link #validateMergedContextConfiguration(MergedContextConfiguration)}
|
* <li>Calls {@link #validateMergedContextConfiguration(MergedContextConfiguration)}
|
||||||
* to allow subclasses to validate the supplied configuration before proceeding.</li>
|
* to allow subclasses to validate the supplied configuration before proceeding.</li>
|
||||||
@@ -97,7 +95,6 @@ public abstract class AbstractGenericContextLoader extends AbstractContextLoader
|
|||||||
* <li>{@link ConfigurableApplicationContext#refresh Refreshes} the
|
* <li>{@link ConfigurableApplicationContext#refresh Refreshes} the
|
||||||
* context and registers a JVM shutdown hook for it.</li>
|
* context and registers a JVM shutdown hook for it.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
|
||||||
* @return a new application context
|
* @return a new application context
|
||||||
* @see org.springframework.test.context.SmartContextLoader#loadContext(MergedContextConfiguration)
|
* @see org.springframework.test.context.SmartContextLoader#loadContext(MergedContextConfiguration)
|
||||||
* @see GenericApplicationContext
|
* @see GenericApplicationContext
|
||||||
@@ -107,7 +104,7 @@ public abstract class AbstractGenericContextLoader extends AbstractContextLoader
|
|||||||
public final ConfigurableApplicationContext loadContext(MergedContextConfiguration mergedConfig) throws Exception {
|
public final ConfigurableApplicationContext loadContext(MergedContextConfiguration mergedConfig) throws Exception {
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug(String.format("Loading ApplicationContext for merged context configuration [%s].",
|
logger.debug(String.format("Loading ApplicationContext for merged context configuration [%s].",
|
||||||
mergedConfig));
|
mergedConfig));
|
||||||
}
|
}
|
||||||
|
|
||||||
validateMergedContextConfiguration(mergedConfig);
|
validateMergedContextConfiguration(mergedConfig);
|
||||||
@@ -118,6 +115,7 @@ public abstract class AbstractGenericContextLoader extends AbstractContextLoader
|
|||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
context.setParent(parent);
|
context.setParent(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
prepareContext(context);
|
prepareContext(context);
|
||||||
prepareContext(context, mergedConfig);
|
prepareContext(context, mergedConfig);
|
||||||
customizeBeanFactory(context.getDefaultListableBeanFactory());
|
customizeBeanFactory(context.getDefaultListableBeanFactory());
|
||||||
@@ -125,8 +123,10 @@ public abstract class AbstractGenericContextLoader extends AbstractContextLoader
|
|||||||
AnnotationConfigUtils.registerAnnotationConfigProcessors(context);
|
AnnotationConfigUtils.registerAnnotationConfigProcessors(context);
|
||||||
customizeContext(context);
|
customizeContext(context);
|
||||||
customizeContext(context, mergedConfig);
|
customizeContext(context, mergedConfig);
|
||||||
|
|
||||||
context.refresh();
|
context.refresh();
|
||||||
context.registerShutdownHook();
|
context.registerShutdownHook();
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,9 +146,7 @@ public abstract class AbstractGenericContextLoader extends AbstractContextLoader
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a Spring ApplicationContext from the supplied {@code locations}.
|
* Load a Spring ApplicationContext from the supplied {@code locations}.
|
||||||
*
|
|
||||||
* <p>Implementation details:
|
* <p>Implementation details:
|
||||||
*
|
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Creates a {@link GenericApplicationContext} instance.</li>
|
* <li>Creates a {@link GenericApplicationContext} instance.</li>
|
||||||
* <li>Calls {@link #prepareContext(GenericApplicationContext)} to allow for customizing the context
|
* <li>Calls {@link #prepareContext(GenericApplicationContext)} to allow for customizing the context
|
||||||
@@ -166,12 +164,10 @@ public abstract class AbstractGenericContextLoader extends AbstractContextLoader
|
|||||||
* <li>{@link ConfigurableApplicationContext#refresh Refreshes} the
|
* <li>{@link ConfigurableApplicationContext#refresh Refreshes} the
|
||||||
* context and registers a JVM shutdown hook for it.</li>
|
* context and registers a JVM shutdown hook for it.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
|
||||||
* <p><b>Note</b>: this method does not provide a means to set active bean definition
|
* <p><b>Note</b>: this method does not provide a means to set active bean definition
|
||||||
* profiles for the loaded context. See {@link #loadContext(MergedContextConfiguration)}
|
* profiles for the loaded context. See {@link #loadContext(MergedContextConfiguration)}
|
||||||
* and {@link AbstractContextLoader#prepareContext(ConfigurableApplicationContext, MergedContextConfiguration)}
|
* and {@link AbstractContextLoader#prepareContext(ConfigurableApplicationContext, MergedContextConfiguration)}
|
||||||
* for an alternative.
|
* for an alternative.
|
||||||
*
|
|
||||||
* @return a new application context
|
* @return a new application context
|
||||||
* @see org.springframework.test.context.ContextLoader#loadContext
|
* @see org.springframework.test.context.ContextLoader#loadContext
|
||||||
* @see GenericApplicationContext
|
* @see GenericApplicationContext
|
||||||
@@ -182,26 +178,28 @@ public abstract class AbstractGenericContextLoader extends AbstractContextLoader
|
|||||||
public final ConfigurableApplicationContext loadContext(String... locations) throws Exception {
|
public final ConfigurableApplicationContext loadContext(String... locations) throws Exception {
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug(String.format("Loading ApplicationContext for locations [%s].",
|
logger.debug(String.format("Loading ApplicationContext for locations [%s].",
|
||||||
StringUtils.arrayToCommaDelimitedString(locations)));
|
StringUtils.arrayToCommaDelimitedString(locations)));
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericApplicationContext context = new GenericApplicationContext();
|
GenericApplicationContext context = new GenericApplicationContext();
|
||||||
|
|
||||||
prepareContext(context);
|
prepareContext(context);
|
||||||
customizeBeanFactory(context.getDefaultListableBeanFactory());
|
customizeBeanFactory(context.getDefaultListableBeanFactory());
|
||||||
createBeanDefinitionReader(context).loadBeanDefinitions(locations);
|
createBeanDefinitionReader(context).loadBeanDefinitions(locations);
|
||||||
AnnotationConfigUtils.registerAnnotationConfigProcessors(context);
|
AnnotationConfigUtils.registerAnnotationConfigProcessors(context);
|
||||||
customizeContext(context);
|
customizeContext(context);
|
||||||
|
|
||||||
context.refresh();
|
context.refresh();
|
||||||
context.registerShutdownHook();
|
context.registerShutdownHook();
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare the {@link GenericApplicationContext} created by this {@code ContextLoader}.
|
* Prepare the {@link GenericApplicationContext} created by this {@code ContextLoader}.
|
||||||
* Called <i>before</i> bean definitions are read.
|
* Called <i>before</i> bean definitions are read.
|
||||||
*
|
|
||||||
* <p>The default implementation is empty. Can be overridden in subclasses to
|
* <p>The default implementation is empty. Can be overridden in subclasses to
|
||||||
* customize {@code GenericApplicationContext}'s standard settings.
|
* customize {@code GenericApplicationContext}'s standard settings.
|
||||||
*
|
|
||||||
* @param context the context that should be prepared
|
* @param context the context that should be prepared
|
||||||
* @since 2.5
|
* @since 2.5
|
||||||
* @see #loadContext(MergedContextConfiguration)
|
* @see #loadContext(MergedContextConfiguration)
|
||||||
@@ -217,10 +215,8 @@ public abstract class AbstractGenericContextLoader extends AbstractContextLoader
|
|||||||
/**
|
/**
|
||||||
* Customize the internal bean factory of the ApplicationContext created by
|
* Customize the internal bean factory of the ApplicationContext created by
|
||||||
* this {@code ContextLoader}.
|
* this {@code ContextLoader}.
|
||||||
*
|
|
||||||
* <p>The default implementation is empty but can be overridden in subclasses
|
* <p>The default implementation is empty but can be overridden in subclasses
|
||||||
* to customize {@code DefaultListableBeanFactory}'s standard settings.
|
* to customize {@code DefaultListableBeanFactory}'s standard settings.
|
||||||
*
|
|
||||||
* @param beanFactory the bean factory created by this {@code ContextLoader}
|
* @param beanFactory the bean factory created by this {@code ContextLoader}
|
||||||
* @since 2.5
|
* @since 2.5
|
||||||
* @see #loadContext(MergedContextConfiguration)
|
* @see #loadContext(MergedContextConfiguration)
|
||||||
@@ -236,18 +232,15 @@ public abstract class AbstractGenericContextLoader extends AbstractContextLoader
|
|||||||
/**
|
/**
|
||||||
* Load bean definitions into the supplied {@link GenericApplicationContext context}
|
* Load bean definitions into the supplied {@link GenericApplicationContext context}
|
||||||
* from the locations or classes in the supplied {@code MergedContextConfiguration}.
|
* from the locations or classes in the supplied {@code MergedContextConfiguration}.
|
||||||
*
|
|
||||||
* <p>The default implementation delegates to the {@link BeanDefinitionReader}
|
* <p>The default implementation delegates to the {@link BeanDefinitionReader}
|
||||||
* returned by {@link #createBeanDefinitionReader(GenericApplicationContext)} to
|
* returned by {@link #createBeanDefinitionReader(GenericApplicationContext)} to
|
||||||
* {@link BeanDefinitionReader#loadBeanDefinitions(String) load} the
|
* {@link BeanDefinitionReader#loadBeanDefinitions(String) load} the
|
||||||
* bean definitions.
|
* bean definitions.
|
||||||
*
|
|
||||||
* <p>Subclasses must provide an appropriate implementation of
|
* <p>Subclasses must provide an appropriate implementation of
|
||||||
* {@link #createBeanDefinitionReader(GenericApplicationContext)}. Alternatively subclasses
|
* {@link #createBeanDefinitionReader(GenericApplicationContext)}. Alternatively subclasses
|
||||||
* may provide a <em>no-op</em> implementation of {@code createBeanDefinitionReader()}
|
* may provide a <em>no-op</em> implementation of {@code createBeanDefinitionReader()}
|
||||||
* and override this method to provide a custom strategy for loading or
|
* and override this method to provide a custom strategy for loading or
|
||||||
* registering bean definitions.
|
* registering bean definitions.
|
||||||
*
|
|
||||||
* @param context the context into which the bean definitions should be loaded
|
* @param context the context into which the bean definitions should be loaded
|
||||||
* @param mergedConfig the merged context configuration
|
* @param mergedConfig the merged context configuration
|
||||||
* @since 3.1
|
* @since 3.1
|
||||||
@@ -260,7 +253,6 @@ public abstract class AbstractGenericContextLoader extends AbstractContextLoader
|
|||||||
/**
|
/**
|
||||||
* Factory method for creating a new {@link BeanDefinitionReader} for loading
|
* Factory method for creating a new {@link BeanDefinitionReader} for loading
|
||||||
* bean definitions into the supplied {@link GenericApplicationContext context}.
|
* bean definitions into the supplied {@link GenericApplicationContext context}.
|
||||||
*
|
|
||||||
* @param context the context for which the {@code BeanDefinitionReader}
|
* @param context the context for which the {@code BeanDefinitionReader}
|
||||||
* should be created
|
* should be created
|
||||||
* @return a {@code BeanDefinitionReader} for the supplied context
|
* @return a {@code BeanDefinitionReader} for the supplied context
|
||||||
@@ -275,10 +267,8 @@ public abstract class AbstractGenericContextLoader extends AbstractContextLoader
|
|||||||
* Customize the {@link GenericApplicationContext} created by this
|
* Customize the {@link GenericApplicationContext} created by this
|
||||||
* {@code ContextLoader} <i>after</i> bean definitions have been
|
* {@code ContextLoader} <i>after</i> bean definitions have been
|
||||||
* loaded into the context but <i>before</i> the context is refreshed.
|
* loaded into the context but <i>before</i> the context is refreshed.
|
||||||
*
|
|
||||||
* <p>The default implementation is empty but can be overridden in subclasses
|
* <p>The default implementation is empty but can be overridden in subclasses
|
||||||
* to customize the application context.
|
* to customize the application context.
|
||||||
*
|
|
||||||
* @param context the newly created application context
|
* @param context the newly created application context
|
||||||
* @since 2.5
|
* @since 2.5
|
||||||
* @see #loadContext(MergedContextConfiguration)
|
* @see #loadContext(MergedContextConfiguration)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -124,17 +124,17 @@ class TxAdviceBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (StringUtils.hasText(readOnly)) {
|
if (StringUtils.hasText(readOnly)) {
|
||||||
attribute.setReadOnly(Boolean.valueOf(methodEle.getAttribute(READ_ONLY_ATTRIBUTE)));
|
attribute.setReadOnly(Boolean.parseBoolean(methodEle.getAttribute(READ_ONLY_ATTRIBUTE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<RollbackRuleAttribute> rollbackRules = new LinkedList<>();
|
List<RollbackRuleAttribute> rollbackRules = new LinkedList<>();
|
||||||
if (methodEle.hasAttribute(ROLLBACK_FOR_ATTRIBUTE)) {
|
if (methodEle.hasAttribute(ROLLBACK_FOR_ATTRIBUTE)) {
|
||||||
String rollbackForValue = methodEle.getAttribute(ROLLBACK_FOR_ATTRIBUTE);
|
String rollbackForValue = methodEle.getAttribute(ROLLBACK_FOR_ATTRIBUTE);
|
||||||
addRollbackRuleAttributesTo(rollbackRules,rollbackForValue);
|
addRollbackRuleAttributesTo(rollbackRules, rollbackForValue);
|
||||||
}
|
}
|
||||||
if (methodEle.hasAttribute(NO_ROLLBACK_FOR_ATTRIBUTE)) {
|
if (methodEle.hasAttribute(NO_ROLLBACK_FOR_ATTRIBUTE)) {
|
||||||
String noRollbackForValue = methodEle.getAttribute(NO_ROLLBACK_FOR_ATTRIBUTE);
|
String noRollbackForValue = methodEle.getAttribute(NO_ROLLBACK_FOR_ATTRIBUTE);
|
||||||
addNoRollbackRuleAttributesTo(rollbackRules,noRollbackForValue);
|
addNoRollbackRuleAttributesTo(rollbackRules, noRollbackForValue);
|
||||||
}
|
}
|
||||||
attribute.setRollbackRules(rollbackRules);
|
attribute.setRollbackRules(rollbackRules);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -40,7 +40,7 @@ class RegexPathElement extends PathElement {
|
|||||||
private static final String DEFAULT_VARIABLE_PATTERN = "(.*)";
|
private static final String DEFAULT_VARIABLE_PATTERN = "(.*)";
|
||||||
|
|
||||||
|
|
||||||
private char[] regex;
|
private final char[] regex;
|
||||||
|
|
||||||
private final boolean caseSensitive;
|
private final boolean caseSensitive;
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ class RegexPathElement extends PathElement {
|
|||||||
if (matches) {
|
if (matches) {
|
||||||
if (isNoMorePattern()) {
|
if (isNoMorePattern()) {
|
||||||
if (matchingContext.determineRemainingPath &&
|
if (matchingContext.determineRemainingPath &&
|
||||||
(this.variableNames.isEmpty() ? true : textToMatch.length() > 0)) {
|
(this.variableNames.isEmpty() || textToMatch.length() > 0)) {
|
||||||
matchingContext.remainingPathIndex = pathIndex + 1;
|
matchingContext.remainingPathIndex = pathIndex + 1;
|
||||||
matches = true;
|
matches = true;
|
||||||
}
|
}
|
||||||
@@ -203,6 +203,7 @@ class RegexPathElement extends PathElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Regex(" + String.valueOf(this.regex) + ")";
|
return "Regex(" + String.valueOf(this.regex) + ")";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -76,7 +76,7 @@ class ToStringVisitor implements RouterFunctions.Visitor, RequestPredicates.Visi
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void indent() {
|
private void indent() {
|
||||||
for (int i=0; i < this.indent; i++) {
|
for (int i = 0; i < this.indent; i++) {
|
||||||
this.builder.append(' ');
|
this.builder.append(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -116,9 +116,8 @@ class HandlerMethodArgumentResolverComposite implements HandlerMethodArgumentRes
|
|||||||
|
|
||||||
HandlerMethodArgumentResolver resolver = getArgumentResolver(parameter);
|
HandlerMethodArgumentResolver resolver = getArgumentResolver(parameter);
|
||||||
if (resolver == null) {
|
if (resolver == null) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException("Unsupported parameter type [" +
|
||||||
"Unsupported parameter type [" + parameter.getParameterType().getName() + "]." +
|
parameter.getParameterType().getName() + "]. supportsParameter should be called first.");
|
||||||
" supportsParameter should be called first.");
|
|
||||||
}
|
}
|
||||||
return resolver.resolveArgument(parameter, bindingContext, exchange);
|
return resolver.resolveArgument(parameter, bindingContext, exchange);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user