Uploaded image for project: 'Ranger'
  1. Ranger
  2. RANGER-1287

Remove code duplication from Java method EmbeddedServer.start()

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Duplicate
    • 0.7.0
    • 0.7.0
    • admin

    Description

      In java class incubator-ranger\embeddedwebserver\src\main\java\org\apache\ranger\server\tomcat\EmbeddedServer.java,
      there is some code duplication in method start().
      1.The following code is repeated twice, should remove one of them.

      valve.setRotatable(true);
      

      2.The following code is repeated three times which can be refactored.

      try{
      	server.start();
      	server.getServer().await();
      	shutdownServer();
      }catch (LifecycleException e) {
      	LOG.severe("Tomcat Server failed to start:" + e.toString());
      	e.printStackTrace();
      }catch (Exception e) {
      	LOG.severe("Tomcat Server failed to start:" + e.toString());
      	e.printStackTrace();
      }
      

      Attachments

        Issue Links

          Activity

            People

              zhangqiang2 Qiang Zhang
              zhangqiang2 Qiang Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 24h
                  24h
                  Remaining:
                  Remaining Estimate - 24h
                  24h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified