Commit bf61e732 by Kazuyuki Hida

ロック要求時は404でもエラーにならないようにした。

parent 3d97a019
...@@ -739,7 +739,7 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -739,7 +739,7 @@ public class AcmsClient implements AcmsClientResponseListener {
} }
public LockReportJSON sendLockReport(LockReportParameters param) throws NetworkDisconnectedException, AcmsException { public LockReportJSON sendLockReport(LockReportParameters param) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApiLockReport, param); HttpResponse response = send(AcmsApis.ApiLockReport, param, true);
String json = response.httpResponseBody; String json = response.httpResponseBody;
return new LockReportJSON(json); return new LockReportJSON(json);
} }
...@@ -798,11 +798,15 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -798,11 +798,15 @@ public class AcmsClient implements AcmsClientResponseListener {
* @since 1.0.0 * @since 1.0.0
*/ */
private HttpResponse send(String methodName, HttpParameterObject param) throws NetworkDisconnectedException, AcmsException { private HttpResponse send(String methodName, HttpParameterObject param) throws NetworkDisconnectedException, AcmsException {
return send(methodName, param, false);
}
private HttpResponse send(String methodName, HttpParameterObject param, boolean ignore404) throws NetworkDisconnectedException, AcmsException {
Logger.d(TAG, "call api : %s", methodName); Logger.d(TAG, "call api : %s", methodName);
String apiUrl = AcmsApis.getApiUrl(env.acmsAddress, urlPath, methodName); String apiUrl = AcmsApis.getApiUrl(env.acmsAddress, urlPath, methodName);
HttpResponse response = send(apiUrl, methodName, param); HttpResponse response = send(apiUrl, methodName, param, ignore404);
// 最終アクセス時間更新 // 最終アクセス時間更新
MemberInfoDao dao = AbstractDao.getDao(MemberInfoDao.class); MemberInfoDao dao = AbstractDao.getDao(MemberInfoDao.class);
...@@ -817,6 +821,10 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -817,6 +821,10 @@ public class AcmsClient implements AcmsClientResponseListener {
} }
public HttpResponse send(String apiUrl, String methodName, HttpParameterObject param) throws NetworkDisconnectedException, AcmsException { public HttpResponse send(String apiUrl, String methodName, HttpParameterObject param) throws NetworkDisconnectedException, AcmsException {
return send(apiUrl, methodName, param, false);
}
public HttpResponse send(String apiUrl, String methodName, HttpParameterObject param, boolean ignore404) throws NetworkDisconnectedException, AcmsException {
if (!networkAdapter.isNetworkConnected()) { if (!networkAdapter.isNetworkConnected()) {
Logger.w(TAG, "network is disconnected."); Logger.w(TAG, "network is disconnected.");
throw new NetworkDisconnectedException(); throw new NetworkDisconnectedException();
...@@ -854,7 +862,9 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -854,7 +862,9 @@ public class AcmsClient implements AcmsClientResponseListener {
if (httpTaskThread.response.httpResponseCode == 401 && httpTaskThread.response.httpResponseBody == null) { // 401の場合bodyが取れない場合があるのでvalidationはしない if (httpTaskThread.response.httpResponseCode == 401 && httpTaskThread.response.httpResponseBody == null) { // 401の場合bodyが取れない場合があるのでvalidationはしない
throw new AcmsException(ABVExceptionCode.S_E_ACMS_0401, null); throw new AcmsException(ABVExceptionCode.S_E_ACMS_0401, null);
} }
if (httpTaskThread.response.httpResponseCode != 304) { // 変更なし boolean isNot304 = httpTaskThread.response.httpResponseCode != 304; // 変更なし
boolean is404 = httpTaskThread.response.httpResponseCode == 404 && !ignore404;
if (isNot304 && is404) {
validateHttpResponse(httpTaskThread.response, methodName); validateHttpResponse(httpTaskThread.response, methodName);
} }
......
...@@ -98,7 +98,7 @@ public class LockReportLogic extends AbstractLogic { ...@@ -98,7 +98,7 @@ public class LockReportLogic extends AbstractLogic {
result.result = reportJSON.httpStatus == HTTP_OK || reportJSON.httpStatus == HTTP_NOT_FOUND ? 0 : 1; result.result = reportJSON.httpStatus == HTTP_OK || reportJSON.httpStatus == HTTP_NOT_FOUND ? 0 : 1;
result.message = ""; result.message = "";
result.extParam = new ExtParam( result.extParam = new ExtParam(
reportJSON.getReportStatus(), reportJSON.httpStatus == HTTP_OK ? reportJSON.getReportStatus() : 0,
reportJSON.getReportLockUserId(), reportJSON.getReportLockUserId(),
reportJSON.getReportLockUserName(), reportJSON.getReportLockUserName(),
reportJSON.getReportLockTime(), reportJSON.getReportLockTime(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment