Merge branch '5.2.x'

This commit is contained in:
Juergen Hoeller 2020-09-07 17:54:51 +02:00
commit 75f394ca85
4 changed files with 47 additions and 21 deletions

View File

@ -19,6 +19,7 @@ package org.springframework.context.annotation;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.ArrayDeque;
import java.util.ArrayList;
@ -461,7 +462,7 @@ class ConfigurationClassParser {
Resource resource = this.resourceLoader.getResource(resolvedLocation);
addPropertySource(factory.createPropertySource(name, new EncodedResource(resource, encoding)));
}
catch (IllegalArgumentException | FileNotFoundException | UnknownHostException ex) {
catch (IllegalArgumentException | FileNotFoundException | UnknownHostException | SocketException ex) {
// Placeholders not resolvable or resource not found when trying to open it
if (ignoreResourceNotFound) {
if (logger.isInfoEnabled()) {

View File

@ -18,6 +18,7 @@ package org.springframework.core.io.support;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.Properties;
@ -180,7 +181,7 @@ public abstract class PropertiesLoaderSupport {
PropertiesLoaderUtils.fillProperties(
props, new EncodedResource(location, this.fileEncoding), this.propertiesPersister);
}
catch (FileNotFoundException | UnknownHostException ex) {
catch (FileNotFoundException | UnknownHostException | SocketException ex) {
if (this.ignoreResourceNotFound) {
if (logger.isDebugEnabled()) {
logger.debug("Properties resource not found: " + ex.getMessage());

View File

@ -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");
* you may not use this file except in compliance with the License.
@ -30,25 +30,39 @@ import org.springframework.lang.Nullable;
*/
public class CallParameterMetaData {
@Nullable
private String parameterName;
private int parameterType;
private int sqlType;
private final boolean function;
@Nullable
private String typeName;
private final String parameterName;
private boolean nullable;
private final int parameterType;
private final int sqlType;
@Nullable
private final String typeName;
private final boolean nullable;
/**
* Constructor taking all the properties.
* Constructor taking all the properties except the function marker.
*/
@Deprecated
public CallParameterMetaData(
@Nullable String columnName, int columnType, int sqlType, @Nullable String typeName, boolean nullable) {
this(false, columnName, columnType, sqlType, typeName, nullable);
}
/**
* Constructor taking all the properties including the function marker.
* @since 5.2.9
*/
public CallParameterMetaData(boolean function, @Nullable String columnName, int columnType,
int sqlType, @Nullable String typeName, boolean nullable) {
this.function = function;
this.parameterName = columnName;
this.parameterType = columnType;
this.sqlType = sqlType;
@ -58,7 +72,15 @@ public class CallParameterMetaData {
/**
* Get the parameter name.
* Return whether this parameter is declared in a function.
* @since 5.2.9
*/
public boolean isFunction() {
return this.function;
}
/**
* Return the parameter name.
*/
@Nullable
public String getParameterName() {
@ -66,7 +88,7 @@ public class CallParameterMetaData {
}
/**
* Get the parameter type.
* Return the parameter type.
*/
public int getParameterType() {
return this.parameterType;
@ -75,23 +97,25 @@ public class CallParameterMetaData {
/**
* Determine whether the declared parameter qualifies as a 'return' parameter
* for our purposes: type {@link DatabaseMetaData#procedureColumnReturn} or
* {@link DatabaseMetaData#procedureColumnResult}.
* {@link DatabaseMetaData#procedureColumnResult}, or in case of a function,
* {@link DatabaseMetaData#functionReturn}.
* @since 4.3.15
*/
public boolean isReturnParameter() {
return (this.parameterType == DatabaseMetaData.procedureColumnReturn ||
this.parameterType == DatabaseMetaData.procedureColumnResult);
return (this.function ? this.parameterType == DatabaseMetaData.functionReturn :
(this.parameterType == DatabaseMetaData.procedureColumnReturn ||
this.parameterType == DatabaseMetaData.procedureColumnResult));
}
/**
* Get the parameter SQL type.
* Return the parameter SQL type.
*/
public int getSqlType() {
return this.sqlType;
}
/**
* Get the parameter type name.
* Return the parameter type name.
*/
@Nullable
public String getTypeName() {
@ -99,7 +123,7 @@ public class CallParameterMetaData {
}
/**
* Get whether the parameter is nullable.
* Return whether the parameter is nullable.
*/
public boolean isNullable() {
return this.nullable;

View File

@ -399,7 +399,7 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
}
else {
int nullable = (function ? DatabaseMetaData.functionNullable : DatabaseMetaData.procedureNullable);
CallParameterMetaData meta = new CallParameterMetaData(columnName, columnType,
CallParameterMetaData meta = new CallParameterMetaData(function, columnName, columnType,
columns.getInt("DATA_TYPE"), columns.getString("TYPE_NAME"),
columns.getInt("NULLABLE") == nullable);
this.callParameterMetaData.add(meta);