auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public File newFolder(String... paths) throws IOException { if (paths.length == 0) { throw new IllegalArgumentException("must pass at least one path"); } File root = getRoot(); for (String path : paths) { if (new File(path).isAbsolute()) { throw new IOException("folder path \'" + path + "\' is not a relative path"); } } File relativePath = null; File file = root; boolean lastMkdirsCallSuccessful = true; for (String path : paths) { relativePath = new File(relativePath, path); file = new File(root, relativePath.getPath()); lastMkdirsCallSuccessful = file.mkdirs(); if (!lastMkdirsCallSuccessful) { if (file.exists() && file.isDirectory()) { continue; <START> } else if (file.exists()) { <END> throw new IOException( "a file with the path \'" + relativePath.getPath() + "\' exists"); } else { throw new IOException( "could not create a folder with the path \'" + relativePath.getPath() + "\'"); } } } if (!lastMkdirsCallSuccessful) { throw new IOException( "a folder with the path \'" + relativePath.getPath() + "\' already exists"); } return file; }</code><technical_language>include in message, createNewFile includes in error message</technical_language>

Target:
public File newFolder(String... paths) throws IOException { if (paths.length == 0) { throw new IllegalArgumentException("must pass at least one path"); } File root = getRoot(); for (String path : paths) { if (new File(path).isAbsolute()) { throw new IOException("folder path \'" + path + "\' is not a relative path"); } } File relativePath = null; File file = root; boolean lastMkdirsCallSuccessful = true; for (String path : paths) { relativePath = new File(relativePath, path); file = new File(root, relativePath.getPath()); lastMkdirsCallSuccessful = file.mkdirs(); if (!lastMkdirsCallSuccessful && !file.isDirectory()) { if (file.exists()) { throw new IOException( "a file with the path \'" + relativePath.getPath() + "\' exists"); } else { throw new IOException( "could not create a folder with the path \'" + relativePath.getPath() + "\'"); } } } if (!lastMkdirsCallSuccessful) { throw new IOException( "a folder with the path \'" + relativePath.getPath() + "\' already exists"); } return file; }
Source:
<code>protected void connect() { if (isConnected()) { return; } if (client == null) { client = clientBuilder.build(); } client.start(); try { LOG.info("Connecting to ZooKeeper with client: ", client); client.blockUntilConnected(); LOG.info("Connected to ZooKeeper"); } catch (InterruptedException e) { <START> LOG.warn("Interrupted while connecting to ZooKeeper", e); <END> } if (leaderSelector == null) { leaderSelector = new LeaderSelector(client, "/" + getDomain(), leaderSelectorListener); } leaderSelector.autoRequeue(); leaderSelector.start(); }</code><technical_language>safely continue do return</technical_language>

Target:
protected void connect() { if (isConnected()) { return; } if (client == null) { client = clientBuilder.build(); } client.start(); boolean blocked = true; while (blocked) { try { LOG.info("Connecting to ZooKeeper with client {}", client); client.blockUntilConnected(); blocked = false; LOG.info("Connected to ZooKeeper"); } catch (InterruptedException e) { LOG.warn("Interrupted while connecting to ZooKeeper", e); } } if (leaderSelector == null) { leaderSelector = new LeaderSelector(client, "/" + getDomain(), leaderSelectorListener); } leaderSelector.autoRequeue(); leaderSelector.start(); }
Source:
<code>public Document(JsonNode json) { this.fields = new HashMap<>(); json.fields().forEachRemaining( e -> { if ("coreId".equals(e.getKey())) { this.id = (json.get("doi").asText().equals("null")) ? json.get("coreId").asText() : "doi:" + json.get("doi").asText(); } else if ("abstract".equals(e.getKey())) { this.contents = json.get("title").asText() + "\n" + json.get("abstract").asText(); <START> } else if ("topics".equals(e.getKey())) { <END> ArrayNode arrayField = (ArrayNode) e.getValue(); StringJoiner sj = new StringJoiner(" "); arrayField.elements().forEachRemaining( arrayElement -> { sj.add(arrayElement.asText()); }); this.fields.put(e.getKey(), sj.toString()); } else { this.fields.put(e.getKey(), e.getValue().asText()); } }); }</code><technical_language>Follow logic here, i if check a of field is array a string instead of "topics" enable more array-like in other fields searched</technical_language>

Target:
public Document(JsonNode json) { this.fields = new HashMap<>(); json.fields().forEachRemaining( e -> { if ("coreId".equals(e.getKey())) { this.id = (json.get("doi").asText().equals("null")) ? json.get("coreId").asText() : "doi:" + json.get("doi").asText(); } else if ("abstract".equals(e.getKey())) { this.contents = json.get("title").asText() + "\n" + json.get("abstract").asText(); } else if (e.getValue() instanceof ArrayNode) { ArrayNode arrayField = (ArrayNode) e.getValue(); StringJoiner sj = new StringJoiner("::"); arrayField.elements().forEachRemaining( arrayElement -> { sj.add(arrayElement.asText()); }); this.fields.put(e.getKey(), sj.toString()); } else { this.fields.put(e.getKey(), e.getValue().asText()); } }); }
Source:
<code>public void init(final GlusterVolumeSnapshotModel model) { super.init(model); model.getInterval().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { getView().setCriticalIntervalLabelVisibility(model, Integer.parseInt(((ListModel<String>) sender).getSelectedItem())); } }); model.getRecurrence().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { getView().updateVisibilities(model); getView().setCriticalIntervalLabelVisibility(model, Integer.parseInt(model.getInterval().getSelectedItem())); getView().setMessage(null); } }); model.getEndByOptions().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { getView().setEndDateVisibility(model); } }); model.getPropertyChangedEvent().addListener(new IEventListener<PropertyChangedEventArgs>() { @Override public void eventRaised(Event<? extends PropertyChangedEventArgs> ev, Object sender, PropertyChangedEventArgs args) { <START> if ("Message".equals(args.propertyName)) { END> getView().setMessage(model.getMessage()); } } }); }</code><technical_language>This is done in super class of this presenter</technical_language>

Target:
public void init(final GlusterVolumeSnapshotModel model) { super.init(model); model.getInterval().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { getView().setCriticalIntervalLabelVisibility(model, Integer.parseInt(((ListModel<String>) sender).getSelectedItem())); } }); model.getRecurrence().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { getView().updateVisibilities(model); getView().setCriticalIntervalLabelVisibility(model, Integer.parseInt(model.getInterval().getSelectedItem())); getView().setMessage(null); } }); model.getEndByOptions().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { getView().setEndDateVisibility(model); } }); }
Source:
<code>public void close() { List<Thread> closeThreads = new LinkedList<>(); Collection<InterpreterSetting> intpSettings = interpreterSettings.values(); <START> for (final InterpreterSetting intpSetting : intpSettings) { <END> Thread t = new Thread() { public void run() { intpSetting.close(); } }; t.start(); closeThreads.add(t); } for (Thread t : closeThreads) { try { t.join(); } catch (InterruptedException e) { LOGGER.error("Can't close interpreterGroup", e); } } }</code><technical_language>Merge line for (InterpreterSetting intpSetting : interpreterSettings.values()) {</technical_language>

Target:
public void close() { List<Thread> closeThreads = new LinkedList<>(); for (final InterpreterSetting intpSetting : interpreterSettings.values()) { Thread t = new Thread() { public void run() { intpSetting.close(); } }; t.start(); closeThreads.add(t); } for (Thread t : closeThreads) { try { t.join(); } catch (InterruptedException e) { LOGGER.error("Can't close interpreterGroup", e); } } }
Source:
<code>private Flow convertAzkabanFlowToFlow(final AzkabanFlow azkabanFlow, final String flowName, <START> final File flowFile) { <END> final Flow flow = new Flow(flowName); final Props props = azkabanFlow.getProps(); FlowLoaderUtils.addEmailPropsToFlow(flow, props); props.setSource(flowFile.getName()); final List<FlowProps> flowPropsList = new ArrayList<>(); flowPropsList.add(new FlowProps(props)); flow.addAllFlowProperties(flowPropsList); azkabanFlow.getNodes().values().stream() .map(n -> convertAzkabanNodeToNode(n, flowName, flowFile)) .forEach(n -> flow.addNode(n)); buildFlowEdges(azkabanFlow, flowName); flow.addAllEdges(this.edgeMap.get(flowName)); flow.initialize(); return flow; }</code><technical_language>flowName is necessary additional method argument obtained azkabanFlow</technical_language>

Target:
private Flow convertAzkabanFlowToFlow(final AzkabanFlow azkabanFlow, final String flowName, final File flowFile) { final Flow flow = new Flow(flowName); final Props props = azkabanFlow.getProps(); FlowLoaderUtils.addEmailPropsToFlow(flow, props); props.setSource(flowFile.getName()); flow.addAllFlowProperties(ImmutableList.of(new FlowProps(props))); azkabanFlow.getNodes().values().stream() .map(n -> convertAzkabanNodeToNode(n, flowName, flowFile)) .forEach(n -> flow.addNode(n)); buildFlowEdges(azkabanFlow, flowName); flow.addAllEdges(this.edgeMap.get(flowName)); flow.initialize(); return flow; }
Source:
<code><START> public boolean isQualifiedForConsoleConnect() { <END> return this == PoweringUp || this == Up || this == RebootInProgress || this == PoweringDown || this == Paused; }</code><technical_language>if try avoid introducing more mess:)</technical_language>

Target:
public boolean isQualifiedForConsoleConnect() { return this == PoweringUp || this == Up || this == RebootInProgress || this == PoweringDown || this == Paused || this == MigratingFrom || this == SavingState; }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TestAddress that = (TestAddress) o; if (addressNum != that.addressNum) return false; <START> return name != null ? name.equals(that.name) : that.name == null; <END> }</code><technical_language>changing this, I use: return addressNum == that.addressNum && Objects.equals(name, that.name);</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TestAddress that = (TestAddress) o; return addressNum == that.addressNum && Objects.equals(name, that.name); }
Source:
<code>private void assertFilesAreOpen() { List<TextEditor> textEditors = getOpenEditorsByType(TextEditor.class); assertEquals(2, textEditors.size()); Set<String> actualSet = new HashSet<String>(); <START> actualSet.addAll(FluentIterable.from(textEditors).transform(new Function<TextEditor, String>() { <END> @Override public String apply(TextEditor editor) { return editor.getTitle(); } }).toSet()); assertTrue(actualSet.contains(fileA.getName())); assertTrue(actualSet.contains(fileB.getName())); }</code><technical_language>do Set<String> editorTitles = FluentIterable...</technical_language>

Target:
private void assertFilesAreOpen() { Set<TextEditor> textEditors = getOpenEditorsByType(TextEditor.class); assertEquals(2, textEditors.size()); Set<String> editorTitles = FluentIterable.from(textEditors).transform(new Function<TextEditor, String>() { @Override public String apply(TextEditor editor) { return editor.getTitle(); } }).toSet(); assertTrue(editorTitles.contains(fileA.getName())); assertTrue(editorTitles.contains(fileB.getName())); }
Source:
<code>public final TestObserver<T> assertValue(Predicate<T> valuePredicate) { int s = values.size(); if (s == 0) { throw fail("No values"); } boolean found = false; for (T value : values) { try { <START> if (valuePredicate.test(value)) { <END> found = true; break; } } catch (Exception ex) { throw ExceptionHelper.wrapOrThrow(ex); } } if (found) { if (s != 1) { throw fail("Value present but other values as well"); } } else { throw fail("Value not present"); } return this; }</code><technical_language>This is unnecessary, test values.get(0) report if s > 1 besides</technical_language>

Target:
public final TestObserver<T> assertValue(Predicate<T> valuePredicate) { int s = values.size(); if (s == 0) { throw fail("No values"); } boolean found = false; try { if (valuePredicate.test(values.get(0))) { found = true; } } catch (Exception ex) { throw ExceptionHelper.wrapOrThrow(ex); } if (found) { if (s != 1) { throw fail("Value present but other values as well"); } } else { throw fail("Value not present"); } return this; }
Source:
<code>private void createObjectsWithOldPrimaryKey(final String className, final boolean insertNullValue) { DynamicRealm realm = DynamicRealm.getInstance(configFactory.createConfigurationBuilder().build()); <START> realm.executeTransaction(new DynamicRealm.Transaction() { <END> @Override public void execute(DynamicRealm realm) { realm.createObject(className).setString(MigrationPrimaryKey.FIELD_PRIMARY, "12"); if (insertNullValue) { realm.createObject(className).setString(MigrationPrimaryKey.FIELD_PRIMARY, null); } } }); realm.close(); }</code><technical_language>try-finally</technical_language>

Target:
private void createObjectsWithOldPrimaryKey(final String className, final boolean insertNullValue) { DynamicRealm realm = DynamicRealm.getInstance(configFactory.createConfigurationBuilder().build()); try { realm.executeTransaction(new DynamicRealm.Transaction() { @Override public void execute(DynamicRealm realm) { realm.createObject(className).setString(MigrationPrimaryKey.FIELD_PRIMARY, "12"); if (insertNullValue) { realm.createObject(className).setString(MigrationPrimaryKey.FIELD_PRIMARY, null); } } }); } finally { realm.close(); } }
Source:
<code>public void should_add_authentication_header_to_request() throws Exception { HttpClient httpClientSpy = spy(new HttpClient()); GitHubLastUpdateCache gitHubLastUpdateCache = new GitHubLastUpdateCache(folder.newFolder()); DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(GitHubSource.GITHUB_USERNAME_PROPERTY, "my-username"); capabilities.setCapability(GitHubSource.GITHUB_TOKEN_PROPERTY, "my-token"); GeckoDriverGitHubSource geckoDriverGitHubSource = new GeckoDriverGitHubSource(httpClientSpy, gitHubLastUpdateCache, capabilities); geckoDriverGitHubSource.getReleaseForVersion("v0.14.0"); verify(httpClientSpy, times(1)).get(anyString(), argThat(headers -> { if (headers.size() > 0) { <START> String authorization = headers.get("Authorization"); <END> if (authorization != null && authorization.startsWith("Basic ")) { String tokens = new String(Base64.getDecoder().decode(authorization.substring(6, authorization.length() - 1))); if ("my-username:my-token".equals(tokens)) { return true; } else { log.severe(String.format( "The auth param value should contain: [my-username:my-token] but contains: [%s]", tokens)); } } else { log.severe("There is no header pair with key: 'Authorization' and value starting with 'Basic'"); } } else { log.severe("The map doesn't contain any header param"); } return false; })); }</code><technical_language>for readability extract a new method is topic of verification here</technical_language>

Target:
public void should_add_authentication_header_to_request() throws Exception { HttpClient httpClientSpy = spy(new HttpClient()); GitHubLastUpdateCache gitHubLastUpdateCache = new GitHubLastUpdateCache(folder.newFolder()); String username = "my-username"; String token = "my-token"; DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(GITHUB_USERNAME_PROPERTY, username); capabilities.setCapability(GITHUB_TOKEN_PROPERTY, token); GeckoDriverGitHubSource geckoDriverGitHubSource = new GeckoDriverGitHubSource(httpClientSpy, gitHubLastUpdateCache, capabilities); geckoDriverGitHubSource.getReleaseForVersion("v0.14.0"); verify(httpClientSpy, times(1)).get(anyString(), argThat(headers -> containsAuthHeaderParam(headers, username + ":" + token))); }
Source:
<code>public FactorCriteria orderByType() { <START> return null; <END> }</code><technical_language>method implemented</technical_language>

Target:
public FactorCriteria orderByType() { return orderBy(DefaultSmsFactor.TYPE); }
Source:
<code>public AbstractSearchQuery(String namespace, String queryString) { <START> m_namespace = namespace; <END> m_queryString = queryString; }</code><technical_language>Namespace null, please check for it, Objects.requireNonNull(namespace)</technical_language>

Target:
public AbstractSearchQuery(String namespace, String queryString) { m_namespace = Objects.requireNonNull(namespace); m_queryString = queryString; }
Source:
<code>public void onPost(final GitLabPushRequest req) { final ParameterizedJobMixIn scheduledJob = new ParameterizedJobMixIn() { @Override protected Job asJob() { return job; } }; if (triggerOnPush && this.isBranchAllowed(this.getSourceBranch(req))) { LOGGER.log(Level.INFO, "{0} triggered for push.", job.getFullName()); <START> String name = " #" + job.getNextBuildNumber(); <END> Action[] actions = createActions(req, job); int projectbuildDelay = 0; if (job instanceof ParameterizedJobMixIn.ParameterizedJob) { ParameterizedJobMixIn.ParameterizedJob abstractProject = (ParameterizedJobMixIn.ParameterizedJob)job; if (abstractProject.getQuietPeriod() > projectbuildDelay) { projectbuildDelay = abstractProject.getQuietPeriod(); } } if(addCiMessage) { req.createCommitStatus(getDescriptor().getGitlab().instance(), "pending", Jenkins.getInstance().getRootUrl() + job.getUrl()); } scheduledJob.scheduleBuild2(projectbuildDelay, actions); } }</code><technical_language>variable name is removed</technical_language>

Target:
public void onPost(final GitLabPushRequest req) { final ParameterizedJobMixIn scheduledJob = new ParameterizedJobMixIn() { @Override protected Job asJob() { return job; } }; if (triggerOnPush && this.isBranchAllowed(this.getSourceBranch(req))) { LOGGER.log(Level.INFO, "{0} triggered for push.", job.getFullName()); Action[] actions = createActions(req, job); int projectbuildDelay = 0; if (job instanceof ParameterizedJobMixIn.ParameterizedJob) { ParameterizedJobMixIn.ParameterizedJob abstractProject = (ParameterizedJobMixIn.ParameterizedJob)job; if (abstractProject.getQuietPeriod() > projectbuildDelay) { projectbuildDelay = abstractProject.getQuietPeriod(); } } if(addCiMessage) { req.createCommitStatus(getDescriptor().getGitlab().instance(), "pending", Jenkins.getInstance().getRootUrl() + job.getUrl()); } scheduledJob.scheduleBuild2(projectbuildDelay, actions); } }
Source:
<code><START> T toTraversable(Value<V> value, T empty, Function<V, T> ofElement, Function<Iterable<V>, T> ofAll) { <END> if (value.isEmpty()) { return empty; } else if (value.isSingleValued()) { return ofElement.apply(value.get()); } else { return ofAll.apply(value); } }</code><technical_language>Please reformat lines (or formatter)</technical_language>

Target:
static <T extends Traversable<V>, V> T toTraversable( Value<V> value, T empty, Function<V, T> ofElement, Function<Iterable<V>, T> ofAll) { if (value.isEmpty()) { return empty; } else if (value.isSingleValued()) { return ofElement.apply(value.get()); } else { return ofAll.apply(value); } }
Source:
<code>public void addAll(Stream<? extends DocumentWriteOperation> operations) { Iterator<? extends DocumentWriteOperation> docWriteItr = operations.iterator(); <START> docWriteItr.forEachRemaining(this::add); <END> }</code><technical_language>work drop iterator execute operations.forEach(this::add);</technical_language>

Target:
public void addAll(Stream<? extends DocumentWriteOperation> operations) { operations.forEach(this::add); }
Source:
<code>private static List<JavaBeanParameter> getParameters(Executable executable) { if ( executable.getParameterCount() == 0 ) { return Collections.emptyList(); } List<JavaBeanParameter> parameters = new ArrayList<>( executable.getParameterCount() ); Parameter[] parameterArray = executable.getParameters(); Class<?>[] parameterTypes = executable.getParameterTypes(); Type[] genericParameterTypes = executable.getGenericParameterTypes(); if ( parameterTypes.length == genericParameterTypes.length ) { for ( int i = 0; i < parameterArray.length; i++ ) { parameters.add( new JavaBeanParameter( i, parameterArray[i], parameterTypes[i], genericParameterTypes[i] ) ); } } else { int explicitlyDeclaredParameterIndex = 0; for ( int i = 0; i < parameterArray.length; i++ ) { if ( parameterArray[i].isSynthetic() || parameterArray[i].isImplicit() ) { parameters.add( new JavaBeanParameter( i, parameterArray[i], parameterTypes[i], parameterTypes[i] ) ); } else { <START> parameters.add( new JavaBeanParameter( i, parameterArray[i], parameterTypes[i], genericParameterTypes[explicitlyDeclaredParameterIndex] ) ); <END> explicitlyDeclaredParameterIndex++; } } } return CollectionHelper.toImmutableList( parameters ); }</code><technical_language>erase type, I case anymore. Is a reason for that, explicitly stated in ticket? erasure necessary of bug fixing? Also, this trouble (behavior change for users in particular)? move this change a separate commit, explanation, explain in commit message</technical_language>

Target:
private static List<JavaBeanParameter> getParameters(Executable executable) { if ( executable.getParameterCount() == 0 ) { return Collections.emptyList(); } List<JavaBeanParameter> parameters = new ArrayList<>( executable.getParameterCount() ); Parameter[] parameterArray = executable.getParameters(); Class<?>[] parameterTypes = executable.getParameterTypes(); Type[] genericParameterTypes = executable.getGenericParameterTypes(); if ( parameterTypes.length == genericParameterTypes.length ) { for ( int i = 0; i < parameterArray.length; i++ ) { parameters.add( new JavaBeanParameter( i, parameterArray[i], parameterTypes[i], getErasedTypeIfTypeVariable( genericParameterTypes[i] ) ) ); } } else { int explicitlyDeclaredParameterIndex = 0; for ( int i = 0; i < parameterArray.length; i++ ) { if ( parameterArray[i].isSynthetic() || parameterArray[i].isImplicit() ) { parameters.add( new JavaBeanParameter( i, parameterArray[i], parameterTypes[i], parameterTypes[i] ) ); } else { parameters.add( new JavaBeanParameter( i, parameterArray[i], parameterTypes[i], getErasedTypeIfTypeVariable( genericParameterTypes[explicitlyDeclaredParameterIndex] ) ) ); explicitlyDeclaredParameterIndex++; } } } return CollectionHelper.toImmutableList( parameters ); }
Source:
<code><START> public void setAccessTokenExpiresSkew(Duration accessTokenExpiresSkew) { <END> Assert.notNull(accessTokenExpiresSkew, "accessTokenExpiresSkew cannot be null"); this.accessTokenExpiresSkew = accessTokenExpiresSkew; updateAuthorizedClientManager(); }</code><technical_language>This deprecated</technical_language>

Target:
public void setAccessTokenExpiresSkew(Duration accessTokenExpiresSkew) { Assert.notNull(accessTokenExpiresSkew, "accessTokenExpiresSkew cannot be null"); Assert.state(this.defaultAuthorizedClientManager, "The accessTokenExpiresSkew cannot be set when the constructor used is \"ServletOAuth2AuthorizedClientExchangeFilterFunction(OAuth2AuthorizedClientManager)\". " + "Instead, use the constructor \"ServletOAuth2AuthorizedClientExchangeFilterFunction(ClientRegistrationRepository, OAuth2AuthorizedClientRepository)\"."); this.accessTokenExpiresSkew = accessTokenExpiresSkew; updateDefaultAuthorizedClientManager(); }
Source:
<code><START> public static void checkStringDataLength(Object dataValue) { <END> int length = ((String) dataValue).length(); if (length > JDBC__MAX_VARCHAR_LENGTH) { throw newJdbcException("SQL data value length must be <= %d not %d\nValue: %s", JDBC__MAX_VARCHAR_LENGTH, length, dataValue); } }</code><technical_language>I instance of check in this method. Meaning this method exception of if object is of right type</technical_language>

Target:
private static void checkStringDataLength(Object dataValue) { int length = ((String) dataValue).length(); if (length > JDBC__MAX_VARCHAR_LENGTH) { throw newJdbcException("SQL data value length must be <= %d not %d\nValue: %s", JDBC__MAX_VARCHAR_LENGTH, length, dataValue); } }
Source:
<code>private void stateTransition(State newState, Function<CircuitBreakerState, CircuitBreakerState> newStateGenerator) { CircuitBreakerState previousState = stateReference.getAndUpdate(currentState -> { if (currentState.getState() == newState) { return currentState; } return newStateGenerator.apply(currentState); }); if (previousState.getState() != newState) { publishStateTransitionEvent(StateTransition.transitionBetween(previousState.getState(), newState)); if (circuitBreakerConfig.getEnableAutomaticTransitionFromOpenToHalfOpen() && newState.equals(OPEN)) { <START> OpenToHalfOpenAutoTransitioner.scheduleAutoTransitionToHalfOpen(this); <END> } } }</code><technical_language>OpenToHalfOpenAutoTransitioner.scheduleAutoTransitionToHalfOpen() invoked in Constructor of OpenState</technical_language>

Target:
private void stateTransition(State newState, Function<CircuitBreakerState, CircuitBreakerState> newStateGenerator) { CircuitBreakerState previousState = stateReference.getAndUpdate(currentState -> { if (currentState.getState() == newState) { return currentState; } return newStateGenerator.apply(currentState); }); if (previousState.getState() != newState) { publishStateTransitionEvent(StateTransition.transitionBetween(previousState.getState(), newState)); } }
Source:
<code>public WfsMetadataImpl( Supplier<String> idSupplier, Supplier<String> coordinateOrderSupplier, List<String> featureMemberNodeNames, Class<T> descriptorClass) { this.idSupplier = idSupplier; this.coordinateOrderSupplier = coordinateOrderSupplier; this.descriptorClass = descriptorClass; this.featureMemberNodeNames = featureMemberNodeNames; this.descriptors = new HashSet<>(); <START> if (featureMemberNodeNames != null && featureMemberNodeNames.size() > 0) { <END> this.activeFeatureMemberNodeName = featureMemberNodeNames.get(0); } }</code><technical_language>CollectionUtils.isNotEmpty(featureMemberNodeNames)</technical_language>

Target:
public WfsMetadataImpl( Supplier<String> idSupplier, Supplier<String> coordinateOrderSupplier, List<String> featureMemberNodeNames, Class<T> descriptorClass) { this.idSupplier = idSupplier; this.coordinateOrderSupplier = coordinateOrderSupplier; this.descriptorClass = descriptorClass; this.featureMemberNodeNames = featureMemberNodeNames; this.descriptors = new HashSet<>(); if (CollectionUtils.isNotEmpty(featureMemberNodeNames)) { this.activeFeatureMemberNodeName = featureMemberNodeNames.get(0); } }
Source:
<code>protected Mark parseMark(Node root) { if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest("parsing mark"); } Mark mark = factory.createMark(); mark.setFill(null); mark.setStroke(null); NodeList children = root.getChildNodes(); final int length = children.getLength(); for (int i = 0; i < length; i++) { Node child = children.item(i); if ((child == null) || (child.getNodeType() != Node.ELEMENT_NODE)) { continue; } String childName = child.getLocalName(); if (childName == null) { childName = child.getNodeName(); } if (childName.equalsIgnoreCase(strokeString)) { mark.setStroke(parseStroke(child)); } else if (childName.equalsIgnoreCase(fillSt)) { mark.setFill(parseFill(child)); } else if (childName.equalsIgnoreCase("WellKnownName")) { if (LOGGER.isLoggable(Level.FINEST)) LOGGER.finest("setting mark to " + getFirstChildValue(child)); Expression wellKnownName = parseCssParameter(child); if (wellKnownName instanceof Literal) { String expanded = wellKnownName.evaluate(null, String.class); if (expanded != null && expanded.startsWith("file://")) { URL url = onlineResourceLocator.locateResource(expanded); if (url != null) { wellKnownName = ff.literal(url.toExternalForm()); } } <START> } <END> mark.setWellKnownName(wellKnownName); } } return mark; }</code><technical_language>If resource is right ? I a log warning</technical_language>

Target:
protected Mark parseMark(Node root) { if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest("parsing mark"); } Mark mark = factory.createMark(); mark.setFill(null); mark.setStroke(null); NodeList children = root.getChildNodes(); final int length = children.getLength(); for (int i = 0; i < length; i++) { Node child = children.item(i); if ((child == null) || (child.getNodeType() != Node.ELEMENT_NODE)) { continue; } String childName = child.getLocalName(); if (childName == null) { childName = child.getNodeName(); } if (childName.equalsIgnoreCase(strokeString)) { mark.setStroke(parseStroke(child)); } else if (childName.equalsIgnoreCase(fillSt)) { mark.setFill(parseFill(child)); } else if (childName.equalsIgnoreCase("WellKnownName")) { if (LOGGER.isLoggable(Level.FINEST)) LOGGER.finest("setting mark to " + getFirstChildValue(child)); Expression wellKnownName = parseCssParameter(child); if (wellKnownName instanceof Literal) { String expanded = wellKnownName.evaluate(null, String.class); if (expanded != null && expanded.startsWith("file://")) { URL url = onlineResourceLocator.locateResource(expanded); if (url != null) { wellKnownName = ff.literal(url.toExternalForm()); } else { LOGGER.log( Level.WARNING, "WellKnownName file reference could not be found: " + expanded); } } } mark.setWellKnownName(wellKnownName); } } return mark; }
Source:
<code>FilteredOffset( Offset baseOffset, ColumnSelectorFactory columnSelectorFactory, boolean descending, Filter postFilter, ColumnSelectorBitmapIndexSelector bitmapIndexSelector ) { this.baseOffset = baseOffset; RowOffsetMatcherFactory rowOffsetMatcherFactory = new CursorOffsetHolderRowOffsetMatcherFactory( baseOffset.getBaseReadableOffset(), descending ); if (postFilter instanceof BooleanFilter) { filterMatcher = ((BooleanFilter) postFilter).makeMatcher( bitmapIndexSelector, columnSelectorFactory, rowOffsetMatcherFactory ); } else { <START> if (postFilter.shouldUseIndex(bitmapIndexSelector)) { <END> filterMatcher = rowOffsetMatcherFactory.makeRowOffsetMatcher( postFilter.getBitmapIndex(bitmapIndexSelector) ); } else { filterMatcher = postFilter.makeMatcher(columnSelectorFactory); } } incrementIfNeededOnCreationOrReset(); }</code><technical_language>Please consistent naming: "supportsBitmapIndex" "shouldUseBitmapIndex", names "Bitmap" part</technical_language>

Target:
FilteredOffset( Offset baseOffset, ColumnSelectorFactory columnSelectorFactory, boolean descending, Filter postFilter, ColumnSelectorBitmapIndexSelector bitmapIndexSelector ) { this.baseOffset = baseOffset; RowOffsetMatcherFactory rowOffsetMatcherFactory = new CursorOffsetHolderRowOffsetMatcherFactory( baseOffset.getBaseReadableOffset(), descending ); if (postFilter instanceof BooleanFilter) { filterMatcher = ((BooleanFilter) postFilter).makeMatcher( bitmapIndexSelector, columnSelectorFactory, rowOffsetMatcherFactory ); } else { if (postFilter.shouldUseBitmapIndex(bitmapIndexSelector)) { filterMatcher = rowOffsetMatcherFactory.makeRowOffsetMatcher( postFilter.getBitmapIndex(bitmapIndexSelector) ); } else { filterMatcher = postFilter.makeMatcher(columnSelectorFactory); } } incrementIfNeededOnCreationOrReset(); }
Source:
<code><START> private File getPackageDirectory() { <END> if (packageDirectory != null && !packageDirectory.isEmpty()) { File dir = new File(packageDirectory); if (dir.isAbsolute()) { return dir; } else { File packageDir = new File(project.getBuild().getDirectory(), packageDirectory); return packageDir; } } else { File packageDir = new File(project.getBuild().getDirectory()); return packageDir; } }</code><technical_language>For of returns in this method, I return canonical file, previously returned canonical path</technical_language>

Target:
private File getPackageDirectory() throws IOException { if (packageDirectory != null && !packageDirectory.isEmpty()) { File dir = new File(packageDirectory); if (dir.isAbsolute()) { return dir.getCanonicalFile(); } else { File packageDir = new File(project.getBuild().getDirectory(), packageDirectory); return packageDir.getCanonicalFile(); } } else { File packageDir = new File(project.getBuild().getDirectory()); return packageDir.getCanonicalFile(); } }
Source:
<code><START> public void testToFlowElement_notautostart() throws Exception { <END> final ReusableSubprocess definition = new ReusableSubprocess(); definition.getExecutionSet().setAdHocAutostart(new AdHocAutostart(false)); final View<BaseReusableSubprocess> view = new ViewImpl<>(definition, Bounds.create()); final Node<View<BaseReusableSubprocess>, ?> node = new NodeImpl<>(java.util.UUID.randomUUID().toString()); node.setContent(view); final PropertyWriter propertyWriter = tested.toFlowElement(node); assertTrue(CallActivityPropertyWriter.class.isInstance(propertyWriter)); assertFalse(CustomElement.autoStart.of(propertyWriter.getFlowElement()).get()); }</code><technical_language>Exception is thrown</technical_language>

Target:
public void testToFlowElement_notautostart() { final ReusableSubprocess definition = new ReusableSubprocess(); definition.getExecutionSet().setAdHocAutostart(new AdHocAutostart(false)); final View<BaseReusableSubprocess> view = new ViewImpl<>(definition, Bounds.create()); final Node<View<BaseReusableSubprocess>, ?> node = new NodeImpl<>(java.util.UUID.randomUUID().toString()); node.setContent(view); final PropertyWriter propertyWriter = tested.toFlowElement(node); assertTrue(CallActivityPropertyWriter.class.isInstance(propertyWriter)); assertFalse(CustomElement.autoStart.of(propertyWriter.getFlowElement()).get()); }
Source:
<code>public List<EPerson> findAll(Context context, MetadataField metadataSortField, String sortField, int pageSize, int offset) throws SQLException { String queryString = "SELECT " + EPerson.class.getSimpleName() .toLowerCase() + " FROM EPerson as " + EPerson.class .getSimpleName().toLowerCase(); List<MetadataField> sortFields = Collections.EMPTY_LIST; <START> if (metadataSortField != null) {ItemRestRepositoryIT <END> sortFields = Collections.singletonList(metadataSortField); } Query query = getSearchQuery(context, queryString, null, Collections.EMPTY_LIST, sortFields, sortField, pageSize, offset); return list(query); }</code><technical_language>compilation failure. A random ItemRestRepositoryIT accidentally included here</technical_language>

Target:
public List<EPerson> findAll(Context context, MetadataField metadataSortField, String sortField, int pageSize, int offset) throws SQLException { String queryString = "SELECT " + EPerson.class.getSimpleName() .toLowerCase() + " FROM EPerson as " + EPerson.class .getSimpleName().toLowerCase(); List<MetadataField> sortFields = Collections.EMPTY_LIST; if (metadataSortField != null) { sortFields = Collections.singletonList(metadataSortField); } Query query = getSearchQuery(context, queryString, null, Collections.EMPTY_LIST, sortFields, sortField, pageSize, offset); return list(query); }
Source:
<code>private void initializeAdapter(){ if (adapter == null) { adapter = new CourseOutlineAdapter(getActivity(), environment.getDatabase() <START> , environment.getStorage(), new CourseOutlineAdapter.DownloadListener() { <END> @Override public void download(List<HasDownloadEntry> models) { if (AppConstants.offline_flag) { ((BaseFragmentActivity) getActivity()). showInfoMessage(getString(R.string.wifi_off_message)); } else { downloadManager.downloadVideos( models, getActivity() , (VideoDownloadHelper.DownloadManagerCallback) getActivity()); } } @Override public void download(DownloadEntry videoData) { if (AppConstants.offline_flag) { ((BaseFragmentActivity) getActivity()). showInfoMessage(getString(R.string.wifi_off_message)); } else { downloadManager.downloadVideo( videoData, getActivity() , (VideoDownloadHelper.DownloadManagerCallback) getActivity()); } } @Override public void viewDownloadStatus() { environment.getRouter().showDownloads(getActivity()); } }); } if (!(NetworkUtil.isConnected(getActivity()))) { AppConstants.offline_flag = true; } else { AppConstants.offline_flag = false; } }</code><technical_language>comma end of previous line</technical_language>

Target:
private void initializeAdapter() { if (adapter == null) { adapter = new CourseOutlineAdapter(getActivity(), environment.getDatabase(), environment.getStorage(), new CourseOutlineAdapter.DownloadListener() { @Override public void download(List<HasDownloadEntry> models) { CourseOutlineActivity activity = (CourseOutlineActivity) getActivity(); if (NetworkUtil.verifyDownloadPossible(activity)) { downloadManager.downloadVideos(models, getActivity(), (VideoDownloadHelper.DownloadManagerCallback) getActivity()); } } @Override public void download(DownloadEntry videoData) { CourseOutlineActivity activity = (CourseOutlineActivity) getActivity(); if (NetworkUtil.verifyDownloadPossible(activity)) { downloadManager.downloadVideo(videoData, activity, activity); } } @Override public void viewDownloadsStatus() { environment.getRouter().showDownloads(getActivity()); } }); } AppConstants.offline_flag = !NetworkUtil.isConnected(getActivity()); }
Source:
<code><START> void assertSetEquals(List<String> expected, List<String> actual) { <END> assertEquals(new HashSet<String>(expected), new HashSet<String>(actual)); }</code><technical_language>inject this feature</technical_language>

Target:
void assertSetEquals(List<String> expected, List<String> actual) { assertEquals(new HashSet<>(expected), new HashSet<>(actual)); }
Source:
<code>public void testMultipleBlobClose() throws Exception { String blobUrlPrefix = "test"; long maxBlobSize = AzureBlobAvroWriter.DATAFILEWRITER_OVERHEAD + 1000; long maxRecordsPerBlob = 10; BlobContainerAsyncClient mockContainerClient = PowerMockito.mock(BlobContainerAsyncClient.class); azureBlobAvroWriter = spy(new AzureBlobAvroWriter(mockContainerClient, mock(AzureBlobWriterMetrics.class), threadPool, THRESHOLD, 60000, blobUrlPrefix, mockDataFileWriter, mockAzureBlobOutputStream, mockBlockBlobAsyncClient, maxBlobSize, maxRecordsPerBlob)); DataFileWriter<IndexedRecord> mockDataFileWriter2 = mock(DataFileWriter.class); AzureBlobOutputStream mockAzureBlobOutputStream2 = mock(AzureBlobOutputStream.class); <START> when(mockAzureBlobOutputStream.getSize()).thenReturn((long) 1); when(mockAzureBlobOutputStream.getSize()).thenReturn((long) 1); <END> BlobAsyncClient mockBlobAsyncClient = mock(BlobAsyncClient.class); doReturn(mockBlobAsyncClient).when(mockContainerClient).getBlobAsyncClient(anyString()); doReturn(mockBlockBlobAsyncClient).when(mockBlobAsyncClient).getBlockBlobAsyncClient(); PowerMockito.whenNew(AzureBlobOutputStream.class).withAnyArguments().thenReturn(mockAzureBlobOutputStream2); PowerMockito.whenNew(DataFileWriter.class).withAnyArguments().thenReturn(mockDataFileWriter2); for (int i = 0; i <= maxRecordsPerBlob; i++) { azureBlobAvroWriter.write(ome); } azureBlobAvroWriter.close(); verify(mockAzureBlobOutputStream).close(); verify(mockAzureBlobOutputStream2).close(); verify(mockDataFileWriter).close(); verify(mockDataFileWriter2).close(); }</code><technical_language>lines same. Is intentional</technical_language>

Target:
public void testMultipleBlobClose() throws Exception { String blobUrlPrefix = "test"; long maxBlobSize = AzureBlobAvroWriter.DATAFILEWRITER_OVERHEAD + 1000; long maxRecordsPerBlob = 10; BlobContainerAsyncClient mockContainerClient = PowerMockito.mock(BlobContainerAsyncClient.class); azureBlobAvroWriter = spy(new AzureBlobAvroWriter(mockContainerClient, mock(AzureBlobWriterMetrics.class), threadPool, THRESHOLD, 60000, blobUrlPrefix, mockDataFileWriter, mockAzureBlobOutputStream, mockBlockBlobAsyncClient, maxBlobSize, maxRecordsPerBlob, mockCompression, false)); DataFileWriter<IndexedRecord> mockDataFileWriter2 = mock(DataFileWriter.class); AzureBlobOutputStream mockAzureBlobOutputStream2 = mock(AzureBlobOutputStream.class); when(mockAzureBlobOutputStream.getSize()).thenReturn((long) 1); BlobAsyncClient mockBlobAsyncClient = mock(BlobAsyncClient.class); doReturn(mockBlobAsyncClient).when(mockContainerClient).getBlobAsyncClient(anyString()); doReturn(mockBlockBlobAsyncClient).when(mockBlobAsyncClient).getBlockBlobAsyncClient(); PowerMockito.whenNew(AzureBlobOutputStream.class).withAnyArguments().thenReturn(mockAzureBlobOutputStream2); PowerMockito.whenNew(DataFileWriter.class).withAnyArguments().thenReturn(mockDataFileWriter2); for (int i = 0; i <= maxRecordsPerBlob; i++) { azureBlobAvroWriter.write(ome); } azureBlobAvroWriter.close(); verify(mockDataFileWriter).close(); verify(mockDataFileWriter2).close(); }
Source:
<code>public Iterator getLocations() { <START> return this.cyclicIterator; <END> }</code><technical_language>Please address <LINK_0></technical_language>

Target:
public Iterator<StorageLocation> getLocations() { return new Iterator<StorageLocation>() { private final int numStorageLocations = storageLocations.size(); private int remainingIterations = numStorageLocations; @Override public boolean hasNext() { return remainingIterations > 0; } @Override public StorageLocation next() { if (!hasNext()) { throw new NoSuchElementException(); } remainingIterations--; final StorageLocation nextLocation = storageLocations.get(startIndex.getAndUpdate(n -> (n + 1) % numStorageLocations)); return nextLocation; } }; }
Source:
<code>private void waitForIndexSynced() { List<Cache<String, Object>> caches = caches(); caches.forEach(c -> { SearchManager sm = Search.getSearchManager(c); DataContainer<String, Object> dataContainer = c.getAdvancedCache().getDataContainer(); Map<Class<?>, AtomicInteger> countPerEntity = new HashMap<>(); dataContainer.forEach(e -> { Class<?> entity = e.getValue().getClass(); <START> countPerEntity.computeIfAbsent(entity, aClass -> new AtomicInteger(0)).incrementAndGet(); <END> }); countPerEntity.forEach((entity, count) -> { CacheQuery<Object> q = sm.getQuery("FROM " + entity.getName()); eventually(() -> q.list().size() == count.get()); }); }); }</code><technical_language>do AtomicInteger suggestion countPerEntity.merge(entity, 1, Integer::sum);</technical_language>

Target:
private void waitForIndexSynced() { List<Cache<String, Object>> caches = caches(); caches.forEach(c -> { SearchManager sm = Search.getSearchManager(c); DataContainer<String, Object> dataContainer = c.getAdvancedCache().getDataContainer(); Map<Class<?>, Integer> countPerEntity = new HashMap<>(); dataContainer.forEach(e -> { Class<?> entity = e.getValue().getClass(); countPerEntity.merge(entity, 1, Integer::sum); }); countPerEntity.forEach((entity, count) -> { CacheQuery<Object> q = sm.getQuery("FROM " + entity.getName()); eventually(() -> q.list().size() == count); }); }); }
Source:
<code>private ChannelFuture maybeWriteResponseMetadata() { try { <START> responseMetadataChangeLock.lock(); <END> verifyResponseAlive(); if (!HttpHeaders.isContentLengthSet(responseMetadata)) { HttpHeaders.setTransferEncodingChunked(responseMetadata); } logger .trace("Sending response metadata with status on channel {}", responseMetadata.getStatus(), ctx.channel()); responseMetadataWritten.set(true); return writeToChannel(responseMetadata, ChannelWriteType.Unsafe); } catch (Exception e) { return ctx.newFailedFuture(e); } finally { responseMetadataChangeLock.unlock(); } }</code><technical_language>callers check for responseMetadataWritten.get(), I check is cleaner</technical_language>

Target:
private ChannelFuture maybeWriteResponseMetadata() { responseMetadataChangeLock.lock(); try { verifyResponseMetadataAlive(); if (!HttpHeaders.isContentLengthSet(responseMetadata)) { HttpHeaders.setTransferEncodingChunked(responseMetadata); } logger .trace("Sending response metadata with status on channel {}", responseMetadata.getStatus(), ctx.channel()); responseMetadataWritten.set(true); return writeToChannel(responseMetadata, ChannelWriteType.Unsafe); } catch (Exception e) { return ctx.newFailedFuture(e); } finally { responseMetadataChangeLock.unlock(); } }
Source:
<code>public void visit(NodeTraversal t, Node n, Node parent) { if (n.isCall() && n.getChildCount() == 2 && n.getFirstChild().matchesQualifiedName("require") && n.getChildAtIndex(1).isString()) { visitRequireCall(t, n, parent); } if (n.isIf()) { FindModuleExportsOrExports commonjsFinder = new FindModuleExportsOrExports(); <START> NodeTraversal.traverse(compiler, n.getFirstChild(), commonjsFinder); <END> if (commonjsFinder.isFound()) { visitCommonJSIfCondition(n); } else { FindDefineAMD amdFinder = new FindDefineAMD(); NodeTraversal.traverse(compiler, n.getFirstChild(), amdFinder); if (amdFinder.isFound()) { visitAMDIfCondition(n); } } } if (n.isScript()) { scriptNodeCount++; visitScript(t, n); } if (n.isGetProp() && "module.exports".equals(n.getQualifiedName())) { Var v = t.getScope().getVar(MODULE); if (v == null) { moduleExportRefs.add(n); } } if (n.isName() && EXPORTS.equals(n.getString())) { Var v = t.getScope().getVar(n.getString()); if (v == null || v.isGlobal()) { exportRefs.add(n); } } }</code><technical_language>pulling out n.getFirstChild() a variable condition this code more readable</technical_language>

Target:
public void visit(NodeTraversal t, Node n, Node parent) { if (n.isCall() && n.getChildCount() == 2 && n.getFirstChild().matchesQualifiedName("require") && n.getChildAtIndex(1).isString()) { visitRequireCall(t, n, parent); } if (n.isIf()) { FindModuleExportStatements commonjsFinder = new FindModuleExportStatements(); Node condition = n.getFirstChild(); NodeTraversal.traverse(compiler, condition, commonjsFinder); if (commonjsFinder.isFound()) { visitCommonJSIfStatement(n); } else { FindDefineAmdStatements amdFinder = new FindDefineAmdStatements(); NodeTraversal.traverse(compiler, condition, amdFinder); if (amdFinder.isFound()) { visitAMDIfStatement(n); } } } if (n.isScript()) { scriptNodeCount++; visitScript(t, n); } if (n.isGetProp() && "module.exports".equals(n.getQualifiedName())) { Var v = t.getScope().getVar(MODULE); if (v == null) { moduleExportRefs.add(n); } } if (n.isName() && EXPORTS.equals(n.getString())) { Var v = t.getScope().getVar(n.getString()); if (v == null || v.isGlobal()) { exportRefs.add(n); } } }
Source:
<code><START> @Override public ListServicesCmd.Exec createListServicesCmdExec() { <END> return new ListServicesCmdExec(getBaseResource(), getDockerClientConfig()); }</code><technical_language>oneline annotation</technical_language>

Target:
public ListServicesCmd.Exec createListServicesCmdExec() { return new ListServicesCmdExec(getBaseResource(), getDockerClientConfig()); }
Source:
<code>public void testErrorMessage() { String[] cmd = TestUtil.getJavaCommand(RepeatTextWithTimeout.class, "2", "1000", "Hello, World"); boolean failed = false; try { PtyProcess.exec(cmd); } catch (IOException e) { <START> failed = true; <END> } Assert.assertTrue("Library should be failed to loaded unless -DPTY_LIB_FOLDER=os specified", failed); }</code><technical_language>nicer JUnit4 syntax like: @Test(expected = IOException.class)</technical_language>

Target:
public void testErrorMessage() throws IOException { TestUtil.unsetLocalPtyLib(); String[] cmd = TestUtil.getJavaCommand(RepeatTextWithTimeout.class, "2", "1000", "Hello, World"); PtyProcess.exec(cmd); }
Source:
<code>public Comparator<String> getComparator() { <START> return Ordering.natural(); <END> }</code><technical_language>Comparator.naturalOrder(). BTW in similar situation null-aware comparator is used. if null-awareness is needed</technical_language>

Target:
public Comparator<String> getComparator() { return Comparator.nullsFirst(Comparator.naturalOrder()); }