Source:
<code>public void registerAssetListener(final String channelName, final AssetListener assetListener) <START> throws KuraException { <END> requireNonNull(assetListener, message.listenerNonNull()); requireNonNull(this.driver, message.driverNonNull()); logger.debug(message.registeringListener()); final Map<String, Channel> channels = this.assetConfiguration.getAssetChannels(); final class BaseDriverListener implements DriverListener { private final AssetListener assetListener; BaseDriverListener(final AssetListener assetListener) { requireNonNull(assetListener, message.listenerNonNull()); this.assetListener = assetListener; } @Override public void onDriverEvent(final DriverEvent event) { requireNonNull(event, message.driverEventNonNull()); final DriverRecord driverRecord = event.getDriverRecord(); final Map<String, Object> driverRecordConf = driverRecord.getChannelConfig(); String channelName = (String) driverRecordConf.get(CHANNEL_ID.value()); if (channelName == null) { return; } final AssetRecord assetRecord = new AssetRecord(channelName); try { prepareAssetRecord(driverRecord, assetRecord); } catch (final KuraException e) { logger.error(message.errorPreparingAssetRecord(), e); } final AssetEvent assetEvent = new AssetEvent(assetRecord); this.assetListener.onAssetEvent(assetEvent); } } final Channel channel = channels.get(channelName); final DriverListener driverListener = new BaseDriverListener(assetListener); this.assetListeners.put(assetListener, driverListener); this.monitor.lock(); try { this.driver.registerDriverListener(Collections.unmodifiableMap(channel.getConfiguration()), driverListener); } catch (final ConnectionException ce) { throw new KuraException(KuraErrorCode.CONNECTION_FAILED, ce); } finally { this.monitor.unlock(); } logger.debug(message.registeringListenerDone()); }</code><technical_language>validate channel name</technical_language>

Target:
public void registerAssetListener(final String channelName, final AssetListener assetListener) throws KuraException { requireNonNull(channelName, message.channelNameNonNull()); requireNonNull(assetListener, message.listenerNonNull()); requireNonNull(this.driver, message.driverNonNull()); logger.debug(message.registeringListener()); final Map<String, Channel> channels = this.assetConfiguration.getAssetChannels(); final Channel channel = channels.get(channelName.trim()); if (channel == null) { throw new IllegalArgumentException(message.channelNameNotFound()); } final class BaseDriverListener implements DriverListener { private final AssetListener assetListener; BaseDriverListener(final AssetListener assetListener) { requireNonNull(assetListener, message.listenerNonNull()); this.assetListener = assetListener; } @Override public void onDriverEvent(final DriverEvent event) { requireNonNull(event, message.driverEventNonNull()); final DriverRecord driverRecord = event.getDriverRecord(); final Map<String, Object> driverRecordConf = driverRecord.getChannelConfig(); String channelName = (String) driverRecordConf.get(CHANNEL_NAME.value()); if (channelName == null) { return; } final AssetRecord assetRecord = new AssetRecord(channelName); try { prepareAssetRecord(driverRecord, assetRecord); } catch (final KuraException e) { logger.error(message.errorPreparingAssetRecord(), e); } final AssetEvent assetEvent = new AssetEvent(assetRecord); this.assetListener.onAssetEvent(assetEvent); } } final DriverListener driverListener = new BaseDriverListener(assetListener); this.assetListeners.put(assetListener, driverListener); this.monitor.lock(); try { this.driver.registerDriverListener(channel.getConfiguration(), driverListener); } catch (final ConnectionException ce) { throw new KuraException(KuraErrorCode.CONNECTION_FAILED, ce); } finally { this.monitor.unlock(); } logger.debug(message.registeringListenerDone()); }