Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
e61ff6d
Make json serialization treat maps as maps, always.
mikekap Apr 15, 2018
8cd92d2
remove obsolete files (#466)
elharo Sep 21, 2018
dacf78b
update app engine SDK (#467)
elharo Sep 21, 2018
19c3c7f
Add Kokoro continuous integration config and badges (#465)
chingor13 Sep 21, 2018
68fdc05
Add CODEOWNERS and issue/pr templates (#470)
chingor13 Sep 21, 2018
2cf19f6
Fix code.google.com links. Fix maven version (#471)
chingor13 Sep 21, 2018
0cd3cbe
fix API doc links (#479)
elharo Sep 24, 2018
70a8902
update test library versions (#481)
elharo Sep 24, 2018
7a1fa3b
Add the ending Java 6 support notice to README (#483)
chingor13 Sep 27, 2018
e601d7d
Fix test to run on environments with German locale (#473) (#474)
geri-m Sep 27, 2018
c1bc063
Kokoro release jobs (#472)
chingor13 Oct 4, 2018
1f067da
add patch to google http client (#486)
cramja Oct 8, 2018
4d6a42d
XML Parsing: Enum as element type (#475) (#476)
geri-m Oct 9, 2018
d27f448
Fix CODEOWNERS path
chingor13 Oct 11, 2018
85cefab
Enable releasetool for this project (#488)
chingor13 Oct 11, 2018
9de9cbb
Revert "add patch to google http client (#486)" (#493)
chingor13 Oct 16, 2018
22b8b95
Release google-http-java-client v1.26.0 (#495)
chingor13 Oct 18, 2018
df0e9f2
Bump next snapshot (#500)
chingor13 Oct 18, 2018
d504e54
Release improvements (#501)
chingor13 Oct 29, 2018
b4770b5
Add Java 11 Kokoro config (#487)
chingor13 Oct 29, 2018
d5effe8
Remove deprecated BackOffPolicy interface (#506)
chingor13 Nov 2, 2018
b3aea0f
Set the version of the jarjar-maven-plugin in pluginManagement (#515)
chingor13 Nov 2, 2018
f4c4567
guava is not provided (#508)
elharo Nov 2, 2018
0a95dd0
Upgrade maven-javadoc-plugin to 3.0.1 (#519)
chingor13 Nov 6, 2018
e1c40f6
Add google-http-client-bom artifact (#517)
chingor13 Nov 6, 2018
287cca1
Allow Enums in DataMaps (#505)
geri-m Nov 6, 2018
710117e
Fix broken snapshot and proto tests (#512)
elharo Nov 6, 2018
c5049a7
Revert "Remove deprecated BackOffPolicy interface (#506)" (#521)
chingor13 Nov 7, 2018
80b1a9c
Fix parameter of maven-javadoc-plugin (#522) (#523)
geri-m Nov 7, 2018
d7f18a3
Skip Lint of JavaDoc (#525)
geri-m Nov 8, 2018
7b95ce8
Add write timeout for post/put requests (#485)
chingor13 Nov 9, 2018
67d8c5d
Release google-http-java-client v1.27.0 (#527)
chingor13 Nov 12, 2018
7d1f23a
Bump next snapshot (#528)
chingor13 Nov 12, 2018
ab627ed
Request charset defaults to UTF-8, Response charset defaults to ISO_8…
ajaaym Dec 4, 2018
fb18555
Update guava to 26.0-android (#531)
chingor13 Dec 4, 2018
f0ca832
Make signature of com.google.api.client.util.Data#nullOf more type sa…
ajaaym Dec 10, 2018
ff93479
GenericData can now overload setters (#538)
ajaaym Dec 10, 2018
d16ab5c
Fix UriTemplate.expand to properly escape value (#534)
ajaaym Dec 10, 2018
02a6040
Fix building HttpResponseException when charset is malformed (#535)
ajaaym Dec 11, 2018
3656dcb
Implement Closeable & Flushable in JsonGenerator and JsonParser (#540)
ajaaym Dec 11, 2018
158545f
Compile to Java 1.7 binary (#542)
chingor13 Dec 12, 2018
455d4a5
Deprecate google-http-client-jackson (#539)
chingor13 Dec 12, 2018
79ed2fe
Deprecate AndroidHttp compatibility shim (#541)
chingor13 Dec 12, 2018
bf4a8da
Split http apache artifact (#543)
chingor13 Dec 12, 2018
16ddb92
Cleanup samples (#544)
chingor13 Dec 12, 2018
c7ad7fd
Merge branch 'master' into maps-can-be-iterable
chingor13 Dec 21, 2018
76eb95d
Add common generator tests for the iterable map and normal map
chingor13 Dec 28, 2018
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
Prev Previous commit
Next Next commit
Fix building HttpResponseException when charset is malformed (#535)
* fix #323 IllegalCharsetNameException in HttpResponse getContentCharset() if charset is malformed

* add test case

* remove unused import
  • Loading branch information
ajaaym authored and chingor13 committed Dec 11, 2018
commit 02a604086d95b349c21975e822b300d05abfe08e
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ public Builder(HttpResponse response) {
} catch (IOException exception) {
// it would be bad to throw an exception while throwing an exception
exception.printStackTrace();
} catch (IllegalArgumentException exception) {
exception.printStackTrace();
}
// message
StringBuilder builder = computeMessageBuffer(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,62 @@ public LowLevelHttpResponse execute() throws IOException {
}
}

public void testInvalidCharset() throws Exception {
HttpTransport transport = new MockHttpTransport() {
@Override
public LowLevelHttpRequest buildRequest(String method, String url) throws IOException {
return new MockLowLevelHttpRequest() {
@Override
public LowLevelHttpResponse execute() throws IOException {
MockLowLevelHttpResponse result = new MockLowLevelHttpResponse();
result.setStatusCode(HttpStatusCodes.STATUS_CODE_NOT_FOUND);
result.setReasonPhrase("Not Found");
result.setContentType("text/plain; charset=");
result.setContent("Unable to find resource");
return result;
}
};
}
};
HttpRequest request =
transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
try {
request.execute();
fail();
} catch (HttpResponseException e) {
assertEquals(
"404 Not Found", e.getMessage());
}
}

public void testUnsupportedCharset() throws Exception {
HttpTransport transport = new MockHttpTransport() {
@Override
public LowLevelHttpRequest buildRequest(String method, String url) throws IOException {
return new MockLowLevelHttpRequest() {
@Override
public LowLevelHttpResponse execute() throws IOException {
MockLowLevelHttpResponse result = new MockLowLevelHttpResponse();
result.setStatusCode(HttpStatusCodes.STATUS_CODE_NOT_FOUND);
result.setReasonPhrase("Not Found");
result.setContentType("text/plain; charset=invalid-charset");
result.setContent("Unable to find resource");
return result;
}
};
}
};
HttpRequest request =
transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
try {
request.execute();
fail();
} catch (HttpResponseException e) {
assertEquals(
"404 Not Found", e.getMessage());
}
}

public void testSerialization() throws Exception {
HttpTransport transport = new MockHttpTransport();
HttpRequest request =
Expand Down