auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public String addQueryProvider( ExecutableElement methodElement, TypeMirror providerClass, List<ClassName> entityHelperTypes) { <START> String fieldName = nameIndex.uniqueField(methodElement.getSimpleName().toString() + "Invoker"); <END> List<String> entityHelperNames = new ArrayList<>(); for (ClassName type : entityHelperTypes) { entityHelperNames.add(addEntityHelperField(type)); } queryProviders.add( new GeneratedQueryProvider(methodElement, fieldName, providerClass, entityHelperNames)); return fieldName; }</code><technical_language>Nice, i wondering if this work for overloaded methods appears (i.e. findSliceInvoker1 is defined if a previous findSliceInvoker exists</technical_language>

Target:
public String addQueryProvider( ExecutableElement methodElement, TypeMirror providerClass, List<ClassName> entityHelperTypes) { String fieldName = nameIndex.uniqueField(methodElement.getSimpleName().toString() + "Invoker"); List<String> entityHelperNames = new ArrayList<>(); for (ClassName type : entityHelperTypes) { entityHelperNames.add(addEntityHelperField(type)); } queryProviders.add(new GeneratedQueryProvider(fieldName, providerClass, entityHelperNames)); return fieldName; }
Source:
<code>private static DB initializeDBConnection(final File saveFile, final WorldProvider dimension) { LOGGER.info("Initializing db connection..."); File file = new File(saveFile, String.format("cubes.dim%d.db", dimension.getDimension())); LOGGER.info("Connected to db at ()", file); file.getParentFile().mkdirs(); <START> DB db = DBMaker.fileDB(file).make(); <END> return db; }</code><technical_language>transactions enabled</technical_language>

Target:
private static DB initializeDBConnection(final File saveFile, final WorldProvider dimension) { LOGGER.info("Initializing db connection..."); File file = new File(saveFile, String.format("cubes.dim%d.db", dimension.getDimension())); LOGGER.info("Connected to db at ()", file); file.getParentFile().mkdirs(); DB db = DBMaker.fileDB(file).transactionEnable().make(); return db; }
Source:
<code>public void reactivateMember(PerunSession sess, Member member, Group group) throws InternalErrorException, MemberNotExistsException { if (!isGroupMember(sess, group, member)) throw new MemberNotExistsException("Member does not belong to this group"); validateMemberInGroup(sess, member, group); <START> Attribute membershipExpirationRulesAttribute = getMembershipExpirationRulesAttribute(sess, group); <END> if (membershipExpirationRulesAttribute == null) { return; } LinkedHashMap<String, String> membershipExpirationRules = membershipExpirationRulesAttribute.valueAsMap(); LocalDate localDate = LocalDate.now(); String period = null; if (membershipExpirationRules.get(AbstractMembershipExpirationRulesModule.membershipPeriodKeyName) != null) { period = membershipExpirationRules.get(AbstractMembershipExpirationRulesModule.membershipPeriodKeyName); } try { String loaPeriod = getLoaPeriod(sess, member, membershipExpirationRules, null); if (loaPeriod != null) { period = loaPeriod; } } catch (ExtendMembershipException e) { } if (period != null) { if (period.startsWith("+")) { localDate = Utils.extendDateByPeriod(localDate, period); } else { Pattern p = Pattern.compile("([0-9]+).([0-9]+)."); Matcher m = p.matcher(period); if (!m.matches()) { throw new InternalErrorException("Wrong format of period in VO membershipExpirationRules attribute. Period: " + period); } localDate = Utils.getClosestExpirationFromStaticDate(m); } } Attribute membershipExpirationAttribute = getMemberExpiration(sess, member, group); membershipExpirationAttribute.setValue(localDate.toString()); try { getPerunBl().getAttributesManagerBl().setAttribute(sess, member, group, membershipExpirationAttribute); } catch (WrongAttributeValueException e) { throw new InternalErrorException("Wrong value: " + membershipExpirationAttribute.getValue(),e); } catch (WrongReferenceAttributeValueException | WrongAttributeAssignmentException e) { throw new InternalErrorException(e); } }</code><technical_language>I wonder, if setting group membership expiration null calling extendMembershipInGroup() do job, prevent code duplicity</technical_language>

Target:
public void reactivateMember(PerunSession sess, Member member, Group group) throws InternalErrorException, MemberNotExistsException { if (!isGroupMember(sess, group, member)) throw new MemberNotExistsException("Member does not belong to this group"); validateMemberInGroup(sess, member, group); Attribute membershipExpirationAttribute = getMemberExpiration(sess, member, group); membershipExpirationAttribute.setValue(null); try { getPerunBl().getAttributesManagerBl().setAttribute(sess, member, group, membershipExpirationAttribute); } catch (WrongAttributeValueException e) { throw new InternalErrorException("Wrong value: " + membershipExpirationAttribute.getValue(),e); } catch (WrongReferenceAttributeValueException | WrongAttributeAssignmentException e) { throw new InternalErrorException(e); } try { extendMembershipInGroup(sess, member, group); } catch (ExtendMembershipException ex) { throw new InternalErrorException(ex); } }
Source:
<code><START> private void setupNavigatorExpandCollapseButton() { <END> final Button button = new Button(); button.setIcon( IconType.CHEVRON_DOWN ); button.setPull( Pull.RIGHT ); button.getElement().getStyle().setMarginTop( 10, Style.Unit.PX ); button.getElement().getStyle().setMarginBottom( 10, Style.Unit.PX ); button.addClickHandler( new ClickHandler() { @Override public void onClick( final ClickEvent clickEvent ) { if ( button.getIcon().equals( IconType.CHEVRON_DOWN ) ) { button.setIcon( IconType.CHEVRON_UP ); onExpandNavigator(); } else { button.setIcon( IconType.CHEVRON_DOWN ); onCollapseNavigator(); } } } ); if ( mode.equals( Mode.COLLAPSED ) ) { button.setIcon( IconType.CHEVRON_DOWN ); } else { button.setIcon( IconType.CHEVRON_UP ); } FlowPanel buttonContainer = new FlowPanel(); buttonContainer.getElement().getStyle().setFloat( Style.Float.RIGHT ); buttonContainer.add( button ); container.add( buttonContainer ); }</code><technical_language>Good move making this method. I making classes reduce class lengths. In this case a NavigatorButton NavigatorExpandCollapseButton put lines 221-225 239-243 there. Leaving buttton.addClickHandler(...) here</technical_language>

Target:
private void setupNavigatorExpandCollapseButton() { this.navigatorExpandCollapseButton.addClickHandler( new ClickHandler() { @Override public void onClick( final ClickEvent clickEvent ) { navigatorExpandCollapseButton.invertMode(); if ( navigatorExpandCollapseButton.isExpanded() ) { onExpandNavigator(); } else { onCollapseNavigator(); } } } ); FlowPanel navigatorExpandCollapseButtonContainer = new FlowPanel(); navigatorExpandCollapseButtonContainer.getElement().getStyle().setFloat( Style.Float.RIGHT ); navigatorExpandCollapseButtonContainer.add( navigatorExpandCollapseButton ); container.add( navigatorExpandCollapseButtonContainer ); }
Source:
<code>public String getClassificationValue(ClassificationScheme classification, ExtrinsicObjectType extrinsicObject) { RegistryObjectType registryObjectType = getClassification(classification, extrinsicObject); <START> ClassificationType classType = null; <END> if ((registryObjectType != null) && (registryObjectType instanceof ClassificationType)) { return ((ClassificationType) registryObjectType).getNodeRepresentation(); } return null; }</code><technical_language>Declared unused</technical_language>

Target:
public String getClassificationValue(ClassificationScheme classification, ExtrinsicObjectType extrinsicObject) { RegistryObjectType registryObjectType = getClassification(classification, extrinsicObject); if (registryObjectType != null && (registryObjectType instanceof ClassificationType)) { return ((ClassificationType) registryObjectType).getNodeRepresentation(); } return null; }
Source:
<code>private boolean pullLatestUpstream(String path) throws MojoExecutionException { Repository localRepo; Git git = null; String previousBranch; String newBranchFull; String newBranch = "sdk-" + serverId; try { localRepo = new FileRepository(new File(path, ".git").getAbsolutePath()); git = new Git(localRepo); previousBranch = localRepo.getBranch(); checkoutAndCreateNewBranch(git, newBranch); newBranchFull = localRepo.getFullBranch(); RevCommit stash = git.stashCreate().call(); <START> addRemoteTempRepo(git, path, newBranch); <END> PullResult pullResult = pullFromRemote(git, newBranch); if(!pullResult.isSuccessful()){ rebaseAbort(git); checkoutBranch(git, previousBranch); failureReason = CONFLICT_MESSAGE; return false; } if (stash != null) { try { git.stashApply().setStashRef(stash.getName()).call(); checkoutBranch(git, previousBranch); mergeWithNewBranch(git, newBranchFull); return true; } catch (StashApplyFailureException e) { git.reset().setMode(ResetCommand.ResetType.HARD).setRef(previousBranch).call(); checkoutBranch(git, previousBranch); git.stashApply().setStashRef(stash.getName()).call(); failureReason = CONFLICT_MESSAGE; return false; } } else { checkoutBranch(git, previousBranch); mergeWithNewBranch(git, newBranchFull); return true; } } catch (IOException e) { failureReason = CREATING_LOCAL_REPO_ERROR; } catch (CheckoutConflictException e) { failureReason = CONFLICT_MESSAGE; } catch (GitAPIException e) { failureReason = GIT_COMMAND_ERROR; } catch (URISyntaxException e) { failureReason = CREATING_TEMP_REMOTE_ERROR; } finally { cleanUpBranchesAndRemotes(git, newBranch); } return false; }</code><technical_language>add a temp repo. pass uri pullFromRemote</technical_language>

Target:
private void pullLatestUpstream(String path) throws Exception { String newBranch = SDK_DASH + serverId; Repository localRepo = getLocalRepository(path); Git git = new Git(localRepo); userBranch = localRepo.getBranch(); checkoutAndCreateNewBranch(git, newBranch); String newBranchFull = localRepo.getFullBranch(); stash = git.stashCreate().call(); addRemoteUpstream(git, path); pullFromRemoteUpstream(git, stash, newBranch, userBranch); if (stash != null) { try { git.stashApply().setStashRef(stash.getName()).call(); checkoutBranch(git, userBranch); mergeWithNewBranch(git, newBranchFull); deleteTempBranch(git, newBranch); } catch (StashApplyFailureException e) { git.reset().setMode(ResetCommand.ResetType.HARD).setRef(userBranch).call(); checkoutBranch(git, userBranch); git.stashApply().setStashRef(stash.getName()).call(); deleteTempBranch(git, newBranch); throw new Exception(CONFLICT_MESSAGE_REASON); } } else { checkoutBranch(git, userBranch); mergeWithNewBranch(git, newBranchFull); deleteTempBranch(git, newBranch); } }
Source:
<code>private void renewPartitionReceiver(SystemStreamPartition ssp) { String streamId = config.getStreamId(ssp.getStream()); EventHubClientManager eventHubClientManager = perPartitionEventHubManagers.get(ssp); String offset = streamPartitionOffsets.get(ssp); Integer partitionId = ssp.getPartition().getPartitionId(); String consumerGroup = config.getStreamConsumerGroup(ssp.getSystem(), streamId); try { try { <START> streamPartitionReceivers.get(ssp).close().get(RENEW_SHUTDOWN_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); <END> } catch (TimeoutException te) { LOG.warn("Timeout closing existing receiver. Moving on renewing a new one", te); Util.logThreadDump("EventHubSystemConsumer.Receiver#Renew"); } PartitionReceiver receiver = eventHubClientManager.getEventHubClient() .createReceiverSync(consumerGroup, partitionId.toString(), EventPosition.fromOffset(offset, !offset.equals(EventHubSystemConsumer.START_OF_STREAM))); receiver.setPrefetchCount(prefetchCount); receiver.setReceiveTimeout(DEFAULT_EVENTHUB_RECEIVER_TIMEOUT); receiver.setReceiveHandler(streamPartitionHandlers.get(ssp)); streamPartitionReceivers.put(ssp, receiver); } catch (Exception e) { eventHubHandlerError.set(new SamzaException( String.format("Failed to recreate receiver for EventHubs after ReceiverHandlerError (ssp=%s)", ssp), e)); } }</code><technical_language>thread is this called from? If a rebalance this time, this effect of delaying shutdown? - if so, process shutdown</technical_language>

Target:
private void renewPartitionReceiver(SystemStreamPartition ssp) { String streamId = config.getStreamId(ssp.getStream()); EventHubClientManager eventHubClientManager = perPartitionEventHubManagers.get(ssp); String offset = streamPartitionOffsets.get(ssp); Integer partitionId = ssp.getPartition().getPartitionId(); String consumerGroup = config.getStreamConsumerGroup(ssp.getSystem(), streamId); try { try { LOG.info("Closing the old receiver for ssp before renewing a new one.", ssp); streamPartitionReceivers.get(ssp).close().get(RENEW_SHUTDOWN_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); } catch (TimeoutException te) { LOG.warn("Timeout closing existing receiver. Moving on renewing a new one", te); if (Duration.between(lastThreadDumpLogTime, Instant.now()).compareTo(MIN_THREAD_DUMP_LOG_INTERVAL) > 0) { Util.logThreadDump("EventHubSystemConsumer.Receiver#Renew"); lastThreadDumpLogTime = Instant.now(); } } PartitionReceiver receiver = eventHubClientManager.getEventHubClient() .createReceiverSync(consumerGroup, partitionId.toString(), EventPosition.fromOffset(offset, !offset.equals(EventHubSystemConsumer.START_OF_STREAM))); receiver.setPrefetchCount(prefetchCount); receiver.setReceiveTimeout(DEFAULT_EVENTHUB_RECEIVER_TIMEOUT); receiver.setReceiveHandler(streamPartitionHandlers.get(ssp)); streamPartitionReceivers.put(ssp, receiver); } catch (Exception e) { eventHubHandlerError.set(new SamzaException( String.format("Failed to recreate receiver for EventHubs after ReceiverHandlerError (ssp=%s)", ssp), e)); } }
Source:
<code>public void removeProcess(final String processName) { synchronized (lock) { final Map<String, ManagedProcess> processes = this.processes; final ManagedProcess process = processes.get(processName); if (process == null) { ProcessLogger.ROOT_LOGGER.attemptToRemoveNonExistentProcess(processName); return; } boolean removed = processes.remove(processName) != null; <START> processesByKey.remove(new Key(process.getAuthKey().getBytes())); <END> if(removed) { processRemoved(processName); } lock.notifyAll(); } }</code><technical_language>needs US-ASCII charset, some other simple ascii encoding conversion</technical_language>

Target:
public void removeProcess(final String processName) { synchronized (lock) { final Map<String, ManagedProcess> processes = this.processes; final ManagedProcess process = processes.get(processName); if (process == null) { ProcessLogger.ROOT_LOGGER.attemptToRemoveNonExistentProcess(processName); return; } boolean removed = processes.remove(processName) != null; processesByKey.remove(new Key(process.getAuthKey().getBytes(Charset.forName("US-ASCII")))); if(removed) { processRemoved(processName); } lock.notifyAll(); } }
Source:
<code>public void serverLauncherUsesDefaultLoggingConfig() { <START> String startLocatorCommand = String.join(" ", <END> "start server", "--name=" + serverName, "--dir=" + workingDir, "--disable-default-server"); gfshRule.execute(startLocatorCommand); await().untilAsserted(() -> { assertThat(serverLogFile.toFile()) .as(serverLogFile.toFile().getAbsolutePath()) .exists() .contains("Server " + serverName + " startup completed in ") .doesNotContain("java.lang.IllegalStateException: No factory method found for class"); assertThat(customLogFile.toFile()) .as(customLogFile.toFile().getAbsolutePath()) .doesNotExist(); }); }</code><technical_language>startServerCommand</technical_language>

Target:
public void serverLauncherUsesDefaultLoggingConfig() { String startServerCommand = String.join(" ", "start server", "--name=" + serverName, "--dir=" + workingDir, "--disable-default-server"); gfshRule.execute(startServerCommand); await().untilAsserted(() -> { assertThat(serverLogFile.toFile()) .as(serverLogFile.toFile().getAbsolutePath()) .exists() .contains("Server " + serverName + " startup completed in ") .doesNotContain("java.lang.IllegalStateException: No factory method found for class"); assertThat(customLogFile.toFile()) .as(customLogFile.toFile().getAbsolutePath()) .doesNotExist(); }); }
Source:
<code><START> public boolean contains(@Nonnull User user) { <END> return user.getProperty(GithubAccessTokenProperty.class) != null; }</code><technical_language>This class fields methods static</technical_language>

Target:
public static boolean contains(@Nonnull User user) { return user.getProperty(GithubAccessTokenProperty.class) != null; }
Source:
<code>public ClusteringServiceConfiguration(URI clusterUri, Map<String, PoolDefinition> pools) { if (clusterUri == null) { <START> throw new NullPointerException("clusterUri"); <END> } for (Entry<String, PoolDefinition> e : pools.entrySet()) { if (e.getValue().getServerResource() == null) { throw new IllegalArgumentException("Pool '" + e.getKey() + "' has no defined server resource, and no default value was supplied"); } } this.clusterUri = clusterUri; this.defaultServerResource = null; this.pools = unmodifiableMap(new HashMap<String, PoolDefinition>(pools)); }</code><technical_language>message a bit more explicit ... "clusterUri null"</technical_language>

Target:
public ClusteringServiceConfiguration(URI clusterUri, Map<String, PoolDefinition> pools) { if (clusterUri == null) { throw new NullPointerException("Cluster URI cannot be null"); } StringBuilder issues = new StringBuilder(); for (Entry<String, PoolDefinition> e : pools.entrySet()) { if (e.getValue().getServerResource() == null) { issues.append("Pool '").append(e.getKey()).append("' has no defined server resource, and no default value was supplied").append("\n"); } } if (issues.length() > 0) { throw new IllegalArgumentException(issues.toString()); } this.clusterUri = clusterUri; this.defaultServerResource = null; this.pools = unmodifiableMap(new HashMap<String, PoolDefinition>(pools)); }
Source:
<code>public String getUsernameWithProfile() { String user = String.format("%s@%s", java.util.Objects.toString(username, ""), <START> java.util.Objects.toString(profile, "")); <END> return "@".equals(user) ? "N/A" : user; }</code><technical_language>reason full class reference instead of importing a class name afterwards</technical_language>

Target:
public String getUsernameWithProfile() { String user = String.format("%s@%s", Objects.toString(username, ""), Objects.toString(profile, "")); return "@".equals(user) ? "N/A" : user; }
Source:
<code>public <K> TopicReader<K> buildTopicReaderForCollection() throws Exception { if ("clueweb".equals(collection)) { return new WebxmlTopicReader(Paths.get(topicsFile)); } <START> else if ("gov2".equals(collection)){ <END> return new TrecTopicReader(Paths.get(topicsFile)); } else if ("twitter".equals(collection)) { return (TopicReader<K>) new MicroblogTopicReader(Paths.get(topicsFile)); } throw new RuntimeException("Unrecognized collection " + collection); }</code><technical_language>space indent, else preceding braces</technical_language>

Target:
public <K> TopicReader<K> buildTopicReaderForCollection() throws Exception { if ("clueweb".equals(collection)) { return (TopicReader<K>) new WebxmlTopicReader(Paths.get(topicsFile)); } else if ("gov2".equals(collection)){ return (TopicReader<K>) new TrecTopicReader(Paths.get(topicsFile)); } else if ("twitter".equals(collection)) { return (TopicReader<K>) new MicroblogTopicReader(Paths.get(topicsFile)); } throw new RuntimeException("Unrecognized collection " + collection); }
Source:
<code>void onComplete(PutOperation op) { Exception e = op.getOperationException(); String blobId = op.getBlobIdString(); if (blobId == null && e == null) { <START> e = new RouterException("Operation failed, but exception was not set", RouterErrorCode.UnexpectedInternalError); <END> } if (e != null) { blobId = null; routerMetrics.onPutBlobError(e); } else { notificationSystem.onBlobCreated(op.getBlobIdString(), op.getBlobProperties(), op.getUserMetadata()); } routerMetrics.operationDequeuingRate.mark(); routerMetrics.putBlobOperationLatencyMs.update(time.milliseconds() - op.getSubmissionTimeMs()); operationCompleteCallback.completeOperation(op.getFuture(), op.getCallback(), blobId, e); }</code><technical_language>update metrics before</technical_language>

Target:
void onComplete(PutOperation op) { Exception e = op.getOperationException(); String blobId = op.getBlobIdString(); if (blobId == null && e == null) { e = new RouterException("Operation failed, but exception was not set", RouterErrorCode.UnexpectedInternalError); routerMetrics.operationFailureWithUnsetExceptionCount.inc(); } if (e != null) { blobId = null; routerMetrics.onPutBlobError(e); } else { notificationSystem.onBlobCreated(op.getBlobIdString(), op.getBlobProperties(), op.getUserMetadata()); } routerMetrics.operationDequeuingRate.mark(); routerMetrics.putBlobOperationLatencyMs.update(time.milliseconds() - op.getSubmissionTimeMs()); operationCompleteCallback.completeOperation(op.getFuture(), op.getCallback(), blobId, e); }
Source:
<code>private void writeIntDirect(int intValue, int index) { byte[] buf = bytes; buf[index] = (byte) ((intValue >>> 24) & 0xFF); buf[index+1] = (byte) ((intValue >>> 16) & 0xFF); buf[index+2] = (byte) ((intValue >>> 8) & 0xFF); <START> buf[index+3] = (byte) ((intValue >>> 0) & 0xFF); <END> }</code><technical_language>need for >>> 0</technical_language>

Target:
private void writeIntDirect(int intValue, int index) { byte[] buf = bytes; buf[index] = (byte) ((intValue >>> 24) & 0xFF); buf[index+1] = (byte) ((intValue >>> 16) & 0xFF); buf[index+2] = (byte) ((intValue >>> 8) & 0xFF); buf[index+3] = (byte) (intValue & 0xFF); }
Source:
<code><START> public ServerRequestInterceptor createServerRequestInterceptor(ORBInitInfo info, Codec codec) { <END> ServiceLocator staticBaseServiceLocator = Globals.getStaticBaseServiceLocator(); if (serverRequestInterceptor == null) { OpenTracingService openTracingService = staticBaseServiceLocator.getService(OpenTracingService.class); if (openTracingService != null) { serverRequestInterceptor = new OpenTracingIiopServerInterceptor(openTracingService); } } return serverRequestInterceptor; }</code><technical_language>This method basically do for types. extracted</technical_language>

Target:
public ServerRequestInterceptor createServerRequestInterceptor(ORBInitInfo info, Codec codec) { if (serverRequestInterceptor == null) { if (attemptCreation()) { serverRequestInterceptor = new OpenTracingIiopServerInterceptor(openTracingService); } } return serverRequestInterceptor; }
Source:
<code>public void createPage(Composite comp) { try { if (page == null) { StringBuffer stringBuffer = new StringBuffer(500); stringBuffer.append("<WorkPage>"); IDynamicWidgetLayoutListener dynamicWidgetLayoutListener = null; for (IAtsWizardItem item : wizardExtensionItems) { boolean hasWizardXWidgetExtensions = item.hasWizardXWidgetExtensions(wizard.getSelectedIAtsActionableItems()); if (hasWizardXWidgetExtensions) { stringBuffer.append( "<XWidget displayName=\"--- Extra fields for " + item.getName() + " ---\" xwidgetType=\"XLabel\" horizontalLabel=\"true\" toolTip=\"These fields are available for only the team workflow specified here.\"/>"); try { <START> if (hasWizardXWidgetExtensions) { <END> if (item instanceof IDynamicWidgetLayoutListener) { dynamicWidgetLayoutListener = (IDynamicWidgetLayoutListener) item; } item.getWizardXWidgetExtensions(wizard.getSelectedIAtsActionableItems(), stringBuffer); } } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } } } stringBuffer.append("</WorkPage>"); page = new XWidgetPage(stringBuffer.toString(), ATSXWidgetOptionResolver.getInstance(), dynamicWidgetLayoutListener); page.createBody(null, comp, null, xModListener, true); comp.layout(); } } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } }</code><technical_language>redundant check? line 98 check this? If so, please remove</technical_language>

Target:
public void createPage(Composite comp) { try { if (page == null) { StringBuffer stringBuffer = new StringBuffer(500); stringBuffer.append("<WorkPage>"); IDynamicWidgetLayoutListener dynamicWidgetLayoutListener = null; for (IAtsWizardItem item : wizardExtensionItems) { boolean hasWizardXWidgetExtensions = item.hasWizardXWidgetExtensions(wizard.getSelectedIAtsActionableItems()); if (hasWizardXWidgetExtensions) { stringBuffer.append( "<XWidget displayName=\"--- Extra fields for " + item.getName() + " ---\" xwidgetType=\"XLabel\" horizontalLabel=\"true\" toolTip=\"These fields are available for only the team workflow specified here.\"/>"); try { if (item instanceof IDynamicWidgetLayoutListener) { dynamicWidgetLayoutListener = (IDynamicWidgetLayoutListener) item; } item.getWizardXWidgetExtensions(wizard.getSelectedIAtsActionableItems(), stringBuffer); } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } } } stringBuffer.append("</WorkPage>"); page = new XWidgetPage(stringBuffer.toString(), ATSXWidgetOptionResolver.getInstance(), dynamicWidgetLayoutListener); page.createBody(null, comp, null, xModListener, true); comp.layout(); } } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } }
Source:
<code>public void onNext(final byte[] bytes) { <START> final ObjectSerializableCodec<String> codec = new ObjectSerializableCodec<>(); <END> final String input = codec.decode(bytes); final String[] result = input.split("\\s+", 2); final String command = result[0]; final String serializedConf = result[1]; switch (command) { case SUBMIT_COMMAND: try { if (!executeJob(ConfigurationUtils.fromString(serializedConf))) { sendMessageToClient("Job Server has already been shut down and will not accept any jobs."); } } catch (InjectionException | IOException e) { throw new RuntimeException(e); } break; case SHUTDOWN_COMMAND: shutdown(); break; default: throw new RuntimeException("There is unexpected command"); } }</code><technical_language>Please reuse codec, obtaining Tang</technical_language>

Target:
public void onNext(final byte[] bytes) { final String input = new String(bytes); final String[] result = input.split(COMMAND_DELIMITER, 2); final String command = result[0]; switch (command) { case SUBMIT_COMMAND: try { final String serializedConf = result[1]; executeJob(ConfigurationUtils.fromString(serializedConf)); } catch (InjectionException | IOException e) { throw new RuntimeException("The given job configuration is incomplete", e); } break; case SHUTDOWN_COMMAND: shutdown(); break; default: throw new RuntimeException("There is unexpected command"); } }
Source:
<code>public void continueOrPropagate(RetryableException ex) { boolean isFastFailoverException = isFastFailoverException(ex); synchronized (this) { if (!isFastFailoverException && retrySemantics == RetrySemantics.NEVER_EXCEPT_ON_NON_LEADERS) { throw hardFailOwingToFailureOnLeader(ex); <START> } <END> if (mostRecentServerIndex.get() != null && mostRecentServerIndex.get() == failoverCount.get()) { long failures = failuresSinceLastSwitch.incrementAndGet(); if (isFastFailoverException || failures >= failuresBeforeSwitching) { if (isFastFailoverException) { numSwitches.set(0); startTimeOfFastFailover.compareAndSet(0, System.currentTimeMillis()); } else { numSwitches.incrementAndGet(); startTimeOfFastFailover.set(0); } failuresSinceLastSwitch.set(0); failoverCount.incrementAndGet(); } } } checkAndHandleFailure(ex); if (!isFastFailoverException) { pauseForBackOff(ex); } }</code><technical_language>this moved mutex</technical_language>

Target:
public void continueOrPropagate(RetryableException ex) { boolean isFastFailoverException = isFastFailoverException(ex); if (!isFastFailoverException && retrySemantics == RetrySemantics.NEVER_EXCEPT_ON_NON_LEADERS) { throw hardFailOwingToFailureOnLeader(ex); } synchronized (this) { if (mostRecentServerIndex.get() != null && mostRecentServerIndex.get() == failoverCount.get()) { long failures = failuresSinceLastSwitch.incrementAndGet(); if (isFastFailoverException || failures >= failuresBeforeSwitching) { if (isFastFailoverException) { numSwitches.set(0); startTimeOfFastFailover.compareAndSet(0, System.currentTimeMillis()); } else { numSwitches.incrementAndGet(); startTimeOfFastFailover.set(0); } failuresSinceLastSwitch.set(0); failoverCount.incrementAndGet(); } } } checkAndHandleFailure(ex); if (!isFastFailoverException) { pauseForBackOff(ex); } }
Source:
<code>protected URI resolveUri(String path) { try { URI uri = new URI("file:/ if (Files.notExists(Paths.get(uri), LinkOption.NOFOLLOW_LINKS)) { return null; } return uri; } catch (URISyntaxException e) { <START> return null; <END> } }</code><technical_language>Log exception</technical_language>

Target:
protected URI resolveUri(String path) { String filename = prefix + path; try { URI uri = new URI(filename); File file = new File(uri); if (!file.exists()) { logger.debug("File '{}' not found", filename); return null; } return uri; } catch (URISyntaxException e) { logger.debug("Error resolving uri for '{}'", filename); return null; } }
Source:
<code>public void addImportedInstance(WorkflowExecutionContext context) throws FalconException { String feedName = context.getOutputFeedNames(); String feedInstanceDataPath = context.getOutputFeedInstancePaths(); String datasourceName = context.getDatasourceName(); String sourceClusterName = context.getSrcClusterName(); LOG.info("Computing import feed instance for : name= path= {}, in cluster: " + "from datasource: {}", feedName, feedInstanceDataPath, sourceClusterName, datasourceName); String feedInstanceName = getFeedInstanceName(feedName, sourceClusterName, feedInstanceDataPath, context.getNominalTimeAsISO8601()); Vertex feedInstanceVertex = addFeedInstance( feedInstanceName, context, feedName, context.getSrcClusterName()); Map<RelationshipProperty, String> properties = new HashMap<RelationshipProperty, String>(); <START> properties.put(RelationshipProperty.TIMESTAMP, context.getTimeStampAsISO8601()); <END> addInstanceToEntity(feedInstanceVertex, datasourceName, RelationshipType.DATASOURCE_ENTITY, RelationshipLabel.DATASOURCE_IMPORT_EDGE, properties); addInstanceToEntity(feedInstanceVertex, sourceClusterName, RelationshipType.CLUSTER_ENTITY, RelationshipLabel.FEED_CLUSTER_EDGE, properties); }</code><technical_language>edge is populated nominal time status. add status edge consistent other entity operations imported instances searchable</technical_language>

Target:
public void addImportedInstance(WorkflowExecutionContext context) throws FalconException { String feedName = context.getOutputFeedNames(); String feedInstanceDataPath = context.getOutputFeedInstancePaths(); String datasourceName = context.getDatasourceName(); String sourceClusterName = context.getSrcClusterName(); LOG.info("Computing import feed instance for : name= path= {}, in cluster: " + "from datasource: {}", feedName, feedInstanceDataPath, sourceClusterName, datasourceName); String feedInstanceName = getFeedInstanceName(feedName, sourceClusterName, feedInstanceDataPath, context.getNominalTimeAsISO8601()); Vertex feedInstanceVertex = addFeedInstance( feedInstanceName, context, feedName, context.getSrcClusterName()); Map<RelationshipProperty, String> properties = edgePropertiesForIndexing(context); properties.put(RelationshipProperty.TIMESTAMP, context.getTimeStampAsISO8601()); addInstanceToEntity(feedInstanceVertex, datasourceName, RelationshipType.DATASOURCE_ENTITY, RelationshipLabel.DATASOURCE_IMPORT_EDGE, properties); addInstanceToEntity(feedInstanceVertex, sourceClusterName, RelationshipType.CLUSTER_ENTITY, RelationshipLabel.FEED_CLUSTER_EDGE, properties); }
Source:
<code>private void createReasonNote(ActionForm form) { CuPurchasingAccountsPayableModuleService cuPurchasingAccountsPayableModuleService = <START> (CuPurchasingAccountsPayableModuleService) SpringContext.getService("purchasingAccountsPayableModuleService"); <END> PurchasingFormBase purForm = (PurchasingFormBase) form; cuPurchasingAccountsPayableModuleService.createAndSaveNote(purForm.getDocument(), purForm.getReasonToChange()); purForm.setReasonToChange(StringUtils.EMPTY); }</code><technical_language>get service class</technical_language>

Target:
private void createReasonNote(ActionForm form) { CuPurchasingAccountsPayableModuleService cuPurchasingAccountsPayableModuleService = (CuPurchasingAccountsPayableModuleService) SpringContext.getBean(PurchasingAccountsPayableModuleService.class); PurchasingFormBase purForm = (PurchasingFormBase) form; cuPurchasingAccountsPayableModuleService.createAndSaveNote(purForm.getDocument(), purForm.getReasonToChange()); purForm.setReasonToChange(StringUtils.EMPTY); }
Source:
<code>public void addAlignment(final SAMRecord alignment) { if (sortOrder.equals(SAMFileHeader.SortOrder.unsorted)) { writeAlignment(alignment); } else if (presorted) { <START> assertPresorted(alignment); <END> writeAlignment(alignment); } else { alignmentSorter.add(alignment); } }</code><technical_language>I suppose I want understand this check in place, else do consider group order, this is issue writing. I suppose is pass alignment alignmentSorter if request a sort order (SO) do in case of group order (GO). In case, adding support SO=unsorted GO=query, alignment passed alignmentSorter based new comparator if SO=unsorted GO=query</technical_language>

Target:
public void addAlignment(final SAMRecord alignment) { if (null == alignment.getHeader()) { alignment.setHeader(header); } if (sortOrder.equals(SAMFileHeader.SortOrder.unsorted)) { writeAlignment(alignment); } else if (presorted) { assertPresorted(alignment); writeAlignment(alignment); } else { alignmentSorter.add(alignment); } }
Source:
<code>public boolean checkTrigger(GameEvent event, Game game) { <START> Permanent enchantment = game.getPermanent(this.getSourceId()); <END> if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { for (Effect effect: this.getEffects()) { effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); } return true; } return false; }</code><technical_language>getPermanentOrLKI if enchantment destroyed resolution</technical_language>

Target:
public boolean checkTrigger(GameEvent event, Game game) { Permanent enchantment = game.getPermanentOrLKIBattlefield(this.getSourceId()); UUID controller = this.getControllerId(); if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { if (!game.getCombat().getAttackerId().equals(controller)) { for (Effect effect: this.getEffects()) { effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); } } return true; } return false; }
Source:
<code>public JSONWithPadding addIndex(@Context UriInfo ui, @PathParam( "applicationId" ) final String applicationIdStr, Map<String, Object> config, @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback) throws Exception{ ApiResponse response = createApiResponse(); final UUID appId = UUIDUtils.tryExtractUUID(applicationIdStr); if (!config.containsKey("replicas") || !config.containsKey("shards") || !(config.get("replicas") instanceof Integer) || !(config.get("shards") instanceof Integer)){ throw new IllegalArgumentException("body must contains 'replicas' of type int and 'shards' of type int"); } if(!config.containsKey("indexSuffix")) { throw new IllegalArgumentException("Please add an indexSuffix to your post"); } <START> String writeConsistency = config.get("writeConsistency") != null ? (String)config.get("writeConsistency") : "one" ; <END> emf.addIndex(appId, config.get("indexSuffix").toString(), (int) config.get("shards"),(int) config.get("replicas"),writeConsistency); response.setAction("Add index to alias"); return new JSONWithPadding(response, callback); }</code><technical_language>IndexFig set default? initial creation</technical_language>

Target:
public JSONWithPadding addIndex(@Context UriInfo ui, @PathParam( "applicationId" ) final String applicationIdStr, Map<String, Object> config, @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback) throws Exception{ ApiResponse response = createApiResponse(); final UUID appId = UUIDUtils.tryExtractUUID(applicationIdStr); if (!config.containsKey("replicas") || !config.containsKey("shards") || !(config.get("replicas") instanceof Integer) || !(config.get("shards") instanceof Integer)){ throw new IllegalArgumentException("body must contains 'replicas' of type int and 'shards' of type int"); } if(!config.containsKey("indexSuffix")) { throw new IllegalArgumentException("Please add an indexSuffix to your post"); } emf.addIndex(appId, config.get("indexSuffix").toString(), (int) config.get("shards"),(int) config.get("replicas"),(String)config.get("writeConsistency")); response.setAction("Add index to alias"); return new JSONWithPadding(response, callback); }
Source:
<code>private Document createContentsFile(List<GodToolsTranslation> godToolsTranslationList) throws ParserConfigurationException { Document contents = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); Element rootElement = contents.createElement("content"); contents.appendChild(rootElement); for(GodToolsTranslation godToolsTranslation : godToolsTranslationList) { Element resourceElement = contents.createElement("resource"); resourceElement.setAttribute("package", godToolsTranslation.getPackageCode()); resourceElement.setAttribute("language", godToolsTranslation.getLanguage().getPath()); resourceElement.setAttribute("config", godToolsTranslation.getTranslation().getId() + ".xml"); resourceElement.setAttribute("status", godToolsTranslation.isDraft() ? "draft" : "live"); resourceElement.setAttribute("name", godToolsTranslation.getPackageStructure().getPackageName()); resourceElement.setAttribute("version", godToolsTranslation.getVersionNumber().toPlainString()); <START> if (!textOnly) <END> { if (godToolsTranslation.getIcon() != null) { resourceElement.setAttribute("icon", GuavaHashGenerator.calculateHash(godToolsTranslation.getIcon().getImageContent()) + ".png"); } else { resourceElement.setAttribute("icon", "missing"); } rootElement.appendChild(resourceElement); } } return contents; }</code><technical_language>100% sure, excluding icon filename contents.xml mess apps. test overwrite (or erase) filename included. test changes</technical_language>

Target:
private Document createContentsFile(List<GodToolsTranslation> godToolsTranslationList) throws ParserConfigurationException { Document contents = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); Element rootElement = contents.createElement("content"); contents.appendChild(rootElement); for(GodToolsTranslation godToolsTranslation : godToolsTranslationList) { Element resourceElement = contents.createElement("resource"); resourceElement.setAttribute("package", godToolsTranslation.getPackageCode()); resourceElement.setAttribute("language", godToolsTranslation.getLanguage().getPath()); resourceElement.setAttribute("config", godToolsTranslation.getTranslation().getId() + ".xml"); resourceElement.setAttribute("status", godToolsTranslation.isDraft() ? "draft" : "live"); resourceElement.setAttribute("name", godToolsTranslation.getPackageStructure().getPackageName()); resourceElement.setAttribute("version", godToolsTranslation.getVersionNumber().toPlainString()); if (includeImages) { if (godToolsTranslation.getIcon() != null) { resourceElement.setAttribute("icon", GuavaHashGenerator.calculateHash(godToolsTranslation.getIcon().getImageContent()) + ".png"); } else { resourceElement.setAttribute("icon", "missing"); } rootElement.appendChild(resourceElement); } } return contents; }
Source:
<code>public int hashCode() { <START> final int prime = 31; <END> int result = 1; result = prime * result + ((outcomes == null) ? 0 : outcomes.hashCode()); result = prime * result + ((probs == null) ? 0 : probs.hashCode()); long temp; temp = Double.doubleToLongBits(score); result = prime * result + (int) (temp ^ (temp >>> 32)); return result; }</code><technical_language>Change this project style hashCode equals impls</technical_language>

Target:
public int hashCode() { return Objects.hash(outcomes, probs, score); }
Source:
<code>private static DetailedSample getParent(DetailedSampleDto childDto) { DetailedSample parent = null; if (childDto.getParentId() != null) { parent = new DetailedSampleImpl(); parent.setId(childDto.getParentId()); } else { if (childDto instanceof SampleIdentityDto && childDto.getClass() != SampleIdentityDto.class) { parent = toIdentitySample((SampleIdentityDto) childDto); } if (childDto instanceof SampleTissueDto && childDto.getClass() != SampleTissueDto.class) { <START> if (childDto.getParentSampleClassId() == null) { <END> throw new IllegalArgumentException("No tissue class specified."); } DetailedSample tissue = toTissueSample((SampleTissueDto) childDto); tissue.setSampleClass(new SampleClassImpl()); tissue.getSampleClass().setId(childDto.getParentSampleClassId()); tissue.setParent(parent); parent = tissue; } if (childDto instanceof SampleStockDto && childDto.getClass() != SampleStockDto.class) { DetailedSample stock = toStockSample((SampleStockDto) childDto); stock.setSampleClass(new SampleClassImpl()); stock.getSampleClass().setId(((SampleAliquotDto) childDto).getStockClassId()); stock.setParent(parent); parent = stock; } } return parent; }</code><technical_language>Please rename DetailedSample.parentSampleClassId refers tissue-level parent only, direct parent</technical_language>

Target:
private static DetailedSample getParent(DetailedSampleDto childDto) { DetailedSample parent = null; if (childDto.getParentId() != null) { parent = new DetailedSampleImpl(); parent.setId(childDto.getParentId()); } else { if (childDto instanceof SampleIdentityDto && childDto.getClass() != SampleIdentityDto.class) { parent = toIdentitySample((SampleIdentityDto) childDto); } if (childDto instanceof SampleTissueDto && childDto.getClass() != SampleTissueDto.class) { if (childDto.getParentTissueSampleClassId() == null) { throw new IllegalArgumentException("No tissue class specified."); } DetailedSample tissue = toTissueSample((SampleTissueDto) childDto); tissue.setSampleClass(new SampleClassImpl()); tissue.getSampleClass().setId(childDto.getParentTissueSampleClassId()); tissue.setParent(parent); parent = tissue; } if (childDto instanceof SampleStockDto && childDto.getClass() != SampleStockDto.class) { DetailedSample stock = toStockSample((SampleStockDto) childDto); stock.setSampleClass(new SampleClassImpl()); stock.getSampleClass().setId(((SampleAliquotDto) childDto).getStockClassId()); stock.setParent(parent); parent = stock; } } return parent; }
Source:
<code>Slice(boolean[] base, int offset, int length) { requireNonNull(base, "base is null"); checkPositionIndexes(offset, offset + length, base.length); this.base = base; <START> this.address = ARRAY_BOOLEAN_BASE_OFFSET + (offset * ARRAY_BOOLEAN_INDEX_SCALE); <END> this.size = length * ARRAY_BOOLEAN_INDEX_SCALE; this.retainedSize = INSTANCE_SIZE + base.length * ARRAY_BOOLEAN_INDEX_SCALE; this.reference = null; }</code><technical_language>nit: remove brackets consistent 2 lines below</technical_language>

Target:
Slice(boolean[] base, int offset, int length) { requireNonNull(base, "base is null"); checkPositionIndexes(offset, offset + length, base.length); this.base = base; this.address = ARRAY_BOOLEAN_BASE_OFFSET + offset * ARRAY_BOOLEAN_INDEX_SCALE; this.size = length * ARRAY_BOOLEAN_INDEX_SCALE; this.retainedSize = INSTANCE_SIZE + base.length * ARRAY_BOOLEAN_INDEX_SCALE; this.reference = null; }
Source:
<code>public DeleteTenant(RxSession session, MetricsService metricsService) { this.session = session; this.metricsService = metricsService; deleteTenant = session.getSession().prepare("DELETE FROM tenants WHERE id = ?"); deleteData = session.getSession().prepare( <START> "DELETE FROM data WHERE tenant_id = ? AND type = ? AND metric = ? AND dpart = 0"); <END> deleteFromMetricsIndex = session.getSession().prepare( "DELETE FROM metrics_idx WHERE tenant_id = ? AND type = ? AND metric = ?"); deleteTag = session.getSession().prepare("DELETE FROM metrics_tags_idx WHERE tenant_id = ? AND tname = ? " + "AND tvalue = ? AND type = ? AND metric = ?"); deleteRetentions = session.getSession().prepare("DELETE FROM retentions_idx WHERE tenant_id = ? AND type = ?"); }</code><technical_language>I I fact CQL statements in places now. collocate job scheduler CQL statements in a single place? This addressed in a PR long open a JIRA</technical_language>

Target:
public DeleteTenant(RxSession session, MetricsService metricsService) { this.session = session; this.metricsService = metricsService; deleteTenant = session.getSession().prepare("DELETE FROM tenants WHERE id = ?"); deleteData = session.getSession().prepare( "DELETE FROM data WHERE tenant_id = ? AND type = ? AND metric = ? AND dpart = 0"); deleteFromMetricsIndex = session.getSession().prepare( "DELETE FROM metrics_idx WHERE tenant_id = ? AND type = ?"); findTags = session.getSession().prepare("SELECT DISTINCT tenant_id, tname FROM metrics_tags_idx"); deleteTag = session.getSession().prepare("DELETE FROM metrics_tags_idx WHERE tenant_id = ? AND tname = ?"); deleteRetentions = session.getSession().prepare("DELETE FROM retentions_idx WHERE tenant_id = ? AND type = ?"); }
Source:
<code>public void updateExistingPaymentWorksVendorInStagingTable(Integer id, String pmwRequestStatus, String kfsVendorProcessingStatus, Timestamp processingTimeStamp) { <START> updateExistingPaymentWorksVendorInStagingTable(id, pmwRequestStatus, kfsVendorProcessingStatus, null, null, null, processingTimeStamp, null, null, null); <END> }</code><technical_language>I suggest adding of KFSConstants.EMPTY_STRING in for related String arguments, minimize of nulls in method calls. for other calls updated in a similar manner</technical_language>

Target:
public void updateExistingPaymentWorksVendorInStagingTable(Integer id, String pmwRequestStatus, String kfsVendorProcessingStatus, Timestamp processingTimeStamp) { updateExistingPaymentWorksVendorInStagingTable(id, pmwRequestStatus, kfsVendorProcessingStatus, KFSConstants.EMPTY_STRING, KFSConstants.EMPTY_STRING, KFSConstants.EMPTY_STRING, processingTimeStamp, null, null, null); }
Source:
<code><START> public void theBundleRequestContainsAFindEventsAction(final Map<String, String> parameters) throws Throwable { <END> final BundleRequest request = (BundleRequest) ScenarioContext.current() .get(PlatformSmartmeteringKeys.BUNDLE_REQUEST); final FindEventsRequest action = new FindEventsRequestBuilder().fromParameterMap(parameters).build(); this.addActionToBundleRequest(request, action); }</code><technical_language>I wondering if need separate versions for this step method parameters. defaults version parameters applied if parameter values missing in step data</technical_language>

Target:
public void theBundleRequestContainsAFindEventsAction(final Map<String, String> parameters) throws Throwable { final FindEventsRequest action = new FindEventsRequestBuilder().fromParameterMap(parameters).build(); this.addActionToBundleRequest(action); }
Source:
<code>public AlertsUpdateEtagTrigger() { <START> super("portal.alerts_etags", 15); <END> }</code><technical_language>Sorry, I completely missed classpath this. fine. need drop H2 Postgres Docker. Unfortunately, I recall SBT a good Docker plugin ... I doubt thinking of ;)</technical_language>

Target:
public AlertsUpdateEtagTrigger() { super(AlertEtags::incrementEtag, 15); }