Browse Source

Merge branch '5.2.x'

pull/25742/head
Juergen Hoeller 6 years ago
parent
commit
75f394ca85
  1. 3
      spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java
  2. 3
      spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderSupport.java
  3. 54
      spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallParameterMetaData.java
  4. 2
      spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericCallMetaDataProvider.java

3
spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java

@ -19,6 +19,7 @@ package org.springframework.context.annotation; @@ -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 { @@ -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()) {

3
spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderSupport.java

@ -18,6 +18,7 @@ package org.springframework.core.io.support; @@ -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 { @@ -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());

54
spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallParameterMetaData.java

@ -1,5 +1,5 @@ @@ -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; @@ -30,25 +30,39 @@ import org.springframework.lang.Nullable;
*/
public class CallParameterMetaData {
private final boolean function;
@Nullable
private String parameterName;
private final String parameterName;
private int parameterType;
private final int parameterType;
private int sqlType;
private final int sqlType;
@Nullable
private String typeName;
private final String typeName;
private boolean nullable;
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 { @@ -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 { @@ -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 { @@ -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 { @@ -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;

2
spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericCallMetaDataProvider.java

@ -399,7 +399,7 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider { @@ -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);

Loading…
Cancel
Save