@@ -183,11 +183,13 @@ public ScanFilter createFromParcel(final Parcel in) {
183183 final byte [] serviceData = new byte [serviceDataLength ];
184184 in .readByteArray (serviceData );
185185 if (in .readInt () == 0 ) {
186+ //noinspection ConstantConditions
186187 builder .setServiceData (serviceDataUuid , serviceData );
187188 } else {
188189 final int serviceDataMaskLength = in .readInt ();
189190 final byte [] serviceDataMask = new byte [serviceDataMaskLength ];
190191 in .readByteArray (serviceDataMask );
192+ //noinspection ConstantConditions
191193 builder .setServiceData (serviceDataUuid , serviceData , serviceDataMask );
192194 }
193195 }
@@ -518,14 +520,12 @@ public Builder setServiceUuid(@Nullable final ParcelUuid serviceUuid,
518520 *
519521 * @throws IllegalArgumentException If {@code serviceDataUuid} is null.
520522 */
521- public Builder setServiceData (@ Nullable final ParcelUuid serviceDataUuid ,
523+ public Builder setServiceData (@ NonNull final ParcelUuid serviceDataUuid ,
522524 @ Nullable final byte [] serviceData ) {
523- if (serviceDataUuid == null && serviceData != null ) {
525+ //noinspection ConstantConditions
526+ if (serviceDataUuid == null ) {
524527 throw new IllegalArgumentException ("serviceDataUuid is null!" );
525528 }
526- if (serviceDataUuid != null && serviceData == null ) {
527- throw new IllegalArgumentException ("serviceData is null!" );
528- }
529529 this .serviceDataUuid = serviceDataUuid ;
530530 this .serviceData = serviceData ;
531531 this .serviceDataMask = null ; // clear service data mask
@@ -542,10 +542,11 @@ public Builder setServiceData(@Nullable final ParcelUuid serviceDataUuid,
542542 * {@code serviceDataMask} is {@code null} while {@code serviceData} is not or
543543 * {@code serviceDataMask} and {@code serviceData} has different length.
544544 */
545- public Builder setServiceData (@ Nullable final ParcelUuid serviceDataUuid ,
545+ public Builder setServiceData (@ NonNull final ParcelUuid serviceDataUuid ,
546546 @ Nullable final byte [] serviceData ,
547547 @ Nullable final byte [] serviceDataMask ) {
548- if (serviceDataUuid == null && serviceData != null ) {
548+ //noinspection ConstantConditions
549+ if (serviceDataUuid == null ) {
549550 throw new IllegalArgumentException ("serviceDataUuid is null" );
550551 }
551552 if (serviceDataMask != null ) {
0 commit comments