@@ -59,22 +59,30 @@ public RequestHandler(PokemonGo api, RequestEnvelopeOuterClass.RequestEnvelope.A
5959 apiEndpoint = ApiSettings .API_ENDPOINT ;
6060 this .auth = auth ;
6161 serverRequests = new ArrayList <>();
62- // TODO: somehow fix it so people using the deprecated functions will still work, while not calling this deprecated stuff ourselves
62+ /* TODO: somehow fix it so people using the deprecated functions will still work,
63+ while not calling this deprecated stuff ourselves */
6364 resetBuilder ();
6465 }
6566
66- @ Deprecated
6767 /**
6868 * Request.
6969 *
7070 * @param requestIn the request in
7171 */
72+ @ Deprecated
7273 public void request (ServerRequest requestIn ) {
7374 hasRequests = true ;
7475 serverRequests .add (requestIn );
7576 builder .addRequests (requestIn .getRequest ());
7677 }
7778
79+ /**
80+ * Sends multiple ServerRequests in a thread safe manner.
81+ *
82+ * @param serverRequests list of ServerRequests to be sent
83+ * @throws RemoteServerException the remote server exception
84+ * @throws LoginFailedException the login failed exception
85+ */
7886 public void sendServerRequests (ServerRequest ... serverRequests ) throws RemoteServerException , LoginFailedException {
7987 if (serverRequests .length == 0 ) {
8088 return ;
@@ -106,8 +114,9 @@ public void sendServerRequests(ServerRequest... serverRequests) throws RemoteSer
106114 throw new RemoteServerException (e );
107115 }
108116
109- if (response .code () != 200 )
117+ if (response .code () != 200 ) {
110118 throw new RemoteServerException ("Got a unexcepted http code : " + response .code ());
119+ }
111120
112121 ResponseEnvelopeOuterClass .ResponseEnvelope responseEnvelop ;
113122 try (InputStream content = response .body ().byteStream ()) {
@@ -133,25 +142,27 @@ public void sendServerRequests(ServerRequest... serverRequests) throws RemoteSer
133142 return ;
134143 }
135144
136- // map each reply to the numeric response, ie first response = first request and send back to the requests to handle.
145+ /* map each reply to the numeric response,
146+ ie first response = first request and send back to the requests to handle. */
137147 int count = 0 ;
138148 for (ByteString payload : responseEnvelop .getReturnsList ()) {
139149 ServerRequest serverReq = serverRequests [count ];
140- // TODO: Probably all other payloads are garbage as well in this case, so might as well throw an exception and leave this loop
150+ /* TODO: Probably all other payloads are garbage as well in this case,
151+ so might as well throw an exception and leave this loop */
141152 if (payload != null ) {
142153 serverReq .handleData (payload );
143154 }
144155 count ++;
145156 }
146157 }
147158
148- @ Deprecated
149159 /**
150160 * Send server requests.
151161 *
152162 * @throws RemoteServerException the remote server exception
153163 * @throws LoginFailedException the login failed exception
154164 */
165+ @ Deprecated
155166 public void sendServerRequests () throws RemoteServerException , LoginFailedException {
156167 setLatitude (api .getLatitude ());
157168 setLongitude (api .getLongitude ());
0 commit comments