auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static ProvisioningConnectorConfig build(OMElement provisioningConnectorConfigOM) throws IdentityApplicationManagementException{ ProvisioningConnectorConfig provisioningConnectorConfig = new ProvisioningConnectorConfig(); Iterator<?> iter = provisioningConnectorConfigOM.getChildElements(); while (iter.hasNext()) { OMElement element = (OMElement) (iter.next()); String elementName = element.getLocalName(); if ("ProvisioningProperties".equals(elementName)) { Iterator<?> propertiesIter = element.getChildElements(); List<Property> propertiesArrList = new ArrayList<Property>(); if (propertiesIter != null) { while (propertiesIter.hasNext()) { OMElement propertiesElement = (OMElement) (propertiesIter.next()); propertiesArrList.add(Property.build(propertiesElement)); } } if (CollectionUtils.isNotEmpty(propertiesArrList)) { Property[] propertiesArr = propertiesArrList.toArray(new Property[0]); provisioningConnectorConfig.setProvisioningProperties(propertiesArr); } } else if ("IsEnabled".equals(elementName)) { provisioningConnectorConfig.setEnabled(Boolean.parseBoolean(element.getText())); } else if ("IsBlocking".equals(elementName)) { <START> provisioningConnectorConfig.setBlocking(Boolean.parseBoolean(element.getText())); <END> } } if(StringUtils.isBlank(provisioningConnectorConfig.getName())){ throw new IdentityApplicationManagementException("No configured name found for " + "ProvisioningConnectorConfig"); } return provisioningConnectorConfig; }</code><technical_language>remove setting Name</technical_language>

Target:
public static ProvisioningConnectorConfig build(OMElement provisioningConnectorConfigOM) throws IdentityApplicationManagementException{ ProvisioningConnectorConfig provisioningConnectorConfig = new ProvisioningConnectorConfig(); Iterator<?> iter = provisioningConnectorConfigOM.getChildElements(); while (iter.hasNext()) { OMElement element = (OMElement) (iter.next()); String elementName = element.getLocalName(); if ("ProvisioningProperties".equals(elementName)) { Iterator<?> propertiesIter = element.getChildElements(); List<Property> propertiesArrList = new ArrayList<Property>(); if (propertiesIter != null) { while (propertiesIter.hasNext()) { OMElement propertiesElement = (OMElement) (propertiesIter.next()); propertiesArrList.add(Property.build(propertiesElement)); } } if (CollectionUtils.isNotEmpty(propertiesArrList)) { Property[] propertiesArr = propertiesArrList.toArray(new Property[0]); provisioningConnectorConfig.setProvisioningProperties(propertiesArr); } } else if ("Name".equals(elementName)) { provisioningConnectorConfig.setName(element.getText()); } else if ("IsEnabled".equals(elementName)) { provisioningConnectorConfig.setEnabled(Boolean.parseBoolean(element.getText())); } else if ("IsBlocking".equals(elementName)) { provisioningConnectorConfig.setBlocking(Boolean.parseBoolean(element.getText())); } } if(StringUtils.isBlank(provisioningConnectorConfig.getName())){ throw new IdentityApplicationManagementException("No configured name found for " + "ProvisioningConnectorConfig"); } return provisioningConnectorConfig; }
Source:
<code>public void testTaskResultByTag() throws Exception { HttpResponse response = sendRequest("jobs/" + jobId + "/tasks/tag/LOOP-T2-1/result"); JSONArray jsonArray = toJsonArray(response); System.out.println(jsonArray.toJSONString()); <START> ArrayList<String> taskNames = new ArrayList<>(); <END> for (int i = 0; i < jsonArray.size(); i++) { JSONObject id = (JSONObject) ((JSONObject) jsonArray.get(i)).get("id"); String name = (String) id.get("readableName"); taskNames.add(name); } assertTrue(taskNames.contains("T1#1")); assertTrue(taskNames.contains("Print1#1")); assertTrue(taskNames.contains("Print2#1")); assertTrue(taskNames.contains("T2#1")); assertEquals(4, jsonArray.size()); }</code><technical_language>Initializing ArrayList size is better</technical_language>

Target:
public void testTaskResultByTag() throws Exception { HttpResponse response = sendRequest("jobs/" + jobId + "/tasks/tag/LOOP-T2-1/result"); JSONArray jsonArray = toJsonArray(response); System.out.println(jsonArray.toJSONString()); ArrayList<String> taskNames = new ArrayList<>(4); for (int i = 0; i < jsonArray.size(); i++) { JSONObject id = (JSONObject) ((JSONObject) jsonArray.get(i)).get("id"); String name = (String) id.get("readableName"); taskNames.add(name); } assertTrue(taskNames.contains("T1#1")); assertTrue(taskNames.contains("Print1#1")); assertTrue(taskNames.contains("Print2#1")); assertTrue(taskNames.contains("T2#1")); assertEquals(4, jsonArray.size()); }
Source:
<code>public PowerUpSpawner(PlayingField pf) { this.pf = pf; <START> pf.registerGameListener(this); <END> this.intervalTicks = INTERVAL * pf.getFPS(); this.tickCounter = 0; this.minX = 0; this.maxX = pf.getWidth(); this.log = Log.getLogger(); }</code><technical_language>expose "this" constructing of possible. In this case, put registerGameListener line of constructor, other fields initialized playingField interacts you. <logic</technical_language>

Target:
public PowerUpSpawner(PlayingField pf) { this.pf = pf; this.intervalTicks = INTERVAL * pf.getFPS(); this.tickCounter = 0; this.minX = 0; this.maxX = pf.getWidth(); this.log = Log.getLogger(); pf.registerGameListener(this); }
Source:
<code>public void testBadStartTime(){ <START> new Stamp(1<<62, 5); <END> }</code><technical_language>suggestion slightly wrong. Need change 1<<62 1L << 62. 1 is int work... adding L a long</technical_language>

Target:
public void testBadStartTime() { new Stamp(1L << 62, 5); }
Source:
<code>public static void main(String[] args) { SingleCommand<Main> cmd = SingleCommand.singleCommand(Main.class); cmd.parse(args); if (server) { JavaTCPServer.run(file, port); } else if (client) { try { JavaTCPClient.run(file, host, port, debug); } catch (Exception e) { <START> System.out.println("Could not launch client"); <END> } } }</code><technical_language>this anti-helpful. catch specific Exceptions provide a simpler expected error e.g. FileNotFoundException -> "input file found", print exception stacktrace</technical_language>

Target:
public static void main(String[] args) { SingleCommand<Main> cmd = SingleCommand.singleCommand(Main.class); cmd.parse(args); if (server) { JavaTCPServer.run(file, port); } else if (client) { try { JavaTCPClient.run(file, host, port, debug); } catch (Exception e) { e.printStackTrace(); } } }
Source:
<code>private void updateRepo() throws TeamException { try { RefUpdate tagRef = repo.updateRef(refName); tagRef.setNewObjectId(tag.getTagId()); <START> tagRef.setRefLogMessage("tag: " + refName, false); END> tagRef.setForceUpdate(shouldMoveTag); Result updateResult = tagRef.update(); if (updateResult != Result.NEW && updateResult != Result.FORCED) throw new TeamException(NLS.bind(CoreText.TagOperation_taggingFailure, tagName)); } catch (IOException e) { throw new TeamException(NLS.bind(CoreText.TagOperation_taggingFailure, tagName), e); } }</code><technical_language>Hmm. do log tags? a good idea C Git doesn't</technical_language>

Target:
private void updateRepo() throws TeamException { String refName = Constants.R_TAGS + tag.getTag(); try { RefUpdate tagRef = repo.updateRef(refName); tagRef.setNewObjectId(tag.getTagId()); tagRef.setForceUpdate(shouldMoveTag); Result updateResult = tagRef.update(); if (updateResult != Result.NEW && updateResult != Result.FORCED) throw new TeamException(NLS.bind(CoreText.TagOperation_taggingFailure, tag.getTag(), updateResult)); } catch (IOException e) { throw new TeamException(NLS.bind(CoreText.TagOperation_taggingFailure, tag.getTag()), e); } }
Source:
<code>public void deleteOneEntryUsingCachePolicy() { try { IndexEventHolder indexEventHolder = (IndexEventHolder) stateHolder.getState().getEventHolder(); <START> Object[] keys = indexEventHolder.getAllPrimaryKeyValues().toArray(); <END> long minTimestamp = Long.MAX_VALUE; Object keyOfMinTimestamp = null; for (Object key: keys) { Object[] data = indexEventHolder.getEvent(key).getOutputData(); long timestamp = (long) data[data.length - 1]; if (timestamp < minTimestamp) { minTimestamp = timestamp; keyOfMinTimestamp = key; } } indexEventHolder.deleteEvent(keyOfMinTimestamp); } catch (ClassCastException ignored) { } }</code><technical_language>This converting array is costly, indexEventHolder.getAllPrimaryKeyValues() diectly</technical_language>

Target:
public void deleteOneEntryUsingCachePolicy() { IndexEventHolder indexEventHolder = (IndexEventHolder) stateHolder.getState().getEventHolder(); Set<Object> keys = indexEventHolder.getAllPrimaryKeyValues(); long minTimestamp = Long.MAX_VALUE; Object keyOfMinTimestamp = null; for (Object key: keys) { Object[] data = indexEventHolder.getEvent(key).getOutputData(); long timestamp = (long) data[cachePolicyAttributePosition]; if (timestamp < minTimestamp) { minTimestamp = timestamp; keyOfMinTimestamp = key; } } indexEventHolder.deleteEvent(keyOfMinTimestamp); }
Source:
<code>public static void getPresignedObjectUrl_test1() throws Exception { String methodName = "getPresignedObjectUrl(GetPresignedObjectUrlArgs args)"; if (!mintEnv) { <START> System.out.println("Test: presigned get object: " + methodName); <END> } long startTime = System.currentTimeMillis(); try { String objectName = getRandomName(); try (final InputStream is = new ContentInputStream(1 * KB)) { client.putObject(bucketName, objectName, is, new PutObjectOptions(1 * KB, -1)); } byte[] inBytes; try (final InputStream is = new ContentInputStream(1 * KB)) { inBytes = readAllBytes(is); } String urlString = client.getPresignedObjectUrl( GetPresignedObjectUrlArgs.builder() .method(Method.GET) .bucket(bucketName) .object(objectName) .build()); byte[] outBytes = readObject(urlString); if (!Arrays.equals(inBytes, outBytes)) { throw new Exception("object content differs"); } client.removeObject(RemoveObjectArgs.builder().bucket(bucketName).object(objectName).build()); mintSuccessLog(methodName, "presigned get object", startTime); } catch (Exception e) { handleException(methodName, "presigned get object", startTime, e); } }</code><technical_language>suggestion System.out.println("Test: " + methodName);</technical_language>

Target:
public static void getPresignedObjectUrl_test1() throws Exception { String methodName = "getPresignedObjectUrl(GetPresignedObjectUrlArgs args)"; if (!mintEnv) { System.out.println("Test: " + methodName + "presigned get"); } long startTime = System.currentTimeMillis(); try { String objectName = getRandomName(); try (final InputStream is = new ContentInputStream(1 * KB)) { client.putObject(bucketName, objectName, is, new PutObjectOptions(1 * KB, -1)); } byte[] inBytes; try (final InputStream is = new ContentInputStream(1 * KB)) { inBytes = readAllBytes(is); } String urlString = client.getPresignedObjectUrl( GetPresignedObjectUrlArgs.builder() .method(Method.GET) .bucket(bucketName) .object(objectName) .build()); byte[] outBytes = readObject(urlString); if (!Arrays.equals(inBytes, outBytes)) { throw new Exception("object content differs"); } client.removeObject(RemoveObjectArgs.builder().bucket(bucketName).object(objectName).build()); mintSuccessLog(methodName, null, startTime); } catch (Exception e) { handleException(methodName, null, startTime, e); } }
Source:
<code>public static void switchUser(String user) { if(!kerberosEnabled) { return; } String keytab = CURRENT_USER_KEYTAB; if(user == null) { user = System.getProperty("user.name"); } else { Assert.assertEquals(user, user2_name, "Unexpected user."); keytab = user2_keytab; } if(user.equals(currentUser)) { logger.info("kerberos switching is not required."); return; } logger.info(String.format("Switching kerberos keytab from %s to %s", currentUser, user)); <START> final String command = String.format("ls -al %s", keytab); <END> final int exitVal = executeCommand(command); Assert.assertEquals(exitVal, 0, "Switching Kerberos credential did not succeed."); currentUser = user; }</code><technical_language>cmd "kinit -kt %s %s", keytab, user</technical_language>

Target:
public static void switchUser(String user) { if(!MerlinConstants.IS_SECURE) { logger.info("Kerberos is disabled, hence no user switching."); return; } if(user == null) { user = MerlinConstants.CURRENT_USER_NAME; } if(user.equals(currentKerberosUser)) { logger.info("kerberos switching is not required."); return; } final String keytab = MerlinConstants.getKeytabForUser(user); logger.info(String.format("Switching kerberos keytab from %s to %s", currentKerberosUser, user)); final String command = String.format("kinit -kt %s %s", keytab, user); final int exitVal = executeCommand(command); Assert.assertEquals(exitVal, 0, "Switching Kerberos credential did not succeed."); currentKerberosUser = user; }
Source:
<code><START> private boolean matchesStringOrRegex( <END> String paramName, String paramValue, boolean isRegex, String targetValue) { if (paramValue != null && paramValue.length() > 0) { if (isRegex) { Pattern p = Pattern.compile(paramValue); if (!p.matcher(targetValue).matches()) { log.debug( "Filter didnt match " + paramName + " regex: " + paramValue + " url: " + targetValue); return false; } } else if (!paramValue.equals(targetValue)) { log.debug("Filter didnt match " + paramName + ": " + paramValue); return false; } } return true; }</code><technical_language>static</technical_language>

Target:
private static boolean matchesStringOrRegex( String paramName, String paramValue, boolean isRegex, String targetValue) { if (paramValue != null && paramValue.length() > 0) { if (isRegex) { if (!targetValue.matches(paramValue)) { if (log.isDebugEnabled()) { log.debug( "Filter didnt match " + paramName + " regex: " + paramValue + " : " + targetValue); } return false; } } else if (!paramValue.equals(targetValue)) { if (log.isDebugEnabled()) { log.debug( "Filter didnt match " + paramName + " : " + paramValue + " : " + targetValue); } return false; } } return true; }
Source:
<code>public static Iterable<String> splitGlob(String path) { if (path.indexOf('{') < 0) { return Arrays.asList(path.split(",")); <START> } <END> return Iterables.transform(splitGlob(new CharStream(path)), Functions.toStringFunction()); }</code><technical_language>this special case handling is necessary</technical_language>

Target:
public static Iterable<String> splitGlob(String path) { return Iterables.transform(splitGlob(new CharStream(path)), Functions.toStringFunction()); }
Source:
<code>private Integer getLinkSpeedBandwidth(Guid clusterId) { final List<VdsNetworkInterface> migrationalClusterNics = <START> getDbFacade().getInterfaceDao().getAllMigrationNetworkInterfacesInCluster(clusterId); <END> return migrationalClusterNics.stream() .map(VdsNetworkInterface::getSpeed) .reduce(MigrateVmCommand::minIfExists) .map(speed -> speed == 0 ? null : speed) .orElse(null); }</code><technical_language>getInterfaceDao in AuditLogableBase</technical_language>

Target:
private Integer getLinkSpeedBandwidth(Guid clusterId) { final List<VdsNetworkInterface> migrationClusterNics = getInterfaceDao().getAllMigrationNetworkInterfacesInCluster(clusterId); return migrationClusterNics.stream() .map(VdsNetworkInterface::getSpeed) .reduce(MigrateVmCommand::minIfExists) .map(speed -> speed == 0 ? null : speed) .orElse(null); }
Source:
<code>private void fetchFromCatalogAndWriteResponse(String bucketName, String workflowName, String sessionId, HttpServletResponse response) { String encodedWorkflowName; try { encodedWorkflowName = URLEncoder.encode(workflowName, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { encodedWorkflowName = workflowName; } String url = URL_CATALOG + "/buckets/" + bucketName + "/resources/" + encodedWorkflowName + "/raw"; LOGGER.info("Sending request to catalog: {}", url); HttpGet httpget = new HttpGet(url); httpget.addHeader(PARAMS_SESSION_ID, sessionId); try (CloseableHttpClient httpClient = HttpClients.createDefault(); <START> CloseableHttpResponse httpResponse = httpClient.execute(httpget);) { <END> HttpEntity responseBody = httpResponse.getEntity(); File job = File.createTempFile("job_upload", ".xml"); FileUtils.copyInputStreamToFile(responseBody.getContent(), job); LOGGER.info("job file={}", job); writeResponse(job, response); } catch (Exception e) { LOGGER.error("Error when sending the request to catalog", e); } }</code><technical_language>Redundant semi colon in end</technical_language>

Target:
private void fetchFromCatalogAndWriteResponse(String bucketName, String workflowName, String sessionId, HttpServletResponse response) { String encodedWorkflowName; try { encodedWorkflowName = URLEncoder.encode(workflowName, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { encodedWorkflowName = workflowName; } String url = URL_CATALOG + "/buckets/" + bucketName + "/resources/" + encodedWorkflowName + "/raw"; LOGGER.info("Sending request to catalog: {}", url); HttpGet httpGet = new HttpGet(url); httpGet.addHeader(PARAMS_SESSION_ID, sessionId); try (CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpResponse httpResponse = httpClient.execute(httpGet)) { HttpEntity responseBody = httpResponse.getEntity(); File job = File.createTempFile("job_upload", ".xml"); FileUtils.copyInputStreamToFile(responseBody.getContent(), job); LOGGER.info("job file={}", job); writeResponse(job, response); } catch (Exception e) { LOGGER.error("Error when sending the request to catalog", e); } }
Source:
<code>private void refreshAndStartQueries() { long nanoTime = System.nanoTime(); long elapsedSeconds = NANOSECONDS.toSeconds(nanoTime - lastCpuQuotaGenerationNanos.get()); if (elapsedSeconds > 0) { lastCpuQuotaGenerationNanos.addAndGet(elapsedSeconds * 1_000_000_000L); } else if (elapsedSeconds < 0) { lastCpuQuotaGenerationNanos.set(nanoTime); } for (RootInternalResourceGroup group : rootGroups) { while (group != null) { try { if (elapsedSeconds > 0) { group.generateCpuQuota(elapsedSeconds); } } catch (RuntimeException e) { <START> log.error(e, "Exception while generation cpu quota for %s", group); <END> } try { group.processQueuedQueries(); } catch (RuntimeException e) { log.error(e, "Exception while processing queued queries for %s version %s", group, group.getVersion()); } if (group.getNext().isPresent()) { group = (RootInternalResourceGroup) group.getNext().get(); } else { group = null; } } } }</code><technical_language>suggestion log.error(e, "Exception while generating cpu quota for %s", group);</technical_language>

Target:
private void refreshAndStartQueries() { long nanoTime = System.nanoTime(); long elapsedSeconds = NANOSECONDS.toSeconds(nanoTime - lastCpuQuotaGenerationNanos.get()); if (elapsedSeconds > 0) { lastCpuQuotaGenerationNanos.addAndGet(elapsedSeconds * 1_000_000_000L); } else if (elapsedSeconds < 0) { lastCpuQuotaGenerationNanos.set(nanoTime); } if (maxTotalRunningTaskCountToNotExecuteNewQuery != Integer.MAX_VALUE) { taskLimitExceeded.set(getTotalRunningTaskCount() > maxTotalRunningTaskCountToNotExecuteNewQuery); } for (RootInternalResourceGroup group : rootGroups) { while (group != null) { try { if (elapsedSeconds > 0) { group.generateCpuQuota(elapsedSeconds); } } catch (RuntimeException e) { log.error(e, "Exception while generating cpu quota for %s", group); } try { group.setTaskLimitExceeded(taskLimitExceeded.get()); group.processQueuedQueries(); } catch (RuntimeException e) { log.error(e, "Exception while processing queued queries for %s version %s", group, group.getVersion()); } if (group.getNext().isPresent()) { group = (RootInternalResourceGroup) group.getNext().get(); } else { group = null; } } } }
Source:
<code>private void onReplaceBrick() { ReplaceBrickModel replaceBrickModel = (ReplaceBrickModel) getWindow(); if (replaceBrickModel == null) { return; } if (!replaceBrickModel.validate()) { return; } GlusterVolumeEntity volumeEntity = getEntity(); if (volumeEntity == null) { return; } GlusterBrickEntity existingBrick = getSelectedItem(); if (existingBrick == null) { return; } VDS server = replaceBrickModel.getServers().getSelectedItem(); GlusterBrickEntity newBrick = new GlusterBrickEntity(); newBrick.setVolumeId(volumeEntity.getId()); newBrick.setServerId(server.getId()); newBrick.setServerName(server.getHostName()); newBrick.setBrickDirectory(replaceBrickModel.getBrickDirectory().getEntity()); replaceBrickModel.startProgress(null); GlusterVolumeReplaceBrickActionParameters parameter = new GlusterVolumeReplaceBrickActionParameters(volumeEntity.getId(), GlusterTaskOperation.COMMIT, existingBrick, newBrick, <START> true); <END> Frontend.getInstance().runAction(VdcActionType.ReplaceGlusterVolumeBrick, parameter, new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { ReplaceBrickModel localModel = (ReplaceBrickModel) result.getState(); localModel.stopProgress(); setWindow(null); } }, replaceBrickModel); }</code><technical_language>do need this force. I this for validations. force call backend. giving option in UI for user choose</technical_language>

Target:
private void onReplaceBrick() { ReplaceBrickModel replaceBrickModel = (ReplaceBrickModel) getWindow(); if (replaceBrickModel == null) { return; } if (!replaceBrickModel.validate()) { return; } GlusterVolumeEntity volumeEntity = getEntity(); if (volumeEntity == null) { return; } GlusterBrickEntity existingBrick = getSelectedItem(); if (existingBrick == null) { return; } VDS server = replaceBrickModel.getServers().getSelectedItem(); GlusterBrickEntity newBrick = new GlusterBrickEntity(); newBrick.setVolumeId(volumeEntity.getId()); newBrick.setServerId(server.getId()); newBrick.setServerName(server.getHostName()); newBrick.setBrickDirectory(replaceBrickModel.getBrickDirectory().getEntity()); replaceBrickModel.startProgress(null); GlusterVolumeReplaceBrickActionParameters parameter = new GlusterVolumeReplaceBrickActionParameters(volumeEntity.getId(), existingBrick, newBrick); Frontend.getInstance().runAction(VdcActionType.ReplaceGlusterVolumeBrick, parameter, new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { ReplaceBrickModel localModel = (ReplaceBrickModel) result.getState(); localModel.stopProgress(); setWindow(null); } }, replaceBrickModel); }
Source:
<code>public void testGetJobs() throws Exception { RestfulHudsonClient client = harness.connect(PrivilegeLevel.ANONYMOUS); harness.ensureHasRun(harness.getPlanFailing()); harness.ensureHasRun(harness.getPlanSucceeding()); List<HudsonModelJob> jobs = client.getJobs(null, null); HudsonTestUtil.assertContains(jobs, harness.getPlanFailing()); HudsonTestUtil.assertContains(jobs, harness.getPlanSucceeding()); <START> HudsonTestUtil.assertContainsNot(jobs, harness.getPlanFolder()); <END> HudsonTestUtil.assertHealthReport(jobs); }</code><technical_language>this check for presence of 2 nested jobs</technical_language>

Target:
public void testGetJobs() throws Exception { RestfulHudsonClient client = harness.connect(PrivilegeLevel.ANONYMOUS); harness.ensureHasRun(harness.getPlanFailing()); harness.ensureHasRun(harness.getPlanSucceeding()); List<HudsonModelJob> jobs = client.getJobs(null, null); HudsonTestUtil.assertContains(jobs, harness.getPlanFailing()); HudsonTestUtil.assertContains(jobs, harness.getPlanSucceeding()); HudsonTestUtil.assertContainsNot(jobs, harness.getPlanFolder()); HudsonTestUtil.assertContainsNot(jobs, harness.getPlanNestedOne()); HudsonTestUtil.assertContainsNot(jobs, harness.getPlanSubFolder()); HudsonTestUtil.assertContainsNot(jobs, harness.getPlanNestedTwo()); HudsonTestUtil.assertHealthReport(jobs); }
Source:
<code><START> public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { <END> MigrationResponse response = _imageStoreService.migrateData(this); response.setObjectName("imagestore"); this.setResponseObject(response); }</code><technical_language>throw exceptions? catch of give nice consise error messages in a ServerApiException, right? of Runtime exception. Mentioning is redundant declared in BaseCmd well</technical_language>

Target:
public void execute() { MigrationResponse response = _imageStoreService.migrateData(this); response.setObjectName("imagestore"); this.setResponseObject(response); }
Source:
<code>public Optional<VirtualFile> tryResolve(String relativePath) { if (relativePath != null && relativePath.startsWith("/")) { <START> relativePath = relativePath.substring(1); <END> } if (Strings.isEmpty(relativePath)) { return Optional.empty(); } Tuple<String, String> nameAndRest = Strings.split(relativePath, "/"); Optional<VirtualFile> child = findChild(nameAndRest.getFirst()); if (Strings.isFilled(nameAndRest.getSecond())) { return child.flatMap(subChild -> subChild.tryResolve(nameAndRest.getSecond())); } return child; }</code><technical_language>Extract method maybe? Altering a parameter is a code smell (doesn't SonarQube warn this? before)</technical_language>

Target:
public Optional<VirtualFile> tryResolve(String relativePath) { String effectivePath = ensureRelativePath(relativePath); if (Strings.isEmpty(effectivePath)) { return Optional.empty(); } Tuple<String, String> nameAndRest = Strings.split(effectivePath, "/"); Optional<VirtualFile> child = findChild(nameAndRest.getFirst()); if (Strings.isFilled(nameAndRest.getSecond())) { return child.flatMap(subChild -> subChild.tryResolve(nameAndRest.getSecond())); } return child; }
Source:
<code>public static void init() throws Exception { IEclipsePreferences preferences = SourceLookupActivator.getPreferences(); preferences.putBoolean( SourceLookupActivator.AUTO_ADD_JBOSS_SOURCE_CONTAINER, true); SourceLookupActivator.getDefault().savePreferences(); IRuntimeDetectorDelegate delegate = new JBossASHandler(); <START> String home = System.getProperty("jbosstools.test.jboss.home.7.1.1", "C:/jboss-as-7.1.1.Final"); <END> RuntimeDefinition runtimeDefinition = delegate.getRuntimeDefinition(new File(home), new NullProgressMonitor()); List<RuntimeDefinition> runtimeDefinitions = new ArrayList<RuntimeDefinition>(); runtimeDefinitions.add(runtimeDefinition); delegate.initializeRuntimes(runtimeDefinitions); }</code><technical_language>"run calling tycho build" machine only, sorry. developer a setup. Yet, target/requirement default is work more C:/jboss-as-7.1.1.Final</technical_language>

Target:
public static void init() throws Exception { IEclipsePreferences preferences = SourceLookupActivator.getPreferences(); preferences.putBoolean( SourceLookupActivator.AUTO_ADD_JBOSS_SOURCE_CONTAINER, true); SourceLookupActivator.getDefault().savePreferences(); IRuntimeDetectorDelegate delegate = new JBossASHandler(); String home = System.getProperty("jbosstools.test.jboss.home.7.1.1", "C:/jboss-as-7.1.1.Final"); File homeFile = new File(home); if (!homeFile.exists()) { homeFile = new File(FileLocator.getBundleFile(Platform.getBundle(Activator.PLUGIN_ID)), "/target/requirements/jboss-as-7.1.1.Final"); } RuntimeDefinition runtimeDefinition = delegate.getRuntimeDefinition(homeFile, new NullProgressMonitor()); List<RuntimeDefinition> runtimeDefinitions = new ArrayList<RuntimeDefinition>(); runtimeDefinitions.add(runtimeDefinition); delegate.initializeRuntimes(runtimeDefinitions); }
Source:
<code>public static final int get2DigitYearStart() { int yearStart = 1929; try { Object o = Library.getProperty(Attributes.PREFERRED_2DIGITYEARSTART); if (o instanceof Integer) yearStart = ((Integer) o).intValue(); else if (o instanceof String) yearStart = Integer.parseInt((String) o); <START> } catch (Throwable ex) { END> } return yearStart; }</code><technical_language>1. return String 2. throw exception, < 0 parse 3. wiki</technical_language>

Target:
public static final int get2DigitYearStart() throws NumberFormatException { String value = Library.getProperty(Attributes.PREFERRED_2DIGITYEARSTART, "1929"); int yearStart = Integer.parseInt(value); if (yearStart < 0) { throw new IllegalArgumentException("Library property: 2DigitYearStart should not be negative"); } return yearStart; }
Source:
<code>public Response putImage(@FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file") FormDataBodyPart body) { try { SelfServiceMetaDataUtils.ensureDataXmlExists(this.id); } catch (IOException e) { throw new WebApplicationException(e); <START> } <END> RepositoryFileReference ref = new RepositoryFileReference(this.id, "image.jpg"); Response response = RestUtils.putContentToFile(ref, uploadedInputStream, body.getMediaType()); Application data = getData(); if (StringUtils.isEmpty(data.getImageUrl())) { data.setImageUrl("image.jpg"); onPutXML(data); } return response; }</code><technical_language>I do this in a separate method perform steps other files uploaded also</technical_language>

Target:
public Response putImage(@FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file") FormDataBodyPart body) { try { SelfServiceMetaDataUtils.ensureDataXmlExists(this.id); } catch (IOException e) { throw new WebApplicationException(e); } RepositoryFileReference ref = new RepositoryFileReference(this.id, "image.jpg"); Response response = RestUtils.putContentToFile(ref, uploadedInputStream, body.getMediaType()); if (StringUtils.isEmpty(this.application.getImageUrl())) { this.application.setImageUrl("image.jpg"); persist(); } return response; }
Source:
<code>public InputStream getInputStream() throws IOException { <START> if (inputStreamDataCache == null) { <END> inputStreamDataCache = new TemporaryFileBackedOutputStream(32 * 1024); IOUtils.copyLarge(inputStream, inputStreamDataCache); IOUtils.closeQuietly(inputStream); } return inputStreamDataCache.asByteSource().openStream(); }</code><technical_language>concurrency concerns stated above</technical_language>

Target:
public synchronized InputStream getInputStream() throws IOException { if (resourceDataCache == null) { resourceDataCache = new TemporaryFileBackedOutputStream(FILE_BACKED_OUTPUT_STREAM_THRESHOLD); IOUtils.copyLarge(inputStream, resourceDataCache); IOUtils.closeQuietly(inputStream); streamCloser.register(resourceDataCache); } InputStream newInputStream = resourceDataCache.asByteSource().openStream(); streamCloser.register(newInputStream); return newInputStream; }
Source:
<code>public void validate(URL beansXml, ErrorHandler errorHandler) { if (beansXml == null) { throw XmlLogger.LOG.loadError("unknown", null); } if (errorHandler == null) { errorHandler = this; } Schema schema = cdi20Schema; try (InputStream in = beansXml.openStream()) { if (in.available() == 0) { return; } try (BufferedReader reader = new BufferedReader(new InputStreamReader(in, Charset.forName(StandardCharsets.UTF_8.name())))) { String line; while ((line = reader.readLine()) != null) { if (line.contains(XmlSchema.CDI11.getFileName())) { schema = cdi11Schema; break; } else if (line.contains(XmlSchema.CDI20.getFileName())) { break; } } } } catch (IOException e) { throw XmlLogger.LOG.loadError(beansXml, e); } if (schema == null) { return; } Validator validator = schema.newValidator(); validator.setErrorHandler(errorHandler); try { <START> validator.validate(new StreamSource(beansXml.toExternalForm())); <END> } catch (SAXException | IOException e) { } }</code><technical_language>If wanted able close stream here, do: try (final InputStream in = new BufferedInputStream(beansXml.openStream()) { validator.validate(in); } catch (SAXException | IOException e) { // No-op - validation is optional }</technical_language>

Target:
public void validate(URL beansXml, ErrorHandler errorHandler) { if (beansXml == null) { throw XmlLogger.LOG.loadError("unknown", null); } if (errorHandler == null) { errorHandler = this; } Schema schema = cdi20Schema; try (InputStream in = beansXml.openStream()) { if (in.available() == 0) { return; } try (BufferedReader reader = new BufferedReader(new InputStreamReader(in, Charset.forName(StandardCharsets.UTF_8.name())))) { String line; while ((line = reader.readLine()) != null) { if (line.contains(XmlSchema.CDI11.getFileName())) { schema = cdi11Schema; break; } else if (line.contains(XmlSchema.CDI20.getFileName())) { break; } } } } catch (IOException e) { throw XmlLogger.LOG.loadError(beansXml, e); } if (schema == null) { return; } Validator validator = schema.newValidator(); validator.setErrorHandler(errorHandler); try (InputStream in = beansXml.openStream()) { validator.validate(new StreamSource(in)); } catch (SAXException | IOException e) { } }
Source:
<code>public void doesNotSendMailToAuthor() throws Exception { final Postman postman = Mockito.mock(Postman.class); final MkBase base = new MkBase(); final Alias author = new EmAlias(base.randomAlias(), postman); final Alias friend = new EmAlias(base.randomAlias(), postman); final Bout bout = author.inbox().bout(author.inbox().start()); bout.friends().invite(author.name()); bout.friends().invite(friend.name()); bout.messages().post("hello"); final ArgumentCaptor<Envelope> captor = ArgumentCaptor.forClass(Envelope.class); Mockito.verify(postman, Mockito.times(1)).send(captor.capture()); final Message msg = captor.getValue().unwrap(); MatcherAssert.assertThat( msg.getAllRecipients().length, Matchers.is(1) ); final InternetAddress recipientAddress = (InternetAddress) msg.getAllRecipients()[0]; MatcherAssert.assertThat( recipientAddress.getAddress(), Matchers.is(friend.email()) ); <START> } <END></code><technical_language>@mbarbieri I do assertion, comparing arguments list a list of InternetAddresses friend.email()..</technical_language>

Target:
public void doesNotSendMailToAuthor() throws Exception { final Postman postman = Mockito.mock(Postman.class); final MkBase base = new MkBase(); final Alias author = new EmAlias(base.randomAlias(), postman); final Alias friend = new EmAlias(base.randomAlias(), postman); final Bout bout = author.inbox().bout(author.inbox().start()); bout.friends().invite(author.name()); bout.friends().invite(friend.name()); bout.messages().post("hello"); final ArgumentCaptor<Envelope> captor = ArgumentCaptor.forClass(Envelope.class); Mockito.verify(postman, Mockito.times(1)).send(captor.capture()); final Message msg = captor.getValue().unwrap(); MatcherAssert.assertThat( (InternetAddress[]) msg.getAllRecipients(), Matchers.is( Matchers.array( Matchers.equalTo(new InternetAddress(friend.email())) ) ) ); }
Source:
<code>public void onNext(INDArray array) { if (!bypassMode.get()) { if (accumulator != null) { try { log.info("Putting update to the queue, current size: [{}]", updatesBuffer.size()); updatesBuffer.put(array); } catch (Exception e) { <START> e.printStackTrace(); <END> throw new RuntimeException(e); } } else if (params != null && stepFunction != null) { synchronized (this) { int encoding = array.data().getInt(3); if (encoding == ThresholdCompression.FLEXIBLE_ENCODING) { Nd4j.getExecutioner().thresholdDecode(array, updates); sparseCounter.incrementAndGet(); } else if (encoding == ThresholdCompression.BITMAP_ENCODING) { Nd4j.getExecutioner().bitmapDecode(array, updates); denseCounter.incrementAndGet(); } else throw new DL4JInvalidConfigException("Unknown compression header received: " + encoding); hasSomething.set(true); if (updatesCount.incrementAndGet() % 32 == 0) { flush(); } } } else throw new ND4JIllegalStateException("Accumulator & StepFunction is null at the same time"); } }</code><technical_language>Log instead</technical_language>

Target:
public void onNext(INDArray array) { if (!bypassMode.get()) { if (accumulator != null) { try { log.debug("Putting update to the queue, current size: [{}]", updatesBuffer.size()); updatesBuffer.put(array); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } } else if (params != null && stepFunction != null) { synchronized (this) { int encoding = array.data().getInt(3); if (encoding == ThresholdCompression.FLEXIBLE_ENCODING) { Nd4j.getExecutioner().thresholdDecode(array, updates); sparseCounter.incrementAndGet(); } else if (encoding == ThresholdCompression.BITMAP_ENCODING) { Nd4j.getExecutioner().bitmapDecode(array, updates); denseCounter.incrementAndGet(); } else throw new DL4JInvalidConfigException("Unknown compression header received: " + encoding); hasSomething.set(true); if (updatesCount.incrementAndGet() % 32 == 0) { flush(); } } } else throw new ND4JIllegalStateException("Accumulator & StepFunction is null at the same time"); } }
Source:
<code>public void verifyDefaultConfigurationParamsAreNotUploadedIfConfigurationFileIsSpecified() throws Exception { Path tempdir = folder.getRoot().toPath().toAbsolutePath(); <START> Path configDir = folder.getRoot().toPath().toAbsolutePath(); <END> Path projectDir = tempdir.resolve("py"); Path scriptsDir = projectDir.resolve("scripts"); CommandStatus initStatus = main("init", "-c", config.toString(), projectDir.toString()); assertThat(initStatus.code(), is(0)); Files.createDirectories(scriptsDir); copyResource("acceptance/echo_params/echo_params.dig", projectDir.resolve("echo_params.dig")); copyResource("acceptance/echo_params/scripts/__init__.py", scriptsDir.resolve("__init__.py")); copyResource("acceptance/echo_params/scripts/echo_params.py", scriptsDir.resolve("echo_params.py")); CommandStatus pushStatus = main("push", "--project", projectDir.toString(), "py", "-c", config.toString(), "-e", server.endpoint(), "-r", "4711"); assertThat(pushStatus.errUtf8(), pushStatus.code(), is(0)); Id attemptId; { CommandStatus startStatus = main("start", "-c", config.toString(), "-e", server.endpoint(), "py", "echo_params", "--session", "now"); assertThat(startStatus.code(), is(0)); attemptId = getAttemptId(startStatus); } { RestSessionAttempt attempt = null; for (int i = 0; i < 30; i++) { attempt = client.getSessionAttempt(attemptId); if (attempt.getDone()) { break; } Thread.sleep(1000); } assertThat(attempt.getSuccess(), is(true)); } String logs = getAttemptLogs(client, attemptId); assertThat(logs, containsString("digdag params")); }</code><technical_language>_configDir_ is used</technical_language>

Target:
public void verifyDefaultConfigurationParamsAreNotUploadedIfConfigurationFileIsSpecified() throws Exception { Path tempdir = folder.getRoot().toPath().toAbsolutePath(); Path projectDir = tempdir.resolve("py"); Path scriptsDir = projectDir.resolve("scripts"); CommandStatus initStatus = main("init", "-c", config.toString(), projectDir.toString()); assertThat(initStatus.code(), is(0)); Files.createDirectories(scriptsDir); copyResource("acceptance/echo_params/echo_params.dig", projectDir.resolve("echo_params.dig")); copyResource("acceptance/echo_params/scripts/__init__.py", scriptsDir.resolve("__init__.py")); copyResource("acceptance/echo_params/scripts/echo_params.py", scriptsDir.resolve("echo_params.py")); CommandStatus pushStatus = main("push", "--project", projectDir.toString(), "py", "-c", config.toString(), "-e", server.endpoint(), "-r", "4711"); assertThat(pushStatus.errUtf8(), pushStatus.code(), is(0)); Id attemptId; { CommandStatus startStatus = main("start", "-c", config.toString(), "-e", server.endpoint(), "py", "echo_params", "--session", "now"); assertThat(startStatus.code(), is(0)); attemptId = getAttemptId(startStatus); } { RestSessionAttempt attempt = null; for (int i = 0; i < 30; i++) { attempt = client.getSessionAttempt(attemptId); if (attempt.getDone()) { break; } Thread.sleep(1000); } assertThat(attempt.getSuccess(), is(true)); } String logs = getAttemptLogs(client, attemptId); assertThat(logs, containsString("digdag params")); }
Source:
<code>void terminateJobHandling(final JobId jobId, final Map<String, String> jobGenericInfo) { try { listenJobLogsSupport.cleanLoggers(jobId); jlogger.close(jobId); long removeDelay = Long.MAX_VALUE; if (SchedulingService.SCHEDULER_AUTO_REMOVED_JOB_DELAY > 0) { removeDelay = SchedulingService.SCHEDULER_AUTO_REMOVED_JOB_DELAY; } if (jobGenericInfo != null && jobGenericInfo.containsKey(GENERIC_INFO_REMOVAL_DELAY)) { try { removeDelay = Math.min(removeDelay, Tools.formatDate(jobGenericInfo.get(GENERIC_INFO_REMOVAL_DELAY))); } catch (Exception e) { <START> logger.error("Error when parsing generic information " + GENERIC_INFO_REMOVAL_DELAY + " for job " + <END> jobId, e); } } if (removeDelay < Long.MAX_VALUE) { long timeToRemove = System.currentTimeMillis() + removeDelay; scheduleJobRemove(jobId, timeToRemove); } } catch (Throwable t) { logger.warn("", t); } }</code><technical_language>I advice remind in log of default removal delay ease log exploitation in debugging session</technical_language>

Target:
void terminateJobHandling(final JobId jobId, final Map<String, String> jobGenericInfo) { try { listenJobLogsSupport.cleanLoggers(jobId); jlogger.close(jobId); long removeDelay = Long.MAX_VALUE; if (SchedulingService.SCHEDULER_AUTO_REMOVED_JOB_DELAY > 0) { removeDelay = SchedulingService.SCHEDULER_AUTO_REMOVED_JOB_DELAY; } if (jobGenericInfo != null && jobGenericInfo.containsKey(GENERIC_INFO_REMOVE_DELAY)) { try { removeDelay = Tools.formatDate(jobGenericInfo.get(GENERIC_INFO_REMOVE_DELAY)); } catch (Exception e) { logger.error("Error when parsing generic information " + GENERIC_INFO_REMOVE_DELAY + " for job " + jobId, e); } } if (removeDelay < Long.MAX_VALUE) { long timeToRemove = System.currentTimeMillis() + removeDelay; scheduleJobRemove(jobId, timeToRemove); } } catch (Throwable t) { logger.warn("", t); } }
Source:
<code>public void visitMethodInvocation(MethodInvocationTree tree) { <START> for (MethodMatcher methodMatcher : getMethodInvocationMatchers()) { <END> if (methodMatcher.matches(tree)) { onMethodInvocationFound(tree); break; } } }</code><technical_language>MethodMatcherCollection.anyMatch()</technical_language>

Target:
public void visitMethodInvocation(MethodInvocationTree tree) { if (LAZY_ARG_METHODS.anyMatch(tree) && !insideCatchStatement() && !insideLevelTest()) { onMethodInvocationFound(tree); } }
Source:
<code>private String getByAccountName(CodeReviewCommit codeReviewCommit) { Account account = getAccount(codeReviewCommit); if (account != null && account.getFullName() != null) { return " by " + <START> account.getUserName(); <END> } return ""; }</code><technical_language>getFullName()</technical_language>

Target:
private String getByAccountName(CodeReviewCommit codeReviewCommit) { Account account = getAccount(codeReviewCommit); if (account != null && account.getFullName() != null) { return " by " + account.getFullName(); } return ""; }
Source:
<code>protected void onPostExecute(RectF[] rect) { if (rect != null) { if (mMode == Mode.ARABIC && rect.length == 2) { if (mRightImageView != null && mLeftImageView != null) { mRightImageView.setPageBounds(rect[0]); mLeftImageView.setPageBounds(rect[1]); <START> if (mOverlayText) { <END> Context context = getContext(); String suraText = QuranInfo.getSuraNameFromPage(context, mPageNumber - 1, true); String juzText = QuranInfo.getJuzString(context, mPageNumber - 1); String pageText = QuranUtils.getLocalizedNumber(context, mPageNumber - 1); String rub3Text =QuranDisplayHelper.displayRub3(context,mPageNumber - 1); mRightImageView.setOverlayText(suraText, juzText, pageText, rub3Text); suraText = QuranInfo.getSuraNameFromPage(context, mPageNumber, true); juzText = QuranInfo.getJuzString(context, mPageNumber); pageText = QuranUtils.getLocalizedNumber(context, mPageNumber); rub3Text = QuranDisplayHelper.displayRub3(context,mPageNumber); mLeftImageView.setOverlayText(suraText, juzText, pageText, rub3Text); } } } } }</code><technical_language>+1! is point in checking if context is null. If is null, is seriously broken repair</technical_language>

Target:
protected void onPostExecute(RectF[] rect) { if (rect != null) { if (mMode == Mode.ARABIC && rect.length == 2) { if (mRightImageView != null && mLeftImageView != null) { mRightImageView.setPageBounds(rect[0]); mLeftImageView.setPageBounds(rect[1]); if (mOverlayText && isAdded()) { Context context = getContext(); String suraText = QuranInfo.getSuraNameFromPage(context, mPageNumber - 1, true); String juzText = QuranInfo.getJuzString(context, mPageNumber - 1); String pageText = QuranUtils.getLocalizedNumber(context, mPageNumber - 1); String rub3Text =QuranDisplayHelper.displayRub3(context,mPageNumber - 1); mRightImageView.setOverlayText(suraText, juzText, pageText, rub3Text); suraText = QuranInfo.getSuraNameFromPage(context, mPageNumber, true); juzText = QuranInfo.getJuzString(context, mPageNumber); pageText = QuranUtils.getLocalizedNumber(context, mPageNumber); rub3Text = QuranDisplayHelper.displayRub3(context,mPageNumber); mLeftImageView.setOverlayText(suraText, juzText, pageText, rub3Text); } } } } }
Source:
<code><START> public ExecutorService getIOExecutor() { <END> return ioExecutor; }</code><technical_language>suggestion public Executor getIOExecutor() { enough return Executor do need lifecycle management methods shutdown() outside</technical_language>

Target:
public Executor getIOExecutor() { return ioExecutor; }
Source:
<code>public Response consumerExistsBulk(Set<String> consumerUuids) throws BadRequestException { if (!CollectionUtils.isEmpty(consumerUuids)) { <START> Set<String> nonExistingUuids = consumerCurator.getNonExistingConsumer(consumerUuids); <END> if (nonExistingUuids.isEmpty()) { return Response.status(Response.Status.NO_CONTENT).build(); } else { return Response.status(Response.Status.NOT_FOUND).entity(nonExistingUuids).build(); } } else { throw new BadRequestException(i18n.tr("No UUIDs provided.")); } }</code><technical_language>behavior of getNonExistingConsumers method, this is risky: capabilities of Set implementation passing through</technical_language>

Target:
public Response consumerExistsBulk(Set<String> consumerUuids) throws BadRequestException { if (consumerUuids != null && !consumerUuids.isEmpty()) { Set<String> existingUuids = consumerCurator.getExistingConsumerUuids(consumerUuids); consumerUuids.removeAll(existingUuids); if (consumerUuids.isEmpty()) { return Response.status(Response.Status.NO_CONTENT).build(); } else { return Response.status(Response.Status.NOT_FOUND) .entity(consumerUuids).build(); } } else { throw new BadRequestException(i18n.tr("No UUIDs provided.")); } }
Source:
<code>public void update(OnmsTopologyUpdater updater, OnmsTopologyMessage message) { final OnmsTopologyProtocol protocol = updater.getProtocol(); if (!m_updatersMap.containsKey(protocol)) { throw new IllegalArgumentException(String.format("cannot update message with id: %s. Protocol %s not " + "supported for message status %s", message.getMessagebody().getId(), protocol, message.getMessagestatus())); } if (m_updatersMap.get(protocol) != updater) { throw new IllegalArgumentException(String.format("cannot update message with id: %s, protocol: %s and " + "message status: %s. Updater not registered", message.getMessagebody().getId(), protocol, message.getMessagestatus())); } synchronized (m_consumers) { m_consumers .stream() <START> .filter(consumer -> consumer.getProtocols().contains(protocol)) <END> .forEach(consumer -> consumer.consume(message)); } }</code><technical_language>Is a case, consumer.getProtocols() null</technical_language>

Target:
public void update(OnmsTopologyUpdater updater, OnmsTopologyMessage message) { final OnmsTopologyProtocol protocol = updater.getProtocol(); if (!m_updatersMap.containsKey(protocol)) { throw new IllegalArgumentException(String.format("cannot update message with id: %s. Protocol %s not " + "supported for message status %s", message.getMessagebody().getId(), protocol, message.getMessagestatus())); } if (m_updatersMap.get(protocol) != updater) { throw new IllegalArgumentException(String.format("cannot update message with id: %s, protocol: %s and " + "message status: %s. Updater not registered", message.getMessagebody().getId(), protocol, message.getMessagestatus())); } synchronized (m_consumers) { m_consumers .stream() .filter(consumer -> { if (consumer.getProtocols() == null) { return false; } return consumer.getProtocols().contains(protocol); }) .forEach(consumer -> consumer.consume(message)); } }