本文整理汇总了Java中org.yaml.snakeyaml.parser.ParserException类的典型用法代码示例。如果您正苦于以下问题:Java ParserException类的具体用法?Java ParserException怎么用?Java ParserException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParserException类属于org.yaml.snakeyaml.parser包,在下文中一共展示了ParserException类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: readConfig
import org.yaml.snakeyaml.parser.ParserException; //导入依赖的package包/类
public MetadataList readConfig(String mappingFile) {
try {
File file = new File(mappingFile);
log.info("Loading mapping file from " + file.getAbsolutePath());
InputStream configStream = new FileInputStream(file);
return readConfig(configStream);
} catch (FileNotFoundException e) {
log.warn("No configuration found");
} catch (ParserException pe) {
log.error(pe);
}
return null;
}
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:17,代码来源:ConfigReader.java
示例2: constructMapping
import org.yaml.snakeyaml.parser.ParserException; //导入依赖的package包/类
@Override
protected Map<Object, Object> constructMapping(MappingNode node) {
try {
return super.constructMapping(node);
}
catch (IllegalStateException ex) {
throw new ParserException("while parsing MappingNode",
node.getStartMark(), ex.getMessage(), node.getEndMark());
}
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:11,代码来源:YamlProcessor.java
示例3: testBadDocumentStart
import org.yaml.snakeyaml.parser.ParserException; //导入依赖的package包/类
@Test
public void testBadDocumentStart() throws Exception {
this.processor.setResources(new ByteArrayResource(
"foo # a document\nbar: baz".getBytes()));
this.exception.expect(ParserException.class);
this.exception.expectMessage("line 2, column 1");
this.processor.process(new MatchCallback() {
@Override
public void process(Properties properties, Map<String, Object> map) {
}
});
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:13,代码来源:YamlProcessorTests.java
示例4: testLoadResourcesWithInternalOverride
import org.yaml.snakeyaml.parser.ParserException; //导入依赖的package包/类
@Test
public void testLoadResourcesWithInternalOverride() throws Exception {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(new ByteArrayResource(
"foo: bar\nspam:\n foo: baz\nfoo: bucket".getBytes()));
exception.expect(ParserException.class);
factory.getObject();
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:9,代码来源:YamlPropertiesFactoryBeanTests.java
示例5: readYaml
import org.yaml.snakeyaml.parser.ParserException; //导入依赖的package包/类
private Iterable<Object> readYaml(Option<FileArtifact> manifestFile) {
try {
Yaml yaml = new Yaml();
return (Iterable<Object>) yaml.loadAll(manifestFile.get().content());
}
catch (ParserException e) {
throw new ManifestParsingException("manifest.yml file in .atomist is malformed:\n\n%s",
e.getMessage());
}
}
开发者ID:atomist-attic,项目名称:rug-resolver,代码行数:11,代码来源:ManifestReader.java
示例6: findRuntime
import org.yaml.snakeyaml.parser.ParserException; //导入依赖的package包/类
@VisibleForTesting
static String findRuntime(StageFlexibleConfiguration config) throws IOException {
try {
// verification for app.yaml that contains runtime:java
Path appYaml = config.getAppEngineDirectory().toPath().resolve(APP_YAML);
return new AppYaml(appYaml).getRuntime();
} catch (ScannerException | ParserException ex) {
throw new AppEngineException("Malformed 'app.yaml'.", ex);
}
}
开发者ID:GoogleCloudPlatform,项目名称:appengine-plugins-core,代码行数:11,代码来源:CloudSdkAppEngineFlexibleStaging.java
示例7: deserialize
import org.yaml.snakeyaml.parser.ParserException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public ConfigurationResult deserialize(InputStream input) throws ConfigurationException {
String content = new Scanner(input).useDelimiter("\\A").next();
HierarchicalConfiguration configuration = new HierarchicalConfiguration();
List<IncludeReference> includes = new ArrayList<>();
if (!content.isEmpty()) {
Object tree;
try {
tree = yaml.load(content);
} catch (ParserException e) {
throw new ConfigurationException("Failed to parse input as valid YAML.", e);
}
traverseTreeAndLoad(configuration.getRootNode(), null, includes, tree);
// Get the references from the special 'extends' key.
for (String reference : configuration.getStringArray("extends")) {
includes.add(new IncludeReference(reference));
}
}
return new ConfigurationResult(configuration, includes);
}
开发者ID:LableOrg,项目名称:java-dynamicconfig,代码行数:27,代码来源:YamlDeserializer.java
示例8: rewriteMessage
import org.yaml.snakeyaml.parser.ParserException; //导入依赖的package包/类
public String rewriteMessage(YAMLException exception) {
if (exception instanceof ParserException) {
if ("while parsing a block mapping".equals(((ParserException) exception).getContext())) {
return Messages.error_yaml_parser_indentation;
}
}
return exception != null ? exception.getLocalizedMessage() : null;
}
开发者ID:RepreZen,项目名称:KaiZen-OpenAPI-Editor,代码行数:9,代码来源:YamlErrorProcessor.java
示例9: testDuplicateKey
import org.yaml.snakeyaml.parser.ParserException; //导入依赖的package包/类
@Test(expected = ParserException.class)
public void testDuplicateKey() throws Exception {
this.factory.setResources(new ByteArrayResource[] {new ByteArrayResource(
"mymap:\n foo: bar\nmymap:\n bar: foo".getBytes())});
this.factory.getObject().get("mymap");
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:7,代码来源:YamlMapFactoryBeanTests.java
示例10: ParseConfigException
import org.yaml.snakeyaml.parser.ParserException; //导入依赖的package包/类
public ParseConfigException(ParserException e) {
Problem problem = new ConfigProblemBuilder(Problem.Severity.FATAL,
"Could not parse your halconfig: " + e.getMessage()).build();
getProblems().add(problem);
}
开发者ID:spinnaker,项目名称:halyard,代码行数:6,代码来源:ParseConfigException.java
注:本文中的org.yaml.snakeyaml.parser.ParserException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论