private static void throwParseException(String value, Type type, Throwable cause) throws ODataUnmarshallingException { throw new ODataUnmarshallingException("This is not a valid " + type + " value: " + value, cause); }
private static void throwParseException(String value, Type type, Throwable cause) throws ODataUnmarshallingException { throw new ODataUnmarshallingException("This is not a valid " + type + " value: " + value, cause); }
private void throwValidationException(StringBuilder validationMessage) throws ODataUnmarshallingException { validationMessage.insert(0, "Cannot send null value for not nullable field(s) "); throw new ODataUnmarshallingException(validationMessage.delete(validationMessage. lastIndexOf(", "), validationMessage.length()).toString()); }
private void throwValidationException(StringBuilder validationMessage) throws ODataUnmarshallingException { validationMessage.insert(0, "Cannot send null value for not nullable field(s) "); throw new ODataUnmarshallingException(validationMessage.delete(validationMessage. lastIndexOf(", "), validationMessage.length()).toString()); }
private static ODataUnmarshallingException wrapInvocationTargetException( InvocationTargetException e) { if (e.getCause() != null) { return new ODataUnmarshallingException(e.getCause().getMessage(), e.getCause()); } else { return new ODataUnmarshallingException(e.getMessage(), e); } } }
private static ODataUnmarshallingException wrapInvocationTargetException( InvocationTargetException e) { if (e.getCause() != null) { return new ODataUnmarshallingException(e.getCause().getMessage(), e.getCause()); } else { return new ODataUnmarshallingException(e.getMessage(), e); } } }
protected void checkFeedMetadata(Element feedMetadataElement, String nodeLocalName) throws ODataUnmarshallingException { if (!nodeLocalName.equals(feedMetadataElement.getLocalName())) { throw new ODataUnmarshallingException("Wrong Feed metadata. Found: '" + feedMetadataElement.getLocalName() + "'. Expected: '" + nodeLocalName + "'"); } }
protected void checkFeedMetadata(Element feedMetadataElement, String nodeLocalName) throws ODataUnmarshallingException { if (!nodeLocalName.equals(feedMetadataElement.getLocalName())) { throw new ODataUnmarshallingException("Wrong Feed metadata. Found: '" + feedMetadataElement.getLocalName() + "'. Expected: '" + nodeLocalName + "'"); } }
public static void setFieldValue(Field field, Object entity, Object value) throws ODataUnmarshallingException { try { field.setAccessible(true); field.set(entity, value); LOG.debug("'{}' is set with '{}'", field.getName(), value); } catch (IllegalAccessException e) { throw new ODataUnmarshallingException(e.getMessage(), e); } }
public static void setFieldValue(Field field, Object entity, Object value) throws ODataUnmarshallingException { try { field.setAccessible(true); field.set(entity, value); LOG.debug("'{}' is set with '{}'", field.getName(), value); } catch (IllegalAccessException e) { throw new ODataUnmarshallingException(e.getMessage(), e); } }
private Document parseXML(String xml) throws ODataUnmarshallingException { try { return DOCBUILDER_FACTORY.newDocumentBuilder().parse(new InputSource(new StringReader(xml))); } catch (SAXException e) { throw new ODataUnmarshallingException("Error while parsing XML", e); } catch (IOException | ParserConfigurationException e) { throw new ODataSystemException(e); } }
private Document parseXML(String xml) throws ODataUnmarshallingException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { return factory.newDocumentBuilder().parse(new InputSource(new StringReader(xml))); } catch (SAXException e) { throw new ODataUnmarshallingException("Error while parsing XML", e); } catch (IOException | ParserConfigurationException e) { throw new ODataSystemException(e); } } }
private Document parseXML(String xml) throws ODataUnmarshallingException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { return factory.newDocumentBuilder().parse(new InputSource(new StringReader(xml))); } catch (SAXException e) { throw new ODataUnmarshallingException("Error while parsing XML", e); } catch (IOException | ParserConfigurationException e) { throw new ODataSystemException(e); } } }
private Document parseXML(String xml) throws ODataUnmarshallingException { try { return DOCBUILDER_FACTORY.newDocumentBuilder().parse(new InputSource(new StringReader(xml))); } catch (SAXException e) { throw new ODataUnmarshallingException("Error while parsing XML", e); } catch (IOException | ParserConfigurationException e) { throw new ODataSystemException(e); } }
/** * Parse the payload to obtain a list of entities (feed). * * @return The list of entities (feed) contained by the payload. * @throws ODataException In case of a parsing or validation error */ public List<?> getODataEntities() throws ODataException { final String bodyText = getBodyText(); LOG.trace("Text of the body is {}", bodyText); if (!isNullOrEmpty(bodyText)) { return processEntities(bodyText); } else { throw new ODataUnmarshallingException("Payload is empty. Expected a feed."); } }
/** * Parse the payload to obtain a single entity (entry). * * @return The single entity (entry) contained by the payload. * @throws ODataException In case of a parsing or validation error */ public Object getODataEntity() throws ODataException { final String bodyText = getBodyText(); LOG.trace("Text of the body is {}", bodyText); if (!isNullOrEmpty(bodyText)) { return processEntity(bodyText); } else { throw new ODataUnmarshallingException("Payload is empty. Expected an entry."); } }
/** * Parse the payload to obtain a single entity (entry). * * @return The single entity (entry) contained by the payload. * @throws ODataException In case of a parsing or validation error */ public Object getODataEntity() throws ODataException { final String bodyText = getBodyText(); LOG.trace("Text of the body is {}", bodyText); if (!isNullOrEmpty(bodyText)) { return processEntity(bodyText); } else { throw new ODataUnmarshallingException("Payload is empty. Expected an entry."); } }
/** * Parse the payload to obtain a list of entities (feed). * * @return The list of entities (feed) contained by the payload. * @throws ODataException In case of a parsing or validation error */ public List<?> getODataEntities() throws ODataException { final String bodyText = getBodyText(); LOG.trace("Text of the body is {}", bodyText); if (!isNullOrEmpty(bodyText)) { return processEntities(bodyText); } else { throw new ODataUnmarshallingException("Payload is empty. Expected a feed."); } }
private void assignParametersToAction(Map<String, Object> bodyParameters, Set<Parameter> actionParameters, Object actionObject) throws ODataUnmarshallingException { for (Parameter parameter : actionParameters) { Object bodyParameter = bodyParameters.get(parameter.getName()); if (bodyParameter == null && !parameter.isNullable()) { LOG.error("Error during setting a parameter to action object field"); throw new ODataUnmarshallingException("Assigning null to non nullable parameter"); } Field javaField = parameter.getJavaField(); ParameterTypeUtil.setParameter(actionObject, javaField, bodyParameter); } }
private void assignParametersToAction(Map<String, Object> bodyParameters, Set<Parameter> actionParameters, Object actionObject) throws ODataUnmarshallingException { for (Parameter parameter : actionParameters) { Object bodyParameter = bodyParameters.get(parameter.getName()); if (bodyParameter == null && !parameter.isNullable()) { LOG.error("Error during setting a parameter to action object field"); throw new ODataUnmarshallingException("Assigning null to non nullable parameter"); } Field javaField = parameter.getJavaField(); ParameterTypeUtil.setParameter(actionObject, javaField, bodyParameter); } }