camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-10562) UnsupportedOperationException in DefaultCamelContext#safelyStartRouteServices
Date Tue, 06 Dec 2016 23:12:58 GMT

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

ASF GitHub Bot commented on CAMEL-10562:
----------------------------------------

GitHub user sschulze opened a pull request:

    https://github.com/apache/camel/pull/1333

    CAMEL-10562: camel-core - Switched to List#sort

    Usage of Collections.sort(CopyOnWriteArrayList, Comparator) causes an UnsupportedOperationException
on Oracle Java 1.8.0 up to fixpack 20 due to the documented restriction of this method to
require an implemented ListIterator#set(...) operation on the given list.
    
    For details have a look at [CAMEL-10562](https://issues.apache.org/jira/browse/CAMEL-10562).

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

    $ git pull https://github.com/sschulze/camel master

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

    https://github.com/apache/camel/pull/1333.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 #1333
    
----
commit bb8be00f5e50f4190677ffac8e73609446a600d9
Author: Stefan Schulze <stefan.schulze3@gmail.com>
Date:   2016-12-06T23:02:19Z

    CAMEL-10562: camel-core - Switched to List#sort

----


> UnsupportedOperationException in DefaultCamelContext#safelyStartRouteServices
> -----------------------------------------------------------------------------
>
>                 Key: CAMEL-10562
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10562
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.18.0, 2.18.1
>         Environment: Oracle JDK 1.8.0_(<20)
>            Reporter: Stefan
>            Priority: Critical
>
> DefaultCamelContext#safelyStartRouteServices the following code is called:
> {code}
> Collections.sort(startupListeners, new OrderedComparator());
> {code}
> {{startupListeners}} is a {{CopyOnWriteArrayList}}.
> In the specification of Collections.sort it is stated, that an UnsupportedOperationException
is thrown if the collections listiterator doesn't support the set-operation.
> Sadly, the documentation of CopyOnWriteArrayList#listIterator states, that the listiterator
doesn't support this operation.
> As expected in this szenario, the UnsupportedOperationException is thrown during startup
of the camel context if an Oracle JDK 1.8.0 with patchlevel lower than 20 is used.
> In 1.8.0_20 the operation Collections#sort(List,Comparator) is rewritten to delegate
to List#sort(Comparator) so it doesn't matter anymore if the lists listIterator supports the
set-operation.
> The issue can trivially been fixed by replacing the line by
> {code}
> startupListeners.sort(new OrderedComparator());
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message