Use more factory method to create ParserException.
ParserException's constructor methods are deprecated. #minor-release PiperOrigin-RevId: 376150191
This commit is contained in:
parent
41ce635a42
commit
6d04b998f9
@ -49,6 +49,20 @@ public class ParserException extends IOException {
|
|||||||
message, cause, /* contentIsMalformed= */ true, C.DATA_TYPE_MANIFEST);
|
message, cause, /* contentIsMalformed= */ true, C.DATA_TYPE_MANIFEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance for which {@link #contentIsMalformed} is false and {@link #dataType} is
|
||||||
|
* {@link C#DATA_TYPE_MANIFEST}.
|
||||||
|
*
|
||||||
|
* @param message See {@link #getMessage()}.
|
||||||
|
* @param cause See {@link #getCause()}.
|
||||||
|
* @return The created instance.
|
||||||
|
*/
|
||||||
|
public static ParserException createForManifestWithUnsupportedFeature(
|
||||||
|
@Nullable String message, @Nullable Throwable cause) {
|
||||||
|
return new ParserException(
|
||||||
|
message, cause, /* contentIsMalformed= */ false, C.DATA_TYPE_MANIFEST);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance for which {@link #contentIsMalformed} is false and {@link #dataType} is
|
* Creates a new instance for which {@link #contentIsMalformed} is false and {@link #dataType} is
|
||||||
* {@link C#DATA_TYPE_MEDIA}.
|
* {@link C#DATA_TYPE_MEDIA}.
|
||||||
|
@ -95,7 +95,8 @@ import java.security.NoSuchAlgorithmException;
|
|||||||
case DIGEST:
|
case DIGEST:
|
||||||
return getDigestAuthorizationHeaderValue(authUserInfo, uri, requestMethod);
|
return getDigestAuthorizationHeaderValue(authUserInfo, uri, requestMethod);
|
||||||
default:
|
default:
|
||||||
throw new ParserException(new UnsupportedOperationException());
|
throw ParserException.createForManifestWithUnsupportedFeature(
|
||||||
|
/* message= */ null, new UnsupportedOperationException());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +137,7 @@ import java.security.NoSuchAlgorithmException;
|
|||||||
DIGEST_FORMAT_WITH_OPAQUE, authUserInfo.username, realm, nonce, uri, response, opaque);
|
DIGEST_FORMAT_WITH_OPAQUE, authUserInfo.username, realm, nonce, uri, response, opaque);
|
||||||
}
|
}
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
throw new ParserException(e);
|
throw ParserException.createForManifestWithUnsupportedFeature(/* message= */ null, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -421,7 +421,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
@Nullable
|
@Nullable
|
||||||
String wwwAuthenticateHeader = response.headers.get(RtspHeaders.WWW_AUTHENTICATE);
|
String wwwAuthenticateHeader = response.headers.get(RtspHeaders.WWW_AUTHENTICATE);
|
||||||
if (wwwAuthenticateHeader == null) {
|
if (wwwAuthenticateHeader == null) {
|
||||||
throw new ParserException("Missing WWW-Authenticate header in a 401 response.");
|
throw ParserException.createForMalformedManifest(
|
||||||
|
"Missing WWW-Authenticate header in a 401 response.", /* cause= */ null);
|
||||||
}
|
}
|
||||||
rtspAuthenticationInfo =
|
rtspAuthenticationInfo =
|
||||||
RtspMessageUtil.parseWwwAuthenticateHeader(wwwAuthenticateHeader);
|
RtspMessageUtil.parseWwwAuthenticateHeader(wwwAuthenticateHeader);
|
||||||
|
@ -426,7 +426,8 @@ import java.util.regex.Pattern;
|
|||||||
/* nonce= */ "",
|
/* nonce= */ "",
|
||||||
/* opaque= */ "");
|
/* opaque= */ "");
|
||||||
}
|
}
|
||||||
throw new ParserException("Invalid WWW-Authenticate header " + headerValue);
|
throw ParserException.createForMalformedManifest(
|
||||||
|
"Invalid WWW-Authenticate header " + headerValue, /* cause= */ null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getRtspStatusReasonPhrase(int statusCode) {
|
private static String getRtspStatusReasonPhrase(int statusCode) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user