Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

get rid of reflection warning

  • Loading branch information...
commit dd0112ccf9ca116b24df0aa57e43710a698ed0ad 1 parent 6198239
feng authored
2  ring-core/src/ring/middleware/file.clj
View
@@ -24,6 +24,6 @@
(fn [req]
(if-not (= :get (:request-method req))
(app req)
- (let [path (.substring (codec/url-decode (:uri req)) 1)]
+ (let [path (.substring ^String (codec/url-decode (:uri req)) 1)]
(or (response/file-response path opts)
(app req)))))))
2  ring-core/src/ring/middleware/file_info.clj
View
@@ -13,7 +13,7 @@
(or (ext-mime-type (.getPath file) mime-types)
"application/octet-stream"))
-(defn make-http-format
+(defn ^SimpleDateFormat make-http-format
"Formats or parses dates into HTTP date format (RFC 822/1123)."
[]
;; SimpleDateFormat is not threadsafe, so return a new instance each time
3  ring-core/src/ring/middleware/multipart_params.clj
View
@@ -51,7 +51,8 @@
"Parse a map of multipart parameters from the request."
[request encoding store]
(into {}
- (for [item (file-item-seq (request-context request encoding))]
+ (for [^FileItemStream item (file-item-seq
+ (request-context request encoding))]
[(.getFieldName item)
(parse-file-item item store)])))
6 ring-core/src/ring/middleware/multipart_params/temp_file.clj
View
@@ -9,18 +9,18 @@
(try ~@body
(catch Exception ex#)))))
-(defn- expired? [file expiry-time]
+(defn- expired? [^File file expiry-time]
(< (.lastModified file)
(- (System/currentTimeMillis)
(* expiry-time 1000))))
(defn- remove-old-files [file-set expiry-time]
- (doseq [file @file-set]
+ (doseq [^File file @file-set]
(when (expired? file expiry-time)
(.delete file)
(swap! file-set disj file))))
-(defn- make-temp-file [file-set]
+(defn- ^File make-temp-file [file-set]
(let [temp-file (File/createTempFile "ring-multipart-" nil)]
(swap! file-set conj temp-file)
(.deleteOnExit temp-file)
2  ring-core/src/ring/util/response.clj
View
@@ -43,7 +43,7 @@
"Safely retrieve the correct file. See file-response for an
explanation of options."
[^String path opts]
- (if-let [file (if-let [^String root (:root opts)]
+ (if-let [^File file (if-let [^String root (:root opts)]
(and (safe-path? root path) (File. root path))
(File. path))]
(cond
Please sign in to comment.
Something went wrong with that request. Please try again.