You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2010/12/10 14:00:20 UTC
svn commit: r1044335 - in /incubator/deltacloud/trunk/server:
lib/deltacloud/helpers/ views/errors/
Author: mfojtik
Date: Fri Dec 10 13:00:20 2010
New Revision: 1044335
URL: http://svn.apache.org/viewvc?rev=1044335&view=rev
Log:
Wrap error messages and details in CDATA
The xml parser used by nokogiri-java (xerces) is much more strict about
unescaped entities, and causes nokogiri to ignore nodes containing them.
Wrapping the content in CDATA blocks fixes this.
Note: this fix does not use the haml :cdata filter, since you cannot
strip whitespace inside the filter.
Modified:
incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb
incubator/deltacloud/trunk/server/views/errors/auth_exception.xml.haml
incubator/deltacloud/trunk/server/views/errors/backend_capability_failure.xml.haml
incubator/deltacloud/trunk/server/views/errors/backend_error.xml.haml
incubator/deltacloud/trunk/server/views/errors/validation_failure.xml.haml
Modified: incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb?rev=1044335&r1=1044334&r2=1044335&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb Fri Dec 10 13:00:20 2010
@@ -121,8 +121,8 @@ module ApplicationHelper
end
end
- def cdata(&block)
- text = capture_haml(&block)
+ def cdata(text = nil, &block)
+ text ||= capture_haml(&block)
"<![CDATA[#{text.strip}]]>"
end
Modified: incubator/deltacloud/trunk/server/views/errors/auth_exception.xml.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/errors/auth_exception.xml.haml?rev=1044335&r1=1044334&r2=1044335&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/errors/auth_exception.xml.haml (original)
+++ incubator/deltacloud/trunk/server/views/errors/auth_exception.xml.haml Fri Dec 10 13:00:20 2010
@@ -1,2 +1,3 @@
%error{:url => "#{request.env['REQUEST_URI']}", :status => "#{response.status}"}
- %message #{@error.message}
+ %message< #{cdata @error.message}
+
Modified: incubator/deltacloud/trunk/server/views/errors/backend_capability_failure.xml.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/errors/backend_capability_failure.xml.haml?rev=1044335&r1=1044334&r2=1044335&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/errors/backend_capability_failure.xml.haml (original)
+++ incubator/deltacloud/trunk/server/views/errors/backend_capability_failure.xml.haml Fri Dec 10 13:00:20 2010
@@ -1,4 +1,5 @@
%error{:url => "#{request.env['REQUEST_URI']}", :status => "#{response.status}"}
%capability #{@error.capability}
- %message #{@error.message}
+ %message< #{cdata @error.message}
+
Modified: incubator/deltacloud/trunk/server/views/errors/backend_error.xml.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/errors/backend_error.xml.haml?rev=1044335&r1=1044334&r2=1044335&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/errors/backend_error.xml.haml (original)
+++ incubator/deltacloud/trunk/server/views/errors/backend_error.xml.haml Fri Dec 10 13:00:20 2010
@@ -4,5 +4,5 @@
%code= @error.code
%cause= @error.cause
- if @error.details
- %details #{@error.details}
- %message #{@error.message}
+ %details< #{cdata @error.details.join("\n")}
+ %message< #{cdata @error.message}
Modified: incubator/deltacloud/trunk/server/views/errors/validation_failure.xml.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/errors/validation_failure.xml.haml?rev=1044335&r1=1044334&r2=1044335&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/errors/validation_failure.xml.haml (original)
+++ incubator/deltacloud/trunk/server/views/errors/validation_failure.xml.haml Fri Dec 10 13:00:20 2010
@@ -1,7 +1,8 @@
%error{:url => "#{request.env['REQUEST_URI']}", :status => "#{response.status}"}
%parameter #{@error.name}
- %message #{@error.message}
+ %message< #{cdata @error.message}
- unless @error.param.options.empty?
%valid_options
- @error.param.options.each do |v|
- %value #{v}
+ %value< #{cdata v}
+