Skip to content

Commit

Permalink
Issue postmanlabs#155 pure java codegen: fix for patch request warnin…
Browse files Browse the repository at this point in the history
…gs in travis ci
  • Loading branch information
virenderm01 committed May 30, 2020
1 parent a558630 commit 0bfd53f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions codegens/java-native/lib/javanative.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ function makeSnippet (request, indentString, options) {
var isBodyRequired = !(_.includes(METHODS_WITHOUT_BODY, request.method)),
snippet = '';
if (request.method === 'PATCH') {
snippet += 'try {\n' +
snippet += 'System.err.close();\n' +
'System.setErr(System.out);\n' +
'try {\n' +
indentString + 'Field methodsField = HttpURLConnection.class.getDeclaredField("methods");\n' +
indentString + 'methodsField.setAccessible(true);\n' +
indentString + 'Field modifiersField = Field.class.getDeclaredField("modifiers");\n' +
Expand All @@ -45,9 +47,7 @@ function makeSnippet (request, indentString, options) {
indentString.repeat(2) + 'e.printStackTrace();\n' +
indentString + '};\n';
}
snippet += 'System.err.close();\n' +
'System.setErr(System.out);\n' +
`URL obj = new URL("${sanitize(request.url.toString())}");\n` +
snippet += `URL obj = new URL("${sanitize(request.url.toString())}");\n` +
'URLConnection connection = obj.openConnection();\n' +
'HttpURLConnection con = null;\n' +
'if(connection instanceof HttpsURLConnection){\n' +
Expand Down

0 comments on commit 0bfd53f

Please sign in to comment.