Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-31747

Error when adding Ruby Console portlet to a page

    Details

    • Type: Regression Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: 6.1.1 CE GA2, 6.1.20 EE GA2
    • Labels:
      None
    • Environment:
      Tomcat 7.0 + MySQL 5. Portal 6.2.x GIT ID: 74f5d059a4e09c433abf5f781ec4d5ff7cc6441b.
      Plugins 6.2.x GIT ID: b3d0fe3135f8b528fe57a1bbf521bcf11a7f6eea.
    • Branch Version/s:
      6.1.x
    • Backported to Branch:
      Committed
    • Fix Priority:
      2

      Description

      1. Deploy the Ruby Console portlet.
      2. Add Ruby Console to a page.

      The portlet will be added but with errors, these errors make the portlet unusable. Within the portlet an error message will display and lines of code will appear. An error also displays in the console.

      Portlet error text:

      Your request failed to complete.
      An unexpected error occurred.

      (NoMethodError) undefined method `getPathContext' for nil:NilClass
      Line 1: require 'java'
      Line 2: 
      Line 3: $renderResponse.setContentType "text/html"
      Line 4: 
      Line 5: themeDisplay = $renderRequest.getAttribute("THEME_DISPLAY");
      Line 6: 
      Line 7: namespace = $renderResponse.getNamespace
      Line 8: 
      Line 9: out = $renderResponse.getPortletOutputStream
      Line 10: 
      Line 11: html = <<-EOF
      Line 12: <style type="text/css">
      Line 13: 	\##{namespace}consoleOutput {
      Line 14: 		border: 1px solid \#ccc;
      Line 15: 		font-family: monospace;
      Line 16: 		font-size: 12px;
      Line 17: 		height: 200px;
      Line 18: 		overflow: auto;
      Line 19: 		padding: 4px;
      Line 20: 		width: 98%;
      Line 21: 	}
      Line 22: </style>
      Line 23: 
      Line 24: <script type="text/javascript">
      Line 25: 	// <![CDATA[
      Line 26: 		function #{namespace}execute() {
      Line 27: 			var content = #{namespace}consoleInput.getCode();
      Line 28: 
      Line 29: 			jQuery.get(
      Line 30: 				'#{$renderResponse.createResourceURL}',
      Line 31: 				{
      Line 32: 					#{namespace}cmd: "exec",
      Line 33: 					#{namespace}consoleInput: content
      Line 34: 				},
      Line 35: 				function(data) {
      Line 36: 					if (!data.match(/^@[email protected]$/m) && document.#{namespace}fm.#{namespace}outputMode.checked) {
      Line 37: 						jQuery("\##{namespace}consoleOutput").empty().append(data);
      Line 38: 					}
      Line 39: 					else {
      Line 40: 						jQuery("\##{namespace}consoleOutput").empty().text(data);
      Line 41: 					}
      Line 42: 				}
      Line 43: 			);
      Line 44: 
      Line 45: 			return false;
      Line 46: 		}
      Line 47: 	// ]]>
      Line 48: </script>
      Line 49: 
      Line 50: <form name="#{namespace}fm">
      Line 51: 	Input
      Line 52: 
      Line 53: 	<br />
      Line 54: 
      Line 55: 	<textarea class="codepress ruby" id="#{namespace}consoleInput" name="#{namespace}consoleInput" style="height: 300px; width: 98%;" wrap="off">
      Line 56: \$resourceResponse.setContentType "text/html"
      Line 57: 
      Line 58: out = $resourceResponse.getPortletOutputStream
      Line 59: 
      Line 60: out.println `date`
      Line 61: </textarea>
      Line 62: 
      Line 63: 	<br /><br />
      Line 64: 
      Line 65: 	<input type="button" value="Execute" onClick="#{namespace}execute();" />
      Line 66: 
      Line 67: 	<input type="checkbox" name="#{namespace}outputMode" />
      Line 68: 
      Line 69: 	Rendered Output
      Line 70: 
      Line 71: 	<br /><br />
      Line 72: 
      Line 73: 	Output
      Line 74: 
      Line 75: 	<br />
      Line 76: 
      Line 77: 	<pre id="#{namespace}consoleOutput"><!--//--></pre>
      Line 78: </form>
      Line 79: 
      Line 80: <script src="#{themeDisplay.getPathContext}/html/js/editor/codepress/codepress.js" type="text/javascript"></script>
      Line 81: EOF
      Line 82: 
      Line 83: out.print html
      

      Console error:

      NoMethodError: undefined method `getPathContext' for nil:NilClass
        (root) at <script>:80
      

        Attachments

          Activity

            People

            Assignee:
            kenji.heigel Kenji Heigel
            Reporter:
            kenji.heigel Kenji Heigel
            Participants of an Issue:
            Recent user:
            Esther Sanz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              9 years, 22 weeks, 6 days ago

                Packages

                Version Package
                6.1.2 CE GA3
                6.1.30 EE GA3
                6.2.0 CE M3