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


Java JDOMParseException类代码示例

本文整理汇总了Java中org.jdom.input.JDOMParseException的典型用法代码示例。如果您正苦于以下问题:Java JDOMParseException类的具体用法?Java JDOMParseException怎么用?Java JDOMParseException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JDOMParseException类属于org.jdom.input包,在下文中一共展示了JDOMParseException类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testMapWithIvalidXml

import org.jdom.input.JDOMParseException; //导入依赖的package包/类
@Test
public void testMapWithIvalidXml() throws Exception {
    // given
    Configuration conf = new Configuration();
    conf.set(NAMED_OUTPUT_META, "meta");
    conf.set(NAMED_OUTPUT_FAULT, "fault");
    doReturn(conf).when(context).getConfiguration();
    mapper.setup(context);
    
    String id = "id";
    DocumentText.Builder docTextBuilder = DocumentText.newBuilder();
    docTextBuilder.setId(id);
    docTextBuilder.setText(getContent(NON_XML_FILE));
    
    // execute
    mapper.map(new AvroKey<>(docTextBuilder.build()), null, context);
    
    // assert
    verify(context, never()).write(any(), any());
    verify(multipleOutputs, times(2)).write(mosKeyCaptor.capture(), mosValueCaptor.capture());
    // doc meta
    assertEquals(conf.get(NAMED_OUTPUT_META), mosKeyCaptor.getAllValues().get(0));
    ExtractedDocumentMetadata docMeta = (ExtractedDocumentMetadata) mosValueCaptor.getAllValues().get(0).datum();
    assertNotNull(docMeta);
    assertEquals(id, docMeta.getId());
    assertEquals("", docMeta.getText());
    assertEquals(JatsXmlHandler.ENTITY_TYPE_UNKNOWN, docMeta.getEntityType());
    // fault
    assertEquals(conf.get(NAMED_OUTPUT_FAULT), mosKeyCaptor.getAllValues().get(1));
    Fault fault = (Fault) mosValueCaptor.getAllValues().get(1).datum();
    assertNotNull(fault);
    assertEquals(id, fault.getInputObjectId());
    assertEquals(JDOMParseException.class.getName(), fault.getCode());
    assertTrue(fault.getTimestamp() > 0);
}
 
开发者ID:openaire,项目名称:iis,代码行数:36,代码来源:MetadataImporterTest.java

示例2: readNext

import org.jdom.input.JDOMParseException; //导入依赖的package包/类
@Override
public NATO4676Message readNext(
		final InputStream is ) {
	NATO4676Message msg = null;
	try {
		if (printNotParse) {
			final String trackStr = IOUtils.toString(
					is,
					"UTF-8");
			is.reset();
		}
		else {
			final SAXBuilder builder = new SAXBuilder();
			final Document doc = builder.build(is);

			final Element rootEl = doc.getRootElement();
			final Namespace xmlns = rootEl.getNamespace();

			String name = rootEl.getName();
			if ("TrackMessage".equals(name)) {
				msg = readTrackMessage(
						rootEl,
						xmlns);
				LOGGER.info("TrackMessage read " + trackStatsNumTracks + " Tracks and " + trackStatsNumDots
						+ " TrackPoints.");
			}
			else if ("MissionSummary".equals(name)) {
				msg = readMissionSummaryMessage(
						rootEl,
						xmlns);
			}
		}
	}
	catch (final JDOMParseException jdomPe) {
		LOGGER.info(
				"jdomParseException: " + jdomPe.getLocalizedMessage(),
				jdomPe);
		return null;
	}
	catch (final IOException ioe) {
		LOGGER.info(
				"IO exception: " + ioe.getLocalizedMessage(),
				ioe);
		return null;
	}
	catch (final JDOMException jdome) {
		LOGGER.info(
				"jdomException: " + jdome.getLocalizedMessage(),
				jdome);
		return null;
	}

	return msg;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:55,代码来源:NATO4676Decoder.java

示例3: getLineNumber

import org.jdom.input.JDOMParseException; //导入依赖的package包/类
/**
 * Returns the line number of the end of the text where the
 * parse error occurred.
 * <p>
 * The first line in the document is line 1.</p>
 *
 * @return an integer representing the line number, or -1
 *         if the information is not available.
 */
public int getLineNumber() {
    return (getCause() instanceof JDOMParseException)?
        ((JDOMParseException)getCause()).getLineNumber(): -1;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:14,代码来源:ParsingFeedException.java

示例4: getColumnNumber

import org.jdom.input.JDOMParseException; //导入依赖的package包/类
/**
 * Returns the column number of the end of the text where the
 * parse error occurred.
 * <p>
 * The first column in a line is position 1.</p>
 *
 * @return an integer representing the column number, or -1
 *         if the information is not available.
 */
public int getColumnNumber() {
    return (getCause() instanceof JDOMParseException)?
        ((JDOMParseException)getCause()).getColumnNumber(): -1;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:14,代码来源:ParsingFeedException.java


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