Replace IllegalStateException with WebApplicationException when
the process of retrieving yang model fails.
This change has no impact on the status code being sent back
to the user, but changes the status reason phrase from
"Request failed" to "Internal Server Error".
JIRA: NETCONF-964
Change-Id: I7934141c481ddb01dab410d4d04d4b23555212ab
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
+import javax.ws.rs.WebApplicationException;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.opendaylight.mdsal.common.api.CommitInfo;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.opendaylight.mdsal.common.api.CommitInfo;
final var yangTextSchemaSource = yangTextSchemaFuture.get();
return yangTextSchemaSource.asCharSource(StandardCharsets.UTF_8).read();
} catch (InterruptedException | ExecutionException e) {
final var yangTextSchemaSource = yangTextSchemaFuture.get();
return yangTextSchemaSource.asCharSource(StandardCharsets.UTF_8).read();
} catch (InterruptedException | ExecutionException e) {
- throw new IllegalStateException("Unable to get schema " + sourceId, e);
+ throw new WebApplicationException("Unable to get schema " + sourceId, e);
} catch (IOException e) {
} catch (IOException e) {
- throw new IllegalStateException("Unable to read schema " + sourceId, e);
+ throw new WebApplicationException("Unable to read schema " + sourceId, e);