title: Webdav with jackrabbit lib on android
body: <p>I implement webdav with Jackrabbit lib.<br>
  And I use below code to scan all files on folder with webdav:  </p>
  
  <pre><code>public void ListWebDav() {
      String FullPath = Webdav Path;
      try {
          DavMethod davMethod = new PropFindMethod(FullPath, DavConstants.PROPFIND_ALL_PROP, DavConstants.DEPTH_1);
          WebDavClient.executeMethod(davMethod);
  
          MultiStatus multiStatus = davMethod.getResponseBodyAsMultiStatus();
          MultiStatusResponse[] responses = multiStatus.getResponses();
          MultiStatusResponse currResponse;
  
          for(int i = 0; i &lt; responses.length; i++) {
              currResponse = responses[i];
              if(getContentType(currResponse) != null) {
                  if(((String)getContentType(currResponse)).contains("directory")) {  //Folder
                      System.out.println("Folder " + URLDecoder.decode(currResponse.getHref()));
                  }
                  else {  //File
                      System.out.println("File " + URLDecoder.decode(currResponse.getHref()));
                  }
              }
              else {
                  System.out.println(URLDecoder.decode(currResponse.getHref()));
              }
          }
      }
      catch(Exception e) {
          e.printStackTrace();
      }
  }
  
  public Object getContentType(MultiStatusResponse msr) {
      try {
          Status[] statusa = msr.getStatus();
          Status status = statusa[0];
  
          int n = status.getStatusCode();
          DavPropertySet propSet = msr.getProperties(n);
          DavProperty davProp = propSet.get(DavPropertyName.PROPERTY_GETCONTENTTYPE);
          return davProp.getValue();
      }
      catch(Exception e) {
          return null;
      }
  }
  </code></pre>
  
  <p>The getContentType function is to judge is folder or file.<br>
  I run the ListWebDav method first time is works normal.<br>
  But if run the second times.<br>
  It will crash with below error code on line <code>Status[] statusa = msr.getStatus();</code>:  </p>
  
  <pre><code>11-27 10:08:29.331: E/StrictMode(26469): A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
  11-27 10:08:29.331: E/StrictMode(26469): java.lang.Throwable: Explicit termination method 'end' not called
  11-27 10:08:29.331: E/StrictMode(26469):    at dalvik.system.CloseGuard.open(CloseGuard.java:184)
  11-27 10:08:29.331: E/StrictMode(26469):    at java.util.zip.Inflater.&lt;init&gt;(Inflater.java:82)
  11-27 10:08:29.331: E/StrictMode(26469):    at java.util.zip.ZipFile.getInputStream(ZipFile.java:310)
  11-27 10:08:29.331: E/StrictMode(26469):    at java.util.jar.JarFile.getInputStream(JarFile.java:389)
  11-27 10:08:29.331: E/StrictMode(26469):    at libcore.net.url.JarURLConnectionImpl.getInputStream(JarURLConnectionImpl.java:222)
  11-27 10:08:29.331: E/StrictMode(26469):    at java.net.URL.openStream(URL.java:470)
  11-27 10:08:29.331: E/StrictMode(26469):    at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:432)
  11-27 10:08:29.331: E/StrictMode(26469):    at java.lang.Class.getResourceAsStream(Class.java:1037)
  11-27 10:08:29.331: E/StrictMode(26469):    at org.apache.jackrabbit.webdav.DavException.&lt;clinit&gt;(DavException.java:41)
  11-27 10:08:29.331: E/StrictMode(26469):    at org.apache.jackrabbit.webdav.Status.&lt;init&gt;(Status.java:42)
  11-27 10:08:29.331: E/StrictMode(26469):    at org.apache.jackrabbit.webdav.MultiStatusResponse.getStatus(MultiStatusResponse.java:253)
  11-27 10:08:29.331: E/StrictMode(26469):    at com.wd.wifi.cable.GlobalData.getContentType(GlobalData.java:313)
  11-27 10:08:29.331: E/StrictMode(26469):    at com.wd.wifi.cable.GlobalData.ListWebDav(GlobalData.java:277)
  11-27 10:08:29.331: E/StrictMode(26469):    at com.wd.wifi.cable.GlobalData.ConnectWebDav(GlobalData.java:258)
  11-27 10:08:29.331: E/StrictMode(26469):    at com.wd.wifi.cable.HDDDevicesListViewFragment$3.onItemClick(HDDDevicesListViewFragment.java:81)
  11-27 10:08:29.331: E/StrictMode(26469):    at android.widget.AdapterView.performItemClick(AdapterView.java:299)
  11-27 10:08:29.331: E/StrictMode(26469):    at android.widget.AbsListView.performItemClick(AbsListView.java:1113)
  11-27 10:08:29.331: E/StrictMode(26469):    at android.widget.AbsListView$PerformClick.run(AbsListView.java:2904)
  11-27 10:08:29.331: E/StrictMode(26469):    at android.widget.AbsListView$3.run(AbsListView.java:3638)
  11-27 10:08:29.331: E/StrictMode(26469):    at android.os.Handler.handleCallback(Handler.java:733)
  11-27 10:08:29.331: E/StrictMode(26469):    at android.os.Handler.dispatchMessage(Handler.java:95)
  11-27 10:08:29.331: E/StrictMode(26469):    at android.os.Looper.loop(Looper.java:137)
  11-27 10:08:29.331: E/StrictMode(26469):    at android.app.ActivityThread.main(ActivityThread.java:4998)
  11-27 10:08:29.331: E/StrictMode(26469):    at java.lang.reflect.Method.invokeNative(Native Method)
  11-27 10:08:29.331: E/StrictMode(26469):    at java.lang.reflect.Method.invoke(Method.java:515)
  11-27 10:08:29.331: E/StrictMode(26469):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
  11-27 10:08:29.331: E/StrictMode(26469):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
  11-27 10:08:29.331: E/StrictMode(26469):    at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>How can I fix it?  </p>