You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ariablu <96...@gmail.com> on 2010/03/16 15:59:27 UTC

IndexOutOfBoundsException occur in UnsafeUriCharactersEncoder.class

If set non-ascii character in any uri (example <to uri="sql:select (non-ascii
character)">),
IndexOutOfBoundsException occurs at
---------------
Class:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java?view=markup
[line 67] if (unsafeCharacters.get(bytes[i])) {
---------------


I think,

[line 65] byte[] bytes = s.getBytes("UTF8");
An byte object can have -128..127, but unsafeCharacters[0..256]

Thanks.

-- 
View this message in context: http://old.nabble.com/IndexOutOfBoundsException-occur-in-UnsafeUriCharactersEncoder.class-tp27919179p27919179.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: IndexOutOfBoundsException occur in UnsafeUriCharactersEncoder.class

Posted by ariablu <96...@gmail.com>.
Thank you for your reply.

I think ...
camel-jdbc cannot rollback, becase connection is closed (and commit) in
process method.
------
Class:http://svn.apache.org/viewvc/camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java?view=markup
[line96]conn.close(); 
------
I cannot use camel-jdbc component for "INSERT","UPDATE","DELETE" statemet.
So I use sql component or SpringJdbcTemplate.


And more example non-ascii character uri,
<to uri="file:c:/documents/(non-ascii character path name)"/>

Thanks.


Claus Ibsen-2 wrote:
> 
> On Tue, Mar 16, 2010 at 3:59 PM, ariablu <96...@gmail.com> wrote:
>>
>> If set non-ascii character in any uri (example <to uri="sql:select
>> (non-ascii
>> character)">),
>> IndexOutOfBoundsException occurs at
>> ---------------
>> Class:
>> http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java?view=markup
>> [line 67] if (unsafeCharacters.get(bytes[i])) {
>> ---------------
>>
> 
> The SQL component is really not fitted for SQL that well. You can use
> it for simple stuff.
> 
> Use camel-jdbc instead.
> or SpringJdbcTemplate
> or maybe even camel-ibatis.
> 
> Having the SQL query in the endpoint is bad practice IMHO.
> 
> 
>>
>> I think,
>>
>> [line 65] byte[] bytes = s.getBytes("UTF8");
>> An byte object can have -128..127, but unsafeCharacters[0..256]
>>
>> Thanks.
>>
>> --
>> View this message in context:
>> http://old.nabble.com/IndexOutOfBoundsException-occur-in-UnsafeUriCharactersEncoder.class-tp27919179p27919179.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://old.nabble.com/IndexOutOfBoundsException-occur-in-UnsafeUriCharactersEncoder.class-tp27919179p27921204.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: IndexOutOfBoundsException occur in UnsafeUriCharactersEncoder.class

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Mar 16, 2010 at 3:59 PM, ariablu <96...@gmail.com> wrote:
>
> If set non-ascii character in any uri (example <to uri="sql:select (non-ascii
> character)">),
> IndexOutOfBoundsException occurs at
> ---------------
> Class:
> http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java?view=markup
> [line 67] if (unsafeCharacters.get(bytes[i])) {
> ---------------
>

The SQL component is really not fitted for SQL that well. You can use
it for simple stuff.

Use camel-jdbc instead.
or SpringJdbcTemplate
or maybe even camel-ibatis.

Having the SQL query in the endpoint is bad practice IMHO.


>
> I think,
>
> [line 65] byte[] bytes = s.getBytes("UTF8");
> An byte object can have -128..127, but unsafeCharacters[0..256]
>
> Thanks.
>
> --
> View this message in context: http://old.nabble.com/IndexOutOfBoundsException-occur-in-UnsafeUriCharactersEncoder.class-tp27919179p27919179.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: IndexOutOfBoundsException occur in UnsafeUriCharactersEncoder.class

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

Thanks for reporting this. I already fill a JIRA[1] for it.
[1] https://issues.apache.org/activemq/browse/CAMEL-2554

Willem
ariablu wrote:
> If set non-ascii character in any uri (example <to uri="sql:select (non-ascii
> character)">),
> IndexOutOfBoundsException occurs at
> ---------------
> Class:
> http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java?view=markup
> [line 67] if (unsafeCharacters.get(bytes[i])) {
> ---------------
> 
> 
> I think,
> 
> [line 65] byte[] bytes = s.getBytes("UTF8");
> An byte object can have -128..127, but unsafeCharacters[0..256]
> 
> Thanks.
>