ServiceMix 4
  1. ServiceMix 4
  2. SMX4-1585

org.apache.servicemix.cxf.transport.nmr.NMRConduitOutputStream.commitOutputMessage() does not propagate exception.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.5.3, 4.6.0
    • Component/s: cxf-nmr
    • Labels:
    • Environment:

      CXF-NMR transport

    • Patch Info:
      Patch Available

      Description

      There is a bug in

      org.apache.servicemix.cxf.transport.nmr.NMRConduitOutputStream.java
      
      private void commitOutputMessage() throws IOException {
          try {
          ...
          } catch (Exception e) {
              e.printStackTrace();
              new IOException(e.toString());
          }
      

      Notice it creates a new IOException but never throws it. As a result the error is ignored completely.

      1. SMX4-1585.patch
        0.8 kB
        Torsten Mielke
      2. SMX4-1585.patch
        0.7 kB
        Torsten Mielke

        Activity

        Hide
        Freeman Fang added a comment -

        Thanks Torsten, didn't realize you were also working on it.

        Show
        Freeman Fang added a comment - Thanks Torsten, didn't realize you were also working on it.
        Hide
        Torsten Mielke added a comment -

        Oh sorry, did not see your update Freeman. So I think its all good then atm.
        Apologies for reopening.
        Feel free to close this ticket accordingly.

        Show
        Torsten Mielke added a comment - Oh sorry, did not see your update Freeman. So I think its all good then atm. Apologies for reopening. Feel free to close this ticket accordingly.
        Hide
        Torsten Mielke added a comment -

        Attaching updated SMX4-1585.patch to removes the e.printStackTrace() call as well.

        Show
        Torsten Mielke added a comment - Attaching updated SMX4-1585 .patch to removes the e.printStackTrace() call as well.
        Hide
        Torsten Mielke added a comment - - edited

        Please allow me to reopen this bug and further improve the fix.
        In addition to throwing the IOException we should get rid of the line before

        e.printStackTrace()
        

        This currently prints the error to stderr (which is the Karaf console). I don't see a need for logging the error here as it will already be logged as a warning by the NMR and will also get logged by the CXF interceptor with full stack traces in each.

        15:27:34,275 | WARN  | qtp832208049-410 | NMR                              | 265 - org.apache.servicemix.nmr.core - 1.6.0.redhat-60024 | 
        Error processing exchange [
          id:        596988866-62354-1381498054120-0-2
          mep:       InOut
          status:    Active
          role:      Consumer
          target:    PropertyMatchingReference[{NAME=someNmrEndpoint, 
        INTERFACE_NAME={http://cxf.sample}SampleEchoServicePortType}]
          operation: {http://cxf.sample}SampleEchoService1
        ]
        org.apache.servicemix.nmr.api.ServiceMixException: Could not dispatch exchange. No matching endpoints.
        	at org.apache.servicemix.nmr.core.FlowRegistryImpl.dispatch(FlowRegistryImpl.java:123)[265:org.apache.servicemix.nmr.core:1.6.0.redhat-60024]
        ...
        15:27:34,280 | WARN  | qtp832208049-410 | PhaseInterceptorChain       
             | 147 - org.apache.cxf.cxf-api - 2.6.0.redhat-60024 | Interceptor for 
        {http://cxf.sample}SampleEchoService#{http:
        //cxf.sample}SampleEchoService1 has thrown 
        exception, unwinding now
        org.apache.cxf.interceptor.Fault: Could not send Message.
        at ...
        
        Show
        Torsten Mielke added a comment - - edited Please allow me to reopen this bug and further improve the fix. In addition to throwing the IOException we should get rid of the line before e.printStackTrace() This currently prints the error to stderr (which is the Karaf console). I don't see a need for logging the error here as it will already be logged as a warning by the NMR and will also get logged by the CXF interceptor with full stack traces in each. 15:27:34,275 | WARN | qtp832208049-410 | NMR | 265 - org.apache.servicemix.nmr.core - 1.6.0.redhat-60024 | Error processing exchange [ id: 596988866-62354-1381498054120-0-2 mep: InOut status: Active role: Consumer target: PropertyMatchingReference[{NAME=someNmrEndpoint, INTERFACE_NAME={http: //cxf.sample}SampleEchoServicePortType}] operation: {http: //cxf.sample}SampleEchoService1 ] org.apache.servicemix.nmr.api.ServiceMixException: Could not dispatch exchange. No matching endpoints. at org.apache.servicemix.nmr.core.FlowRegistryImpl.dispatch(FlowRegistryImpl.java:123)[265:org.apache.servicemix.nmr.core:1.6.0.redhat-60024] ... 15:27:34,280 | WARN | qtp832208049-410 | PhaseInterceptorChain | 147 - org.apache.cxf.cxf-api - 2.6.0.redhat-60024 | Interceptor for {http: //cxf.sample}SampleEchoService#{http: //cxf.sample}SampleEchoService1 has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: Could not send Message. at ...
        Hide
        Freeman Fang added a comment -

        yeah, good suggestion, revised accordingly, thanks

        Show
        Freeman Fang added a comment - yeah, good suggestion, revised accordingly, thanks
        Hide
        Justas Samuolis added a comment -

        I think then Exception is catched it would be better to remove e.printStackTrace(); and use LOG.error(e.getMessage(), e) instead.

        Show
        Justas Samuolis added a comment - I think then Exception is catched it would be better to remove e.printStackTrace(); and use LOG.error(e.getMessage(), e) instead.
        Hide
        Freeman Fang added a comment - - edited

        apply patch on behalf of Torsten Mielke with thanks
        Good catch BTW

        Show
        Freeman Fang added a comment - - edited apply patch on behalf of Torsten Mielke with thanks Good catch BTW
        Hide
        Torsten Mielke added a comment -

        Attaching patch in SMX4-1585.patch.

        Show
        Torsten Mielke added a comment - Attaching patch in SMX4-1585 .patch.

          People

          • Assignee:
            Freeman Fang
            Reporter:
            Torsten Mielke
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development