aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonsListFetcher.java3
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SdkStats.java27
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/sources/SdkSource.java3
3 files changed, 22 insertions, 11 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 55021a3..328204c 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
@@ -267,7 +267,8 @@ public class AddonsListFetcher {
InputStream xml = cache.openCachedUrl(urlString, monitor);
if (xml != null) {
xml.mark(500000);
- xml = new NonClosingInputStream(xml).setCloseBehavior(CloseBehavior.RESET);
+ xml = new NonClosingInputStream(xml);
+ ((NonClosingInputStream) xml).setCloseBehavior(CloseBehavior.RESET);
}
return xml;
} catch (Exception e) {
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SdkStats.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SdkStats.java
index 60bb89d..83c9c3a 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SdkStats.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SdkStats.java
@@ -252,7 +252,8 @@ public class SdkStats {
InputStream xml = cache.openCachedUrl(urlString, monitor);
if (xml != null) {
xml.mark(500000);
- xml = new NonClosingInputStream(xml).setCloseBehavior(CloseBehavior.RESET);
+ xml = new NonClosingInputStream(xml);
+ ((NonClosingInputStream) xml).setCloseBehavior(CloseBehavior.RESET);
}
return xml;
} catch (Exception e) {
@@ -446,18 +447,26 @@ public class SdkStats {
*/
private Validator getValidator(int version) throws SAXException {
InputStream xsdStream = SdkStatsConstants.getXsdStream(version);
- SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ try {
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- if (factory == null) {
- return null;
- }
+ if (factory == null) {
+ return null;
+ }
- // This may throw a SAX Exception if the schema itself is not a valid XSD
- Schema schema = factory.newSchema(new StreamSource(xsdStream));
+ // This may throw a SAX Exception if the schema itself is not a valid XSD
+ Schema schema = factory.newSchema(new StreamSource(xsdStream));
- Validator validator = schema == null ? null : schema.newValidator();
+ Validator validator = schema == null ? null : schema.newValidator();
- return validator;
+ return validator;
+ } finally {
+ if (xsdStream != null) {
+ try {
+ xsdStream.close();
+ } catch (IOException ignore) {}
+ }
+ }
}
/**
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/sources/SdkSource.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/sources/SdkSource.java
index a0d515a..ee3b0af 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/sources/SdkSource.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/sources/SdkSource.java
@@ -631,7 +631,8 @@ public abstract class SdkSource implements IDescription, Comparable<SdkSource> {
InputStream xml = cache.openCachedUrl(urlString, monitor);
if (xml != null) {
xml.mark(500000);
- xml = new NonClosingInputStream(xml).setCloseBehavior(CloseBehavior.RESET);
+ xml = new NonClosingInputStream(xml);
+ ((NonClosingInputStream) xml).setCloseBehavior(CloseBehavior.RESET);
}
return xml;
} catch (Exception e) {