auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>@Test public void semiJoinCorrelate() { tester(false, new JdbcTest.HrSchema()) .query( "select empid, name from emps e where e.deptno in (select d.deptno from depts d)") .withHook(Hook.PLANNER, (Consumer<RelOptPlanner>) planner -> { planner.addRule(JoinToCorrelateRule.JOIN); planner.removeRule(EnumerableRules.ENUMERABLE_SEMI_JOIN_RULE); }) .explainContains("" + "EnumerableCalc(expr#0..2=[{inputs}], empid=[$t0], name=[$t2])\n" <START> + " EnumerableHashJoin(condition=[=($1, $3)], joinType=[semi])\n" <END> + " EnumerableCalc(expr#0..4=[{inputs}], proj#0..2=[{exprs}])\n" + " EnumerableTableScan(table=[[s, emps]])\n" + " EnumerableTableScan(table=[[s, depts]])") .returnsUnordered( "empid=100; name=Bill", "empid=110; name=Theodore", "empid=150; name=Sebastian"); }</code><technical_language>@danny0405 , this Correlate longer works? Previous plan correlate while new is HashJoin. This a degradation</technical_language>

Target:
@Test public void semiJoinCorrelate() { tester(false, new JdbcTest.HrSchema()) .query( "select empid, name from emps e where e.deptno in (select d.deptno from depts d)") .withHook(Hook.PLANNER, (Consumer<RelOptPlanner>) planner -> { planner.addRule(JoinToCorrelateRule.INSTANCE); planner.removeRule(EnumerableRules.ENUMERABLE_JOIN_RULE); }) .explainContains("" + "EnumerableCalc(expr#0..3=[{inputs}], empid=[$t1], name=[$t3])\n" + " EnumerableCorrelate(correlation=[$cor2], joinType=[inner], requiredColumns=[{0}])\n" + " EnumerableAggregate(group=[{0}])\n" + " EnumerableTableScan(table=[[s, depts]])\n" + " EnumerableCalc(expr#0..4=[{inputs}], expr#5=[$cor2], expr#6=[$t5.deptno], expr#7=[=($t1, $t6)], proj#0..2=[{exprs}], $condition=[$t7])\n" + " EnumerableTableScan(table=[[s, emps]])") .returnsUnordered( "empid=100; name=Bill", "empid=110; name=Theodore", "empid=150; name=Sebastian"); }
Source:
<code>public void removeInventoryListener(InventoryListener listener) { try { <START> this.inventoryListenerSupport.inventoryListenerRWLock.writeLock().lock(); <END> status.assertInitialOrStopped(getClass(), "removeInventoryListener()"); this.inventoryListenerSupport.inventoryListeners.remove(listener); LOG.debugf("Removed inventory listener [%s] for endpoint [%s]", listener, getMonitoredEndpoint()); } finally { this.inventoryListenerSupport.inventoryListenerRWLock.writeLock().unlock(); } }</code><technical_language>acquisition of locks (just before) entering try-catch. if wrong, finally block is try unlock a lock acquired. swap lines 263-264. Do for others</technical_language>

Target:
public void removeInventoryListener(InventoryListener listener) { this.inventoryListenerSupport.inventoryListenerRWLock.writeLock().lock(); try { status.assertInitialOrStopped(getClass(), "removeInventoryListener()"); this.inventoryListenerSupport.inventoryListeners.remove(listener); LOG.debugf("Removed inventory listener [%s] for endpoint [%s]", listener, getMonitoredEndpoint()); } finally { this.inventoryListenerSupport.inventoryListenerRWLock.writeLock().unlock(); } }
Source:
<code>public void contains_asEmptyListAfterClassRemovedInOtherThread() { final String CLASS_NAME = "KingsAndQueens"; final CountDownLatch bgRealmClosed = new CountDownLatch(1); DynamicRealm realm = initializeDynamicRealm(CLASS_NAME); RealmResults<DynamicRealmObject> results = realm.where(CLASS_NAME).findAll(); DynamicRealmObject object = realm.where(CLASS_NAME).findFirst(); assertTrue(results.contains(object)); new Thread(new Runnable() { @Override public void run() { <START> DynamicRealm bgRealm = DynamicRealm.getInstance(realmConfig); <END> removeClassFromDynamicRealm(bgRealm, CLASS_NAME); bgRealm.close(); bgRealmClosed.countDown(); } }).start(); TestHelper.awaitOrFail(bgRealmClosed); assertFalse(results.contains(object)); realm.close(); }</code><technical_language>I realm.getConfiguration() instead. Right clear Realms config</technical_language>

Target:
public void contains_asEmptyListAfterClassRemovedInOtherThread() { final String CLASS_NAME = "KingsAndQueens"; final CountDownLatch bgRealmClosed = new CountDownLatch(1); DynamicRealm realm = initializeDynamicRealm(CLASS_NAME); final RealmConfiguration config = realm.getConfiguration(); RealmResults<DynamicRealmObject> results = realm.where(CLASS_NAME).findAll(); DynamicRealmObject object = realm.where(CLASS_NAME).findFirst(); assertTrue(results.contains(object)); new Thread(new Runnable() { @Override public void run() { DynamicRealm bgRealm = DynamicRealm.getInstance(config); removeClassFromDynamicRealm(bgRealm, CLASS_NAME); bgRealm.close(); bgRealmClosed.countDown(); } }).start(); TestHelper.awaitOrFail(bgRealmClosed); assertFalse(results.contains(object)); realm.close(); }
Source:
<code>public List<String> getSuggestedNames(String queryString, int maxResults) throws GeoEntryQueryException { return Collections.emptyList(); <START> } <END></code><technical_language>I log if returning empty list. empty list error suggests results found, in this case method is implemented</technical_language>

Target:
public List<String> getSuggestedNames(String queryString, int maxResults) throws GeoEntryQueryException { LOGGER.debug("Suggestion query not implemented."); return Collections.emptyList(); }
Source:
<code>private void discoverCoAP(InetAddress address) { Map<String, Object> properties = new HashMap<>(4); properties.put(PROPERTY_COAP_SERVER, address.getHostAddress()); ThingUID uid = new ThingUID(THING_TYPE_SAMPLE, "iotiny-" + address.getHostAddress().substring(address.getHostAddress().lastIndexOf('.') + 1)); if (uid != null) { DiscoveryResult result = DiscoveryResultBuilder.create(uid).withProperties(properties) .withLabel("Internet Of Tiny: " + address.getHostAddress()).build(); thingDiscovered(result); } <START> <END> }</code><technical_language>drop this empty line</technical_language>

Target:
private void discoverCoAP(InetAddress address) { Map<String, Object> properties = new HashMap<>(4); properties.put(PROPERTY_COAP_SERVER, address.getHostAddress()); ThingUID uid = new ThingUID(THING_TYPE, "iotiny-" + address.getHostAddress().substring(address.getHostAddress().lastIndexOf('.') + 1)); if (uid != null) { DiscoveryResult result = DiscoveryResultBuilder.create(uid).withProperties(properties) .withLabel("Internet Of Tiny: " + address.getHostAddress()).build(); thingDiscovered(result); } }
Source:
<code>default void init(ContainerContext containerContext, JobContext jobContext, ExternalContext externalContext) { <START> throw new UnsupportedOperationException("init() is not supported in " + this.getClass().getName()); <END> }</code><technical_language>Is this a noop throwing exception? call init right place in store lifecycle</technical_language>

Target:
default void init(ContainerContext containerContext, JobContext jobContext, ExternalContext externalContext) { }
Source:
<code>public void assertMarkedAsDeleted(INodesInPath iip, String snapshotName) throws IOException { final INodeDirectory dir = getSnapshottableRoot(iip); final Snapshot.Root snapshotRoot = dir.getDirectorySnapshottableFeature() .getSnapshotByName(dir, snapshotName) .getRoot(); <START> if (snapshotRoot.isMarkedAsDeleted()) { <END> throw new IllegalStateException("Failed to gcDeletedSnapshot " + snapshotName + " from " + dir.getFullPathName() + ": snapshot is not marked as deleted"); } }</code><technical_language>check !snapshotRoot.isMarkedAsDeleted()</technical_language>

Target:
public void assertMarkedAsDeleted(INodesInPath iip, String snapshotName) throws IOException { final INodeDirectory dir = getSnapshottableRoot(iip); final Snapshot.Root snapshotRoot = dir.getDirectorySnapshottableFeature() .getSnapshotByName(dir, snapshotName) .getRoot(); if (!snapshotRoot.isMarkedAsDeleted()) { throw new SnapshotException("Failed to gcDeletedSnapshot " + snapshotName + " from " + dir.getFullPathName() + ": snapshot is not marked as deleted"); } }
Source:
<code>public void testUnionDeterminism() { { CompiledPlan plan = compileAdHocPlan("select B, DESC from T2 UNION select A, DESC from T1"); boolean isDeterministic = plan.isOrderDeterministic(); assertEquals(false, isDeterministic); } { CompiledPlan plan = compileAdHocPlan("(select B, DESC from T2 UNION select A, DESC from T1) order by B asc"); boolean isDeterministic = plan.isOrderDeterministic(); assertEquals(false, isDeterministic); } { CompiledPlan plan = compileAdHocPlan("(select B, DESC from T2 UNION select A, DESC from T1) order by B asc, DESC desc"); boolean isDeterministic = plan.isOrderDeterministic(); <START> assertEquals(false, isDeterministic); <END> } { CompiledPlan plan = compileAdHocPlan("select B, DESC from T2 UNION (select A, DESC from T1 order by a, desc) " + "order by B asc, DESC desc"); boolean isDeterministic = plan.isOrderDeterministic(); assertEquals(true, isDeterministic); } }</code><technical_language>assertEquals(false, --> assertFalse(</technical_language>

Target:
public void testUnionDeterminism() { assertIsNonDeterministic("select B, DESC from T2 UNION select A, DESC from T1"); assertIsNonDeterministic("(select B, DESC from T2 UNION select A, DESC from T1) order by B asc"); assertIsDeterministic("(select B, DESC from T2 UNION select A, DESC from T1) order by B asc, DESC desc"); assertIsNonDeterministic("(select a, b, c from t7 union select a, b, c from t8) order by a, b"); assertIsDeterministic("((select a, b, c from t7 order by a, b) union (select a, b, c from t7 order by a, b))"); assertIsNonDeterministic("((select a, b, c from t7 order by a, b) union (select a, b, c from t7 order by a, b)) order by a"); assertIsNonDeterministic("((select a, b, c from t7) union (select a, b, c from t7)) order by a, b"); assertIsNonDeterministic("((select a, b, cast(c as bigint) from t7) union (select a, b, c + 1 from t7)) order by a, b"); }
Source:
<code>protected Map<String, TraceTypeHelper> getTraceTypeMap(String selected) { Map<String, TraceTypeHelper> traceTypeMap = new TreeMap<>(); for (TraceTypeHelper helper : TmfTraceType.getTraceTypeHelpers()) { if (!helper.isExperimentType() && (helper.isEnabled() || <START> (selected != null && <END> helper.getTraceTypeId().equals(selected)))) { traceTypeMap.put(helper.getLabel(), helper); } } return traceTypeMap; }</code><technical_language>remove, if null equal, helper's id null</technical_language>

Target:
protected Map<String, TraceTypeHelper> getTraceTypeMap(String selected) { Map<String, TraceTypeHelper> traceTypeMap = new TreeMap<>(); for (TraceTypeHelper helper : TmfTraceType.getTraceTypeHelpers()) { if (!helper.isExperimentType() && (helper.isEnabled() || (helper.getTraceTypeId().equals(selected)))) { traceTypeMap.put(helper.getLabel(), helper); } } return traceTypeMap; }
Source:
<code>public static List<ColumnModel> expandFromAggregation(List<ColumnAggregation> aggregations){ List<ColumnModel> results = new LinkedList<>(); for(ColumnAggregation aggregation: aggregations) { String[] typeSplit = aggregation.getColumnTypeConcat().split(","); for(String typeString: typeSplit) { ColumnModel model = new ColumnModel(); model.setName(aggregation.getColumnName()); ColumnType type = AnnotationType.valueOf(typeString).getColumnType(); if(aggregation.getListSize() > 1){ try { <START> type = ColumnTypeListMappings.forNonListType(type).getListType(); <END> } catch (IllegalArgumentException e){ } } model.setColumnType(type); if(ColumnType.STRING == type || ColumnType.STRING_LIST==type) { model.setMaximumSize(aggregation.getMaxStringElementSize()); } results.add(model); } } return results; }</code><technical_language>optional work illegal arg for getListType();</technical_language>

Target:
public static List<ColumnModel> expandFromAggregation(List<ColumnAggregation> aggregations){ List<ColumnModel> results = new LinkedList<>(); for(ColumnAggregation aggregation: aggregations) { String[] typeSplit = aggregation.getColumnTypeConcat().split(","); for(String typeString: typeSplit) { ColumnModel model = new ColumnModel(); model.setName(aggregation.getColumnName()); ColumnType type = AnnotationType.valueOf(typeString).getColumnType(); if(aggregation.getMaxListSize() > 1){ try { type = ColumnTypeListMappings.listType(type); } catch (IllegalArgumentException e){ } } model.setColumnType(type); if(ColumnType.STRING == type || ColumnType.STRING_LIST==type) { model.setMaximumSize(aggregation.getMaxStringElementSize()); } results.add(model); } } return results; }
Source:
<code>public void testSplitMultiValuedCellsTextCase() throws Exception { AbstractOperation op = new MultiValuedCellSplitOperation( "Value", "Key", "(?<=[a-z]|[a-z][\\s])(?=[A-Z])", true); Process process = op.createProcess(project, new Properties()); process.performImmediate(); int keyCol = project.columnModel.getColumnByName("Key").getCellIndex(); int valueCol = project.columnModel.getColumnByName("Value").getCellIndex(); Assert.assertEquals(project.rows.get(0).getCellValue(keyCol), "Record_1"); Assert.assertEquals(project.rows.get(0).getCellValue(valueCol), "one:two;three four;five"); Assert.assertEquals(project.rows.get(1).getCellValue(keyCol), null); Assert.assertEquals(project.rows.get(1).getCellValue(valueCol), "Six "); Assert.assertEquals(project.rows.get(2).getCellValue(keyCol), null); Assert.assertEquals(project.rows.get(2).getCellValue(valueCol), "Seven"); Assert.assertEquals(project.rows.get(3).getCellValue(keyCol), null); <START> Assert.assertEquals(project.rows.get(3).getCellValue(valueCol), "Eight;nine91011twelve thirteen 14Fifteen"); <END> }</code><technical_language>Test cases including accented upper case characters needed here. Unicode digits 0-9 range</technical_language>

Target:
public void testSplitMultiValuedCellsTextCase() throws Exception { AbstractOperation op = new MultiValuedCellSplitOperation( "Value", "Key", "(?<=\\p{Lower}|[\\p{Lower}][\\s])(?=\\p{Upper})", true); Process process = op.createProcess(project, new Properties()); process.performImmediate(); int keyCol = project.columnModel.getColumnByName("Key").getCellIndex(); int valueCol = project.columnModel.getColumnByName("Value").getCellIndex(); Assert.assertEquals(project.rows.get(0).getCellValue(keyCol), "Record_1"); Assert.assertEquals(project.rows.get(0).getCellValue(valueCol), "one:two;three four;five"); Assert.assertEquals(project.rows.get(1).getCellValue(keyCol), null); Assert.assertEquals(project.rows.get(1).getCellValue(valueCol), "Six "); Assert.assertEquals(project.rows.get(2).getCellValue(keyCol), null); Assert.assertEquals(project.rows.get(2).getCellValue(valueCol), "Sevè"); Assert.assertEquals(project.rows.get(3).getCellValue(keyCol), null); Assert.assertEquals(project.rows.get(3).getCellValue(valueCol), "Ëight;niné91011twelve thirteen 14Àifteen"); }
Source:
<code>protected void checkForm(String prefix, String title, String description, boolean checkAllMetadata, boolean isEdit) { LayoutElement form = new LayoutElement(driver, prefix); try { Assert.assertEquals(title, form.getWidget("nxw_title").getValue(isEdit)); } catch (NoSuchElementException e) { <START> throw e; <END> } if (description != null) { Assert.assertEquals(description, form.getWidget("nxw_description").getValue(isEdit)); } if (checkAllMetadata) { Assert.assertEquals("test string", form.getWidget("nxw_simpleString").getValue(isEdit)); Assert.assertEquals("Oct 11, 2012", form.getWidget("nxw_simpleDate", DateWidgetElement.class).getValue(isEdit)); FileWidgetElement file = form.getWidget("nxw_simpleBlob", FileWidgetElement.class); String filename = file.getFilename(isEdit); Assert.assertTrue(filename != null); Assert.assertTrue(filename.startsWith("Studio test")); Assert.assertTrue(filename.endsWith(".txt")); JSListWidgetElement list = form.getWidget("nxw_multiString", JSListWidgetElement.class); String subId = "nxw_sub0"; Assert.assertEquals("hihi", list.getSubWidget(subId, 0, false).getValue(isEdit)); Assert.assertEquals("hoho", list.getSubWidget(subId, 1, false).getValue(isEdit)); } }</code><technical_language>remove this try/catch</technical_language>

Target:
protected void checkForm(String prefix, String title, String description, boolean checkAllMetadata, boolean isEdit) { LayoutElement form = new LayoutElement(driver, prefix); Assert.assertEquals(title, form.getWidget("nxw_title").getValue(isEdit)); if (description != null) { Assert.assertEquals(description, form.getWidget("nxw_description").getValue(isEdit)); } if (checkAllMetadata) { Assert.assertEquals("test string", form.getWidget("nxw_simpleString").getValue(isEdit)); Assert.assertEquals("Oct 11, 2012", form.getWidget("nxw_simpleDate", DateWidgetElement.class).getValue(isEdit)); FileWidgetElement file = form.getWidget("nxw_simpleBlob", FileWidgetElement.class); String filename = file.getFilename(isEdit); Assert.assertTrue(filename != null); Assert.assertTrue(filename.startsWith("Studio test")); Assert.assertTrue(filename.endsWith(".txt")); JSListWidgetElement list = form.getWidget("nxw_multiString", JSListWidgetElement.class); String subId = "nxw_sub0"; Assert.assertEquals("hihi", list.getSubWidget(subId, 0, false).getValue(isEdit)); Assert.assertEquals("hoho", list.getSubWidget(subId, 1, false).getValue(isEdit)); } }
Source:
<code>public DistributedRemoteSubscriptionStorage(@Named("jgroups.config.file") String confFile) throws Exception { try { JChannel channel = new JChannel(confFile); this.lockService = new LockService(channel); channel.connect(CHANNEL_NAME); <START> subscriptions = new ReplicatedHashMap<>(channel); <END> subscriptions.start(5000); } catch (Exception e) { LOG.error("Unable to create distributed event subscriptions map.", e); throw e; } }</code><technical_language>achieve consistent state of subscribers in period of time, updates performed cluster synchronously, achieve blocking_updates property, if need manage local concurrent operations read/write locks instead of LockService</technical_language>

Target:
public DistributedRemoteSubscriptionStorage(@Named("jgroups.config.file") String confFile) throws Exception { try { JChannel channel = new JChannel(confFile); this.lockService = new LockService(channel); channel.connect(CHANNEL_NAME); subscriptions = new ReplicatedHashMap<>(channel); subscriptions.setBlockingUpdates(true); subscriptions.start(5000); } catch (Exception e) { LOG.error("Unable to create distributed event subscriptions map.", e); throw e; } }
Source:
<code>public AbstractPackageRegistry(SecurityConfig securityConfig) { <START> super(); <END> if (securityConfig != null) { this.securityConfig = securityConfig; } else { this.securityConfig = new SecurityConfig(null, null); } }</code><technical_language>needed</technical_language>

Target:
public AbstractPackageRegistry(SecurityConfig securityConfig) { if (securityConfig != null) { this.securityConfig = securityConfig; } else { this.securityConfig = new SecurityConfig(null, null); } }
Source:
<code>public static DataSource azureTableStorage( String name, String storageConnectionString, String tableName, String query, String description, DataDeletionDetectionPolicy deletionDetectionPolicy) { <START> if (StringUtils.isEmpty(name)) { <END> throw new IllegalArgumentException("name cannot be null or empty"); } if (StringUtils.isEmpty(tableName)) { throw new IllegalArgumentException("tableName cannot be null or empty"); } if (StringUtils.isEmpty(storageConnectionString)) { throw new IllegalArgumentException("storageConnectionString cannot be null or empty"); } return new DataSource() .setName(name) .setType(DataSourceType.AZURE_TABLE) .setCredentials(new DataSourceCredentials() .setConnectionString(storageConnectionString)) .setContainer(new DataContainer() .setName(tableName) .setQuery(query)) .setDescription(description) .setDataDeletionDetectionPolicy(deletionDetectionPolicy); }</code><technical_language>CoreUtils a method isNullOrEmpty replace StringUtils.isEmpty</technical_language>

Target:
public static DataSource azureTableStorage( String name, String storageConnectionString, String tableName, String query, String description, DataDeletionDetectionPolicy deletionDetectionPolicy) { if (CoreUtils.isNullOrEmpty(name)) { throw new IllegalArgumentException("name cannot be null or empty"); } if (CoreUtils.isNullOrEmpty(tableName)) { throw new IllegalArgumentException("tableName cannot be null or empty"); } if (CoreUtils.isNullOrEmpty(storageConnectionString)) { throw new IllegalArgumentException("storageConnectionString cannot be null or empty"); } return new DataSource() .setName(name) .setType(DataSourceType.AZURE_TABLE) .setCredentials(new DataSourceCredentials() .setConnectionString(storageConnectionString)) .setContainer(new DataContainer() .setName(tableName) .setQuery(query)) .setDescription(description) .setDataDeletionDetectionPolicy(deletionDetectionPolicy); }
Source:
<code>Map<String, String> getTableNameTagFor(TableReference tableRef) { String tableName = tableRef.getTablename(); if (!isSafeToLog.apply(tableRef)) { <START> tableName = "unsafeTableRef_" + obfuscate(tableRef); <END> } return ImmutableMap.of("tableName", tableName); }</code><technical_language>save some characters t_hash</technical_language>

Target:
Map<String, String> getTableNameTagFor(TableReference tableRef) { String tableName = tableRef.getTablename(); if (!isSafeToLog.apply(tableRef)) { tableName = "unsafeTable_" + obfuscate(tableRef); } return ImmutableMap.of("tableName", tableName); }
Source:
<code>public static Map<String, String> decodeHeaders(ByteBuf buffer) { int numHeaders = buffer.readUnsignedShort(); <START> Map<String, String> headers = new HashMap<>(numHeaders); <END> for (int i = 0; i < numHeaders; i++) { String key = CodecUtils.decodeString(buffer); String value = CodecUtils.decodeString(buffer); headers.put(key, value); } return headers; }</code><technical_language>this a guaranteed re-sizing of map. com.google.common.collect.Maps.newHashMapWithExpectedSize(numHeaders) instead</technical_language>

Target:
public static Map<String, String> decodeHeaders(ByteBuf buffer) { int numHeaders = buffer.readUnsignedShort(); Map<String, String> headers = Maps.newHashMapWithExpectedSize(numHeaders); for (int i = 0; i < numHeaders; i++) { String key = CodecUtils.decodeString(buffer); String value = CodecUtils.decodeString(buffer); headers.put(key, value); } return headers; }
Source:
<code><START> private void createTiledElevationSource() { <END> ArcGISTiledElevationSource tiledElevationSource = new ArcGISTiledElevationSource( Environment.getExternalStorageDirectory() + getString(R.string.local_tile_package_location)); tiledElevationSource.addLoadStatusChangedListener(loadStatusChangedEvent -> { if (loadStatusChangedEvent.getNewLoadStatus() == LoadStatus.LOADED) { mSceneView.getScene().getBaseSurface().getElevationSources().add(tiledElevationSource); } else if (loadStatusChangedEvent.getNewLoadStatus() == LoadStatus.FAILED_TO_LOAD) { logToUser(getString(R.string.error_tiled_elevation_source_load_failure_message)); } }); tiledElevationSource.loadAsync(); }</code><technical_language>put this permissions methods, for visibility</technical_language>

Target:
private void createTiledElevationSource() { ArcGISTiledElevationSource tiledElevationSource = new ArcGISTiledElevationSource( Environment.getExternalStorageDirectory() + getString(R.string.local_tile_package_location)); tiledElevationSource.addLoadStatusChangedListener(loadStatusChangedEvent -> { if (loadStatusChangedEvent.getNewLoadStatus() == LoadStatus.LOADED) { mSceneView.getScene().getBaseSurface().getElevationSources().add(tiledElevationSource); } else if (loadStatusChangedEvent.getNewLoadStatus() == LoadStatus.FAILED_TO_LOAD) { logErrorToUser(getString(R.string.error_tiled_elevation_source_load_failure_message)); } }); tiledElevationSource.loadAsync(); }
Source:
<code>private PrimitiveLongIterator partitionedOperation( Function<ReadOnlyFulltext,PrimitiveLongIterator> readerFunction ) { <START> return PrimitiveLongCollections.concat( indexReaders.parallelStream().map( readerFunction::apply ).collect( Collectors.toList() ) ); <END> }</code><technical_language>readerFunction here, apply</technical_language>

Target:
private PrimitiveLongIterator partitionedOperation( Function<ReadOnlyFulltext,PrimitiveLongIterator> readerFunction ) { return PrimitiveLongCollections.concat( indexReaders.parallelStream().map( readerFunction ).collect( Collectors.toList() ) ); }
Source:
<code>public void testChecksumPlugin() throws IOException { final ChecksumPlugin plugin = new ChecksumPlugin(); <START> final Jar jar = new Jar("jar", new File("testresources/componentsEntry/source.jar")); <END> final Processor p = new Processor(); plugin.setReporter(p); final ChecksumDTO dto = (ChecksumDTO) plugin.extract(jar, Locale.forLanguageTag("und")); assertNotNull(dto.md5); assertNotNull(dto.sha1); assertNotNull(dto.sha256); assertTrue(p.isOk()); }</code><technical_language>close jar object. Put in a try-with-resource</technical_language>

Target:
public void testChecksumPlugin() throws IOException { final ChecksumPlugin plugin = new ChecksumPlugin(); try (final Jar jar = new Jar("jar", new File("testresources/componentsEntry/source.jar")); Processor p = new Processor()) { plugin.setReporter(p); final ChecksumDTO dto = (ChecksumDTO) plugin.extract(jar, Locale.forLanguageTag("und")); assertNotNull(dto.md5); assertNotNull(dto.sha1); assertNotNull(dto.sha256); assertTrue(p.isOk()); } }
Source:
<code>protected void doSingleFileUpdate(String indexId, String siteName, ContentStoreService contentStoreService, Context context, String path, boolean delete, UpdateDetail updateDetail, UpdateStatus updateStatus, Map<String, String> metadata) { if (delete) { doDelete(indexId, siteName, path, updateStatus); } else { Content binaryContent = contentStoreService.getContent(context, path); if (binaryContent != null && binaryContent.getLength() > 0) { if (binaryContent.getLength() > maxFileSize) { <START> logger.info("Skipping large binary file @ {}", path); <END> } else { doUpdateContent(indexId, siteName, path, binaryContent, updateDetail, updateStatus, metadata); } } } }</code><technical_language>@sumerjabri @jdrossl this a warning</technical_language>

Target:
protected void doSingleFileUpdate(String indexId, String siteName, ContentStoreService contentStoreService, Context context, String path, boolean delete, UpdateDetail updateDetail, UpdateStatus updateStatus, Map<String, String> metadata) { if (delete) { doDelete(indexId, siteName, path, updateStatus); } else { Content binaryContent = contentStoreService.getContent(context, path); if (binaryContent != null && binaryContent.getLength() > 0) { if (binaryContent.getLength() > maxFileSize) { logger.warn("Skipping large binary file @ {}", path); } else { doUpdateContent(indexId, siteName, path, binaryContent, updateDetail, updateStatus, metadata); } } } }
Source:
<code>private void cyclePreview(int newPosition) { PreviewPreferences previewPreferences = Globals.prefs.getPreviewPreferences() .getBuilder() .withPreviewCyclePosition(newPosition) .build(); <START> updateLayout(previewPreferences); <END> }</code><technical_language>Is need store new layout in preferences? (Should done in updateLayout)</technical_language>

Target:
private void cyclePreview(int newPosition) { PreviewPreferences previewPreferences = preferences.getPreviewPreferences() .getBuilder() .withPreviewCyclePosition(newPosition) .build(); updateLayout(previewPreferences); }
Source:
<code>@Test public void onlyScaleDownOriginalSmaller() throws Exception { Bitmap source = Bitmap.createBitmap(50, 50, ARGB_8888); Request data = new Request.Builder(URI_1).resize(100, 100).onlyScaleDown().build(); Bitmap result = transformResult(data, source, 0); <START> <END> ShadowBitmap shadowBitmap = shadowOf(result); assertThat(shadowBitmap.getCreatedFromBitmap()).isNull(); assertThat(shadowBitmap.getCreatedFromBitmap()).isNotSameAs(source); }</code><technical_language>I want assertThat(result).isSameAs(source);</technical_language>

Target:
@Test public void onlyScaleDownOriginalSmaller() throws Exception { Bitmap source = Bitmap.createBitmap(50, 50, ARGB_8888); Request data = new Request.Builder(URI_1).resize(100, 100).onlyScaleDown().build(); Bitmap result = transformResult(data, source, 0); assertThat(result).isSameAs(source); ShadowBitmap shadowBitmap = shadowOf(result); assertThat(shadowBitmap.getCreatedFromBitmap()).isNull(); assertThat(shadowBitmap.getCreatedFromBitmap()).isNotSameAs(source); }
Source:
<code>public boolean deleteDevice(@NotNull String deviceId) { <START> DeviceDeleteRequest deviceDeleteRequest = new DeviceDeleteRequest(findById(deviceId)); <END> Request request = Request.newBuilder() .withBody(deviceDeleteRequest) .build(); CompletableFuture<String> future = new CompletableFuture<>(); Consumer<Response> responseConsumer = response -> { Action resAction = response.getBody().getAction(); if (resAction.equals(Action.DEVICE_DELETE_RESPONSE)) { future.complete(response.getBody().getAction().name()); } else { logger.warn("Unknown action received from backend {}", resAction); } }; rpcClient.call(request, responseConsumer); return deviceDao.deleteById(deviceId) != 0; }</code><technical_language>Device's existence checked creating calling request</technical_language>

Target:
public boolean deleteDevice(@NotNull String deviceId) { DeviceVO deviceVO = deviceDao.findById(deviceId); if (deviceVO == null) { logger.error("Device with ID not found", deviceId); return false; } DeviceDeleteRequest deviceDeleteRequest = new DeviceDeleteRequest(deviceId); Request request = Request.newBuilder() .withBody(deviceDeleteRequest) .build(); CompletableFuture<String> future = new CompletableFuture<>(); Consumer<Response> responseConsumer = response -> { Action resAction = response.getBody().getAction(); if (resAction.equals(Action.DEVICE_DELETE_RESPONSE)) { future.complete(response.getBody().getAction().name()); } else { logger.warn("Unknown action received from backend {}", resAction); } }; rpcClient.call(request, responseConsumer); return deviceDao.deleteById(deviceId) != 0; }
Source:
<code>public void onPartitionBecomeInactiveFromStandby(String partitionName) { PartitionStateChangeListener storageManagerListener = partitionStateChangeListeners.get(StateModelListenerType.StorageManagerListener); if (storageManagerListener != null) { storageManagerListener.onPartitionBecomeInactiveFromStandby(partitionName); } PartitionStateChangeListener replicationManagerListener = partitionStateChangeListeners.get(StateModelListenerType.ReplicationManagerListener); if (replicationManagerListener != null) { replicationManagerListener.onPartitionBecomeInactiveFromStandby(partitionName); try { replicaSyncUpManager.waitDeactivationCompleted(partitionName); } catch (InterruptedException e) { logger.error("Deactivation was interrupted on partition {}", partitionName); throw new StateTransitionException("Deactivation failed or was interrupted", <START> StateTransitionException.TransitionErrorCode.DeactivationFailure); <END> } catch (StateTransitionException e) { logger.error("Deactivation didn't complete on partition {}", partitionName, e); throw e; } } }</code><technical_language>Minor: import TransitionErrorCode statically</technical_language>

Target:
public void onPartitionBecomeInactiveFromStandby(String partitionName) { PartitionStateChangeListener storageManagerListener = partitionStateChangeListeners.get(StateModelListenerType.StorageManagerListener); if (storageManagerListener != null) { storageManagerListener.onPartitionBecomeInactiveFromStandby(partitionName); } PartitionStateChangeListener replicationManagerListener = partitionStateChangeListeners.get(StateModelListenerType.ReplicationManagerListener); if (replicationManagerListener != null) { replicationManagerListener.onPartitionBecomeInactiveFromStandby(partitionName); try { replicaSyncUpManager.waitDeactivationCompleted(partitionName); } catch (InterruptedException e) { logger.error("Deactivation was interrupted on partition {}", partitionName); throw new StateTransitionException("Deactivation failed or was interrupted", DeactivationFailure); } catch (StateTransitionException e) { logger.error("Deactivation didn't complete on partition {}", partitionName, e); throw e; } } }
Source:
<code>public static int getContentLength(String message) { String[] messageLines = message.split("\n"); <START> int lenght = 0; <END> int i = 0; while (i < messageLines.length - 1) { String currentLine = messageLines[++i]; while (currentLine.length() > 0) { currentLine = messageLines[++i]; } i++; StringBuilder content = new StringBuilder(); String endLine = null; for (int k = i; k < messageLines.length; k++, i++) { String line = messageLines[k]; if (line.contains(END_OF_MESSAGE)) { int idx = line.indexOf(END_OF_MESSAGE); content.append(line.substring(0, idx)); endLine = line.substring(idx + 1, line.length()); break; } else { content.append(line); } } lenght += content.length(); if (!isEmpty(endLine)) { messageLines[i] = endLine; } else { i++; } } return lenght; }</code><technical_language>length</technical_language>

Target:
public static int getContentLength(String message) { String[] messageLines = message.split("\n"); int length = 0; int i = 0; while (i < messageLines.length - 1) { String currentLine = messageLines[++i]; while (currentLine.length() > 0) { currentLine = messageLines[++i]; } i++; StringBuilder content = new StringBuilder(); String endLine = null; for (int k = i; k < messageLines.length; k++, i++) { String line = messageLines[k]; if (line.contains(END_OF_MESSAGE)) { int idx = line.indexOf(END_OF_MESSAGE); content.append(line.substring(0, idx)); endLine = line.substring(idx + 1, line.length()); break; } else { content.append(line); } } length += content.length(); if (!isEmpty(endLine)) { messageLines[i] = endLine; } else { i++; } } return length; }
Source:
<code>public String toString(){ for (Entity entity : entities){ if (!entity.isPassable()) return entity.toString(); } <START> for (Entity entity : entities){ <END> return entity.toString(); } return " "; }</code><technical_language>do: if (entities.size() > 0){ return entities.iterator().next().toString(); } yet! return entities.size() > 0 ? entities.iterator().next().toString() : " ";</technical_language>

Target:
public String toString(){ if (!isPassable()) return impassableEntity.toString(); return passableEntities.isEmpty() ? EMPTY_SQUARE_SYMBOL : passableEntities.iterator().next().toString(); }
Source:
<code>public void run() { try { if(prjSave == null) { String remoteServices = fConn.getSshSettings().getRemoteServices(); IRemoteServices services = RemoteServices.getRemoteServices(remoteServices); if (services != null) { IRemoteConnectionManager connMgr = services.getConnectionManager(); if (connMgr != null) { fRemoteConnection = connMgr.getConnection(fConn.getSshSettings().getConnectionName()); } } } else { fRemoteConnection = Util.getRemoteConnection(prjSave); } if (fRemoteConnection != null && !fRemoteConnection.isOpen()) { try { <START> fRemoteConnection.open(null); <END> } catch (RemoteConnectionException e) { Activator.log(e); } } if(fRemoteConnection != null && fRemoteConnection.isOpen()) { TerminalPlugin plugin = TerminalPlugin.getDefault(); IPreferenceStore preferenceStore = plugin.getPreferenceStore(); setupHistoryMonitoring(fConn, preferenceStore); try { readDataForever(fConn.getInputStream()); } catch (InterruptedIOException e) { } } } catch (IOException e) { fControl.setState(TerminalState.CLOSED); } finally { try { disconnect(); } finally { fControl.setState(TerminalState.CLOSED); } } }</code><technical_language>bad idea pass a null here. If connection hangs for reason this thread hang. Instead of a thread, a Job supplies IProgressMonitor</technical_language>

Target:
public void run() { try { fProject = fConn.getProject(); if (fProject == null) { String remoteServices = fConn.getSshSettings().getRemoteServices(); IRemoteServices services = RemoteServices.getRemoteServices(remoteServices); if (services != null) { IRemoteConnectionManager connMgr = services.getConnectionManager(); if (connMgr != null) { fRemoteConnection = connMgr.getConnection(fConn.getSshSettings().getConnectionName()); } } } else { fRemoteConnection = Util.getRemoteConnection(fProject); } if (fRemoteConnection != null && !fRemoteConnection.isOpen()) { try { fRemoteConnection.open(null); } catch (RemoteConnectionException e) { Activator.log(e); } } if (fRemoteConnection != null && fRemoteConnection.isOpen()) { TerminalPlugin plugin = TerminalPlugin.getDefault(); IPreferenceStore preferenceStore = plugin.getPreferenceStore(); setupHistoryMonitoring(fConn, preferenceStore); try { readDataForever(fConn.getInputStream()); } catch (InterruptedIOException e) { } } } catch (IOException e) { fControl.setState(TerminalState.CLOSED); } finally { try { disconnect(); } finally { fControl.setState(TerminalState.CLOSED); } } }
Source:
<code>public void compute(Iterator<MessageWritable> msgIterator) throws Exception { initVertex(); <START> if (getSuperstep() == 1 && startSeeds.contains(getVertexId())) { <END> markSelfAndBroadcast(); } else if (getSuperstep() <= numOfHops + 1 && msgIterator.hasNext()) { markSelfAndBroadcast(); } voteToHalt(); }</code><technical_language>if /else branch</technical_language>

Target:
public void compute(Iterator<MessageWritable> msgIterator) throws Exception { initVertex(); if ((getSuperstep() == 1 && startSeeds.contains(getVertexId())) || (getSuperstep() <= numOfHops + 1 && msgIterator.hasNext())) { markSelfAndBroadcast(); } voteToHalt(); }
Source:
<code>public static KeyPair loadKey(String pemString, String passwd) throws IOException, GeneralSecurityException { return SecurityUtils.loadKeyPairIdentity("key", <START> new ByteArrayInputStream(pemString.getBytes("UTF-8")), <END> FilePasswordProvider.of(passwd)); }</code><technical_language>nit: java.nio.charset.StandardCharsets.UTF_8 instead of "UTF-8"</technical_language>

Target:
public static KeyPair loadKey(String pemString, String passwd) throws IOException, GeneralSecurityException { return SecurityUtils.loadKeyPairIdentity("key", new ByteArrayInputStream(pemString.getBytes(UTF_8)), FilePasswordProvider.of(passwd)); }
Source:
<code>public void addMissingMessageIDs(String namespace, Set<String> messageIDs) { Set<String> alreadyPresent = dataService.findAll(L10N_STRING, new QueryImpl<L10nString>().in(MSGID, messageIDs).and().eq(NAMESPACE, namespace), L10nString.class) .map(L10nString::getMessageID) .collect(toCollection(TreeSet::new)); Set<String> toAdd = Sets.difference(messageIDs, alreadyPresent); if (!toAdd.isEmpty()) { Stream<L10nString> entities = toAdd.stream() .map(key -> l10nStringFactory.create() .setMessageID(key) .setNamespace(namespace)); dataService.add(L10N_STRING, entities); LOG.debug("Added message IDs to namespace '{}' : {}.", namespace, messageIDs); <START> <END> } }</code><technical_language>If remove catch, method suddenly throw runtime exceptions previously nommed up. Is this intentional</technical_language>

Target:
public void addMissingMessageIDs(String namespace, Set<String> messageIDs) { Set<String> alreadyPresent = dataService.findAll(L10N_STRING, new QueryImpl<L10nString>().in(MSGID, messageIDs).and().eq(NAMESPACE, namespace), L10nString.class) .map(L10nString::getMessageID) .collect(toCollection(TreeSet::new)); Set<String> toAdd = Sets.difference(messageIDs, alreadyPresent); if (!toAdd.isEmpty()) { Stream<L10nString> entities = toAdd.stream() .map(key -> l10nStringFactory.create() .setMessageID(key) .setNamespace(namespace)); try { dataService.add(L10N_STRING, entities); LOG.debug("Added message IDs to namespace '{}' : {}.", namespace, messageIDs); } catch (EntityTypePermissionException ex) { LOG.info("No permission to add message IDs to namespace '{}' : {}.", namespace, messageIDs, ex); } } }
Source:
<code>private Optional<VM> chooseNextVmToMigrateFromVMsToHostsAffinity(Cluster cluster, List<AffinityGroup> allAffinityGroups) { List<AffinityGroup> <START> allVMtoHostsAffinityGroups <END> = getAllAffinityGroupsForVMsToHostsAffinity(allAffinityGroups); if (allVMtoHostsAffinityGroups.isEmpty()) { return Optional.empty(); } Map<Guid, VM> vmsMap = getVMsMap(allVMtoHostsAffinityGroups); List<Guid> candidateVMsPositiveEnforcingAffinity = getCandidatesFromVMtoHostsAffinity(allVMtoHostsAffinityGroups, vmsMap, true, true); List<Guid> candidateVMsNegativeEnforcingAffinity = getCandidatesFromVMtoHostsAffinity(allVMtoHostsAffinityGroups, vmsMap, false, true); List<Guid> candidateVMsPositiveNonEnforcingAffinity = getCandidatesFromVMtoHostsAffinity(allVMtoHostsAffinityGroups, vmsMap, true, false); List<Guid> candidateVMsNegativeNonEnforcingAffinity = getCandidatesFromVMtoHostsAffinity(allVMtoHostsAffinityGroups, vmsMap, false, false); List<Guid> candidatesVMs = new ArrayList<>(); candidatesVMs.addAll(candidateVMsPositiveEnforcingAffinity); candidatesVMs.addAll(candidateVMsNegativeEnforcingAffinity); candidatesVMs.addAll(candidateVMsPositiveNonEnforcingAffinity); candidatesVMs.addAll(candidateVMsNegativeNonEnforcingAffinity); if (!candidatesVMs.isEmpty()) { log.info("vm to hosts affinity group violation detected"); } for (Guid id : candidatesVMs) { VM canidateVM = vmsMap.get(id); if (isVmMigrationValid(cluster, canidateVM)) { return Optional.of(canidateVM); } } return Optional.empty(); }</code><technical_language>a small thing, try remain consistent capitalization. "allVmToHosts.."</technical_language>

Target:
private Optional<VM> chooseNextVmToMigrateFromVMsToHostsAffinity(Cluster cluster, List<AffinityGroup> allAffinityGroups) { List<AffinityGroup> allVmToHostsAffinityGroups = getAllAffinityGroupsForVMsToHostsAffinity(allAffinityGroups); if (allVmToHostsAffinityGroups.isEmpty()) { return Optional.empty(); } Map<Guid, VM> vmsMap = getVMsMap(allVmToHostsAffinityGroups); List<Guid> candidateVMsPositiveEnforcingAffinity = getVmToHostsAffinityGroupCandidates(allVmToHostsAffinityGroups, vmsMap, true, true); List<Guid> candidateVMsNegativeEnforcingAffinity = getVmToHostsAffinityGroupCandidates(allVmToHostsAffinityGroups, vmsMap, false, true); List<Guid> candidateVMsPositiveNonEnforcingAffinity = getVmToHostsAffinityGroupCandidates(allVmToHostsAffinityGroups, vmsMap, true, false); List<Guid> candidateVMsNegativeNonEnforcingAffinity = getVmToHostsAffinityGroupCandidates(allVmToHostsAffinityGroups, vmsMap, false, false); List<Guid> candidateVMs = new ArrayList<>(); candidateVMs.addAll(candidateVMsPositiveEnforcingAffinity); candidateVMs.addAll(candidateVMsNegativeEnforcingAffinity); candidateVMs.addAll(candidateVMsPositiveNonEnforcingAffinity); candidateVMs.addAll(candidateVMsNegativeNonEnforcingAffinity); if (!candidateVMs.isEmpty()) { log.info("vm to hosts affinity group violation detected"); } for (Guid id : candidateVMs) { VM candidateVM = vmsMap.get(id); if (isVmMigrationValid(cluster, candidateVM)) { return Optional.of(candidateVM); } } return Optional.empty(); }
Source:
<code>public void testUpdateDeviceStatsPermission() throws Exception { TrafficStats.setThreadStatsTag(0); TrafficStats.setThreadStatsUid( 0); Socket socket = new Socket("example.com", 80); TrafficStats.tagSocket(socket); final int byteCount = 1024; socket.setTcpNoDelay(true); OutputStream out = socket.getOutputStream(); byte[] buf = new byte[byteCount]; final long uidTxBytesBefore = TrafficStats.getUidTxBytes(Process.myUid()); out.write(buf); out.close(); <START> socket.close(); <END> long uidTxBytesAfter = TrafficStats.getUidTxBytes(Process.myUid()); long uidTxDeltaBytes = uidTxBytesAfter - uidTxBytesBefore; assertTrue("uidtxb: " + uidTxBytesBefore + " -> " + uidTxBytesAfter + " delta=" + uidTxDeltaBytes + " >= " + byteCount, uidTxDeltaBytes >= byteCount); final int UNSUPPORTED = -1; assertEquals(UNSUPPORTED, TrafficStats.getUidRxBytes( 0)); }</code><technical_language>Consider setting SO_LINGER 1 close return bytes written acknowledged server</technical_language>

Target:
public void testUpdateDeviceStatsPermission() throws Exception { TrafficStats.setThreadStatsTag(0); TrafficStats.setThreadStatsUid( 0); Socket socket = new Socket("example.com", 80); TrafficStats.tagSocket(socket); final int byteCount = 1024; socket.setTcpNoDelay(true); socket.setSoLinger(true, 0); OutputStream out = socket.getOutputStream(); byte[] buf = new byte[byteCount]; final long uidTxBytesBefore = TrafficStats.getUidTxBytes(Process.myUid()); out.write(buf); out.close(); socket.close(); long uidTxBytesAfter = TrafficStats.getUidTxBytes(Process.myUid()); long uidTxDeltaBytes = uidTxBytesAfter - uidTxBytesBefore; assertTrue("uidtxb: " + uidTxBytesBefore + " -> " + uidTxBytesAfter + " delta=" + uidTxDeltaBytes + " >= " + byteCount, uidTxDeltaBytes >= byteCount); }
Source:
<code>public StockSaver(final HibernateSessionProvider sessionProviderForLocal) { super(sessionProviderForLocal); <START> this.studyGermplasmListService = new StudyGermplasmListServiceImpl(sessionProviderForLocal); <END> }</code><technical_language>autowire _studyGermplasmListService_ instead</technical_language>

Target:
public StockSaver(final HibernateSessionProvider sessionProviderForLocal) { super(sessionProviderForLocal); }
Source:
<code>public boolean matches(Attribute<?> other) { if (!this.definition.equals(other.definition)) return false; <START> if (!this.definition.isLocal()) <END> return value.equals(other.value); return true; }</code><technical_language>Attribute implement equals? This relies object identity equality, is okay</technical_language>

Target:
public boolean matches(Attribute<?> other) { if (other == null) return false; if (!this.definition.equals(other.definition)) return false; if (this.definition.isGlobal()) return value.equals(other.value); return true; }
Source:
<code><START> public void handleHealthStatusResponse(final GetHealthStatusResponseDto getHealthStatusResponseDto, <END> final String deviceIdentification, final String organisationIdentification, final String correlationUid, final String messageType, final ResponseMessageResultType responseMessageResultType, final OsgpException osgpException) { LOGGER.info("handleResponse for MessageType: {}", messageType); ResponseMessageResultType result = ResponseMessageResultType.OK; GetHealthStatusResponse getHealthStatusResponse = null; OsgpException exception = null; try { if (responseMessageResultType == ResponseMessageResultType.NOT_OK || osgpException != null) { LOGGER.error("Device Response not ok.", osgpException); throw osgpException; } this.handleResponseMessageReceived(LOGGER, deviceIdentification); getHealthStatusResponse = this.mapper.map(getHealthStatusResponseDto, GetHealthStatusResponse.class); } catch (final Exception e) { LOGGER.error("Unexpected Exception", e); result = ResponseMessageResultType.NOT_OK; exception = this.ensureOsgpException(e, "Exception occurred while getting Health Status Response Data"); } this.webServiceResponseMessageSender.send(ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(correlationUid).withOrganisationIdentification(organisationIdentification) .withDeviceIdentification(deviceIdentification).withResult(result).withOsgpException(exception) .withDataObject(getHealthStatusResponse).build(), messageType); }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Method 7 parameters, is greater 6 authorized. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public void handleHealthStatusResponse(final GetHealthStatusResponseDto getHealthStatusResponseDto, final String deviceIdentification, final String organisationIdentification, final String correlationUid, final String messageType, final ResponseMessageResultType responseMessageResultType, final OsgpException osgpException) { LOGGER.info("handleResponse for MessageType: {}", messageType); ResponseMessageResultType result = ResponseMessageResultType.OK; GetHealthStatusResponse getHealthStatusResponse = null; OsgpException exception = null; try { if (responseMessageResultType == ResponseMessageResultType.NOT_OK || osgpException != null) { LOGGER.error("Device Response not ok.", osgpException); throw osgpException; } this.handleResponseMessageReceived(LOGGER, deviceIdentification); getHealthStatusResponse = this.mapper.map(getHealthStatusResponseDto, GetHealthStatusResponse.class); } catch (final Exception e) { LOGGER.error("Unexpected Exception", e); result = ResponseMessageResultType.NOT_OK; exception = this.ensureOsgpException(e, "Exception occurred while getting Health Status Response Data"); } ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(correlationUid).withOrganisationIdentification(organisationIdentification) .withDeviceIdentification(deviceIdentification).withResult(result).withOsgpException(exception) .withDataObject(getHealthStatusResponse).build(); this.webServiceResponseMessageSender.send(responseMessage, messageType); }