db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dag H. Wanvik (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-5413) NetworkServerControl#main can exit with status 1 without printing an error message to console
Date Fri, 30 Sep 2011 02:05:45 GMT

    [ https://issues.apache.org/jira/browse/DERBY-5413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13117825#comment-13117825

Dag H. Wanvik commented on DERBY-5413:

I think I'll need to revert this change. I must have missed an error in my regressions. It
turns out tools/derbyrunjartest.java breaks with this patch:

> Fri Sep 30 01:56:07 GMT+01:00 2011 : DRDA_NoCommand.U:No command given.
> java.lang.Exception: DRDA_NoCommand.U:No command given.
Test Failed.

The logic in the server is confusing. It turns out the extra message above comes from my patch.
When the server analyzes incorrect commands in derbyrunjartest, the serves prints a usage
legend while inside NetwrokControlServerImpl. Since *something* has already been printed,
the above exception is suppressed by default. "server.consoleExceptionPrint(e)" does nothing
unless a debug flag is on - contrary to its name if I may add, hence confusing...

The reason I wanted to make sure we printed unconditionally was code added for DERBY-5363
which, if it saw an error, had printed *nothing* at this point in the code. I'll let that
code handle its own exception printing instead, and back this patch out. Note, the server
can still die silently if an exception with string NetworkServerControlImpl.UNEXPECTED_ERR,
but this would be a coding error I presume. 

> NetworkServerControl#main can exit with status 1 without printing an error message to
> ---------------------------------------------------------------------------------------------
>                 Key: DERBY-5413
>                 URL: https://issues.apache.org/jira/browse/DERBY-5413
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Server
>    Affects Versions:
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>             Fix For:,
>         Attachments: derby-5413.diff
> Cf this piece of code in main
> catch (Exception e)
> {
>      //if there was an error, exit(1)
>      if ((e.getMessage() == null) ||
>          !e.getMessage().equals(NetworkServerControlImpl.UNEXPECTED_ERR) ||
>          printErrors
>      )
>      {
>          if (server != null)
>              server.consoleExceptionPrint(e);
>          else
>              e.printStackTrace();  // default output stream is System.out
>      }
>      // else, we've already printed a trace, so just exit.
>      System.exit(1);
> The call "server.consoleExceptionPrint(e)" will actually *not* print anything unless
the debug flag "NetworkServerControlImpl#debugOutput" has ben set to true which it isn't a
> I think it should be replaced by a call to server.consoleExceptionPrintTrace(e), which
will print unconditionally.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message