auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Constraint fairAssignmentCountPerTeam(ConstraintFactory constraintFactory) { <START> return constraintFactory.from(TeamAssignment.class) <END> .filter(teamAssignment -> teamAssignment.getTeam() != null) .groupBy(TeamAssignment::getTeam, loadBalanceByCount()) .penalize("fairAssignmentCountPerTeam", HardMediumSoftScore.ONE_MEDIUM, (team, result) -> (int) (Math.sqrt(((Long[])result)[1]) * 1000.0)); }</code><technical_language>code style: space //</technical_language>

Target:
private Constraint fairAssignmentCountPerTeam(ConstraintFactory constraintFactory) { return constraintFactory.from(TeamAssignment.class) .groupBy(TeamAssignment::getTeam, loadBalanceByCount()) .penalize("fairAssignmentCountPerTeam", HardMediumSoftScore.ONE_MEDIUM, (team, result) -> (int) (Math.sqrt(((long[])result)[1]) * 1000.0)); }
Source:
<code>private CompletableFuture<Boolean> connectAsync() { final CompletableFuture<Boolean> completableFuture = new CompletableFuture<>(); Executors.newSingleThreadExecutor() <START> .submit( <END> () -> { boolean connected; try { connected = client.connectBlocking(DEFAULT_CONNECT_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); } catch (final InterruptedException ignored) { connected = false; } return completableFuture.complete(connected); }); return completableFuture; }</code><technical_language>In this case want Thread constructor directly, indirection thread executor overhead a FutureReturnValueIgnored warning</technical_language>

Target:
private CompletableFuture<Boolean> connectAsync() { final CompletableFuture<Boolean> completableFuture = new CompletableFuture<>(); new Thread( () -> { boolean connected; try { connected = client.connectBlocking(DEFAULT_CONNECT_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); } catch (final InterruptedException ignored) { connected = false; } completableFuture.complete(connected); }) .start(); return completableFuture; }
Source:
<code>public MatchResult detailMatches(PlanNode node, PlanNodeCost cost, Session session, Metadata metadata, SymbolAliases symbolAliases) { checkState(shapeMatches(node), "Plan testing framework error: shapeMatches returned false in detailMatches in %s", this.getClass().getName()); IndexSourceNode indexSourceNode = (IndexSourceNode) node; TableMetadata tableMetadata = metadata.getTableMetadata(session, indexSourceNode.getTableHandle()); String actualTableName = tableMetadata.getTable().getTableName(); return new MatchResult( expectedTableName.equalsIgnoreCase(actualTableName) && ((!expectedConstraint.isPresent()) || <START> domainsMatch(expectedConstraint, indexSourceNode.getEffectiveTupleDomain(), indexSourceNode.getTableHandle(), session, metadata))); <END> }</code><technical_language>separate parameters new lines</technical_language>

Target:
public MatchResult detailMatches(PlanNode node, PlanNodeCost cost, Session session, Metadata metadata, SymbolAliases symbolAliases) { checkState(shapeMatches(node), "Plan testing framework error: shapeMatches returned false in detailMatches in %s", this.getClass().getName()); IndexSourceNode indexSourceNode = (IndexSourceNode) node; TableMetadata tableMetadata = metadata.getTableMetadata(session, indexSourceNode.getTableHandle()); String actualTableName = tableMetadata.getTable().getTableName(); if (!expectedTableName.equalsIgnoreCase(actualTableName)) { return NO_MATCH; } if (expectedConstraint.isPresent() && !domainsMatch( expectedConstraint, indexSourceNode.getEffectiveTupleDomain(), indexSourceNode.getTableHandle(), session, metadata)) { return NO_MATCH; } return match(); }
Source:
<code>public static MapfishMapContext createMapContext(final MapAttributeValues mapValues) { final Dimension mapSize = mapValues.getMapSize(); Rectangle paintArea = new Rectangle(mapSize); final double dpi = mapValues.getDpi(); MapBounds bounds = mapValues.getMapBounds(); bounds = adjustBoundsToScaleAndMapSize(mapValues, paintArea, bounds, dpi); final double dpiRatio = dpi / PDF_DPI; paintArea.setBounds(0, 0, (int) (mapSize.getWidth() * dpiRatio), <START> (int) (mapSize.getHeight() * dpiRatio)); <END> return new MapfishMapContext(bounds, paintArea.getSize(), mapValues.getRotation(), dpi, mapValues.longitudeFirst, mapValues.isDpiSensitiveStyle()); }</code><technical_language>a Math.ceil parameters</technical_language>

Target:
public static MapfishMapContext createMapContext(final MapAttributeValues mapValues) { final Dimension mapSize = mapValues.getMapSize(); Rectangle paintArea = new Rectangle(mapSize); final double dpi = mapValues.getDpi(); MapBounds bounds = mapValues.getMapBounds(); bounds = adjustBoundsToScaleAndMapSize(mapValues, paintArea, bounds, dpi); final double dpiRatio = dpi / PDF_DPI; paintArea.setBounds(0, 0, (int) Math.ceil(mapSize.getWidth() * dpiRatio), (int) Math.ceil(mapSize.getHeight() * dpiRatio)); return new MapfishMapContext(bounds, paintArea.getSize(), mapValues.getRotation(), dpi, mapValues.longitudeFirst, mapValues.isDpiSensitiveStyle()); }
Source:
<code>public void closeAsync() throws IOException { if (anyAreSet(state, FLAG_CLOSED) || servletRequestContext.getOriginalResponse().isTreatAsCommitted()) { return; } if (!servletRequestContext.getExchange().isInIoThread()) { servletRequestContext.getExchange().getIoThread().execute(new Runnable() { @Override public void run() { try { closeAsync(); } catch (IOException e) { <START> throw new RuntimeException(e); <END> } } }); return; } try { state |= FLAG_CLOSED; state &= ~FLAG_READY; if (allAreClear(state, FLAG_WRITE_STARTED) && channel == null) { if (servletRequestContext.getOriginalResponse().getHeader(Headers.TRANSFER_ENCODING_STRING) == null) { if (buffer == null) { servletRequestContext.getOriginalResponse().setHeader(Headers.CONTENT_LENGTH, "0"); } else { servletRequestContext.getOriginalResponse().setHeader(Headers.CONTENT_LENGTH, Integer.toString(buffer.position())); } } } createChannel(); if (buffer != null) { if (!flushBufferAsync(true)) { return; } if (pooledBuffer != null) { pooledBuffer.close(); buffer = null; } else { buffer = null; } } channel.shutdownWrites(); state |= FLAG_DELEGATE_SHUTDOWN; if (!channel.flush()) { channel.resumeWrites(); } } catch (IOException e) { if (pooledBuffer != null) { pooledBuffer.close(); pooledBuffer = null; buffer = null; } throw e; } }</code><technical_language>log IO logger</technical_language>

Target:
public void closeAsync() throws IOException { if (anyAreSet(state, FLAG_CLOSED) || servletRequestContext.getOriginalResponse().isTreatAsCommitted()) { return; } if (!servletRequestContext.getExchange().isInIoThread()) { servletRequestContext.getExchange().getIoThread().execute(new Runnable() { @Override public void run() { try { closeAsync(); } catch (IOException e) { UndertowLogger.REQUEST_IO_LOGGER.closeAsyncFailed(e); } } }); return; } try { state |= FLAG_CLOSED; state &= ~FLAG_READY; if (allAreClear(state, FLAG_WRITE_STARTED) && channel == null) { if (servletRequestContext.getOriginalResponse().getHeader(Headers.TRANSFER_ENCODING_STRING) == null) { if (buffer == null) { servletRequestContext.getOriginalResponse().setHeader(Headers.CONTENT_LENGTH, "0"); } else { servletRequestContext.getOriginalResponse().setHeader(Headers.CONTENT_LENGTH, Integer.toString(buffer.position())); } } } createChannel(); if (buffer != null) { if (!flushBufferAsync(true)) { return; } if (pooledBuffer != null) { pooledBuffer.close(); buffer = null; } else { buffer = null; } } channel.shutdownWrites(); state |= FLAG_DELEGATE_SHUTDOWN; if (!channel.flush()) { channel.resumeWrites(); } } catch (IOException e) { if (pooledBuffer != null) { pooledBuffer.close(); pooledBuffer = null; buffer = null; } throw e; } }
Source:
<code>public void shouldCommunicateWithHermesUsingHttp2() { <START> SSLContextSupplier sslSupplier = getSslContextSupplier(); <END> HermesClient client = hermesClient(new OkHttpSender(sslSupplier.get())).withURI(topicURI_SSL).build(); HermesResponse response = client.publish(topic.qualifiedName(), message.body()).join(); assertThat(response.getHeader("OkHttp-Selected-Protocol")).isEqualTo("h2"); }</code><technical_language>do need SSLContextSupplier here? SSLContextSupplier#get is called (in tests), private method call get return</technical_language>

Target:
public void shouldCommunicateWithHermesUsingHttp2() { HermesClient client = hermesClient(new OkHttpHermesSender(getOkHttpClientWithSslContextConfigured())).withURI(sslTopicUri).build(); HermesResponse response = client.publish(topic.qualifiedName(), message.body()).join(); assertThat(response.getHeader("OkHttp-Selected-Protocol")).isEqualTo("h2"); }
Source:
<code>public Bundle getBundle(String symbolicName) { <START> State systemState = getPlatformAdmin().getState(false); BundleDescription bundleDescriptor = systemState.getBundle(symbolicName, null); if (bundleDescriptor != null) { Bundle bundle = bundleDescriptor.getBundle(); <END> if ((bundle.getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) { return bundle; } } return null; }</code><technical_language>Do equinox resolver/state API. some point I deprecate that</technical_language>

Target:
public Bundle getBundle(String symbolicName) { Bundle[] bundles = getBundles(symbolicName, null); return bundles != null && bundles.length > 0 ? bundles[0] : null; }
Source:
<code>public DeterministicKeyChain(DeterministicKey watchingKey, long creationTimeSeconds) { <START> checkArgument(!watchingKey.hasPrivKey(), "Private subtrees not currently supported"); <END> checkArgument(watchingKey.getPath().size() == 1, "You can only watch an account key currently"); basicKeyChain = new BasicKeyChain(); this.creationTimeSeconds = creationTimeSeconds; this.seed = null; initializeHierarchyUnencrypted(watchingKey); }</code><technical_language>this correct? isPubKeyOnly return false for a watching key</technical_language>

Target:
public DeterministicKeyChain(DeterministicKey watchingKey, long creationTimeSeconds) { checkArgument(watchingKey.isPubKeyOnly(), "Private subtrees not currently supported"); checkArgument(watchingKey.getPath().size() == 1, "You can only watch an account key currently"); basicKeyChain = new BasicKeyChain(); this.creationTimeSeconds = creationTimeSeconds; this.seed = null; initializeHierarchyUnencrypted(watchingKey); }
Source:
<code>private HttpMethod runMethod(HttpMessage msg, boolean isFollowRedirect, HttpMethodParams params) throws IOException { HttpMethod method = null; modifyUserAgent(msg); method = helper.createRequestMethod(msg.getRequestHeader(), msg.getRequestBody(), params); if (!(method instanceof EntityEnclosingMethod) || method instanceof ZapGetMethod) { method.setFollowRedirects(isFollowRedirect); } <START> updateCookieState(); <END> User forceUser = this.getUser(msg); if (forceUser != null) { this.executeMethod(method, forceUser.getCorrespondingHttpState()); } else { this.executeMethod(method, client.getState()); } HttpMethodHelper.updateHttpRequestHeaderSent(msg.getRequestHeader(), method); return method; }</code><technical_language>Is this needed? state/settings properly set always</technical_language>

Target:
private HttpMethod runMethod(HttpMessage msg, boolean isFollowRedirect, HttpMethodParams params) throws IOException { HttpMethod method = null; modifyUserAgent(msg); method = helper.createRequestMethod(msg.getRequestHeader(), msg.getRequestBody(), params); if (!(method instanceof EntityEnclosingMethod) || method instanceof ZapGetMethod) { method.setFollowRedirects(isFollowRedirect); } User forceUser = this.getUser(msg); if (forceUser != null) { this.executeMethod(method, forceUser.getCorrespondingHttpState()); } else { this.executeMethod(method, null); } HttpMethodHelper.updateHttpRequestHeaderSent(msg.getRequestHeader(), method); return method; }
Source:
<code>public void aggregate(final ByteBuffer buf, final int position) { final ArrayOfDoublesSketch update = selector.getObject(); if (update == null) { return; } <START> final WritableMemory mem = WritableMemory.wrap(buf); <END> final WritableMemory region = mem.writableRegion(position, maxIntermediateSize); final ArrayOfDoublesUnion union = ArrayOfDoublesSketches.wrapUnion(region); union.update(update); }</code><technical_language>Consider similar optimization e. g. in SketchBufferAggregator</technical_language>

Target:
public void aggregate(final ByteBuffer buf, final int position) { final ArrayOfDoublesSketch update = selector.getObject(); if (update == null) { return; } final WritableMemory mem = WritableMemory.wrap(buf); final WritableMemory region = mem.writableRegion(position, maxIntermediateSize); final Lock lock = stripedLock.getAt(ArrayOfDoublesSketchBuildBufferAggregator.lockIndex(position)).writeLock(); lock.lock(); try { final ArrayOfDoublesUnion union = ArrayOfDoublesSketches.wrapUnion(region); union.update(update); } finally { lock.unlock(); } }
Source:
<code>private Portal getPortalData(String name, LocationWrapper first, LocationWrapper second) { try (Connection connection = db.getConnection(); PreparedStatement getPortalData = connection.prepareStatement(DatabaseManager.getPortalData);) { getPortalData.setString(1, name); ResultSet set = getPortalData.executeQuery(); if (!set.next()) return null; int specialId = set.getInt("portal_type"); String serverName = set.getString("server_name"); String partner = set.getString("partner_id"); PortalLoadEvent event = new PortalLoadEvent(name, specialId, serverName, partner, first, second); Bukkit.getPluginManager().callEvent(event); if (event.getPortal() == null) return null; <START> return event.getPortal(); <END> } catch (SQLException e) { logger.log(Level.SEVERE, "Failed to getPortalData for {0}", name); logger.log(Level.SEVERE, "Failed to getPortalData, exception:", e); } return null; }</code><technical_language>want API offer changing portal loaded? means if I request a portal name "XYZ" database, I get else, of listeners interferring. careful separate database storage gameplay mechanics here</technical_language>

Target:
private Portal getPortalData(String name, LocationWrapper first, LocationWrapper second) { try (Connection connection = db.getConnection(); PreparedStatement getPortalData = connection.prepareStatement(DatabaseManager.getPortalData);) { getPortalData.setString(1, name); ResultSet set = getPortalData.executeQuery(); if (!set.next()) return null; int specialId = set.getInt("portal_type"); String serverName = set.getString("server_name"); String partner = set.getString("partner_id"); boolean currentServer = serverName.equals(MercuryAPI.serverName()); PortalFactory factory = BetterShardsPlugin.getPortalManager().getPortalFactory(); Class<? extends Portal> clazz = factory.getPortal(specialId); Portal p = factory.buildPortal(clazz); p.setName(name); p.setIsOnCurrentServer(true); p.setServerName(MercuryAPI.serverName()); p.setFirstLocation(first); p.setSecondLocation(second); p.setPartnerPortal(partner); p.valuesPopulated(); return p; } catch (SQLException e) { logger.log(Level.SEVERE, "Failed to getPortalData for {0}", name); logger.log(Level.SEVERE, "Failed to getPortalData, exception:", e); } return null; }
Source:
<code>private void assertLatestScheduledVerticesAreEqualTo(final List<TestingSchedulingExecutionVertex> expected) { final List<List<ExecutionVertexDeploymentOption>> deploymentOptions = testingSchedulerOperation.getScheduledVertices(); <START> assertThat(expected.size(), Matchers.lessThanOrEqualTo(deploymentOptions.size())); <END> for (int i = 0; i < expected.size(); i++) { assertEquals( idsFromVertices(Collections.singletonList(expected.get(expected.size() - i - 1))), idsFromDeploymentOptions(deploymentOptions.get(deploymentOptions.size() - i - 1))); } }</code><technical_language>add static import matchers</technical_language>

Target:
private void assertLatestScheduledVerticesAreEqualTo(final List<TestingSchedulingExecutionVertex> expected) { final List<List<ExecutionVertexDeploymentOption>> deploymentOptions = testingSchedulerOperation.getScheduledVertices(); assertThat(expected.size(), lessThanOrEqualTo(deploymentOptions.size())); for (int i = 0; i < expected.size(); i++) { assertEquals( idsFromVertices(Collections.singletonList(expected.get(expected.size() - i - 1))), idsFromDeploymentOptions(deploymentOptions.get(deploymentOptions.size() - i - 1))); } }
Source:
<code>public Response createFromYaml(String data) throws ServerException, ConflictException, NotFoundException, ValidationException, BadRequestException { throw new BadRequestException( <START> "This is an outdated method please use /api/workspace/devfile to create a new workspace"); <END> }</code><technical_language>Run-on sentence; explain user other api. Preferred: "This method is deprecated removed time. Please ..."</technical_language>

Target:
public Response createFromYaml(String data) throws ServerException, ConflictException, NotFoundException, ValidationException, BadRequestException { throw new BadRequestException( "This method is deprecated and may be removed at any time. Please use /api/workspace/devfile to create a new workspace"); }
Source:
<code>private int outputTest(StringBuilder buffer, TestResult failedTest, boolean showStack, boolean showMessage, int lengthLeft) { StringBuilder local = new StringBuilder(); local.append(failedTest.isPassed() ? "PASSED" : "FAILED").append(": "); if(failedTest instanceof CaseResult) { local.append(((CaseResult)failedTest).getClassName()); } else { local.append(failedTest.getFullName()); } local.append('.').append(failedTest.getDisplayName()).append('\n'); if (showMessage) { String errorDetails = escapeHtml ? escapeHtml(failedTest.getErrorDetails()) : failedTest.getErrorDetails(); local.append("\nError Message:\n").append(errorDetails).append('\n'); } if (showStack) { String stackTrace = escapeHtml ? escapeHtml(failedTest.getErrorStackTrace()) : failedTest.getErrorStackTrace(); <START> local.append("\nStack Trace:\n").append(stackTrace).append('\n'); <END> } if (showMessage || showStack) { local.append('\n'); } if(local.length() > lengthLeft) { local.setLength(lengthLeft); } buffer.append(local.toString()); return local.length(); }</code><technical_language>escapeHtml, want <br/> instead of \n in strings</technical_language>

Target:
private int outputTest(StringBuilder buffer, TestResult failedTest, boolean showStack, boolean showMessage, int lengthLeft) { StringBuilder local = new StringBuilder(); String lineBreak = getLineBreak(); local.append(failedTest.isPassed() ? "PASSED" : "FAILED").append(": "); if(failedTest instanceof CaseResult) { local.append(((CaseResult)failedTest).getClassName()); } else { local.append(failedTest.getFullName()); } local.append('.').append(failedTest.getDisplayName()).append(lineBreak); if (showMessage) { String errorDetails = escapeHtml ? escapeHtml(failedTest.getErrorDetails()) : failedTest.getErrorDetails(); local.append(lineBreak).append("Error Message:").append(lineBreak).append(errorDetails).append(lineBreak); } if (showStack) { String stackTrace = escapeHtml ? escapeHtml(failedTest.getErrorStackTrace()) : failedTest.getErrorStackTrace(); local.append(lineBreak).append("Stack Trace:").append(lineBreak).append(stackTrace).append(lineBreak); } if (showMessage || showStack) { local.append(lineBreak); } if(local.length() > lengthLeft) { local.setLength(lengthLeft); } buffer.append(local.toString()); return local.length(); }
Source:
<code>public ApiAuthenticationResult authenticate(HttpRequest httpRequest) { Assert.notNull(httpRequest, "httpRequest argument cannot be null."); if (ServletHttpRequest.class.isAssignableFrom(httpRequest.getClass())){ <START> this.httpRequest = (ServletHttpRequest) httpRequest; <END> } else { Assert.isInstanceOf(HttpRequest.class, httpRequest, "The specified httpRequest argument must be an instance of " + HttpRequest.class.getName() + " or " + ServletHttpRequest.class.getName()); this.httpRequest = httpRequest; } return this.execute(); }</code><technical_language>wrong casting</technical_language>

Target:
public ApiAuthenticationResult authenticate(HttpRequest httpRequest) { Assert.notNull(httpRequest, "httpRequest argument cannot be null."); if (ServletHttpRequest.class.isAssignableFrom(httpRequest.getClass())){ this.httpRequest = httpRequest; } else { Assert.isInstanceOf(HttpRequest.class, httpRequest, "The specified httpRequest argument must be an instance of " + HttpRequest.class.getName() + " or " + ServletHttpRequest.class.getName()); this.httpRequest = httpRequest; } return this.execute(); }
Source:
<code>public CapabilityCollection(AccessSection section) { if (section == null) { section = new AccessSection(AccessSection.GLOBAL_CAPABILITIES); } Map<String, List<PermissionRule>> tmp = new HashMap<>(); for (Permission permission : section.getPermissions()) { for (PermissionRule rule : permission.getRules()) { if (!permission.getName().equals(GlobalCapability.EMAIL_REVIEWERS) && rule.getAction() == PermissionRule.Action.DENY) { continue; } List<PermissionRule> r = tmp.get(permission.getName()); if (r == null) { r = new ArrayList<>(2); tmp.put(permission.getName(), r); } r.add(rule); } } configureDefaults(tmp, section); Map<String, List<PermissionRule>> res = new HashMap<>(); for (Map.Entry<String, List<PermissionRule>> e : tmp.entrySet()) { List<PermissionRule> rules = e.getValue(); if (rules.size() == 1) { res.put(e.getKey(), Collections.singletonList(rules.get(0))); } else { res.put(e.getKey(), Collections.unmodifiableList( Arrays.asList(rules.toArray(new PermissionRule[rules.size()])))); } } permissions = Collections.unmodifiableMap(res); administrateServer = getPermission(GlobalCapability.ADMINISTRATE_SERVER); emailReviewers = getPermission(GlobalCapability.EMAIL_REVIEWERS); priority = getPermission(GlobalCapability.PRIORITY); queryLimit = getPermission(GlobalCapability.QUERY_LIMIT); <START> batchChangesLimit = getPermission(GlobalCapability.BATCH_CHANGES_LIMIT); <END> }</code><technical_language>Ordering</technical_language>

Target:
public CapabilityCollection(AccessSection section) { if (section == null) { section = new AccessSection(AccessSection.GLOBAL_CAPABILITIES); } Map<String, List<PermissionRule>> tmp = new HashMap<>(); for (Permission permission : section.getPermissions()) { for (PermissionRule rule : permission.getRules()) { if (!permission.getName().equals(GlobalCapability.EMAIL_REVIEWERS) && rule.getAction() == PermissionRule.Action.DENY) { continue; } List<PermissionRule> r = tmp.get(permission.getName()); if (r == null) { r = new ArrayList<>(2); tmp.put(permission.getName(), r); } r.add(rule); } } configureDefaults(tmp, section); Map<String, List<PermissionRule>> res = new HashMap<>(); for (Map.Entry<String, List<PermissionRule>> e : tmp.entrySet()) { List<PermissionRule> rules = e.getValue(); if (rules.size() == 1) { res.put(e.getKey(), Collections.singletonList(rules.get(0))); } else { res.put(e.getKey(), Collections.unmodifiableList( Arrays.asList(rules.toArray(new PermissionRule[rules.size()])))); } } permissions = Collections.unmodifiableMap(res); administrateServer = getPermission(GlobalCapability.ADMINISTRATE_SERVER); batchChangesLimit = getPermission(GlobalCapability.BATCH_CHANGES_LIMIT); emailReviewers = getPermission(GlobalCapability.EMAIL_REVIEWERS); priority = getPermission(GlobalCapability.PRIORITY); queryLimit = getPermission(GlobalCapability.QUERY_LIMIT); }
Source:
<code>public SizeCommand(Cache<Object, ?> cache, long flags) { setFlagsBitSet(flags); AdvancedCache<Object, ?> advancedCache = cache.getAdvancedCache(); if (flags != EnumUtil.EMPTY_BIT_SET) { advancedCache = advancedCache.withFlags(EnumUtil.enumArrayOf(flags, Flag.class)); } this.cache = advancedCache.getCacheConfiguration().memory().storageType() == StorageType.OBJECT ? <START> advancedCache : advancedCache.withEncoding(IdentityEncoder.class); <END> }</code><technical_language>FYI, this logic is part of <LINK_0>, avoid creating new instances if requested encoding is in place</technical_language>

Target:
public SizeCommand(Cache<Object, ?> cache, long flags) { setFlagsBitSet(flags); AdvancedCache<Object, ?> advancedCache = cache.getAdvancedCache(); if (flags != EnumUtil.EMPTY_BIT_SET) { advancedCache = advancedCache.withFlags(EnumUtil.enumArrayOf(flags, Flag.class)); } this.cache = advancedCache.withEncoding(IdentityEncoder.class); }
Source:
<code>public TextBoxLabel() { super(new EmptyValueRenderer<String>() { @Override public String render(String value) { <START> String renderedText = super.render(value); <END> return renderedText; } }); }</code><technical_language>in case removing SafeHtmlUtils.htmlEscape(renderedText); do need override render() method. Please only: super(new EmptyValueRenderer<String>());</technical_language>

Target:
public TextBoxLabel() { super(new EmptyValueRenderer<String>()); }
Source:
<code>private void updateStoragePoolFormatType() { final storage_pool storagePool = getStoragePool(); final Guid spId = storagePool.getId(); final VDSBrokerFrontend resourceManager = Backend.getInstance().getResourceManager(); final Version spVersion = storagePool.getcompatibility_version(); final Version oldSpVersion = _oldStoragePool.getcompatibility_version(); if (Version.OpEquality(spVersion, oldSpVersion)) { return; } StorageFormatType targetFormat = StorageFormatType.V1; if (spVersion.compareTo(Version.v3_0) == 0) { targetFormat = StorageFormatType.V2; } else if (spVersion.compareTo(Version.v3_1) == 0) { targetFormat = StorageFormatType.V3; <START> } <END> StorageType spType = storagePool.getstorage_pool_type(); if (targetFormat == StorageFormatType.V2 && spType != StorageType.ISCSI && spType != StorageType.FCP) { return; } storagePool.setStoragePoolFormatType(targetFormat); getStoragePoolDAO().update(storagePool); updateMemberDomainsFormat(targetFormat); if (storagePool.getstatus() != StoragePoolStatus.Up) { return; } UpgradeStoragePoolVDSCommandParameters parameters = new UpgradeStoragePoolVDSCommandParameters(spId, targetFormat); resourceManager.RunVdsCommand( VDSCommandType.UpgradeStoragePool, parameters); }</code><technical_language>please configuration version values (it save per-version checks)</technical_language>

Target:
private void updateStoragePoolFormatType() { final storage_pool storagePool = getStoragePool(); final Guid spId = storagePool.getId(); final Version spVersion = storagePool.getcompatibility_version(); final Version oldSpVersion = _oldStoragePool.getcompatibility_version(); if (Version.OpEquality(spVersion, oldSpVersion)) { return; } StorageFormatType targetFormat = StorageFormatType.V1; if (spVersion.compareTo(Version.v3_0) == 0) { targetFormat = StorageFormatType.V2; } else if (spVersion.compareTo(Version.v3_1) == 0) { targetFormat = StorageFormatType.V3; } StorageType spType = storagePool.getstorage_pool_type(); if (targetFormat == StorageFormatType.V2 && spType != StorageType.ISCSI && spType != StorageType.FCP) { return; } storagePool.setStoragePoolFormatType(targetFormat); getStoragePoolDAO().update(storagePool); updateMemberDomainsFormat(targetFormat); if (storagePool.getstatus() != StoragePoolStatus.Up) { return; } UpgradeStoragePoolVDSCommandParameters parameters = new UpgradeStoragePoolVDSCommandParameters(spId, targetFormat); if (getStoragePool().getstatus() == StoragePoolStatus.Up) { runVdsCommand(VDSCommandType.UpgradeStoragePool, parameters); } }
Source:
<code>public Collection<Unit> getTargetUnits() { <START> return Collections.unmodifiableCollection(targetUnits); <END> }</code><technical_language>I if callers avoid mutating return and/or copy needed. If skip defensive copy, a performance improvement simpler code in this class a simpler getter do</technical_language>

Target:
public Collection<Unit> getTargetUnits() { return targetUnits; }
Source:
<code>public void registerIn(final ActionRegistry registry) { registry.register(ChangeAttributeMetadataCommand.class, new CommandHandler<ChangeAttributeMetadataCommand>() { @Override public void handleCommand(final ChangeAttributeMetadataCommand command, final List response) { final Attribute attribute = getServerModelStore().findAttributeById(command.getAttributeId()); if (attribute == null) { <START> LOG.debug("Cannot find attribute with id '{}'. Metadata remains unchanged.", command.getAttributeId()); <END> return; } ((ServerAttribute) attribute).silently(new Runnable() { @Override public void run() { if(command.getMetadataName().equals(Attribute.VALUE_NAME)) { attribute.setValue(command.getValue()); } else if(command.getMetadataName().equals(Attribute.QUALIFIER_NAME)) { if(command.getValue() == null) { ((ServerAttribute) attribute).setQualifier(null); } else { ((ServerAttribute) attribute).setQualifier(command.getValue().toString()); } } else { throw new RuntimeException("Metadata type wrong!"); } } }); } }); }</code><technical_language>This warn</technical_language>

Target:
public void registerIn(final ActionRegistry registry) { registry.register(ChangeAttributeMetadataCommand.class, new CommandHandler<ChangeAttributeMetadataCommand>() { @Override public void handleCommand(final ChangeAttributeMetadataCommand command, final List response) { final Attribute attribute = getServerModelStore().findAttributeById(command.getAttributeId()); if (attribute == null) { LOG.warn("Cannot find attribute with id '{}'. Metadata remains unchanged.", command.getAttributeId()); return; } ((ServerAttribute) attribute).silently(new Runnable() { @Override public void run() { if(command.getMetadataName().equals(Attribute.VALUE_NAME)) { attribute.setValue(command.getValue()); } else if(command.getMetadataName().equals(Attribute.QUALIFIER_NAME)) { if(command.getValue() == null) { ((ServerAttribute) attribute).setQualifier(null); } else { ((ServerAttribute) attribute).setQualifier(command.getValue().toString()); } } else { throw new RuntimeException("Metadata type wrong!"); } } }); } }); }
Source:
<code>public static ClusteringServiceConfigurationBuilder seededFrom(ClusteringServiceConfiguration configuration) { ServerSideConfiguration serverSideConfiguration = configuration.getServerConfiguration(); if (serverSideConfiguration == null) { return new ClusteringServiceConfigurationBuilder(configuration.getConnectionSource(), configuration.getTimeouts(), configuration.isAutoCreate(), null, configuration.getProperties()); } else { <START> ServerSideConfigurationBuilder serverSideBuilder = new ServerSideConfigurationBuilder().defaultServerResource(serverSideConfiguration.getDefaultServerResource()); <END> for (Map.Entry<String, ServerSideConfiguration.Pool> poolEntry : serverSideConfiguration.getResourcePools().entrySet()) { serverSideBuilder = serverSideBuilder.resourcePool(poolEntry.getKey(), poolEntry.getValue()); } return new ClusteringServiceConfigurationBuilder(configuration.getConnectionSource(), configuration.getTimeouts(), configuration.isAutoCreate(), serverSideBuilder, configuration.getProperties()); } }</code><technical_language>This is OK a odd bind ServerSideConfigurationBuilder ServerSideConfiguration _here_ in ClusteringServiceConfigurationBuilder. sense a "copy" constructor in ServerSideConfigurationBuilder here</technical_language>

Target:
public static ClusteringServiceConfigurationBuilder seededFrom(ClusteringServiceConfiguration configuration) { ServerSideConfiguration serverSideConfiguration = configuration.getServerConfiguration(); if (serverSideConfiguration == null) { return new ClusteringServiceConfigurationBuilder(configuration.getConnectionSource(), configuration.getTimeouts(), configuration.isAutoCreate(), null, configuration.getProperties()); } else { return new ClusteringServiceConfigurationBuilder(configuration.getConnectionSource(), configuration.getTimeouts(), configuration.isAutoCreate(), new ServerSideConfigurationBuilder(serverSideConfiguration), configuration.getProperties()); } }
Source:
<code>private void checkVdsSwapThreshold(VdsStatistics stat) { Integer minAvailableThreshold = Config.GetValue(ConfigValues.LogPhysicalMemoryThresholdInMB); Integer maxUsedPercentageThreshold = Config.GetValue(ConfigValues.LogMaxPhysicalMemoryUsedThresholdInPercentage); Long swapUsedPercent = (stat.getswap_total() - stat.getswap_free()) / stat.getswap_total(); if (stat.getswap_free() < minAvailableThreshold || swapUsedPercent > maxUsedPercentageThreshold) { AuditLogableBase logable = new AuditLogableBase(); logable.setVdsId(stat.getId()); logable.AddCustomValue("HostName", _vds.getvds_name()); logable.AddCustomValue("UsedSwap", swapUsedPercent.toString()); logable.AddCustomValue("AvailableSwapMemory", stat.getswap_free().toString()); logable.AddCustomValue("Threshold", stat.getswap_free() < minAvailableThreshold ? minAvailableThreshold.toString() : maxUsedPercentageThreshold.toString()); auditLog(logable, stat.getswap_free() < minAvailableThreshold ? <START> AuditLogType.VDS_LOW_SWAP : AuditLogType.VDS_HIGH_SWAP_USE); <END> } }</code><technical_language>here, i this code nicer</technical_language>

Target:
private void checkVdsSwapThreshold(VdsStatistics stat) { Integer minAvailableThreshold = Config.GetValue(ConfigValues.LogPhysicalMemoryThresholdInMB); Integer maxUsedPercentageThreshold = Config.GetValue(ConfigValues.LogMaxPhysicalMemoryUsedThresholdInPercentage); Long swapUsedPercent = (stat.getswap_total() - stat.getswap_free()) / stat.getswap_total(); AuditLogType valueToLog = stat.getswap_free() < minAvailableThreshold ? AuditLogType.VDS_LOW_SWAP : AuditLogType.VDS_HIGH_SWAP_USE; if (stat.getswap_free() < minAvailableThreshold || swapUsedPercent > maxUsedPercentageThreshold) { AuditLogableBase logable = new AuditLogableBase(stat.getId()); logable.AddCustomValue("HostName", _vds.getvds_name()); logable.AddCustomValue("UsedSwap", swapUsedPercent.toString()); logable.AddCustomValue("AvailableSwapMemory", stat.getswap_free().toString()); logable.AddCustomValue("Threshold", stat.getswap_free() < minAvailableThreshold ? minAvailableThreshold.toString() : maxUsedPercentageThreshold.toString()); auditLog(logable, valueToLog); } }
Source:
<code>private ListenableFuture<Void> guardQueryWithSuppression(Exception e, AtomicLong committedOffset, ProgressiveBackoff progressiveBackoff) { ListenableFuture<Void> exceptionFuture = Futures.immediateFailedFuture(e); if (!retrier.isRetriable(e)) { return exceptionFuture; } ListenableFuture<Void> suppressedQueryFuture = Futures.catchingAsync( query(committedOffset, progressiveBackoff), <START> Throwable.class, <END> (t) -> { e.addSuppressed(t); return exceptionFuture; }, MoreExecutors.directExecutor()); return Futures.transformAsync( suppressedQueryFuture, (result) -> exceptionFuture, MoreExecutors.directExecutor()); }</code><technical_language>Throwable? catching errors</technical_language>

Target:
private ListenableFuture<Void> guardQueryWithSuppression(Exception e, AtomicLong committedOffset, ProgressiveBackoff progressiveBackoff) { ListenableFuture<Void> exceptionFuture = Futures.immediateFailedFuture(e); if (!retrier.isRetriable(e)) { return exceptionFuture; } ListenableFuture<Void> suppressedQueryFuture = Futures.catchingAsync( query(committedOffset, progressiveBackoff), Exception.class, (queryException) -> { e.addSuppressed(queryException); return exceptionFuture; }, MoreExecutors.directExecutor()); return Futures.transformAsync( suppressedQueryFuture, (result) -> exceptionFuture, MoreExecutors.directExecutor()); }
Source:
<code>public String toString() { return "ConnectionPoolInfo{" + "name='" + name + '\'' + ", url='" + url + '\'' + ", user='" + user + '\'' <START> + ", password='" + password + '\'' + ", dataSourceClassname='" + dataSourceClassname + '\'' <END> + ", driverClassname='" + driverClassname + '\'' + ", useMetrics=" + useMetrics + ", useHealthChecks=" + useHealthChecks + ", properties=" + properties + '}'; }</code><technical_language>some concern for security: output user/pass here</technical_language>

Target:
public String toString() { return "ConnectionPoolInfo{" + "name='" + name + '\'' + ", url='" + url + '\'' + ", dataSourceClassname='" + dataSourceClassname + '\'' + ", driverClassname='" + driverClassname + '\'' + ", useMetrics=" + useMetrics + ", useHealthChecks=" + useHealthChecks + ", properties=" + properties + '}'; }
Source:
<code>public ImageResource getValue(VM vm) { if (vm.getVmPoolId() == null) { <START> VmTypeConfig config = new VmTypeConfig(vm.isStateless(), vm.getVmType()); <END> if (configToIcon.containsKey(config)) { Pair<ImageResource, String> value = configToIcon.get(config); setTitle(value.getSecond()); return value.getFirst(); } else { return getApplicationResources().manyDesktopsImage(); } } else { return getApplicationResources().manyDesktopsImage(); } }</code><technical_language>suggestion below, key lookup realized more simply, for example: VmTypeConfig config = VmTypeConfig.for(vm.getVmType(), vm.isStateless()); ... setTitle(config.getTooltip()); return config.getImageResource();</technical_language>

Target:
public ImageResource getValue(VM vm) { if (vm.getVmPoolId() == null) { VmTypeConfig config = VmTypeConfig.from(vm.getVmType(), vm.isStateless()); setTitle(config.getTooltip(constants)); return config.getImageResource(getApplicationResources()); } else { return getApplicationResources().manyDesktopsImage(); } }
Source:
<code>public void close() { try { tasks.forEach(BufferedEventSender.Resender::stop); executorService.shutdown(); executorService.awaitTermination(2, TimeUnit.SECONDS); } catch <START> (InterruptedException e) <END> { Thread.currentThread().interrupt(); } finally { underlyingSender.close(); } }</code><technical_language>log a message in case executorService fails terminate time</technical_language>

Target:
public void close() { try { tasks.forEach(BufferedEventSender.Resender::stop); executorService.shutdown(); executorService.awaitTermination(2, TimeUnit.SECONDS); } catch (InterruptedException e) { log.warn("Interrupted while waiting for the executor service to shutdown, some events might be lost."); Thread.currentThread().interrupt(); } finally { underlyingSender.close(); } }
Source:
<code>private List<AggregationOp> getInternalOps(AggregationOp op) { <START> switch (op) { <END> case COUNT: return ImmutableList.of(AggregationOp.COUNT); case MIN: return ImmutableList.of(AggregationOp.MIN); case MAX: return ImmutableList.of(AggregationOp.MAX); case SUM: return ImmutableList.of(AggregationOp.SUM); case AVG: return ImmutableList.of(AggregationOp.SUM, AggregationOp.COUNT); case STDEV: return ImmutableList.of(AggregationOp.SUM, AggregationOp.SUM_SQUARED, AggregationOp.COUNT); default: throw new IllegalArgumentException("Type " + op + " is invalid"); } }</code><technical_language>save a bit of code fallthrough this: case COUNT: case MIN: case MAX: case SUM: return ImmutableList.of(op); This save more code add more ops require internal state</technical_language>

Target:
private List<AggregationOp> getInternalOps(AggregationOp op) { switch (op) { case COUNT: case MIN: case MAX: case SUM: return ImmutableList.of(op); case AVG: return ImmutableList.of(AggregationOp.SUM, AggregationOp.COUNT); case STDEV: return ImmutableList.of(AggregationOp.SUM, AggregationOp.SUM_SQUARED, AggregationOp.COUNT); default: throw new IllegalArgumentException("Type " + op + " is invalid"); } }
Source:
<code>public Tier loadComplete(Tier newTier) throws EntityNotFoundException { Query query = getEntityManager() .createQuery( "select p from Tier p fetch all properties where p.name = :name and p.vdc =:vdc and p.environmentname= :environmentname"); query.setParameter("name", newTier.getName()); query.setParameter("vdc", newTier.getVdc()); query.setParameter("environmentname", newTier.getEnviromentName()); Tier tier = null; try { tier = (Tier) query.getResultList().get(0); tier.getNetworks().size(); tier.getProductReleases().size(); tier.getSecurityGroup(); } catch (Exception e) { <START> String message = " Tier don't exist in database "; <END> throw new EntityNotFoundException(Tier.class, message, newTier.getName()); } return tier; }</code><technical_language>Tier exist in database</technical_language>

Target:
public Tier loadComplete(Tier newTier) throws EntityNotFoundException { Query query = getEntityManager() .createQuery( "select p from Tier p fetch all properties where p.name = :name and p.vdc =:vdc and p.environmentname= :environmentname"); query.setParameter("name", newTier.getName()); query.setParameter("vdc", newTier.getVdc()); query.setParameter("environmentname", newTier.getEnviromentName()); Tier tier = null; try { tier = (Tier) query.getResultList().get(0); tier.getNetworks().size(); tier.getProductReleases().size(); tier.getSecurityGroup(); } catch (Exception e) { String message = " Tier does not exist in database "; throw new EntityNotFoundException(Tier.class, message, newTier.getName()); } return tier; }
Source:
<code>private NewIndexType buildWithoutSubfields() { ImmutableMap.Builder<String, String> hash = ImmutableMap.builder(); <START> hash.put("type", getFieldType()) <END> .put(INDEX, disableSearch ? INDEX_NOT_SEARCHABLE : INDEX_SEARCHABLE) .put("norms", valueOf(!disableNorms)) .put("store", valueOf(store)); if (FIELD_TYPE_KEYWORD.equals(getFieldType())) { hash.put("doc_values", disabledDocValues ? "false" : "true"); } if (getFieldData()) { hash.put(FIELD_FIELDDATA, FIELDDATA_ENABLED); } return indexType.setProperty(fieldName, hash.build()); }</code><technical_language>remove ;\nhash (only write ImmutableMap.builder()\n.put(...))</technical_language>

Target:
private NewIndexType buildWithoutSubfields() { Map<String, Object> hash = new TreeMap<>(); hash.put("type", getFieldType()); hash.put(INDEX, disableSearch ? INDEX_NOT_SEARCHABLE : INDEX_SEARCHABLE); hash.put("norms", valueOf(!disableNorms)); hash.put("store", valueOf(store)); if (FIELD_TYPE_KEYWORD.equals(getFieldType())) { hash.put("doc_values", valueOf(!disabledDocValues)); } if (getFieldData()) { hash.put(FIELD_FIELDDATA, FIELDDATA_ENABLED); } return indexType.setProperty(fieldName, hash); }
Source:
<code>public DateTruncTest() { c1 = Calendar.getInstance(); <START> c1.setTimeZone(TimeZone.getTimeZone("UTC")); <END> c1.set(2000, 2, 3, 4, 5, 6); c1.set(Calendar.MILLISECOND, 7); c1.setMinimalDaysInFirstWeek(4); c1.setFirstDayOfWeek(Calendar.MONDAY); truncatedDate = Calendar.getInstance(); truncatedDate.setTimeZone(TimeZone.getTimeZone("UTC")); truncatedDate.set(2000, 2, 3, 4, 5, 6); truncatedDate.set(Calendar.MILLISECOND, 7); truncatedDate.setMinimalDaysInFirstWeek(4); truncatedDate.setFirstDayOfWeek(Calendar.MONDAY); lastModified = Calendar.getInstance(); lastModified.setTimeZone(TimeZone.getTimeZone("UTC")); lastModified.set(2000, 2, 3, 4, 5, 6); lastModified.set(Calendar.MILLISECOND, 7); lastModified.setMinimalDaysInFirstWeek(4); lastModified.setFirstDayOfWeek(Calendar.MONDAY); }</code><technical_language>setting timezone below</technical_language>

Target:
public DateTruncTest() { c1 = Calendar.getInstance(); c1.set(2000, 2, 3, 4, 5, 6); c1.set(Calendar.MILLISECOND, 7); c1.setMinimalDaysInFirstWeek(4); c1.setFirstDayOfWeek(Calendar.MONDAY); truncatedDate = Calendar.getInstance(); truncatedDate.set(2000, 2, 3, 4, 5, 6); truncatedDate.set(Calendar.MILLISECOND, 7); truncatedDate.setMinimalDaysInFirstWeek(4); truncatedDate.setFirstDayOfWeek(Calendar.MONDAY); lastModified = Calendar.getInstance(); lastModified.set(2000, 2, 3, 4, 5, 6); lastModified.set(Calendar.MILLISECOND, 7); lastModified.setMinimalDaysInFirstWeek(4); lastModified.setFirstDayOfWeek(Calendar.MONDAY); }
Source:
<code>public static <T extends TypedSPI> Optional<T> getCachedTypedServiceInstance(final Class<T> typedServiceInterface, final String type) { <START> T instance = TYPED_SERVICES.containsKey(typedServiceInterface) ? (T) TYPED_SERVICES.get(typedServiceInterface).get(type) : null; <END> if (null == instance) { return Optional.empty(); } return Optional.of(instance); }</code><technical_language>Consider making good of Optional#map if Optional</technical_language>

Target:
public static <T extends TypedSPI> Optional<T> getCachedTypedServiceInstance(final Class<T> typedServiceInterface, final String type) { return Optional.ofNullable(TYPED_SERVICES.get(typedServiceInterface)).map(services -> (T) services.get(type)); }
Source:
<code>public int run() { scope.enter(kompiledDir.get()); try { Reader stringToParse = options.stringToParse(); Source source = options.source(); if (options.experimental.kore) { CompiledDefinition def = compiledDef.get(); org.kframework.kore.Sort sort = options.sort; if (sort == null) { if (env.get("KRUN_SORT") != null) { sort = Sort(env.get("KRUN_SORT")); } else { sort = def.programStartSymbol; } } org.kframework.definition.Module mod; if (options.module == null) { mod = def.syntaxModule(); } else { Option<org.kframework.definition.Module> mod2 = def.getParsedDefinition().getModule(options.module); if (mod2.isEmpty()) { throw KEMException.innerParserError("Module " + options.module + " not found. Specify a module with -m."); } mod = mod2.get(); } <START> K parsed = def.getParser(def.getParserModule(mod), sort, kem).apply(FileUtil.read(stringToParse), source); <END> System.out.println(ToKast.apply(parsed)); } else { Context context = contextProvider.get(); Sort sort = sort(options.sort, context); ASTNode out = loader.get().processPgm(stringToParse, source, sort, context, options.parser); StringBuilder kast; KoreFilter koreFilter = new KoreFilter(context); StringBuilder sb = new StringBuilder(); koreFilter.visitNode(out, sb); kast = sb; kast.append("\n"); System.out.print(kast.toString()); } sw.printTotal("Total"); return 0; } finally { scope.exit(); } }</code><technical_language>this necessary getParser call getParserModule</technical_language>

Target:
public int run() { scope.enter(kompiledDir.get()); try { Reader stringToParse = options.stringToParse(); Source source = options.source(); if (options.experimental.kore) { CompiledDefinition def = compiledDef.get(); org.kframework.kore.Sort sort = options.sort; if (sort == null) { if (env.get("KRUN_SORT") != null) { sort = Sort(env.get("KRUN_SORT")); } else { sort = def.programStartSymbol; } } org.kframework.definition.Module mod; if (options.module == null) { mod = def.syntaxModule(); } else { Option<org.kframework.definition.Module> mod2 = def.kompiledDefinition.getModule(options.module); if (mod2.isEmpty()) { throw KEMException.innerParserError("Module " + options.module + " not found. Specify a module with -m."); } mod = mod2.get(); } K parsed = def.getParser(mod, sort, kem).apply(FileUtil.read(stringToParse), source); System.out.println(ToKast.apply(parsed)); } else { Context context = contextProvider.get(); Sort sort = sort(options.sort, context); ASTNode out = loader.get().processPgm(stringToParse, source, sort, context, options.parser); StringBuilder kast; KoreFilter koreFilter = new KoreFilter(context); StringBuilder sb = new StringBuilder(); koreFilter.visitNode(out, sb); kast = sb; kast.append("\n"); System.out.print(kast.toString()); } sw.printTotal("Total"); return 0; } finally { scope.exit(); } }
Source:
<code>public void testPostRewriteHookCanBeIgnored() throws Exception { assumeSupportedPlatform(); Git git = Git.wrap(db); String path = "a.txt"; writeTrashFile(path, "content"); git.add().addFilepattern(path).call(); <START> git.commit().setMessage("to amend"); <END> Hook h = Hook.POST_REWRITE; writeHookFile(h.getName(), "#!/bin/sh\necho \"test\"\n\necho 1>&2 \"stderr\"\nexit 1"); ByteArrayOutputStream out = new ByteArrayOutputStream(); git.commit().setAmend(true).setNoPostRewrite(true) .setMessage("amended commit msg.") .setHookOutputStream(new PrintStream(out)).call(); assertEquals("", out.toString("UTF-8")); }</code><technical_language>add call()</technical_language>

Target:
public void testPostRewriteHookCanBeIgnored() throws Exception { assumeSupportedPlatform(); Git git = Git.wrap(db); String path = "a.txt"; writeTrashFile(path, "content"); git.add().addFilepattern(path).call(); git.commit().setMessage("to amend").call(); Hook h = Hook.POST_REWRITE; writeHookFile(h.getName(), "#!/bin/sh\necho \"test\"\nexit 1"); ByteArrayOutputStream out = new ByteArrayOutputStream(); git.commit().setAmend(true).setNoPostRewrite(true) .setMessage("amended commit msg.") .setHookOutputStream(new PrintStream(out)).call(); assertEquals("", out.toString("UTF-8")); }
Source:
<code>public boolean isDirty() { <START> return dirty; <END> }</code><technical_language>this. for consistency</technical_language>

Target:
public boolean isDirty() { return this.dirty; }