本文整理汇总了Java中javax.xml.bind.JAXBException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java JAXBException.getMessage方法的具体用法?Java JAXBException.getMessage怎么用?Java JAXBException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.bind.JAXBException
的用法示例。
在下文中一共展示了JAXBException.getMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
public void parse() throws SAXException {
// parses a content object by using the given marshaller
// SAX events will be sent to the repeater, and the repeater
// will further forward it to an appropriate component.
try {
marshaller.marshal( contentObject, (XMLFilterImpl)repeater );
} catch( JAXBException e ) {
// wrap it to a SAXException
SAXParseException se =
new SAXParseException( e.getMessage(),
null, null, -1, -1, e );
// if the consumer sets an error handler, it is our responsibility
// to notify it.
if(errorHandler!=null)
errorHandler.fatalError(se);
// this is a fatal error. Even if the error handler
// returns, we will abort anyway.
throw se;
}
}
示例2: getJaxbContext
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
/**
* Return a {@link JAXBContext} for the given class.
* @param clazz the class to return the context for
* @return the {@code JAXBContext}
* @throws HttpMessageConversionException in case of JAXB errors
*/
protected final JAXBContext getJaxbContext(Class<?> clazz) {
Assert.notNull(clazz, "'clazz' must not be null");
JAXBContext jaxbContext = this.jaxbContexts.get(clazz);
if (jaxbContext == null) {
try {
jaxbContext = JAXBContext.newInstance(clazz);
this.jaxbContexts.putIfAbsent(clazz, jaxbContext);
}
catch (JAXBException ex) {
throw new HttpMessageConversionException(
"Could not instantiate JAXBContext for class [" + clazz + "]: " + ex.getMessage(), ex);
}
}
return jaxbContext;
}
示例3: parse
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
public void parse() throws SAXException {
// parses a content object by using the given bridge
// SAX events will be sent to the repeater, and the repeater
// will further forward it to an appropriate component.
try {
startDocument();
// this method only writes a fragment, so need start/end document
bridge.marshal( contentObject, this, null );
endDocument();
} catch( JAXBException e ) {
// wrap it to a SAXException
SAXParseException se =
new SAXParseException( e.getMessage(),
null, null, -1, -1, e );
// if the consumer sets an error handler, it is our responsibility
// to notify it.
fatalError(se);
// this is a fatal error. Even if the error handler
// returns, we will abort anyway.
throw se;
}
}
示例4: addChild
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
protected Occurs addChild(ExplicitGroup sq, QName name, TypeInfo typeInfo) {
LocalElement le = null;;
QName type = model.getBindingContext().getTypeName(typeInfo);
if (type != null) {
le = sq.element();
le._attribute("name", name.getLocalPart());
le.type(type);
} else {
if (typeInfo.type instanceof Class) {
try {
QName elemName = model.getBindingContext().getElementName((Class)typeInfo.type);
if (elemName.getLocalPart().equals("any") && elemName.getNamespaceURI().equals(XsdNs)) {
return sq.any();
} else {
le = sq.element();
le.ref(elemName);
}
} catch (JAXBException je) {
throw new WebServiceException(je.getMessage(), je);
}
}
}
return le;
}
示例5: bodyParamNS
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
protected String bodyParamNS(ParameterImpl p) {
String nsToImport = null;
TypeInfo typeInfo = p.getItemType();
if (typeInfo == null) typeInfo = p.getTypeInfo();
QName type = model.getBindingContext().getTypeName(typeInfo);
if (type != null) {
nsToImport = type.getNamespaceURI();
} else {
if (typeInfo.type instanceof Class) {
try {
QName elemRef = model.getBindingContext().getElementName((Class)typeInfo.type);
if (elemRef != null) nsToImport = elemRef.getNamespaceURI();
} catch (JAXBException je) {
throw new WebServiceException(je.getMessage(), je);
}
}
}
return nsToImport;
}
示例6: getJaxbContext
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
protected static JAXBContext getJaxbContext(Class clazz) {
Validate.notNull(clazz, "'clazz' must not be null");
JAXBContext jaxbContext = jaxbContexts.get(clazz);
if (jaxbContext == null) {
try {
jaxbContext = JAXBContext.newInstance(clazz, CollectionWrapper.class);
jaxbContexts.putIfAbsent(clazz, jaxbContext);
} catch (JAXBException ex) {
throw new RuntimeException(
"Could not instantiate JAXBContext for class [" + clazz + "]: " + ex.getMessage(), ex);
}
}
return jaxbContext;
}
示例7: enviaCte
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
/**
* Metodo para Enviar a CTE
*
* @param TEnviCTe
* @return TRetEnviCTe
* @throws CteException
*/
static TRetEnviCTe enviaCte(TEnviCTe enviCTe) throws CteException {
try {
result = enviar(XmlUtil.objectCteToXml(enviCTe), ConstantesCte.CTE);
return XmlUtil.xmlToObject(result.getExtraElement().toString(), br.inf.portalfiscal.cte.schema_300.retEnviCTe.TRetEnviCTe.class);
} catch (JAXBException e) {
throw new CteException(e.getMessage());
}
}
示例8: getMessage
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
private static String getMessage(JAXBException ex) {
String ret = ex.getMessage();
if (ret == null && ex.getLinkedException() != null) {
ret = ex.getLinkedException().getMessage();
}
return ret;
}
示例9: getMessage
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
public static String getMessage(JAXBException ex) {
ParamUtil.requireNonNull("ex", ex);
String ret = ex.getMessage();
if (ret == null && ex.getLinkedException() != null) {
ret = ex.getLinkedException().getMessage();
}
return ret;
}
示例10: createUnmarshaller
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
/**
* Create a new {@link Unmarshaller} for the given class.
* @param clazz the class to create the unmarshaller for
* @return the {@code Unmarshaller}
* @throws HttpMessageConversionException in case of JAXB errors
*/
protected final Unmarshaller createUnmarshaller(Class<?> clazz) throws JAXBException {
try {
JAXBContext jaxbContext = getJaxbContext(clazz);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
customizeUnmarshaller(unmarshaller);
return unmarshaller;
}
catch (JAXBException ex) {
throw new HttpMessageConversionException(
"Could not create Unmarshaller for class [" + clazz + "]: " + ex.getMessage(), ex);
}
}
示例11: proceed
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
private void proceed()
{
// The server is ready, so send our MissionInit back to the agent and go!
// We launch the agent by sending it the MissionInit message we were sent
// (but with the Launcher's IP address included)
String xml = null;
boolean sentOkay = false;
String errorReport = "";
try
{
xml = SchemaHelper.serialiseObject(currentMissionInit(), MissionInit.class);
sentOkay = ClientStateMachine.this.getMissionControlSocket().sendTCPString(xml);
}
catch (JAXBException e)
{
errorReport = e.getMessage();
}
if (sentOkay)
episodeHasCompleted(ClientState.RUNNING);
else
{
ClientStateMachine.this.getScreenHelper().addFragment("ERROR: Could not contact agent to start mission - mission will abort.", TextCategory.TXT_CLIENT_WARNING, 10000);
if (!errorReport.isEmpty())
{
ClientStateMachine.this.getScreenHelper().addFragment("ERROR DETAILS: " + errorReport, TextCategory.TXT_CLIENT_WARNING, 10000);
errorReport = ": " + errorReport;
}
episodeHasCompletedWithErrors(ClientState.ERROR_CANNOT_START_AGENT, "Failed to send MissionInit back to agent" + errorReport);
}
}
示例12: JAXBSerializer
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
/**
* Load the JAXBContext.
*/
public JAXBSerializer(final Class<T> clazz) {
try {
this.jaxbContext = JAXBContext.newInstance(clazz);
} catch (JAXBException e) {
throw new RuntimeException("Unable to create JAXBContext: " + e.getMessage(), e);
}
}
示例13: montaCte
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
/**
* Metodo para Montar a CTE
*
* @param TEnviNFe
* @return TEnviCTe
* @throws NfeException
*/
static TEnviCTe montaCte(TEnviCTe enviCTe, boolean valida) throws CteException {
try {
/**
* Assina o Xml
*/
String xml = Assinatura.assinar(XmlUtil.objectCteToXml(enviCTe), Assinatura.CTE);
/**
* Valida o Xml caso sejá selecionado True
*/
if (valida) {
String erros = ValidarCte.validaXml(xml, ConstantesCte.SERVICOS.ENVIO_CTE);
if (!ObjetoUtil.isEmpty(erros)) {
throw new CteException("Erro Na Validação do Xml: " + erros);
}
}
if(ConfiguracoesIniciais.getInstance().isLog()){
System.out.println("Cte Assinado: " + xml);
}
return XmlUtil.xmlToObject(xml, br.inf.portalfiscal.cte.schema_300.enviCTe.TEnviCTe.class);
} catch (JAXBException e) {
throw new CteException(e.getMessage());
}
}
示例14: enviaCteOS
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
/**
* Metodo para Enviar a CTEOS.
*
* @param TEnviCTe
* @return TRetEnviCTe
* @throws CteException
*/
static TRetCTeOS enviaCteOS(br.inf.portalfiscal.cte.schema_300.enviCTe.TEnviCTe enviCTe) throws CteException {
try {
result = enviar(XmlUtil.objectCteToXml(enviCTe), ConstantesCte.CTE_OS);
return XmlUtil.xmlToObject(result.getExtraElement().toString(), TRetCTeOS.class);
} catch (JAXBException e) {
throw new CteException(e.getMessage());
}
}
示例15: cancelamento
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
static br.inf.portalfiscal.cte.schema_300.evCancCTe.TRetEvento cancelamento(br.inf.portalfiscal.cte.schema_300.evCancCTe.TEvento evento, boolean valida) throws CteException {
try {
String xml = XmlUtil.objectCteToXml(evento);
xml = evento(xml, ConstantesCte.SERVICOS.CANCELAR, valida);
return XmlUtil.xmlToObject(xml, br.inf.portalfiscal.cte.schema_300.evCancCTe.TRetEvento.class);
} catch (JAXBException e) {
throw new CteException(e.getMessage());
}
}