Connecting to a NFC technology may fail.

NotSupportedOperationException will be thrown in these cases,
unchecked for now.

Bug: 4195403
Change-Id: I48f4f277d43afba8bc505ae2a6c216cc387b1e97
This commit is contained in:
Martijn Coenen
2011-06-06 12:32:07 +02:00
parent 40f4efe712
commit ea51a4275a
2 changed files with 8 additions and 1 deletions

View File

@@ -57,6 +57,7 @@ public class ErrorCodes {
case ERROR_SE_ALREADY_SELECTED: return "SE_ALREADY_SELECTED";
case ERROR_SE_CONNECTED: return "SE_CONNECTED";
case ERROR_NO_SE_CONNECTED: return "NO_SE_CONNECTED";
case ERROR_NOT_SUPPORTED: return "NOT_SUPPORTED";
default: return "UNKNOWN ERROR";
}
}
@@ -105,4 +106,6 @@ public class ErrorCodes {
public static final int ERROR_NO_SE_CONNECTED = -20;
}
public static final int ERROR_NOT_SUPPORTED = -21;
}

View File

@@ -77,6 +77,10 @@ import java.io.IOException;
// Store this in the tag object
mTag.setConnectedTechnology(mSelectedTechnology);
mIsConnected = true;
} else if (errorCode == ErrorCodes.ERROR_NOT_SUPPORTED) {
throw new UnsupportedOperationException("Connecting to " +
"this technology is not supported by the NFC " +
"adapter.");
} else {
throw new IOException();
}