camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (CAMEL-9850) Twitter: truncation has no effect
Date Wed, 13 Apr 2016 09:31:26 GMT


ASF GitHub Bot commented on CAMEL-9850:

GitHub user binfalse opened a pull request:

    camel-twitter: remove truncation

    This removes the non-effective truncation of messages to be sent to twitter.

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

    $ git pull twitter-no-truncation

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

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

    This closes #942
commit cbada76346fa0aae74128b2b74aa3a834144ea63
Author: Martin Scharm <>
Date:   2016-04-09T09:53:12Z

    camel-xmpp: fix private chat response issue
    Responding to a private chat wasn't able because the message was always sent to
        String participant = exchange.getIn().getHeader(XmppConstants.TO, String.class);
    However, the `XmppConstants.TO` in such messages is the camel instance
    (which received the message) and not the chat's other participant.
    Thus, responding to a chat message always resultet in a message to itself.
    This patch fixes that issue and addresses messages always to
        String participant = endpoint.getParticipant();

commit cb1b8f6337c4795fc9d5046c204ff1e5dc86d533
Author: Martin Scharm <>
Date:   2016-04-09T10:05:03Z

    Merge branch 'master' of

commit b31266e5b0f29c596288f1432a55445a60b4888b
Author: Martin Scharm <>
Date:   2016-04-10T08:33:17Z


commit b96035b239974e3ddf4cb1c9a84258e11b9a1433
Author: Martin Scharm <>
Date:   2016-04-10T08:36:52Z

    camel-twitter: removed the truncation
    Twitter status updates were truncated to 160 chars if they were longer.
    However the twitter limit is 140 chars, so this truncation didn't have
    any effect and I removed it.


> Twitter: truncation has no effect
> ---------------------------------
>                 Key: CAMEL-9850
>                 URL:
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-twitter
>    Affects Versions: 2.17.0
>            Reporter: martin scharm
>             Fix For: 2.18.0
> h3. Problem
> The current version of camel-twitter implements a truncation that does not have any effect:
> [|]
> {code:java}
> if (status.length() > 160) {
>     log.warn("Message is longer than 160 characters. Message will be truncated!");
>     status = status.substring(0, 160);
> }
> {code}
> Status updates were truncated to 160 chars if they were longer. 
> However, the twitter limit is 140 chars. Updates with a length of 141-160 will not be
truncated and fail; updates with a length of more than 160 will be truncated to 160 chars
and still fail.
> Moreover, there are longer messages that are nevertheless compliant with the 140 char
limit. See for example URLs: every URL is shortened using twitter's shortener. Thus,
even very long URLs occupy just a handful characters and the character counting, as used in
camel-twitter, fails.
> h3. Proposals
> To fix this issue I prepared three proposals:
> h4. Remove Truncation
> As the truncation has no effect anyway it could simply be deleted. See my [commit b96035b
on github|].
> h4. Update Truncation
> Update the current code to truncate to 140 chars. See my [commit 83b3f30 on github|].
> h4. Introduce an optional Truncation
> As explained above, there are valid messages with more than 140 characters, eg. containing
long URLs (see above). Using the previous solution it would not be possible to tweet them.
> Thus, based on [commit 83b3f30|]
I implemented optional truncation in my [commit bbbff05 on github|].
> That way, the client can decide whether messages should be truncated or not. There is
a new flag {{truncate}} that can be used what creating an endpoint, eg.:
> {code}
> twitter://timeline/user?consumerKey=%s&...&truncate=true
> {code}
> However, if deciding for {{truncate=false}} the client should be aware that updating
twitter may fail raising a {{twitter4j.TwitterException}}.
> I nevertheless set the default value to false, as this best reflects the previous behaviour
and will not break other code.

This message was sent by Atlassian JIRA

View raw message