summaryrefslogtreecommitdiff
path: root/platform/lang-api/src/com/intellij/facet
diff options
context:
space:
mode:
Diffstat (limited to 'platform/lang-api/src/com/intellij/facet')
-rw-r--r--platform/lang-api/src/com/intellij/facet/frameworks/SettingsConnectionService.java27
-rw-r--r--platform/lang-api/src/com/intellij/facet/ui/FacetEditorValidator.java6
2 files changed, 21 insertions, 12 deletions
diff --git a/platform/lang-api/src/com/intellij/facet/frameworks/SettingsConnectionService.java b/platform/lang-api/src/com/intellij/facet/frameworks/SettingsConnectionService.java
index e896c9f14246..cb3518834423 100644
--- a/platform/lang-api/src/com/intellij/facet/frameworks/SettingsConnectionService.java
+++ b/platform/lang-api/src/com/intellij/facet/frameworks/SettingsConnectionService.java
@@ -17,10 +17,12 @@ package com.intellij.facet.frameworks;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.JDOMUtil;
+import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.util.containers.hash.HashMap;
+import com.intellij.util.containers.ContainerUtil;
import org.jdom.Document;
import org.jdom.Element;
+import org.jdom.JDOMException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -65,18 +67,23 @@ public abstract class SettingsConnectionService {
@Nullable
private Map<String, String> readSettings(String... attributes) {
- Map<String, String> settings = new HashMap<String, String>();
+ Map<String, String> settings = ContainerUtil.newLinkedHashMap();
try {
- final URL url = new URL(getSettingsUrl());
- final InputStream is = getStream(url);
- final Document document = JDOMUtil.loadDocument(is);
- final Element root = document.getRootElement();
- for (String s : attributes) {
- final String attributeValue = root.getAttributeValue(s);
- if (StringUtil.isNotEmpty(attributeValue)) {
- settings.put(s, attributeValue);
+ URL url = new URL(getSettingsUrl());
+ String text = FileUtil.loadTextAndClose(getStream(url));
+ try {
+ Document document = JDOMUtil.loadDocument(text);
+ Element root = document.getRootElement();
+ for (String s : attributes) {
+ String attributeValue = root.getAttributeValue(s);
+ if (StringUtil.isNotEmpty(attributeValue)) {
+ settings.put(s, attributeValue);
+ }
}
}
+ catch (JDOMException e) {
+ LOG.error("", e, text);
+ }
}
catch (MalformedURLException e) {
LOG.error(e);
diff --git a/platform/lang-api/src/com/intellij/facet/ui/FacetEditorValidator.java b/platform/lang-api/src/com/intellij/facet/ui/FacetEditorValidator.java
index f3a6d087da35..c04efa50ba33 100644
--- a/platform/lang-api/src/com/intellij/facet/ui/FacetEditorValidator.java
+++ b/platform/lang-api/src/com/intellij/facet/ui/FacetEditorValidator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,12 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package com.intellij.facet.ui;
+import org.jetbrains.annotations.NotNull;
+
/**
* @author nik
*/
public abstract class FacetEditorValidator {
+ @NotNull
public abstract ValidationResult check();
}