Skip to content
Browse files

Merge pull request #26 from shenfeng/master

get rid of reflection warning
  • Loading branch information...
2 parents 5feb755 + dd0112c commit 074afb7e0dc513e07f33502b0e2007335d3390b1 @weavejester weavejester committed Aug 14, 2011
2 ring-core/src/ring/middleware/file.clj
@@ -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
@@ -13,7 +13,7 @@
(or (ext-mime-type (.getPath file) mime-types)
-(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
@@ -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
@@ -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
@@ -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))]

0 comments on commit 074afb7

Please sign in to comment.
Something went wrong with that request. Please try again.