方法跳过return语句

时间:2013-03-14 12:59:56

标签: java object unmarshalling

我有一种解组方法:

public static Object unmarshalXmlTo0100(String xmlMsg, String destination, String resource) throws Exception {
    //init unmarshaller
    ByteArrayInputStream input = new ByteArrayInputStream(xmlMsg.getBytes());
    JAXBContext context = JAXBContext.newInstance(destination);
    Unmarshaller unmarshaller = context.createUnmarshaller();

    //init schema
    SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
    Schema schema = schemaFactory.newSchema(XmlParser.class.getClassLoader().getResource(resource));
    unmarshaller.setSchema(schema);

    //unmarschal
    Object data = unmarshaller.unmarshal(input);

    //return message
    return data;
 }

现在我出于某种原因使用以下方法来调用方法:

processDataObj = MainXMLParser.unmarshalXmlTo0100(processData, "cp.jaxb.planningBericht.classes", "source/xml/cp_md_format_planningBericht.xsd");

一切都很顺利。

但是当我使用以下内容时:

processDataObj = MainXMLParser.unmarshalXmlTo0100(processData, "cp.jaxb.beschikbaarheidBericht.classes", "source/xml/cp_md_format_beschikbaarheidBericht.xsd");

unmarshaller什么都不返回,但是它继续运行,所以proccesDataObj是空的......

我不知道出了什么问题......

1 个答案:

答案 0 :(得分:0)

您确定其他XSD文件是否存在于上述位置?你是肯定的,这个XSD方案实际上是“正确的”(例如有预期的名称空间和其他类型)?

相关问题