Add a space in the ParserException
message
PiperOrigin-RevId: 668870991
This commit is contained in:
parent
3587afc9d7
commit
05cbbffbd7
@ -113,7 +113,7 @@ public class ParserException extends IOException {
|
|||||||
@Override
|
@Override
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return super.getMessage()
|
return super.getMessage()
|
||||||
+ "{contentIsMalformed="
|
+ " {contentIsMalformed="
|
||||||
+ contentIsMalformed
|
+ contentIsMalformed
|
||||||
+ ", dataType="
|
+ ", dataType="
|
||||||
+ dataType
|
+ dataType
|
||||||
|
@ -20,6 +20,7 @@ import static androidx.media3.extractor.VorbisUtil.verifyVorbisHeaderCapturePatt
|
|||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
|
import androidx.media3.common.C;
|
||||||
import androidx.media3.common.ParserException;
|
import androidx.media3.common.ParserException;
|
||||||
import androidx.media3.common.util.ParsableByteArray;
|
import androidx.media3.common.util.ParsableByteArray;
|
||||||
import androidx.media3.test.utils.TestUtil;
|
import androidx.media3.test.utils.TestUtil;
|
||||||
@ -116,8 +117,9 @@ public final class VorbisUtilTest {
|
|||||||
VorbisUtil.verifyVorbisHeaderCapturePattern(0x99, header, false);
|
VorbisUtil.verifyVorbisHeaderCapturePattern(0x99, header, false);
|
||||||
fail();
|
fail();
|
||||||
} catch (ParserException e) {
|
} catch (ParserException e) {
|
||||||
assertThat(e.getMessage())
|
assertThat(e).hasMessageThat().contains("expected header type 99");
|
||||||
.isEqualTo("expected header type 99{contentIsMalformed=true, dataType=1}");
|
assertThat(e.contentIsMalformed).isTrue();
|
||||||
|
assertThat(e.dataType).isEqualTo(C.DATA_TYPE_MEDIA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,8 +139,9 @@ public final class VorbisUtilTest {
|
|||||||
VorbisUtil.verifyVorbisHeaderCapturePattern(0x01, header, false);
|
VorbisUtil.verifyVorbisHeaderCapturePattern(0x01, header, false);
|
||||||
fail();
|
fail();
|
||||||
} catch (ParserException e) {
|
} catch (ParserException e) {
|
||||||
assertThat(e.getMessage())
|
assertThat(e).hasMessageThat().contains("expected characters 'vorbis'");
|
||||||
.isEqualTo("expected characters 'vorbis'{contentIsMalformed=true, dataType=1}");
|
assertThat(e.contentIsMalformed).isTrue();
|
||||||
|
assertThat(e.dataType).isEqualTo(C.DATA_TYPE_MEDIA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,13 +157,11 @@ public class ImageAssetLoaderTest {
|
|||||||
});
|
});
|
||||||
ParserException parserException = (ParserException) exceptionRef.get().getCause();
|
ParserException parserException = (ParserException) exceptionRef.get().getCause();
|
||||||
|
|
||||||
assertThat(parserException.contentIsMalformed).isFalse();
|
|
||||||
assertThat(parserException.dataType).isEqualTo(C.DATA_TYPE_MEDIA);
|
|
||||||
assertThat(parserException)
|
assertThat(parserException)
|
||||||
.hasMessageThat()
|
.hasMessageThat()
|
||||||
.isEqualTo(
|
.contains("Attempted to load a Bitmap from unsupported MIME type: image/gif");
|
||||||
"Attempted to load a Bitmap from unsupported MIME type:"
|
assertThat(parserException.contentIsMalformed).isFalse();
|
||||||
+ " image/gif{contentIsMalformed=false, dataType=1}");
|
assertThat(parserException.dataType).isEqualTo(C.DATA_TYPE_MEDIA);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AssetLoader getAssetLoader(AssetLoader.Listener listener, String uri) {
|
private static AssetLoader getAssetLoader(AssetLoader.Listener listener, String uri) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user