Skip to content

Commit

Permalink
[eclipse-ee4j#627]Reduced Exception to IOException(which is really th…
Browse files Browse the repository at this point in the history
…rown here), so there would be less of "auto-close" warnings

Signed-off-by: Anton Pinsky <[email protected]>
  • Loading branch information
api-from-the-ion committed Nov 8, 2023
1 parent 0d8db8e commit fe4afe0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
12 changes: 11 additions & 1 deletion src/main/java/org/eclipse/yasson/YassonJsonb.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand All @@ -12,6 +12,7 @@

package org.eclipse.yasson;

import java.io.IOException;
import java.lang.reflect.Type;

import jakarta.json.JsonStructure;
Expand Down Expand Up @@ -131,4 +132,13 @@ public interface YassonJsonb extends jakarta.json.bind.Jsonb {
* @since JSON Binding 1.0
*/
JsonStructure toJsonStructure(Object object, Type runtimeType) throws JsonbException;

/**
* Closes this Jsonb instance and releases any system resources associated.
* See @{@link jakarta.json.bind.Jsonb} and @{@link jakarta.json.bind.Jsonb#close()} for more details on closing.
*
* @throws IOException if an I/O error occurs; reducing from @{@link Exception} in @{@link AutoCloseable}.
*/
@Override
void close() throws IOException;
}
6 changes: 3 additions & 3 deletions src/main/java/org/eclipse/yasson/internal/JsonBinding.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package org.eclipse.yasson.internal;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
Expand Down Expand Up @@ -213,8 +214,7 @@ private JsonGenerator streamGenerator(OutputStream stream) {
}

@Override
public void close() throws Exception {
public void close() throws IOException {
jsonbContext.getComponentInstanceCreator().close();
}

}
}

0 comments on commit fe4afe0

Please sign in to comment.