auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void setup(Binder binder) { newSetBinder(binder, Filter.class, TheServlet.class).addBinding() <START> .to(AuthenticationFilter.class).in(Scopes.SINGLETON); <END> List<AuthenticationType> authTypes = buildConfigObject(SecurityConfig.class).getAuthenticationTypes(); MapBinder<AuthenticationType, Authenticator> authBinder = newMapBinder(binder, AuthenticationType.class, Authenticator.class); if (authTypes.contains(CERTIFICATE)) { authBinder.addBinding(CERTIFICATE).to(CertificateAuthenticator.class).in(Scopes.SINGLETON); } if (authTypes.contains(KERBEROS)) { configBinder(binder).bindConfig(KerberosConfig.class); authBinder.addBinding(KERBEROS).to(KerberosAuthenticator.class).in(Scopes.SINGLETON); } if (authTypes.contains(LDAP)) { configBinder(binder).bindConfig(LdapConfig.class); authBinder.addBinding(LDAP).to(LdapAuthenticator.class).in(Scopes.SINGLETON); } binder.bind(new TypeLiteral<List<AuthenticationType>>() {}).toInstance(authTypes); }</code><technical_language>This is a bit complicated. change this bind authenticators in order, need separate list binding: java for (AuthenticationType authType : authTypes) { if (authType == CERTIFICATE) { bind ... } else if (authType == ...) { ... } } @Provides List<Authenticator> getAuthenticatorList(Set<Authenticator> authenticators) { return ImmutableList.copyOf(authenticators.values()); } Multibinder Set is guaranteed in binding order</technical_language>

Target:
protected void setup(Binder binder) { newSetBinder(binder, Filter.class, TheServlet.class).addBinding() .to(AuthenticationFilter.class).in(Scopes.SINGLETON); List<AuthenticationType> authTypes = buildConfigObject(SecurityConfig.class).getAuthenticationTypes(); Multibinder<Authenticator> authBinder = newSetBinder(binder, Authenticator.class); for (AuthenticationType authType : authTypes) { if (authType == CERTIFICATE) { authBinder.addBinding().to(CertificateAuthenticator.class).in(Scopes.SINGLETON); } if (authType == KERBEROS) { configBinder(binder).bindConfig(KerberosConfig.class); authBinder.addBinding().to(KerberosAuthenticator.class).in(Scopes.SINGLETON); } if (authType == LDAP) { configBinder(binder).bindConfig(LdapConfig.class); authBinder.addBinding().to(LdapAuthenticator.class).in(Scopes.SINGLETON); } } }
Source:
<code>void assertChildrenIntegrity(AbstractHistoryTree<E, N> tree, N node) { try { if (node.getNbChildren() > 0) { N childNode = tree.getNode(node.getChild(0)); assertEquals("Equals start time of parent " + node.getSequenceNumber() + " and first child " + childNode.getSequenceNumber(), node.getNodeStart(), childNode.getNodeStart()); if (node.isOnDisk()) { childNode = tree.getNode(node.getLatestChild()); assertEquals("Equals end time of parent " + node.getSequenceNumber() + " and last child " + childNode.getSequenceNumber(), node.getNodeEnd(), childNode.getNodeEnd()); } } for (int i = 0; i < node.getNbChildren(); i++) { N childNode = tree.getNode(node.getChild(i)); assertTrue("Child at index " + i + " of parent " + node.getSequenceNumber() + " has valid start time", node.getNodeStart() <= childNode.getNodeStart()); if (node.isOnDisk() && childNode.isOnDisk()) { assertTrue("Child at index " + i + " of parent " + node.getSequenceNumber() + " has valid end time", childNode.getNodeEnd() <= node.getNodeEnd()); } assertTrue(tree.verifyChildrenSpecific(node, i, childNode)); <START> assertTrue(tree.verifyIntersectingChildren(node, childNode)); <END> } } catch (ClosedChannelException e) { fail(e.getMessage()); } }</code><technical_language>in unit tests This is in unit test plugin(?) do mean, "can in HT stub classes?". I too, problem is stub classes extend another, extend respective runtime class (e.g. OverlappingTreeStub extends OverlappingTree, HistoryTreeStub). define methods in a base HistoryTreeStub sub-stubs them. I in a util bad. a fan of assert*() calls of -Test classes in general, good enough</technical_language>

Target:
void assertChildrenIntegrity(AbstractHistoryTree<E, N> tree, N node) { try { if (node.getNbChildren() > 0) { N childNode = tree.getNode(node.getChild(0)); assertEquals("Equals start time of parent " + node.getSequenceNumber() + " and first child " + childNode.getSequenceNumber(), node.getNodeStart(), childNode.getNodeStart()); if (node.isOnDisk()) { childNode = tree.getNode(node.getLatestChild()); assertEquals("Equals end time of parent " + node.getSequenceNumber() + " and last child " + childNode.getSequenceNumber(), node.getNodeEnd(), childNode.getNodeEnd()); } } for (int i = 0; i < node.getNbChildren(); i++) { N childNode = tree.getNode(node.getChild(i)); assertTrue("Child at index " + i + " of parent " + node.getSequenceNumber() + " has valid start time", node.getNodeStart() <= childNode.getNodeStart()); if (node.isOnDisk() && childNode.isOnDisk()) { assertTrue("Child at index " + i + " of parent " + node.getSequenceNumber() + " has valid end time", childNode.getNodeEnd() <= node.getNodeEnd()); } assertTrue("Child at index " + i + " of parent " + node.getSequenceNumber() + " specific children", tree.verifyChildrenSpecific(node, i, childNode)); assertTrue("Child at index " + i + " of parent " + node.getSequenceNumber() + " intersecting children", tree.verifyIntersectingChildren(node, childNode)); } } catch (ClosedChannelException e) { fail(e.getMessage()); } }
Source:
<code>public double getSystemWideCpuUsage() { try { if (operatingSystemMXBean != null) { <START> return operatingSystemMXBean.getSystemCpuLoad(); <END> } return Double.NaN; } catch (Throwable t) { logger.error("Failed to get System CPU", t); return Double.NaN; } }</code><technical_language>Negative mapped Double.NaN</technical_language>

Target:
public double getSystemWideCpuUsage() { try { if (operatingSystemMXBean != null) { double val = operatingSystemMXBean.getSystemCpuLoad(); if (val > 0) { return val; } } return Double.NaN; } catch (Throwable t) { logger.error("Failed to get System CPU", t); return Double.NaN; } }
Source:
<code>public MethodConstraintMappingContext method(String name, Class<?>... parameterTypes) { Contracts.assertNotNull( name, MESSAGES.methodNameMustNotBeNull() ); Method method = run( GetDeclaredMethod.action( beanClass, name, parameterTypes ) ); if ( method == null || method.getDeclaringClass() != beanClass ) { throw LOG.getBeanDoesNotContainMethodException( beanClass, name, Arrays.asList( parameterTypes ) ); } Callable callable = JavaBeanExecutable.of( method ); if ( configuredMembers.contains( callable ) ) { <START> throw LOG.getMethodHasAlreadyBeConfiguredViaProgrammaticApiException( <END> beanClass, ExecutableHelper.getExecutableAsString( name, parameterTypes ) ); } MethodConstraintMappingContextImpl context = new MethodConstraintMappingContextImpl( this, callable ); configuredMembers.add( callable ); executableContexts.add( context ); return context; }</code><technical_language>Unrelated patch while it, fix s/Be/Been/. done in commit change line above</technical_language>

Target:
public MethodConstraintMappingContext method(String name, Class<?>... parameterTypes) { Contracts.assertNotNull( name, MESSAGES.methodNameMustNotBeNull() ); Optional<Callable> method = javaBean.getCallableByNameAndParameters( name, parameterTypes ); if ( !method.isPresent() || method.get().getDeclaringClass() != beanClass ) { throw LOG.getBeanDoesNotContainMethodException( javaBean, name, parameterTypes ); } Callable callable = method.get(); if ( configuredMembers.contains( callable ) ) { throw LOG.getMethodHasAlreadyBeenConfiguredViaProgrammaticApiException( beanClass, ExecutableHelper.getExecutableAsString( name, parameterTypes ) ); } MethodConstraintMappingContextImpl context = new MethodConstraintMappingContextImpl( this, callable ); configuredMembers.add( callable ); executableContexts.add( context ); return context; }
Source:
<code>public void connectSensors() { super.connectSensors(); ConfigToAttributes.apply(this); String accessibleRootUrl = inferUrl(true); httpFeed = HttpFeed.builder() .entity(this) .period(getConfig(HTTP_POLL_PERIOD)) .baseUri(accessibleRootUrl) .baseUriVars(ImmutableMap.of("include-runtime", "true")) .poll(new HttpPollConfig<Boolean>(NGINX_URL_ANSWERS_NICELY) .checkSuccess(Predicates.alwaysTrue()) .onResult(new Function<HttpToolResponse, Boolean>() { @Override public Boolean apply(HttpToolResponse input) { List<String> actual = input.getHeaderLists().get("Server"); return actual != null && actual.size() == 1; }}) .setOnException(false)) .build(); addEnricher(Enrichers.builder().updatingMap(Attributes.SERVICE_NOT_UP_INDICATORS) .from(NGINX_URL_ANSWERS_NICELY) <START> .computing(Functionals.ifNotEquals(true).value("URL where nginx listens is not answering correctly") ) <END> .build()); connectServiceUpIsRunning(); Group urlMappings = getConfig(URL_MAPPINGS); if (urlMappings != null) { subscribeToMembers(urlMappings, UrlMapping.TARGET_ADDRESSES, new SensorEventListener<Collection<String>>() { @Override public void onEvent(SensorEvent<Collection<String>> event) { updateNeeded(); } }); urlMappingsMemberTrackerPolicy = addPolicy(PolicySpec.create(UrlMappingsMemberTrackerPolicy.class) .configure("group", urlMappings)); } }</code><technical_language>indication of 'correctly' means useful debugging</technical_language>

Target:
public void connectSensors() { super.connectSensors(); ConfigToAttributes.apply(this); String accessibleRootUrl = inferUrl(true); httpFeed = HttpFeed.builder() .entity(this) .period(getConfig(HTTP_POLL_PERIOD)) .baseUri(accessibleRootUrl) .baseUriVars(ImmutableMap.of("include-runtime", "true")) .poll(new HttpPollConfig<Boolean>(NGINX_URL_ANSWERS_NICELY) .checkSuccess(Predicates.alwaysTrue()) .onResult(new Function<HttpToolResponse, Boolean>() { @Override public Boolean apply(HttpToolResponse input) { List<String> actual = input.getHeaderLists().get("Server"); return actual != null && actual.size() == 1; }}) .setOnException(false)) .build(); addEnricher(Enrichers.builder().updatingMap(Attributes.SERVICE_NOT_UP_INDICATORS) .from(NGINX_URL_ANSWERS_NICELY) .computing(Functionals.ifNotEquals(true).value("URL where nginx listens is not answering correctly (with expected header)") ) .build()); connectServiceUpIsRunning(); Group urlMappings = getConfig(URL_MAPPINGS); if (urlMappings != null) { subscribeToMembers(urlMappings, UrlMapping.TARGET_ADDRESSES, new SensorEventListener<Collection<String>>() { @Override public void onEvent(SensorEvent<Collection<String>> event) { updateNeeded(); } }); urlMappingsMemberTrackerPolicy = addPolicy(PolicySpec.create(UrlMappingsMemberTrackerPolicy.class) .configure("group", urlMappings)); } }
Source:
<code>private void setOverlayPlayPauseImage() { <START> boolean playing = player != null && player.getPlayer().getPlayWhenReady(); int attr = playing ? R.attr.pause : R.attr.play; overlayPlayPauseButton.setImageResource(ThemeHelper.resolveResourceIdFromAttr(activity, attr)); <END> }</code><technical_language>expression here, do create variables</technical_language>

Target:
private void setOverlayPlayPauseImage() { final int attr = player != null && player.isPlaying() ? R.attr.ic_pause : R.attr.ic_play_arrow; overlayPlayPauseButton.setImageResource( ThemeHelper.resolveResourceIdFromAttr(activity, attr)); }
Source:
<code>public JSONObject changeLibraryIdBarcode(HttpSession session, JSONObject json) { Long libraryId = json.getLong("libraryId"); String idBarcode = json.getString("identificationBarcode"); try { <START> if (!"".equals(idBarcode)) { <END> Library library = requestManager.getLibraryById(libraryId); library.setIdentificationBarcode(idBarcode); requestManager.saveLibrary(library); } else { return JSONUtils.SimpleJSONError("New identification barcode not recognized"); } } catch (IOException e) { e.printStackTrace(); return JSONUtils.SimpleJSONError(e.getMessage()); } return JSONUtils.SimpleJSONResponse("New identification barcode successfully assigned."); }</code><technical_language>org.apache.commons.lang.StringUtils.isEmpty(String) is for null safe string checking</technical_language>

Target:
public JSONObject changeLibraryIdBarcode(HttpSession session, JSONObject json) { Long libraryId = json.getLong("libraryId"); String idBarcode = json.getString("identificationBarcode"); try { if (!isStringEmptyOrNull(idBarcode)) { Library library = requestManager.getLibraryById(libraryId); library.setIdentificationBarcode(idBarcode); requestManager.saveLibrary(library); } else { return JSONUtils.SimpleJSONError("New identification barcode not recognized"); } } catch (IOException e) { log.debug("Could not change Library identificationBarcode: " + e.getMessage()); e.printStackTrace(); return JSONUtils.SimpleJSONError(e.getMessage()); } return JSONUtils.SimpleJSONResponse("New identification barcode successfully assigned."); }
Source:
<code>public StreamExecLimit( long limitStart, <START> long limitEnd, <END> boolean generateUpdateBefore, boolean insertOnly, ExecEdge inputEdge, LogicalType outputType, String description) { super( RankType.ROW_NUMBER, getRankStrategy(insertOnly), new ConstantRankRange(limitStart + 1, limitEnd), generateUpdateBefore, false, new int[0], new int[0], new boolean[0], new boolean[0], inputEdge, outputType, description); }</code><technical_language>implements StreamExecNode<RowData> is unnecessary</technical_language>

Target:
public StreamExecLimit( long limitStart, long limitEnd, boolean generateUpdateBefore, boolean insertOnly, ExecEdge inputEdge, LogicalType outputType, String description) { super( RankType.ROW_NUMBER, getRankStrategy(insertOnly), new ConstantRankRange(limitStart + 1, limitEnd), generateUpdateBefore, false, new int[0], new int[0], new boolean[0], new boolean[0], inputEdge, outputType, description); this.limitEnd = limitEnd; }
Source:
<code>private Artifact resolveJLine(final VersionNumber scalaVersion, final Artifact defaultFallback) throws Exception { final Artifact compilerArtifact = super.scalaCompilerArtifact(scalaVersion.toString()); final Set<Artifact> compilerDeps = super.resolveArtifactDependencies(compilerArtifact); for (final Artifact a : compilerDeps) { super.getLog().warn(a.toString()); if (this.filterForJline(a)) { return a; } else { <START> continue; <END> } } super.getLog().warn("Unable to determine the required Jline dependency from the POM. Falling back to hard-coded defaults."); super.getLog().warn("If you get an InvocationTargetException, then this probably means we guessed the wrong version for JLine"); super.getLog().warn(String.format("Guessed JLine: %s", defaultFallback.toString())); return defaultFallback; }</code><technical_language>else clause removed</technical_language>

Target:
private Artifact resolveJLine(final VersionNumber scalaVersion, final Artifact defaultFallback) throws Exception { final Artifact compilerArtifact = super.scalaCompilerArtifact(scalaVersion.toString()); final Set<Artifact> compilerDeps = super.resolveArtifactDependencies(compilerArtifact); for (final Artifact a : compilerDeps) { super.getLog().warn(a.toString()); if (this.filterForJline(a)) { return a; } } super.getLog().warn("Unable to determine the required Jline dependency from the POM. Falling back to hard-coded defaults."); super.getLog().warn("If you get an InvocationTargetException, then this probably means we guessed the wrong version for JLine"); super.getLog().warn(String.format("Guessed JLine: %s", defaultFallback.toString())); return defaultFallback; }
Source:
<code><START> protected int delete(String urlS) throws IOException { <END> URL url = new URL(urlS); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded" ); conn.setRequestProperty("Authorization", "key=" + variant.getGoogleKey()); conn.setRequestMethod("DELETE"); conn.connect(); return conn.getResponseCode(); }</code><technical_language>do some handling of IO issues</technical_language>

Target:
private int delete(String urlS) throws IOException { URL url = new URL(urlS); HttpURLConnection conn = prepareAuthorizedConnection(url); conn.setRequestMethod("DELETE"); conn.connect(); return conn.getResponseCode(); }
Source:
<code>public JobProcessResult waitFor() throws InterruptedException { if (!launched.get()) { throw new IllegalStateException("Process not launched"); } final Process process = processReference.get(); int exitCode = 0; if (process != null) { exitCode = process.waitFor(); UserConsole.getLogger().info("Job process terminated with exit code: {}", exitCode); } try { Thread.sleep(100); } catch (final InterruptedException e) { } if (killed.get()) { return new JobProcessResult.Builder(JobStatus.KILLED, JobStatusMessages.JOB_KILLED_BY_USER).build(); } else if (exitCode == SUCCESS_EXIT_CODE) { return new JobProcessResult.Builder( JobStatus.SUCCEEDED, JobStatusMessages.JOB_FINISHED_SUCCESSFULLY ).build(); } else { <START> return new JobProcessResult.Builder(JobStatus.FAILED, JobStatusMessages.JOB_FAILED).build(); <END> } }</code><technical_language>this loses exit code. guessing want save it. (I put in final status message, users do special codes meaning people need know)</technical_language>

Target:
public JobProcessResult waitFor() throws InterruptedException { if (!this.launched.get()) { throw new IllegalStateException("Process not launched"); } final Process process = this.processReference.get(); int exitCode = 0; if (process != null) { exitCode = process.waitFor(); UserConsole.getLogger().info("Job process terminated with exit code: {}", exitCode); } try { Thread.sleep(100); } catch (final InterruptedException e) { } final ScheduledFuture timeoutThreadFuture = this.timeoutKillThread.get(); if (timeoutThreadFuture != null) { timeoutThreadFuture.cancel(true); } if (this.killed.get()) { final KillService.KillSource source = this.killSource.get() != null ? this.killSource.get() : KillService.KillSource.API_KILL_REQUEST; switch (source) { case TIMEOUT: return new JobProcessResult .Builder(JobStatus.KILLED, JobStatusMessages.JOB_EXCEEDED_TIMEOUT, exitCode) .build(); case API_KILL_REQUEST: case SYSTEM_SIGNAL: default: return new JobProcessResult .Builder(JobStatus.KILLED, JobStatusMessages.JOB_KILLED_BY_USER, exitCode) .build(); } } else if (exitCode == SUCCESS_EXIT_CODE) { return new JobProcessResult.Builder( JobStatus.SUCCEEDED, JobStatusMessages.JOB_FINISHED_SUCCESSFULLY, exitCode ).build(); } else { return new JobProcessResult.Builder(JobStatus.FAILED, JobStatusMessages.JOB_FAILED, exitCode).build(); } }
Source:
<code>public void updateConfig(EntityConfigUpdateCommand command, Username currentUser) { LOGGER.info("Config update for entity request by is in queue - {}", currentUser, command); synchronized (GoConfigWriteLock.class) { try { LOGGER.info("Config update for entity request by is being processed", currentUser); <START> if (!command.canContinue(cachedConfigService.currentConfig()) || !command.isUserAuthorized()) { <END> throw new ConfigUpdateCheckFailedException(); } cachedConfigService.writeEntityWithLock(command, currentUser); } catch (Exception e) { LOGGER.error("Config update for entity failed", e); throw e; } finally { LOGGER.info("Entity update for request by is completed", currentUser); } } }</code><technical_language>Do (cheaper) authorization check earlier</technical_language>

Target:
public void updateConfig(EntityConfigUpdateCommand command, Username currentUser) { LOGGER.info("Config update for entity request by is in queue - {}", currentUser, command); synchronized (GoConfigWriteLock.class) { try { LOGGER.info("Config update for entity request by is being processed", currentUser); if (!command.isUserAuthorized() || !command.canContinue(cachedConfigService.currentConfig())) { throw new ConfigUpdateCheckFailedException(); } cachedConfigService.writeEntityWithLock(command, currentUser); } catch (Exception e) { LOGGER.error("Config update for entity failed", e); throw e; } finally { LOGGER.info("Entity update for request by is completed", currentUser); } } }
Source:
<code>public int processLineContent(String line, int offset) { String key = matcher.group(1); if (key.endsWith("!")) { key = key.substring(0, key.length() - 1).trim(); ((AsciiDocContentState) getState()).removeAttribute(key); } else { String value <START> = matcher.group(2).trim(); <END> key = key.trim(); ((AsciiDocContentState) getState()).putAttribute(key, value); } setClosed(true); return -1; }</code><technical_language>chance group 2 null</technical_language>

Target:
public int processLineContent(String line, int offset) { if (key.endsWith("!")) { key = key.substring(0, key.length() - 1).trim(); ((AsciiDocContentState) getState()).removeAttribute(key); } else { String newKey = key.trim(); String newValue = (value == null) ? "" : value.trim(); ((AsciiDocContentState) getState()).putAttribute(newKey, newValue); } setClosed(true); return -1; }
Source:
<code>public final B withMinTermMatch(int minTermMatch) { <START> if (minTermMatch > 0) { <END> optionsBuilder.put(OptionKey.MIN_TERM_MATCH, minTermMatch); } return getSelf(); }</code><technical_language>Throw a BadRequestException if minTermMatch is equals 0</technical_language>

Target:
public final B withMinTermMatch(int minTermMatch) { if (minTermMatch <= 0) { throw new BadRequestException("Min number of terms to match should be greater than 0. It was: '%s'.", minTermMatch); } optionsBuilder.put(OptionKey.MIN_TERM_MATCH, minTermMatch); return getSelf(); }
Source:
<code>private void doUpdateTimeZone(final String selectedTimeZone) { TimeZoneModel.withLoadedTimeZones(getTimeZoneType(), new Runnable() { @Override public void run() { final Iterable<TimeZoneModel> timeZones = TimeZoneModel.getTimeZones(getTimeZoneType()); getModel().getTimeZone().setItems(timeZones); getModel().getTimeZone().setSelectedItem(Linq.firstOrDefault(timeZones, new Linq.TimeZonePredicate(selectedTimeZone))); <START> if (getModel().getIsLinuxOS()) { END> getModel().getTimeZone().setIsChangable(false); getModel().getTimeZone().setTitle(constants.timeZoneNotEditableForLinuxVms()); } else { getModel().getTimeZone().setIsChangable(true); getModel().getTimeZone().setTitle(""); } } }); }</code><technical_language>I replace this if-else ternary statements shorter. a matter of style - consider</technical_language>

Target:
private void doUpdateTimeZone(final String selectedTimeZone) { TimeZoneModel.withLoadedTimeZones(getTimeZoneType(), new Runnable() { @Override public void run() { final Iterable<TimeZoneModel> timeZones = TimeZoneModel.getTimeZones(getTimeZoneType()); getModel().getTimeZone().setItems(timeZones); getModel().getTimeZone().setSelectedItem(Linq.firstOrDefault(timeZones, new Linq.TimeZonePredicate(selectedTimeZone))); getModel().getTimeZone().setIsChangable(!getModel().getIsLinuxOS()); getModel().getTimeZone().setTitle(getModel().getIsLinuxOS() ? constants.timeZoneNotChangeableForLinuxVms() : ""); } }); }
Source:
<code>public int assignedTaskCount() { <START> return assignedTasks().size(); <END> }</code><technical_language>prop: assert active stand-by tasks disjunct, avoid compute union sum sizes of activeTasks standbyTasks</technical_language>

Target:
public int assignedTaskCount() { return activeTaskCount() + standbyTaskCount(); }
Source:
<code>private synchronized void removeServer(ServerInformation serverInformation, boolean externalize) { <START> final List<ServerInformation> userServers = _userPreferences.getUserServers(); <END> if (userServers.remove(serverInformation)) { for (ServerInformationChangeListener listener : _listeners) { listener.onRemove(serverInformation); } } if (externalize) { _configurationWriter.removeServerInformation(serverInformation.getName()); _userPreferences.save(); } }</code><technical_language>I this is coming ... origin a good source ;-) wanting get rid of "UserDatastores" etc. circumvent conf.xml. I want _always_ able offload this conf.xml. a reminiscence of days "xml is difficult, serialization is easier" ruled</technical_language>

Target:
private synchronized void removeServer(ServerInformation serverInformation, boolean externalize) { if (_updatedServerInformationList.remove(serverInformation)) { for (ServerInformationChangeListener listener : _listeners) { listener.onRemove(serverInformation); } } if (externalize) { _configurationWriter.removeServerInformation(serverInformation.getName()); } }
Source:
<code><START> public ServerToServerWithExternalIp(DimensionDataCloudControlApi api) { <END> this.api = checkNotNull(api, "api"); }</code><technical_language>Remove public modifier</technical_language>

Target:
ServerToServerWithExternalIp(DimensionDataCloudControlApi api) { this.api = checkNotNull(api, "api"); }
Source:
<code>public void populateDAG(DAG dag, Configuration configuration) { FileSplitterInput fileSplitter = dag.addOperator("FileSplitter", createFileSplitter()); FSRecordReader recordReader = dag.addOperator("BlockReader", createBlockReader()); dag.addStream("BlockMetadata", fileSplitter.blocksMetadataOutput, recordReader.blocksMetadataInput); if (sequentialFileRead) { dag.setInputPortAttribute(recordReader.blocksMetadataInput, Context.PortContext.STREAM_CODEC, new SequentialFileBlockMetadataCodec()); } FileSplitterInput.TimeBasedDirectoryScanner fileScanner = fileSplitter.getScanner(); fileScanner.setFiles(files); if (scanIntervalMillis != 0) { fileScanner.setScanIntervalMillis(scanIntervalMillis); } fileScanner.setRecursive(recursive); if (filePatternRegularExp != null) { fileSplitter.getScanner().setFilePatternRegularExp(filePatternRegularExp); } recordReader.setBasePath(files); if (readersCount != 0) { dag.setAttribute(recordReader, Context.OperatorContext.PARTITIONER, new StatelessPartitioner<FSSliceReader>(readersCount)); } fileSplitter.setBlocksThreshold(blocksThreshold); <START> records.set(recordReader.records); <END> }</code><technical_language>explain this line does</technical_language>

Target:
public void populateDAG(DAG dag, Configuration configuration) { FileSplitterInput fileSplitter = dag.addOperator("FileSplitter", createFileSplitter()); FSRecordReader recordReader = dag.addOperator("BlockReader", createRecordReader()); dag.addStream("BlockMetadata", fileSplitter.blocksMetadataOutput, recordReader.blocksMetadataInput); if (sequentialFileRead) { dag.setInputPortAttribute(recordReader.blocksMetadataInput, Context.PortContext.STREAM_CODEC, new SequentialFileBlockMetadataCodec()); } FileSplitterInput.TimeBasedDirectoryScanner fileScanner = fileSplitter.getScanner(); fileScanner.setFiles(files); if (scanIntervalMillis != 0) { fileScanner.setScanIntervalMillis(scanIntervalMillis); } fileScanner.setRecursive(recursive); if (filePatternRegularExp != null) { fileSplitter.getScanner().setFilePatternRegularExp(filePatternRegularExp); } recordReader.setBasePath(files); if (readersCount != 0) { dag.setAttribute(recordReader, Context.OperatorContext.PARTITIONER, new StatelessPartitioner<FSSliceReader>(readersCount)); } fileSplitter.setBlocksThreshold(blocksThreshold); records.set(recordReader.records); }
Source:
<code>public ArrayList<VDSDomainsData> getDomains() { return <START> privateDomains; <END> }</code><technical_language>do need a local variable do: return cachedVds.getDomains();</technical_language>

Target:
public ArrayList<VDSDomainsData> getDomains() { return domains; }
Source:
<code>public void checkFactoryAcceptingWithSincePolicy() throws Exception { dashboard.open(); testFactory.open(seleniumWebDriver); seleniumWebDriver.switchFromDashboardIframeToIde(); if (System.currentTimeMillis() > initTime + ADDITIONAL_TIME) { Assert.fail( "Factory started longer then additional time and next test steps does not make sense"); } warningDialog.waitWaitWarnDialogWindowWithSpecifiedTextMess(EXPIRE_MESSAGE); <START> while (System.currentTimeMillis() <= initTime + ADDITIONAL_TIME + 10000) { <END> WaitUtils.sleepQuietly(1); } testFactory.open(seleniumWebDriver); seleniumWebDriver.switchFromDashboardIframeToIde(); projectExplorer.waitProjectExplorer(); warningDialog.waitWaitClosingWarnDialogWindow(); }</code><technical_language>**10000** needs named</technical_language>

Target:
public void checkFactoryAcceptingWithSincePolicy() throws Exception { dashboard.open(); testFactory.open(seleniumWebDriver); seleniumWebDriver.switchFromDashboardIframeToIde(); if (System.currentTimeMillis() > initTime + FACTORY_INACTIVITY_TIME) { Assert.fail( "Factory started longer then additional time and next test steps does not make sense"); } warningDialog.waitWaitWarnDialogWindowWithSpecifiedTextMess(EXPIRE_MESSAGE); while (System.currentTimeMillis() <= initTime + FACTORY_INACTIVITY_TIME + ADDITIONAL_TIME) { WaitUtils.sleepQuietly(1); } testFactory.open(seleniumWebDriver); seleniumWebDriver.switchFromDashboardIframeToIde(); projectExplorer.waitProjectExplorer(); warningDialog.waitWaitClosingWarnDialogWindow(); }
Source:
<code>protected boolean canDoAddVmCommand() { boolean returnValue = false; returnValue = areParametersLegal(getReturnValue().getCanDoActionMessages()); <START> returnValue = returnValue && checkNumberOfMonitors(getParameters().graphicsTypesToBeSet()) <END> && checkSingleQxlDisplay(); returnValue = returnValue && checkPciAndIdeLimit(getParameters().getVm().getOs(), getVdsGroup().getcompatibility_version(), getParameters().getVmStaticData().getNumOfMonitors(), getVmInterfaces(), getVmDisks(), isVirtioScsiEnabled(), hasWatchdog(), isBalloonEnabled(), getParameters().isSoundDeviceEnabled(), getReturnValue().getCanDoActionMessages()) && canAddVm(getReturnValue().getCanDoActionMessages(), destStorages.values()) && hostToRunExist(); return returnValue; }</code><technical_language>do need pass parameter? accessible method (unless extract method some shared place later)</technical_language>

Target:
protected boolean canDoAddVmCommand() { boolean returnValue = false; returnValue = areParametersLegal(getReturnValue().getCanDoActionMessages()); returnValue = returnValue && checkNumberOfMonitors(getResultingVmGraphics()) && checkSingleQxlDisplay(); returnValue = returnValue && checkPciAndIdeLimit(getParameters().getVm().getOs(), getVdsGroup().getcompatibility_version(), getParameters().getVmStaticData().getNumOfMonitors(), getVmInterfaces(), getVmDisks(), isVirtioScsiEnabled(), hasWatchdog(), isBalloonEnabled(), getParameters().isSoundDeviceEnabled(), getReturnValue().getCanDoActionMessages()) && canAddVm(getReturnValue().getCanDoActionMessages(), destStorages.values()) && hostToRunExist(); return returnValue; }
Source:
<code>private void playerDies() { Track.getInstance().getPlayer().die(); OBSERVABLE.notify( GameObserver.Category.PLAYER, GameObserver.Player.COLLISION, AbstractObstacle.class.getSimpleName()); sleep(SLEEP_FACTOR * InternalTicker.NANOS_PER_TICK / InternalTicker.E6); <START> letPlayerSurvive(); END> sleep(LONG); }</code><technical_language>player surviving if is dead? < review, logic</technical_language>

Target:
private void playerDies() { Track.getInstance().getPlayer().die(); OBSERVABLE.notify( GameObserver.Category.PLAYER, GameObserver.Player.COLLISION, AbstractObstacle.class.getSimpleName()); sleep(SLEEP_FACTOR * InternalTicker.NANOS_PER_TICK / InternalTicker.E6); }
Source:
<code>private void updateTreeForLanguages(ICResourceDescription rcDes) { treeLanguages.removeAll(); currentLanguageId = null; List<String> languageIds = LanguageSettingsManager.getLanguages(rcDes); if (languageIds.size() > 1) { languageIds.remove(null); } else if (languageIds.isEmpty()) { languageIds.add(null); } Map<String, List<String>> map = new TreeMap<String, List<String>>(); for (String langId : languageIds) { ILanguage language = LanguageManager.getInstance().getLanguage(langId); String langName = language != null ? language.getName() : Messages.LanguageSettingsEntriesTab_UnspecifiedLanguage; if (langName == null || langName.length() == 0) continue; List<String> langIds = map.get(langName); if (langIds == null) { langIds = new ArrayList<String>(); map.put(langName, langIds); } langIds.add(langId); } for (String langName : map.keySet()) { List<String> langIds = map.get(langName); for (String langId : langIds) { TreeItem t = new TreeItem(treeLanguages, SWT.NONE); if (langIds.size() == 1) { t.setText(0, langName); } else { StringBuilder uniqueLangName = new StringBuilder(); <START> uniqueLangName.append(langName).append(" [") END> .append(langId).append("]"); t.setText(0, uniqueLangName.toString()); } t.setData(langId); if (currentLanguageIdGlobal != null && currentLanguageIdGlobal.equals(langId)) { currentLanguageId = currentLanguageIdGlobal; treeLanguages.setSelection(t); } else if (currentLanguageId == null) { currentLanguageId = langId; } } } }</code><technical_language>I prefer append(" [id=") - consistent other UI hints in similar cases</technical_language>

Target:
private void updateTreeForLanguages(ICResourceDescription rcDes) { treeLanguages.removeAll(); currentLanguageId = null; List<String> languageIds = LanguageSettingsManager.getLanguages(rcDes); if (languageIds.size() > 1) { languageIds.remove(null); } else if (languageIds.isEmpty()) { languageIds.add(null); } Map<String, List<String>> map = new TreeMap<String, List<String>>(); for (String langId : languageIds) { ILanguage language = LanguageManager.getInstance().getLanguage(langId); String langName = language != null ? language.getName() : Messages.LanguageSettingsEntriesTab_UnspecifiedLanguage; if (langName == null || langName.length() == 0) continue; List<String> langIds = map.get(langName); if (langIds == null) { langIds = new ArrayList<String>(); map.put(langName, langIds); } langIds.add(langId); } for (String langName : map.keySet()) { List<String> langIds = map.get(langName); for (String langId : langIds) { TreeItem t = new TreeItem(treeLanguages, SWT.NONE); if (langIds.size() == 1) { t.setText(0, langName); } else { StringBuilder uniqueLangName = new StringBuilder(); uniqueLangName.append(langName).append(" [id=") .append(langId).append("]"); t.setText(0, uniqueLangName.toString()); } t.setData(langId); if (currentLanguageIdGlobal != null && currentLanguageIdGlobal.equals(langId)) { currentLanguageId = currentLanguageIdGlobal; treeLanguages.setSelection(t); } else if (currentLanguageId == null) { currentLanguageId = langId; } } } }
Source:
<code>protected Object doTransform(Message<?> message) throws Exception { Assert.notNull(message, "message must not be null"); Assert.notNull(message.getHeaders().getId(), "ID header must not be null"); Message<?> storedMessage = this.messageStore.addMessage(message); AbstractIntegrationMessageBuilder<?> responseBuilder = getMessageBuilderFactory() <START> .withPayload(storedMessage.getHeaders().getId()); END> responseBuilder.copyHeaders(message.getHeaders()); return responseBuilder.build(); }</code><technical_language>expose a local variable for storedMessage.getHeaders().getId() calls? need this // NOSONAR spend time for more method calls</technical_language>

Target:
protected Object doTransform(Message<?> message) throws Exception { Assert.notNull(message, "message must not be null"); UUID id = message.getHeaders().getId(); Assert.notNull(id, "ID header must not be null"); this.messageStore.addMessage(message); AbstractIntegrationMessageBuilder<?> responseBuilder = getMessageBuilderFactory().withPayload(id); responseBuilder.copyHeaders(message.getHeaders()); return responseBuilder.build(); }
Source:
<code>public Destination getJMSDestination() throws JMSException { if (dest == null) { SimpleString address = message.getAddressSimpleString(); SimpleString name = address; <START> if (address != null & session.isEnable1xPrefixes()) { <END> if (address.startsWith(PacketImpl.OLD_QUEUE_PREFIX)) { name = address.subSeq(PacketImpl.OLD_QUEUE_PREFIX.length(), address.length()); } else if (address.startsWith(PacketImpl.OLD_TEMP_QUEUE_PREFIX)) { name = address.subSeq(PacketImpl.OLD_TEMP_QUEUE_PREFIX.length(), address.length()); } else if (address.startsWith(PacketImpl.OLD_TOPIC_PREFIX)) { name = address.subSeq(PacketImpl.OLD_TOPIC_PREFIX.length(), address.length()); } else if (address.startsWith(PacketImpl.OLD_TEMP_TOPIC_PREFIX)) { name = address.subSeq(PacketImpl.OLD_TEMP_TOPIC_PREFIX.length(), address.length()); } } if (address == null) { dest = null; } else if (RoutingType.ANYCAST.equals(message.getRoutingType())) { dest = ActiveMQDestination.createQueue(address); } else if (RoutingType.MULTICAST.equals(message.getRoutingType())) { dest = ActiveMQDestination.createTopic(address); } else { dest = (ActiveMQDestination) ActiveMQDestination.fromPrefixedName(address.toString()); } if (name != null) { ((ActiveMQDestination) dest).setName(name.toString()); } } return dest; }</code><technical_language>heavily called in apps dynamic routing</technical_language>

Target:
public Destination getJMSDestination() throws JMSException { if (dest == null) { SimpleString address = message.getAddressSimpleString(); SimpleString changedAddress = checkPrefix(address); if (address == null) { dest = null; } else if (RoutingType.ANYCAST.equals(message.getRoutingType())) { dest = ActiveMQDestination.createQueue(address); } else if (RoutingType.MULTICAST.equals(message.getRoutingType())) { dest = ActiveMQDestination.createTopic(address); } else { dest = (ActiveMQDestination) ActiveMQDestination.fromPrefixedName(address.toString()); } if (changedAddress != null) { ((ActiveMQDestination) dest).setName(changedAddress.toString()); } } return dest; }
Source:
<code>void checkForDependentConfigs(String templateId) { <START> List<String> dependentConfigIds = new ArrayList<>(); <END> pipelineDAO.all() .stream() .filter(pipeline -> pipeline.getType() != null && pipeline.getType().equals("templatedPipeline")) .forEach(templatedPipeline -> { String source; try { TemplateConfiguration config = objectMapper.convertValue(templatedPipeline.getConfig(), TemplateConfiguration.class); source = config.getPipeline().getTemplate().getSource(); } catch (Exception e) { return; } if (source != null && source.equalsIgnoreCase("spinnaker://" + templateId)) { dependentConfigIds.add(templatedPipeline.getId()); } }); if (dependentConfigIds.size() != 0) { throw new InvalidRequestException("The following pipeline config(s)" + " depend on this template: " + String.join(", ", dependentConfigIds)); } }</code><technical_language>want check for dependent templates, templates inherit another</technical_language>

Target:
void checkForDependentConfigs(String templateId) { List<String> dependentConfigIds = new ArrayList<>(); pipelineDAO.all() .stream() .filter(pipeline -> pipeline.getType() != null && pipeline.getType().equals("templatedPipeline")) .forEach(templatedPipeline -> { String source; try { TemplateConfiguration config = objectMapper.convertValue(templatedPipeline.getConfig(), TemplateConfiguration.class); source = config.getPipeline().getTemplate().getSource(); } catch (Exception e) { return; } if (source != null && source.equalsIgnoreCase("spinnaker://" + templateId)) { dependentConfigIds.add(templatedPipeline.getId()); } }); if (dependentConfigIds.size() != 0) { throw new InvalidRequestException("The following pipeline configs" + " depend on this template: " + String.join(", ", dependentConfigIds)); } }
Source:
<code>private static String getEmbeddedDefaultRepositoryXml( final String fullyQualifiedServerUrl ) { <START> String repositoriesXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><repositories>" END> + "<repository><id>PentahoEnterpriseRepository</id>" + "<name>" + SINGLE_DI_SERVER_INSTANCE + "</name>" + "<description>" + SINGLE_DI_SERVER_INSTANCE + "</description>" + "<repository_location_url>" + fullyQualifiedServerUrl + "</repository_location_url>" + "<version_comment_mandatory>N</version_comment_mandatory>" + "</repository>" + "</repositories>"; return repositoriesXml; }</code><technical_language>**Intellij warning:** Initializing this variable is redundant, result done with: return "<?xml version=\"1.0\" encoding=\"UTF-8\"?><repositories>" ..</technical_language>

Target:
private static String getEmbeddedDefaultRepositoryXml( final String fullyQualifiedServerUrl ) { return "<?xml version=\"1.0\" encoding=\"UTF-8\"?><repositories>" + "<repository><id>PentahoEnterpriseRepository</id>" + "<name>" + SINGLE_DI_SERVER_INSTANCE + "</name>" + "<description>" + SINGLE_DI_SERVER_INSTANCE + "</description>" + "<repository_location_url>" + fullyQualifiedServerUrl + "</repository_location_url>" + "<version_comment_mandatory>N</version_comment_mandatory>" + "</repository>" + "</repositories>"; }
Source:
<code><START> @Nonnull public Explosion getExplosion() { return explosion; } <END></code><technical_language>Formatting. sqeeze in line, follow forge code style. this formatter: <LINK_0></technical_language>

Target:
public Explosion getExplosion() { return explosion; }
Source:
<code>public void testMapFromJson() throws Exception { Map<String,Object> helperJSONHashMap = new HashMap<String, Object>(); for(String key:helperJSONTreeMap.keySet()){ Object value = helperJSONTreeMap.get(key); if(value instanceof TreeMap){ value = new HashMap<String,Object>((TreeMap)value); } helperJSONHashMap.put(key,value); } File fixture = TestUtils.loadFixture("fixture/json_helper.json"); FileReader fr = new FileReader(fixture); Map<String, Object> objectHashMap = helper.fromJson(fr); <START> for(String key:helperJSONTreeMap.keySet()){ <END> Object value = helperJSONTreeMap.get(key); if(value instanceof TreeMap){ value = new HashMap<String,Object>((TreeMap)value); } helperJSONHashMap.put(key,value); } Assert.assertTrue("Map read is not equal to expected map", helperJSONHashMap.equals(objectHashMap)); }</code><technical_language>This for loop duplicates above. need convert a TreeMap a HashMap. Map implementations different, equals() return true if contents</technical_language>

Target:
public void testMapFromJson() throws Exception { File fixture = TestUtils.loadFixture("fixture/json_helper.json"); FileReader fr = new FileReader(fixture); Map<String, Object> objectHashMap = helper.fromJson(fr); Assert.assertTrue("Map read is not equal to expected map", expectedJSONMap.equals(objectHashMap)); }
Source:
<code>public void setSummary(@CheckForNull String summary) throws IOException { checkPermission(UPDATE); <START> this.description = description; <END> save(); }</code><technical_language>Bug, setting description instead of summary</technical_language>

Target:
public void setSummary(@CheckForNull String summary) throws IOException { checkPermission(UPDATE); this.summary = summary; save(); }
Source:
<code><START> public void addMoodToMessage(Message message, Mood mood, MoodConcretisation concretisation) { <END> MoodElement element = buildMood(mood, concretisation, null); message.addExtension(element); }</code><technical_language>static</technical_language>

Target:
public static void addMoodToMessage(Message message, Mood mood, MoodConcretisation concretisation) { MoodElement element = buildMood(mood, concretisation, null); message.addExtension(element); }
Source:
<code>public void start() { <START> Set<Object> singletons = new HashSet<Object>(); <END> singletons.add(new DispoSetMessageReader()); singletons.add(new DispoSetMessageWriter()); singletons.add(new DispoItemMessageReader()); singletons.add(new DispoItemMessageWriter()); singletons.add(new DispoAnnotationMessageReader()); singletons.add(new DispoAnnotationMessageWriter()); DispoHtmlWriter writer = new DispoHtmlWriter(TemplateRegistry.newRegistry()); singletons.add(new DispoProgramResource(dispoApi, writer, dispoApi.getDispoFactory())); singletons.add(new DispoInitResource(writer)); singletons.add(new DispoAdminResource(writer)); }</code><technical_language>set for singletons get declared a class data member? Allocating new set name is confusing - this line incorrect</technical_language>

Target:
public void start() { singletons.add(new DispoSetMessageReader()); singletons.add(new DispoSetMessageWriter()); singletons.add(new DispoItemMessageReader()); singletons.add(new DispoItemMessageWriter()); singletons.add(new DispoAnnotationMessageReader()); singletons.add(new DispoAnnotationMessageWriter()); DispoHtmlWriter writer = new DispoHtmlWriter(TemplateRegistry.newRegistry()); singletons.add(new DispoProgramResource(dispoApi, writer, dispoApi.getDispoFactory())); singletons.add(new DispoInitResource(writer)); singletons.add(new DispoAdminResource(writer)); }
Source:
<code>public Elasticsearch5SearchIndex(Graph graph, GraphConfiguration config) { this.graph = graph; this.config = new ElasticsearchSearchIndexConfiguration(graph, config); this.indexSelectionStrategy = this.config.getIndexSelectionStrategy(); this.allFieldEnabled = this.config.isAllFieldEnabled(false); this.propertyNameVisibilitiesStore = this.config.createPropertyNameVisibilitiesStore(graph); this.client = createClient(this.config); this.serverPluginInstalled = checkPluginInstalled(this.client); this.geoShapePrecision = this.config.getGeoShapePrecision(); this.geoShapeErrorPct = this.config.getGeoShapeErrorPct(); this.logRequestSizeLimit = this.config.getLogRequestSizeLimit(); this.exceptionHandler = this.config.getExceptionHandler(graph); this.flushObjectQueue = new FlushObjectQueue(this); <START> storePainlessScript("addFieldsToExtendedDataScript", getClass().getResourceAsStream("add-fields-to-extended-data.painless"), true); <END> storePainlessScript("deleteFieldsFromDocumentScript", getClass().getResourceAsStream("remove-fields-from-document.painless"), true); storePainlessScript("updateFieldsOnDocumentScript", getClass().getResourceAsStream("update-fields-on-document.painless"), false); }</code><technical_language>Move getClass().getResourceAsStream storePainlessScript</technical_language>

Target:
public Elasticsearch5SearchIndex(Graph graph, GraphConfiguration config) { this.graph = graph; this.config = new ElasticsearchSearchIndexConfiguration(graph, config); this.indexSelectionStrategy = this.config.getIndexSelectionStrategy(); this.allFieldEnabled = this.config.isAllFieldEnabled(false); this.propertyNameVisibilitiesStore = this.config.createPropertyNameVisibilitiesStore(graph); this.client = createClient(this.config); this.serverPluginInstalled = checkPluginInstalled(this.client); this.geoShapePrecision = this.config.getGeoShapePrecision(); this.geoShapeErrorPct = this.config.getGeoShapeErrorPct(); this.logRequestSizeLimit = this.config.getLogRequestSizeLimit(); this.exceptionHandler = this.config.getExceptionHandler(graph); this.flushObjectQueue = new FlushObjectQueue(this); storePainlessScript("addFieldsToExtendedDataScript", "add-fields-to-extended-data.painless", true); storePainlessScript("deleteFieldsFromDocumentScript", "remove-fields-from-document.painless", true); storePainlessScript("updateFieldsOnDocumentScript", "update-fields-on-document.painless", false); }
Source:
<code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Bundle bundle; { if (savedInstanceState != null) { bundle = savedInstanceState; } else { bundle = getArguments(); } } restore(bundle); <START> View view = inflater.inflate(R.layout.fragment_course_outline_new, container, false); <END> initListView(view); errorNotification = new FullScreenErrorNotification(listView); snackbarErrorNotification = new SnackbarErrorNotification(listView); fetchCourseComponent(view); return view; }</code><technical_language>final</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Bundle bundle; { if (savedInstanceState != null) { bundle = savedInstanceState; } else { bundle = getArguments(); } } restore(bundle); final View view = inflater.inflate(R.layout.fragment_course_outline_new, container, false); initListView(view); errorNotification = new FullScreenErrorNotification(listView); snackbarErrorNotification = new SnackbarErrorNotification(listView); fetchCourseComponent(view); return view; }