Skip to content

Commit d3100e9

Browse files
author
Nakul Sabharwal
committed
Renamed String UTF-8 to JSON_ENCODING. Changed error statement in logError and client exception to contain Unsupported encoding problem:
1 parent 2d99421 commit d3100e9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main/java/com/microsoft/graph/http/DefaultHttpProvider.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public class DefaultHttpProvider implements IHttpProvider {
6363
/**
6464
* The encoding type for getBytes
6565
*/
66-
static final String ENCODING_TYPE = "UTF-8";
66+
static final String JSON_ENCODING = "UTF-8";
6767

6868
/**
6969
* The serializer
@@ -260,7 +260,7 @@ private <Result, Body, DeserializeType> Result sendRequestInternal(final IHttpRe
260260
} else {
261261
logger.logDebug("Sending " + serializable.getClass().getName() + " as request body");
262262
final String serializeObject = serializer.serializeObject(serializable);
263-
bytesToWrite = serializeObject.getBytes(ENCODING_TYPE);
263+
bytesToWrite = serializeObject.getBytes(JSON_ENCODING);
264264

265265
// If the user hasn't specified a Content-Type for the request
266266
if (!hasHeader(requestHeaders, CONTENT_TYPE_HEADER_NAME)) {
@@ -348,9 +348,9 @@ private <Result, Body, DeserializeType> Result sendRequestInternal(final IHttpRe
348348
logger.logError("Graph service exception " + ex.getMessage(shouldLogVerbosely), ex);
349349
throw ex;
350350
} catch (final UnsupportedEncodingException ex) {
351-
final ClientException clientException = new ClientException("Unsupported encoding",
351+
final ClientException clientException = new ClientException("Unsupported encoding problem: ",
352352
ex);
353-
logger.logError("Unsupported encoding exception " + ex.getMessage(), ex);
353+
logger.logError("Unsupported encoding problem: " + ex.getMessage(), ex);
354354
throw clientException;
355355
} catch (final Exception ex) {
356356
final ClientException clientException = new ClientException("Error during http request",
@@ -415,7 +415,7 @@ private <Result> Result handleJsonResponse(final InputStream in, Map<String, Lis
415415
private <Result> Result handleEmptyResponse(Map<String, List<String>> responseHeaders, final Class<Result> clazz)
416416
throws UnsupportedEncodingException{
417417
//Create an empty object to attach the response headers to
418-
InputStream in = new ByteArrayInputStream("{}".getBytes(ENCODING_TYPE));
418+
InputStream in = new ByteArrayInputStream("{}".getBytes(JSON_ENCODING));
419419
return handleJsonResponse(in, responseHeaders, clazz);
420420
}
421421

0 commit comments

Comments
 (0)