Bug 742700 - Null URI crash in canceling J-PAKE. r=rnewman

This commit is contained in:
Chenxia Liu 2012-04-05 19:25:34 -07:00
parent 8ca6e187d8
commit f6f94ebc79
2 changed files with 14 additions and 9 deletions

View File

@ -72,7 +72,7 @@ public class JPakeClient {
public int jpakePollInterval;
public int jpakeMaxTries;
public String channel;
public String channelUrl;
public volatile String channelUrl;
// J-PAKE session data.
public KeyBundle myKeyBundle;
@ -219,28 +219,33 @@ public class JPakeClient {
Logger.debug(LOG_TAG, "All stages complete.");
return;
}
JPakeStage nextStage = null;
JPakeStage currentStage = null;
try{
nextStage = stages.remove();
Logger.debug(LOG_TAG, "starting stage " + nextStage.toString());
nextStage.execute(this);
currentStage = stages.remove();
Logger.debug(LOG_TAG, "starting stage " + currentStage.toString());
currentStage.execute(this);
} catch (Exception e) {
Logger.error(LOG_TAG, "Exception in stage " + nextStage, e);
Logger.error(LOG_TAG, "Exception in stage " + currentStage, e);
abort("Stage exception.");
}
}
/**
* Abort J-PAKE.
* Abort J-PAKE. This can propagate an error from the stages, or result from
* UI abort (onPause, user abort)
*
* @param reason
* Reason for abort.
*/
public void abort(String reason) {
finished = true;
// We do not need to clean up the channel in the following cases:
if (Constants.JPAKE_ERROR_CHANNEL.equals(reason) ||
Constants.JPAKE_ERROR_NETWORK.equals(reason) ||
Constants.JPAKE_ERROR_NODATA.equals(reason)) {
Constants.JPAKE_ERROR_NODATA.equals(reason) ||
channelUrl == null) {
// We may leak a channel if the activity aborts sync while requesting the channel.
// The server, however, will delete the channel anyways after a certain time has passed.
displayAbort(reason);
} else {
// Delete channel, then call controller's displayAbort in callback.

View File

@ -85,7 +85,7 @@ public class DeleteChannel {
}
};
jClient.runOnThread(new Runnable() {
JPakeClient.runOnThread(new Runnable() {
@Override
public void run() {
httpResource.delete();