Examples of ErrorReason


Examples of com.google.greaze.definition.ErrorReason

      // read response
      HeaderMap responseParams = readResponseHeaders(conn, paramSpec);
      R responseBody = readResponseBody(conn, bodyType);
      return new RestResponseBase<I, R>(getSpec(), responseParams, responseBody);
    } catch (IOException e) {
      ErrorReason reason = ErrorReason.fromValue(conn, e);
      throw new WebServiceSystemException(reason, e);
    }
  }
View Full Code Here

Examples of com.google.greaze.definition.ErrorReason

        } else {
          throw new WebServiceSystemException(ErrorReason.SERVER_UNAVAILABLE, e);
        }
      }
    } catch (WebServiceSystemException e) {
      ErrorReason reason = e.getReason();
      String reasonStr = reason.toString();
      log.log(Level.WARNING, reasonStr, e);
      res.setHeader(ErrorReason.HTTP_RESPONSE_HEADER_NAME, reasonStr);
      res.sendError(reason.getResponseCode(), e.getLocalizedMessage());
    }
  }
View Full Code Here

Examples of com.google.greaze.definition.ErrorReason

  protected void handleResponseCode(HttpURLConnection conn) throws WebServiceSystemException, IOException {
    // First check response code
    int responseCode = conn.getResponseCode();
    String errorReason = conn.getHeaderField(ErrorReason.HTTP_RESPONSE_HEADER_NAME);
    if (responseCode >= 400 || GreazeStrings.isNotEmpty(errorReason)) {
      ErrorReason reason = GreazeStrings.isEmpty(errorReason)
          ? ErrorReason.fromHttpResponseCode(responseCode)
              : ErrorReason.valueOf(errorReason);
      String msg = Streams.readAsString(conn.getInputStream());
      throw new WebServiceSystemException(reason, "Server input: " + msg);
    }
View Full Code Here

Examples of org.nfctools.ndef.wkt.handover.records.ErrorRecord.ErrorReason

    if (!errorRecord.hasErrorData()) {
      throw new NdefEncoderException("Expected error data", wellKnownRecord);
    }

    ErrorReason errorReason = errorRecord.getErrorReason();

    switch (errorReason) {
      case TemporaryMemoryConstraints: {
        /**
         * An 8-bit unsigned integer that expresses the minimum number of milliseconds after which a Handover
         * Request Message with the same number of octets might be processed successfully. The number of
         * milliseconds SHALL be determined by the time interval between the sending of the error indication and
         * the subsequent receipt of a Handover Request Message by the Handover Selector.
         */

        return new byte[] { errorReason.getValue(), (byte)(errorRecord.getErrorData().shortValue() & 0xFF) };
      }
      case PermanenteMemoryConstraints: {

        /**
         * A 32-bit unsigned integer, encoded with the most significant byte first, that indicates the maximum
         * number of octets of an acceptable Handover Select Message. The number of octets SHALL be determined
         * by the total length of the NDEF message, including all header information.
         */
        long unsignedInt = errorRecord.getErrorData().longValue();
        return new byte[] { errorReason.getValue(), (byte)((unsignedInt >> 24) & 0xFF),
            (byte)((unsignedInt >> 16) & 0xFF), (byte)((unsignedInt >> 8) & 0xFF),
            (byte)(unsignedInt & 0xFF) };
      }
      case CarrierSpecificConstraints: {

        /**
         * An 8-bit unsigned integer that expresses the minimum number of milliseconds after which a Handover
         * Request Message might be processed successfully. The number of milliseconds SHALL be determined by
         * the time interval between the sending of the error indication and the subsequent receipt of a
         * Handover Request Message by the Handover Selector.
         */

        return new byte[] { errorReason.getValue(), (byte)(errorRecord.getErrorData().shortValue() & 0xFF) };
      }
    }

    throw new NdefEncoderException("Unknown error reason " + errorReason, wellKnownRecord);
  }
View Full Code Here

Examples of org.nfctools.ndef.wkt.handover.records.ErrorRecord.ErrorReason

  @Override
  public WellKnownRecord decodePayload(byte[] payload, NdefMessageDecoder messageDecoder) {
    ErrorRecord errorRecord = new ErrorRecord();

    ErrorReason errorReason = ErrorReason.toErrorReason(payload[0]);

    errorRecord.setErrorReason(errorReason);

    Number number;
    switch (errorReason) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.