Skip to content

Commit 4039f1b

Browse files
authored
Enable OkHttpClient tests for solid module (#578)
This fixes an issue where the OkHttpClient would throw an uncaught exception processing a response if the body handler threw a RuntimeException (IOException are handled gracefully).
1 parent cbb3e22 commit 4039f1b

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

okhttp/src/main/java/com/inrupt/client/okhttp/OkHttpService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ public void onResponse(final Call call, final okhttp3.Response res) throws IOExc
8888
try (final okhttp3.Response r = res) {
8989
final Response.ResponseInfo info = new OkHttpResponseInfo(r);
9090
future.complete(new OkHttpResponse<>(res.request().url().uri(), info, handler.apply(info)));
91+
} catch (final RuntimeException ex) {
92+
future.completeExceptionally(ex);
9193
}
9294
}
9395

solid/pom.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,34 @@
130130
</classpathDependencyExcludes>
131131
</configuration>
132132
</execution>
133+
<execution>
134+
<id>okhttp-jena-test</id>
135+
<phase>test</phase>
136+
<goals>
137+
<goal>test</goal>
138+
</goals>
139+
<configuration>
140+
<classpathDependencyExcludes>
141+
<classpathDependencyExclude>com.inrupt.client:inrupt-client-httpclient</classpathDependencyExclude>
142+
<classpathDependencyExclude>com.inrupt.client:inrupt-client-rdf4j</classpathDependencyExclude>
143+
<classpathDependencyExclude>com.inrupt.client:inrupt-client-rdf-legacy</classpathDependencyExclude>
144+
</classpathDependencyExcludes>
145+
</configuration>
146+
</execution>
147+
<execution>
148+
<id>okhttp-rdf4j-test</id>
149+
<phase>test</phase>
150+
<goals>
151+
<goal>test</goal>
152+
</goals>
153+
<configuration>
154+
<classpathDependencyExcludes>
155+
<classpathDependencyExclude>com.inrupt.client:inrupt-client-httpclient</classpathDependencyExclude>
156+
<classpathDependencyExclude>com.inrupt.client:inrupt-client-jena</classpathDependencyExclude>
157+
<classpathDependencyExclude>com.inrupt.client:inrupt-client-rdf-legacy</classpathDependencyExclude>
158+
</classpathDependencyExcludes>
159+
</configuration>
160+
</execution>
133161
</executions>
134162
</plugin>
135163
<plugin>

0 commit comments

Comments
 (0)