org.editorconfig.core.EditorConfigException Java Examples

The following examples show how to use org.editorconfig.core.EditorConfigException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EditorConfigService.java    From editorconfig-eclipse with Apache License 2.0 6 votes vote down vote up
public EditorFileConfig getEditorConfig(final String path) {
	final List<OutPair> properties;
	try {
		properties = editorConfig.getProperties(path);
	} catch (final EditorConfigException e) {
		throw new RuntimeException(e);
	}
	final SortedSet<ConfigProperty> configProperties = new TreeSet<ConfigProperty>(CONFIG_PROPERTY_TYPE_COMPARATOR);
	for (final OutPair outPair : properties) {
		final ConfigProperty configProperty = createConfigProperty(outPair);
		if (configProperty != null) {
			configProperties.add(configProperty);
		}
	}
	return new EditorFileConfig(path, Collections.unmodifiableSet(configProperties));
}
 
Example #2
Source File: SettingsProviderComponent.java    From editorconfig-jetbrains with MIT License 5 votes vote down vote up
public List<OutPair> getOutPairs (String filePath) {
    final List<OutPair> outPairs;
    try {
        outPairs = editorConfig.getProperties(filePath);
        return outPairs;
    }
    catch (EditorConfigException error) {
        LOG.error(error);
        return new ArrayList<OutPair>();
    }   
}
 
Example #3
Source File: EditorConfigServiceTest.java    From editorconfig-eclipse with Apache License 2.0 4 votes vote down vote up
@Test(expected = RuntimeException.class)
public void getFileConfigShouldThrowRuntimeExceptionWhenEditorConfigThrowsException() throws Exception {
	when(mockEditorConfig.getProperties("path")).thenThrow(EditorConfigException.class);
	editorConfigService.getEditorConfig("path");
}