Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-1052

TJWSEmbeddedJaxrsServer.getPort() returns always null

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Optional Optional
    • 3.0.10.Final
    • 2.3.7.Final, 3.0.7.Final
    • None
    • None
    • User Experience
    • Low

      I noticed a Bug in the TJWSEmbeddedJaxrsServer implementation.
      It defines the following two methods.

         public String getProperty(String key)
         {
            return props.getProperty(key);
         }
      
         public String getPort()
         {
            return getProperty(Serve.ARG_PORT);
         }
      

      The problem is that the port is not set via the Properties interface, but via the Hashtable interface of Properties
      which does not enforce Strings and so it is stored as Integer.

      TJWSServletServer

         public void setPort(int port)
         {
            //props.put(Serve.ARG_PORT, Integer.toString(port));
            props.put(Serve.ARG_PORT, port);
         }
      

      The commented out line would actually work for get properties, but I guess that there was a reason it was commented out.

      The main problem is that props are treated as a Map with mixed types in some places but in others it is treated as Properties which requires Map<String, String>.

      The problem exists in resteasy 2.x and 3.x releases.

            patriot1burke@gmail.com Bill Burke (Inactive)
            leonard84_jira Leonard Brünings (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: