You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling NewServer if the jar file is not found (bad path or just does not exist), NewServer does not return an error. When the Start function is then called, it will also not return an error.
The underlying line of code being called in Start (line 77) is: cmd := command("java", "-jar", s.jar, "-p", s.port) which is then started with: if err := cmd.Start(); err != nil { return err } which has no problem except for the fact that it is erring silently. If we read from standard error we can see the problem being logged, but the current code is not capturing this, since cmd.Start() did not err. Thus, this is a silent "failure". The code does not fail but the call to start the Server never actually succeeds.
This prints: SERVER: &{tika-server-1.19.jar http://localhost:9998 9998 <nil>} and HERE is never printed since the line is never reached. The Start function never completes.
I propose the following fix to be placed in the first line of the Start function:
When calling NewServer if the jar file is not found (bad path or just does not exist),
NewServer
does not return an error. When theStart
function is then called, it will also not return an error.The underlying line of code being called in
Start
(line 77) is:cmd := command("java", "-jar", s.jar, "-p", s.port)
which is then started with:if err := cmd.Start(); err != nil { return err }
which has no problem except for the fact that it is erring silently. If we read from standard error we can see the problem being logged, but the current code is not capturing this, sincecmd.Start()
did not err. Thus, this is a silent "failure". The code does not fail but the call to start the Server never actually succeeds.Consider the following example code:
This prints:
SERVER: &{tika-server-1.19.jar http://localhost:9998 9998 <nil>}
andHERE
is never printed since the line is never reached. TheStart
function never completes.I propose the following fix to be placed in the first line of the
Start
function:This will allow for immediate failure if the tika jar file was not found or does not exist.
I would like to make a PR for this.
The text was updated successfully, but these errors were encountered: