Examples of BatchException


Examples of com.ibatis.sqlmap.engine.execution.BatchException

          n += c;
        }
      }
      return n;
    } catch (BatchExecutorException e) {
      throw new BatchException(e);
    }
  }
View Full Code Here

Examples of com.ibatis.sqlmap.engine.execution.BatchException

  public List executeBatchDetailed() throws SQLException, BatchException {
    try {
      return transactionManager.getCurrentExecutor().flushStatements();
    } catch (BatchExecutorException e) {
      throw new BatchException(e);
    }
  }
View Full Code Here

Examples of com.ibatis.sqlmap.engine.execution.BatchException

  public void commitTransaction() throws SQLException {
    try {
      transactionManager.commit();
    } catch (BatchExecutorException e) {
      throw new BatchException(e);
    }
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.batch.BatchException

      }
      if (scanner.hasNext(closeDelimiter)) {
        scanner.next(closeDelimiter);
        currentLineNumber++;
      } else {
        throw new BatchException(BatchException.MISSING_CLOSE_DELIMITER.addContent(currentLineNumber));
      }
    } else {
      throw new BatchException(BatchException.MISSING_CONTENT_TYPE);
    }
    return responses;

  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.batch.BatchException

      mimeHeaders = parseMimeHeaders(scanner);
      currentContentId = mimeHeaders.get(BatchHelper.HTTP_CONTENT_ID.toLowerCase(Locale.ENGLISH));

      final String contentType = mimeHeaders.get(HttpHeaders.CONTENT_TYPE.toLowerCase(Locale.ENGLISH));
      if (contentType == null) {
        throw new BatchException(BatchException.MISSING_CONTENT_TYPE);
      }
      if (isChangeSet) {
        if (HttpContentType.APPLICATION_HTTP.equalsIgnoreCase(contentType)) {
          validateEncoding(mimeHeaders.get(BatchHelper.HTTP_CONTENT_TRANSFER_ENCODING.toLowerCase(Locale.ENGLISH)));
          parseNewLine(scanner);// mandatory
          BatchSingleResponseImpl response = parseResponse(scanner, isChangeSet);
          responses.add(response);
        } else {
          throw new BatchException(BatchException.INVALID_CONTENT_TYPE.addContent(HttpContentType.APPLICATION_HTTP));
        }
      } else {
        if (HttpContentType.APPLICATION_HTTP.equalsIgnoreCase(contentType)) {
          validateEncoding(mimeHeaders.get(BatchHelper.HTTP_CONTENT_TRANSFER_ENCODING.toLowerCase(Locale.ENGLISH)));
          parseNewLine(scanner);// mandatory
          BatchSingleResponseImpl response = parseResponse(scanner, isChangeSet);
          responses.add(response);
        } else if (contentType.matches(REG_EX_OPTIONAL_WHITESPACE + HttpContentType.MULTIPART_MIXED + ANY_CHARACTERS)) {
          String changeSetBoundary = getBoundary(contentType);
          if (boundary.equals(changeSetBoundary)) {
            throw new BatchException(BatchException.INVALID_CHANGESET_BOUNDARY.addContent(currentLineNumber));
          }
          parseNewLine(scanner);// mandatory
          Pattern changeSetCloseDelimiter =
              Pattern.compile("--" + changeSetBoundary + "--" + REG_EX_ZERO_OR_MORE_WHITESPACES);
          while (!scanner.hasNext(changeSetCloseDelimiter)) {
            responses.addAll(parseMultipart(scanner, changeSetBoundary, true));
          }
          scanner.next(changeSetCloseDelimiter);
          currentLineNumber++;
          parseOptionalEmptyLine(scanner);
        } else {
          throw new BatchException(BatchException.INVALID_CONTENT_TYPE.addContent(HttpContentType.MULTIPART_MIXED
              + " or " + HttpContentType.APPLICATION_HTTP));
        }
      }
    } else if (scanner.hasNext(boundary + REG_EX_ZERO_OR_MORE_WHITESPACES)) {
      currentLineNumber++;
      throw new BatchException(BatchException.INVALID_BOUNDARY_DELIMITER.addContent(currentLineNumber));
    } else if (scanner.hasNext(REG_EX_ANY_BOUNDARY_STRING)) {
      currentLineNumber++;
      throw new BatchException(BatchException.NO_MATCH_WITH_BOUNDARY_STRING.addContent(boundary).addContent(
          currentLineNumber));
    } else {
      currentLineNumber++;
      throw new BatchException(BatchException.MISSING_BOUNDARY_DELIMITER.addContent(currentLineNumber));
    }
    return responses;

  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.batch.BatchException

      if (result.groupCount() == 2) {
        statusCode = result.group(1);
        statusInfo = result.group(2);
      } else {
        currentLineNumber++;
        throw new BatchException(BatchException.INVALID_STATUS_LINE.addContent(scanner.next()).addContent(
            currentLineNumber));
      }

      Map<String, String> headers = parseResponseHeaders(scanner);
      parseNewLine(scanner);
      String contentLengthHeader = getHeaderValue(headers, HttpHeaders.CONTENT_LENGTH);
      String body =
          (contentLengthHeader != null) ? parseBody(scanner, Integer.parseInt(contentLengthHeader))
              : parseBody(scanner);
      response.setStatusCode(statusCode);
      response.setStatusInfo(statusInfo);
      response.setHeaders(headers);
      response.setContentId(currentContentId);
      response.setBody(body);
    } else {
      currentLineNumber++;
      throw new BatchException(BatchException.INVALID_STATUS_LINE.addContent(scanner.next()).addContent(
          currentLineNumber));
    }
    return response;
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.batch.BatchException

    return response;
  }

  private void validateEncoding(final String encoding) throws BatchException {
    if (!BatchHelper.BINARY_ENCODING.equalsIgnoreCase(encoding)) {
      throw new BatchException(BatchException.INVALID_CONTENT_TRANSFER_ENCODING);
    }
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.batch.BatchException

          String headerName = result.group(1).trim().toLowerCase(Locale.ENGLISH);
          String headerValue = result.group(2).trim();
          headers.put(headerName, headerValue);
        }
      } else {
        throw new BatchException(BatchException.INVALID_HEADER.addContent(scanner.next()));
      }
    }
    return headers;
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.batch.BatchException

            headers.put(headerName, headerValue);
          }
        }
      } else {
        currentLineNumber++;
        throw new BatchException(BatchException.INVALID_HEADER.addContent(scanner.next())
            .addContent(currentLineNumber));
      }
    }
    return headers;
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.batch.BatchException

    contentTypeScanner.useDelimiter(";\\s?");
    if (contentTypeScanner.hasNext(REG_EX_CONTENT_TYPE)) {
      contentTypeScanner.next(REG_EX_CONTENT_TYPE);
    } else {
      contentTypeScanner.close();
      throw new BatchException(BatchException.INVALID_CONTENT_TYPE.addContent(HttpContentType.MULTIPART_MIXED));
    }
    if (contentTypeScanner.hasNext(REG_EX_BOUNDARY_PARAMETER)) {
      contentTypeScanner.next(REG_EX_BOUNDARY_PARAMETER);
      MatchResult result = contentTypeScanner.match();
      contentTypeScanner.close();
      if (result.groupCount() == 1 && result.group(1).trim().matches(REG_EX_BOUNDARY)) {
        return trimQuota(result.group(1).trim());
      } else {
        throw new BatchException(BatchException.INVALID_BOUNDARY);
      }
    } else {
      contentTypeScanner.close();
      throw new BatchException(BatchException.MISSING_PARAMETER_IN_CONTENT_TYPE);
    }
  }
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.