auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public CompletableFuture<LogReplicationEntry> send(LogReplicationEntry message) { <START> log.info("Send single log entry for request {}", message.getMetadata()); <END> return client.sendLogEntry(message); }</code><technical_language>I this is trace</technical_language>

Target:
public CompletableFuture<LogReplicationEntry> send(LogReplicationEntry message) { log.trace("Send single log entry for request {}", message.getMetadata()); return client.sendLogEntry(message); }
Source:
<code>private Expression badValueFailureExpression(final String columnRef, boolean failureThrowsException) { if (failureThrowsException) { return new Expression() { @Override public boolean writeExpression(JavaFileWriter writer) throws IOException { <START> writer.appendString("throw new IllegalArgumentException(\"Value for upsert logical key column \"" <END> + " + " + columnRef + ".getName() + \" was missing when trying to upsert item of class \"" + " + getClass())"); return true; } }; } else { return Expressions.fromString("null").returnExpr(); } }</code><technical_language>I if IllegalStateException is here</technical_language>

Target:
private Expression badValueFailureExpression(final String columnRef, boolean failureThrowsException) { if (failureThrowsException) { return new Expression() { @Override public boolean writeExpression(JavaFileWriter writer) throws IOException { writer.appendString("throw new IllegalStateException(\"Value for upsert logical key column \"" + " + " + columnRef + ".getName() + \" was missing when trying to build upsert criterion " + "for class \" + getClass())"); return true; } }; } else { return Expressions.fromString("null").returnExpr(); } }
Source:
<code><START> public void testSupportsBad() { <END> AuthenticationToken authenticationToken = mock(AuthenticationToken.class); boolean supports = upRealm.supports(authenticationToken); assertFalse(supports); authenticationToken = mock(BaseAuthenticationToken.class); supports = upRealm.supports(authenticationToken); assertFalse(supports); when(authenticationToken.getCredentials()).thenReturn(new Object()); supports = upRealm.supports(authenticationToken); assertFalse(supports); }</code><technical_language>separate assertFalse statements technically separate tests? specific names / criteria</technical_language>

Target:
public void testSupportsBad() { BaseAuthenticationToken authenticationToken = mock(BaseAuthenticationToken.class); boolean supports = upRealm.supports(authenticationToken); assertFalse(supports); when(authenticationToken.getType()).thenReturn(AuthenticationTokenType.PKI); supports = upRealm.supports(authenticationToken); assertFalse(supports); when(authenticationToken.getType()).thenReturn(AuthenticationTokenType.USERNAME); authenticationToken = mock(BaseAuthenticationToken.class); supports = upRealm.supports(authenticationToken); assertFalse(supports); when(authenticationToken.getCredentials()).thenReturn(new Object()); supports = upRealm.supports(authenticationToken); assertFalse(supports); when(authenticationToken.getCredentials()).thenReturn(""); supports = upRealm.supports(authenticationToken); assertFalse(supports); }
Source:
<code>public Ticker getTicker(CurrencyPair currencyPair, Object... objects) throws IOException { OrderBook orderBook = getOrderBook(currencyPair, 1, 1, 1); return new Ticker.Builder() .currencyPair(orderBook.getAsks().get(0).getCurrencyPair()) .ask(orderBook.getAsks().get(0).getLimitPrice()) .bid(orderBook.getBids().get(0).getLimitPrice()) <START> .build(); <END> }</code><technical_language>I this is a ticker - important fields missing throw exception return this</technical_language>

Target:
public Ticker getTicker(CurrencyPair currencyPair, Object... objects) throws IOException { throw new NotAvailableFromExchangeException(); }
Source:
<code>public Map<String,String> getSupportedFunctions() { if ( supportedFunctions == null ) { <START> supportedFunctions = new HashMap(); <END> dialect.registerFunctions(supportedFunctions); } return supportedFunctions; }</code><technical_language>Generics, new HashMap<>();</technical_language>

Target:
public Map<String, String> getSupportedFunctions() { if (supportedFunctions == null) { supportedFunctions = new HashMap<>(); dialect.registerFunctions(supportedFunctions); } return supportedFunctions; }
Source:
<code>void writeFully(SocketChannel channel, ByteBuffer buffer, boolean forceAsync, DistributionMessage msg) throws IOException, ConnectionException { final DMStats stats = owner.getConduit().getStats(); if (!sharedResource) { stats.incTOSentMsg(); } if (useSyncWrites(forceAsync)) { if (asyncQueuingInProgress) { if (addToQueue(buffer, msg, false)) { return; } } long startLock = stats.startSocketLock(); synchronized (outLock) { stats.endSocketLock(startLock); if (asyncQueuingInProgress) { if (addToQueue(buffer, msg, false)) { return; } } synchronized (ioFilter) { ByteBuffer wrappedBuffer = ioFilter.wrap(buffer); while (wrappedBuffer.remaining() > 0) { int amtWritten = 0; long start = stats.startSocketWrite(true); try { <START> amtWritten = channel.write(wrappedBuffer); <END> } finally { stats.endSocketWrite(true, start, amtWritten, 0); } } } } } else { writeAsync(channel, buffer, forceAsync, msg, stats); } }</code><technical_language>Is needs done, if write throws exception...Sorry I asking wrong question I context here</technical_language>

Target:
void writeFully(SocketChannel channel, ByteBuffer buffer, boolean forceAsync, DistributionMessage msg) throws IOException, ConnectionException { final DMStats stats = owner.getConduit().getStats(); if (!sharedResource) { stats.incTOSentMsg(); } if (useSyncWrites(forceAsync)) { if (asyncQueuingInProgress) { if (addToQueue(buffer, msg, false)) { return; } } long startLock = stats.startSocketLock(); synchronized (outLock) { stats.endSocketLock(startLock); if (asyncQueuingInProgress) { if (addToQueue(buffer, msg, false)) { return; } } synchronized (ioFilter.getSynchObject()) { ByteBuffer wrappedBuffer = ioFilter.wrap(buffer); while (wrappedBuffer.remaining() > 0) { int amtWritten = 0; long start = stats.startSocketWrite(true); try { amtWritten = channel.write(wrappedBuffer); } finally { stats.endSocketWrite(true, start, amtWritten, 0); } } } } } else { writeAsync(channel, buffer, forceAsync, msg, stats); } }
Source:
<code>public Phone createPhone(CreatePhoneRequest request) { <START> <END> Assert.notNull(request, "Request cannot be null."); final Phone phone = request.getPhone(); String href = getPhones().getHref(); return getDataStore().create(href, phone); }</code><technical_language>remove blank line please</technical_language>

Target:
public Phone createPhone(CreatePhoneRequest request) { Assert.notNull(request, "Request cannot be null."); final Phone phone = request.getPhone(); String href = getPhones().getHref(); if (request.hasPhoneOptions()) { return getDataStore().create(href, phone, request.getPhoneOptions()); } return getDataStore().create(href, phone); }
Source:
<code>protected void captureTimeline(long currentId) { Paging paging = new Paging(1, 200); List<Status> statuses = null; do { Twitter client = getTwitterClient(); int keepTrying = 0; while (keepTrying < 1) { try { statuses = client.getUserTimeline(currentId, paging); for (Status tStat : statuses) { String json = TwitterObjectFactory.getRawJSON(tStat); <START> while(!providerQueue.offer(new StreamsDatum(json))) { <END> sleep(); } } paging.setPage(paging.getPage() + 1); keepTrying = 10; } catch(TwitterException twitterException) { keepTrying += TwitterErrorHandler.handleTwitterError(client, twitterException); } catch(Exception e) { keepTrying += TwitterErrorHandler.handleTwitterError(client, e); } } } while (shouldContinuePulling(statuses)); }</code><technical_language>is a utility I other day wraps this in a convenience method: org.apache.streams.util.ComponentUtils.offerUntilSuccess</technical_language>

Target:
protected void captureTimeline(long currentId) { Paging paging = new Paging(1, 200); List<Status> statuses = null; do { Twitter client = getTwitterClient(); int keepTrying = 0; while (keepTrying < 1) { try { statuses = client.getUserTimeline(currentId, paging); for (Status tStat : statuses) { String json = TwitterObjectFactory.getRawJSON(tStat); ComponentUtils.offerUntilSuccess(new StreamsDatum(json), providerQueue); } paging.setPage(paging.getPage() + 1); keepTrying = 10; } catch(TwitterException twitterException) { keepTrying += TwitterErrorHandler.handleTwitterError(client, twitterException); } catch(Exception e) { keepTrying += TwitterErrorHandler.handleTwitterError(client, e); } } } while (shouldContinuePulling(statuses)); }
Source:
<code>private void checkLocationAvailability() { LocationAvailability availability = <START> LocationServices.FusedLocationApi.getLocationAvailability(client); <END> boolean isAvailable = availability.isLocationAvailable(); Toast.makeText(LocationAvailabilityActivity.this, isAvailable ? R.string.location_available : R.string.location_unavailable, Toast.LENGTH_SHORT).show(); }</code><technical_language>While exercising a call FusedLocationApi.getLocationAvailability(client) is good verify LocationCallback is properly invoked location updates requested provider status changes occur. <LINK_0> This is case more suitably replace LocationListener.onProviderEnabled(String provider) LocationListener.onProviderDisabled(String provider) client app is relying a push style notification actively polling provider status</technical_language>

Target:
private void checkLocationAvailability() { LocationAvailability availability = LocationServices.FusedLocationApi.getLocationAvailability(client); boolean isAvailable = availability.isLocationAvailable(); Toast.makeText(LocationAvailabilityActivity.this, isAvailable ? R.string.location_available : R.string.location_unavailable, Toast.LENGTH_SHORT).show(); final LocationRequest locationRequest = LocationRequest.create() .setPriority(PRIORITY_HIGH_ACCURACY); LocationServices.FusedLocationApi.requestLocationUpdates(client, locationRequest, callback, Looper.myLooper()); }
Source:
<code>public void validateSessionPersistenceProtocolCompatibility(LoadBalancer inLb, LoadBalancer dbLb) throws BadRequestException, UnprocessableEntityException { SessionPersistence inpersist = inLb.getSessionPersistence(); LoadBalancerProtocol dbProtocol = dbLb.getProtocol(); String httpErrMsg = "HTTP_COOKIE Session persistence is only valid with HTTP and HTTP(SSL Termination) protocols. "; String sipErrMsg = "SOURCE_IP Session persistence is only valid with non-HTTP protocols. "; String sslErrMsg = "SSL_ID Session persistence is only valid with HTTP(SSL Termination) protocols. "; LOG.info("Verifying session persistence protocol..." + inpersist); if (inpersist != NONE) { if (inpersist == HTTP_COOKIE && (dbProtocol != HTTP)) { LOG.info(httpErrMsg); throw new BadRequestException(httpErrMsg); } if (inpersist == SOURCE_IP && (dbProtocol == HTTP)) { LOG.info(httpErrMsg); throw new BadRequestException(sipErrMsg); } if (inpersist == SSL_ID && <START> (dbProtocol != HTTPS)) { <END> LOG.info(sslErrMsg); throw new BadRequestException(sslErrMsg); } } LOG.info("Successfully verified session persistence protocol..." + inLb.getSessionPersistence()); }</code><technical_language>check if protocol is HTTP SSL termination error message? I this accomplishes that</technical_language>

Target:
public void validateSessionPersistenceProtocolCompatibility(LoadBalancer inLb, LoadBalancer dbLb) throws BadRequestException, UnprocessableEntityException { SessionPersistence persistenceType = inLb.getSessionPersistence(); LoadBalancerProtocol dbProtocol = dbLb.getProtocol(); String httpErrMsg = "HTTP_COOKIE session persistence is only valid with the HTTP protocol."; String sipErrMsg = "SOURCE_IP session persistence is only valid with non-HTTP protocols. "; String sslErrMsg = "SSL_ID session persistence is only valid with the HTTPS protocol. "; LOG.info("Verifying session persistence protocol..." + persistenceType); if (persistenceType != NONE) { if (persistenceType == HTTP_COOKIE && (dbProtocol != HTTP)) { LOG.info(httpErrMsg); throw new BadRequestException(httpErrMsg); } if (persistenceType == SOURCE_IP && (dbProtocol == HTTP)) { LOG.info(httpErrMsg); throw new BadRequestException(sipErrMsg); } if (persistenceType == SSL_ID && (dbProtocol != HTTPS)) { LOG.info(sslErrMsg); throw new BadRequestException(sslErrMsg); } } LOG.info("Successfully verified session persistence protocol..." + inLb.getSessionPersistence()); }
Source:
<code>private void initializeProbabilityVector(MatrixLib p) { double[] pi = new double[p.numCols()]; double sum = 0.0; for (int i = 0; i < p.numCols(); i++) { double ele = p.elementAt(0, i); if (ele < 0) { throw new IllegalArgumentException("Probability " + ele + " for element " + i + " is negative."); } <START> sum += p.elementAt(0, i); <END> } if (sum < 1e-9) { throw new IllegalArgumentException("Probabilities sum to approx zero"); } for (int i = 0; i < p.numCols(); i++) { pi[i] = p.elementAt(0, i) / sum; } this.p = pi; this.k = this.p.length; this.pCDF = new double[k]; pCDF[0] = this.p[0]; for (int i = 1; i < k; i++) { this.pCDF[i] = pCDF[i - 1] + this.p[i]; } }</code><technical_language>calling p.elementAt(0, i) twice? ele instead</technical_language>

Target:
private void initializeProbabilityVector(MatrixLib p) { double sum = 0.0; for (int i = 0; i < p.numCols(); i++) { double ele = p.elementAt(0, i); if (ele < 0) { throw new IllegalArgumentException("Probability " + ele + " for element " + i + " is negative."); } sum += ele; } if (sum < 1e-9) { throw new IllegalArgumentException("Probabilities sum to approx zero"); } this.k = p.numCols(); this.p = new double[k]; this.pCDF = new double[k]; this.p[0] = p.elementAt(0, 0) / sum; pCDF[0] = this.p[0]; for (int i = 1; i < p.numCols(); i++) { this.p[i] = p.elementAt(0, i) / sum; this.pCDF[i] = pCDF[i - 1] + this.p[i]; } }
Source:
<code>private void prepFeeders() throws JobProcessorException { fireTextStatus("Preparing feeders."); Machine machine = Configuration.get().getMachine(); for (Feeder feeder : machine.getFeeders()) { if (feeder.isEnabled() && feeder.getPart() != null) { for (JobPlacement placement : getPendingJobPlacements()) { if (placement.getPartId() == feeder.getPart().getId()) { <START> try { <END> feeder.prepareForJob(); } catch (Exception e) { throw new JobProcessorException(feeder, e); } } } } } }</code><technical_language>Feeders enabled a job run, this get called for a feeder</technical_language>

Target:
private void prepFeeders() throws JobProcessorException { fireTextStatus("Preparing feeders."); Machine machine = Configuration.get().getMachine(); List<Feeder> feederList = new ArrayList<>(); for (Feeder feeder : machine.getFeeders()) { if (feeder.isEnabled() && feeder.getPart() != null) { for (JobPlacement placement : getPendingJobPlacements()) { if (placement.getPartId() == feeder.getPart().getId()) { feederList.add(feeder); } } } } for (Feeder feeder : feederList) { try { feeder.prepareForJob(feederList); } catch (Exception e) { throw new JobProcessorException(feeder, e); } } }
Source:
<code>private static Comparable zeroValue(RelDataType type) { switch (type.getSqlTypeName()) { case CHAR: return new NlsString(Spaces.of(type.getPrecision()), null, null); case VARCHAR: return new NlsString("", null, null); case BINARY: return new ByteString(new byte[type.getPrecision()]); case VARBINARY: return ByteString.EMPTY; case TINYINT: case SMALLINT: case INTEGER: case BIGINT: case DECIMAL: case FLOAT: case REAL: case DOUBLE: return BigDecimal.ZERO; case BOOLEAN: return false; case TIME: case DATE: case TIMESTAMP: return DateTimeUtils.ZERO_CALENDAR; case TIME_WITH_LOCAL_TIME_ZONE: return new TimeString(0, 0, 0); case TIMESTAMP_WITH_LOCAL_TIME_ZONE: return new TimestampString(0, 0, 0, 0, 0, 0); case TIME_WITH_TIME_ZONE: return new TimeWithTimeZoneString(0, 0, 0, "UTC"); case TIMESTAMP_WITH_TIME_ZONE: <START> return new TimestampWithTimeZoneString(0, 0, 0, 0, 0, 0, "UTC"); <END> default: throw Util.unexpected(type.getSqlTypeName()); } }</code><technical_language>0 is January 1, 1970 UTC, assuming millis epoch millis (count 1970-01-01 UTC)</technical_language>

Target:
private static Comparable zeroValue(RelDataType type) { switch (type.getSqlTypeName()) { case CHAR: return new NlsString(Spaces.of(type.getPrecision()), null, null); case VARCHAR: return new NlsString("", null, null); case BINARY: return new ByteString(new byte[type.getPrecision()]); case VARBINARY: return ByteString.EMPTY; case TINYINT: case SMALLINT: case INTEGER: case BIGINT: case DECIMAL: case FLOAT: case REAL: case DOUBLE: return BigDecimal.ZERO; case BOOLEAN: return false; case TIME: case DATE: case TIMESTAMP: return DateTimeUtils.ZERO_CALENDAR; case TIME_WITH_LOCAL_TIME_ZONE: return new TimeString(0, 0, 0); case TIMESTAMP_WITH_LOCAL_TIME_ZONE: return new TimestampString(0, 0, 0, 0, 0, 0); case TIME_WITH_TIME_ZONE: return new TimeWithTimeZoneString(0, 0, 0, "UTC"); case TIMESTAMP_WITH_TIME_ZONE: return new TimestampWithTimeZoneString(1970, 1, 1, 0, 0, 0, "UTC"); default: throw Util.unexpected(type.getSqlTypeName()); } }
Source:
<code>public MythicSkillCommand() { setName("mythicskill"); <START> setSyntax("mythicskill [<skillname>] (<location>|...) (<entity>|...) (power:<#.#>) (casters:<entity>|..)"); <END> setRequiredArguments(1, 5); }</code><technical_language>.. is ellipses, .. is dots. symbol matters</technical_language>

Target:
public MythicSkillCommand() { setName("mythicskill"); setSyntax("mythicskill [<skillname>] [<location>|.../<entity>|...] (power:<#.#>) (casters:<entity>|...)"); setRequiredArguments(2, 5); }
Source:
<code>@Override public LinearRegressionModel train(Matrix data) { long ts1 = System.currentTimeMillis(); Vector groundTruth = extractGroundTruth(data); Matrix inputs = extractInputs(data); <START> long ts2 = System.currentTimeMillis(); <END> QRDecomposition decomposition = new QRDecomposition(inputs); long ts3 = System.currentTimeMillis(); QRDSolver solver = new QRDSolver(decomposition.getQ(), decomposition.getR()); Vector variables = solver.solve(groundTruth); long ts4 = System.currentTimeMillis(); Vector weights = variables.viewPart(1, variables.size() - 1); double intercept = variables.get(0); return new LinearRegressionModel(weights, intercept); }</code><technical_language>forget remove timestamps</technical_language>

Target:
@Override public LinearRegressionModel train(Matrix data) { Vector groundTruth = extractGroundTruth(data); Matrix inputs = extractInputs(data); QRDecomposition decomposition = new QRDecomposition(inputs); QRDSolver solver = new QRDSolver(decomposition.getQ(), decomposition.getR()); Vector variables = solver.solve(groundTruth); Vector weights = variables.viewPart(1, variables.size() - 1); double intercept = variables.get(0); return new LinearRegressionModel(weights, intercept); }
Source:
<code>private void documentEnded(boolean pushing, String docID, String revID, int flags, C4Error error, boolean trans) { if (!pushing && error.getDomain() == LiteCoreDomain && error.getCode() == kC4ErrorConflict) { Log.i(TAG, "%s: pulled conflicting version of '%s'", this, docID); try { this.config.getDatabase().resolveConflictInDocument(docID); } catch (CouchbaseLiteException ex) { Log.e(TAG, "Failed to resolveConflict: docID -> %s", ex, docID); } <START> } else if(error.getDomain()==0 && error.getCode()==0) { <END> DocumentReplicatedUpdate update = new DocumentReplicatedUpdate((Replicator) this,true, flags == C4Constants.C4RevisionFlags.kRevDeleted, pushing, docID); synchronized (docEndedListenerTokens) { for (DocumentReplicatedListenerToken token : docEndedListenerTokens) token.notify(update); } Log.i(TAG, "C4ReplicatorListener.documentEnded() pushing -> %s, docID -> %s, error -> %s, trans -> %s", pushing ? "true" : false, docID, error, trans ? "true" : false); } else { Log.i(TAG, "C4ReplicatorListener.documentError() pushing -> %s, docID -> %s, error -> %s, trans -> %s", pushing ? "true" : false, docID, error, trans ? "true" : false); } }</code><technical_language>notify is error well</technical_language>

Target:
private void documentEnded(boolean pushing, String docID, String revID, int flags, C4Error error, boolean trans) { DocumentReplication update = new DocumentReplication((Replicator) this, flags == C4Constants.C4RevisionFlags.kRevDeleted, pushing, docID, revID, flags, error, trans); if (!pushing && error.getDomain() == LiteCoreDomain && error.getCode() == kC4ErrorConflict) { Log.i(TAG, "%s: pulled conflicting version of '%s'", this, docID); try { this.config.getDatabase().resolveConflictInDocument(docID); } catch (CouchbaseLiteException ex) { Log.e(TAG, "Failed to resolveConflict: docID -> %s", ex, docID); } } notifyDocumentEnded(update); }
Source:
<code>public MyLoggingFilter() { super(null, true); <START> System.out.println("MyLoggingFilter running"); <END> }</code><technical_language>NTC</technical_language>

Target:
public MyLoggingFilter() { super(null, true); }
Source:
<code>private boolean isAdAggregatorIdValid(Bond bond, HostInterfaceLineModel lineModel) { String bondAdAggregatorId = Objects.toString(bond.getAdAggregatorId()); if <START> (bondAdAggregatorId==null) { <END> return false; } for (HostInterface nic : lineModel.getInterfaces()) { String nicAggregatorId = Objects.toString(nic.getInterface().getAdAggregatorId()); if (!bondAdAggregatorId.equals(nicAggregatorId)) { return false; } } return true; }</code><technical_language>true, of Objects.toString(null) == "null"</technical_language>

Target:
private boolean isAdAggregatorIdValid(Bond bond, HostInterfaceLineModel lineModel) { Integer aggregatorId = bond.getAdAggregatorId(); if (aggregatorId == null) { return false; } String bondAdAggregatorId = Objects.toString(aggregatorId); for (HostInterface nic : lineModel.getInterfaces()) { String nicAggregatorId = Objects.toString(nic.getInterface().getAdAggregatorId()); if (!bondAdAggregatorId.equals(nicAggregatorId)) { return false; } } return true; }
Source:
<code>protected Boolean doGetValue() { return <START> tracked.isStale() ? Boolean.TRUE : Boolean.FALSE; <END> }</code><technical_language>code simplified rely autoboxing</technical_language>

Target:
protected Boolean doGetValue() { return tracked.isStale(); }
Source:
<code>private String enableCapabilities() throws TransportException { final StringBuilder line = new StringBuilder(); if (noProgress) wantCapability(line, OPTION_NO_PROGRESS); if (includeTags) includeTags = wantCapability(line, OPTION_INCLUDE_TAG); if (allowOfsDelta) wantCapability(line, OPTION_OFS_DELTA); if (wantCapability(line, OPTION_MULTI_ACK_DETAILED)) { multiAck = MultiAck.DETAILED; if (statelessRPC) noDone = wantCapability(line, OPTION_NO_DONE); } else if (wantCapability(line, OPTION_MULTI_ACK)) multiAck = MultiAck.CONTINUE; else multiAck = MultiAck.OFF; if (thinPack) thinPack = wantCapability(line, OPTION_THIN_PACK); if (wantCapability(line, OPTION_SIDE_BAND_64K)) sideband = true; else if (wantCapability(line, OPTION_SIDE_BAND)) sideband = true; if (statelessRPC && multiAck != MultiAck.DETAILED) { throw new PackProtocolException(uri, MessageFormat.format( JGitText.get().statelessRPCRequiresOptionToBeEnabled, OPTION_MULTI_ACK_DETAILED)); } if (filterBlobLimit >= 0) { <START> wantCapability(line, OPTION_FILTER); <END> } addUserAgentCapability(line); return line.toString(); }</code><technical_language>This returns a boolean. happen remote end lacks this capability</technical_language>

Target:
private String enableCapabilities() throws TransportException { final StringBuilder line = new StringBuilder(); if (noProgress) wantCapability(line, OPTION_NO_PROGRESS); if (includeTags) includeTags = wantCapability(line, OPTION_INCLUDE_TAG); if (allowOfsDelta) wantCapability(line, OPTION_OFS_DELTA); if (wantCapability(line, OPTION_MULTI_ACK_DETAILED)) { multiAck = MultiAck.DETAILED; if (statelessRPC) noDone = wantCapability(line, OPTION_NO_DONE); } else if (wantCapability(line, OPTION_MULTI_ACK)) multiAck = MultiAck.CONTINUE; else multiAck = MultiAck.OFF; if (thinPack) thinPack = wantCapability(line, OPTION_THIN_PACK); if (wantCapability(line, OPTION_SIDE_BAND_64K)) sideband = true; else if (wantCapability(line, OPTION_SIDE_BAND)) sideband = true; if (statelessRPC && multiAck != MultiAck.DETAILED) { throw new PackProtocolException(uri, MessageFormat.format( JGitText.get().statelessRPCRequiresOptionToBeEnabled, OPTION_MULTI_ACK_DETAILED)); } if (filterBlobLimit >= 0) { if (!wantCapability(line, OPTION_FILTER)) { throw new PackProtocolException(uri, JGitText.get().filterRequiresCapability); } } addUserAgentCapability(line); return line.toString(); }
Source:
<code>public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { TileAlchemyArray array = (TileAlchemyArray) world.getTileEntity(pos); if (array == null) return false; if (player.isSneaking() && array.rotateCooldown == 0) { array.setRotation(array.getRotation().rotateY()); array.rotateCooldown = 5; world.notifyBlockUpdate(pos, state, state, 3); return false; } ItemStack playerItem = player.getHeldItem(hand); if (!playerItem.isEmpty()) { if (array.getStackInSlot(0).isEmpty()) { Utils.insertItemToTile(array, player, 0); } else if (!array.getStackInSlot(0).isEmpty()) { Utils.insertItemToTile(array, player, 1); array.attemptCraft(); } else { return true; } if (array.arrayEffect instanceof AlchemyArrayEffectMovement && (playerItem.getItem() == Items.REDSTONE || playerItem.getItem() == Items.FEATHER) || array.arrayEffect instanceof AlchemyArrayEffectUpdraft && (playerItem.getItem() == Items.FEATHER || playerItem.getItem() == Items.GLOWSTONE_DUST)) { for (int i = 0; i < array.getSizeInventory(); i++) { ItemStack stack = array.getStackInSlot(i); <START> if (stack.getItem() == playerItem.getItem()) { <END> if (stack.getCount() < 127) { stack.setCount(stack.getCount() + 1); playerItem.shrink(1); } break; } } world.notifyBlockUpdate(pos, state, state, 3); return true; } } world.notifyBlockUpdate(pos, state, state, 3); return true; }</code><technical_language>suggestion if (ItemStack.areItemsEqual(stack, playerItem)) {</technical_language>

Target:
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { TileAlchemyArray array = (TileAlchemyArray) world.getTileEntity(pos); if (array == null) return false; if (player.isSneaking() && array.rotateCooldown == 0) { array.setRotation(array.getRotation().rotateY()); array.rotateCooldown = 5; world.notifyBlockUpdate(pos, state, state, 3); return false; } ItemStack playerItem = player.getHeldItem(hand); if (!playerItem.isEmpty()) { if (array.getStackInSlot(0).isEmpty()) { Utils.insertItemToTile(array, player, 0); } else if (!array.getStackInSlot(0).isEmpty()) { Utils.insertItemToTile(array, player, 1); array.attemptCraft(); } else { return true; } if (array.arrayEffect instanceof AlchemyArrayEffectMovement && (playerItem.getItem() == Items.REDSTONE || playerItem.getItem() == Items.FEATHER) || array.arrayEffect instanceof AlchemyArrayEffectUpdraft && (playerItem.getItem() == Items.FEATHER || playerItem.getItem() == Items.GLOWSTONE_DUST)) { for (int i = 0; i < array.getSizeInventory(); i++) { ItemStack stack = array.getStackInSlot(i); if (ItemStack.areItemsEqual(stack, playerItem)) { if (stack.getCount() < 127) { stack.setCount(stack.getCount() + 1); playerItem.shrink(1); } break; } } world.notifyBlockUpdate(pos, state, state, 3); return true; } } world.notifyBlockUpdate(pos, state, state, 3); return true; }
Source:
<code>public void setupMocks() { dataStore = mock(DataStore.class); <START> asyncQuery = mock(AsyncQuery.class); <END> tx = mock(DataStoreTransaction.class); asyncQueryResultStorage = mock(AsyncQueryResultStorage.class); Map<String, Class<? extends Check>> checkMappings = new HashMap<>(); dictionary = new EntityDictionary(checkMappings); dictionary.bindEntity(AsyncQuery.class); dictionary.bindEntity(AsyncQueryResult.class); ElideSettings elideSettings = new ElideSettingsBuilder(dataStore) .withEntityDictionary(dictionary) .withJoinFilterDialect(new RSQLFilterDialect(dictionary)) .withSubqueryFilterDialect(new RSQLFilterDialect(dictionary)) .withISO8601Dates("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC")) .build(); elide = new Elide(elideSettings); when(dataStore.beginTransaction()).thenReturn(tx); asyncQueryDAO = new com.yahoo.elide.async.service.DefaultAsyncQueryDAO(elide, dataStore); defaultResultStorageEngine = new com.yahoo.elide.async.service.DefaultResultStorageEngine(elide, dataStore, "http://localhost:8080"); }</code><technical_language>This removed</technical_language>

Target:
public void setupMocks() { dataStore = mock(DataStore.class); tx = mock(DataStoreTransaction.class); Map<String, Class<? extends Check>> checkMappings = new HashMap<>(); EntityDictionary dictionary = new EntityDictionary(checkMappings); dictionary.bindEntity(AsyncQuery.class); dictionary.bindEntity(AsyncQueryResult.class); ElideSettings elideSettings = new ElideSettingsBuilder(dataStore) .withEntityDictionary(dictionary) .withJoinFilterDialect(new RSQLFilterDialect(dictionary)) .withSubqueryFilterDialect(new RSQLFilterDialect(dictionary)) .withISO8601Dates("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC")) .build(); elide = new Elide(elideSettings); when(dataStore.beginTransaction()).thenReturn(tx); defaultResultStorageEngine = new DefaultResultStorageEngine("/api/v1/download", elide.getElideSettings(), dataStore); }
Source:
<code>public void returnsEmptyIteratorOnInvalidPartRequest() throws Exception { final String body = "443 N Wolfe Rd, Sunnyvale, CA 94085"; final RqMultipart multi = new RqMtFake( new RqFake(), new RqWithHeaders( new RqFake("", "", body), new FormattedText( "Content-Length: %s", body.getBytes().length ).asString(), "Content-Disposition: form-data; name=\"t5\"" ), new RqWithHeaders( new RqFake("", "", ""), "Content-Length: 0", <START> "Content-Disposition: form-data; name=\"data\"; filename=\"a.zip\"" <END> ) ); MatcherAssert.assertThat( multi.part("fake").iterator().hasNext(), Matchers.is(false) ); multi.body().close(); }</code><technical_language>@Serranya here. above</technical_language>

Target:
public void returnsEmptyIteratorOnInvalidPartRequest() throws Exception { final String body = "443 N Wolfe Rd, Sunnyvale, CA 94085"; final RqMultipart multi = new RqMtFake( new RqFake(), new RqWithHeaders( new RqFake("", "", body), new FormattedText( RqMtFakeTest.CONTENT_LENGTH, body.getBytes().length ).asString(), new FormattedText( RqMtFakeTest.CONTENT_DISP, "name=\"t5\"" ).asString() ), new RqWithHeaders( new RqFake("", "", ""), new FormattedText(RqMtFakeTest.CONTENT_LENGTH, 0).asString(), new FormattedText( RqMtFakeTest.CONTENT_DISP, "name=\"data\"; filename=\"a.zip\"" ).asString() ) ); MatcherAssert.assertThat( multi.part("fake").iterator().hasNext(), Matchers.is(false) ); multi.body().close(); }
Source:
<code>public static String createExclusionFieldString(List<String> excludeList) { String[] excludeArray = new String[excludeList.size()]; for (int i = 0; i < excludeList.size(); i++) { excludeArray[i] = String.format("'%s' : 0", excludeList.get(i)); } <START> return "{ " + StringUtils.join(excludeArray, ", ") + " }"; <END> }</code><technical_language>Java 8 [built-in support for joining multiple Strings](<LINK_0></technical_language>

Target:
public static String createExclusionFieldString(List<String> excludeList) { List<String> formattedList = excludeList.stream().map(field -> String.format("'%s' : 0", field)) .collect(Collectors.toList()); return "{ " + String.join(", ", formattedList) + " }"; }
Source:
<code>private void scanRoot(Node n) { if (n.isFunction()) { if (inputId == null) { inputId = NodeUtil.getInputId(n); } final Node fnNameNode = n.getFirstChild(); final Node args = fnNameNode.getNext(); String fnName = fnNameNode.getString(); if (!fnName.isEmpty() && NodeUtil.isFunctionExpression(n)) { declareVar(fnNameNode); } Preconditions.checkState(args.isParamList()); for (Node a = args.getFirstChild(); a != null; a = a.getNext()) { if (a.isDefaultValue() || a.isRest()) { declareLHS(scope, a.getFirstChild()); } else { declareLHS(scope, a); } } } else if (n.isClass()) { if (scope.getParent() != null) { inputId = NodeUtil.getInputId(n); } final Node classNameNode = n.getFirstChild(); if (!classNameNode.isEmpty()) { String className = classNameNode.getString(); <START> if (!className.isEmpty() && NodeUtil.isClassExpression(n)) { <END> declareVar(classNameNode); } } } else if (n.isBlock() || n.isFor() || n.isForOf() || n.isSwitch()) { if (scope.getParent() != null) { inputId = NodeUtil.getInputId(n); } scanVars(n); } else { Preconditions.checkState(scope.getParent() == null); scanVars(n); } }</code><technical_language>class name, EMPTY node empty string function nodes</technical_language>

Target:
private void scanRoot(Node n) { if (n.isFunction()) { if (inputId == null) { inputId = NodeUtil.getInputId(n); } final Node fnNameNode = n.getFirstChild(); final Node args = fnNameNode.getNext(); String fnName = fnNameNode.getString(); if (!fnName.isEmpty() && NodeUtil.isFunctionExpression(n)) { declareVar(fnNameNode); } Preconditions.checkState(args.isParamList()); for (Node a = args.getFirstChild(); a != null; a = a.getNext()) { if (a.isDefaultValue() || a.isRest()) { declareLHS(scope, a.getFirstChild()); } else { declareLHS(scope, a); } } } else if (n.isClass()) { if (scope.getParent() != null) { inputId = NodeUtil.getInputId(n); } final Node classNameNode = n.getFirstChild(); if (!classNameNode.isEmpty()) { if (NodeUtil.isClassExpression(n)) { declareVar(classNameNode); } } } else if (n.isBlock() || n.isFor() || n.isForOf() || n.isSwitch()) { if (scope.getParent() != null) { inputId = NodeUtil.getInputId(n); } scanVars(n); } else { Preconditions.checkState(scope.getParent() == null); scanVars(n); } }
Source:
<code>public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) throws Exception { if (!active) { return; } if (cause instanceof ReadTimeoutException) { <START> ActiveMQClientLogger.LOGGER.error("Connection without communication timeout has expired."); <END> } ActiveMQException me = ActiveMQClientMessageBundle.BUNDLE.nettyError(); me.initCause(cause); synchronized (listener) { try { listener.connectionException(channelId(ctx.channel()), me); active = false; } catch (Exception ex) { ActiveMQClientLogger.LOGGER.errorCallingLifeCycleListener(ex); } } }</code><technical_language>a specific error code defined in ActiveMQClientLogger that</technical_language>

Target:
public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) throws Exception { if (!active) { return; } ActiveMQException me = ActiveMQClientMessageBundle.BUNDLE.nettyError(); me.initCause(cause); synchronized (listener) { try { listener.connectionException(channelId(ctx.channel()), me); active = false; } catch (Exception ex) { ActiveMQClientLogger.LOGGER.errorCallingLifeCycleListener(ex); } } }
Source:
<code>private void calculateHashes(AbstractFile file, IngestJobTotals totals) throws TskCoreException { String md5Hash = file.getMd5Hash(); String sha256Hash = file.getSha256Hash(); if ((md5Hash != null && md5Hash.isEmpty()) && (sha256Hash != null && sha256Hash.isEmpty())) { <START> return; <END> } TimingMetric metric = HealthMonitor.getTimingMetric("Disk Reads: Hash calculation"); long calcstart = System.currentTimeMillis(); List<HashUtility.HashResult> newHashResults = HashUtility.calculateHashes(file, Arrays.asList(HashUtility.HashType.MD5,HashUtility.HashType.SHA256 )); if (file.getSize() > 0) { if (file.getSize() < 1000000) { HealthMonitor.submitTimingMetric(metric); } else { HealthMonitor.submitNormalizedTimingMetric(metric, file.getSize() / 500000); } } for (HashUtility.HashResult hash : newHashResults) { if (hash.getType().equals(HashUtility.HashType.MD5)) { file.setMd5Hash(hash.getValue()); } else if (hash.getType().equals(HashUtility.HashType.SHA256)) { file.setSha256Hash(hash.getValue()); } } long delta = (System.currentTimeMillis() - calcstart); totals.totalCalctime.addAndGet(delta); }</code><technical_language>this code wrong. string versions of hash non-empty a hash calculated (assuming is malicious code setXxHash() garbage)</technical_language>

Target:
private void calculateHashes(AbstractFile file, IngestJobTotals totals) throws TskCoreException { String md5Hash = file.getMd5Hash(); String sha256Hash = file.getSha256Hash(); if ((md5Hash != null && ! md5Hash.isEmpty()) && (sha256Hash != null && ! sha256Hash.isEmpty())) { return; } TimingMetric metric = HealthMonitor.getTimingMetric("Disk Reads: Hash calculation"); long calcstart = System.currentTimeMillis(); List<HashUtility.HashResult> newHashResults = HashUtility.calculateHashes(file, Arrays.asList(HashUtility.HashType.MD5,HashUtility.HashType.SHA256 )); if (file.getSize() > 0) { if (file.getSize() < 1000000) { HealthMonitor.submitTimingMetric(metric); } else { HealthMonitor.submitNormalizedTimingMetric(metric, file.getSize() / 500000); } } for (HashUtility.HashResult hash : newHashResults) { if (hash.getType().equals(HashUtility.HashType.MD5)) { file.setMd5Hash(hash.getValue()); } else if (hash.getType().equals(HashUtility.HashType.SHA256)) { file.setSha256Hash(hash.getValue()); } } long delta = (System.currentTimeMillis() - calcstart); totals.totalCalctime.addAndGet(delta); }
Source:
<code>public String toString() { <START> return "DatabaseInfo{" <END> + "Location='" + mLocation + '\'' + ", OwnerName='" + mOwnerName + '\'' + ", OwnerType=" + mOwnerType + ", Comment='" + mComment + '\'' + ", Parameters=" + mParameters + '}'; }</code><technical_language>MoreObjects.toStringHelper(this) do in codebase</technical_language>

Target:
public String toString() { return MoreObjects.toStringHelper(this) .add("location", mLocation) .add("ownerName", mOwnerName) .add("ownerType", mOwnerType) .add("comment", mComment) .add("parameters", mParameters) .toString(); }
Source:
<code>protected boolean canDoAction() { parameters = getParameters(); if (super.canDoAction() && getGeoRepSession().getStatus() == GeoRepSessionStatus.ACTIVE) { GlusterVolumeEntity masterVolume = getGlusterVolume(); if (masterVolume.getStatus() == GlusterStatus.UP) { VDS slaveVds = getVdsDAO().getByName(parameters.getSlaveHost()); if(slaveVds != null) { GlusterVolumeEntity slaveVolumeEntity = getGlusterVolumeDao().getByName(slaveVds.getVdsGroupId(), parameters.getSlaveVolumeName()); return (slaveVolumeEntity == null ? false : slaveVolumeEntity.getStatus() == GlusterStatus.UP) <START> && (masterVolume.getAdvancedDetails().getCapacityInfo().getFreeSize() < slaveVolumeEntity.getAdvancedDetails().getCapacityInfo().getFreeSize()); <END> } else { return true; } } else { return false; } } else { if(getGeoRepSession().getStatus() == GeoRepSessionStatus.PASSIVE) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GEOREP_SESSION_PAUSED); } return false; } }</code><technical_language>required check size for pause</technical_language>

Target:
protected boolean canDoAction() { setGlusterVolumeId(getGeoRepSession().getMasterVolumeId()); if (!super.canDoAction()) { return false; } if (getGeoRepSession().getStatus() == GeoRepSessionStatus.PASSIVE) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GEOREP_SESSION_ALREADY_PAUSED); } return false; }
Source:
<code>public Response uploadCompleted(@PathParam(REQUEST_BATCH_ID) String batchId , @PathParam(REQUEST_FILE_IDX) String fileIdx, String body ) throws Exception { JsonNode jsonNode = new ObjectMapper().readTree(body); Batch batch = batchManager.getBatch(batchId); <START> if (batch == null) { <END> return Response.status(Status.NOT_FOUND).build(); } Long fileSize = jsonNode.hasNonNull("fileSize") ? jsonNode.get("fileSize").asLong() : -1L; String md5 = jsonNode.hasNonNull("md5") ? jsonNode.get("md5").asText() : null; String name = jsonNode.hasNonNull("name") ? jsonNode.get("name").asText() : null; String mimeType = jsonNode.hasNonNull("mimeType") ? jsonNode.get("mimeType").asText(null) : null; String key = jsonNode.hasNonNull("key") ? jsonNode.get("key").asText(null) : null; String etag = jsonNode.hasNonNull("etag") ? jsonNode.get("etag").asText(null) : null; BatchFileInfo batchFileInfo = BatchFileInfo.builder() .withFileSize(fileSize) .withMd5(md5) .withName(name) .withMimeType(mimeType) .withKey(key) .build(); BatchHandler handler = batchManager.getHandlerByName(batch.getProvider()); if (handler.completeUpload(batchId, fileIdx, batchFileInfo)) { return Response.ok().build(); } return Response.status(Status.CONFLICT).build(); }</code><technical_language>Format</technical_language>

Target:
public Response uploadCompleted(@PathParam(REQUEST_BATCH_ID) String batchId, @PathParam(REQUEST_FILE_IDX) String fileIdx, String body) throws IOException { BatchManager bm = Framework.getService(BatchManager.class); JsonNode jsonNode = new ObjectMapper().readTree(body); Batch batch = bm.getBatch(batchId); if (batch == null) { return buildEmptyResponse(Status.NOT_FOUND); } String key = jsonNode.hasNonNull(KEY) ? jsonNode.get(KEY).asText(null) : null; String filename = jsonNode.hasNonNull(NAME) ? jsonNode.get(NAME).asText() : null; String mimeType = jsonNode.hasNonNull(MIMETYPE) ? jsonNode.get(MIMETYPE).asText(null) : null; Long length = jsonNode.hasNonNull(FILE_SIZE) ? jsonNode.get(FILE_SIZE).asLong() : -1L; String md5 = jsonNode.hasNonNull(MD5) ? jsonNode.get(MD5).asText() : null; BatchFileInfo batchFileInfo = new BatchFileInfo(key, filename, mimeType, length, md5); BatchHandler handler = bm.getHandler(batch.getHandlerName()); if (!handler.completeUpload(batchId, fileIdx, batchFileInfo)) { return Response.status(Status.CONFLICT).build(); } Map<String, Object> result = new HashMap<>(); result.put("uploaded", "true"); result.put("batchId", batchId); result.put("fileIdx", fileIdx); return buildResponse(Status.OK, result); }
Source:
<code>protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String currentLeader; String requestURI = StringUtils.toLowerCase(request.getRequestURI()); if (requestURI.startsWith(STANDARD_COORDINATOR_BASE_PATH)) { currentLeader = coordLeaderSelector.getCurrentLeader(); } else if (requestURI.startsWith(STANDARD_OVERLORD_BASE_PATH)) { currentLeader = overlordLeaderSelector.getCurrentLeader(); } else if (requestURI.startsWith(ARBITRARY_COORDINATOR_BASE_PATH)) { currentLeader = coordLeaderSelector.getCurrentLeader(); request.setAttribute( MODIFIED_PATH_ATTRIBUTE, request.getRequestURI().substring(ARBITRARY_COORDINATOR_BASE_PATH.length()) ); } else if (requestURI.startsWith(ARBITRARY_OVERLORD_BASE_PATH)) { currentLeader = overlordLeaderSelector.getCurrentLeader(); request.setAttribute( MODIFIED_PATH_ATTRIBUTE, request.getRequestURI().substring(ARBITRARY_OVERLORD_BASE_PATH.length()) ); } else { <START> handleBadRequest(response, "Unsupported proxy destination"); <END> return; } if (currentLeader == null) { handleBadRequest(response, "Unable to determine destination; is your coordinator/overlord running?"); return; } request.setAttribute(BASE_URI_ATTRIBUTE, currentLeader); super.service(request, response); }</code><technical_language>nice if error message shows wrong URI</technical_language>

Target:
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String currentLeader; String requestURI = StringUtils.toLowerCase(request.getRequestURI()); if (requestURI.startsWith(STANDARD_COORDINATOR_BASE_PATH)) { currentLeader = coordLeaderSelector.getCurrentLeader(); } else if (requestURI.startsWith(STANDARD_OVERLORD_BASE_PATH)) { currentLeader = overlordLeaderSelector.getCurrentLeader(); } else if (requestURI.startsWith(ARBITRARY_COORDINATOR_BASE_PATH)) { currentLeader = coordLeaderSelector.getCurrentLeader(); request.setAttribute( MODIFIED_PATH_ATTRIBUTE, request.getRequestURI().substring(ARBITRARY_COORDINATOR_BASE_PATH.length()) ); } else if (requestURI.startsWith(ARBITRARY_OVERLORD_BASE_PATH)) { currentLeader = overlordLeaderSelector.getCurrentLeader(); request.setAttribute( MODIFIED_PATH_ATTRIBUTE, request.getRequestURI().substring(ARBITRARY_OVERLORD_BASE_PATH.length()) ); } else { handleBadRequest(response, StringUtils.format("Unsupported proxy destination [%s]", request.getRequestURI())); return; } if (currentLeader == null) { handleBadRequest( response, StringUtils.format( "Unable to determine destination for [%s]; is your coordinator/overlord running?", request.getRequestURI() ) ); return; } request.setAttribute(BASE_URI_ATTRIBUTE, currentLeader); super.service(request, response); }
Source:
<code>public Policy updatePolicy(Policy policy) { String hql = "UPDATE Policy SET policy = :policy " + "WHERE tenant = :tenant and internalId.id = :id"; Query query = this.currentSession().createQuery(hql); query.setParameter("policy", policy.getPolicy()); query.setParameter("tenant", policy.getInternalId().getTenant()); query.setParameter("id", policy.getInternalId().getId()); int result = query.executeUpdate(); <START> System.out.println("The result of the update is " + result); <END> return policy; }</code><technical_language>Remove statement</technical_language>

Target:
public Policy updatePolicy(Policy policy) { String hql = "UPDATE Policy SET policy = :policy " + "WHERE tenant = :tenant and internalId.id = :id"; Query query = this.currentSession().createQuery(hql); query.setParameter("policy", policy.getPolicy()); query.setParameter("tenant", policy.getInternalId().getTenant()); query.setParameter("id", policy.getInternalId().getId()); int result = query.executeUpdate(); return policy; }
Source:
<code>public void before() { final NoOpRecordCollector collector = new NoOpRecordCollector() { @Override public <K, V> void send(final String topic, final K key, final V value, final Headers headers, final Integer partition, final Long timestamp, final Serializer<K> keySerializer, final Serializer<V> valueSerializer) { sent.put(key, ValueAndTimestamp.make((byte[]) value, timestamp)); } }; <START> final StreamsMetricsImpl streamsMetrics = niceMock(StreamsMetricsImpl.class); replay(streamsMetrics); <END> final InternalMockProcessorContext context = new InternalMockProcessorContext( TestUtils.tempDirectory(), Serdes.String(), Serdes.Long(), collector, new ThreadCache(new LogContext("testCache "), 0, streamsMetrics)); context.setTime(0); store.init(context, store); }</code><technical_language>question mocks above</technical_language>

Target:
public void before() { final NoOpRecordCollector collector = new NoOpRecordCollector() { @Override public <K, V> void send(final String topic, final K key, final V value, final Headers headers, final Integer partition, final Long timestamp, final Serializer<K> keySerializer, final Serializer<V> valueSerializer) { sent.put(key, ValueAndTimestamp.make((byte[]) value, timestamp)); } }; final InternalMockProcessorContext context = new InternalMockProcessorContext( TestUtils.tempDirectory(), Serdes.String(), Serdes.Long(), collector, new ThreadCache( new LogContext("testCache "), 0, new StreamsMetricsImpl(new Metrics(), "test", StreamsConfig.METRICS_LATEST))); context.setTime(0); store.init(context, store); }
Source:
<code>public static ArrayList<Integer> johnsonLindenStraussMinDim(int n, double... eps){ return johnsonLindenstraussMinDim(new int[]{n}, eps); <START> } <END></code><technical_language>This feels vectorized</technical_language>

Target:
public static List<Integer> johnsonLindenStraussMinDim(int n, double... eps){ return johnsonLindenstraussMinDim(new int[]{n}, eps); }
Source:
<code>public static void deleteCommunity(UUID uuid) throws SQLException, IOException { try (Context c = new Context()) { c.turnOffAuthorisationSystem(); Community community = communityService.find(c, uuid); if (community != null) { try { if (community.getAdministrators() != null) { <START> Group adminGroup = community.getAdministrators(); <END> communityService.removeAdministrators(c, community); groupService.delete(c, adminGroup); } communityService.delete(c, community); } catch (AuthorizeException e) { throw new RuntimeException(e.getMessage(), e); } } c.complete(); } }</code><technical_language>move if please</technical_language>

Target:
public static void deleteCommunity(UUID uuid) throws SQLException, IOException { try (Context c = new Context()) { c.turnOffAuthorisationSystem(); Community community = communityService.find(c, uuid); if (community != null) { try { Group adminGroup = community.getAdministrators(); if (adminGroup != null) { communityService.removeAdministrators(c, community); groupService.delete(c, adminGroup); } communityService.delete(c, community); } catch (AuthorizeException e) { throw new RuntimeException(e.getMessage(), e); } } c.complete(); } }