Check timeZone() argument in AbstractSqlQueryRequest (#31822)
A value of `null` will throw an IAE.
This commit is contained in:
parent
89cb0872cf
commit
03adbf2a39
|
@ -112,7 +112,7 @@ public abstract class AbstractSqlQueryRequest extends AbstractSqlRequest impleme
|
|||
}
|
||||
|
||||
public AbstractSqlQueryRequest timeZone(TimeZone timeZone) {
|
||||
if (query == null) {
|
||||
if (timeZone == null) {
|
||||
throw new IllegalArgumentException("time zone may not be null.");
|
||||
}
|
||||
this.timeZone = timeZone;
|
||||
|
|
|
@ -110,4 +110,10 @@ public class SqlQueryRequestTests extends AbstractSerializingTestCase<SqlQueryRe
|
|||
mutator.accept(newRequest);
|
||||
return newRequest;
|
||||
}
|
||||
|
||||
public void testTimeZoneNullException() {
|
||||
final SqlQueryRequest sqlQueryRequest = createTestInstance();
|
||||
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> sqlQueryRequest.timeZone(null));
|
||||
assertEquals("time zone may not be null.", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue