Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-1597

setStackTrace method of org.apache.cxf.interceptor.ClientFaultConverter make me can't put stackTrace elment under fault detail element

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.1
    • Fix Version/s: 2.1.1, 2.0.7
    • Component/s: Core
    • Labels:
      None
    • Estimated Complexity:
      Novice

      Description

      i think method setStackTrace may need have a change like this to make it more compatible with other databinding:

      private void setStackTrace(Fault fault, Message msg) {
      Map<String, String> ns = new HashMap<String, String>();
      XPathUtils xu = new XPathUtils(ns);
      String ss = (String) xu.getValue("/" + Fault.STACKTRACE + "/text()", fault.getDetail(), //changed
      XPathConstants.STRING);
      List<StackTraceElement> stackTraceList = new ArrayList<StackTraceElement>();
      if (!StringUtils.isEmpty(ss)) {
      StringTokenizer st = new StringTokenizer(ss, "\n");
      while (st.hasMoreTokens()) {
      String oneLine = st.nextToken();
      StringTokenizer stInner = new StringTokenizer(oneLine, "!");
      if(stInner.countTokens() == 4)

      { StackTraceElement ste = new StackTraceElement(stInner.nextToken(), stInner.nextToken(), stInner.nextToken(), Integer.parseInt(stInner.nextToken())); stackTraceList.add(ste); }

      else

      { break; }

      }
      if (stackTraceList.size() > 0)

      { StackTraceElement[] stackTraceElement = new StackTraceElement[stackTraceList.size()]; Exception e = msg.getContent(Exception.class); e.setStackTrace(stackTraceList.toArray(stackTraceElement)); }

      }

      }

      if changed like so, we can put arbitrary stackTrace element under fault detail instead of the specified xml format

        Attachments

          Activity

            People

            • Assignee:
              dkulp Daniel Kulp
              Reporter:
              hwavelet hwavelet
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

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