diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/IntOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/IntOperations.java index 06d2cb2eb7..9710c80eab 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/IntOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/IntOperations.java @@ -233,10 +233,9 @@ public interface IntOperations { * @param intBody the long value * @throws ErrorException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters * @return the {@link ServiceResponse} object if successful. */ - ServiceResponse putUnixTimeDate(long intBody) throws ErrorException, IOException, IllegalArgumentException; + ServiceResponse putUnixTimeDate(long intBody) throws ErrorException, IOException; /** * Put datetime encoded as Unix time. diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/IntOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/IntOperationsImpl.java index 58cd455e4d..134ce02e57 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/IntOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/IntOperationsImpl.java @@ -620,13 +620,9 @@ private ServiceResponse getUnixTimeDelegate(Response respons * @param intBody the long value * @throws ErrorException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters * @return the {@link ServiceResponse} object if successful. */ - public ServiceResponse putUnixTimeDate(long intBody) throws ErrorException, IOException, IllegalArgumentException { - if (intBody == null) { - throw new IllegalArgumentException("Parameter intBody is required and cannot be null."); - } + public ServiceResponse putUnixTimeDate(long intBody) throws ErrorException, IOException { Call call = service.putUnixTimeDate(intBody); return putUnixTimeDateDelegate(call.execute()); } @@ -643,10 +639,6 @@ public ServiceCall putUnixTimeDateAsync(long intBody, final ServiceCallback call = service.putUnixTimeDate(intBody); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -662,7 +654,7 @@ public void onResponse(Call call, Response response) return serviceCall; } - private ServiceResponse putUnixTimeDateDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + private ServiceResponse putUnixTimeDateDelegate(Response response) throws ErrorException, IOException { return new ServiceResponseBuilder(this.client.getMapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathsOperations.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathsOperations.java index 6f82029407..1ccd08f952 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathsOperations.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathsOperations.java @@ -508,10 +508,9 @@ public interface PathsOperations { * @param unixTimeUrlPath Unix time encoded value * @throws ErrorException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters * @return the {@link ServiceResponse} object if successful. */ - ServiceResponse unixTimeUrl(long unixTimeUrlPath) throws ErrorException, IOException, IllegalArgumentException; + ServiceResponse unixTimeUrl(long unixTimeUrlPath) throws ErrorException, IOException; /** * Get the date 2016-04-13 encoded value as '1460505600' (Unix time). diff --git a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathsOperationsImpl.java b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathsOperationsImpl.java index 60f4ea1452..31942e3ce2 100644 --- a/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathsOperationsImpl.java +++ b/AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/url/PathsOperationsImpl.java @@ -1428,13 +1428,9 @@ private ServiceResponse arrayCsvInPathDelegate(Response resp * @param unixTimeUrlPath Unix time encoded value * @throws ErrorException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization - * @throws IllegalArgumentException exception thrown from invalid parameters * @return the {@link ServiceResponse} object if successful. */ - public ServiceResponse unixTimeUrl(long unixTimeUrlPath) throws ErrorException, IOException, IllegalArgumentException { - if (unixTimeUrlPath == null) { - throw new IllegalArgumentException("Parameter unixTimeUrlPath is required and cannot be null."); - } + public ServiceResponse unixTimeUrl(long unixTimeUrlPath) throws ErrorException, IOException { Call call = service.unixTimeUrl(unixTimeUrlPath); return unixTimeUrlDelegate(call.execute()); } @@ -1451,10 +1447,6 @@ public ServiceCall unixTimeUrlAsync(long unixTimeUrlPath, final ServiceCallback< if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } - if (unixTimeUrlPath == null) { - serviceCallback.failure(new IllegalArgumentException("Parameter unixTimeUrlPath is required and cannot be null.")); - return null; - } Call call = service.unixTimeUrl(unixTimeUrlPath); final ServiceCall serviceCall = new ServiceCall(call); call.enqueue(new ServiceResponseCallback(serviceCallback) { @@ -1470,7 +1462,7 @@ public void onResponse(Call call, Response response) return serviceCall; } - private ServiceResponse unixTimeUrlDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + private ServiceResponse unixTimeUrlDelegate(Response response) throws ErrorException, IOException { return new ServiceResponseBuilder(this.client.getMapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorException.class) diff --git a/AutoRest/Generators/Java/Java/TemplateModels/MethodTemplateModel.cs b/AutoRest/Generators/Java/Java/TemplateModels/MethodTemplateModel.cs index c9f8bc6faf..7b9afbb821 100644 --- a/AutoRest/Generators/Java/Java/TemplateModels/MethodTemplateModel.cs +++ b/AutoRest/Generators/Java/Java/TemplateModels/MethodTemplateModel.cs @@ -363,6 +363,7 @@ public IEnumerable RequiredNullableParameters !param.Type.IsPrimaryType(KnownPrimaryType.Double) && !param.Type.IsPrimaryType(KnownPrimaryType.Boolean) && !param.Type.IsPrimaryType(KnownPrimaryType.Long) && + !param.Type.IsPrimaryType(KnownPrimaryType.UnixTime) && !param.IsConstant && param.IsRequired) { yield return param;