auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public void setUp() throws Exception { <END> perms = new AccessPermissionListMock(); user = SecurityPrincipalMocks.createAdministratorUser(); }</code><technical_language>Do throw Exception</technical_language>

Target:
public void setUp() { perms = new AccessPermissionListMock(); user = SecurityPrincipalMocks.createAdministratorUser(); }
Source:
<code>public void initialize() { playerTextField.textProperty().addListener((observable, oldValue, newValue) -> { playerList.setAll(getPlayerNames()); playersListView.getSelectionModel().selectFirst(); }); filteredPlayerList.predicateProperty().bind(Bindings.createObjectBinding(() -> p -> { if (playerService.getCurrentPlayer().map(Player::getUsername).map(n -> n.equals(p)).orElse(true)) { return false; } <START> if (playerTextField.getText().trim().equals("")) { <END> return playerService.getPlayerForUsername(p).map(player -> player.getSocialStatus() == SocialStatus.FRIEND).orElse(false); } else { return p.toLowerCase().contains(playerTextField.getText().toLowerCase()); } }, playerTextField.textProperty() )); playersListView.setItems(sortedPlayerList); playerTextField.setText(""); playerTextField.requestFocus(); }</code><technical_language>playerTextField.getText().isBlank()</technical_language>

Target:
public void initialize() { playerTextField.textProperty().addListener((observable, oldValue, newValue) -> { playersListView.getSelectionModel().selectFirst(); }); playerList.setAll(getPlayerNames()); filteredPlayerList.predicateProperty().bind(Bindings.createObjectBinding(() -> p -> { if (playerService.getCurrentPlayer() .map(Player::getUsername) .map(n -> n.equals(p)) .orElse(true)) { return false; } if (playerTextField.getText().isBlank()) { return playerService.getPlayerForUsername(p) .map(player -> player.getSocialStatus() == SocialStatus.FRIEND) .orElse(false); } else { return p.toLowerCase().contains(playerTextField.getText().toLowerCase()); } }, playerTextField.textProperty() )); playersListView.setItems(sortedPlayerList); playersListView.getSelectionModel().selectFirst(); requestFocus(); }
Source:
<code>protected boolean migrateProperties(int version) { boolean migrated = false; if (version < CONVERT_COLUMNS_AND_TABLE_TO_UPPERCASE_VERSION) { convertColumnsAndTableToUppercase.setValue(false); migrated = true; } if(version < TABLE_ACTION_VERSION) { tableAction.setValue(TableAction.TableActionEnum.NONE); migrated = true; } if (version < CONVERT_EMPTY_STRINGS_TO_NULL_VERSION) { convertEmptyStringsToNull.setValue(true); migrated = true; } if(version < DB_TYPE_SELECTION_VERSION) { <START> usePersonalDBType.setValue(false); <END> migrated = true; } return migrated; }</code><technical_language>default is false, need this migration</technical_language>

Target:
protected boolean migrateProperties(int version) { boolean migrated = false; if (version < CONVERT_COLUMNS_AND_TABLE_TO_UPPERCASE_VERSION) { convertColumnsAndTableToUppercase.setValue(false); migrated = true; } if(version < TABLE_ACTION_VERSION) { tableAction.setValue(TableAction.TableActionEnum.NONE); migrated = true; } if (version < CONVERT_EMPTY_STRINGS_TO_NULL_VERSION) { convertEmptyStringsToNull.setValue(true); migrated = true; } return migrated; }
Source:
<code>private void updateMetrics(long beginProcessing, long endProcessing, SamzaSqlRelMsgMetadata metadata) { insertProcessingTime.update(TranslatorUtils.getMicroDurationFromNanoTimes(beginProcessing, endProcessing)); long outputTime = System.nanoTime(); queryOutputEvents.inc(); Validate.isTrue(metadata.hasScanSystemNanoTime()); long scanTime = metadata.getScanSystemNanoTime(); queryLatency.update(TranslatorUtils.getMicroDurationFromNanoTimes(scanTime, outputTime)); if (metadata.hasArrivalSystemNanoTime()) { long arrivalTime = metadata.getArrivalSystemNanoTime(); queueingLatency.update(TranslatorUtils.getMicroDurationFromNanoTimes(arrivalTime, scanTime)); } if (metadata.hasEventTime()) { long eventTime = metadata.getEventTime(); <START> totalLatency.update(Duration.between(Instant.ofEpochMilli(eventTime), Instant.now()).toMillis()); <END> } }</code><technical_language>this in micros before, changing millis. this is intentional, wanted double check</technical_language>

Target:
private void updateMetrics(long beginProcessing, long endProcessing, SamzaSqlRelMsgMetadata metadata) { insertProcessingTime.update(endProcessing - beginProcessing); queryOutputEvents.inc(); Validate.isTrue(metadata.hasScanTime()); queryLatencyNs.update(System.nanoTime() - metadata.getScanTimeNanos()); if (metadata.hasArrivalTime()) { queuingLatencyMS.update(metadata.getScanTimeMillis() - metadata.getArrivalTime()); } if (metadata.hasEventTime()) { totalLatencyMs.update(System.currentTimeMillis() - metadata.getEventTime()); } }
Source:
<code>public Object combine(Object lhs, Object rhs) { <START> return (((SerializablePair<Long, Double>) lhs).lhs > ((SerializablePair<Long, Double>) rhs).lhs) ? lhs : rhs; <END> }</code><technical_language>comparator</technical_language>

Target:
public Object combine(Object lhs, Object rhs) { return DoubleFirstAggregatorFactory.TIME_COMPARATOR.compare(lhs, rhs) > 0 ? lhs : rhs; }
Source:
<code><START> void addUnloadedPlayer(String id, EntityData.PlayerStore unloadedPlayer) { <END> unloadedPlayers.put(id, unloadedPlayer); }</code><technical_language>More meaningless access changes</technical_language>

Target:
public void addUnloadedPlayer(String id, EntityData.PlayerStore unloadedPlayer) { unloadedPlayers.put(id, unloadedPlayer); }
Source:
<code>private void linkPointsToStreets(boolean all) { LambdaCounter counter = new LambdaCounter(LOG, pointSet.featureCount(), 10000, "Linked of PointSet points to streets."); IntStream.range(0, pointSet.featureCount()).parallel().forEach(p -> { <START> if (all || streetLayer.edgeStore.temporarilyDeletedEdges != null && streetLayer.edgeStore.temporarilyDeletedEdges.contains(edges[p])) { <END> Split split = streetLayer.findSplit(pointSet.getLat(p), pointSet.getLon(p), MAX_OFFSTREET_WALK_METERS, streetMode); if (split == null) { edges[p] = -1; } else { edges[p] = split.edge; distances0_mm[p] = split.distance0_mm; distances1_mm[p] = split.distance1_mm; } counter.increment(); } }); long unlinked = Arrays.stream(edges).filter(e -> e == -1).count(); counter.done(); LOG.info("{} points are not linked to the street network.", unlinked); }</code><technical_language>I lean grouping sub-expression || parentheses relying reader's operator precedence knowledge</technical_language>

Target:
private void linkPointsToStreets(boolean all) { LambdaCounter counter = new LambdaCounter(LOG, pointSet.featureCount(), 10000, "Linked of PointSet points to streets."); IntStream.range(0, pointSet.featureCount()).parallel().forEach(p -> { if (all || (streetLayer.edgeStore.temporarilyDeletedEdges != null && streetLayer.edgeStore.temporarilyDeletedEdges.contains(edges[p]))) { Split split = streetLayer.findSplit(pointSet.getLat(p), pointSet.getLon(p), MAX_OFFSTREET_WALK_METERS, streetMode); if (split == null) { edges[p] = -1; } else { edges[p] = split.edge; distances0_mm[p] = split.distance0_mm; distances1_mm[p] = split.distance1_mm; } counter.increment(); } }); long unlinked = Arrays.stream(edges).filter(e -> e == -1).count(); counter.done(); LOG.info("{} points are not linked to the street network.", unlinked); }
Source:
<code>public void testRebuildArtifactsIndexes() <START> throws NoSuchAlgorithmException, XmlPullParserException, <END> IOException, ClassNotFoundException, SchedulerException, InstantiationException, CronTaskException, IllegalAccessException, CronTaskNotFoundException, InterruptedException, ParseException { String jobName = "RebuildIndex-1"; addRebuildCronJobConfig(jobName, "storage0", "releases-one", ARTIFACT_BASE_PATH_STRONGBOX_INDEXES); while (!jobManager.getExecutedJobs().containsKey(jobName)) { Thread.sleep(8000); } System.out.println(jobManager.getExecutedJobs().toString()); SearchRequest request = new SearchRequest("storage0", "releases-one", "+g:org.carlspring.strongbox.indexes +a:strongbox-test-one +v:1.0 +p:jar"); assertTrue(artifactSearchService.contains(request)); deleteRebuildCronJobConfig(jobName); }</code><technical_language>I in test cases these, fine replace huge lists of thrown exceptions throws Exception. mind correcting this other test methods</technical_language>

Target:
public void testRebuildArtifactsIndexes() throws Exception { String jobName = "RebuildIndex-1"; addRebuildCronJobConfig(jobName, "storage0", "releases-one", ARTIFACT_BASE_PATH_STRONGBOX_INDEXES); while (!jobManager.getExecutedJobs().containsKey(jobName)) { Thread.sleep(8000); } System.out.println(jobManager.getExecutedJobs().toString()); SearchRequest request = new SearchRequest("storage0", "releases-one", "+g:org.carlspring.strongbox.indexes +a:strongbox-test-one +v:1.0 +p:jar"); assertTrue(artifactSearchService.contains(request)); deleteRebuildCronJobConfig(jobName); }
Source:
<code>private boolean isRenameAllowed(String catalogName, String srcDBName, String destDBName) throws MetaException, NoSuchObjectException { RawStore ms = getMS(); if (!srcDBName.equalsIgnoreCase(destDBName)) { Database destDB = ms.getDatabase(catalogName, destDBName); <START> if (destDB == null) { <END> throw new NoSuchObjectException("The destination db " + destDBName + " is not found"); } Database srcDB = ms.getDatabase(catalogName, srcDBName); if (srcDB == null) { throw new NoSuchObjectException("The source db " + srcDBName + " is not found"); } if (ReplChangeManager.isSourceOfReplication(srcDB) || ReplChangeManager.isSourceOfReplication(destDB)) { LOG.info("Cannot rename as either " + srcDBName + " or " + destDBName + " is a source of replication"); return false; } } return true; }</code><technical_language>ms.getDatabase return null instead throw NoSuchObjectException. need handle anywhere</technical_language>

Target:
private boolean isRenameAllowed(String catalogName, String srcDBName, String destDBName) throws MetaException, NoSuchObjectException { RawStore ms = getMS(); if (!srcDBName.equalsIgnoreCase(destDBName)) { Database destDB = ms.getDatabase(catalogName, destDBName); Database srcDB = ms.getDatabase(catalogName, srcDBName); if (ReplChangeManager.isSourceOfReplication(srcDB) || ReplChangeManager.isSourceOfReplication(destDB)) { return false; } } return true; }
Source:
<code>public void testWithEmptySet() { final Set<AlarmNotification> alarmNotificationSet = new TreeSet<AlarmNotification>(); final AlarmNotifications alarmNotifications = new AlarmNotifications(alarmNotificationSet); final AlarmNotificationsDto alarmNotificationsDto = this.configurationMapper.map(alarmNotifications, AlarmNotificationsDto.class); <START> assertNotNull(alarmNotifications); <END> assertNotNull(alarmNotificationsDto); assertNotNull(alarmNotificationSet); assertNotNull(alarmNotificationsDto.getAlarmNotifications()); assertTrue(alarmNotificationSet.isEmpty()); assertTrue(alarmNotificationsDto.getAlarmNotifications().isEmpty()); assertEquals(alarmNotificationSet.isEmpty(), alarmNotificationsDto.getAlarmNotifications().isEmpty()); }</code><technical_language>delete this line</technical_language>

Target:
public void testWithEmptySet() { final Set<AlarmNotification> alarmNotificationSet = new TreeSet<AlarmNotification>(); final AlarmNotifications alarmNotifications = new AlarmNotifications(alarmNotificationSet); final AlarmNotificationsDto alarmNotificationsDto = this.configurationMapper.map(alarmNotifications, AlarmNotificationsDto.class); assertNotNull(alarmNotificationsDto); assertNotNull(alarmNotificationsDto.getAlarmNotificationsSet()); assertTrue(alarmNotificationsDto.getAlarmNotificationsSet().isEmpty()); }
Source:
<code>public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException { log.debug("Attempting Keycloak authentication"); HttpFacade facade = new SimpleHttpFacade(request, response); KeycloakDeployment deployment = adapterDeploymentContext.resolveDeployment(facade); AdapterTokenStore tokenStore = adapterTokenStoreFactory.createAdapterTokenStore(deployment, request); RequestAuthenticator authenticator = new SpringSecurityRequestAuthenticator(facade, request, deployment, tokenStore, -1); AuthOutcome result = authenticator.authenticate(); log.debug("Auth outcome: {}", result); if (AuthOutcome.FAILED.equals(result)) { throw new KeycloakAuthenticationException("Auth outcome: " + result); } <START> <END> else if (AuthOutcome.AUTHENTICATED.equals(result)) { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); Assert.notNull(authentication, "Authentication SecurityContextHolder was null"); return authenticationManager.authenticate(authentication); } else { AuthChallenge challenge = authenticator.getChallenge(); if (challenge != null) { challenge.challenge(facade); } return null; } }</code><technical_language>Remove formatting changes</technical_language>

Target:
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException { log.debug("Attempting Keycloak authentication"); HttpFacade facade = new SimpleHttpFacade(request, response); KeycloakDeployment deployment = adapterDeploymentContext.resolveDeployment(facade); deployment.setContainerErrorPage(false); AdapterTokenStore tokenStore = adapterTokenStoreFactory.createAdapterTokenStore(deployment, request); RequestAuthenticator authenticator = new SpringSecurityRequestAuthenticator(facade, request, deployment, tokenStore, -1); AuthOutcome result = authenticator.authenticate(); log.debug("Auth outcome: {}", result); if (AuthOutcome.FAILED.equals(result)) { throw new KeycloakAuthenticationException("Auth outcome: " + result); } else if (AuthOutcome.AUTHENTICATED.equals(result)) { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); Assert.notNull(authentication, "Authentication SecurityContextHolder was null"); return authenticationManager.authenticate(authentication); } else { AuthChallenge challenge = authenticator.getChallenge(); if (challenge != null) { challenge.challenge(facade); } return null; } }
Source:
<code>public ListenableFuture<?> execute(AlterFunction statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters) { Analyzer analyzer = new Analyzer(stateMachine.getSession(), metadata, sqlParser, accessControl, Optional.empty(), parameters, stateMachine.getWarningCollector()); analyzer.analyze(statement); QualifiedFunctionName functionName = QualifiedFunctionName.of(statement.getFunctionName().toString()); AlterRoutineCharacteristics alterRoutineCharacteristics = new AlterRoutineCharacteristics( <START> statement.getCharacteristics().getNullCallClause().map(nullCallClause -> RoutineCharacteristics.NullCallClause.valueOf(nullCallClause.name()))); <END> metadata.getFunctionManager().alterFunction( functionName, statement.getParameterTypes().map(types -> types.stream().map(TypeSignature::parseTypeSignature).collect(toImmutableList())), alterRoutineCharacteristics); return immediateFuture(null); }</code><technical_language>I supporting null-call stuff open for other if add else easier add</technical_language>

Target:
public ListenableFuture<?> execute(AlterFunction statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters) { Analyzer analyzer = new Analyzer(stateMachine.getSession(), metadata, sqlParser, accessControl, Optional.empty(), parameters, stateMachine.getWarningCollector()); analyzer.analyze(statement); QualifiedFunctionName functionName = QualifiedFunctionName.of(statement.getFunctionName().toString()); AlterRoutineCharacteristics alterRoutineCharacteristics = new AlterRoutineCharacteristics( statement.getCharacteristics().getNullCallClause() .map(com.facebook.presto.sql.tree.RoutineCharacteristics.NullCallClause::name) .map(NullCallClause::valueOf)); metadata.getFunctionManager().alterFunction( functionName, statement.getParameterTypes().map(types -> types.stream() .map(TypeSignature::parseTypeSignature) .collect(toImmutableList())), alterRoutineCharacteristics); return immediateFuture(null); }
Source:
<code>public void testSubjectAndDescriptionProperties() { ProcessInstance processInstance = kieSession.startProcess(HUMAN_TASK_ID); <START> List<TaskSummary> list = taskService.getTasksAssignedAsPotentialOwner("john", "en-UK"); <END> TaskSummary task = list.get(0); Task t = taskService.getTaskById(task.getId()); Assertions.assertThat(task.getDescription()).isEqualTo("This is description of the human task."); Assertions.assertThat(task.getSubject()).isNullOrEmpty(); Assertions.assertThat(t.getSubject()).isEqualTo("Bake a cake"); taskService.start(task.getId(), "john"); taskService.complete(task.getId(), "john", null); ProcessInstanceLog plog = getLogService().findProcessInstance(processInstance.getId()); Assertions.assertThat(plog.getStatus()).isEqualTo(ProcessInstance.STATE_COMPLETED); }</code><technical_language>a lot of repetition in this test... "john", "en-UK", "Bake a cake" etc. ... constants reuse</technical_language>

Target:
public void testSubjectAndDescriptionProperties() { ProcessInstance processInstance = kieSession.startProcess(HUMAN_TASK_ID); List<TaskSummary> list = taskService.getTasksAssignedAsPotentialOwner("john", "en-UK"); TaskSummary task = list.get(0); Task t = taskService.getTaskById(task.getId()); Assertions.assertThat(task.getDescription()).isEqualTo("This is description of the human task."); Assertions.assertThat(task.getSubject()).isNullOrEmpty(); Assertions.assertThat(t.getSubject()).isEqualTo(EXPECTED_SUBJECT); taskService.start(task.getId(), "john"); taskService.complete(task.getId(), "john", null); ProcessInstanceLog plog = getLogService().findProcessInstance(processInstance.getId()); Assertions.assertThat(plog.getStatus()).isEqualTo(ProcessInstance.STATE_COMPLETED); }
Source:
<code>public Mono<Long> schedule(ServiceBusMessage messageToSchedule, Instant scheduledEnqueueTime, int maxSendLinkSize) { messageToSchedule.setScheduledEnqueueTime(scheduledEnqueueTime); <START> return isAuthorized(SCHEDULE_MESSAGE_OPERATION).thenMany(createRequestResponse.flatMap(channel -> { <END> Message requestMessage = createManagementMessage(SCHEDULE_MESSAGE_OPERATION, channel.getReceiveLinkName()); Map<String, Object> requestBodyMap = createScheduleMessgeAmqpValue(messageToSchedule, maxSendLinkSize); requestMessage.setBody(new AmqpValue(requestBodyMap)); return channel.sendWithAck(requestMessage); }).flatMapMany(responseMessage -> { int statusCode = RequestResponseUtils.getResponseStatusCode(responseMessage); if (statusCode != AmqpResponseCode.OK.getValue()) { return FluxUtil.monoError(logger, new AmqpException(false, String.format("Could not schedule message with message id: '%s'.", messageToSchedule.getMessageId()), getErrorContext())); } return Flux.fromIterable(messageSerializer.deserializeList(responseMessage, Long.class)); })) .next(); }</code><technical_language>item list.. return a mono instead of wrapping in a flux</technical_language>

Target:
public Mono<Long> schedule(ServiceBusMessage messageToSchedule, Instant scheduledEnqueueTime, int maxSendLinkSize) { messageToSchedule.setScheduledEnqueueTime(scheduledEnqueueTime); return isAuthorized(SCHEDULE_MESSAGE_OPERATION).then(createRequestResponse.flatMap(channel -> { Message requestMessage = createManagementMessage(SCHEDULE_MESSAGE_OPERATION, channel.getReceiveLinkName()); Map<String, Object> requestBodyMap = createScheduleMessgeAmqpValue(messageToSchedule, maxSendLinkSize); requestMessage.setBody(new AmqpValue(requestBodyMap)); return channel.sendWithAck(requestMessage); }).map(responseMessage -> { int statusCode = RequestResponseUtils.getResponseStatusCode(responseMessage); if (statusCode != AmqpResponseCode.OK.getValue()) { throw logger.logExceptionAsError(new AmqpException(false, String.format("Could not schedule message with message id: '%s'.", messageToSchedule.getMessageId()), getErrorContext())); } List<Long> sequenceNumberList = messageSerializer.deserializeList(responseMessage, Long.class); if (CoreUtils.isNullOrEmpty(sequenceNumberList)) { throw logger.logExceptionAsError(new AmqpException(false, String.format("Service bus response empty. Could not schedule message with message id: '%s'.", messageToSchedule.getMessageId()), getErrorContext())); } return sequenceNumberList.get(0); })); }
Source:
<code>private static final File getBaseDir() throws FileNotFoundException { String baseEnv = System.getenv("BASE"); if (baseEnv == null) { <START> throw new FileNotFoundException("Unable to locate Jenkins base directory. Environment variable 'BASE' not found."); <END> } return new File(baseEnv); }</code><technical_language>I try Jenkins root dir a fallback. is a risk of breaking some cases</technical_language>

Target:
private static final File getBaseDir() { File baseDir; String baseEnv = System.getenv("BASE"); if (baseEnv != null) { baseDir = new File(baseEnv); } else { LOGGER.log(Level.WARNING, "Could not find environment variable 'BASE' for Jenkins base directory. Falling back to JENKINS_HOME"); baseDir = Jenkins.getInstance().getRootDir(); } return baseDir; }
Source:
<code>private void actionCompleted(SegmentHolder segmentHolder) { switch (segmentHolder.getType()) { case LOAD: segmentsToLoad.remove(segmentHolder.getSegment()); queuedSize.addAndGet(-segmentHolder.getSegmentSize()); break; case DROP: segmentsToDrop.remove(segmentHolder.getSegment()); break; default: throw new UnsupportedOperationException(); } callBackExecutor.execute( <START> () -> executeCallbacks(segmentHolder) <END> ); }</code><technical_language>Pointless level submission. executeCallbacks() submits callback another time (this means valuable annotate method in this class in executor supposed run. executors, "external", client code execution context (which kind of runs)</technical_language>

Target:
private void actionCompleted(SegmentHolder segmentHolder) { switch (segmentHolder.getType()) { case LOAD: segmentsToLoad.remove(segmentHolder.getSegment()); queuedSize.addAndGet(-segmentHolder.getSegmentSize()); break; case DROP: segmentsToDrop.remove(segmentHolder.getSegment()); break; default: throw new UnsupportedOperationException(); } executeCallbacks(segmentHolder); }
Source:
<code>public Map<String, Object> calculateInputVariables(DelegateExecution execution) { Extension extensions = processExtensionService.getExtensionsForId(execution.getProcessDefinitionId()); Map<String, Object> constants = calculateConstants(execution, extensions); if (!extensions.hasMapping(execution.getCurrentActivityId())) { return constants; } Map<String, Object> inboundVariables; <START> if (extensions.hasMappingTypeInputs(execution.getCurrentActivityId())) { <END> inboundVariables = execution.getVariables(); } else { inboundVariables = calculateInputVariables(execution, extensions); } inboundVariables = expressionResolver.resolveExpressionsMap(new VariableScopeExpressionEvaluator(execution), inboundVariables); inboundVariables.putAll(constants); return inboundVariables; }</code><technical_language>a bit confused here. Possibly need rename this method. shouldMapAllInputs. do think</technical_language>

Target:
public Map<String, Object> calculateInputVariables(DelegateExecution execution) { Extension extensions = processExtensionService.getExtensionsForId(execution.getProcessDefinitionId()); Map<String, Object> constants = calculateConstants(execution, extensions); if (!extensions.hasMapping(execution.getCurrentActivityId())) { return constants; } Map<String, Object> inboundVariables; if (extensions.shouldMapAllInputs(execution.getCurrentActivityId())) { inboundVariables = execution.getVariables(); } else { inboundVariables = calculateInputVariables(execution, extensions); } inboundVariables = expressionResolver.resolveExpressionsMap(new VariableScopeExpressionEvaluator(execution), inboundVariables); inboundVariables.putAll(constants); return inboundVariables; }
Source:
<code>public void testListAccounts() throws Exception { List<AccountInfo> possibleAccounts = api().listAccounts(); assertNotNull(possibleAccounts, "possibleAccounts was not set"); assertTrue(possibleAccounts.size() > 0, "Expected at least 1 Account but list was empty"); boolean accountFound = false; for (AccountInfo possibleAccount : possibleAccounts) { if (possibleAccount.username().equals(username)) { accountFound = true; } <START> } <END> assertTrue(accountFound, "Expected but could not find Account amongst " + possibleAccounts.size() + " found"); }</code><technical_language>a more idiomatic Iterables.find similar approach</technical_language>

Target:
public void testListAccounts() throws Exception { List<AccountInfo> possibleAccounts = api().listAccounts(); assertNotNull(possibleAccounts, "possibleAccounts was not set"); assertTrue(possibleAccounts.size() > 0, "Expected at least 1 Account but list was empty"); AccountInfo possibleAccount = Iterables.find(possibleAccounts, new Predicate<AccountInfo>() { @Override public boolean apply(AccountInfo arg0) { return arg0.userName().equals(username); } }, null); assertNotNull(possibleAccount, "Expected but could not find Account amongst " + possibleAccounts.size() + " found"); }
Source:
<code>public Optional<Task> getTask(String taskid) { Preconditions.checkNotNull(taskid, "taskid"); if(tasks.containsKey(taskid)) { <START> return Optional.of(tasks.get(taskid).task); <END> } else { return Optional.absent(); } }</code><technical_language>Accessing fields is generally frowned in idiomatic Java. I annoying extra couple of keystrokes, appears Task object is encapsulating state</technical_language>

Target:
public Optional<Task> getTask(String taskid) { Preconditions.checkNotNull(taskid, "taskid"); if(tasks.containsKey(taskid)) { return Optional.of(tasks.get(taskid).getTask()); } else { return Optional.absent(); } }
Source:
<code>public TTSService getTTS() { TTSService tts = null; if (defaultTTS != null) { tts = ttsServices.get(defaultTTS); if (tts == null) { logger.warn("Default TTS service '{}' not available!", defaultTTS); } <START> } else if (ttsServices.size() > 0) { <END> tts = ttsServices.values().iterator().next(); } else { logger.debug("No TTS service available!"); } return tts; }</code><technical_language>If interested in real size check if is element, isEmpty() (or negative result of that). Size more expensive (runtime) isEmpty</technical_language>

Target:
public TTSService getTTS() { TTSService tts = null; if (defaultTTS != null) { tts = ttsServices.get(defaultTTS); if (tts == null) { logger.warn("Default TTS service '{}' not available!", defaultTTS); } } else if (!ttsServices.isEmpty()) { tts = ttsServices.values().iterator().next(); } else { logger.debug("No TTS service available!"); } return tts; }
Source:
<code><START> protected <T> T invokeWithRetry(Callable<T> func, T defaultReturnValue) throws Exception { <END> for (int currentRetryCount = 1; currentRetryCount <= MAX_RETY_COUNT; currentRetryCount++) { try { LOG.debug("HiveAtlasPlugin: retrying method: {}", func.getClass().getName(), null); return func.call(); } catch (Exception e) { if (processImportExportLockException(e, currentRetryCount)) { continue; } if (processInvalidParameterException(e)) { return null; } LOG.error("HiveAtlasPlugin: " + func.getClass().getName(), e); throw new Exception(e); } } return defaultReturnValue; }</code><technical_language>reuse existing retry classes</technical_language>

Target:
protected <T> T invokeWithRetry(Callable<T> func, T defaultReturnValue) throws Exception { for (int currentRetryCount = 1; currentRetryCount <= MAX_RETY_COUNT; currentRetryCount++) { try { LOG.debug("Retrying method: {}", func.getClass().getName(), null); return func.call(); } catch (Exception e) { if (processImportExportLockException(e, currentRetryCount)) { continue; } if (processInvalidParameterException(e)) { return null; } LOG.error(func.getClass().getName(), e); throw new Exception(e); } } return defaultReturnValue; }
Source:
<code>protected BusinessDetail loadBusinessDetail(File file) throws JAXBException { BusinessDetail resp = null; try { synchronized (file) { JAXBContext context = JAXBContext.newInstance(BusinessDetail.class); final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); dbf.setFeature(NhincConstants.FEATURE_GENERAL_ENTITIES, false); dbf.setFeature(NhincConstants.FEATURE_DISALLOW_DOCTYPE, true); dbf.setFeature(NhincConstants.FEATURE_PARAMETER_ENTITIES, false); dbf.setExpandEntityReferences(false); final DocumentBuilder db = dbf.newDocumentBuilder(); final Document doc = db.parse(file); doc.getDocumentElement().normalize(); DOMSource source = new DOMSource(doc); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); StreamResult result = new StreamResult(); ByteArrayOutputStream out = new ByteArrayOutputStream(); result.setOutputStream(out); transformer.transform(source, result); ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); Unmarshaller unmarshaller = context.createUnmarshaller(); JAXBElement<BusinessDetail> jaxbElement = unmarshaller.unmarshal(new StreamSource(in), BusinessDetail.class); resp = jaxbElement.getValue(); } <START> } catch (final IOException e) { <END> LOG.error("unable to load XDRConfiguration file", e); } catch (final ParserConfigurationException e) { LOG.error("unable to load XDRConfiguration file", e); } catch (final TransformerException e) { LOG.error("unable to load XDRConfiguration file", e); } catch (final SAXException e) { LOG.error("unable to load XDRConfiguration file", e); } return resp; }</code><technical_language>a multicatch</technical_language>

Target:
protected BusinessDetail loadBusinessDetail(File file) throws JAXBException { BusinessDetail resp = null; FileInputStream inputStream = null; try { synchronized (file) { JAXBContext context = JAXBContext.newInstance(BusinessDetail.class); Unmarshaller unmarshaller = context.createUnmarshaller(); JAXBUnmarshallingUtil util = new JAXBUnmarshallingUtil(); inputStream = new FileInputStream(file); JAXBElement<BusinessDetail> jaxbElement = unmarshaller .unmarshal(util.getSafeStreamReaderFromInputStream(inputStream), BusinessDetail.class); resp = jaxbElement.getValue(); } } catch (FileNotFoundException | XMLStreamException e) { LOG.error("Exception in reading/parsing Connection Information file: {}", e.getLocalizedMessage(), e); } finally { StreamUtils.closeStreamSilently(inputStream); } return resp; }
Source:
<code>private Guid getStorageDomainId(Disk disk) { if (disk.isSetStorageDomains() && disk.getStorageDomains().isSetStorageDomains() && disk.getStorageDomains().getStorageDomains().get(0).isSetId()) { return asGuid(disk.getStorageDomains().getStorageDomains().get(0).getId()); } else if (disk.isSetStorageDomains() && disk.getStorageDomains().getStorageDomains().get(0).isSetName()) { String storageName = disk.getStorageDomains().getStorageDomains().get(0).getName(); Guid storageDomainId = getStorageDomainIdByName(storageName); if (storageDomainId == null) { throw new WebFaultException(null, localize(Messages.BACKEND_FAILED), localize(Messages.ENTITY_NOT_FOUND_TEMPLATE, storageName), <START> Response.Status.NOT_FOUND); <END> } else { return storageDomainId; } } return null; }</code><technical_language>do this 'notFound' method? other callers of 'notFound' benefit this enhanced behavior</technical_language>

Target:
private Guid getStorageDomainId(Disk disk) { if (disk.isSetStorageDomains() && disk.getStorageDomains().isSetStorageDomains() && disk.getStorageDomains().getStorageDomains().get(0).isSetId()) { return asGuid(disk.getStorageDomains().getStorageDomains().get(0).getId()); } else if (disk.isSetStorageDomains() && disk.getStorageDomains().getStorageDomains().get(0).isSetName()) { String storageName = disk.getStorageDomains().getStorageDomains().get(0).getName(); Guid storageDomainId = getStorageDomainIdByName(storageName); if (storageDomainId == null) { notFound(storageName); } else { return storageDomainId; } } return null; }
Source:
<code>private void testEncryptDecrypt(byte[] payload) throws GeneralSecurityException, HandshakeException { Record record = new Record(ContentType.APPLICATION_DATA, EPOCH, 1, new ApplicationMessage(payload, session.getPeer()), session, true, 0); byte[] raw = record.toByteArray(); List<Record> list = Record.fromByteArray(raw, session.getPeer(), null, ClockUtil.nanoRealtime()); assertFalse("failed to decode raw message", list.isEmpty()); for (Record recv : list) { recv.setSession(session); DTLSMessage message = recv.getFragment(); <START> assertArrayEquals("decrpted payload differs", payload, message.toByteArray()); <END> } }</code><technical_language>typo : "decrypted"</technical_language>

Target:
private void testEncryptDecrypt(byte[] payload) throws GeneralSecurityException, HandshakeException { Record record = new Record(ContentType.APPLICATION_DATA, EPOCH, 1, new ApplicationMessage(payload, session.getPeer()), session, true, 0); byte[] raw = record.toByteArray(); List<Record> list = Record.fromByteArray(raw, session.getPeer(), null, ClockUtil.nanoRealtime()); assertFalse("failed to decode raw message", list.isEmpty()); for (Record recv : list) { recv.setSession(session); DTLSMessage message = recv.getFragment(); assertArrayEquals("decrypted payload differs", payload, message.toByteArray()); } }
Source:
<code>public void setDstAddrHostname(String dstAddrHostname) { <START> addHost(dstAddrHostname); <END> this.dstAddrHostname = dstAddrHostname; }</code><technical_language>update addHost() method includes Objects.requireNonNull() check host. I missed originally</technical_language>

Target:
public void setDstAddrHostname(String dstAddrHostname) { this.dstAddrHostname = dstAddrHostname; }
Source:
<code>private static <START> SWTBotView openSymbolProviderDialog() <END> { final SWTBotView viewBot = fBot.viewById(CallStackView.ID); viewBot.setFocus(); viewBot.toolbarButton(CONFIGURE_SYMBOL_PROVIDERS).click(); fBot.waitUntil(Conditions.shellIsActive("Symbol mapping")); return viewBot; }</code><technical_language>I more useful return SWTBotShell of dialog is opened this method</technical_language>

Target:
private static void openSymbolProviderDialog() { final SWTBotView viewBot = fBot.viewById(CallStackView.ID); viewBot.setFocus(); viewBot.toolbarButton(CONFIGURE_SYMBOL_PROVIDERS).click(); fBot.waitUntil(Conditions.shellIsActive("Symbol mapping")); }
Source:
<code>private static Activity getActivity(final Context context) { <START> if (context == null) { <END> return null; } else if (context instanceof Activity) { return (Activity) context; } else if (context instanceof ContextWrapper) { return getActivity(((ContextWrapper) context).getBaseContext()); } return null; }</code><technical_language>if is superfluous. instanceof is false for null, a null bypasses instanceof checks returns null end of method already</technical_language>

Target:
private static Activity getActivity(final Context context) { if (context instanceof Activity) { return (Activity) context; } else if (context instanceof ContextWrapper) { return getActivity(((ContextWrapper) context).getBaseContext()); } return null; }
Source:
<code>private void setFinalResult( Result resultMessage, Frame responseFrame, boolean schemaInAgreement, NodeResponseCallback callback) { try { ExecutionInfo executionInfo = buildExecutionInfo(callback, resultMessage, responseFrame, schemaInAgreement); AsyncResultSet resultSet = Conversions.toResultSet(resultMessage, executionInfo, session, context); if (result.complete(resultSet)) { cancelScheduledTasks(); session .getMetricUpdater() .updateTimer( CoreSessionMetric.cql_requests, <START> System.nanoTime() - startTimeNanos, <END> TimeUnit.NANOSECONDS); } } catch (Throwable error) { setFinalError(error); } }</code><technical_language>Is reason nanoTime is instead of Timer.Context a Timer is in metrics disabled</technical_language>

Target:
private void setFinalResult( Result resultMessage, Frame responseFrame, boolean schemaInAgreement, NodeResponseCallback callback) { try { ExecutionInfo executionInfo = buildExecutionInfo(callback, resultMessage, responseFrame, schemaInAgreement); AsyncResultSet resultSet = Conversions.toResultSet(resultMessage, executionInfo, session, context); if (result.complete(resultSet)) { cancelScheduledTasks(); session .getMetricUpdater() .updateTimer( CoreSessionMetric.CQL_REQUESTS, System.nanoTime() - startTimeNanos, TimeUnit.NANOSECONDS); } } catch (Throwable error) { setFinalError(error); } }
Source:
<code>private void handleConnectionClosedException() { while (true) { try { destroyState(); reconnect(); retrieveEntity(); connectionRecoveryListener.run(); return; <START> } catch (ConnectionClosedException | ConnectionShutdownException e) { <END> LOGGER.info("Disconnected to the server", e); } } }</code><technical_language>a break. rest of code</technical_language>

Target:
private void handleConnectionClosedException() { while (true) { try { destroyState(); reconnect(); retrieveEntity(); connectionRecoveryListener.run(); break; } catch (ConnectionClosedException | ConnectionShutdownException e) { LOGGER.info("Disconnected from the server", e); } } }
Source:
<code>public Injector init() throws Exception { Map<String, SecureStoreLoadUtil.Metadata> secureStores = getAllSecureStores(); Set<String> secureStoreNames = <START> Sets.newHashSet(secureStores.keySet()); <END> if (secureStoreNames.isEmpty()) { return createInjectorWithCustomSecureStore(DefaultSecureStore.class); } secureStoreNames.add(DefaultSecureStore.NAME); String currentProvider = getCurrentSecureStoreName(); String secureStoreName = ui.readString(currentProvider, secureStoreNames, "Secure store"); if (DefaultSecureStore.NAME.equals(secureStoreName)) { if (!DefaultSecureStore.NAME.equals(currentProvider)) { flags.cfg.unset("gerrit", null, "secureStore"); } return createInjectorWithCustomSecureStore(DefaultSecureStore.class); } SecureStoreLoadUtil.Metadata selectedPlugin = secureStores.get(secureStoreName); File installedPlugin = installPlugin(selectedPlugin.jarFile, ui, site); flags.cfg.setString("gerrit", null, "secureStore", secureStoreName); Class<? extends SecureStore> storeClass = selectedPlugin.load(installedPlugin); return createInjectorWithCustomSecureStore(storeClass); }</code><technical_language>Sets.newTreeSet() list is sorted in</technical_language>

Target:
public Injector init() throws Exception { Map<String, SecureStoreLoadUtil.Metadata> secureStores = getAllSecureStores(); Set<String> secureStoreNames = Sets.newTreeSet(secureStores.keySet()); if (secureStoreNames.isEmpty()) { return createInjectorWithCustomSecureStore(DefaultSecureStore.class); } secureStoreNames.add(DefaultSecureStore.NAME); String currentProvider = getCurrentSecureStoreName(); String secureStoreName = ui.readString(currentProvider, secureStoreNames, "Secure store"); if (DefaultSecureStore.NAME.equals(secureStoreName)) { if (!DefaultSecureStore.NAME.equals(currentProvider)) { flags.cfg.unset("gerrit", null, "secureStore"); } return createInjectorWithCustomSecureStore(DefaultSecureStore.class); } SecureStoreLoadUtil.Metadata selectedPlugin = secureStores.get(secureStoreName); File installedPlugin = installPlugin(selectedPlugin, ui, site); flags.cfg.setString("gerrit", null, "secureStore", secureStoreName); Class<? extends SecureStore> storeClass = selectedPlugin.load(installedPlugin); return createInjectorWithCustomSecureStore(storeClass); }
Source:
<code>public LogData(ByteBuf buf) { lastKnownSize = buf.readableBytes(); <START> type = ICorfuPayload.fromBuffer(buf, DataType.class); <END> if (type == DataType.DATA) { data = ICorfuPayload.fromBuffer(buf, byte[].class); } else { data = null; } if (type.isMetadataAware()) { metadataMap = ICorfuPayload.enumMapFromBuffer(buf, IMetadata.LogUnitMetadataType.class); } else { metadataMap = new EnumMap<>(IMetadata.LogUnitMetadataType.class); } }</code><technical_language>buf.readerIndex()</technical_language>

Target:
public LogData(ByteBuf buf) { try { lastKnownSize = buf.readableBytes(); type = ICorfuPayload.fromBuffer(buf, DataType.class); if (type == DataType.DATA) { data = ICorfuPayload.fromBuffer(buf, byte[].class); } else { data = null; } if (type.isMetadataAware()) { buf.readInt(); metadataMap = ICorfuPayload.enumMapFromBuffer(buf, IMetadata.LogUnitMetadataType.class); } else { metadataMap = new EnumMap<>(IMetadata.LogUnitMetadataType.class); } } catch (Exception e) { throw e; } }
Source:
<code>void setBackgroundColor (long context, long handle, GdkRGBA rgba) { if (rgba == null) { GdkColor temp = getDisplay().COLOR_LIST_BACKGROUND; <START> background = new GdkRGBA (); <END> background = display.toGdkRGBA (temp); } else { background = rgba; } GdkColor defaultColor = getDisplay().COLOR_LIST_SELECTION; GdkRGBA selectedBackground = new GdkRGBA (); selectedBackground = display.toGdkRGBA (defaultColor); if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { String css = "GtkTreeView {background-color: " + gtk_rgba_to_css_string(background) + ";}\n" + "GtkTreeView:selected {background-color: " + gtk_rgba_to_css_string(selectedBackground) + ";}"; gtk_css_provider_load_from_css(context, css); } else { super.setBackgroundColor(context, handle, rgba); OS.gtk_widget_override_background_color(handle, OS.GTK_STATE_FLAG_SELECTED, selectedBackground); } }</code><technical_language>display.toGdkRGBA returns null remove "rgba=new GdkRGBA()"</technical_language>

Target:
void setBackgroundColor (long context, long handle, GdkRGBA rgba) { if (rgba == null) { GdkColor temp = getDisplay().COLOR_LIST_BACKGROUND; background = display.toGdkRGBA (temp); } else { background = rgba; } GdkColor defaultColor = getDisplay().COLOR_LIST_SELECTION; GdkRGBA selectedBackground = display.toGdkRGBA (defaultColor); if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { String css = "GtkTreeView {background-color: " + gtk_rgba_to_css_string(background) + ";}\n" + "GtkTreeView:selected {background-color: " + gtk_rgba_to_css_string(selectedBackground) + ";}"; gtk_css_provider_load_from_css(context, css); } else { super.setBackgroundColor(context, handle, rgba); OS.gtk_widget_override_background_color(handle, OS.GTK_STATE_FLAG_SELECTED, selectedBackground); } }
Source:
<code>private void addNewPaymentDetailToGroupIfTotalIsPositive(PdpFeedGroupEntry newGroupEntry, PdpFeedDetailEntry newDetailEntry, KualiDecimal originalDetailTransactionTotal) { if (originalDetailTransactionTotal.isPositive()) { if (LOG.isDebugEnabled()) { LOG.debug("addNewPaymentDetailToGroupIfTotalIsPositive, total transaction for " + newDetailEntry.getSourceDocNbr() + " detail: " + originalDetailTransactionTotal); } newGroupEntry.getDetail().add(newDetailEntry); } else { if (LOG.isInfoEnabled()) { StringBuilder sb = new StringBuilder("addNewPaymentDetailToGroupIfTotalIsPositive, Not adding detail to group for source document "); sb.append(newDetailEntry.getSourceDocNbr()).append(" with a tansaction total of ").append(originalDetailTransactionTotal); if (originalDetailTransactionTotal.isNegative()) { <START> sb.append(". A negative amount, it will be handled by the collector."); <END> } else { sb.append(". A zero amount, no payment needs to be issued."); } LOG.info(sb.toString()); } } }</code><technical_language>is extra full stop needed beginning of this String message</technical_language>

Target:
private void addNewPaymentDetailToGroupIfTotalIsPositive(PdpFeedGroupEntry newGroupEntry, PdpFeedDetailEntry newDetailEntry, KualiDecimal originalDetailTransactionTotal) { if (originalDetailTransactionTotal.isPositive()) { if (LOG.isInfoEnabled()) { LOG.info("addNewPaymentDetailToGroupIfTotalIsPositive, total transaction for " + newDetailEntry.getSourceDocNbr() + " detail: " + originalDetailTransactionTotal); } newGroupEntry.getDetail().add(newDetailEntry); } else { if (LOG.isInfoEnabled()) { StringBuilder sb = new StringBuilder("addNewPaymentDetailToGroupIfTotalIsPositive, Not adding detail to group for source document "); sb.append(newDetailEntry.getSourceDocNbr()).append(" with a tansaction total of ").append(originalDetailTransactionTotal); if (originalDetailTransactionTotal.isNegative()) { sb.append(". A negative amount, it will be handled by the collector"); } else { sb.append(". A zero amount, no payment needs to be issued"); } LOG.info(sb.toString()); } } }
Source:
<code>public void init() { instance = this; DenizenAPI.getCurrentInstance().getCommandRegistry().registerCoreMember(WorldEditCommand.class, <START> "WORLDEDIT", "worldedit [cuboid_to_schematic/cuboid_to_clipboard/schematic_to_paste/schematic_to_clipboard] (rotate:<amount>) (target:<player>)", 2); <END> PropertyParser.registerProperty(WorldEditPlayerProperties.class, PlayerTag.class); }</code><technical_language>Doc line is wrong</technical_language>

Target:
public void init() { instance = this; DenizenAPI.getCurrentInstance().getCommandRegistry().registerCoreMember(WorldEditCommand.class, "WORLDEDIT", "worldedit [create_schematic/copy_to_clipboard/paste] (file:<file path>) (cuboid:<cuboid>) (position:<location>) (rotate:<#>) (undoable) (noair)", 2); PropertyParser.registerProperty(WorldEditPlayerProperties.class, PlayerTag.class); }
Source:
<code>public void testGetDriveInfo() throws Exception { String uuid = "f17cce62-bcc9-4e0b-a57b-a5582b05aff0"; CloudSigma2Api api = requestSendsResponse( getBuilder() .endpoint(endpoint + "drives/" + uuid + "/") .build(), responseBuilder() .payload(payloadFromResourceWithContentType("/drive-info.json", MediaType.APPLICATION_JSON)) .build()); DriveInfo result = api.getDriveInfo(uuid); assertNotNull(result); Assert.assertEquals(result.getName(), "test_drive_1"); Assert.assertEquals(result.getJobs().get(0).getResourceUri(), "/api/2.0/jobs/ec01d3bc-1ec0-440d-a1c3-0a6421d0d511/"); Assert.assertEquals(result.getJobs().get(0).getUuid(), "ec01d3bc-1ec0-440d-a1c3-0a6421d0d511"); Assert.assertEquals(result.getJobs().get(2).getResourceUri(), "/api/2.0/jobs/8bacb5b3-6392-4f74-8094-ba3376a3f5f7/"); <START> Assert.assertEquals(result.getJobs().get(2).getUuid(), "8bacb5b3-6392-4f74-8094-ba3376a3f5f7"); <END> }</code><technical_language>Add static import for assertEquals method</technical_language>

Target:
public void testGetDriveInfo() throws Exception { String uuid = "f17cce62-bcc9-4e0b-a57b-a5582b05aff0"; CloudSigma2Api api = requestSendsResponse( getBuilder() .endpoint(endpoint + "drives/" + uuid + "/") .build(), responseBuilder() .payload(payloadFromResourceWithContentType("/drive-info.json", MediaType.APPLICATION_JSON)) .build()); DriveInfo result = api.getDriveInfo(uuid); assertNotNull(result); assertEquals(result.getName(), "test_drive_1"); assertEquals(result.getJobs().get(0).getResourceUri(), "/api/2.0/jobs/ec01d3bc-1ec0-440d-a1c3-0a6421d0d511/"); assertEquals(result.getJobs().get(0).getUuid(), "ec01d3bc-1ec0-440d-a1c3-0a6421d0d511"); assertEquals(result.getJobs().get(2).getResourceUri(), "/api/2.0/jobs/8bacb5b3-6392-4f74-8094-ba3376a3f5f7/"); assertEquals(result.getJobs().get(2).getUuid(), "8bacb5b3-6392-4f74-8094-ba3376a3f5f7"); }
Source:
<code><START> public LogEventType getLogEvent(Long id) { <END> ViewErrorLogRequestMessageType request = new ViewErrorLogRequestMessageType(); request.setConfigAssertion(buildConfigAssertion()); request.setId(id); try { LogEventSimpleResponseMessageType response = (LogEventSimpleResponseMessageType) invokeClientPort( ADMIN_DASHBOARD_ERRORLOG_VIEW, request); logDebug(ADMIN_DASHBOARD_ERRORLOG_VIEW, response.getEventLogList().size()); if (CollectionUtils.isNotEmpty(response.getEventLogList())) { return response.getEventLogList().get(0); } } catch (Exception e) { LOG.error("error during view-log-event: {}", e.getLocalizedMessage(), e); } return null; }</code><technical_language>named getLogEventById</technical_language>

Target:
public LogEventType getLogEvent(Long id) { ViewErrorLogRequestMessageType request = new ViewErrorLogRequestMessageType(); request.setConfigAssertion(buildConfigAssertion()); request.setId(id); try { LogEventSimpleResponseMessageType response = (LogEventSimpleResponseMessageType) invokeClientPort( ADMIN_DASHBOARD_ERRORLOG_VIEW, request); logDebug(ADMIN_DASHBOARD_ERRORLOG_VIEW, response.getEventLogList().size()); return response.getEventLogList().get(0); } catch (Exception ex) { LOG.error("Error while calling service view-errorlog: {}", ex.getMessage(), ex); HelperUtil.addMessageError(null, SERVICE_ERROR); } return null; }