Skip to content

Commit 8b9da40

Browse files
Fix compile error: declare ParseException on postForResponse
EntityUtils.toString() throws org.apache.hc.core5.http.ParseException (checked). The try-with-resources refactor removed the catch(Exception) wrapper that was absorbing it in the original post() method, so the new postForResponse() must declare it. Test callers already use throws Exception. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 17dadea commit 8b9da40

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

modules/json/test/org/apache/axis2/json/gson/UtilTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
import org.apache.hc.core5.http.io.entity.EntityUtils;
3030
import org.apache.hc.core5.http.io.entity.StringEntity;
3131

32+
import org.apache.hc.core5.http.ParseException;
33+
3234
import java.io.IOException;
3335

3436
public class UtilTest {
@@ -49,7 +51,7 @@ public TestResponse(int statusCode, String body) {
4951
* callers that test error paths need the response body even on HTTP 500.
5052
*/
5153
public static TestResponse postForResponse(String jsonString, String strURL)
52-
throws IOException {
54+
throws IOException, ParseException {
5355
HttpEntity stringEntity = new StringEntity(jsonString, ContentType.APPLICATION_JSON);
5456
HttpPost httpPost = new HttpPost(strURL);
5557
httpPost.setEntity(stringEntity);

0 commit comments

Comments
 (0)