@@ -66,7 +66,7 @@ public class GPSdEndpoint {
6666
6767 private final List <IObjectListener > listeners = new ArrayList <IObjectListener >(1 );
6868
69- private IGPSObject asnycResult = null ;
69+ private IGPSObject asyncResult = null ;
7070
7171 private final Object asyncMutex = new Object ();
7272
@@ -255,17 +255,17 @@ private void voidCommand(final String command) throws IOException {
255255 */
256256 private IGPSObject waitForResult () {
257257 synchronized (this .asyncWaitMutex ) {
258- this .asnycResult = null ;
259- try {
260- this .asyncWaitMutex .wait (1000 );
261- } catch (final InterruptedException e ) {
262- GPSdEndpoint .LOG .info ("Interrupted while waiting for result" , e );
263- }
264- if (this .asnycResult != null ) {
265- return this .asnycResult ;
258+ if (this .asyncResult == null ) {
259+ try {
260+ this .asyncWaitMutex .wait (1000 );
261+ } catch (final InterruptedException e ) {
262+ GPSdEndpoint .LOG .info ("Interrupted while waiting for result" , e );
263+ }
266264 }
265+ final IGPSObject result = this .asyncResult ;
266+ this .asyncResult = null ;
267+ return result ;
267268 }
268- return null ;
269269 }
270270
271271 /*
@@ -299,7 +299,7 @@ void handle(final IGPSObject object) {
299299 } else {
300300 // object was requested, so put it in the response object
301301 synchronized (this .asyncWaitMutex ) {
302- this .asnycResult = object ;
302+ this .asyncResult = object ;
303303 this .asyncWaitMutex .notifyAll ();
304304 }
305305 }
0 commit comments