auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public static IOseeBranch getAtsBranch() { <END> if (atsBranch == null) { if (atsBranch == null && AtsPreferencesService.isAvailable()) { try { String atsBranchUuid = AtsPreferencesService.get(ATS_BRANCH_UUID); setConfig(atsBranchUuid, AtsPreferencesService.get(ATS_BRANCH_NAME)); } catch (Exception ex) { OseeLog.log(AtsUtilCore.class, Level.SEVERE, "Error processing ats_branch.txt file.", ex); } } if (atsBranch == null) { String atsBranchUuid = System.getProperty(ATS_BRANCH_UUID); if (Strings.isValid(atsBranchUuid)) { setConfig(atsBranchUuid, System.getProperty(ATS_BRANCH_NAME)); } } if (atsBranch == null) { atsBranch = CoreBranches.COMMON; atsConfigName = CoreBranches.COMMON.getName(); } } return atsBranch; }</code><technical_language>This appears a critical section multiple threads get wrong answer if process is in middle of setting atsBranch atsConfigName</technical_language>

Target:
public synchronized static IOseeBranch getAtsBranch() { if (atsBranch == null) { if (atsBranch == null && AtsPreferencesService.isAvailable()) { try { String atsBranchUuid = AtsPreferencesService.get(ATS_BRANCH_UUID); setConfig(atsBranchUuid, AtsPreferencesService.get(ATS_BRANCH_NAME)); } catch (Exception ex) { OseeLog.log(AtsUtilCore.class, Level.SEVERE, "Error processing stored ATS Branch.", ex); } } if (atsBranch == null) { String atsBranchUuid = System.getProperty(ATS_BRANCH_UUID); if (Strings.isValid(atsBranchUuid)) { setConfig(atsBranchUuid, System.getProperty(ATS_BRANCH_NAME)); } } if (atsBranch == null) { atsBranch = CoreBranches.COMMON; atsConfigName = CoreBranches.COMMON.getName(); } } return atsBranch; }
Source:
<code>public static String getStartedUrl() { try { String paHost = ProActiveInet.getInstance().getHostname(); Properties properties = readWebDeploymentProperties(); int httpPort = Integer.parseInt(properties.getProperty("ear.wrapper.target.server.http.port", "9080")); int httpsPort = Integer.parseInt(properties.getProperty("ear.wrapper.target.server.https.port", "9443")); boolean httpsEnabled = isHttpsEnabled(properties); int port = httpPort; String httpProtocol; <START> if (httpsEnabled) { <END> httpProtocol = "https"; port = httpsPort; } else { httpProtocol = "http"; } return httpProtocol + "://" + paHost + ":" + port; } catch (Exception e) { logger.warn("Could not find the getStarted URL", e); return null; } }</code><technical_language>write if ( isHttpsEnabled(properties) ) {</technical_language>

Target:
public static String getStartedUrl() { try { String paHost = ProActiveInet.getInstance().getHostname(); int port = WebProperties.WAR_WRAPPER_HTTP_PORT.getValueAsInt(); String contextRoot = WebProperties.WAR_WRAPPER_CONTEXT_ROOT.getValueAsString(); String httpProtocol; if (WebProperties.WAR_WRAPPER_HTTPS_ENABLED.getValueAsBoolean()) { httpProtocol = "https"; port = WebProperties.WAR_WRAPPER_HTTPS_PORT.getValueAsInt(); } else { httpProtocol = "http"; } return httpProtocol + "://" + paHost + ":" + port + contextRoot; } catch (Exception e) { logger.warn("Could not find the getStarted URL", e); return null; } }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } VdsStatistics other = (VdsStatistics) obj; return (ObjectUtils.objectsEqual(id, other.id) && ObjectUtils.bigDecimalEqual(cpu_idle, other.cpu_idle) && ObjectUtils.bigDecimalEqual(cpu_load, other.cpu_load) && ObjectUtils.bigDecimalEqual(cpu_sys, other.cpu_sys) && ObjectUtils.bigDecimalEqual(cpu_user, other.cpu_user) && ObjectUtils.objectsEqual(mem_available, other.mem_available) && ObjectUtils.objectsEqual(memFree, other.memFree) && ObjectUtils.objectsEqual(mem_shared, other.mem_shared) && ObjectUtils.objectsEqual(usage_cpu_percent, other.usage_cpu_percent) && ObjectUtils.objectsEqual(usage_network_percent, other.usage_network_percent) && ObjectUtils.objectsEqual(ksm_state, other.ksm_state) && ObjectUtils.objectsEqual(ksm_pages, other.ksm_pages) && ObjectUtils.objectsEqual(ksm_cpu_percent, other.ksm_cpu_percent) && ObjectUtils.objectsEqual(swap_total, other.swap_total) && ObjectUtils.objectsEqual(swap_free, other.swap_free) && ObjectUtils.objectsEqual(highlyAvailableScore, other.highlyAvailableScore) <START> && ObjectUtils.objectsEqual(anonymousHugePages, other.anonymousHugePages)); <END> }</code><technical_language>primitive int, need objectsEquals unneeded boxing</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } VdsStatistics other = (VdsStatistics) obj; return (ObjectUtils.objectsEqual(id, other.id) && ObjectUtils.bigDecimalEqual(cpu_idle, other.cpu_idle) && ObjectUtils.bigDecimalEqual(cpu_load, other.cpu_load) && ObjectUtils.bigDecimalEqual(cpu_sys, other.cpu_sys) && ObjectUtils.bigDecimalEqual(cpu_user, other.cpu_user) && ObjectUtils.objectsEqual(mem_available, other.mem_available) && ObjectUtils.objectsEqual(memFree, other.memFree) && ObjectUtils.objectsEqual(mem_shared, other.mem_shared) && ObjectUtils.objectsEqual(usage_cpu_percent, other.usage_cpu_percent) && ObjectUtils.objectsEqual(usage_network_percent, other.usage_network_percent) && ObjectUtils.objectsEqual(ksm_state, other.ksm_state) && ObjectUtils.objectsEqual(ksm_pages, other.ksm_pages) && ObjectUtils.objectsEqual(ksm_cpu_percent, other.ksm_cpu_percent) && ObjectUtils.objectsEqual(swap_total, other.swap_total) && ObjectUtils.objectsEqual(swap_free, other.swap_free) && ObjectUtils.objectsEqual(highlyAvailableScore, other.highlyAvailableScore) && (anonymousHugePages == other.anonymousHugePages)); }
Source:
<code>private boolean verifyChangesInUI (boolean lastDisplayVisibility) { String lightboxHeaderDisplayValue = lightboxHeader.getCssValue("display"); String lightboxFooterDisplayValue = lightboxFooter.getCssValue("display"); boolean lightboxHeaderDisplay; boolean lightboxFooterDisplay; if (lightboxHeaderDisplayValue.contains("none")) { lightboxHeaderDisplay = false; } else { lightboxHeaderDisplay = true; } if (lightboxFooterDisplayValue.contains("none")) { lightboxFooterDisplay = false; } else { lightboxFooterDisplay = true; } <START> if (lightboxHeaderDisplay == lastDisplayVisibility) { <END> PageObjectLogging.log("verifyChangesInUI", "Lightbox header visibility didn't changed", false); } else { PageObjectLogging.log("verifyChangesInUI", "Lightbox header visibility changed", true); } if (lightboxFooterDisplay == lastDisplayVisibility) { PageObjectLogging.log("verifyChangesInUI", "Lightbox footer visibility didn't changed", false); } else { PageObjectLogging.log("verifyChangesInUI", "Lightbox footer visibility changed", true); } return !lastDisplayVisibility; }</code><technical_language>contains() returns a boolean, use: lightboxHeader.getCssValue("display").contains("none");</technical_language>

Target:
private boolean verifyChangesInUI (boolean lastDisplayVisibility) { boolean lightboxHeaderDisplay = true; boolean lightboxFooterDisplay = true; if (lightboxHeader.getCssValue("display").contains("none")) { lightboxHeaderDisplay = false; } if (lightboxFooter.getCssValue("display").contains("none")) { lightboxFooterDisplay = false; } if (lightboxHeaderDisplay == lastDisplayVisibility) { PageObjectLogging.log("verifyChangesInUI", "Lightbox header visibility didn't changed", false); } else { PageObjectLogging.log("verifyChangesInUI", "Lightbox header visibility changed", true); } if (lightboxFooterDisplay == lastDisplayVisibility) { PageObjectLogging.log("verifyChangesInUI", "Lightbox footer visibility didn't changed", false); } else { PageObjectLogging.log("verifyChangesInUI", "Lightbox footer visibility changed", true); } return !lastDisplayVisibility; }
Source:
<code>protected void accumulate(NodeValue nv, Binding binding, FunctionEnv functionEnv) { if ( DEBUG ) System.out.println("median: "+nv) ; if ( nv.isNumber() ) { count++ ; if ( total == noValuesToMedian ) total = nv ; else total = XSDFuncOp.numAdd(nv, total) ; <START> collection.add(nv); <END> } else { throw new ExprEvalException("median: not a number: "+nv) ; } if ( DEBUG ) System.out.println("median: ("+total+","+count+")") ; }</code><technical_language>store double values here? please brackets for preceding if else current indentation this read odd</technical_language>

Target:
protected void accumulate(NodeValue nv, Binding binding, FunctionEnv functionEnv) { log.debug("median {}", nv); if ( nv.isNumber() ) { count++ ; collection.add(nv); } else { throw new ExprEvalException("median: not a number: "+nv) ; } log.debug("median count {}", count); }
Source:
<code>public void start(Stage primaryStage) throws Exception { setupLayout(); <START> primaryStage.getIcons().add(new Image("file:icon.png")); <END> primaryStage.setTitle("SonarQube Java Analyzer - Viewer"); codeArea.insertText(0, defaultFileContent()); SplitPane splitPane = new SplitPane(); splitPane.getItems().addAll(verticalLayout, webView); webView.getEngine().load(Viewer.class.getResource("/viewer/viewer.html").toExternalForm()); primaryStage.setScene(new Scene(splitPane, 1200, 800)); primaryStage.show(); Timeline timeline = new Timeline(new KeyFrame(Duration.millis(500), ae -> checkForUpdate())); timeline.setCycleCount(Animation.INDEFINITE); timeline.play(); }</code><technical_language>please remove provide icon :)</technical_language>

Target:
public void start(Stage primaryStage) throws Exception { setupLayout(); primaryStage.setTitle("SonarQube Java Analyzer - Viewer"); codeArea.insertText(0, defaultFileContent()); SplitPane splitPane = new SplitPane(); splitPane.getItems().addAll(verticalLayout, webView); webView.getEngine().load(Viewer.class.getResource("/viewer/viewer.html").toExternalForm()); primaryStage.setScene(new Scene(splitPane, 1200, 800)); primaryStage.show(); Timeline timeline = new Timeline(new KeyFrame(Duration.millis(500), ae -> checkForUpdate())); timeline.setCycleCount(Animation.INDEFINITE); timeline.play(); }
Source:
<code>AnnotatedConnectException(ConnectException exception, SocketAddress remoteAddress) { super(exception.getMessage() + ": " + remoteAddress); initCause(exception); <START> setStackTrace(EmptyArrays.EMPTY_STACK_TRACE); <END> }</code><technical_language>@carl-mastrangelo remove this line</technical_language>

Target:
AnnotatedConnectException(ConnectException exception, SocketAddress remoteAddress) { super(exception.getMessage() + ": " + remoteAddress); initCause(exception); }
Source:
<code>public void editLabel(AgentPrincipals agent, PID pid, String label) { FedoraTransaction tx = txManager.startTransaction(); try (Timer.Context context = timer.time()) { aclService.assertHasAccess( "User does not have permissions to edit labels", pid, agent.getPrincipals(), Permission.editDescription); RepositoryObject obj = repoObjLoader.getRepositoryObject(pid); Model objModel = obj.getModel(); Resource resc = objModel.getResource(obj.getUri().toString()); <START> String oldLabel = replaceOldLabel(objModel, resc, label); <END> repoObjFactory.createExclusiveRelationship(obj, DcElements.title, label); obj.getPremisLog() .buildEvent(Premis.Migration) .addImplementorAgent(agent.getUsernameUri()) .addEventDetail("Object renamed from " + oldLabel + " to " + label) .write(); } catch (Exception e) { tx.cancel(e); } finally { tx.close(); } operationsMessageSender.sendUpdateDescriptionOperation( agent.getUsername(), Arrays.asList(pid)); }</code><technical_language>I need call this method anymore, createExclusiveRelationship figures out previous values for property replaced, need modify model anymore. drop lines 74 75 too</technical_language>

Target:
public void editLabel(AgentPrincipals agent, PID pid, String label) { FedoraTransaction tx = txManager.startTransaction(); try (Timer.Context context = timer.time()) { aclService.assertHasAccess( "User does not have permissions to edit labels", pid, agent.getPrincipals(), Permission.editDescription); RepositoryObject obj = repoObjLoader.getRepositoryObject(pid); String oldLabel = getOldLabel(obj); repoObjFactory.createExclusiveRelationship(obj, DcElements.title, label); obj.getPremisLog() .buildEvent(Premis.Migration) .addImplementorAgent(agent.getUsernameUri()) .addEventDetail("Object renamed from " + oldLabel + " to " + label) .write(); } catch (Exception e) { tx.cancel(e); } finally { tx.close(); } operationsMessageSender.sendUpdateDescriptionOperation( agent.getUsername(), Arrays.asList(pid)); }
Source:
<code>protected T updateBasicField(U field, FieldMetaData fieldMetaData, T document, T documentAdditions, T documentDeletions) { switch (fieldMetaData.valueMetaData.type) { case TType.SET: Set<String> originalSet = document.getFieldValue(field)==null ? new HashSet<>() : (Set<String>) document.getFieldValue(field); removeAll(originalSet, (Set<String>) documentDeletions.getFieldValue(field)); addAll(originalSet,(Set<String>) documentAdditions.getFieldValue(field)); document.setFieldValue(field, originalSet); break; case TType.STRING: case TType.ENUM: document.setFieldValue(field, documentAdditions.getFieldValue(field)); break; case TType.I32: case TType.BOOL: if (documentAdditions.isSet(field)){ document.setFieldValue(field, documentAdditions.getFieldValue(field)); } break; case TType.MAP: if(isMapFieldMapOfStringSets(field, document, documentAdditions, documentDeletions, log)){ document.setFieldValue(field, updateCustomMap( (Map<String, Set<String>>) document.getFieldValue(field), (Map<String, Set<String>>) documentAdditions.getFieldValue(field), (Map<String, Set<String>>) documentDeletions.getFieldValue(field))); } else { try { document.setFieldValue(field, documentAdditions.getFieldValue(field)); <START> } catch (ClassCastException e) { <END> log.error("Cannot handle type of field in Moderator: " + field.getFieldName()); } } break; default: log.error("Unknown field in Moderator: " + field.getFieldName()); } return document; }</code><technical_language>I problem try-catch block se, understand is necessary. explain use-case problem a bit more in detail</technical_language>

Target:
protected T updateBasicField(U field, FieldMetaData fieldMetaData, T document, T documentAdditions, T documentDeletions) { switch (fieldMetaData.valueMetaData.type) { case TType.SET: Set<String> originalSet = document.getFieldValue(field)==null ? new HashSet<>() : (Set<String>) document.getFieldValue(field); removeAll(originalSet, (Set<String>) documentDeletions.getFieldValue(field)); addAll(originalSet,(Set<String>) documentAdditions.getFieldValue(field)); document.setFieldValue(field, originalSet); break; case TType.STRING: case TType.ENUM: document.setFieldValue(field, documentAdditions.getFieldValue(field)); break; case TType.I32: case TType.BOOL: if (documentAdditions.isSet(field)){ document.setFieldValue(field, documentAdditions.getFieldValue(field)); } break; case TType.MAP: if(isMapFieldMapOfStringSets(field, document, documentAdditions, documentDeletions, log)){ document.setFieldValue(field, updateCustomMap( (Map<String, Set<String>>) document.getFieldValue(field), (Map<String, Set<String>>) documentAdditions.getFieldValue(field), (Map<String, Set<String>>) documentDeletions.getFieldValue(field))); } else { document.setFieldValue(field, documentAdditions.getFieldValue(field)); } break; default: log.error("Unknown field in Moderator: " + field.getFieldName()); } return document; }
Source:
<code>static EsClient onAdd(final EsClientConfiguration configuration) { LOG.info("Connecting to Elasticsearch cluster at '{}'{}, connect timeout: ms, socket timeout: ms.", configuration.getClusterUrl(), configuration.isProtected() ? " using basic authentication" : "", configuration.getConnectTimeout(), configuration.getSocketTimeout()); if (configuration.isHttp()) { return new EsHttpClient(configuration); } else { <START> checkState(configuration.isTcp(), "Only TCP and HTTP clients are supported"); <END> HostAndPort hostAndPort = HostAndPort.fromString(configuration.getClusterUrl().replaceAll(EsClientConfiguration.TCP_SCHEME, "")); Settings settings = Settings.builder() .put("cluster.name", configuration.getClusterName()) .build(); return new EsTcpClient(new PreBuiltTransportClient(settings) .addTransportAddress(new TransportAddress(new InetSocketAddress(hostAndPort.getHostText(), hostAndPort.getPort())))); } }</code><technical_language>throw exception if transport client is configured a user name password, is supported in x-pack version</technical_language>

Target:
static EsClient onAdd(final EsClientConfiguration configuration) { LOG.info("Connecting to Elasticsearch cluster at '{}'{}, connect timeout: ms, socket timeout: ms.", configuration.getClusterUrl(), configuration.isProtected() ? " using basic authentication" : "", configuration.getConnectTimeout(), configuration.getSocketTimeout()); if (configuration.isHttp()) { return new EsHttpClient(configuration); } else { checkState(configuration.isTcp(), "Only TCP and HTTP clients are supported"); checkState(!configuration.isProtected(), "TCP connection scheme does not yet support security configuration. Consider switching to HTTP instead."); HostAndPort hostAndPort = HostAndPort.fromString(configuration.getClusterUrl().replaceAll(EsClientConfiguration.TCP_SCHEME, "")); Settings settings = Settings.builder() .put("cluster.name", configuration.getClusterName()) .build(); return new EsTcpClient(new PreBuiltTransportClient(settings) .addTransportAddress(new TransportAddress(new InetSocketAddress(hostAndPort.getHostText(), hostAndPort.getPort())))); } }
Source:
<code>public int reservePort() { int port = 0; int attempts = 0; boolean searchingForPort = true; synchronized (reservedPorts) { <START> while (searchingForPort && ++attempts < 10) { <END> port = findFreePort(); searchingForPort = !reservedPorts.add(port) || isBlocked(port); } } if (!(attempts < 10)) { throw new RuntimeException("Could not allocate a free port after " + attempts + " attempts."); } return port; }</code><technical_language>minor: prefer a constant (MAX_ATTEMPTS?) this is</technical_language>

Target:
public synchronized int reservePort() { int port = 0; int attempts = 0; boolean searchingForPort = true; while (searchingForPort && ++attempts < MAX_ATTEMPTS) { port = findFreePort(); searchingForPort = isBlocked(port) || !reservedPorts.add(port); } if (searchingForPort) { throw new RuntimeException("Could not allocate a free port after " + MAX_ATTEMPTS + " attempts."); } return port; }
Source:
<code>private void recreateEmptyArea() { if (emptyArea != null) { emptyArea.dispose(); emptyArea = null; } <START> if (images != null) { <END> disposeImages(); images = new ArrayList<>(); } createEmptyArea(displayArea); switchTopControlRunnable.run(); }</code><technical_language>images is null call disposeImages()</technical_language>

Target:
private void recreateEmptyArea() { if (emptyArea != null) { emptyArea.dispose(); emptyArea = null; } disposeImages(); createEmptyArea(displayArea); switchTopControlRunnable.run(); }
Source:
<code>public AdBrokerBenchmark(AdBrokerConfig config) { <START> this.m_config = config; <END> ClientConfig clientConfig = new ClientConfig(config.user, config.password, new StatusListener()); clientConfig.setMaxTransactionsPerSecond(config.ratelimit); m_client = ClientFactory.createClient(clientConfig); m_rand = new Random(777); m_periodicStatsContext = m_client.createStatsContext(); m_fullStatsContext = m_client.createStatsContext(); System.out.print(HORIZONTAL_RULE); System.out.println(" Command Line Configuration"); System.out.println(HORIZONTAL_RULE); System.out.println(config.getConfigDumpString()); if (config.latencyreport && config.ratelimit == Integer.MAX_VALUE) { System.out.println("WARNING: Option latencyreport is ON, and no rate limit is set. " + "Expect high latencies to be reported.\n"); } }</code><technical_language>remove "this" qualifier for m_config</technical_language>

Target:
public AdBrokerBenchmark(AdBrokerConfig config) { m_config = config; ClientConfig clientConfig = new ClientConfig(config.user, config.password, new StatusListener()); clientConfig.setMaxTransactionsPerSecond(config.ratelimit); m_client = ClientFactory.createClient(clientConfig); m_rand = new Random(777); m_periodicStatsContext = m_client.createStatsContext(); m_fullStatsContext = m_client.createStatsContext(); System.out.print(HORIZONTAL_RULE); System.out.println(" Command Line Configuration"); System.out.println(HORIZONTAL_RULE); System.out.println(config.getConfigDumpString()); if (config.latencyreport && config.ratelimit == Integer.MAX_VALUE) { System.out.println("WARNING: Option latencyreport is ON, and no rate limit is set. " + "Expect high latencies to be reported.\n"); } }
Source:
<code>private void checkAndRethrow() { try { this.currentTask.get(); <START> } catch (CancellationException | InterruptedException | ExecutionException e) { this.isClosed = true; throw new RuntimeException("Exception while writing records asynchronously", e); <END> } finally { this.currentTask = null; } }</code><technical_language>suggestion } catch (CancellationException | InterruptedException | ExecutionException e) { this.isClosed = true; final Throwable t = e instanceof ExecutionException ? e.getCause() : e; throw new RuntimeException("Exception while writing records asynchronously", t);</technical_language>

Target:
private void checkAndRethrow() { try { this.currentTask.get(); } catch (CancellationException | InterruptedException | ExecutionException e) { this.isClosed = true; final Throwable t = e instanceof ExecutionException ? e.getCause() : e; throw new RuntimeException("Exception while writing records asynchronously", t); } finally { this.currentTask = null; } }
Source:
<code>private void discoverRegistryPressed(Shell shell) { IConnection tmp = pageModel.createConnection(); IStatus ret = RegistryProviderModel.getDefault().getRegistryURL(tmp); String oldVal = (String)registryURLObservable.getValue(); String newVal = ret.getMessage(); if( ret != null && ret.isOK()) { if( !eq(oldVal, newVal) ) { String title = "Overwrite registry URL?"; String msg = "Are you sure you want to change the registry URL from " + oldVal + " to " + newVal + "?"; MessageDialog dialog = new MessageDialog(shell, title, null, <START> msg, MessageDialog.CONFIRM, new String[] {"Cancel", "OK"} , 0); <END> String old = registryURLObservable.getValue().toString().trim(); if(old.isEmpty() || dialog.open() == 1 ) { registryURLObservable.setValue(ret.getMessage()); } } } else { String title = "Registry URL not found"; String msg = "No registry provider found for the given connection. If your Openshift connection is backed by a CDK or minishift installation, please ensure the CDK is running."; ErrorDialog ed = new ErrorDialog(shell, title, msg, ret, IStatus.ERROR | IStatus.WARNING | IStatus.INFO | IStatus.CANCEL); ed.open(); } }</code><technical_language>this leads a dialog order of "OK" "Cancel" inversed (most dialogs in Eclipse order 1. Cancel 2.OK): ![image](<LINK_0></technical_language>

Target:
private void discoverRegistryPressed(Shell shell) { IConnection tmp = pageModel.createConnection(); IStatus ret = RegistryProviderModel.getDefault().getRegistryURL(tmp); String oldVal = (String)registryURLObservable.getValue(); String newVal = ret.getMessage(); if( ret != null && ret.isOK()) { if( !eq(oldVal, newVal) ) { String title = "Overwrite registry URL?"; String msg = "Are you sure you want to change the registry URL from " + oldVal + " to " + newVal + "?"; MessageDialog dialog = new MessageDialog(shell, title, null, msg, MessageDialog.CONFIRM, new String[] {"OK", "Cancel"}, 0); String old = registryURLObservable.getValue().toString().trim(); if(old.isEmpty() || dialog.open() == IDialogConstants.OK_ID ) { registryURLObservable.setValue(ret.getMessage()); } } } else { String title = "Registry URL not found"; String msg = "No registry provider found for the given connection. If your Openshift connection is backed by a CDK or minishift installation, please ensure the CDK is running."; ErrorDialog ed = new ErrorDialog(shell, title, msg, ret, IStatus.ERROR | IStatus.WARNING | IStatus.INFO | IStatus.CANCEL); ed.open(); } }
Source:
<code><START> public void should_checkMethodAccessibility_warn_user_when_method_is_deprecated() throws Throwable { <END> final Method callMe = MyObjectImpl.class.getDeclaredMethod("callMe"); serverAPIImpl.checkMethodAccessibility(new MyObjectImpl(), MyObject.class.getName(), callMe, null, true); verify(technicalLoggerService).log( ServerAPIImpl.class, TechnicalLogSeverity.WARNING, "The API method " + this.getClass().getName() + "$MyObject.callMe is deprecated. It will no longer exists in future major release. Check the javadoc to know how to replace it."); }</code><technical_language>test if method is deprecated log issued</technical_language>

Target:
public void should_checkMethodAccessibility_warn_user_when_method_is_deprecated() throws Throwable { final Method callMe = MyObjectImpl.class.getDeclaredMethod("callMeOld"); serverAPIImpl.checkMethodAccessibility(new MyObjectImpl(), MyObject.class.getName(), callMe, null, true); verify(technicalLoggerService).log( ServerAPIImpl.class, TechnicalLogSeverity.WARNING, "The API method " + this.getClass().getName() + "$MyObject.callMeOld is deprecated. It will be deleted in a future release. Please plan to update your code to use the replacement method instead. Check the Javadoc for more details."); }
Source:
<code>protected String inferUrl() { <START> return inferUrl(); <END> }</code><technical_language>Infinite loop</technical_language>

Target:
protected String inferUrl() { return inferUrl(false); }
Source:
<code>public void run() { if (isTimedOut()) { reportFuture.completeExceptionally( new InfrastructureException( <START> String.format("Server '%s' in '%s' is not available.", serverRef, machineName))); <END> } else if (isAvailable()) { currentNumberOfSequentialSuccessfulPings++; if (currentNumberOfSequentialSuccessfulPings == successThreshold) { reportFuture.complete(serverRef); } else { timer.schedule(new ServerCheckingTask(currentNumberOfSequentialSuccessfulPings), period); } } else { timer.schedule(new ServerCheckingTask(0), period); } }</code><technical_language>replacing "machine" "container"? This change hard understand message</technical_language>

Target:
public void run() { if (isTimedOut()) { reportFuture.completeExceptionally( new InfrastructureException( String.format( "Server '%s' in container '%s' not available.", serverRef, machineName))); } else if (isAvailable()) { currentNumberOfSequentialSuccessfulPings++; if (currentNumberOfSequentialSuccessfulPings == successThreshold) { reportFuture.complete(serverRef); } else { timer.schedule(new ServerCheckingTask(currentNumberOfSequentialSuccessfulPings), period); } } else { timer.schedule(new ServerCheckingTask(0), period); } }
Source:
<code>public SanctumOfShatteredHeights(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.SHRINE); <START> Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(new PermanentsOnBattlefieldCount(filter)), new ManaCostsImpl("{1}")); <END> ability.addCost(new DiscardTargetCost(new TargetCardInHand(filter1))); this.addAbility(ability); }</code><technical_language>need zone in constructor important, need set text autogenerate correctly</technical_language>

Target:
public SanctumOfShatteredHeights(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.SHRINE); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(new PermanentsOnBattlefieldCount(new FilterControlledPermanent(SubType.SHRINE))) .setText("Sanctum of Shattered Heights deals X damage to target creature or planeswalker, where X is the number of Shrines you control"), new ManaCostsImpl("{1}")); ability.addCost(new DiscardTargetCost(new TargetCardInHand(filter))); this.addAbility(ability); }
Source:
<code>public GroupingSetDescriptor( @JsonProperty("groupingKeys") List<VariableReferenceExpression> groupingKeys, @JsonProperty("groupingSetCount") int groupingSetCount, @JsonProperty("globalGroupingSets") Set<Integer> globalGroupingSets) { requireNonNull(globalGroupingSets, "globalGroupingSets is null"); checkArgument(globalGroupingSets.size() <= groupingSetCount, "list of empty global grouping sets must be no larger than grouping set count"); requireNonNull(groupingKeys, "groupingKeys is null"); if (groupingKeys.isEmpty()) { checkArgument(!globalGroupingSets.isEmpty(), "no grouping keys implies at least one global grouping set, but none provided"); } this.groupingKeys = unmodifiableList(new ArrayList<>(groupingKeys)); this.groupingSetCount = groupingSetCount; <START> this.globalGroupingSets = unmodifiableSet(new HashSet<>(globalGroupingSets)); <END> }</code><technical_language>Same, order</technical_language>

Target:
public GroupingSetDescriptor( @JsonProperty("groupingKeys") List<VariableReferenceExpression> groupingKeys, @JsonProperty("groupingSetCount") int groupingSetCount, @JsonProperty("globalGroupingSets") Set<Integer> globalGroupingSets) { requireNonNull(globalGroupingSets, "globalGroupingSets is null"); checkArgument(globalGroupingSets.size() <= groupingSetCount, "list of empty global grouping sets must be no larger than grouping set count"); requireNonNull(groupingKeys, "groupingKeys is null"); if (groupingKeys.isEmpty()) { checkArgument(!globalGroupingSets.isEmpty(), "no grouping keys implies at least one global grouping set, but none provided"); } this.groupingKeys = unmodifiableList(new ArrayList<>(groupingKeys)); this.groupingSetCount = groupingSetCount; this.globalGroupingSets = unmodifiableSet(new LinkedHashSet<>(globalGroupingSets)); }
Source:
<code>public CorfuTablePerformanceTest() { seed = Long.parseLong(PROPERTIES.getProperty("tableSeed", "1024")); randomBoundary = Integer.parseInt(PROPERTIES.getProperty("tableRandomBoundary","10")); time = Long.parseLong(PROPERTIES.getProperty("tableTime", "100")); keyNum = Integer.parseInt(PROPERTIES.getProperty("keyNum", "10")); valueSize = Integer.parseInt(PROPERTIES.getProperty("valueSize", "1024")); random = new Random(seed); <START> keyValueManager = new org.corfudb.performancetest.KeyValueManager(keyNum, valueSize); <END> }</code><technical_language>![Codacy](<LINK_0> Issue found: [Unnecessary of fully qualified name 'org.corfudb.performancetest.KeyValueManager' due existing package import 'org.corfudb.performancetest.*'](<LINK_1></technical_language>

Target:
public CorfuTablePerformanceTest() { final long seed = Long.parseLong(PROPERTIES.getProperty("tableSeed", "1024")); randomBoundary = Integer.parseInt(PROPERTIES.getProperty("tableRandomBoundary","10")); time = Long.parseLong(PROPERTIES.getProperty("tableTime", "100")); final int keyNum = Integer.parseInt(PROPERTIES.getProperty("keyNum", "10")); final int valueSize = Integer.parseInt(PROPERTIES.getProperty("valueSize", "1024")); random = new Random(seed); keyValueManager = new KeyValueManager(keyNum, valueSize); }
Source:
<code>public static void setOverrideFileName(String... path) { fOverridePath = <START> (path == null) ? null : path; <END> fOverride = true; }</code><technical_language>path</technical_language>

Target:
public static void setOverrideFileName(String... path) { fOverridePath = path; fOverride = true; }
Source:
<code>public String getAnswerHtml(FeedbackQuestionDetails questionDetails) { FeedbackRubricQuestionDetails fqd = (FeedbackRubricQuestionDetails) questionDetails; StringBuilder html = new StringBuilder(); for (int i = 0; i < answer.size(); i++) { int chosenIndex = answer.get(i); String chosenChoice = ""; if (chosenIndex == -1) { chosenChoice = "<span class=\"color_neutral\"><i>" + Const.INSTRUCTOR_FEEDBACK_RESULTS_MISSING_RESPONSE + "</i></span>"; html.append(StringHelper.integerToLowerCaseAlphabeticalIndex(i + 1)).append(") ") .append(chosenChoice).append("<br>"); } else { chosenChoice = Sanitizer.sanitizeForHtml(fqd.rubricChoices.get(answer.get(i))); html.append(StringHelper.integerToLowerCaseAlphabeticalIndex(i + 1)).append(") ").append(chosenChoice) .append(" <span class=\"color_neutral\"><i>(Choice ").append(chosenIndex + 1) .append(")</i></span><br>"); } } <START> return html.toString(); <END> }</code><technical_language>~~Again, variable html.~~ resolved</technical_language>

Target:
public String getAnswerHtml(FeedbackQuestionDetails questionDetails) { FeedbackRubricQuestionDetails fqd = (FeedbackRubricQuestionDetails) questionDetails; StringBuilder html = new StringBuilder(100); for (int i = 0; i < answer.size(); i++) { int chosenIndex = answer.get(i); String chosenChoice = ""; if (chosenIndex == -1) { chosenChoice = "<span class=\"color_neutral\"><i>" + Const.INSTRUCTOR_FEEDBACK_RESULTS_MISSING_RESPONSE + "</i></span>"; html.append(StringHelper.integerToLowerCaseAlphabeticalIndex(i + 1) + ") " + chosenChoice + "<br>"); } else { chosenChoice = Sanitizer.sanitizeForHtml(fqd.rubricChoices.get(answer.get(i))); html.append(StringHelper.integerToLowerCaseAlphabeticalIndex(i + 1) + ") " + chosenChoice + " <span class=\"color_neutral\"><i>(Choice " + (chosenIndex + 1) + ")</i></span><br>"); } } return html.toString(); }
Source:
<code>public DocumentModel run(DocumentModel doc) throws OperationException { Property property = doc.getProperty(xpath); if (!property.isList()) { <START> throw new OperationException("Property type is not supported by this operation"); <END> } ListType listType = (ListType) property.getType(); if (listType.isArray()) { removeItemFromArrayProperty(doc, property); } else { removeItemFromListProperty(property); } doc = session.saveDocument(doc); if (save) { session.save(); } return doc; }</code><technical_language>add xpath property type message, wdyt</technical_language>

Target:
public DocumentModel run(DocumentModel doc) throws OperationException { Property property = doc.getProperty(xpath); if (!property.isList()) { throw new OperationException(String.format("Property: %s of type: %s is not supported by this operation", xpath, property.getType().getName())); } ListType listType = (ListType) property.getType(); if (listType.isArray()) { removeItemFromArrayProperty(doc, property); } else { removeItemFromListProperty(property); } doc = session.saveDocument(doc); if (save) { session.save(); } return doc; }
Source:
<code>public Document getSelectedRecord(String opac, String identifier) throws IOException, NotFoundException, SAXException, ParserConfigurationException { importModule = initializeImportModule(); DataRecord dataRecord = importModule.getFullRecordById(opac, identifier); if (Objects.isNull(dataRecord)) { throw new NotFoundException("Record with ID '" + identifier + "' not found in OPAC '" + opac + "'!"); } List<SchemaConverterInterface> converters = getSchemaConverters(dataRecord); <START> if (converters.isEmpty()) { <END> throw new UnsupportedFormatException("No SchemaConverter found that supports '" + dataRecord.getMetadataFormat() + "' and '" + dataRecord.getFileFormat() + "'!"); } DataRecord resultRecord = converters.get(0).convert(dataRecord, MetadataFormat.KITODO, FileFormat.XML); if (resultRecord.getOriginalData() instanceof String) { return XMLUtils.parseXMLString((String) resultRecord.getOriginalData()); } else { throw new UnknownFormatConversionException("Result data is not a String!"); } }</code><technical_language>Please put this check in getSchemaConverters I prefer method called getSchemaConverter return a single converter</technical_language>

Target:
public Document getSelectedRecord(String opac, String identifier) throws IOException, SAXException, ParserConfigurationException, URISyntaxException, NoRecordFoundException, UnsupportedFormatException { importModule = initializeImportModule(); DataRecord dataRecord = importModule.getFullRecordById(opac, identifier); SchemaConverterInterface converter = getSchemaConverter(dataRecord); URI xsltFile = Paths.get(ConfigCore.getParameter(ParameterCore.DIR_XSLT)).toUri() .resolve(new URI(OPACConfig.getXsltMappingFile(opac))); DataRecord resultRecord = converter.convert(dataRecord, MetadataFormat.KITODO, FileFormat.XML, ServiceManager.getFileService().getFile(xsltFile)); if (resultRecord.getOriginalData() instanceof String) { return XMLUtils.parseXMLString((String) resultRecord.getOriginalData()); } else { throw new UnknownFormatConversionException("Result data is not a String!"); } }
Source:
<code><START> public void visitBinaryExpression(BinaryExpressionTree tree) { <END> if (tree.is(CONDITIONAL_AND, CONDITIONAL_OR)) { ExpressionTree leftChild = removeParenthesis(tree.leftOperand()); ExpressionTree rightChild = removeParenthesis(tree.rightOperand()); boolean leftChildOfSameKind = leftChild.is(tree.getKind()); boolean rightChildOfSameKind = rightChild.is(tree.getKind()); if (rightChildOfSameKind) { logicalOperationsToIgnore.add(rightChild); } if (!logicalOperationsToIgnore.contains(tree) && !leftChildOfSameKind) { complexity.addComplexityWithoutNesting(tree.operator()); } } super.visitBinaryExpression(tree); }</code><technical_language>I suggest flatten BinaryExpressionTree in a list of operators reproduces original syntax : [AND,OR,AND] list calculate complexity scanning left right. algorithm flatten : list = new_empty_list i = 0 flatten(i, list, tree) function flatten(i, list, tree) list.add(i,tree) flatten(i, list, tree.left) flatten(++i, list, tree.right) end_function</technical_language>

Target:
public void visitBinaryExpression(BinaryExpressionTree tree) { if (tree.is(CONDITIONAL_AND, CONDITIONAL_OR) && !nestedLogicalExpressions.contains(tree)) { List<SyntaxToken> flatOperators = new ArrayList<>(); flattenLogicalExpression(0, flatOperators, tree); complexity.addComplexityWithoutNesting(flatOperators.get(0)); for (int i = 1; i < flatOperators.size(); i++) { if (!flatOperators.get(i).text().equals(flatOperators.get(i - 1).text())) { complexity.addComplexityWithoutNesting(flatOperators.get(i)); } } } super.visitBinaryExpression(tree); }
Source:
<code>public boolean nextKeyValue() throws IOException, InterruptedException { while (true) { if (pos_ > end_) { reader_.markNoMoreNewBlocks(); } value_.set(null); errorTracker.incRecords(); Throwable decodeException = null; try { if (!reader_.readNext(value_)) { return false; } } catch (IOException e) { throw e; } catch (Throwable e) { decodeException = e; } <START> recordsReadCounter.increment(1); <END> key_.set(pos_); pos_ = getLzoFilePos(); if (value_.get() != null) { return true; } errorTracker.incErrors(decodeException); recordErrorsCounter.increment(1); } }</code><technical_language>increment for successful reads</technical_language>

Target:
public boolean nextKeyValue() throws IOException, InterruptedException { while (true) { if (pos_ > end_) { reader_.markNoMoreNewBlocks(); } value_.set(null); errorTracker.incRecords(); Throwable decodeException = null; try { if (!reader_.readNext(value_)) { return false; } } catch (IOException e) { throw e; } catch (Throwable e) { decodeException = e; } key_.set(pos_); pos_ = getLzoFilePos(); if (value_.get() != null) { recordsReadCounter.increment(1); return true; } errorTracker.incErrors(decodeException); recordErrorsCounter.increment(1); } }
Source:
<code>public PatientData<Object> readJSON(JSONObject json) { Map<String, Object> result = new LinkedHashMap<>(); List<String> allergiesList = new LinkedList<>(); <START> Boolean nkda = Boolean.FALSE; <END> if (json.has(ALLERGIES)) { Object allergiesValue = json.get(ALLERGIES); if (allergiesValue instanceof JSONArray) { JSONArray allergiesJsonArray = (JSONArray) allergiesValue; @SuppressWarnings("unchecked") Iterator<String> iterator = allergiesJsonArray.iterator(); while (iterator.hasNext()) { allergiesList.add(iterator.next()); } nkda = Boolean.FALSE; } else if (allergiesValue instanceof String) { String allergiesString = (String) allergiesValue; if (NKDA.equals(allergiesString)) { nkda = Boolean.TRUE; } } } result.put(NKDA, nkda); result.put(ALLERGIES, allergiesList); return new DictionaryPatientData<>(DATA_NAME, result); }</code><technical_language>Boolean, primitive type boolean, java autobox Boolean a function requires it</technical_language>

Target:
public PatientData<Object> readJSON(JSONObject json) { Map<String, Object> result = new LinkedHashMap<>(); List<String> allergiesList = new LinkedList<>(); boolean nkda = false; if (json.has(ALLERGIES)) { Object allergiesValue = json.get(ALLERGIES); if (allergiesValue instanceof JSONArray) { JSONArray allergiesJsonArray = (JSONArray) allergiesValue; for (Object o : allergiesJsonArray) { String allergy = (String) o; if (NKDA.equalsIgnoreCase(allergy)) { nkda = true; } else { allergiesList.add(allergy); } } } } result.put(NKDA, nkda); result.put(ALLERGIES, allergiesList); return new DictionaryPatientData<>(DATA_NAME, result); }
Source:
<code>public List<InsightCard> getInsights(@Scope(OAuthScope.INSIGHTS_READ) final AccessToken accessToken) { LOGGER.debug("Returning list of insights for account id = {}", accessToken.accountId); final Boolean chronological = false; final DateTime queryDate = DateTime.now(DateTimeZone.UTC).plusDays(1); final ImmutableList<InsightCard> cards = insightsDAODynamoDB.getInsightsByDate(accessToken.accountId, queryDate, chronological, MAX_INSIGHTS_NUM); if (cards.size() == 0) { final Optional<Account> optionalAccount = accountDAO.getById(accessToken.accountId); int userAgeInYears = 0; if (optionalAccount.isPresent()) { userAgeInYears = DateTimeUtil.getDateDiffFromNowInDays(optionalAccount.get().DOB) / 365; } final List<InsightCard> introCards = IntroductionInsights.getIntroCards(accessToken.accountId, userAgeInYears); this.insightsDAODynamoDB.insertListOfInsights(introCards); return introCards; } else { final List<InsightCard> cardsWithPreview = new ArrayList<>(); for (InsightCard card : cards) { <START> cardsWithPreview.add(card.withInfoPreview(insightProcessor.getInsightPreviewForCategory(card.category).orNull())); <END> } return cardsWithPreview; } }</code><technical_language>add orNull please</technical_language>

Target:
public List<InsightCard> getInsights(@Scope(OAuthScope.INSIGHTS_READ) final AccessToken accessToken) { LOGGER.debug("Returning list of insights for account id = {}", accessToken.accountId); final Boolean chronological = false; final DateTime queryDate = DateTime.now(DateTimeZone.UTC).plusDays(1); final ImmutableList<InsightCard> cards = insightsDAODynamoDB.getInsightsByDate(accessToken.accountId, queryDate, chronological, MAX_INSIGHTS_NUM); if (cards.size() == 0) { final Optional<Account> optionalAccount = accountDAO.getById(accessToken.accountId); int userAgeInYears = 0; if (optionalAccount.isPresent()) { userAgeInYears = DateTimeUtil.getDateDiffFromNowInDays(optionalAccount.get().DOB) / 365; } final List<InsightCard> introCards = IntroductionInsights.getIntroCards(accessToken.accountId, userAgeInYears); this.insightsDAODynamoDB.insertListOfInsights(introCards); return introCards; } else { final List<InsightCard> cardsWithPreview = new ArrayList<>(); for (InsightCard card : cards) { cardsWithPreview.add(card.withInfoPreview(insightProcessor.getInsightPreviewForCategory(card.category))); } return cardsWithPreview; } }
Source:
<code>public static String getSpectralType(Integer spectralClass, Double subtype, String luminosity) { if( null == spectralClass || null == subtype ) { return null; } if(spectralClass == PlanetarySystem.SPECTRAL_Q) { return (null != luminosity) ? "Q" + luminosity : "Q"; } int subtypeValue = (int)Math.round(subtype * 100); if( subtypeValue < 0 ) { subtypeValue = 0; } if( subtypeValue > 999 ) { subtypeValue = 999; } String subtypeFormat = "%.2f"; if( subtypeValue % 100 == 0 ) { subtypeFormat = "%.0f"; } else if( subtypeValue % 10 == 0 ) { subtypeFormat = "%.1f"; } <START> if( luminosity.equals(PlanetarySystem.LUM_VI) ) { <END> return "sd" + getSpectralClassName(spectralClass) + String.format(subtypeFormat, subtypeValue / 100.0); } else if( luminosity.equals(PlanetarySystem.LUM_VI_PLUS) ) { return "esd" + getSpectralClassName(spectralClass) + String.format(subtypeFormat, subtypeValue / 100.0); } else if( luminosity.equals(PlanetarySystem.LUM_VII) ) { return String.format(Locale.ROOT, "D" + subtypeFormat, subtypeValue / 100.0); } else { return String.format(Locale.ROOT, "%s" + subtypeFormat + "%s", getSpectralClassName(spectralClass), subtypeValue / 100.0, (null != luminosity ? luminosity : PlanetarySystem.LUM_V)); } }</code><technical_language>luminosity null here</technical_language>

Target:
public static String getSpectralType(Integer spectralClass, Double subtype, String luminosity) { if( null == spectralClass || null == subtype ) { return null; } if(spectralClass == PlanetarySystem.SPECTRAL_Q) { return (null != luminosity) ? "Q" + luminosity : "Q"; } int subtypeValue = (int)Math.round(subtype * 100); if( subtypeValue < 0 ) { subtypeValue = 0; } if( subtypeValue > 999 ) { subtypeValue = 999; } String subtypeFormat = "%.2f"; if( subtypeValue % 100 == 0 ) { subtypeFormat = "%.0f"; } else if( subtypeValue % 10 == 0 ) { subtypeFormat = "%.1f"; } if( null != luminosity && luminosity.equals(PlanetarySystem.LUM_VI) ) { return "sd" + getSpectralClassName(spectralClass) + String.format(subtypeFormat, subtypeValue / 100.0); } else if( null != luminosity && luminosity.equals(PlanetarySystem.LUM_VI_PLUS) ) { return "esd" + getSpectralClassName(spectralClass) + String.format(subtypeFormat, subtypeValue / 100.0); } else if( null != luminosity && luminosity.equals(PlanetarySystem.LUM_VII) ) { return String.format(Locale.ROOT, "D" + subtypeFormat, subtypeValue / 100.0); } else { return String.format(Locale.ROOT, "%s" + subtypeFormat + "%s", getSpectralClassName(spectralClass), subtypeValue / 100.0, (null != luminosity ? luminosity : PlanetarySystem.LUM_V)); } }
Source:
<code>private Packet rewritePacket(final Packet packetIn) { <START> Packet packetOut = packetIn; <END> if (packetIn instanceof S38PacketPlayerListItem) { ((SpongeTabList) ((Player) this.playerEntity).getTabList()).updateEntriesOnSend((S38PacketPlayerListItem) packetIn); } else if (packetIn instanceof IMixinPacketResourcePackSend) { IMixinPacketResourcePackSend packet = (IMixinPacketResourcePackSend) packetIn; this.sentResourcePacks.put(packet.setFakeHash(), packet.getResourcePack()); } return packetOut; }</code><technical_language>inspection says, is this variable for? packetIn</technical_language>

Target:
private Packet rewritePacket(final Packet packetIn) { if (packetIn instanceof S38PacketPlayerListItem) { ((SpongeTabList) ((Player) this.playerEntity).getTabList()).updateEntriesOnSend((S38PacketPlayerListItem) packetIn); } else if (packetIn instanceof IMixinPacketResourcePackSend) { IMixinPacketResourcePackSend packet = (IMixinPacketResourcePackSend) packetIn; this.sentResourcePacks.put(packet.setFakeHash(), packet.getResourcePack()); } return packetIn; }