auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void startSharing(StreamProcessor processor, IClientManager cm, Client c, Optional<StreamDesc> osd, JSONObject msg, Activity a) { StreamDesc sd; KurentoHandler h = processor.getHandler(); if (sharingStarted.compareAndSet(false, true)) { sharingUser.put("sid", c.getSid()); sd = c.addStream(StreamType.SCREEN, a); sd.setWidth(msg.getInt("width")).setHeight(msg.getInt("height")); cm.update(c); <START> log.debug("User {}: has started sharing, with stream: {}", sd.getUid(), a); <END> h.sendClient(sd.getSid(), newKurentoMsg() .put("id", "broadcast") .put("stream", sd.toJson() .put("shareType", msg.getString("shareType")) .put("fps", msg.getString("fps"))) .put(PARAM_ICE, h.getTurnServers())); } else if (osd.isPresent() && !osd.get().hasActivity(a)) { sd = osd.get(); sd.addActivity(a); cm.update(c); h.sendShareUpdated(sd); WebSocketHelper.sendRoom(new TextRoomMessage(c.getRoomId(), c, RoomMessage.Type.RIGHT_UPDATED, c.getUid())); WebSocketHelper.sendRoomOthers(roomId, c.getUid(), newKurentoMsg() .put("id", "newStream") .put(PARAM_ICE, processor.getHandler().getTurnServers()) .put("stream", sd.toJson())); } }</code><technical_language>I change this message Stream {}: sharing started, activity: {}</technical_language>

Target:
public void startSharing(StreamProcessor processor, IClientManager cm, Client c, Optional<StreamDesc> osd, JSONObject msg, Activity a) { StreamDesc sd; KurentoHandler h = processor.getHandler(); if (sharingStarted.compareAndSet(false, true)) { sharingUser.put("sid", c.getSid()); sd = c.addStream(StreamType.SCREEN, a); sd.setWidth(msg.getInt("width")).setHeight(msg.getInt("height")); cm.update(c); log.debug("Stream.UID {}: sharing has been started, activity: {}", sd.getUid(), a); h.sendClient(sd.getSid(), newKurentoMsg() .put("id", "broadcast") .put("stream", sd.toJson() .put("shareType", msg.getString("shareType")) .put("fps", msg.getString("fps"))) .put(PARAM_ICE, h.getTurnServers())); } else if (osd.isPresent() && !osd.get().hasActivity(a)) { sd = osd.get(); sd.addActivity(a); cm.update(c); h.sendShareUpdated(sd); WebSocketHelper.sendRoom(new TextRoomMessage(c.getRoomId(), c, RoomMessage.Type.RIGHT_UPDATED, c.getUid())); WebSocketHelper.sendRoomOthers(roomId, c.getUid(), newKurentoMsg() .put("id", "newStream") .put(PARAM_ICE, processor.getHandler().getTurnServers()) .put("stream", sd.toJson())); } }
Source:
<code>public Dialog onCreateDialog(Bundle savedInstanceState) { @SuppressLint("InflateParams") View view = LayoutInflater.from(getActivity()).inflate(R.layout.crypto_settings_dialog, null); cryptoStatusSelector = (CryptoStatusSelector) view.findViewById(R.id.crypto_status_selector); cryptoStatusText = (LinearViewAnimator) view.findViewById(R.id.crypto_status_text); cryptoStatusSelector.setCryptoStatusListener(this); Bundle arguments = savedInstanceState != null ? savedInstanceState : getArguments(); currentMode = CryptoMode.valueOf(arguments.getString(ARG_CURRENT_MODE)); updateView(false); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(view); <START> builder.setPositiveButton("Proceed", new OnClickListener() { <END> @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); return builder.create(); }</code><technical_language>Hardcoded string</technical_language>

Target:
public Dialog onCreateDialog(Bundle savedInstanceState) { @SuppressLint("InflateParams") View view = LayoutInflater.from(getActivity()).inflate(R.layout.crypto_settings_dialog, null); cryptoModeSelector = (CryptoModeSelector) view.findViewById(R.id.crypto_status_selector); cryptoStatusText = (LinearViewAnimator) view.findViewById(R.id.crypto_status_text); cryptoModeSelector.setCryptoStatusListener(this); Bundle arguments = savedInstanceState != null ? savedInstanceState : getArguments(); currentMode = CryptoMode.valueOf(arguments.getString(ARG_CURRENT_MODE)); updateView(false); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(view); builder.setPositiveButton(R.string.crypto_settings_ok, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); return builder.create(); }
Source:
<code>public void onBackPressed() { if (doubleBackToExitPressedOnce) { super.onBackPressed(); return; } this.doubleBackToExitPressedOnce = true; <START> Toast.makeText(this, "Please click BACK again to exit", Toast.LENGTH_SHORT).show(); <END> new Handler().postDelayed(new Runnable() { @Override public void run() { doubleBackToExitPressedOnce=false; } }, 3000); }</code><technical_language>Please xml resource added in strings.xml instead of hardcoding</technical_language>

Target:
public void onBackPressed() { if (doubleBackToExitPressedOnce) { super.onBackPressed(); return; } this.doubleBackToExitPressedOnce = true; Toast.makeText(this, getString(R.string.double_press_to_exit), Toast.LENGTH_SHORT).show(); new Handler().postDelayed(new Runnable() { @Override public void run() { doubleBackToExitPressedOnce=false; } }, 3000); }
Source:
<code>public void addFollowingAccounts(List<DeterministicKey> followingAccountKeys) { if (isMarried()) { throw new IllegalStateException("KeyChainGroup is married already"); } DeterministicKey accountKey = getActiveKeyChain().getWatchingKey(); <START> followingKeychains = HashMultimap.create(); <END> for (DeterministicKey key : followingAccountKeys) { checkArgument(key.getPath().size() == 1, "Following keys have to be account keys"); DeterministicKeyChain chain = DeterministicKeyChain.watchAndFollow(key); if (lookaheadSize > 0) { chain.setLookaheadSize(lookaheadSize); } followingKeychains.put(accountKey, chain); } }</code><technical_language>This overwrite existing multimap if is a married chain in wallet. this conditional followingKeychain null</technical_language>

Target:
public void addFollowingAccounts(List<DeterministicKey> followingAccountKeys) { checkState(!isMarried(), "KeyChainGroup is married already"); checkState(getActiveKeyChain().numLeafKeysIssued() == 0, "Active keychain already has keys in use"); DeterministicKey accountKey = getActiveKeyChain().getWatchingKey(); for (DeterministicKey key : followingAccountKeys) { checkArgument(key.getPath().size() == 1, "Following keys have to be account keys"); DeterministicKeyChain chain = DeterministicKeyChain.watchAndFollow(key); if (lookaheadSize > 0) { chain.setLookaheadSize(lookaheadSize); } followingKeychains.put(accountKey, chain); } }
Source:
<code>public int outboundMessagesQueueSize() { if (mreg == null) return -1; <START> return (int) mreg.longAdderMetric( <END> OUTBOUND_MESSAGES_QUEUE_SIZE_METRIC_NAME, OUTBOUND_MESSAGES_QUEUE_SIZE_METRIC_DESC ).value(); }</code><technical_language>store LongMetric object instance</technical_language>

Target:
public int outboundMessagesQueueSize() { if (outboundMessagesQueueSizeMetric == null) return -1; return (int) outboundMessagesQueueSizeMetric.value(); }
Source:
<code>protected void createSelection(Composite container) { Label lblSelect = new Label(container, SWT.NONE); lblSelect.setText("Select synoptic:"); List<String> columnNames = Arrays.asList("Name"); items = createTable(container, SWT.BORDER | SWT.V_SCROLL, columnNames); <START> List<String> names = (List<String>) SynopticInfo.names(available); names.sort(String.CASE_INSENSITIVE_ORDER); <END> setItems(names); }</code><technical_language>above, API issue unordered ordered colelctions I this is solvable suggestion SynopticInfo.names(available).stream() .sorted(String.CASE_INSENSITIVE_ORDER) .collect(Collectors.toList());</technical_language>

Target:
protected void createSelection(Composite container) { Label lblSelect = new Label(container, SWT.NONE); lblSelect.setText("Select synoptic:"); List<String> columnNames = Arrays.asList("Name"); items = createTable(container, SWT.BORDER | SWT.V_SCROLL, columnNames); List<String> names = SynopticInfo.names(available).stream() .sorted(String.CASE_INSENSITIVE_ORDER) .collect(Collectors.toList()); setItems(names); }
Source:
<code>public Page getOutput() { if (state != State.HAS_OUTPUT) { return null; } List<Type> types = aggregates.stream().map(Aggregator::getType).collect(toImmutableList()); PageBuilder pageBuilder = new PageBuilder(1, types); pageBuilder.declarePosition(); for (int i = 0; i < aggregates.size(); i++) { Aggregator aggregator = aggregates.get(i); BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(i); aggregator.evaluate(blockBuilder); } state = State.FINISHED; Page page = pageBuilder.build(); if (partial) { <START> BlockBuilder blockBuilder = TINYINT.createBlockBuilder(null, 1); <END> TINYINT.writeLong(blockBuilder, 1); page = page.prependColumn(blockBuilder.build()); } return page; }</code><technical_language>A future commit introduces a RowType enum. Is reason change is part of this commit</technical_language>

Target:
public Page getOutput() { if (partialOutput.isPresent()) { Page output = partialOutput.get(); partialOutput = Optional.empty(); return output; } if (state != State.FINISHING) { return null; } state = State.FINISHED; return processor.getFinalOutput(); }
Source:
<code>public void testObjectsFitBucketThatHasContent() throws IOException, URISyntaxException { putObjectThenRunVerification(new FileSystemHelperImpl(), new ResultVerifier() { @Override <START> public void verifyResult(ObjectStorageSpaceVerificationResult result, long totalRequiredSize) { <END> assertEquals(ObjectStorageSpaceVerificationResult.VerificationStatus.OK, result.getVerificationStatus()); assertEquals(result.getRequiredSpace(), totalRequiredSize); assertTrue(result.getAvailableSpace() > 0); assertTrue(result.containsSufficientSpace()); assertNull(result.getIoException()); } }); }</code><technical_language>Missing finals</technical_language>

Target:
public void testObjectsFitBucketThatHasContent() throws IOException, URISyntaxException { putObjectThenRunVerification(new FileSystemHelperImpl(), new ResultVerifier() { @Override public void verifyResult(final ObjectStorageSpaceVerificationResult result, final long totalRequiredSize) { assertEquals(ObjectStorageSpaceVerificationResult.VerificationStatus.OK, result.getVerificationStatus()); assertEquals(result.getRequiredSpace(), totalRequiredSize); assertTrue(result.getAvailableSpace() > 0); assertTrue(result.containsSufficientSpace()); assertNull(result.getIoException()); } }); }
Source:
<code>protected void checkAccessControlForInstructorFeedbackSubmission( InstructorAttributes instructor, FeedbackSessionAttributes feedbackSession) { String moderatedPerson = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON); String previewAsPerson = getRequestParamValue(Const.ParamsNames.PREVIEWAS); if (StringHelper.isEmpty(moderatedPerson) && StringHelper.isEmpty(previewAsPerson)) { gateKeeper.verifySessionSubmissionPrivilegeForInstructor(feedbackSession, instructor); } else { <START> gateKeeper.verifyLoggedInUserPrivileges(); <END> gateKeeper.verifyAccessible(logic.getInstructorForGoogleId(feedbackSession.getCourseId(), userInfo.getId()), feedbackSession, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION_COMMENT_IN_SECTIONS); } }</code><technical_language>previous setting INSTRUCTOR_PERMISSION_MODIFY_SESSION is correct for previewing. This is correct for moderation only. Refer checkAccessControlForStudentFeedbackSubmission</technical_language>

Target:
protected void checkAccessControlForInstructorFeedbackSubmission( InstructorAttributes instructor, FeedbackSessionAttributes feedbackSession) { String moderatedPerson = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON); String previewAsPerson = getRequestParamValue(Const.ParamsNames.PREVIEWAS); if (!StringHelper.isEmpty(moderatedPerson)) { gateKeeper.verifyLoggedInUserPrivileges(); gateKeeper.verifyAccessible(logic.getInstructorForGoogleId(feedbackSession.getCourseId(), userInfo.getId()), feedbackSession, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION_COMMENT_IN_SECTIONS); } else if (!StringHelper.isEmpty(previewAsPerson)) { gateKeeper.verifyLoggedInUserPrivileges(); gateKeeper.verifyAccessible(logic.getInstructorForGoogleId(feedbackSession.getCourseId(), userInfo.getId()), feedbackSession, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION); } else { gateKeeper.verifySessionSubmissionPrivilegeForInstructor(feedbackSession, instructor); } }
Source:
<code>public static Time TO_TIME(String source, String format) throws SQLException { if (source == null) return null; Date date = TO_DATE(source, format); <START> return new Time(date.getTime()) ; <END> }</code><technical_language>TO_DATE() change date local date, a result, lose hour/minute/second info. Time object created 00:00:00</technical_language>

Target:
public static Time TO_TIME(String source, String format) throws SQLException { if (source == null) return null; return new Time(stringWithFormatToDateTime(source, format).getMillis()) ; }
Source:
<code>public ValidationResult validate(){ if (vmNamesList.isEmpty()) { return ValidationResult.VALID; <START> } else if (vmNamesList.size() > 1 && removedNetworks.size() > 1) { <END> return new ValidationResult(EngineMessage.MULTIPLE_NETWORKS_CANNOT_DETACH_NETWORKS_USED_BY_VMS, LinqUtils.concat(ReplacementUtils.replaceWith(VAR_NETWORK_NAMES, removedNetworks), ReplacementUtils.replaceWith(VAR_VM_NAMES, vmNamesList))); } else if (vmNamesList.size() > 1) { return new ValidationResult(EngineMessage.NETWORK_CANNOT_DETACH_NETWORK_USED_BY_VMS, LinqUtils.concat( ReplacementUtils.replaceWith(VAR_NETWORK_NAME, removedNetworks), ReplacementUtils.replaceWith(VAR_VM_NAMES, vmNamesList))); } else if (removedNetworks.size() > 1) { return new ValidationResult(EngineMessage.MULTIPLE_NETWORKS_CANNOT_DETACH_NETWORKS_USED_BY_SINGLE_VM, LinqUtils.concat( ReplacementUtils.replaceWith(VAR_NETWORK_NAMES, removedNetworks), ReplacementUtils.replaceWith(VAR_VM_NAME, vmNamesList))); } else { return new ValidationResult(EngineMessage.NETWORK_CANNOT_DETACH_NETWORK_USED_BY_SINGLE_VM, LinqUtils.concat( ReplacementUtils.replaceWith(VAR_NETWORK_NAME, removedNetworks), ReplacementUtils.replaceWith(VAR_VM_NAME, vmNamesList))); } }</code><technical_language>else is unnecessary here, previous 'if' is true, jump out of method. extract vmNamesList.size() removedNetworks.size() variable calculated multiple times</technical_language>

Target:
public ValidationResult validate() { if (vmNamesList.isEmpty()) { return ValidationResult.VALID; } final int vmsAmount = vmNamesList.size(); final int removedNetworksAmount = removedNetworks.size(); if (vmsAmount > 1 && removedNetworksAmount > 1) { return new ValidationResult(EngineMessage.MULTIPLE_NETWORKS_CANNOT_DETACH_NETWORKS_USED_BY_VMS, LinqUtils.concat(ReplacementUtils.replaceWith(VAR_NETWORK_NAMES, removedNetworks), ReplacementUtils.replaceWith(VAR_VM_NAMES, vmNamesList))); } else if (vmsAmount > 1) { return new ValidationResult(EngineMessage.NETWORK_CANNOT_DETACH_NETWORK_USED_BY_VMS, LinqUtils.concat( ReplacementUtils.replaceWith(VAR_NETWORK_NAME, removedNetworks), ReplacementUtils.replaceWith(VAR_VM_NAMES, vmNamesList))); } else if (removedNetworksAmount > 1) { return new ValidationResult(EngineMessage.MULTIPLE_NETWORKS_CANNOT_DETACH_NETWORKS_USED_BY_SINGLE_VM, LinqUtils.concat( ReplacementUtils.replaceWith(VAR_NETWORK_NAMES, removedNetworks), ReplacementUtils.replaceWith(VAR_VM_NAME, vmNamesList))); } else { return new ValidationResult(EngineMessage.NETWORK_CANNOT_DETACH_NETWORK_USED_BY_SINGLE_VM, LinqUtils.concat( ReplacementUtils.replaceWith(VAR_NETWORK_NAME, removedNetworks), ReplacementUtils.replaceWith(VAR_VM_NAME, vmNamesList))); } }
Source:
<code>public boolean delete(ModuleDefinition definition) { Assert.notNull(definition, "'definition' cannot be null."); <START> if (!ClassUtils.isAssignable(definition.getClass(), CompositeModuleDefinition.class)) { <END> return false; } String path = Paths.build(Paths.MODULES, definition.getType().toString(), definition.getName()); try { zooKeeperConnection.getClient().delete().deletingChildrenIfNeeded().forPath(path); List<ModuleDefinition> children = ((CompositeModuleDefinition) definition).getChildren(); for (ModuleDefinition child : children) { ModuleDefinitionRepositoryUtils.deleteDependencies(moduleDependencyRepository, child, dependencyKey(definition)); } } catch (KeeperException.NoNodeException ignore) { return false; } catch (Exception e) { throw ZooKeeperUtils.wrapThrowable(e); } return true; }</code><technical_language>definition.isComposed()</technical_language>

Target:
public boolean delete(ModuleDefinition definition) { Assert.notNull(definition, "'definition' cannot be null."); if (!definition.isComposed()) { return false; } String path = Paths.build(Paths.MODULES, definition.getType().toString(), definition.getName()); try { zooKeeperConnection.getClient().delete().deletingChildrenIfNeeded().forPath(path); List<ModuleDefinition> children = ((CompositeModuleDefinition) definition).getChildren(); for (ModuleDefinition child : children) { ModuleDefinitionRepositoryUtils.deleteDependencies(moduleDependencyRepository, child, dependencyKey(definition)); } } catch (KeeperException.NoNodeException ignore) { return false; } catch (Exception e) { throw ZooKeeperUtils.wrapThrowable(e); } return true; }
Source:
<code>public void setBugPattern(String bugPattern) throws PatternSyntaxException { <START> if (!bugPattern.matches(".*\\([^\\)]*\\).*")) { <END> throw new PatternSyntaxException("The pattern must contain at least one group.", bugPattern, 0); } this.bugPattern = Pattern.compile(bugPattern).toString(); }</code><technical_language>this more strict ? i.e. require character parens</technical_language>

Target:
public void setBugPattern(String bugPattern) throws PatternSyntaxException { if (!bugPattern.matches(PATTERN_SINGLE_GROUP)) { throw new PatternSyntaxException(PATTERN_MUST_CONTAIN_GROUP, bugPattern, 0); } this.bugPattern = Pattern.compile(bugPattern).toString(); }
Source:
<code>public Future<AuthenticationResult> acquireToken(final String resource, final UserAssertion userAssertion, final AsymmetricKeyCredential credential, final AuthenticationCallback callback) { this.validateInput(resource, credential, true); Map<String, String> params = new HashMap<String, String>(); params.put("resource", resource); params.put("requested_token_use", "on_behalf_of"); try { AdalOAuthAuthorizationGrant grant = new AdalOAuthAuthorizationGrant( new JWTBearerGrant( SignedJWT.parse(userAssertion.getAssertion())), params); ClientAssertion clientAssertion = JwtHelper .buildJwt(credential, this.authenticationAuthority .getSelfSignedJwtAudience()); <START> final ClientAuthentication clientAuth = createClientAuthFromClientAssertion(clientAssertion); <END> return this.acquireToken(grant, clientAuth, callback); } catch (final Exception e) { throw new AuthenticationException(e); } }</code><technical_language>this method is basically for ClientCredential , difference is ClientAuthentication is created, I suggest move common part private method</technical_language>

Target:
public Future<AuthenticationResult> acquireToken(final String resource, final UserAssertion userAssertion, final AsymmetricKeyCredential credential, final AuthenticationCallback callback) { this.validateInput(resource, userAssertion, credential); ClientAssertion clientAssertion = JwtHelper .buildJwt(credential, this.authenticationAuthority.getSelfSignedJwtAudience()); final ClientAuthentication clientAuth = createClientAuthFromClientAssertion(clientAssertion); return acquireTokenOnBehalfOf(resource, userAssertion, clientAuth, callback); }
Source:
<code>public void destroyNode(final String id) { CloudService cloudService = api.getCloudServiceApi().get(id); String deleteDeploymentRequestId = api.getDeploymentApiForService(cloudService.name()).delete(id); String operationDescription = format("Delete deployment(%s) of cloudService(%s)", id, cloudService.name()); waitForOperationCompletion(deleteDeploymentRequestId, operationDescription); String cloudServiceDeleteRequestId = api.getCloudServiceApi().delete(cloudService.name()); operationDescription = format("Delete cloudService(%s)", cloudService.name(), Long.toString(operationTimeout)); <START> waitForOperationCompletion(cloudServiceDeleteRequestId, operationDescription); <END> }</code><technical_language>destroying nodes, consider removing storage account some point</technical_language>

Target:
public void destroyNode(final String id) { CloudService cloudService = api.getCloudServiceApi().get(id); if (cloudService != null) { final String cloudServiceName = cloudService.name(); logger.debug("Deleting deployment(%s) of cloud service (%s)", id, cloudServiceName); deleteDeployment(id, cloudServiceName); logger.debug("Deployment (%s) deleted in cloud service (%s).", id, cloudServiceName); logger.debug("Deleting cloud service (%s) ...", cloudServiceName); deleteCloudService(cloudServiceName); logger.debug("Cloud service (%s) deleted.", cloudServiceName); } }
Source:
<code>private void executeActionInTransactionScope() { registerRollbackHandler((TransactionRollbackListener)() -> { log.error("Transaction rolled-back for command '{}'.", <START> CommandBase.this.getClass().getName()); <END> try { if (isQuotaDependant()) { rollbackQuota(); } } catch (NullPointerException e) { log.error("RollbackQuota: failed (may be because quota is disabled)", e); } cancelTasks(); }); if (!executeWithoutTransaction()) { if (TransactionSupport.current() == null) { cancelTasks(); } TransactionSupport.setRollbackOnly(); } }</code><technical_language>this is part of main class, 'CommandBase.this' omitted</technical_language>

Target:
private void executeActionInTransactionScope() { registerRollbackHandler((TransactionRollbackListener)() -> { log.error("Transaction rolled-back for command '{}'.", getClass().getName()); try { if (isQuotaDependant()) { rollbackQuota(); } } catch (NullPointerException e) { log.error("RollbackQuota: failed (may be because quota is disabled)", e); } cancelTasks(); }); if (!executeWithoutTransaction()) { if (TransactionSupport.current() == null) { cancelTasks(); } TransactionSupport.setRollbackOnly(); } }
Source:
<code>private boolean verifyShareableDisksMoving() { <START> HashMap<Guid, StorageDomain> targetDomains= new HashMap<>(); <END> ArrayList<String> problematicDisks = new ArrayList<>(); for ( MoveDiskParameters param : getParameters().getParametersList() ) { DiskImage currDisk = getDiskImageDao().get(param.getImageId()); if (currDisk.isShareable()) { Guid targetDomainId = param.getStorageDomainId(); if (!targetDomains.containsKey( targetDomainId ) ) { targetDomains.put(targetDomainId, getStorageDomainDAO().get(targetDomainId)); } if (targetDomains.get(targetDomainId).getStorageType().equals(StorageType.GLUSTERFS)) { problematicDisks.add(currDisk.getDiskAlias()); } } } if (!problematicDisks.isEmpty()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CANT_MOVE_SHAREABLE_DISK_TO_GLUSTERFS); addCanDoActionMessageVariable("problematicDisks", StringHelper.join(", ", problematicDisks.toArray())); return false; } else { return true; } }</code><technical_language>defined a Map - Hash implementation is inconsequential</technical_language>

Target:
private boolean verifyShareableDisksMoving() { Map<Guid, StorageDomain> targetDomains= new HashMap<>(); List<String> problematicDisks = new LinkedList<>(); for ( MoveDiskParameters param : getParameters().getParametersList() ) { DiskImage currDisk = getDiskImageDao().get(param.getImageId()); if (currDisk.isShareable()) { Guid targetDomainId = param.getStorageDomainId(); if (!targetDomains.containsKey( targetDomainId ) ) { targetDomains.put(targetDomainId, getStorageDomainDAO().get(targetDomainId)); } if (targetDomains.get(targetDomainId).getStorageType().equals(StorageType.GLUSTERFS)) { problematicDisks.add(currDisk.getDiskAlias()); } } } if (!problematicDisks.isEmpty()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CANT_MOVE_SHAREABLE_DISK_TO_GLUSTERFS); addCanDoActionMessageVariable("problematicDisks", StringHelper.join(", ", problematicDisks.toArray())); return false; } return true; }
Source:
<code>public IConditionValueAutoCompleter getFieldValueAutoCompleter(String fieldName) { IConditionValueAutoCompleter retval = null; <START> if (StringUtils.equals(fieldName, "TYPE")) { <END> retval = new EnumValueAutoCompleter(VmPoolType.class); } else { } return retval; }</code><technical_language>StringUtils overkill - comparing a constant, "TYPE".equals(fieldName)</technical_language>

Target:
public IConditionValueAutoCompleter getFieldValueAutoCompleter(String fieldName) { IConditionValueAutoCompleter retval = null; if ("TYPE".equals(fieldName)) { retval = new EnumValueAutoCompleter(VmPoolType.class); } return retval; }
Source:
<code>public void run() { while (!stop) { try { synchronized (taskCountLock) { if (executor.isShutdown()) { break; } int maxAcquire = Math.min(executor.getMaximumPoolSize() - activeTaskCount, 10); if (maxAcquire > 0) { List<TaskRequest> reqs = taskServer.lockSharedAgentTasks(maxAcquire, agentId, config.getLockRetentionTime(), 1000); for (TaskRequest req : reqs) { executor.submit(() -> { try { runner.run(req); } catch (Throwable t) { logger.error("Uncaught exception. Task queue will detect this failure and this task will be retried later.", t); errorReporter.reportUncaughtError(t); } finally { synchronized (taskCountLock) { <START> activeTaskCount--; <END> } } }); activeTaskCount++; } } else { taskCountLock.wait(500); } } } catch (Throwable t) { logger.error("Uncaught exception during acquiring tasks from a server. Ignoring. Agent thread will be retried.", t); errorReporter.reportUncaughtError(t); try { Thread.sleep(1000); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } } } }</code><technical_language>AtomicInteger a bit simpler</technical_language>

Target:
public void run() { while (!stop) { try { synchronized (addActiveTaskLock) { if (executor.isShutdown()) { break; } int maximumActiveTasks = activeTaskCount.get(); int guaranteedAvaialbleThreads = executor.getMaximumPoolSize() - maximumActiveTasks; int maxAcquire = Math.min(guaranteedAvaialbleThreads, 10); if (maxAcquire > 0) { List<TaskRequest> reqs = taskServer.lockSharedAgentTasks(maxAcquire, agentId, config.getLockRetentionTime(), 1000); for (TaskRequest req : reqs) { executor.submit(() -> { try { runner.run(req); } catch (Throwable t) { logger.error("Uncaught exception. Task queue will detect this failure and this task will be retried later.", t); errorReporter.reportUncaughtError(t); } finally { activeTaskCount.decrementAndGet(); } }); activeTaskCount.incrementAndGet(); } } else { addActiveTaskLock.wait(500); } } } catch (Throwable t) { logger.error("Uncaught exception during acquiring tasks from a server. Ignoring. Agent thread will be retried.", t); errorReporter.reportUncaughtError(t); try { Thread.sleep(1000); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } } } }
Source:
<code>public void printFailuresTo(PrintWriter writer, int maxStackTraceLines) { Preconditions.notNull(writer, "Writer must not be null"); <START> Preconditions.condition(maxStackTraceLines >= 0, "Invalid negative value for maxStackTraceLines"); <END> if (getTotalFailureCount() > 0) { writer.printf("%nFailures (%d):%n", getTotalFailureCount()); this.failures.forEach(failure -> { writer.printf("%s%s%n", TAB, describeTest(failure.getTestIdentifier())); printSource(writer, failure.getTestIdentifier()); writer.printf("%s=> %s%n", DOUBLE_TAB, failure.getException()); printStackTrace(writer, failure.getException(), maxStackTraceLines); }); writer.flush(); } }</code><technical_language>suggestion Preconditions.condition(maxStackTraceLines >= 0, "maxStackTraceLines a positive number");</technical_language>

Target:
public void printFailuresTo(PrintWriter writer, int maxStackTraceLines) { Preconditions.notNull(writer, "Writer must not be null"); Preconditions.condition(maxStackTraceLines >= 0, "maxStackTraceLines must be a positive number"); if (getTotalFailureCount() > 0) { writer.printf("%nFailures (%d):%n", getTotalFailureCount()); this.failures.forEach(failure -> { writer.printf("%s%s%n", TAB, describeTest(failure.getTestIdentifier())); printSource(writer, failure.getTestIdentifier()); writer.printf("%s=> %s%n", DOUBLE_TAB, failure.getException()); printStackTrace(writer, failure.getException(), maxStackTraceLines); }); writer.flush(); } }
Source:
<code>public InvalidMessageError(Message message) { <START> super(message, "It sent but is should not have:"); <END> }</code><technical_language>Is this intended message</technical_language>

Target:
public InvalidMessageError(Message message) { super(message, "It sent but it should not have:"); }
Source:
<code>public void edit(final GridBodyCellEditContext context) { final int uiRowIndex = context.getRowIndex(); final int uiColumnIndex = context.getColumnIndex(); final double absoluteCellX = context.getAbsoluteCellX(); final double absoluteCellY = context.getAbsoluteCellY(); editor.bind(gridWidget, uiRowIndex, uiColumnIndex); final double[] dxy = {0.0, 0.0}; final Optional<Point2D> rx = context.getRelativeLocation(); rx.ifPresent(r -> { final double headerRowHeight = context.getCellHeight(); <START> dxy[1] = r.getY() - headerRowHeight * uiRowIndex; <END> dxy[0] = r.getX(); }); cellEditorControls.show(editor, (int) (absoluteCellX + dxy[0]), (int) (absoluteCellY + dxy[1])); }</code><technical_language>more readable code below? java dxy[0] = ... dxy[1] = ..</technical_language>

Target:
public void edit(final GridBodyCellEditContext context) { final int uiRowIndex = context.getRowIndex(); final int uiColumnIndex = context.getColumnIndex(); final double absoluteCellX = context.getAbsoluteCellX(); final double absoluteCellY = context.getAbsoluteCellY(); editor.bind(gridWidget, uiRowIndex, uiColumnIndex); final double[] dxy = {0.0, 0.0}; final double headerRowHeight = context.getCellHeight(); final Optional<Point2D> rx = context.getRelativeLocation(); rx.ifPresent(r -> { dxy[0] = r.getX(); dxy[1] = r.getY() - headerRowHeight * uiRowIndex; }); cellEditorControls.show(editor, (int) (absoluteCellX + dxy[0]), (int) (absoluteCellY + dxy[1])); }
Source:
<code>public PatientData<String> load(Patient patient) { <START> String affected = "affected"; <END> try { XWikiDocument doc = (XWikiDocument) this.documentAccessBridge.getDocument(patient.getDocument()); BaseObject data = doc.getXObject(Patient.CLASS_REFERENCE); if (data == null) { return null; } int isNormal = data.getIntValue(UNAFFECTED); if (isNormal == 0) { return new SimpleValuePatientData<String>(getName(), affected); } else if (isNormal == 1) { return new SimpleValuePatientData<String>(getName(), UNAFFECTED); } } catch (Exception e) { this.logger.error("Could not find requested document or some unforeseen" + " error has occurred during controller loading ", e.getMessage()); } return null; }</code><technical_language>I move "affected" a static variable for consistency</technical_language>

Target:
public PatientData<String> load(Patient patient) { try { XWikiDocument doc = (XWikiDocument) this.documentAccessBridge.getDocument(patient.getDocument()); BaseObject data = doc.getXObject(Patient.CLASS_REFERENCE); if (data == null) { return null; } int isNormal = data.getIntValue(UNAFFECTED); if (isNormal == 0) { return new SimpleValuePatientData<String>(getName(), AFFECTED); } else if (isNormal == 1) { return new SimpleValuePatientData<String>(getName(), UNAFFECTED); } } catch (Exception e) { this.logger.error("Could not find requested document or some unforeseen" + " error has occurred during controller loading ", e.getMessage()); } return null; }
Source:
<code>public void connect(ITerminalControl control) { if (control == null) { throw new IllegalArgumentException("Invalid ITerminalControl"); } fControl = control; <START> fControl.setState(TerminalState.CONNECTED); <END> fGdbTerminalCtrlMngr.addPageTerminalControl(fControl); }</code><technical_language>idea of marking CONNECTED _after_ connected</technical_language>

Target:
public void connect(ITerminalControl control) { if (control == null) { throw new IllegalArgumentException("Invalid ITerminalControl"); } fControl = control; fGdbTerminalCtrlConnector.addPageTerminalControl(fControl); fControl.setState(TerminalState.CONNECTED); }
Source:
<code>public ExtMap queryUsers(ExtMap input, ExtMap output, long pageSize) { LdapQueryData queryData = new LdapQueryDataImpl(); queryData.setLdapQueryType(LdapQueryType.searchUsers); queryData.setDomain(getDirectoryName()); queryData.setFilterParameters(new Object[] { generateQueryString(input) }); LdapReturnValueBase ldapResult = broker.runAdAction( AdActionType.SearchUserByQuery, new LdapSearchByQueryParameters(configuration, null, getDirectoryName(), queryData, <START> (input.<Integer> get(Authz.InvokeKeys.QUERY_FLAGS, Authz.QueryFlags.RESOLVE_GROUPS_NONE) & Authz.QueryFlags.RESOLVE_GROUPS) !=0 <END> ) ); List<LdapUser> ldapUsers = (List<LdapUser>) ldapResult.getReturnValue(); List<ExtMap> results = new ArrayList<>(); int addedUsers = 0; for (LdapUser ldapUser : ldapUsers) { if (addedUsers++ < pageSize) { results.add(mapLdapUser(ldapUser)); } } return output.mput(Authz.InvokeKeys.QUERY_RESULT, results); }</code><technical_language>replace Authz.QueryFlags.RESOLVE_GROUPS_NONE 0</technical_language>

Target:
public ExtMap queryUsers(ExtMap input, ExtMap output, long pageSize) { LdapQueryData queryData = new LdapQueryDataImpl(); queryData.setLdapQueryType(LdapQueryType.searchUsers); queryData.setDomain(getDirectoryName()); queryData.setFilterParameters(new Object[] { generateQueryString(input) }); LdapReturnValueBase ldapResult = broker.runAdAction( AdActionType.SearchUserByQuery, new LdapSearchByQueryParameters(configuration, null, getDirectoryName(), queryData, (input.<Integer> get(Authz.InvokeKeys.QUERY_FLAGS, 0) & Authz.QueryFlags.RESOLVE_GROUPS) != 0 ) ); List<LdapUser> ldapUsers = (List<LdapUser>) ldapResult.getReturnValue(); List<ExtMap> results = new ArrayList<>(); int addedUsers = 0; for (LdapUser ldapUser : ldapUsers) { if (addedUsers++ < pageSize) { results.add(mapLdapUser(ldapUser)); } } return output.mput(Authz.InvokeKeys.QUERY_RESULT, results); }
Source:
<code>public String buildKeyName(long keynum) { if (!orderedinserts) { keynum = Utils.hash(keynum); } <START> return "user"+String.format("%0"+zeropadding+"d",keynum); <END> }</code><technical_language>note format is costly. important in scheme of things</technical_language>

Target:
public String buildKeyName(long keynum) { if (!orderedinserts) { keynum = Utils.hash(keynum); } String value = Long.toString(keynum); int fill = zeropadding - value.length(); String prekey = "user"; for(int i=0; i<fill; i++) { prekey += '0'; } return prekey + value; }
Source:
<code>private void handleMap(MemberStateImpl memberState, Config config, Map<String, LocalMapStats> maps) { <START> Set<String> queuesWithStats = createHashSet(maps.size()); <END> for (String name : maps.keySet()) { if (config.findMapConfig(name).isStatisticsEnabled()) { queuesWithStats.add(name); } } memberState.setMapsWithStats(queuesWithStats); }</code><technical_language>Minor: queues -> maps</technical_language>

Target:
private void handleMap(MemberStateImpl memberState, Config config, Map<String, LocalMapStats> maps) { Set<String> mapsWithStats = createHashSet(maps.size()); for (String name : maps.keySet()) { if (config.findMapConfig(name).isStatisticsEnabled()) { mapsWithStats.add(name); } } memberState.setMapsWithStats(mapsWithStats); }
Source:
<code>public String toString() { <START> return "Check "+position+" in scope "+scope; <END> }</code><technical_language>Uppercase check..</technical_language>

Target:
public String toString() { return "check "+position+" in scope "+scope; }
Source:
<code>public Map<String, Serializable> getScopeVariables(TaskContext taskContext) { Map<String, Serializable> variables = new HashMap<>(); Map<String, Serializable> inherited = new HashMap<>(); Map<String, Serializable> dictionary = new HashMap<>(); try { inherited.putAll(extractSystemVariables(taskContext, "")); inherited.putAll(extractJobVariables(taskContext)); inherited.putAll(extractInheritedVariables(taskContext)); for (TaskVariable taskVariable : taskContext.getInitializer().getTaskVariables().values()) { <START> if (!taskVariable.isJobInherited()) { <END> variables.put(taskVariable.getName(), taskVariable.getValue()); } else if (!inherited.containsKey(taskVariable.getName())) { variables.put(taskVariable.getName(), taskVariable.getValue()); } } dictionary = extractAllVariables(taskContext, null, ""); } catch (IOException | ClassNotFoundException e) { logger.error("Error reading variables from task context!"); } return resolveVariables(variables, dictionary); }</code><technical_language>![MAJOR](<LINK_1> 'Severity: MAJOR') Remove this conditional structure edit code blocks same. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public Map<String, Serializable> getScopeVariables(TaskContext taskContext) { Map<String, Serializable> variables = new HashMap<>(); Map<String, Serializable> inherited = new HashMap<>(); Map<String, Serializable> dictionary = new HashMap<>(); try { inherited.putAll(extractSystemVariables(taskContext, "")); inherited.putAll(extractJobVariables(taskContext)); inherited.putAll(extractInheritedVariables(taskContext)); for (TaskVariable taskVariable : taskContext.getInitializer().getTaskVariables().values()) { if (!taskVariable.isJobInherited()) { variables.put(taskVariable.getName(), taskVariable.getValue()); } else if (!inherited.containsKey(taskVariable.getName())) { variables.put(taskVariable.getName(), taskVariable.getValue()); } } dictionary = extractAllVariables(taskContext, null, ""); } catch (IOException | ClassNotFoundException e) { logger.error(ERROR_READING_VARIABLES, e); } return resolveVariables(variables, dictionary); }
Source:
<code>public void testCorrectNumOfCollectedRecordsAndUpdatedStateWithAdaptiveReads() { Properties consumerProperties = new Properties(); <START> consumerProperties.setProperty("flink.shard.adaptivereads", "true"); <END> KinesisProxyInterface kinesis = FakeKinesisBehavioursFactory.initialNumOfRecordsAfterNumOfGetRecordsCallsWithAdaptiveReads(10, 2, 500L); assertNumberOfMessagesReceivedFromKinesis(50, kinesis, fakeSequenceNumber(), consumerProperties); }</code><technical_language>Is a constant for this</technical_language>

Target:
public void testCorrectNumOfCollectedRecordsAndUpdatedStateWithAdaptiveReads() { Properties consumerProperties = new Properties(); consumerProperties.setProperty(SHARD_USE_ADAPTIVE_READS, "true"); KinesisProxyInterface kinesis = FakeKinesisBehavioursFactory.initialNumOfRecordsAfterNumOfGetRecordsCallsWithAdaptiveReads(10, 2, 500L); assertNumberOfMessagesReceivedFromKinesis(50, kinesis, fakeSequenceNumber(), consumerProperties); }
Source:
<code>private String getContextPath(ServletContext servletContext) { String contextPath = ""; try { contextPath = servletContext.getContextPath(); } catch (NoSuchMethodError ex) { try { String path = servletContext.getResource("/").getPath(); contextPath = path.substring(0, path.lastIndexOf("/")); contextPath = contextPath.substring(contextPath.lastIndexOf("/")); } catch (Exception e) { log.error("Failed to get construct context path", e); } } catch (Exception e) { log.error("Failed to get context path", e); } <START> <END> if (contextPath.indexOf("/") != -1) { contextPath = contextPath.substring(1); } return contextPath; }</code><technical_language>Do mind explaining reason replacing contains indexOf</technical_language>

Target:
private String getContextPath(ServletContext servletContext) { String contextPath = ""; try { contextPath = servletContext.getContextPath(); } catch (NoSuchMethodError ex) { try { String path = servletContext.getResource("/").getPath(); contextPath = path.substring(0, path.lastIndexOf("/")); contextPath = contextPath.substring(contextPath.lastIndexOf("/")); } catch (Exception e) { log.error("Failed to get construct context path", e); } } catch (Exception e) { log.error("Failed to get context path", e); } if (contextPath.contains("/")) { contextPath = contextPath.substring(1); } return contextPath; }
Source:
<code>public void addListener_shouldBeCalledToReturnTheQueryResults() { final SharedRealm sharedRealm = getSharedRealm(); Table table = sharedRealm.getTable("test_table"); final Collection collection = new Collection(sharedRealm, table.where()); looperThread.keepStrongReference(collection); collection.addListener(collection, new RealmChangeListener<Collection>() { @Override <START> public void onChange(@Nonnull Collection collection1) { <END> assertEquals(collection, collection1); assertEquals(4, collection1.size()); sharedRealm.close(); looperThread.testComplete(); } }); }</code><technical_language>enough mark RealmChangeListener interface @Nonnull ? call site a bit excessive</technical_language>

Target:
public void addListener_shouldBeCalledToReturnTheQueryResults() { final SharedRealm sharedRealm = getSharedRealm(); Table table = sharedRealm.getTable("test_table"); final Collection collection = new Collection(sharedRealm, table.where()); looperThread.keepStrongReference(collection); collection.addListener(collection, new RealmChangeListener<Collection>() { @Override public void onChange(Collection collection1) { assertEquals(collection, collection1); assertEquals(4, collection1.size()); sharedRealm.close(); looperThread.testComplete(); } }); }
Source:
<code>private String replace(String string, String oldString, String newString) { if (string == null) { return null; } if (newString == null) { return string; } int i = 0; if ((i = string.indexOf(oldString, i)) >= 0) { <START> char[] string2 = string.toCharArray(); <END> char[] newString2 = newString.toCharArray(); int oLength = oldString.length(); StringBuilder buf = new StringBuilder(string2.length); buf.append(string2, 0, i).append(newString2); i += oLength; int j = i; while ((i = string.indexOf(oldString, i)) > 0) { buf.append(string2, j, i - j).append(newString2); i += oLength; j = i; } buf.append(string2, j, string2.length - j); return buf.toString(); } return string; }</code><technical_language>replace() is a "class-level" utility method (no dependency instance state), remain static final instead of changing ? Allowing implementations override produce unintended consequences, instead protected final descendants call</technical_language>

Target:
private static final String replace(String string, String oldString, String newString) { if (string == null) { return null; } if (newString == null) { return string; } int i = 0; if ((i = string.indexOf(oldString, i)) >= 0) { char[] string2 = string.toCharArray(); char[] newString2 = newString.toCharArray(); int oLength = oldString.length(); StringBuilder buf = new StringBuilder(string2.length); buf.append(string2, 0, i).append(newString2); i += oLength; int j = i; while ((i = string.indexOf(oldString, i)) > 0) { buf.append(string2, j, i - j).append(newString2); i += oLength; j = i; } buf.append(string2, j, string2.length - j); return buf.toString(); } return string; }
Source:
<code>public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); if (data.hasKey("profile")) profile = LockingProfileType.fromOrdinal(data.getByte("profile")); profileInstance = profile.create(this); profileInstance.readFromNBT(data); redstone = data.getBoolean("powered"); if(data.hasKey("locked")) locked = data.getBoolean("locked"); if(data.hasKey("trainLeaving")) trainLeaving = data.getBoolean("trainLeaving"); if(data.hasKey("trainDelay")) trainDelay = data.getInteger("trainDelay"); prevCartUUID = readUUID("prevCart", data); currentCartUUID = readUUID("currentCart", data); uuid = readUUID("uuid", data); justLoaded = true; <START> System.out.println("Read from NBT"); <END> }</code><technical_language>_cough_ want remove println. ;) FYI, need create a new PR, a commit branch</technical_language>

Target:
public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); if (data.hasKey("profile")) profile = LockingProfileType.fromOrdinal(data.getByte("profile")); profileInstance = profile.create(this); profileInstance.readFromNBT(data); redstone = data.getBoolean("powered"); if(data.hasKey("locked")) locked = data.getBoolean("locked"); if(data.hasKey("trainLeaving")) trainLeaving = data.getBoolean("trainLeaving"); if(data.hasKey("trainDelay")) trainDelay = data.getInteger("trainDelay"); prevCartUUID = readUUID("prevCart", data); currentCartUUID = readUUID("currentCart", data); uuid = readUUID("uuid", data); justLoaded = true; }
Source:
<code>public void setUp() { <START> jedis = new Jedis("localhost", getPort(), 10000000); <END> }</code><technical_language>good this timeout awaitility: Math.toIntExact(GeodeAwaitility.getTimeout().toMillis());</technical_language>

Target:
public void setUp() { jedis = new Jedis("localhost", getPort(), JEDIS_TIMEOUT); }
Source:
<code>public void setClosestMatch(String text) { <START> System.out.println("matching text " + text); END> final boolean matchFound = ComboUtil.setClosestMatch(getCCombo(), text); if (!matchFound) { reset(); } }</code><technical_language>Remove sysout</technical_language>

Target:
public void setClosestMatch(String text) { final boolean matchFound = ComboUtil.setClosestMatch(getCCombo(), text); if (!matchFound) { reset(); } }
Source:
<code>public boolean isEventProvidedBy(ITmfEvent event) { if ((event.getTrace() == this)) { return true; } if (hasChildren()) { synchronized (fLock) { <START> List <TmfEventProvider> children = getChildren(TmfEventProvider.class); <END> for (TmfEventProvider child : children) { if (child.isEventProvidedBy(event)) { return true; } } } } return false; }</code><technical_language>getChildren method is cached, is re-created event. this means is slow O(n) depending number of traces in eperiment. This call is O(n)</technical_language>

Target:
public boolean isEventProvidedBy(ITmfEvent event) { ITmfTrace trace = event.getTrace(); if ((trace == this)) { return true; } return getAncestySet().contains(trace); }
Source:
<code>private void validate() { ArgChecker.inOrderNotEqual(startDate, endDate, "startDate", "endDate"); ArgChecker.inOrderNotEqual(unadjustedStartDate, unadjustedEndDate, "unadjustedStartDate", "unadjustedEndDate"); Currency payCcy = payment.getCurrency(); Currency notionalCcy = notionalAmount.getCurrency(); if (fxResetObservation != null) { if (notionalCcy.equals(payCcy)) { throw new IllegalArgumentException(Messages.format( "Payment currency must not equal notional currency when FX reset applies", payCcy, notionalCcy)); } if (!fxResetObservation.getIndex().getCurrencyPair().contains(payCcy)) { throw new IllegalArgumentException(Messages.format( "Payment currency must be one of those in the FxReset index {}", payCcy, fxResetObservation.getIndex())); } if (!fxResetObservation.getIndex().getCurrencyPair().contains(notionalCcy)) { throw new IllegalArgumentException(Messages.format( <START> "Notional currency must be one of those in the FxReset index {}", payCcy, fxResetObservation.getIndex())); <END> } } else { if (!notionalCcy.equals(payCcy)) { throw new IllegalArgumentException(Messages.format( "Payment currency must equal notional currency {}", payCcy, notionalCcy)); } } }</code><technical_language>This notionalCcy</technical_language>

Target:
private void validate() { ArgChecker.inOrderNotEqual(startDate, endDate, "startDate", "endDate"); ArgChecker.inOrderNotEqual(unadjustedStartDate, unadjustedEndDate, "unadjustedStartDate", "unadjustedEndDate"); Currency payCcy = payment.getCurrency(); Currency notionalCcy = notionalAmount.getCurrency(); if (fxResetObservation != null) { if (notionalCcy.equals(payCcy)) { throw new IllegalArgumentException(Messages.format( "Payment currency must not equal notional currency when FX reset applies", payCcy, notionalCcy)); } if (!fxResetObservation.getIndex().getCurrencyPair().contains(payCcy)) { throw new IllegalArgumentException(Messages.format( "Payment currency must be one of those in the FxReset index {}", payCcy, fxResetObservation.getIndex())); } if (!fxResetObservation.getIndex().getCurrencyPair().contains(notionalCcy)) { throw new IllegalArgumentException(Messages.format( "Notional currency must be one of those in the FxReset index {}", notionalCcy, fxResetObservation.getIndex())); } } else { if (!notionalCcy.equals(payCcy)) { throw new IllegalArgumentException(Messages.format( "Payment currency must equal notional currency {}", payCcy, notionalCcy)); } } }