Use Map.getOrDefault in getSqlType implementation

Issue: SPR-15238
This commit is contained in:
Juergen Hoeller
2017-02-10 10:54:54 +01:00
parent 81aca78579
commit c0f4d78ef9

View File

@@ -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);
}
/**