From c0f4d78ef9b9e03836baa31ac3ada0b4c48197e7 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 10 Feb 2017 10:54:54 +0100 Subject: [PATCH] Use Map.getOrDefault in getSqlType implementation Issue: SPR-15238 --- .../jdbc/core/namedparam/AbstractSqlParameterSource.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/AbstractSqlParameterSource.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/AbstractSqlParameterSource.java index 7ca10b9440..626cfb5f07 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/AbstractSqlParameterSource.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/AbstractSqlParameterSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2017 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. @@ -64,11 +64,7 @@ public abstract class AbstractSqlParameterSource implements SqlParameterSource { @Override public int getSqlType(String paramName) { Assert.notNull(paramName, "Parameter name must not be null"); - Integer sqlType = this.sqlTypes.get(paramName); - if (sqlType != null) { - return sqlType; - } - return TYPE_UNKNOWN; + return this.sqlTypes.getOrDefault(paramName, TYPE_UNKNOWN); } /**