auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>void initialize(boolean engineStartup, List<String> macsForMacPool) { log.info("Initializing %s", this); this.macsStorage = createMacsStorage(this.rangesBoundaries); <START> System.out.println(String.format("Initializing %s with macs: %s", this, macsForMacPool)); <END> List<String> notAddedMacs = addMacs(macsForMacPool); if (!notAddedMacs.isEmpty()) { if (engineStartup) { String auditLogMessage = "Following MACs violates duplicity restriction, and was pushed into MAC pool without respect to it:" + notAddedMacs; auditLogDirector.log(new AuditLogableImpl(), AuditLogType.MAC_ADDRESS_VIOLATES_NO_DUPLICATES_SETTING, auditLogMessage); forceAddMacs(notAddedMacs); } else { throw new EngineException(EngineError.MAC_POOL_INITIALIZATION_FAILED, "Unable to initialize MAC pool due to existing duplicates"); } } log.info("Finished initializing %s. Available MACs in pool: %s", this, macsStorage.getAvailableMacsCount()); }</code><technical_language>change sys.out</technical_language>

Target:
void initialize(boolean engineStartup, List<String> macsForMacPool) { log.info("Initializing {}", this); this.macsStorage = createMacsStorage(this.rangesBoundaries); log.debug("Initializing with macs: {}", this, macsForMacPool); List<String> notAddedMacs = addMacs(macsForMacPool); if (!notAddedMacs.isEmpty()) { if (engineStartup) { String auditLogMessage = "Following MACs violates duplicity restriction, and was pushed into MAC pool without respect to it:" + notAddedMacs; auditLogDirector.log(new AuditLogableImpl(), AuditLogType.MAC_ADDRESS_VIOLATES_NO_DUPLICATES_SETTING, auditLogMessage); forceAddMacs(notAddedMacs); } else { throw new EngineException(EngineError.MAC_POOL_INITIALIZATION_FAILED, "Unable to initialize MAC pool due to existing duplicates"); } } log.info("Finished initializing {}. Available MACs in pool: {}", this, macsStorage.getAvailableMacsCount()); }
Source:
<code>public Disk update(Disk incoming) { if (incoming.isSetQcowVersion()) { return performUpdate( incoming, new QueryIdResolver<>(QueryType.GetDiskByDiskId, IdQueryParameters.class), ActionType.AmendImageGroupVolumes, new UpdateParametersProvider()); } <START> throw new WebApplicationException(Response.Status.CONFLICT); <END> }</code><technical_language>I error message accompany returned conflict status. Please add error message Messages.java Messages.properties throw a WebFaultException: throw new WebFaultException(null, localize(Messages.YOUR_NEW_MESSAGE_NAME), Response.Status.CONFLICT); (WebFaultException is a class extends WebApplicationException)</technical_language>

Target:
public Disk update(Disk incoming) { if (incoming.isSetQcowVersion()) { return performUpdate( incoming, new QueryIdResolver<>(QueryType.GetDiskByDiskId, IdQueryParameters.class), ActionType.AmendImageGroupVolumes, new UpdateParametersProvider()); } throw new WebFaultException(null, localize(Messages.DISK_UPDATE_NOT_PERMITTED), Response.Status.CONFLICT); }
Source:
<code><START> public static ServiceCachingPolicy getMultiThreadedClientPolicy() { <END> return DEFAULT_MULTI_THREAD_CLIENTS_POLICY; }</code><technical_language>is point of this method if field returns in public</technical_language>

Target:
public static ServiceCachingPolicy getMultiThreadedClientPolicy() { return DEFAULT_MULTI_THREADED_CLIENTS_POLICY; }
Source:
<code>String[] getProgramArguments() throws IOException { LOGGER.entering(); List<String> args = new LinkedList<String>(); args.addAll(Arrays.asList(super.getProgramArguments())); Iterator<Entry<String, JsonElement>> iterator = defaultArgs.entrySet().iterator(); <START> while (iterator.hasNext()) { <END> String key = iterator.next().getKey(); if (!args.contains(key)) { args.add(key); String val = defaultArgs.get(key).getAsString(); if (StringUtils.isNotBlank(val)) { args.add(val); } } } List<String> filteredArgs = new LinkedList<String>(); filteredArgs.add(SELION_CONFIG_ARG); filteredArgs.add(SELION_NOCONTINUOS_ARG); for (String filter : filteredArgs) { if (!filter.equals(SELION_NOCONTINUOS_ARG)) { args.remove(args.indexOf(filter) + 1); } args.remove(filter); } LOGGER.exiting(args.toString()); return args.toArray(new String[args.size()]); }</code><technical_language>interacting element in this Set, for (Map.Entry<String, JsonElement> eachArg : defaultArgs.entrySet()) { ... }</technical_language>

Target:
String[] getProgramArguments() throws IOException { LOGGER.entering(); List<String> args = new LinkedList<String>(Arrays.asList(super.getProgramArguments())); for (Entry<String, JsonElement> entry : defaultArgs.entrySet()) { String key = entry.getKey(); if (!args.contains(key)) { args.add(key); String val = defaultArgs.get(key).getAsString(); if (StringUtils.isNotBlank(val)) { args.add(val); } } } List<String> filteredArgs = new LinkedList<String>(); filteredArgs.add(SELION_CONFIG_ARG); filteredArgs.add(SELION_NOCONTINUOUS_ARG); for (String filter : filteredArgs) { if (!filter.equals(SELION_NOCONTINUOUS_ARG)) { args.remove(args.indexOf(filter) + 1); } args.remove(filter); } LOGGER.exiting(args.toString()); return args.toArray(new String[args.size()]); }
Source:
<code>public void testAdsOnFilePageOasis() throws Exception { AdsBaseObject ads = buildAdsObjectForPage("File:Example.jpg"); String adUnit = "wka.life/_project43 <START> verifySlotHasCorrectAd( <END> ads, "TOP_LEADERBOARD", adUnit, "271491732" ); verifySlotHasCorrectAd( ads, "TOP_RIGHT_BOXAD", adUnit, "271491732" ); ads.scrollToPosition("#articleCategories"); verifySlotHasCorrectAd( ads, "BOTTOM_LEADERBOARD", adUnit, "271491732" ); }</code><technical_language>L56-L76 - slot name is difference. define some array slot names verify slots in loop (it require reusing SLOT_TRIGGERS in case of BLB</technical_language>

Target:
public void testAdsOnFilePageOasis() throws Exception { AdsBaseObject ads = buildAdsObjectForPage("File:Example.jpg"); String adUnit = "wka.life/_project43 verifySlotHasCorrectAd( ads, AdsContent.TOP_LB, adUnit, PROJECT43_TEST_LINE_ITEM_ID ); verifySlotHasCorrectAd( ads, AdsContent.MEDREC, adUnit, PROJECT43_TEST_LINE_ITEM_ID ); ads.scrollToPosition("#articleCategories"); verifySlotHasCorrectAd( ads, AdsContent.BOTTOM_LB, adUnit, PROJECT43_TEST_LINE_ITEM_ID ); }
Source:
<code>public <T extends Rollup> Points<T> getDataToRoll(Class<T> type, final Locator locator, Range range, ColumnFamily<Locator, Long> cf) throws IOException { AbstractSerializer serializer = Serializers.serializerFor(type); if (cf == CassandraModel.CF_METRICS_FULL) { serializer = Serializers.simpleNumberSerializer; } else if ( cf == CassandraModel.CF_METRICS_PREAGGREGATED_FULL) { if (type.equals(BluefloodTimerRollup.class)) { serializer = Serializers.timerRollupInstance; } else if (type.equals(BluefloodSetRollup.class)) { serializer = Serializers.setRollupInstance; } else if (type.equals(BluefloodGaugeRollup.class)) { serializer = Serializers.gaugeRollupInstance; } else if (type.equals(BluefloodCounterRollup.class)) { serializer = Serializers.counterRollupInstance; } else { serializer = Serializers.simpleNumberSerializer; } } ColumnList<Long> cols = getColumnsFromDB(locator, cf, range); Points<T> points = new Points<T>(); try { for (Column<Long> col : cols) { points.add(new Points.Point<T>(col.getName(), (T)col.getValue(serializer))); } if ( cf == CassandraModel.CF_METRICS_FULL || cf == CassandraModel.CF_METRICS_PREAGGREGATED_FULL ) { <START> Instrumentation.getRawPointsIn5MinHistogram().update(points.getPoints().size()); <END> } } catch (RuntimeException ex) { log.error("Problem deserializing data for " + locator + " (" + range + ") from " + cf.getName(), ex); throw new IOException(ex); } return points; }</code><technical_language>separate histograms for regular pre-aggregated</technical_language>

Target:
public <T extends Rollup> Points<T> getDataToRoll(Class<T> type, final Locator locator, Range range, ColumnFamily<Locator, Long> cf) throws IOException { AbstractSerializer serializer = Serializers.serializerFor(type); if (cf == CassandraModel.CF_METRICS_FULL) { serializer = Serializers.simpleNumberSerializer; } else if ( cf == CassandraModel.CF_METRICS_PREAGGREGATED_FULL) { if (type.equals(BluefloodTimerRollup.class)) { serializer = Serializers.timerRollupInstance; } else if (type.equals(BluefloodSetRollup.class)) { serializer = Serializers.setRollupInstance; } else if (type.equals(BluefloodGaugeRollup.class)) { serializer = Serializers.gaugeRollupInstance; } else if (type.equals(BluefloodCounterRollup.class)) { serializer = Serializers.counterRollupInstance; } else { serializer = Serializers.simpleNumberSerializer; } } ColumnList<Long> cols = getColumnsFromDB(locator, cf, range); Points<T> points = new Points<T>(); try { for (Column<Long> col : cols) { points.add(new Points.Point<T>(col.getName(), (T)col.getValue(serializer))); } if ( cf == CassandraModel.CF_METRICS_FULL ) { Instrumentation.getRawPointsIn5MinHistogram().update(points.getPoints().size()); } } catch (RuntimeException ex) { log.error("Problem deserializing data for " + locator + " (" + range + ") from " + cf.getName(), ex); throw new IOException(ex); } return points; }
Source:
<code>public void testParseHeader() { <START> Bundle carbonCoreBundle = Arrays.asList(bundleContext.getBundles()).stream() <END> .filter(b -> b.getSymbolicName().equals("org.wso2.carbon.sample.deployer.mgt")).findFirst().get(); String headerValue = carbonCoreBundle.getHeaders().get(CARBON_COMPONENT); try { List<ManifestElement> elements = ManifestElement .parseHeader(CARBON_COMPONENT, headerValue, bundleContext.getBundle()); Assert.assertTrue(elements.size() > 0); ManifestElement firstElement = elements.get(0); String value = firstElement.getValue(); String strRepresentation = firstElement.toString(); String[] elementsInManifest = strRepresentation.split(";"); List<String> keys = Collections.list(firstElement.getKeys()); Assert.assertEquals("startup.listener", value); Assert.assertEquals(elementsInManifest.length, 3); Assert.assertEquals(keys.size(), 2); } catch (ManifestElementParserException e) { Assert.assertTrue(false); } }</code><technical_language>stream operations in separate line improves readability. ok .stream() line. if move others lines improve readability</technical_language>

Target:
public void testParseHeader() { Bundle carbonCoreBundle = Arrays.stream(bundleContext.getBundles()) .filter(b -> b.getSymbolicName().equals("org.wso2.carbon.sample.deployer.mgt")) .findFirst() .get(); String headerValue = carbonCoreBundle.getHeaders().get(CARBON_COMPONENT); try { List<ManifestElement> elements = ManifestElement .parseHeader(CARBON_COMPONENT, headerValue, bundleContext.getBundle()); Assert.assertTrue(elements.size() > 0); ManifestElement firstElement = elements.get(0); String value = firstElement.getValue(); String strRepresentation = firstElement.toString(); String[] elementsInManifest = strRepresentation.split(";"); List<String> keys = Collections.list(firstElement.getKeys()); Assert.assertEquals("startup.listener", value); Assert.assertEquals(elementsInManifest.length, 3); Assert.assertEquals(keys.size(), 2); } catch (ManifestElementParserException e) { Assert.assertTrue(false); } }
Source:
<code>public Response toResponse(RemoteException exception) { String errorId = UUID.randomUUID().toString(); Status status = Status.fromStatusCode(exception.getStatus()); if (CLIENT_ERROR.equals(status.getFamily())) { log.error("Received response status code from server handling request. errorId: {}", SafeArg.of("statusCode", status.getStatusCode()), SafeArg.of("errorId", errorId), exception); } else { <START> log.warn("Received response status code from server handling request. errorId: {}", <END> SafeArg.of("statusCode", status.getStatusCode()), SafeArg.of("errorId", errorId), exception); } SerializableError error = exception.getRemoteException(); ResponseBuilder builder = Response.status(status); try { builder.type(MediaType.APPLICATION_JSON); String json = JsonExceptionMapper.MAPPER.writeValueAsString(error); builder.entity(json); } catch (RuntimeException | JsonProcessingException e) { log.warn("Unable to translate exception to json for request {}", SafeArg.of("errorId", errorId), e); builder = Response.status(status); builder.type(MediaType.TEXT_PLAIN); builder.entity(error.getMessage()); } return builder.build(); }</code><technical_language>do warn-level logging enabled default</technical_language>

Target:
public Response toResponse(RemoteException exception) { String errorId = UUID.randomUUID().toString(); Status status = Status.fromStatusCode(exception.getStatus()); if (Status.Family.CLIENT_ERROR.equals(status.getFamily())) { log.error("Received response status code from server handling request. errorId: {}", SafeArg.of("statusCode", status.getStatusCode()), SafeArg.of("errorId", errorId), exception); } else { log.info("Received response status code from server handling request. errorId: {}", SafeArg.of("statusCode", status.getStatusCode()), SafeArg.of("errorId", errorId), exception); } SerializableError error = exception.getRemoteException(); ResponseBuilder builder = Response.status(status); try { builder.type(MediaType.APPLICATION_JSON); String json = JsonExceptionMapper.MAPPER.writeValueAsString(error); builder.entity(json); } catch (RuntimeException | JsonProcessingException e) { log.warn("Unable to translate exception to json for request {}", SafeArg.of("errorId", errorId), e); builder = Response.status(status); builder.type(MediaType.TEXT_PLAIN); builder.entity(error.getMessage()); } return builder.build(); }
Source:
<code>public void warnOnActiveVm() { if (activeVmAttachedToClusterPredicate.eval(networkCluster.getClusterId())) { AuditLogableBase loggable = createLoggable(); <START> commandBase.auditLog(loggable, AuditLogType.NETWORK_UPDATE_DISPLAY_FOR_CLUSTER_WITH_ACTIVE_VM); <END> } }</code><technical_language>passing command instance for logging capability right. A proper AuditLogDirector.log()</technical_language>

Target:
public void warnOnActiveVm() { if (activeVmAttachedToClusterPredicate.eval(networkCluster.getClusterId())) { AuditLogableBase loggable = createLoggable(); auditLog.log(loggable, AuditLogType.NETWORK_UPDATE_DISPLAY_FOR_CLUSTER_WITH_ACTIVE_VM); } }
Source:
<code>public URI read(JsonReader in) throws IOException { if (in.peek() == JsonToken.NULL) { in.nextNull(); return Problem.DEFAULT_TYPE; } try { String nextString = in.nextString(); <START> return "null".equals(nextString) ? Problem.DEFAULT_TYPE : new URI(nextString); <END> } catch (URISyntaxException e) { throw new JsonIOException(e); } }</code><technical_language>case is this? This is covered checking for JsonToken.NULL, correct? json Is this in case of: json type: null If yes, is a case?</technical_language>

Target:
public URI read(JsonReader in) throws IOException { if (in.peek() == JsonToken.NULL) { in.nextNull(); return Problem.DEFAULT_TYPE; } try { String nextString = in.nextString(); return new URI(nextString); } catch (URISyntaxException e) { throw new JsonIOException(e); } }
Source:
<code>@Override public void set(String key, Bitmap bitmap) { if (key == null || bitmap == null) { throw new NullPointerException("key == null || bitmap == null"); } Bitmap previous; synchronized (this) { int addedSize = Utils.getBitmapBytes(bitmap); if (addedSize > maxSize) { <START> return; <END> } putCount++; size += addedSize; previous = map.put(key, bitmap); if (previous != null) { size -= Utils.getBitmapBytes(previous); } } trimToSize(maxSize); }</code><technical_language>synchronized? reason a lock return</technical_language>

Target:
@Override public void set(String key, Bitmap bitmap) { if (key == null || bitmap == null) { throw new NullPointerException("key == null || bitmap == null"); } int addedSize = Utils.getBitmapBytes(bitmap); if (addedSize > maxSize) { return; } synchronized (this) { putCount++; size += addedSize; Bitmap previous = map.put(key, bitmap); if (previous != null) { size -= Utils.getBitmapBytes(previous); } } trimToSize(maxSize); }
Source:
<code>public void onDelete(@NonNull ReadingList readingList) { showDeleteListUndoSnackbar(readingList); ReadingList.DAO.removeList(readingList); funnel.logDeleteList(readingList, readingLists.size()); updateLists(); <START> if (callback() != null) { <END> callback().onReadingListModified(); } }</code><technical_language>Instead of adding a callback, consider a ContentObserver changes observed (I SavePageSyncService this?). This allow remove tab change logic well</technical_language>

Target:
public void onDelete(@NonNull ReadingList readingList) { showDeleteListUndoSnackbar(readingList); ReadingList.DAO.removeList(readingList); funnel.logDeleteList(readingList, readingLists.size()); updateLists(); }
Source:
<code>protected abstract JDBCLoaderProperties createConfig() throws IOException; protected abstract String[] getScripts(); protected abstract String[] getSampleConfigurations(); protected String pref(String s) { <START> return s.replace("${pref}", prefix); <END> }</code><technical_language>Calling method replacePrefix placeholder ${prefix} clearer</technical_language>

Target:
protected abstract JDBCLoaderProperties createConfig() throws IOException; protected abstract String[] getScripts(); protected abstract String[] getSampleConfigurations(); protected String replacePrefix(String s) { return s.replace("${prefix}", prefix); }
Source:
<code>private ConfigurationDto mergeOutputSettings(final ConfigurationDto originalConfig, final List<DeviceOutputSetting> outputSettings) { if (originalConfig.getRelayConfiguration() != null) { return originalConfig; } List<RelayMapDto> relayMap = new ArrayList<>(); <START> RelayConfigurationDto relayConfig = new RelayConfigurationDto(relayMap); <END> outputSettings.forEach(outputSetting -> relayMap.add(new com.alliander.osgp.dto.valueobjects.RelayMapDto( outputSetting.getExternalId(), outputSetting.getInternalId(), RelayTypeDto.valueOf(outputSetting.getOutputType().toString()), outputSetting.getAlias())) ); return new ConfigurationDto(originalConfig.getLightType(), originalConfig.getDaliConfiguration(), relayConfig, originalConfig.getShortTermHistoryIntervalMinutes(), originalConfig.getPreferredLinkType(), originalConfig.getMeterType(), originalConfig.getLongTermHistoryInterval(), originalConfig.getLongTermHistoryIntervalType()); }</code><technical_language>This work. type RelayConfigurationDto creates a new instance of array. Therefore, loop/lambda add RelayMapDto instances new instance of array in RelayConfigurationDto</technical_language>

Target:
private ConfigurationDto mergeOutputSettings(final ConfigurationDto originalConfig, final List<DeviceOutputSetting> outputSettings) { if (originalConfig.getRelayConfiguration() != null && originalConfig.getRelayConfiguration().getRelayMap() != null && !originalConfig.getRelayConfiguration().getRelayMap().isEmpty()) { return originalConfig; } final List<RelayMapDto> relayMap = new ArrayList<>(); outputSettings.forEach(outputSetting -> relayMap.add(new com.alliander.osgp.dto.valueobjects.RelayMapDto( outputSetting.getExternalId(), outputSetting.getInternalId(), RelayTypeDto.valueOf(outputSetting.getOutputType().toString()), outputSetting.getAlias())) ); final RelayConfigurationDto relayConfig = new RelayConfigurationDto(relayMap); return new ConfigurationDto(originalConfig.getLightType(), originalConfig.getDaliConfiguration(), relayConfig, originalConfig.getShortTermHistoryIntervalMinutes(), originalConfig.getPreferredLinkType(), originalConfig.getMeterType(), originalConfig.getLongTermHistoryInterval(), originalConfig.getLongTermHistoryIntervalType()); }
Source:
<code>public void testGetRangerAWSCloudStorageServiceConfigs() { CmTemplateProcessor templateProcessor = mock(CmTemplateProcessor.class); TemplatePreparationObject preparationObject = getTemplatePreparationObjectForAWS(true) .withBlueprintView(mock(BlueprintView.class)) .withProductDetails(new ClouderaManagerRepo().withVersion("7.2.1"), List.of()) .build(); List<ApiClusterTemplateConfig> serviceConfigs = underTest.getServiceConfigs(templateProcessor, preparationObject); assertEquals(1, serviceConfigs.size()); <START> assertEquals(RANGER_HDFS_AUDIT_URL, serviceConfigs.get(0).getName()); <END> assertEquals("s3a://bucket/ranger/auditlogs", serviceConfigs.get(0).getValue()); }</code><technical_language>This is recommended. tests importing constants. reason is if do this, if a typo in "ranger_plugin_hdfs_audit_url", catching it. making this constant explicit in tests, a developer a conscious decision making change for constants</technical_language>

Target:
public void testGetRangerAWSCloudStorageServiceConfigs() { CmTemplateProcessor templateProcessor = mock(CmTemplateProcessor.class); TemplatePreparationObject preparationObject = getTemplatePreparationObjectForAWS(true) .withBlueprintView(mock(BlueprintView.class)) .withProductDetails(new ClouderaManagerRepo().withVersion("7.2.1"), List.of()) .build(); List<ApiClusterTemplateConfig> serviceConfigs = underTest.getServiceConfigs(templateProcessor, preparationObject); assertEquals(1, serviceConfigs.size()); assertEquals("ranger_plugin_hdfs_audit_url", serviceConfigs.get(0).getName()); assertEquals("s3a://bucket/ranger/auditlogs", serviceConfigs.get(0).getValue()); }
Source:
<code>public Collection<List<String>> getLinesToDisplay(JobOutput output){ if(this.model.getSelectionTarget() == SelectionTarget.TASK_TARGET){ Task task = this.parentController.getSelectedTask(); List<String> lines = output.getLines(task); <START> Collection<List<String>> result = new ArrayList<List<String>>(); <END> if(lines != null){ result.add(lines); } return result; } else{ return output.getLines(); } }</code><technical_language>initialized capacity</technical_language>

Target:
public Collection<List<String>> getLinesToDisplay(JobOutput output){ if(this.model.getSelectionTarget() == SelectionTarget.TASK_TARGET){ Task task = this.parentController.getSelectedTask(); List<String> lines = output.getLines(task); Collection<List<String>> result = new ArrayList<List<String>>(1); if(lines != null){ result.add(lines); } return result; } else{ return output.getLines(); } }
Source:
<code>private void verboseTroubleStatusHandler(EventObject event) { DSCAlarmEvent dscAlarmEvent = (DSCAlarmEvent) event; APIMessage apiMessage = dscAlarmEvent.getAPIMessage(); DSCAlarmItemType[] dscAlarmItemTypes = { DSCAlarmItemType.PANEL_SERVICE_REQUIRED, DSCAlarmItemType.PANEL_AC_TROUBLE, DSCAlarmItemType.PANEL_TELEPHONE_TROUBLE, DSCAlarmItemType.PANEL_FTC_TROUBLE, DSCAlarmItemType.PANEL_ZONE_FAULT, DSCAlarmItemType.PANEL_ZONE_TAMPER, DSCAlarmItemType.PANEL_ZONE_LOW_BATTERY, DSCAlarmItemType.PANEL_TIME_LOSS }; String itemName; int bitField = Integer.decode("0x" + apiMessage.getAPIData()); int[] masks = { 1, 2, 4, 8, 16, 32, 64, 128 }; int[] bits = new int[8]; for (int i = 0; i < 8; i++) { bits[i] = bitField & masks[i]; itemName = getItemName(dscAlarmItemTypes[i], 0, 0); <START> if (itemName != "") { <END> updateItem(itemName, bits[i] != 0 ? 1 : 0, ""); } } }</code><technical_language>I add this line, comparing a String operator work accidentally. change (and other occurrences) if (!("".equals(itemName)) if (StringUtils.isNotEmpty(itemName))</technical_language>

Target:
private void verboseTroubleStatusHandler(EventObject event) { DSCAlarmEvent dscAlarmEvent = (DSCAlarmEvent) event; APIMessage apiMessage = dscAlarmEvent.getAPIMessage(); DSCAlarmItemType[] dscAlarmItemTypes = { DSCAlarmItemType.PANEL_SERVICE_REQUIRED, DSCAlarmItemType.PANEL_AC_TROUBLE, DSCAlarmItemType.PANEL_TELEPHONE_TROUBLE, DSCAlarmItemType.PANEL_FTC_TROUBLE, DSCAlarmItemType.PANEL_ZONE_FAULT, DSCAlarmItemType.PANEL_ZONE_TAMPER, DSCAlarmItemType.PANEL_ZONE_LOW_BATTERY, DSCAlarmItemType.PANEL_TIME_LOSS }; String itemName; int bitField = Integer.decode("0x" + apiMessage.getAPIData()); int[] masks = { 1, 2, 4, 8, 16, 32, 64, 128 }; int[] bits = new int[8]; for (int i = 0; i < 8; i++) { bits[i] = bitField & masks[i]; itemName = getItemName(dscAlarmItemTypes[i], 0, 0); if (StringUtils.isNotEmpty(itemName)) { updateItem(itemName, bits[i] != 0 ? 1 : 0, ""); } } }
Source:
<code>public LObject<T> nextObject() { LObject<T> object = queue.poll(); if (object != null) { queue.add(object); <START> } <END> return object; }</code><technical_language>I this do job: <LINK_0></technical_language>

Target:
public LObject<T> nextObject() { return queue.peek(); }
Source:
<code>private String buildUpdateExistingPaymentWorksVendorInStagingTableSql(String pmwVendorRequestId, String pmwRequestStatus, String kfsVendorProcessingStatus, String kfsAchProcessingStatus, String kfsVendorDocumentNumber, Timestamp processingTimeStamp) { StringBuilder sql = new StringBuilder(); sql.append("update kfs.cu_pmw_vendor_t "); sql.append("set pmw_req_stat = '" + pmwRequestStatus); sql.append("', kfs_vnd_proc_stat = '" + kfsVendorProcessingStatus); <START> sql.append("', proc_ts = '" + PaymentWorksDataTransformationService.PROCESSING_TIMESTAMP_SQL_FORMATTER.format(processingTimeStamp)); <END> if (StringUtils.isNotBlank(kfsAchProcessingStatus)) { sql.append("', kfs_ach_proc_stat = '" + kfsAchProcessingStatus); } if (StringUtils.isNotBlank(kfsAchProcessingStatus)) { sql.append("', pven_fdoc_nbr = '" + kfsVendorDocumentNumber); } sql.append("' where pmw_vnd_req_id = '" + pmwVendorRequestId + "'"); return sql.toString(); }</code><technical_language>dateTimeService instead of this custom formatter</technical_language>

Target:
private String buildUpdateExistingPaymentWorksVendorInStagingTableSql(String pmwVendorRequestId, String pmwRequestStatus, String kfsVendorProcessingStatus, String kfsAchProcessingStatus, String kfsVendorDocumentNumber, Timestamp processingTimeStamp) { StringBuilder sql = new StringBuilder(); sql.append("update kfs.cu_pmw_vendor_t "); sql.append("set pmw_req_stat = '" + pmwRequestStatus); sql.append("', kfs_vnd_proc_stat = '" + kfsVendorProcessingStatus); sql.append("', proc_ts = '" + PROCESSING_TIMESTAMP_SQL_FORMATTER.format(processingTimeStamp)); if (StringUtils.isNotBlank(kfsAchProcessingStatus)) { sql.append("', kfs_ach_proc_stat = '" + kfsAchProcessingStatus); } if (StringUtils.isNotBlank(kfsVendorDocumentNumber)) { sql.append("', pven_fdoc_nbr = '" + kfsVendorDocumentNumber); } sql.append("' where pmw_vnd_req_id = '" + pmwVendorRequestId + "'"); return sql.toString(); }
Source:
<code>public static <T extends Annotation> Object invokeStaticMethodWithAnnotation(Class<?> clazzWithMethod, Class<T> annotationClass, Class<?>... methodReturnTypes) { List<Method> annotatedMethods = Arrays.stream(clazzWithMethod.getDeclaredMethods()).filter( method -> method.isAnnotationPresent(annotationClass)).collect(Collectors.toList()); if(annotatedMethods.size() > 1){ throw new RedDeerException("More than one method is annotated with "+annotationClass); } if(annotatedMethods.size() == 1){ try { <START> boolean methodFound = false; <END> for(Class<?> methodReturnType: methodReturnTypes){ Class<?> mrt = annotatedMethods.get(0).getReturnType(); if (annotatedMethods.get(0).getReturnType().isAssignableFrom(methodReturnType)) { methodFound = true; } } if(!methodFound){ throw new RedDeerException("Method annotated with annotation " + annotationClass + " does not have specified return type " + methodReturnTypes); } return annotatedMethods.get(0).invoke(null, (Object[]) null); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new RedDeerException("Something were wrong when executing a method annotated with " + " annotation " + annotationClass, e); } } return null; }</code><technical_language>Cosmetic changes: Bcs. method 1 return type, dont iterate return type, a return type is found, call code line 124 (return annotatedMethods.get...invoke...). dont need methodFound variable well</technical_language>

Target:
public static <T extends Annotation> Object invokeStaticMethodWithAnnotation(Class<?> clazzWithMethod, Class<T> annotationClass, Class<?>... methodReturnTypes) { List<Method> annotatedMethods = Arrays.stream(clazzWithMethod.getDeclaredMethods()).filter( method -> method.isAnnotationPresent(annotationClass)).collect(Collectors.toList()); if(annotatedMethods.size() > 1){ throw new RedDeerException("More than one method is annotated with "+annotationClass); } if(annotatedMethods.size() == 1){ try { for(Class<?> methodReturnType: methodReturnTypes){ if (annotatedMethods.get(0).getReturnType().isAssignableFrom(methodReturnType)) { return annotatedMethods.get(0).invoke(null, (Object[]) null); } } throw new RedDeerException("Method annotated with annotation " + annotationClass + " does not have specified return type " + methodReturnTypes); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new RedDeerException("Something were wrong when executing a method annotated with " + " annotation " + annotationClass, e); } } return null; }
Source:
<code>public void setup(Context.OperatorContext context) { operatorId = context.getId(); logger.info("OperatorID from Base class: {}", operatorId); spinMillis = context.getValue(com.datatorrent.api.Context.OperatorContext.SPIN_MILLIS); factory = JCSMPFactory.onlyInstance(); JCSMPChannelProperties channelProperties = (JCSMPChannelProperties)this.properties.getProperty(JCSMPProperties.CLIENT_CHANNEL_PROPERTIES); channelProperties.setConnectRetries(Integer.parseInt(this.connectRetries)); channelProperties.setReconnectRetries(Integer.parseInt(this.reconnectRetries)); <START> reconnectRetryMillis = channelProperties.getReconnectRetryWaitInMillis(); <END> try { session = factory.createSession(this.properties, null, new PrintingSessionEventHandler()); } catch (JCSMPException e) { DTThrowable.rethrow(e); } logger.debug("Properties:\n" + properties.toString()); idempotentStorageManager.setup(context); lastCompletedWId = idempotentStorageManager.getLargestRecoveryWindow(); }</code><technical_language>Is more move this activate() createSession connect()? 2nd argument is null, is pass factory.getDefaultContext()</technical_language>

Target:
public void setup(Context.OperatorContext context) { operatorId = context.getId(); logger.debug("OperatorID: {}", operatorId); rcHandler = new ReconnectCallbackHandler(); cbHandler = new MessageHandler(arrivedTopicMessagesToProcess); factory = JCSMPFactory.onlyInstance(); JCSMPChannelProperties channelProperties = (JCSMPChannelProperties)this.properties.getProperty(JCSMPProperties.CLIENT_CHANNEL_PROPERTIES); channelProperties.setConnectRetries(this.connectRetries); channelProperties.setReconnectRetries(this.reconnectRetries); reconnectRetryMillis = channelProperties.getReconnectRetryWaitInMillis(); try { session = factory.createSession(this.properties, null, new SessionHandler()); } catch (JCSMPException e) { DTThrowable.rethrow(e); } logger.debug("Properties:\n" + properties.toString()); idempotentStorageManager.setup(context); lastCompletedWId = idempotentStorageManager.getLargestRecoveryWindow(); }
Source:
<code>public RecipeHandler(IRecipeMachine machineInstance) { this.machineInstance = machineInstance; shapedTrie = new RecipeNode(null); shapelessTrie = new RecipeNode(null); <START> shapedReverseLookupTable = new HashMap<Item, ArrayList<Pair<AbstractIngredient[], Float>>>(); <END> shapelessReverseLookupTable = new HashMap<Item, ArrayList<Pair<AbstractIngredient[], Float>>>(); }</code><technical_language>shouldnt hash maps, more identity hash maps</technical_language>

Target:
public RecipeHandler(IRecipeMachine machineInstance) { this.machineInstance = machineInstance; String uniqueName = machineInstance.getUniqueMachineName(); if (machineLookupTable.containsKey(uniqueName)) { throw new RuntimeException("Another machine named " + uniqueName + " has already been registered."); } machineLookupTable.put(uniqueName, machineInstance); shapedTrie = new RecipeNode(null); shapelessTrie = new RecipeNode(null); shapedReverseLookupTable = new IdentityHashMap<Item, List<Pair<AbstractIngredient[], Float>>>(); shapelessReverseLookupTable = new IdentityHashMap<Item, List<Pair<AbstractIngredient[], Float>>>(); }
Source:
<code>public boolean equals(Object o) { <START> return (o == this) || ((o instanceof java.util.Map) && areEqual(delegate.toJavaSet(), ((java.util.Map<?, ?>) o).entrySet())); <END> }</code><technical_language>Ditto for AbstractMap.equals .hashCode. (And in multimap.)</technical_language>

Target:
public boolean equals(Object o) { return TODO(); }
Source:
<code>public void run() { try { Thread.currentThread().setName("LeaderConnector-" + address); Socket sock = connectToLeader(); if(sock != null && sock.isConnected() && !socket.compareAndSet(null, sock)) <START> sock.close(); <END> } catch (Exception e) { LOG.error("Failed to connect to " + address, e); } finally { latch.countDown(); } }</code><technical_language>Please consider adding a short log message close a redundant connection leader</technical_language>

Target:
public void run() { try { Thread.currentThread().setName("LeaderConnector-" + address); Socket sock = connectToLeader(); if (sock != null && sock.isConnected() && !socket.compareAndSet(null, sock)) { LOG.info("Connection to the leader is already established, close the redundant connection"); sock.close(); } } catch (Exception e) { LOG.error("Failed connect to {}", address, e); } finally { latch.countDown(); } }
Source:
<code>private void openPopupPlayer(final boolean append) { if (!PermissionHelper.isPopupEnabled(activity)) { PermissionHelper.showPopupEnablementToast(activity); return; } if (!bounded) startService(false); if (player != null && player.isInFullscreen()) player.toggleFullscreen(); PlayQueue queue = setupPlayQueueForIntent(append); if (append) { NavigationHelper.enqueueOnPopupPlayer(activity, queue, false); } else { <START> Runnable onAllow = () -> NavigationHelper.playOnPopupPlayer(activity, queue, true); if (shouldAskBeforeClearingQueue()) showClearingQueueConfirmation(onAllow); else onAllow.run(); <END> } }</code><technical_language>I this piece of code is times, shouldAskBeforeClearingQueue() is in places, I shouldAskBeforeClearingQueue() replaced a function lines toghether. (also note I inverted player == null condition added @Nullable final; function name is optimal): java void replaceQueueIfUserConfirms(final Runnable onAllow) { @Nullable final PlayQueue activeQueue = player == null ? null : player.getPlayQueue(); // Player STATE_IDLE a user pressed button if (isClearingQueueConfirmationRequired(activity) && playerIsNotStopped() && activeQueue != null && !activeQueue.equals(playQueue) && activeQueue.getStreams().size() > 1) { showClearingQueueConfirmation(onAllow); } else { onAllow.run(); } } this (and occourences below) become: suggestion replaceQueueIfUserConfirms(() -> NavigationHelper.playOnPopupPlayer(activity, queue, true));</technical_language>

Target:
private void openPopupPlayer(final boolean append) { if (!PermissionHelper.isPopupEnabled(activity)) { PermissionHelper.showPopupEnablementToast(activity); return; } if (!bound) { startService(requireContext(), false); } if (player != null && player.isFullscreen()) { player.toggleFullscreen(); } final PlayQueue queue = setupPlayQueueForIntent(append); if (append) { NavigationHelper.enqueueOnPopupPlayer(activity, queue, false); } else { replaceQueueIfUserConfirms(() -> NavigationHelper .playOnPopupPlayer(activity, queue, true)); } }
Source:
<code>protected void onUpdated() { if (entity==null || !Entities.isManaged(entity)) { if (log.isDebugEnabled()) log.debug("Ignoring onUpdated when entity is not in valid state ({})", this, entity); return; } if (getConfig(DERIVE_SERVICE_PROBLEMS)) { Object newval = computeServiceProblems(); updateMapSensor(SERVICE_PROBLEMS, newval); <START> } <END> if (getConfig(DERIVE_SERVICE_NOT_UP)) { Object newval = computeServiceNotUp(); updateMapSensor(SERVICE_NOT_UP_INDICATORS, newval); } }</code><technical_language>personal preference, this harder read</technical_language>

Target:
protected void onUpdated() { if (entity==null || !Entities.isManaged(entity)) { if (log.isDebugEnabled()) log.debug("Ignoring onUpdated when entity is not in valid state ({})", this, entity); return; } if (getConfig(DERIVE_SERVICE_PROBLEMS)) { updateMapSensor(SERVICE_PROBLEMS, computeServiceProblems()); } if (getConfig(DERIVE_SERVICE_NOT_UP)) { updateMapSensor(SERVICE_NOT_UP_INDICATORS, computeServiceNotUp()); } }
Source:
<code>private JSONObject _request(Method m, String url, String json, boolean build, boolean search) throws AlgoliaException { HttpRequestBase req; switch (m) { case DELETE: req = new HttpDelete(); break; case GET: req = new HttpGet(); break; case POST: req = new HttpPost(); break; case PUT: req = new HttpPut(); break; default: throw new IllegalArgumentException("Method " + m + " is not supported"); } List<AlgoliaInnerException> errors = new ArrayList<AlgoliaInnerException>(); List<String> hosts = build ? buildHostsThatAreUp() : queryHostsThatAreUp(); for (String host : hosts) { JSONObject res = _requestByHost(req, host, url, json, errors, search); if (res != null) { hostStatuses.put(host, new HostStatus()); return res; } else { <START> hostStatuses.put(host, new HostStatus().setUp(false)); <END> } } throw AlgoliaException.from("Hosts unreachable", errors); }</code><technical_language>I remove setUp function a constructor argument. easy get default is true</technical_language>

Target:
private JSONObject _request(Method m, String url, String json, boolean build, boolean search) throws AlgoliaException { HttpRequestBase req; switch (m) { case DELETE: req = new HttpDelete(); break; case GET: req = new HttpGet(); break; case POST: req = new HttpPost(); break; case PUT: req = new HttpPut(); break; default: throw new IllegalArgumentException("Method " + m + " is not supported"); } List<AlgoliaInnerException> errors = new ArrayList<AlgoliaInnerException>(); List<String> hosts = build ? buildHostsThatAreUp() : queryHostsThatAreUp(); for (String host : hosts) { JSONObject res = _requestByHost(req, host, url, json, errors, search); if (res != null) { hostStatuses.put(host, HostStatus.up()); return res; } else { hostStatuses.put(host, HostStatus.down()); } } throw AlgoliaException.from("Hosts unreachable", errors); }
Source:
<code>protected boolean doValidate() { GeoLocation currentValue = getCurrentValue(); if (currentValue == null) { <START> return false; <END> } double latitude = currentValue.getLatitude(); double longitude = currentValue.getLongitude(); if (latitude > 90.0 || latitude < -90.0) { return false; } if (longitude > 180.0 || longitude < -180.0) { return false; } return true; }</code><technical_language>This check done in superclass</technical_language>

Target:
protected boolean doValidate() { GeoLocation currentValue = getCurrentValue(); if (currentValue != null) { double latitude = currentValue.getLatitude(); double longitude = currentValue.getLongitude(); if (latitude > 90.0 || latitude < -90.0) { return false; } if (longitude > 180.0 || longitude < -180.0) { return false; } return true; } else { return !isRequired(); } }
Source:
<code>public void deleteMembersGroup(PerunSession sess, Vo vo) throws InternalErrorException, GroupAlreadyRemovedException, GroupAlreadyRemovedFromResourceException { Group group; try { group = getGroupByName(sess, vo, VosManager.MEMBERS_GROUP); } catch (GroupNotExistsException e) { throw new ConsistencyErrorException("Built-in members group must exist.",e); } try { this.deleteAnyGroup(sess, group, true); } catch (RelationExistsException e) { throw new ConsistencyErrorException("Built-in members group cannot have any relation in this stage.", e); } catch (NotGroupMemberException | WrongAttributeValueException | WrongReferenceAttributeValueException | GroupNotExistsException | AlreadyMemberException e) { throw new ConsistencyErrorException("This exception is caused by something going wrong while deleting groups operations. " + "Members group cannot have any operations defined on it.", e); <START> } <END> }</code><technical_language>create new exception - "GroupOperationException" in method processRelation for exceptions there. throw here</technical_language>

Target:
public void deleteMembersGroup(PerunSession sess, Vo vo) throws InternalErrorException, GroupAlreadyRemovedException, GroupAlreadyRemovedFromResourceException, GroupOperationsException, GroupNotExistsException { Group group; try { group = getGroupByName(sess, vo, VosManager.MEMBERS_GROUP); } catch (GroupNotExistsException e) { throw new ConsistencyErrorException("Built-in members group must exist.",e); } try { this.deleteAnyGroup(sess, group, true); } catch (RelationExistsException e) { throw new ConsistencyErrorException("Built-in members group cannot have any relation in this stage.", e); } }
Source:
<code>public void validateCollectionElementsNotNull(Supplier<? extends Collection<?>> getter1, Supplier<? extends Collection<?>> getter2) { Collection<?> collection1 = getter1.get(); Collection<?> collection2 = getter2.get(); if (isCollectionInvalid(collection1) || <START> isCollectionInvalid(collection2)) { <END> throw new IllegalArgumentException("collection contains null elements"); } }</code><technical_language>alright microoptimization avoidance of implicit array creation, however, I feel structured code minimization in mind -- especially offloading work a worker method with. Anyway, a private method validates a collection, single-param version more unpack collection supplier, feels cleanest do of this is declare single-param version base, variadic overloads call supplier. For example: public void validateCollectionElementsNotNull(Supplier<? extends Collection<?>> getter) { Collection<?> collection = getter.get(); if (collection == null || collection.stream().anyMatch(Objects::isNull)) { throw new IllegalArgumentException("collection contains null elements"); } } public void validateCollectionElementsNotNull(Supplier<? extends Collection<?>> getter1, Supplier<? extends Collection<?>> getter2) { this.validateCollectionElementsNonNull(getter1); this.validateCollectionElementsNonNull(getter2); } //</technical_language>

Target:
public void validateCollectionElementsNotNull(Supplier<? extends Collection<?>> getter1, Supplier<? extends Collection<?>> getter2) { validateCollectionElementsNotNull(getter1); validateCollectionElementsNotNull(getter2); }
Source:
<code>public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (holder instanceof ReaderPostViewHolder) { renderPost(position, (ReaderPostViewHolder) holder); } else if (holder instanceof ReaderXPostViewHolder) { renderXPost(position, (ReaderXPostViewHolder) holder); } else if (holder instanceof SiteHeaderViewHolder) { <START> SiteHeaderViewHolder blogHolder = (SiteHeaderViewHolder) holder; <END> blogHolder.mSiteHeaderView.setOnBlogInfoLoadedListener(mBlogInfoLoadedListener); if (isDiscover()) { blogHolder.mSiteHeaderView.loadBlogInfo(ReaderConstants.DISCOVER_SITE_ID, 0); } else { blogHolder.mSiteHeaderView.loadBlogInfo(mCurrentBlogId, mCurrentFeedId); } } else if (holder instanceof TagHeaderViewHolder) { TagHeaderViewHolder tagHolder = (TagHeaderViewHolder) holder; tagHolder.mTagHeaderView.setCurrentTag(mCurrentTag); } else if (holder instanceof GapMarkerViewHolder) { GapMarkerViewHolder gapHolder = (GapMarkerViewHolder) holder; gapHolder.mGapMarkerView.setCurrentTag(mCurrentTag); } }</code><technical_language>Do change variable name headerViewHolder siteHolder a BlogInfoViewHolder anymore</technical_language>

Target:
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (holder instanceof ReaderPostViewHolder) { renderPost(position, (ReaderPostViewHolder) holder); } else if (holder instanceof ReaderXPostViewHolder) { renderXPost(position, (ReaderXPostViewHolder) holder); } else if (holder instanceof SiteHeaderViewHolder) { SiteHeaderViewHolder siteHolder = (SiteHeaderViewHolder) holder; siteHolder.mSiteHeaderView.setOnBlogInfoLoadedListener(mBlogInfoLoadedListener); if (isDiscover()) { siteHolder.mSiteHeaderView.loadBlogInfo(ReaderConstants.DISCOVER_SITE_ID, 0); } else { siteHolder.mSiteHeaderView.loadBlogInfo(mCurrentBlogId, mCurrentFeedId); } } else if (holder instanceof TagHeaderViewHolder) { TagHeaderViewHolder tagHolder = (TagHeaderViewHolder) holder; tagHolder.mTagHeaderView.setCurrentTag(mCurrentTag); } else if (holder instanceof GapMarkerViewHolder) { GapMarkerViewHolder gapHolder = (GapMarkerViewHolder) holder; gapHolder.mGapMarkerView.setCurrentTag(mCurrentTag); } }
Source:
<code>protected void AddVmTemplateImages() { Guid srcStorageDomain = mImages.get(0).getstorage_id().getValue(); Guid vmSnapshotId = Guid.NewGuid(); for (DiskImage diskImage : mImages) { CreateImageTemplateParameters createParams = new CreateImageTemplateParameters(diskImage.getId(), <START> getVmTemplateId(), getVmTemplateName(), getVmId()); <END> if(diskImage.getstorage_id() != null && !diskImage.getstorage_id().equals(Guid.Empty)) { createParams.setStorageDomainId(diskImage.getstorage_id().getValue()); } else { createParams.setStorageDomainId(srcStorageDomain); } createParams.setVmSnapshotId(vmSnapshotId); createParams.setEntityId(getParameters().getEntityId()); createParams.setDestinationStorageDomainId(getStorageDomainId().getValue()); createParams.setParentParemeters(getParameters()); getParameters().getImagesParameters().add(createParams); VdcReturnValueBase retValue = Backend.getInstance().runInternalAction( VdcActionType.CreateImageTemplate, createParams); getReturnValue().getTaskIdList().addAll(retValue.getInternalTaskIdList()); } }</code><technical_language>I disk storageId equals null</technical_language>

Target:
protected void AddVmTemplateImages() { Guid srcStorageDomain = mImages.get(0).getstorage_id().getValue(); Guid vmSnapshotId = Guid.NewGuid(); for (DiskImage diskImage : mImages) { CreateImageTemplateParameters createParams = new CreateImageTemplateParameters(diskImage.getId(), getVmTemplateId(), getVmTemplateName(), getVmId()); if(!diskImage.getstorage_id().equals(Guid.Empty)) { createParams.setStorageDomainId(diskImage.getstorage_id().getValue()); } else { createParams.setStorageDomainId(srcStorageDomain); } createParams.setVmSnapshotId(vmSnapshotId); createParams.setEntityId(getParameters().getEntityId()); createParams.setDestinationStorageDomainId(getStorageDomainId().getValue()); createParams.setParentParemeters(getParameters()); getParameters().getImagesParameters().add(createParams); VdcReturnValueBase retValue = Backend.getInstance().runInternalAction( VdcActionType.CreateImageTemplate, createParams); getReturnValue().getTaskIdList().addAll(retValue.getInternalTaskIdList()); } }
Source:
<code>public PatternPathRouter.RoutableDestination<Object> getRoutableEndpoint( CarbonMessage carbonMessage) throws WebSocketEndpointAnnotationException { String uri = (String) carbonMessage.getProperty(Constants.TO); <START> LOGGER.info("path : " + uri); <END> List<PatternPathRouter.RoutableDestination<Object>> routableDestinations = endpointPatternPathRouter.getDestinations(uri); return getBestEndpoint(routableDestinations, uri); }</code><technical_language>a space word colon</technical_language>

Target:
public PatternPathRouter.RoutableDestination<Object> getRoutableEndpoint( CarbonMessage carbonMessage) throws WebSocketEndpointAnnotationException { String uri = (String) carbonMessage.getProperty(Constants.TO); List<PatternPathRouter.RoutableDestination<Object>> routableDestinations = endpointPatternPathRouter.getDestinations(uri); return getBestEndpoint(routableDestinations, uri); }