File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
src/main/java/org/scribe/model Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -36,13 +36,6 @@ public Request(Verb verb, String url)
3636 this .url = url ;
3737 this .bodyParams = new HashMap <String , String >();
3838 this .headers = new HashMap <String , String >();
39- try
40- {
41- connection = (HttpURLConnection ) new URL (url ).openConnection ();
42- } catch (IOException ioe )
43- {
44- throw new OAuthException ("Could not open connection to: " + url , ioe );
45- }
4639 }
4740
4841 /**
@@ -56,13 +49,22 @@ public Response send()
5649 {
5750 try
5851 {
52+ createConnection ();
5953 return doSend ();
6054 } catch (IOException ioe )
6155 {
6256 throw new OAuthException ("Problems while creating connection" , ioe );
6357 }
6458 }
6559
60+ private void createConnection () throws IOException
61+ {
62+ if (connection == null )
63+ {
64+ connection = (HttpURLConnection ) new URL (url ).openConnection ();
65+ }
66+ }
67+
6668 Response doSend () throws IOException
6769 {
6870 connection .setRequestMethod (this .verb .name ());
You can’t perform that action at this time.
0 commit comments