aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabrice Bellingard <bellingard@gmail.com>2012-04-02 17:48:04 +0200
committerFabrice Bellingard <bellingard@gmail.com>2012-04-02 17:49:02 +0200
commit92cc81884284a49758f8778d1a8b812352c9ed18 (patch)
treee9c0c16696136bb0a60e8bfc3895b3f6e648b778
parentae82c4624b4beea7efe47810351e8955e4631c9b (diff)
downloadsonarqube-92cc81884284a49758f8778d1a8b812352c9ed18.tar.gz
sonarqube-92cc81884284a49758f8778d1a8b812352c9ed18.zip
SONAR-3361 Error : undefined method `source' for nil:NilClass
-rw-r--r--plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties9
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb34
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/resource_deleted.html.erb1
3 files changed, 31 insertions, 13 deletions
diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties
index 47692382715..da03b7db22e 100644
--- a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties
+++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties
@@ -783,6 +783,15 @@ violations_drilldown.no_violations=No violations
#------------------------------------------------------------------------------
#
+# RESOURCE VIEWER
+#
+#------------------------------------------------------------------------------
+
+resource_viewer.resource_deleted=This resource has been deleted.
+
+
+#------------------------------------------------------------------------------
+#
# VIOLATIONS VIEWER
#
#------------------------------------------------------------------------------
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb
index 631ca73e1a2..6ae87b82df2 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb
@@ -38,22 +38,26 @@ class ResourceController < ApplicationController
params[:layout]='false'
@snapshot=@resource.last_snapshot
- load_extensions()
-
- if @extension
- if @extension.getId()=='violations'
- render_violations()
- elsif (@extension.getId()=='coverage')
- render_coverage()
- elsif (@extension.getId()=='source')
- render_source()
- elsif (@extension.getId()=='duplications')
- render_duplications()
+ if @snapshot
+ load_extensions()
+
+ if @extension
+ if @extension.getId()=='violations'
+ render_violations()
+ elsif (@extension.getId()=='coverage')
+ render_coverage()
+ elsif (@extension.getId()=='source')
+ render_source()
+ elsif (@extension.getId()=='duplications')
+ render_duplications()
+ else
+ render_extension()
+ end
else
- render_extension()
+ render_nothing()
end
else
- render_nothing()
+ render_resource_deleted()
end
end
@@ -537,4 +541,8 @@ class ResourceController < ApplicationController
def render_nothing()
render :action => 'nothing', :layout => !request.xhr?
end
+
+ def render_resource_deleted()
+ render :action => 'resource_deleted', :layout => !request.xhr?
+ end
end \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/resource_deleted.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/resource_deleted.html.erb
new file mode 100644
index 00000000000..f137fec47b5
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/resource_deleted.html.erb
@@ -0,0 +1 @@
+<%= message('resource_viewer.resource_deleted') -%> \ No newline at end of file