This repository was archived by the owner on Oct 17, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
src/main/java/com/hellosign/sdk/http Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 <groupId >com.hellosign</groupId >
66 <artifactId >hellosign-java-sdk</artifactId >
77 <packaging >jar</packaging >
8- <version >4.0.5 </version >
8+ <version >4.0.6 </version >
99 <name >HelloSign Java SDK</name >
1010 <url >https://github.com/HelloFax/hellosign-java-sdk</url >
1111 <properties >
Original file line number Diff line number Diff line change @@ -206,9 +206,10 @@ public JSONObject asJson() throws HelloSignException {
206206 json = new JSONObject (response );
207207 } catch (JSONException e ) {
208208 throw new HelloSignException (e );
209+ } finally {
210+ reset ();
209211 }
210212 validate (json );
211- reset ();
212213 return json ;
213214 }
214215
@@ -222,14 +223,20 @@ public JSONObject asJson() throws HelloSignException {
222223 */
223224 public File asFile (String fileName ) throws HelloSignException {
224225 Integer lastResponseCode = getLastResponseCode ();
225- if (lastResponseCode != null && lastResponseCode != HttpURLConnection .HTTP_OK ) {
226- this .asJson (); // Will validate response
227- }
228- File f = createTemporaryFile (fileName );
229- if (getLastResponseAsFile (f ) == 0 ) {
230- logger .warn ("No bytes written to file: " + fileName );
226+ File f = null ;
227+ try {
228+ if (lastResponseCode != null && lastResponseCode != HttpURLConnection .HTTP_OK ) {
229+ this .asJson (); // Will validate response
230+ }
231+ f = createTemporaryFile (fileName );
232+ if (getLastResponseAsFile (f ) == 0 ) {
233+ logger .warn ("No bytes written to file: " + fileName );
234+ }
235+ } catch (HelloSignException ex ) {
236+ throw ex ;
237+ } finally {
238+ reset ();
231239 }
232- reset ();
233240 return f ;
234241 }
235242
You can’t perform that action at this time.
0 commit comments