OSDN Git Service

NsdManager: remove duplicated argument validation
authorHugo Benichi <hugobenichi@google.com>
Tue, 2 May 2017 04:36:28 +0000 (13:36 +0900)
committerHugo Benichi <hugobenichi@google.com>
Thu, 3 Aug 2017 05:19:43 +0000 (14:19 +0900)
commitcf96a1b36d00167f912d294a34c9a5151b922832
tree7c613c3ebf21a26745ecf168780ff12a194d6927
parent0553f96c0a477f16e4daab7c7b51d8904cbec0bf
NsdManager: remove duplicated argument validation

This patch simplifies argument validation in NsdManager public api and
regroup duplicated validation into common methods.

This makes stack traces more actionable as now specific errors will
cause the api to throw exception from specific methods, whereas before
IllegalArgumentException would be thrown from inside the same api method
for different reasons.

This patch also includes a couple of other small cleanups.

Test: $ runtest -x frameworks/base/tests/net/../NsdManagerTest.java
Bug: 37013369

(cherry picked from commit ff3e6ccca1715ae72c6499cc7c894d27f46e8403)

Change-Id: Icf047532aa551fbe0a70721cfb95507eaa84d51e
core/java/android/net/nsd/NsdManager.java