Maurits Rijk
Maurits Rijk

Reputation: 9985

ClassCastException when passing a HashMap to a Java function

I want to call a Java function (provided by SVNKit) with the following signature:

public abstract long getFile(String path,
                             long revision,
                             Map properties,
                             OutputStream contents)
                      throws SVNException

The parameters properties and contents are optional. In Clojure I call this function with:

(defn read-file
  ""
  [repository path]
  (let [properties (java.util.HashMap.)
        baos (java.io.ByteArrayOutputStream.)]
    (.getFile repository path -1 properties baos)
    (.size baos)))

I get a ClassCastException on the properties parameter. When I leave it out (use nil instead of properties) it works fine. The ClassCastException doesn't give any information about what class it is expecting.

Any ideas?

Upvotes: 2

Views: 377

Answers (1)

Eric Rosenberg
Eric Rosenberg

Reputation: 1533

According to the SVNKit javadoc at http://svnkit.com/javadoc/index-all.html

there is not a method with the signature you listed. The closest seems to be:

public abstract long getFile(String path,
                             long revision,
                             SVNProperties properties,
                             OutputStream contents)
                      throws SVNException

from http://svnkit.com/javadoc/org/tmatesoft/svn/core/io/SVNRepository.html

Upvotes: 2

Related Questions