diff options
author | Raphael <raphael@google.com> | 2011-10-13 20:57:05 -0700 |
---|---|---|
committer | Raphael <raphael@google.com> | 2011-10-13 20:58:19 -0700 |
commit | 9d38047fb0c217cc3ee5ef01edf920ae642edb9a (patch) | |
tree | f93b43d224555ccdb9f09b403647c716f137f133 /sdkmanager/libs/sdklib | |
parent | d0babf526623d775506553f28972d05064856960 (diff) | |
download | sdk-9d38047fb0c217cc3ee5ef01edf920ae642edb9a.zip sdk-9d38047fb0c217cc3ee5ef01edf920ae642edb9a.tar.gz sdk-9d38047fb0c217cc3ee5ef01edf920ae642edb9a.tar.bz2 |
SDK Manager: don't output XML parse errors to stderr
This is exactly like change I6f82b040 except now we
remove the stderr output when parsing the addons_list.xml
To put this in context, end-users should not see any
xml parsing error. In this case we get one because the
file doesn't exist on the test server and the web server
returns an HTML page describing the error, which naturally
fails to validate against our XSD. But since the point of
the method is just to validate, errors are irrelevant.
Change-Id: I80b2c7600d1ceffa870ac3d71ef0c0f6ef9f809c
Diffstat (limited to 'sdkmanager/libs/sdklib')
-rwxr-xr-x | sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonsListFetcher.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonsListFetcher.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonsListFetcher.java index cb8602f..c83a3c1 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonsListFetcher.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonsListFetcher.java @@ -23,6 +23,7 @@ import com.android.sdklib.repository.SdkAddonsListConstants; import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
+import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
@@ -255,6 +256,20 @@ public class AddonsListFetcher { // Parse the old document using a non namespace aware builder
factory.setNamespaceAware(false);
DocumentBuilder builder = factory.newDocumentBuilder();
+
+ // We don't want the default handler which prints errors to stderr.
+ builder.setErrorHandler(new ErrorHandler() {
+ public void warning(SAXParseException e) throws SAXException {
+ // pass
+ }
+ public void fatalError(SAXParseException e) throws SAXException {
+ throw e;
+ }
+ public void error(SAXParseException e) throws SAXException {
+ throw e;
+ }
+ });
+
doc = builder.parse(xml);
// Prepare a new document using a namespace aware builder
|