From f5b23c2571e7bf275aeb4d7480d23001b13cea51 Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Fri, 29 Mar 2013 12:11:43 +0100 Subject: [PATCH] Added assertion to WSF_UPLOADED_FILE --- .../wsf/src/request/value/wsf_uploaded_file.e | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/library/server/wsf/src/request/value/wsf_uploaded_file.e b/library/server/wsf/src/request/value/wsf_uploaded_file.e index dd107571..1371b45a 100644 --- a/library/server/wsf/src/request/value/wsf_uploaded_file.e +++ b/library/server/wsf/src/request/value/wsf_uploaded_file.e @@ -173,7 +173,9 @@ feature -- Basic operation move_to (a_destination: STRING): BOOLEAN -- Move current uploaded file to `a_destination' + --| Violates CQS principle. require + a_destination_not_empty: not a_destination.is_empty has_no_error: not has_error local f: RAW_FILE @@ -182,9 +184,12 @@ feature -- Basic operation create f.make (n) if f.exists then f.change_name (a_destination) + set_tmp_name (f.name) Result := True end end + ensure + exists: old exists implies exists end feature -- Status @@ -199,6 +204,16 @@ feature -- Status -- Eventual error code --| no error => 0 + exists: BOOLEAN + local + f: PLAIN_TEXT_FILE + do + if attached tmp_name as n then + create f.make (n) + Result := f.exists + end + end + feature -- Element change set_error (e: like error) @@ -220,7 +235,7 @@ feature -- Element change end note - copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others" + copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software