title: Execution of the expression failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: String
body: <p>I am trying to create a simple mule application that reads the name and content of a file on the disk and displays it on the web browser.</p>
  
  <p>My flow is as follows HTTP -> JAVA TRANSFORMER - SETPAYLOAD - HTTP</p>
  
  <p>My Java transformer code includes the following</p>
  
  <pre><code>public class ReadFile extends AbstractMessageTransformer {
  
      /**
       * loads the content of the file specified in the parameter
       * 
       * @param filename
       *            the name of the file
       * @return the content of the file
       */
      public String readFile(String filename) {
          File file;
          file = new File("O:\\test.txt");
          StringBuilder builder = new StringBuilder();
          BufferedReader reader = null;
          try {
              reader = new BufferedReader(new FileReader(file));
              String line = null;
              while ((line = reader.readLine()) != null)
                  builder.append(line);
          } catch (IOException e) {
              e.printStackTrace();
          } finally {
              closeQuietly(reader);
          }
          return builder.toString();
      }
  
      public String getFileName(MuleMessage message) {
  
          Path p = Paths.get("O:\\Test.txt");
          String file = p.getFileName().toString();
          return file;
  
      }
  
      public String setPayload(MuleMessage message, String outputEncoding) {
  
          String payload1 = "#[ReadFile]";
          return payload1;
  
      }
  
      private void closeQuietly(Closeable c) {
          if (c != null) {
              try {
                  c.close();
              } catch (IOException ignored) {
              }
          }
      }
  
      @Override
      public Object transformMessage(MuleMessage message, String outputEncoding)
              throws TransformerException {
          String filename = getFileName(message);
          String content = readFile(filename);
          setPayload(message, content);
          return message;
      }
  
  }
  </code></pre>
  
  <p>I am getting the error Execution of the expression <strong>ReadFile</strong> failed. <code>(org.mule.api.expression.ExpressionRuntimeException)</code>. Message payload is of type: <code>String</code></p>
  
  <p>and have no idea why?</p>