下面列出了怎么用org.eclipse.emf.ecore.resource.URIConverter的API类实例代码及写法,或者点击链接到github查看源代码。
protected URI getNormalizedURI(Resource resource) {
URI uri = resource.getURI();
URIConverter uriConverter = resource.getResourceSet()!=null?resource.getResourceSet().getURIConverter():null;
if (uri != null && uriConverter != null) {
if (!uri.isPlatform()) {
return uriConverter.normalize(uri);
}
// This is a fix for resources which have been loaded using a platform:/plugin URI
// This happens when one resource has absolute references using a platform:/plugin uri and the corresponding
// ResourceDescriptionManager resolves references in the first phase, i.e. during EObjectDecription computation.
// EMF's GenModelResourceDescriptionStrategy does so as it needs to call GenModel.reconcile() eagerly.
if (uri.isPlatformPlugin()) {
URI resourceURI = uri.replacePrefix(URI.createURI("platform:/plugin/"), URI.createURI("platform:/resource/"));
if (uriConverter.normalize(uri).equals(uriConverter.normalize(resourceURI)))
return resourceURI;
}
}
return uri;
}
private void removeGeneratedFiles(URI source, XSource2GeneratedMapping source2GeneratedMapping) {
Map<URI, String> outputConfigMap = source2GeneratedMapping.deleteSourceAndGetOutputConfigs(source);
IResourceServiceProvider serviceProvider = context.getResourceServiceProvider(source);
IContextualOutputConfigurationProvider2 outputConfigurationProvider = serviceProvider
.get(IContextualOutputConfigurationProvider2.class);
XtextResourceSet resourceSet = request.getResourceSet();
Set<OutputConfiguration> outputConfigs = outputConfigurationProvider.getOutputConfigurations(resourceSet);
Map<String, OutputConfiguration> outputConfigsMap = Maps.uniqueIndex(outputConfigs,
OutputConfiguration::getName);
URIConverter uriConverter = resourceSet.getURIConverter();
for (URI generated : outputConfigMap.keySet()) {
OutputConfiguration config = outputConfigsMap.get(outputConfigMap.get(generated));
if (config != null && config.isCleanUpDerivedResources()) {
try {
uriConverter.delete(generated, CollectionLiterals.emptyMap());
request.setResultDeleteFile(generated);
} catch (IOException e) {
Exceptions.sneakyThrow(e);
}
}
}
}
protected ExecutionContext restore(String context, Statechart statechart) {
try {
ResourceSet set = new ResourceSetImpl();
Resource resource = set.createResource(URI.createURI("snapshot.xmi"));
if (resource == null)
return null;
set.getResources().add(resource);
resource.load(new URIConverter.ReadableInputStream(context, "UTF_8"), Collections.emptyMap());
IDomain domain = DomainRegistry.getDomain(statechart);
Injector injector = domain.getInjector(IDomain.FEATURE_SIMULATION);
ITypeSystem typeSystem = injector.getInstance(ITypeSystem.class);
if (typeSystem instanceof AbstractTypeSystem) {
set.getResources().add(((AbstractTypeSystem) typeSystem).getResource());
}
EcoreUtil.resolveAll(resource);
ExecutionContext result = (ExecutionContext) resource.getContents().get(0);
result.setSnapshot(true);
return result;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* Given an array of {@link IContainers}, searches through all *.genmodel files in all {@link IFolders}, ignoring nested folders, trying to find a
* {@link GenModel} for the given {@link EPackage}.
*
* @param containers
* To search, may be empty, but must not be {@code null}
* @param baseURI
* of these containers; must not be {@code null}
* @param ePackage
* to find a genmodel for; must not be {@code null}
* @param resourceSet
* to use for resource loading; must not be {@code null}
* @return the genmodel, if found, or {@code null} if not.
* @throws CoreException
* if enumerating folder contents does so
*/
private static GenModel findGenModelInContainers(final IContainer[] containers, final URI baseURI, final EPackage ePackage, final ResourceSet resourceSet) throws CoreException {
Preconditions.checkNotNull(containers);
Preconditions.checkNotNull(baseURI);
Preconditions.checkNotNull(ePackage);
Preconditions.checkNotNull(resourceSet);
final URIConverter uriConverter = resourceSet.getURIConverter();
for (IContainer container : containers) {
if (!(container instanceof IFolder)) {
continue;
}
IResource[] resources = container.members();
for (IResource r : resources) {
if (r.exists() && r instanceof IFile && GENMODEL_EXTENSION.equals(r.getFileExtension())) {
URI uriToTry = uriConverter.normalize(baseURI.appendSegment(URI.encodeSegment(r.getName(), false)));
GenModel result = loadGenModel(uriToTry, ePackage, resourceSet);
if (result != null) {
return result;
}
}
}
}
return null;
}
@Test
public void getMissingVariables() throws IOException, InvalidFormatException {
try (XWPFDocument document = POIServices.getInstance().getXWPFDocument(URIConverter.INSTANCE,
URI.createFileURI("resources/document/properties/missingVariables.docx"));) {
final TemplateCustomProperties properties = new TemplateCustomProperties(document);
final List<String> missingVariables = properties.getMissingVariables();
assertEquals(16, missingVariables.size());
assertEquals("linkNamelinkText", missingVariables.get(0));
assertEquals("bookmarkName", missingVariables.get(1));
assertEquals("queryInBookmark", missingVariables.get(2));
assertEquals("ifCondition", missingVariables.get(3));
assertEquals("queryInIf", missingVariables.get(4));
assertEquals("elseIfCondition", missingVariables.get(5));
assertEquals("queryInElseIf", missingVariables.get(6));
assertEquals("queryInElse", missingVariables.get(7));
assertEquals("letExpression", missingVariables.get(8));
assertEquals("queryInLet", missingVariables.get(9));
assertEquals("forExpression", missingVariables.get(10));
assertEquals("queryInFor", missingVariables.get(11));
assertEquals("queryExpression", missingVariables.get(12));
assertEquals("aqlInSelect", missingVariables.get(13));
assertEquals("aqlLetExpression", missingVariables.get(14));
assertEquals("aqlLetBody", missingVariables.get(15));
}
}
@Test
public void getMissingVariablesInHeader() throws IOException, InvalidFormatException {
try (XWPFDocument document = POIServices.getInstance().getXWPFDocument(URIConverter.INSTANCE,
URI.createFileURI("resources/document/properties/missingVariablesInHeader.docx"));) {
final TemplateCustomProperties properties = new TemplateCustomProperties(document);
final List<String> missingVariables = properties.getMissingVariables();
assertEquals(16, missingVariables.size());
assertEquals("linkNamelinkText", missingVariables.get(0));
assertEquals("bookmarkName", missingVariables.get(1));
assertEquals("queryInBookmark", missingVariables.get(2));
assertEquals("ifCondition", missingVariables.get(3));
assertEquals("queryInIf", missingVariables.get(4));
assertEquals("elseIfCondition", missingVariables.get(5));
assertEquals("queryInElseIf", missingVariables.get(6));
assertEquals("queryInElse", missingVariables.get(7));
assertEquals("letExpression", missingVariables.get(8));
assertEquals("queryInLet", missingVariables.get(9));
assertEquals("forExpression", missingVariables.get(10));
assertEquals("queryInFor", missingVariables.get(11));
assertEquals("queryExpression", missingVariables.get(12));
assertEquals("aqlInSelect", missingVariables.get(13));
assertEquals("aqlLetExpression", missingVariables.get(14));
assertEquals("aqlLetBody", missingVariables.get(15));
}
}
@Test
public void getMissingVariablesInFooter() throws IOException, InvalidFormatException {
try (XWPFDocument document = POIServices.getInstance().getXWPFDocument(URIConverter.INSTANCE,
URI.createFileURI("resources/document/properties/missingVariablesInFooter.docx"));) {
final TemplateCustomProperties properties = new TemplateCustomProperties(document);
final List<String> missingVariables = properties.getMissingVariables();
assertEquals(16, missingVariables.size());
assertEquals("linkNamelinkText", missingVariables.get(0));
assertEquals("bookmarkName", missingVariables.get(1));
assertEquals("queryInBookmark", missingVariables.get(2));
assertEquals("ifCondition", missingVariables.get(3));
assertEquals("queryInIf", missingVariables.get(4));
assertEquals("elseIfCondition", missingVariables.get(5));
assertEquals("queryInElseIf", missingVariables.get(6));
assertEquals("queryInElse", missingVariables.get(7));
assertEquals("letExpression", missingVariables.get(8));
assertEquals("queryInLet", missingVariables.get(9));
assertEquals("forExpression", missingVariables.get(10));
assertEquals("queryInFor", missingVariables.get(11));
assertEquals("queryExpression", missingVariables.get(12));
assertEquals("aqlInSelect", missingVariables.get(13));
assertEquals("aqlLetExpression", missingVariables.get(14));
assertEquals("aqlLetBody", missingVariables.get(15));
}
}
/**
* Generates a stub for a custom class (e.g. FooImplCustom) into the {@link CustomClassEcoreGeneratorFragment#javaModelSrcDirectories specified SRC folder}.
*
* @param from
* qualified name of default implementation class (e.g. FooImpl) to extend
* @param customClassName
* qualified name of custom class to generate
* @param path
* URI for resource to generate into
*/
@SuppressWarnings({"nls", "PMD.InsufficientStringBufferDeclaration"})
protected void generateCustomClassStub(final String from, final String customClassName, final URI path) {
StringBuilder sb = new StringBuilder();
// sb.append(copyright()).append("\n");
int lastIndexOfDot = customClassName.lastIndexOf('.');
sb.append("package ").append(customClassName.substring(0, lastIndexOfDot)).append(";\n\n\n");
sb.append("public class ").append(customClassName.substring(lastIndexOfDot + 1)).append(" extends ").append(from).append(" {\n\n");
sb.append("}\n");
try {
OutputStream stream = URIConverter.INSTANCE.createOutputStream(path);
stream.write(sb.toString().getBytes());
stream.close();
} catch (IOException e) {
throw new WrappedException(e);
}
}
/**
* @since 2.3
*/
protected void updateCache(IURIEditorInput input) throws CoreException {
URIInfo info= (URIInfo) getElementInfo(input);
if (info != null) {
URI emfURI = toEmfUri(input.getURI());
if (emfURI != null) {
boolean readOnly = true;
if (emfURI.isFile() && !emfURI.isArchive()) {
// TODO: Should we use the ResourceSet somehow to obtain the URIConverter for the file protocol?
// see also todo below, but don't run into a stackoverflow ;-)
Map<String, ?> attributes = URIConverter.INSTANCE.getAttributes(emfURI, null);
readOnly = Boolean.TRUE.equals(attributes.get(URIConverter.ATTRIBUTE_READ_ONLY));
}
info.isReadOnly= readOnly;
info.isModifiable= !readOnly;
}
info.updateCache= false;
}
}
private void registerUsedGenModel(final URIConverter converter, final Grammar grammar) {
final URI genModelUri = this.getGenModelUri(grammar);
boolean _exists = converter.exists(genModelUri, null);
if (_exists) {
try {
GenModelHelper _genModelHelper = new GenModelHelper();
XtextResourceSet _xtextResourceSet = new XtextResourceSet();
_genModelHelper.registerGenModel(_xtextResourceSet, genModelUri);
} catch (final Throwable _t) {
if (_t instanceof Exception) {
final Exception e = (Exception)_t;
EMFGeneratorFragment2.LOG.error("Failed to register GenModel", e);
} else {
throw Exceptions.sneakyThrow(_t);
}
}
}
}
/**
* checks whether the given URI can be loaded given the context. I.e. there's a resource set with a corresponding
* resource factory and the physical resource exists.
*/
public static boolean isValidUri(Resource resource, URI uri) {
if (uri == null || uri.isEmpty()) {
return false;
}
URI newURI = getResolvedImportUri(resource, uri);
try {
ResourceSet resourceSet = resource.getResourceSet();
if (resourceSet.getResource(uri, false) != null)
return true;
URIConverter uriConverter = resourceSet.getURIConverter();
URI normalized = uriConverter.normalize(newURI);
if (normalized != null)
// fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=326760
if("platform".equals(normalized.scheme()) && !normalized.isPlatform())
return false;
return uriConverter.exists(normalized, Collections.emptyMap());
} catch (RuntimeException e) { // thrown by org.eclipse.emf.ecore.resource.ResourceSet#getResource(URI, boolean)
log.trace("Cannot load resource: " + newURI, e);
}
return false;
}
/**
* Initializes the {@link Generation#getDefinitions() variable definition} for the given {@link Generation}.
*
* @param gen
* the {@link Generation}
*/
private void initializeVariableDefinition(Generation gen) {
final IQueryEnvironment queryEnvironment = Query.newEnvironment();
try {
final TemplateCustomProperties properties = POIServices.getInstance().getTemplateCustomProperties(
URIConverter.INSTANCE, URI.createURI(gen.getTemplateFileName()).resolve(gen.eResource().getURI()));
((IQueryEnvironment) queryEnvironment).registerEPackage(EcorePackage.eINSTANCE);
((IQueryEnvironment) queryEnvironment).registerCustomClassMapping(
EcorePackage.eINSTANCE.getEStringToStringMapEntry(), EStringToStringMapEntryImpl.class);
properties.configureQueryEnvironmentWithResult((IQueryEnvironment) queryEnvironment);
final ResourceSetImpl defaultResourceSet = new ResourceSetImpl();
defaultResourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*",
new XMIResourceFactoryImpl());
final ResourceSet resourceSetForModel = M2DocUtils.createResourceSetForModels(new ArrayList<Exception>(),
queryEnvironment, defaultResourceSet, GenconfUtils.getOptions(gen));
final List<Definition> newDefinitions = GenconfUtils.getNewDefinitions(gen, properties);
gen.getDefinitions().addAll(newDefinitions);
GenconfUtils.initializeVariableDefinition(gen, queryEnvironment, properties, resourceSetForModel);
M2DocUtils.cleanResourceSetForModels(queryEnvironment, resourceSetForModel);
// CHECKSTYLE:OFF
} catch (Exception e) {
// CHECKSTYLE:ON
// no initialization if it fails no big deal
}
}
/**
* Constructor with enforced image type.
*
* @param uriConverter
* the {@link URIConverter uri converter} to use
* @param uri
* the {@link URI}
* @param type
* the picture {@link PictureType type}
*/
public MImageImpl(URIConverter uriConverter, URI uri, PictureType type) {
this.uriConverter = uriConverter;
this.uri = uri;
this.type = type;
try (InputStream input = getInputStream()) {
final BufferedImage image = ImageIO.read(input);
if (image != null) {
width = image.getWidth();
height = image.getHeight();
conserveRatio = true;
ratio = ((double) width) / ((double) height);
} else {
conserveRatio = false;
ratio = -1;
}
} catch (IOException e) {
// will continue with out ratio and width x height preset
ratio = -1;
}
}
@Override
public Collection<URI> getContainedURIs(String containerHandle) {
if (!HANDLE.equals(containerHandle))
return Collections.emptySet();
if (resourceSet instanceof XtextResourceSet) {
ResourceDescriptionsData descriptionsData = findResourceDescriptionsData(resourceSet);
if (descriptionsData != null) {
return descriptionsData.getAllURIs();
}
return newArrayList(((XtextResourceSet) resourceSet).getNormalizationMap().values());
}
List<URI> uris = Lists.newArrayListWithCapacity(resourceSet.getResources().size());
URIConverter uriConverter = resourceSet.getURIConverter();
for (Resource r : resourceSet.getResources())
uris.add(uriConverter.normalize(r.getURI()));
return uris;
}
@Ignore @Test public void testCanResolveGenmodelURIs() {
String declaringPlugin = "org.eclipse.emf.ecore";
String pointId = "generated_package";
IExtensionPoint point = registry.getExtensionPoint(declaringPlugin + "." + pointId);
IExtension[] extensions = point.getExtensions();
for(IExtension extension: extensions) {
IConfigurationElement[] configurationElements = extension.getConfigurationElements();
for(IConfigurationElement configurationElement: configurationElements) {
String attribute = configurationElement.getAttribute("genModel");
if (attribute != null && attribute.length() != 0) {
String name = extension.getContributor().getName();
String uriAsString = "platform:/plugin/" + name + "/" + attribute;
URI uri = URI.createURI(uriAsString);
boolean exists = URIConverter.INSTANCE.exists(uri, Collections.emptyMap());
if (!exists) {
fail(uriAsString + " does not exist");
}
}
}
}
}
public static String getCompleteContent(XtextResource xr) throws IOException, UnsupportedEncodingException {
XtextResourceSet resourceSet = (XtextResourceSet) xr.getResourceSet();
URIConverter uriConverter = resourceSet.getURIConverter();
URI uri = xr.getURI();
String encoding = xr.getEncoding();
InputStream inputStream = null;
try {
inputStream = uriConverter.createInputStream(uri);
return getCompleteContent(encoding, inputStream);
} finally {
tryClose(inputStream, null);
}
}
/**
* Configure the resourceSet such that it understands the n4js scheme. Use the injected classLoader to lookup
* resources.
*/
public void registerScheme(ResourceSet builtInSchemeResourceSet) {
// tell EMF to resolve a classpath URI which actually has not been a classpath URI (but a SCHEME/n4js
// URI):
URIConverter converter = builtInSchemeResourceSet.getURIConverter();
if (registerScheme(converter, classLoader)) {
ExecutionEnvironmentDescriptor descriptor = new ExecutionEnvironmentDescriptor(builtInSchemeResourceSet);
register(builtInSchemeResourceSet, descriptor);
}
}
private boolean registerScheme(URIConverter converter, @SuppressWarnings("hiding") ClassLoader classLoader) {
URIHandler uriHandler = converter.getURIHandlers().get(0);
if (uriHandler instanceof MyURIHandler || uriHandler.canHandle(SAMPLE_URI)) {
return false;
}
converter.getURIHandlers().add(0, createURIHandler(classLoader, converter));
return true;
}
protected boolean isFile(final URI uri) {
boolean _xblockexpression = false;
{
final Object directory = this.getAttribute(uri, URIConverter.ATTRIBUTE_DIRECTORY);
boolean _xifexpression = false;
if ((directory instanceof Boolean)) {
_xifexpression = (!((Boolean) directory).booleanValue());
} else {
_xifexpression = false;
}
_xblockexpression = _xifexpression;
}
return _xblockexpression;
}
/**
* @return the eobject's URI in the normalized form or as is if it is a platform:/resource URI.
* @since 2.4
*/
public static URI getPlatformResourceOrNormalizedURI(EObject eObject) {
URI rawURI = EcoreUtil.getURI(eObject);
if (rawURI.isPlatformResource()) {
return rawURI;
}
Resource resource = eObject.eResource();
if(resource != null && resource.getResourceSet() != null) {
return resource.getResourceSet().getURIConverter().normalize(rawURI);
} else {
return URIConverter.INSTANCE.normalize(rawURI);
}
}
/**
* @return the resources uri in the normalized form or as is if it is a platform:/resource URI.
* @since 2.4
*/
public static URI getPlatformResourceOrNormalizedURI(Resource resource) {
URI rawURI = resource.getURI();
if (rawURI.isPlatformResource()) {
return rawURI;
}
if(resource.getResourceSet() != null) {
return resource.getResourceSet().getURIConverter().normalize(rawURI);
} else {
return URIConverter.INSTANCE.normalize(rawURI);
}
}
@Override
public InputStream getContents() throws CoreException {
URIHandler handler = schemeHelper.createURIHandler(URIConverter.INSTANCE);
try {
return handler.createInputStream(getURI(), Collections.emptyMap());
} catch (IOException e) {
throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.n4js.ts.ui", "Cannot load "
+ getFullPath(), e));
}
}
@Override
public InputStream getContents() throws CoreException {
try {
return URIConverter.INSTANCE.createInputStream(uri);
} catch (IOException e) {
throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.n4js.ts.ui", "Cannot load "
+ getFullPath(), e));
}
}
private void registerUsedGenModel(URIConverter converter) {
if (genModel == null)
return;
URI genModelUri = URI.createURI(genModel);
genModelUri = toPlatformResourceURI(genModelUri);
if (converter.exists(genModelUri, null)) {
try {
new GenModelHelper().registerGenModel(new XtextResourceSet(), genModelUri);
} catch (ConfigurationException ce) {
throw ce;
} catch (Exception e) {
log.error(e, e);
}
}
}
/**
* {@inheritDoc}
*
* Also registers an URI converter that can resolve resource URIs that point
* to nested types to their outermost declarator.
*/
@Override
protected void registerProtocol(ResourceSet resourceSet) {
super.registerProtocol(resourceSet);
final URIConverter existing = resourceSet.getURIConverter();
resourceSet.setURIConverter(new JavaURIConverter(existing));
}
/**
* Ensure that the validation generation produces a document with an info.
*
* @throws InvalidFormatException
* @throws IOException
* @throws DocumentParserException
* @throws DocumentGenerationException
*/
@Test
public void testInfoGeneration()
throws InvalidFormatException, IOException, DocumentParserException, DocumentGenerationException {
IQueryEnvironment queryEnvironment = org.eclipse.acceleo.query.runtime.Query
.newEnvironmentWithDefaultServices(null);
final File tempFile = File.createTempFile("testParsingErrorSimpleTag", ".docx");
try (DocumentTemplate documentTemplate = M2DocUtils.parse(URIConverter.INSTANCE,
URI.createFileURI("resources/document/notEmpty/notEmpty-template.docx"), queryEnvironment,
new ClassProvider(this.getClass().getClassLoader()), new BasicMonitor())) {
final XWPFRun location = ((XWPFParagraph) documentTemplate.getDocument().getBodyElements().get(0)).getRuns()
.get(0);
documentTemplate.getBody().getValidationMessages().add(
new TemplateValidationMessage(ValidationMessageLevel.INFO, "XXXXXXXXXXXXXXXXXXXXXXXX", location));
M2DocUtils.serializeValidatedDocumentTemplate(URIConverter.INSTANCE, documentTemplate,
URI.createFileURI(tempFile.getAbsolutePath()));
}
assertTrue(new File(tempFile.getAbsolutePath()).exists());
try (FileInputStream resIs = new FileInputStream(tempFile.getAbsolutePath());
OPCPackage resOPackage = OPCPackage.open(resIs);
XWPFDocument resDocument = new XWPFDocument(resOPackage);) {
final XWPFRun messageRun = M2DocTestUtils.getRunContaining(resDocument, "XXXXXXXXXXXXXXXXXXXXXXXX");
assertNotNull(messageRun);
assertEquals("XXXXXXXXXXXXXXXXXXXXXXXX", messageRun.text());
assertEquals("0000FF", messageRun.getColor());
}
tempFile.delete();
}
@Override
protected synchronized URIConverter getURIConverter() {
if (this.uriConverter == null) {
List<ContentHandler> withoutPlatformDelegate = Lists.newArrayList();
for (ContentHandler contentHandler : ContentHandler.Registry.INSTANCE.contentHandlers()) {
if (!isTooEager(contentHandler))
withoutPlatformDelegate.add(contentHandler);
}
this.uriConverter = new ExtensibleURIConverterImpl(URIHandler.DEFAULT_HANDLERS, withoutPlatformDelegate);
}
return this.uriConverter;
}
private void setUpExampleBibtex() throws Exception {
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
"bib", new BibtexResourceFactoryImpl());
final String bib = "@INPROCEEDINGS{Test01, classes = {test}}";
resourceSet = new ResourceSetImpl();
resource = resourceSet.createResource(URI.createURI("test.bib"));
resource.load(new URIConverter.ReadableInputStream(bib, "UTF-8"), Collections.EMPTY_MAP);
}
/**
* Test With No Exist Last Destination File.
*
* @throws IOException
* IOException
* @throws DocumentParserException
* DocumentParserException
*/
@Test
public void testWithNoExistLastDestinationFile() throws IOException, DocumentParserException {
UserContentManager userContentManager = new UserContentManager(URIConverter.INSTANCE, null,
URI.createFileURI("no_exist_file_path"));
assertNull(userContentManager.consumeUserContent("noExistid1"));
}
/**
* Test With Last Destination File Contain No UserContent.
*
* @throws IOException
* IOException
* @throws DocumentParserException
* DocumentParserException
*/
@Test
public void testLastDestinationFileContainNoUserContent() throws IOException, DocumentParserException {
UserContentManager userContentManager = new UserContentManager(URIConverter.INSTANCE, null,
URI.createFileURI("userContent/testUserContent2.docx"));
// CHECKSTYLE:OFF
assertNull(userContentManager.consumeUserContent("noExistid2"));
// CHECKSTYLE:ON
userContentManager.dispose();
}