diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java index 492d6e34310..3adec23443c 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java @@ -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()) { 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 61cbc21dd65..0f33f9bfaf9 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 @@ -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()); diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallParameterMetaData.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallParameterMetaData.java index 53eae916342..76d9cec68f4 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallParameterMetaData.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallParameterMetaData.java @@ -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; diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericCallMetaDataProvider.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericCallMetaDataProvider.java index ef4ef9a8183..f0b6991f682 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericCallMetaDataProvider.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericCallMetaDataProvider.java @@ -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);