{"action":"created","issue":{"url":"https://api.github.com/repos/eclipse/smarthome/issues/2521","repository_url":"https://api.github.com/repos/eclipse/smarthome","labels_url":"https://api.github.com/repos/eclipse/smarthome/issues/2521/labels{/name}","comments_url":"https://api.github.com/repos/eclipse/smarthome/issues/2521/comments","events_url":"https://api.github.com/repos/eclipse/smarthome/issues/2521/events","html_url":"https://github.com/eclipse/smarthome/issues/2521","id":191203199,"number":2521,"title":"ClassCastException in HandlerFactories","user":{"login":"kaikreuzer","id":3244965,"avatar_url":"https://avatars.githubusercontent.com/u/3244965?v=3","gravatar_id":"","url":"https://api.github.com/users/kaikreuzer","html_url":"https://github.com/kaikreuzer","followers_url":"https://api.github.com/users/kaikreuzer/followers","following_url":"https://api.github.com/users/kaikreuzer/following{/other_user}","gists_url":"https://api.github.com/users/kaikreuzer/gists{/gist_id}","starred_url":"https://api.github.com/users/kaikreuzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaikreuzer/subscriptions","organizations_url":"https://api.github.com/users/kaikreuzer/orgs","repos_url":"https://api.github.com/users/kaikreuzer/repos","events_url":"https://api.github.com/users/kaikreuzer/events{/privacy}","received_events_url":"https://api.github.com/users/kaikreuzer/received_events","type":"User","site_admin":false},"labels":[{"id":74198568,"url":"https://api.github.com/repos/eclipse/smarthome/labels/bug","name":"bug","color":"fc2929","default":true},{"id":294421275,"url":"https://api.github.com/repos/eclipse/smarthome/labels/Core","name":"Core","color":"207de5","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":21,"created_at":"2016-11-23T07:25:13Z","updated_at":"2016-11-24T13:46:58Z","closed_at":null,"body":"There are reports from a number of bindings about ClassCastExceptions, when trying to instantiate a handler for a bridge - the Thing framework seems to hand in a Thing (and not a Bridge) instance in that case. Before the Thing refactoring, this code was working, so it seems that this must be some bug in the framework, not in the bindings. See a log here:\r\n\r\n```\r\nCaused by: java.lang.ClassCastException: org.eclipse.smarthome.core.thing.internal.ThingImpl cannot be cast to org.eclipse.smarthome.core.thing.Bridge\r\nat org.openhab.binding.homematic.handler.HomematicThingHandlerFactory.createHandler(HomematicThingHandlerFactory.java:50)[204:org.openhab.binding.homematic:2.0.0.201611212345]\r\nat org.eclipse.smarthome.core.thing.binding.BaseThingHandlerFactory.registerHandler(BaseThingHandlerFactory.java:98)[104:org.eclipse.smarthome.core.thing:0.9.0.201611191809]\r\nat org.eclipse.smarthome.core.thing.internal.ThingManager$7.call(ThingManager.java:586)[104:org.eclipse.smarthome.core.thing:0.9.0.201611191809]\r\nat org.eclipse.smarthome.core.thing.internal.ThingManager$7.call(ThingManager.java:1)[104:org.eclipse.smarthome.core.thing:0.9.0.201611191809]\r\nat org.eclipse.smarthome.core.common.SafeMethodCaller$CallableWrapper.call(SafeMethodCaller.java:177)[97:org.eclipse.smarthome.core:0.9.0.201611191809]\r\n... 4 more\r\n```\r\n\r\nMore infos also at https://github.com/openhab/openhab2-addons/issues/1462"},"comment":{"url":"https://api.github.com/repos/eclipse/smarthome/issues/comments/262779768","html_url":"https://github.com/eclipse/smarthome/issues/2521#issuecomment-262779768","issue_url":"https://api.github.com/repos/eclipse/smarthome/issues/2521","id":262779768,"user":{"login":"sjka","id":2592443,"avatar_url":"https://avatars.githubusercontent.com/u/2592443?v=3","gravatar_id":"","url":"https://api.github.com/users/sjka","html_url":"https://github.com/sjka","followers_url":"https://api.github.com/users/sjka/followers","following_url":"https://api.github.com/users/sjka/following{/other_user}","gists_url":"https://api.github.com/users/sjka/gists{/gist_id}","starred_url":"https://api.github.com/users/sjka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjka/subscriptions","organizations_url":"https://api.github.com/users/sjka/orgs","repos_url":"https://api.github.com/users/sjka/repos","events_url":"https://api.github.com/users/sjka/events{/privacy}","received_events_url":"https://api.github.com/users/sjka/received_events","type":"User","site_admin":false},"created_at":"2016-11-24T13:46:58Z","updated_at":"2016-11-24T13:46:58Z","body":"that's good to have your confirmation, thanks! So we now have an official workaround. We all can use our smart homes again while I'm hunting the root-cause.\r\n\r\n> Do you have any explanation, why it worked in the past?\r\n\r\nnot yet. Just looks like really unfortunate timing: The ThingHandlerFactory is registered already while the ThingTypeRegistry is not yet aware of the ThingTypes (i.e. xml processing still in progress), so the GenericThingProvider tries its best. Which as we know is not enough. However, just adding some debug logging for better analysis already fixed it 😩  So maybe the Brigde/ThingHandler refactoring optimized it in a way that it now does not always work anymore by coincidence. Otherwise it's definitely unrelated, as far a I can see."}}
{"actor":{"display_login":"sjka"}}