当前位置: 首页>>代码示例>>Java>>正文


Java JAXBException.getMessage方法代码示例

本文整理汇总了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;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:JAXBSource.java

示例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;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:AbstractJaxb2HttpMessageConverter.java

示例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;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:JAXBBridgeSource.java

示例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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:ServiceArtifactSchemaGenerator.java

示例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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:ServiceArtifactSchemaGenerator.java

示例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;
}
 
开发者ID:zhangjunfang,项目名称:util,代码行数:16,代码来源:XmlMapper.java

示例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());
    }

}
 
开发者ID:Samuel-Oliveira,项目名称:Java_CTe,代码行数:18,代码来源:EnvioCte.java

示例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;
}
 
开发者ID:xipki,项目名称:xitk,代码行数:8,代码来源:P11Conf.java

示例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;
}
 
开发者ID:xipki,项目名称:xitk,代码行数:9,代码来源:XmlUtil.java

示例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);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:AbstractJaxb2HttpMessageConverter.java

示例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);
    }
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:31,代码来源:ClientStateMachine.java

示例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);
    }
}
 
开发者ID:apache,项目名称:nifi-registry,代码行数:11,代码来源:JAXBSerializer.java

示例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());
    }

}
 
开发者ID:Samuel-Oliveira,项目名称:Java_CTe,代码行数:36,代码来源:EnvioCte.java

示例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());
    }

}
 
开发者ID:Samuel-Oliveira,项目名称:Java_CTe,代码行数:19,代码来源:EnvioCte.java

示例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());
        }

    }
 
开发者ID:Samuel-Oliveira,项目名称:Java_CTe,代码行数:15,代码来源:Evento.java


注:本文中的javax.xml.bind.JAXBException.getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。