public synchronized Object fromXML(java.io.Reader input) throws XMLUtilityException { Object beanObject; org.exolab.castor.xml.Unmarshaller unmarshaller = null; try { log.debug("Creating unmarshaller"); unmarshaller = new org.exolab.castor.xml.Unmarshaller(this.getMapping()); } catch (MappingException e) { log.error("XML mapping file is invalid: ", e); throw new XMLUtilityException("XML mapping file invalid: ", e); } catch (Exception e) { log.error("General Exception caught trying to create unmarshaller: ", e); throw new XMLUtilityException("General Exception caught trying to create unmarshaller: ", e); } try { log.debug("About to unmarshal from input "); beanObject = unmarshaller.unmarshal(input); } catch (MarshalException e) { log.error("Error marshalling input: ", e); throw new XMLUtilityException("Error unmarshalling xml input: " + e.getMessage(), e); } catch (ValidationException e) { log.error("Error in xml validation when unmarshalling xml input: ", e); throw new XMLUtilityException("Error in xml validation when unmarshalling xml input: ", e); } return beanObject; }
/** * Returns the typed value, serialized to a ByteBuffer according to a comparator/validator. * * @return a ByteBuffer of the value. * @throws InvalidRequestException if unable to coerce the string to its type. */ public ByteBuffer getByteBuffer(AbstractType<?> validator, List<ByteBuffer> variables) throws InvalidRequestException { try { if (!isBindMarker()) return validator.fromStringCQL2(text); // must be a marker term so check for a CqlBindValue stored in the term if (bindIndex == null) throw new AssertionError("a marker Term was encountered with no index value"); return variables.get(bindIndex); } catch (MarshalException e) { throw new InvalidRequestException(e.getMessage()); } }