use of org.jdom.JDOMException in project voldemort by voldemort.
the class StoreDefinitionsMapper method readStoreList.
public List<StoreDefinition> readStoreList(Reader input, boolean verifySchema) {
try {
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(input);
if (verifySchema) {
Validator validator = schema.newValidator();
validator.validate(new JDOMSource(doc));
}
Element root = doc.getRootElement();
if (!root.getName().equals(STORES_ELMT))
throw new MappingException("Invalid root element: " + doc.getRootElement().getName());
List<StoreDefinition> stores = new ArrayList<StoreDefinition>();
for (Object store : root.getChildren(STORE_ELMT)) stores.add(readStore((Element) store));
for (Object view : root.getChildren(VIEW_ELMT)) stores.add(readView((Element) view, stores));
return stores;
} catch (JDOMException e) {
throw new MappingException(e);
} catch (SAXException e) {
throw new MappingException(e);
} catch (IOException e) {
throw new MappingException(e);
}
}
use of org.jdom.JDOMException in project android by JetBrains.
the class ExternalRepository method doRefreshFor.
private void doRefreshFor(@NotNull final String groupId, @NotNull final String artifactId) {
String url = String.format(URL_TEMPLATE, groupId.replaceAll("\\.", "/"), artifactId);
Document document;
try {
document = JDOMUtil.loadDocument(URI.create(url).toURL());
} catch (JDOMException e) {
LOG.warn(String.format("Unexpected exception occurred on attempt to parse document from %s (checking the latest version " + "for artifact '%s:%s')", url, groupId, artifactId));
return;
} catch (IOException e) {
LOG.warn(String.format("Unexpected I/O exception occurred on attempt to check the latest version for artifact '%s:%s' at " + "external repository (url %s)", groupId, artifactId, url));
return;
}
Element versioning = document.getRootElement().getChild(MAVEN_METADATA_VERSIONING);
if (versioning == null) {
LOG.warn(String.format("Can't check the latest version for artifact '%s:%s'. Reason: artifact metadata info downloaded from " + "%s has unknown format - expected to find a <%s> element under a root element but it's not there", groupId, artifactId, url, MAVEN_METADATA_VERSIONING));
return;
}
Element latest = versioning.getChild(MAVEN_METADATA_LATEST);
if (latest == null) {
LOG.warn(String.format("Can't check the latest version for artifact '%s:%s'. Reason: artifact metadata info downloaded from " + "%s has unknown format - expected to find a <%s> element under a <%s> element but it's not there", groupId, artifactId, url, MAVEN_METADATA_LATEST, MAVEN_METADATA_VERSIONING));
return;
}
try {
GradleVersion version = GradleVersion.parse(latest.getText());
myLatestVersionCache.put(Pair.create(groupId, artifactId), version);
} catch (NumberFormatException e) {
LOG.warn(String.format("Can't check the latest version for artifact '%s:%s'. Reason: artifact metadata info downloaded from " + "%s has unknown version format - '%s'", groupId, artifactId, url, latest.getText()));
}
}
use of org.jdom.JDOMException in project intellij-plugins by JetBrains.
the class FlexmojosSdkAdditionalData method setupFlexCompilerClasspath.
void setupFlexCompilerClasspath(final VirtualFile compilerPomFile, final String repositoryRootPath) {
myFlexCompilerClasspath.clear();
try {
final Element rootElement = JDOMUtil.load(compilerPomFile.getInputStream());
if (!rootElement.getName().equals("project"))
return;
for (final Object dependenciesElement : rootElement.getChildren("dependencies", rootElement.getNamespace())) {
for (final Object dependencyElement : ((Element) dependenciesElement).getChildren("dependency", rootElement.getNamespace())) {
final String groupId = ((Element) dependencyElement).getChildText("groupId", rootElement.getNamespace());
final String artifactId = ((Element) dependencyElement).getChildText("artifactId", rootElement.getNamespace());
final String version = ((Element) dependencyElement).getChildText("version", rootElement.getNamespace());
addClasspathEntry(repositoryRootPath, groupId, artifactId, version);
}
}
} catch (IOException ignored) {
/*ignore*/
} catch (JDOMException ignored) {
/*ignore*/
}
}
use of org.jdom.JDOMException in project android by JetBrains.
the class ImportModuleTask method perform.
@Override
public Exception perform() {
final Module[] moduleWrapper = { null };
final Exception exception = ApplicationManager.getApplication().runWriteAction(new Computable<Exception>() {
@Override
public Exception compute() {
try {
moduleWrapper[0] = ModuleManager.getInstance(myProject).loadModule(myModuleFilePath);
} catch (InvalidDataException e) {
return e;
} catch (IOException e) {
return e;
} catch (JDOMException e) {
return e;
} catch (ModuleWithNameAlreadyExists e) {
return e;
}
return null;
}
});
if (exception != null) {
return exception;
}
assert moduleWrapper[0] != null;
if (AndroidFacet.getInstance(moduleWrapper[0]) == null) {
AndroidUtils.addAndroidFacetInWriteAction(moduleWrapper[0], myContentRoot, true);
}
AndroidSdkUtils.setupAndroidPlatformIfNecessary(moduleWrapper[0], false);
setDepModule(moduleWrapper[0]);
return null;
}
use of org.jdom.JDOMException in project intellij-plugins by JetBrains.
the class JabberFacadeImpl method getServers.
public String[] getServers() {
SAXBuilder saxBuilder = new SAXBuilder();
try {
Document document = saxBuilder.build(getClass().getResource("servers.xml"));
Element rootElement = document.getRootElement();
List children = rootElement.getChildren("item", rootElement.getNamespace());
List<String> result = new ArrayList<>();
for (Object aChildren : children) {
Element element = (Element) aChildren;
result.add(element.getAttributeValue("jid"));
}
return ArrayUtil.toStringArray(result);
} catch (JDOMException e) {
LOG.error(e.getMessage(), e);
} catch (IOException e) {
LOG.error(e.getMessage(), e);
}
return new String[] { "jabber.org" };
}
Aggregations