Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prep for Java 19: Remove Sneaky Throws. #20931

Merged
merged 2 commits into from
Dec 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.net.URI;
import java.net.URISyntaxException;
import lombok.SneakyThrows;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand All @@ -27,7 +28,7 @@ void testVersionMetadata() {
}

@Test
void testDowngrade() {
void testDowngrade() throws URISyntaxException {
final io.airbyte.protocol.models.v0.AirbyteMessage v0Message = getV0Message();

final io.airbyte.protocol.models.AirbyteMessage downgradedMessage = v0migration.downgrade(v0Message);
Expand All @@ -36,16 +37,15 @@ void testDowngrade() {
}

@Test
void testUpgrade() {
void testUpgrade() throws URISyntaxException {
final io.airbyte.protocol.models.AirbyteMessage unversionedMessage = getUnversionedMessage();

final io.airbyte.protocol.models.v0.AirbyteMessage upgradedMessage = v0migration.upgrade(unversionedMessage);
final io.airbyte.protocol.models.v0.AirbyteMessage expectedMessage = getV0Message();
assertEquals(expectedMessage, upgradedMessage);
}

@SneakyThrows
private io.airbyte.protocol.models.v0.AirbyteMessage getV0Message() {
private io.airbyte.protocol.models.v0.AirbyteMessage getV0Message() throws URISyntaxException {
return new io.airbyte.protocol.models.v0.AirbyteMessage()
.withType(io.airbyte.protocol.models.v0.AirbyteMessage.Type.SPEC)
.withSpec(
Expand All @@ -54,8 +54,7 @@ private io.airbyte.protocol.models.v0.AirbyteMessage getV0Message() {
.withDocumentationUrl(new URI("file:///tmp/doc")));
}

@SneakyThrows
private io.airbyte.protocol.models.AirbyteMessage getUnversionedMessage() {
private io.airbyte.protocol.models.AirbyteMessage getUnversionedMessage() throws URISyntaxException {
return new io.airbyte.protocol.models.AirbyteMessage()
.withType(io.airbyte.protocol.models.AirbyteMessage.Type.SPEC)
.withSpec(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,15 @@ public VersionedAirbyteStreamFactory(final AirbyteMessageSerDeProvider serDeProv
* the stream rather than the one passed from the constructor.
*/
@Trace(operationName = WORKER_OPERATION_NAME)
@SneakyThrows
@Override
public Stream<AirbyteMessage> create(final BufferedReader bufferedReader) {
if (shouldDetectVersion) {
final Optional<Version> versionMaybe = detectVersion(bufferedReader);
final Optional<Version> versionMaybe;
try {
versionMaybe = detectVersion(bufferedReader);
} catch (final IOException e) {
throw new RuntimeException(e);
}
if (versionMaybe.isPresent()) {
logger.info("Detected Protocol Version {}", versionMaybe.get().serialize());
initializeForProtocolVersion(versionMaybe.get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.util.Set;
import lombok.SneakyThrows;
Expand Down Expand Up @@ -106,9 +107,8 @@ void test() throws IOException {
assertNull(JsonSchemaValidator.getSchema(schemaFile, "NonExistentObject"));
}

@SneakyThrows
@Test
void testResolveReferences() throws IOException {
void testResolveReferences() throws IOException, URISyntaxException {
String referencableSchemas = """
{
"definitions": {
Expand Down