[ 
https://issues.apache.org/jira/browse/CXF-5719?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14005898#comment-14005898
 ] 

ASF GitHub Bot commented on CXF-5719:
-------------------------------------

GitHub user neyb opened a pull request:

    https://github.com/apache/cxf/pull/4

    PR : fix CXF-5719

    fix CXF-5719 : exception are splitted with #*# and not # or *
    https://issues.apache.org/jira/browse/CXF-5719
    not fixing a bug occuring when the exception message contains a #*# string

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/neyb/cxf master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cxf/pull/4.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #4
    
----
commit 82eecdca23402fe8977bba7ff863314c94a9ad92
Author: neyb <noo.blas...@gmail.com>
Date:   2014-05-22T13:05:51Z

    fix CXF-5719 : exception are splitted with #*# and not # or *
    https://issues.apache.org/jira/browse/CXF-5719
    not fixing a bug occuring when the exception message contains a #*# string

----


> NoSuchElementException in ClientFaultConverter when stack trace message 
> contains * or #
> ---------------------------------------------------------------------------------------
>
>                 Key: CXF-5719
>                 URL: https://issues.apache.org/jira/browse/CXF-5719
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.6.10, 2.7.7, 3.0.0-milestone1
>            Reporter: Saad Benbouzid
>              Labels: exception-handling, exceptions, soapfault, stacktrace
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Following stack trace shows up whenever there is a # or a * character in one 
> of the 'Caused By:' clause.
> {code}
> Caused by: java.util.NoSuchElementException
>       at java.util.StringTokenizer.nextToken(StringTokenizer.java:349)
>       at 
> org.apache.cxf.interceptor.ClientFaultConverter.parseStackTrackLine(ClientFaultConverter.java:287)
>       at 
> org.apache.cxf.interceptor.ClientFaultConverter.getCause(ClientFaultConverter.java:278)
>       at 
> org.apache.cxf.interceptor.ClientFaultConverter.setStackTrace(ClientFaultConverter.java:246)
>       at 
> org.apache.cxf.interceptor.ClientFaultConverter.handleMessage(ClientFaultConverter.java:79)
>       at 
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
>       at 
> org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:113)
>       at 
> org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
>       at 
> org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
>       at 
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
>       at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:845)
> {code}
> For example : 
> {code}
> org.springframework.jdbc.UncategorizedSQLException: Error setting null for 
> parameter #1 with JdbcType OTHER . Try setting a different JdbcType for this 
> parameter or a different jdbcTypeForNull configuration property. Cause: 
> java.sql.SQLException: Type de colonne non valide: 1111
> ; uncategorized SQLException for SQL []; SQL state [99999]; error code 
> [17004]; Type de colonne non valide: 1111; nested exception is 
> java.sql.SQLException: Type de colonne non valide: 1111
>       at 
> org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
>       at 
> org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
>       at 
> org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
>       at 
> org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
>       at 
> org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371)
>       at com.sun.proxy.$Proxy74.selectOne(Unknown Source)
> {code}
> Because it considers the # (sharp) character as a delimiter.
> That means actual CSF stack trace deserialization does not work for any 
> 'Caused By' clause with a sharp (#) or a star character (#)... which is 
> really unpleasant for customization (see stack trace Apache MyBatis stack 
> trace example above).
> Please avoid *StringTokenizer* splitting in favor of a  *String.split(...)* 
> or a plain old iterator. Because *StringTokenizer* considers not only 
> *Message.EXCEPTION_CAUSE_SUFFIX* as a delimiter, but also each character in 
> it, which are sharp # and star *.
> {quote}
> StringTokenizer is a legacy class that is retained for compatibility reasons 
> although its use is discouraged in new code. It is recommended that anyone 
> seeking this functionality use the split method of String or the 
> java.util.regex package instead.
> {quote}
> {color:red}
> *org.apache.cxf.interceptor.ClientFaultConverter._setStackTrace_*
> {color}
> also see CXF-5231



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to