Uploaded image for project: 'Hyrax Data Server'
  1. HYRAX-670

Reading values from olfs.xml file is fragile

    Details

    • Type: Bug
    • Status: Done (View workflow)
    • Priority: Highest
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Sprint:

      Description

      Please fix this ASAP since it's very hard to debug.

      I used the olfs.xml file to set the log file path and default ping values, however, it failed even though the code clearly was reading the values from the log file. I found that the code to extract values using the XPaths for the HyraxLogfilePath and DefaultPing elements is very easy to break. If the XML file is formatted like this:

           <LogReporter>
              <HyraxLogfilePath>/Users/jimg/src/opendap/hyrax_git/apache-tomcat-7.0.57/webapps/opendap/WE\
      B-INF/conf/logs/AnonymousAccess.log</HyraxLogfilePath>
              <DefaultPing>1800</DefaultPing>
          </LogReporter>
      

      if works great. However, if it is formatted like this:

           <LogReporter>
              <HyraxLogfilePath>
                  /Users/jimg/src/opendap/hyrax_git/apache-tomcat-7.0.57/webapps/opendap/WE\
      B-INF/conf/logs/AnonymousAccess.log
           </HyraxLogfilePath>
              <DefaultPing>
                  1800
               </DefaultPing>
          </LogReporter>
      

      massive fail...

      The problem is that the the latter has two CR characters and spaces at the begining and end of each value. Here's what it said in the log when the latter formatting was used:

      2016-07-01 07:16:20.095 DEBUG 2914 --- [http-bio-8080-exec-8] o.s.w.f.CommonsRequestLoggingFilter      : After request [uri=/reporter/defaultPing?null;client=0:0:0:0:0:0:0:1]
      2016-07-01 07:16:20.096 ERROR 2914 --- [http-bio-8080-exec-8] o.s.boot.context.web.ErrorPageFilter     : Forwarding to error page from request [/defaultPing] due to exception [For input string: "
                  1800
              "]
      
      java.lang.NumberFormatException: For input string: "
                  1800
              "
              at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[na:1.7.0_72]
              at java.lang.Long.parseLong(Long.java:430) ~[na:1.7.0_72]
      

        Attachments

          Activity

            People

            • Assignee:
              grinchenko.ed Eduard Grinchenko (Inactive)
              Reporter:
              jimg James Gallagher
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: