auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private String deleteBucket() throws CommandException, IOException { try { getClient().deleteBucket(new DeleteBucketRequest(bucketName)); } catch (final FailedRequestException e) { if (CommandExceptionFactory.hasStatusCode(e, 409)) { CommandExceptionFactory.getInstance().handleException(this.getClass().getSimpleName(), new CommandException("Error: Tried to delete a non-empty bucket.\nUse --force to delete all objects in the bucket."), true); } <START> CommandExceptionFactory.getInstance().handleException(this.getClass().getSimpleName(), e, true); <END> } return "Success: Deleted bucket '" + bucketName + "'."; }</code><technical_language>Exceptions handled in of commands. calling layer that</technical_language>

Target:
private String deleteBucket() throws CommandException, IOException { try { getClient().deleteBucket(new DeleteBucketRequest(bucketName)); } catch (final FailedRequestException e) { if (e.getStatusCode() == 409) { throw new CommandException("Error: Tried to delete a non-empty bucket.\nUse --force to delete all objects in the bucket."); } throw e; } return "Success: Deleted bucket '" + bucketName + "'."; }
Source:
<code>public PinotColumnMetadata(String name, Type type) { super(name, type); this.name = name; <START> } <END></code><technical_language>requireNonNull</technical_language>

Target:
public PinotColumnMetadata(String name, Type type) { super(requireNonNull(name, "name is null"), requireNonNull(type, "type is null")); this.name = name; }
Source:
<code>RSocketServer(DuplexConnection connection, RSocket requestHandler, Consumer<Throwable> errorConsumer) { this.connection = connection; this.requestHandler = requestHandler; this.errorConsumer = errorConsumer; this.sendingSubscriptions = new IntObjectHashMap<>(); this.channelProcessors = new IntObjectHashMap<>(); this.receiveDisposable = connection .receive() .flatMap(this::handleFrame) .doOnError(t -> { errorConsumer.accept(t); Collection<Subscription> values; synchronized (this) { <START> values = sendingSubscriptions.values(); <END> } values .forEach(Subscription::cancel); }) .then() .subscribe(); this.connection .onClose() .doOnError(errorConsumer::accept) .doFinally(s -> { cleanup(); receiveDisposable.dispose(); }) .subscribe(); }</code><technical_language>IntObjectHashMap::values() a live view of map. I trust concurrency here</technical_language>

Target:
RSocketServer(DuplexConnection connection, RSocket requestHandler, Consumer<Throwable> errorConsumer) { this.connection = connection; this.requestHandler = requestHandler; this.errorConsumer = errorConsumer; this.sendingSubscriptions = new IntObjectHashMap<>(); this.channelProcessors = new IntObjectHashMap<>(); this.receiveDisposable = connection .receive() .flatMap(this::handleFrame) .doOnError(errorConsumer::accept) .then() .subscribe(); this.connection .onClose() .doOnError(errorConsumer::accept) .doFinally(s -> { cleanup(); receiveDisposable.dispose(); }) .subscribe(); }
Source:
<code>public void checkEndOfExecutionPath(CheckerContext context, ConstraintManager constraintManager) { ExplodedGraph.Node exitNode = context.getNode(); exitNode.parents().stream().forEach(node -> { MethodYield yield = exitNode.selectedMethodYield(node); <START> if (yield instanceof ExceptionalCheckBasedYield && ((ExceptionalCheckBasedYield) yield).raisedByCheck(this)) { <END> reportIssueOnMethodInvocation(node); } }); }</code><technical_language>polymorphism : "raised check" part of yield interface. (thus changing name generatedByCheck(...)) default implem returning false</technical_language>

Target:
public void checkEndOfExecutionPath(CheckerContext context, ConstraintManager constraintManager) { ExplodedGraph.Node exitNode = context.getNode(); exitNode.parents().stream().forEach(node -> { MethodYield yield = exitNode.selectedMethodYield(node); if (yield != null && yield.generatedByCheck(this)) { reportIssueOnMethodInvocation(node); } }); }
Source:
<code>private Session session() throws IOException { try { JSch.setConfig("StrictHostKeyChecking", "no"); JSch.setLogger(SSHChannel.LOGGER); final JSch jsch = new JSch(); final File file = this.key.asFile(); jsch.setHostKeyRepository(SSHChannel.REPO); jsch.addIdentity(file.getAbsolutePath()); Logger.info( this, "Opening SSH session to %s@%s:%s (%d bytes in RSA key)...", this.login, this.addr, this.port, file.length() ); final Session session = jsch.getSession( this.login, this.addr, this.port ); <START> session.setServerAliveInterval((int) TimeUnit.SECONDS.toMillis(10)); <END> session.setServerAliveCountMax(Tv.MILLION); session.connect(); return session; } catch (JSchException ex) { throw new IOException(ex); } }</code><technical_language>I bet Qulice complain this magic number. Tv.TEN instead</technical_language>

Target:
private Session session() throws IOException { try { JSch.setConfig("StrictHostKeyChecking", "no"); JSch.setLogger(SSHChannel.LOGGER); final JSch jsch = new JSch(); final File file = this.key.asFile(); jsch.setHostKeyRepository(SSHChannel.REPO); jsch.addIdentity(file.getAbsolutePath()); Logger.info( this, "Opening SSH session to %s@%s:%s (%d bytes in RSA key)...", this.login, this.addr, this.port, file.length() ); final Session session = jsch.getSession( this.login, this.addr, this.port ); session.setServerAliveInterval( (int) TimeUnit.SECONDS.toMillis(Tv.TEN) ); session.setServerAliveCountMax(Tv.MILLION); session.connect(); return session; } catch (JSchException ex) { throw new IOException(ex); } }
Source:
<code>public void testCreateEnvironmentClientCertificateCredential() { <START> Configuration configuration = Configuration.getGlobalConfiguration(); <END> configuration.put(Configuration.PROPERTY_AZURE_CLIENT_ID, "foo"); configuration.put(Configuration.PROPERTY_AZURE_CLIENT_CERTIFICATE_PATH, "bar"); configuration.put(Configuration.PROPERTY_AZURE_TENANT_ID, "baz"); EnvironmentCredential credential = new EnvironmentCredentialBuilder().build(); StepVerifier.create(credential.getToken(new TokenRequestContext().addScopes("qux/.default")) .doOnSuccess(s -> fail()) .onErrorResume(t -> { String message = t.getMessage(); Assert.assertFalse(message != null && message.contains("Cannot create any credentials with the current environment variables")); return Mono.just(new AccessToken("token", OffsetDateTime.MAX)); })) .expectNextMatches(token -> "token".equals(token.getToken())) .verifyComplete(); }</code><technical_language>remove local instance Configuration fluent pattern for put</technical_language>

Target:
public void testCreateEnvironmentClientCertificateCredential() { Configuration.getGlobalConfiguration() .put(Configuration.PROPERTY_AZURE_CLIENT_ID, "foo") .put(Configuration.PROPERTY_AZURE_USERNAME, "bar") .put(Configuration.PROPERTY_AZURE_PASSWORD, "baz"); EnvironmentCredential credential = new EnvironmentCredentialBuilder().build(); StepVerifier.create(credential.getToken(new TokenRequestContext().addScopes("qux/.default")) .doOnSuccess(s -> fail()) .onErrorResume(t -> { String message = t.getMessage(); Assert.assertFalse(message != null && message.contains("Cannot create any credentials with the current environment variables")); return Mono.just(new AccessToken("token", OffsetDateTime.MAX)); })) .expectNextMatches(token -> "token".equals(token.getToken())) .verifyComplete(); }
Source:
<code>public void resolveNegativeEntryNumber() throws Exception { Git git = new Git(db); writeTrashFile("file.txt", "content"); git.add().addFilepattern("file.txt").call(); git.commit().setMessage("create file").call(); try { db.resolve("master@{-12}"); fail("Exception not thrown"); <START> } catch (IOException e) { <END> assertNotNull(e); } }</code><technical_language>catch RevisionSyntaxException here. Other exceptions real errors</technical_language>

Target:
public void resolveNegativeEntryNumber() throws Exception { Git git = new Git(db); writeTrashFile("file.txt", "content"); git.add().addFilepattern("file.txt").call(); git.commit().setMessage("create file").call(); try { db.resolve("master@{-12}"); fail("Exception not thrown"); } catch (RevisionSyntaxException e) { assertNotNull(e); } }
Source:
<code>protected void propertyChanged() { <START> super.propertyChanged(); <END> deriveAndSet(); }</code><technical_language>if people override this method forget call super.propertyChanged(). derived longer available. want DynamicSetProperty if trick avoid happening</technical_language>

Target:
protected void propertyChanged()
Source:
<code>public Expression implement( RexToLixTranslator translator, RexCall call, List<Expression> expressions) { if (backupMethodName != null) { if (anyAnyOperands(call)) { return callBackupMethodAnyType(translator, call, expressions); } final Type type0 = expressions.get(0).getType(); final Type type1 = expressions.get(1).getType(); final SqlBinaryOperator op = (SqlBinaryOperator) call.getOperator(); final Primitive primitive = Primitive.ofBoxOr(type0); if (primitive == null || type1 == BigDecimal.class || COMPARISON_OPERATORS.contains(op) && !COMP_OP_TYPES.contains(primitive)) { return Expressions.call(SqlFunctions.class, backupMethodName, expressions); } final Primitive boxPrimitive0 = Primitive.ofBox(type0); final Primitive boxPrimitive1 = Primitive.ofBox(type1); if (EQUALS_OPERATORS.contains(op) && boxPrimitive0 != null && boxPrimitive1 != null && !isConstantNullExpression(expressions.get(0)) <START> && !isConstantNullExpression(expressions.get(1))) { <END> return Expressions.call(SqlFunctions.class, backupMethodName, expressions); } } final Type returnType = translator.typeFactory.getJavaClass(call.getType()); return RexToLixTranslator.convert( Expressions.makeBinary(expressionType, expressions.get(0), expressions.get(1)), returnType); }</code><technical_language>if operand is Long another is Integer</technical_language>

Target:
public Expression implement( RexToLixTranslator translator, RexCall call, List<Expression> expressions) { if (backupMethodName != null) { if (anyAnyOperands(call)) { return callBackupMethodAnyType(translator, call, expressions); } final Type type0 = expressions.get(0).getType(); final Type type1 = expressions.get(1).getType(); final SqlBinaryOperator op = (SqlBinaryOperator) call.getOperator(); final Primitive primitive = Primitive.ofBoxOr(type0); if (primitive == null || type1 == BigDecimal.class || COMPARISON_OPERATORS.contains(op) && !COMP_OP_TYPES.contains(primitive)) { return Expressions.call(SqlFunctions.class, backupMethodName, expressions); } final Primitive boxPrimitive0 = Primitive.ofBox(type0); final Primitive boxPrimitive1 = Primitive.ofBox(type1); if (EQUALS_OPERATORS.contains(op) && boxPrimitive0 != null && boxPrimitive1 != null) { return Expressions.call(SqlFunctions.class, backupMethodName, expressions); } } final Type returnType = translator.typeFactory.getJavaClass(call.getType()); return RexToLixTranslator.convert( Expressions.makeBinary(expressionType, expressions.get(0), expressions.get(1)), returnType); }
Source:
<code>public Response enforce(@PathParam("tenant") String tenant, String xacmlRequest) { <START> LOGGER.debug("Enforcing policies for tenant [" + tenant + "]"); <END> PDP pdp = pdpFactory.get(tenant, extractSubjectIds(xacmlRequest)); return Response.ok(pdp.evaluate(xacmlRequest)).build(); }</code><technical_language><LINK_0></technical_language>

Target:
public Response enforce(@PathParam("tenant") String tenant, String xacmlRequest) { LOGGER.debug("Enforcing policies for tenant [{}]", tenant); PDP pdp = pdpFactory.get(tenant, extractSubjectIds(xacmlRequest)); return Response.ok(pdp.evaluate(xacmlRequest)).build(); }
Source:
<code>private void handleInternalLink(PageTitle title) { if (!isAdded()) { return; } if (title.isSpecial()) { Utils.visitInExternalBrowser(getActivity(), Uri.parse(title.getMobileUri())); return; } if (referenceDialog != null && referenceDialog.isShowing()) { referenceDialog.dismiss(); } <START> if (title.getNamespace() != null || (!app.isProdRelease() && app.getLinkPreviewVersion() == 0)) { <END> HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_INTERNAL_LINK); getPageActivity().displayNewPage(title, historyEntry); new LinkPreviewFunnel(app).logNavigate(); } else { getPageActivity().showLinkPreview(title, HistoryEntry.SOURCE_INTERNAL_LINK); } }</code><technical_language>TextUtils.isEmpty()</technical_language>

Target:
private void handleInternalLink(PageTitle title) { if (!isAdded()) { return; } if (title.isSpecial()) { Utils.visitInExternalBrowser(getActivity(), Uri.parse(title.getMobileUri())); return; } if (referenceDialog != null && referenceDialog.isShowing()) { referenceDialog.dismiss(); } if (!TextUtils.isEmpty(title.getNamespace()) || (!app.isProdRelease() && app.getLinkPreviewVersion() == 0)) { HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_INTERNAL_LINK); getPageActivity().displayNewPage(title, historyEntry); new LinkPreviewFunnel(app).logNavigate(); } else { getPageActivity().showLinkPreview(title, HistoryEntry.SOURCE_INTERNAL_LINK); } }
Source:
<code>public synchronized T get() { if (container==null) { Class<T> fixture = (Class<T>) type.getRawType(); File buildlog = diag.touch("docker-" + fixture.getSimpleName() + ".build.log"); File runlog = diag.touch("docker-" + fixture.getSimpleName() + ".run.log"); try { Starter<T> containerStarter = docker.build(fixture, buildlog).start(fixture); <START> if (portOffset != null) containerStarter.withPortOffset(portOffset); <END> container = containerStarter.withLog(runlog).start(); } catch (InterruptedException | IOException e) { throw new Error("Failed to start container - " + fixture.getName(), e); } } return container; }</code><technical_language>if (portOffset != null) { containerStarter.withPortOffset(portOffset); }</technical_language>

Target:
public synchronized T get() { if (container==null) { Class<T> fixture = (Class<T>) type.getRawType(); File buildlog = diag.touch("docker-" + fixture.getSimpleName() + ".build.log"); File runlog = diag.touch("docker-" + fixture.getSimpleName() + ".run.log"); try { Starter<T> containerStarter = docker.build(fixture, buildlog).start(fixture); if (portOffset != null) { containerStarter.withPortOffset(portOffset); } container = containerStarter.withLog(runlog).start(); } catch (InterruptedException | IOException e) { throw new Error("Failed to start container - " + fixture.getName(), e); } } return container; }
Source:
<code>private static boolean isGraphicsMagickAvailable() { CompareCmd gmConsole = new CompareCmd(true); gmConsole.setOutputConsumer(new ArrayListOutputConsumer()); IMOperation gmOperation = new IMOperation(); try { gmConsole.run(gmOperation.version()); } catch (IOException e) { <START> return false; <END> } catch (InterruptedException e) { return false; } catch (IM4JavaException e) { return false; } return true; }</code><technical_language>@danielsuter I guess a good idea output some log in this case here, a chance a installation in log wrong (this is loged once, okay)</technical_language>

Target:
private static boolean isGraphicsMagickAvailable() { CompareCmd gmConsole = new CompareCmd(true); gmConsole.setOutputConsumer(new ArrayListOutputConsumer()); IMOperation gmOperation = new IMOperation(); try { gmConsole.run(gmOperation.version()); } catch (IOException e) { LOGGER.warn(e, e); return false; } catch (InterruptedException e) { LOGGER.warn(e, e); return false; } catch (IM4JavaException e) { LOGGER.warn(e, e); return false; } return true; }
Source:
<code>public void checkForSurvey(final SurveyCallbacks callbacks) { if (MPConfig.DEBUG) Log.d(LOGTAG, "Checking for surveys..."); if (null == callbacks) { Log.i(LOGTAG, "Skipping survey check because callback is null."); return; } final String checkDistinctId = getDistinctId(); if (null == checkDistinctId) { Log.i(LOGTAG, "Skipping survey check because user has not yet been identified."); return; } <START> if (Build.VERSION.SDK_INT < 10) { END> Log.i(LOGTAG, "Surveys not supported on OS older than API 10, reporting null."); callbacks.foundSurvey(null); return; } mDecideUpdates.setSurveyCallback(callbacks, checkDistinctId, mMessages); }</code><technical_language>I agree this behavior--no point in logic http request if do anything</technical_language>

Target:
public void checkForSurvey(final SurveyCallbacks callbacks) { if (MPConfig.DEBUG) Log.d(LOGTAG, "Checking for surveys..."); if (null == callbacks) { Log.i(LOGTAG, "Skipping survey check because callback is null."); return; } final Survey found = getNextSurvey(); callbacks.foundSurvey(found); }
Source:
<code>public synchronized void close() throws IOException { if (writeBuffer != null) { ReferenceCountUtil.safeRelease(writeBuffer); <START> writeBuffer = null; <END> } fileChannel.close(); }</code><technical_language>advantage in setting null writeBuffer in close method? simpler if writeBuffer is final variable calling ReferenceCountUtil.safeRelease(writeBuffer) null check</technical_language>

Target:
public synchronized void close() throws IOException { ReferenceCountUtil.safeRelease(writeBuffer); fileChannel.close(); }
Source:
<code>public WrapperHelper compile(Class<?> wrapperType, Method[] setMethods, Method[] getMethods, Method[] jaxbMethods, Field[] fields, Object objectFactory) { int count = 1; String newClassName = wrapperType.getName() + "_WrapperTypeHelper" + count; Class<?> cls = loadClass(newClassName, WrapperHelperClassLoader.class); while (cls != null) { try { WrapperHelper helper = WrapperHelper.class.cast(cls.getDeclaredConstructor().newInstance()); if (!helper.getSignature().equals(WrapperHelperCompiler.computeSignature(setMethods, getMethods))) { count++; newClassName = wrapperType.getName() + "_WrapperTypeHelper" + count; cls = loadClass(newClassName, WrapperHelperClassLoader.class); } else { return helper; } <START> } catch (Exception e) { <END> return null; } } return null; }</code><technical_language>Please catch Throwable cover XxxError (like VerifyError fe)</technical_language>

Target:
public WrapperHelper compile(Class<?> wrapperType, Method[] setMethods, Method[] getMethods, Method[] jaxbMethods, Field[] fields, Object objectFactory) { int count = 1; String newClassName = wrapperType.getName() + "_WrapperTypeHelper" + count; Class<?> cls = findClass(newClassName, wrapperType); while (cls != null) { try { WrapperHelper helper = WrapperHelper.class.cast(cls.getDeclaredConstructor().newInstance()); if (!helper.getSignature().equals( WrapperHelperClassGenerator.computeSignature(setMethods, getMethods))) { count++; newClassName = wrapperType.getName() + "_WrapperTypeHelper" + count; cls = findClass(newClassName, wrapperType); } else { return helper; } } catch (Exception e) { return null; } } return null; }
Source:
<code>protected Object doExecute() throws Exception { printInitCommand("Shows GRE tunnels"); try { IResource router = getResourceFromFriendlyName(resourceId); IGRETunnelCapability tunnelCapability = (IGRETunnelCapability) router.getCapabilityByInterface(IGRETunnelCapability.class); <START> tunnelCapability.showGRETunnelConfiguration(); <END> List<GRETunnelService> lGRETunnelService = tunnelCapability.showGRETunnelConfiguration(); if (lGRETunnelService == null || lGRETunnelService.isEmpty()) { printInfo("No GRE tunnels configured on the router"); } else { printGRETunnelConfiguration(lGRETunnelService); } return null; } catch (ResourceException e) { printError(e); printEndCommand(); return -1; } catch (Exception e) { printError("Error showing GRE tunnels"); printError(e); printEndCommand(); return -1; } }</code><technical_language>iep! This removed. is need call (see below)</technical_language>

Target:
protected Object doExecute() throws Exception { printInitCommand("Shows GRE tunnels"); try { IResource router = getResourceFromFriendlyName(resourceId); IGRETunnelCapability tunnelCapability = (IGRETunnelCapability) router.getCapabilityByInterface(IGRETunnelCapability.class); List<GRETunnelService> lGRETunnelService = tunnelCapability.showGRETunnelConfiguration(); if (lGRETunnelService == null || lGRETunnelService.isEmpty()) { printInfo("No GRE tunnels configured on the router"); } else { printGRETunnelConfiguration(lGRETunnelService); } return null; } catch (ResourceException e) { printError(e); printEndCommand(); return -1; } catch (Exception e) { printError("Error showing GRE tunnels"); printError(e); printEndCommand(); return -1; } }
Source:
<code>private void waitForSilence() { PartitionedRegion region = (PartitionedRegion) cacheRule.getCache().getRegion(REGION_NAME); await().untilAsserted(() -> { <START> PartitionedRegionStats prStats = region.getPrStats(); <END> assertThat(prStats.getVolunteeringInProgress()).isEqualTo(0); assertThat(prStats.getBucketCreatesInProgress()).isEqualTo(0); assertThat(prStats.getPrimaryTransfersInProgress()).isEqualTo(0); assertThat(prStats.getRebalanceBucketCreatesInProgress()).isEqualTo(0); assertThat(prStats.getRebalancePrimaryTransfersInProgress()).isEqualTo(0); }); }</code><technical_language>This waits for message pertaining region creation status change. is DistributionMessageObserver if messages in progress</technical_language>

Target:
private void waitForSilence() { DMStats dmStats = cacheRule.getSystem().getDistributionManager().getStats(); PartitionedRegion region = (PartitionedRegion) cacheRule.getCache().getRegion(REGION_NAME); PartitionedRegionStats partitionedRegionStats = region.getPrStats(); await().untilAsserted(() -> { assertThat(dmStats.getReplyWaitsInProgress()).isEqualTo(0); assertThat(partitionedRegionStats.getVolunteeringInProgress()).isEqualTo(0); assertThat(partitionedRegionStats.getBucketCreatesInProgress()).isEqualTo(0); assertThat(partitionedRegionStats.getPrimaryTransfersInProgress()).isEqualTo(0); assertThat(partitionedRegionStats.getRebalanceBucketCreatesInProgress()).isEqualTo(0); assertThat(partitionedRegionStats.getRebalancePrimaryTransfersInProgress()).isEqualTo(0); }); }
Source:
<code>@Override public boolean isNullable() { <START> for (RelDataTypeField field : getFieldList()) { <END> if (!field.getType().isNullable()) { return false; } } return true; }</code><technical_language>SQL standard nullability of structured fileds depend field set independently. instead of checking fields of RelRecordType, I add a new attribute in class set appropriately</technical_language>

Target:
@Override public boolean isNullable() { return nullable; }
Source:
<code>ModelResolverDescriptor(IModelResolver resolver, String id, String label, String description) { super(); <START> Preconditions.checkArgument(resolver != null && id != null); <END> final String fLabel; if (label == null) { fLabel = id; } else { fLabel = label; } final String fDescription; if (description == null) { fDescription = ""; } else { fDescription = description; } this.label = fLabel; this.description = fDescription; this.resolver = resolver; this.id = id; }</code><technical_language>call checkargument is better. This get IAE line number give a clue parameter null</technical_language>

Target:
ModelResolverDescriptor(IModelResolver resolver, String id, String label, String description) { super(); Preconditions.checkArgument(resolver != null); Preconditions.checkArgument(id != null); final String fLabel; if (label == null) { fLabel = id; } else { fLabel = label; } this.label = fLabel; this.description = Strings.nullToEmpty(description); this.resolver = resolver; this.id = id; }
Source:
<code>public long commit() { long commitAddress; try { txBeginInternal(); operations.forEach(Runnable::run); } finally { <START> commitAddress = endTxn(); <END> } return commitAddress; }</code><technical_language>set startedReadWriteTxn=false also</technical_language>

Target:
public void commit() { commit(null); }
Source:
<code>private static CheckpointedInputGate buildGate(TestInvokable target, int numChannels) { <END> SingleInputGate gate = new SingleInputGateBuilder().setNumberOfChannels(numChannels).build(); <START> TestInputChannel[] channels = new TestInputChannel[numChannels]; for (int i = 0; i < numChannels; i++) { channels[i] = new TestInputChannel(gate, i); } gate.setInputChannels(channels); return new CheckpointedInputGate(gate, barrierHandler(gate, target), 0); }</code><technical_language>nit: a oneliner (Int)Stream</technical_language>

Target:
private static CheckpointedInputGate buildGate(TestInvokable target, int numChannels) { SingleInputGate gate = new SingleInputGateBuilder().setNumberOfChannels(numChannels).build(); TestInputChannel[] channels = new TestInputChannel[numChannels]; for (int i = 0; i < numChannels; i++) { channels[i] = new TestInputChannel(gate, i, false, true); } gate.setInputChannels(channels); return new CheckpointedInputGate(gate, barrierHandler(gate, target), 0); }
Source:
<code>public VersionedCommitCommand() { <START> super(ByteString.emptyString()); <END> }</code><technical_language>null, commands super(null) in "CommandIdUniquenessTest constructor"</technical_language>

Target:
public VersionedCommitCommand() { super(null); }
Source:
<code>public Expr apply(final List<Expr> args) { if (args.size() < 2 || args.size() > 3) { <START> throw new IAE("'%s' must have 2 or 3 arguments", name()); <END> } final Expr arg = args.get(0); final Expr patternExpr = args.get(1); final Expr escapeExpr = args.size() > 2 ? args.get(2) : null; if (!patternExpr.isLiteral() || (escapeExpr != null && !escapeExpr.isLiteral())) { throw new IAE("pattern and escape must be literals"); } final String escape = escapeExpr == null ? null : (String) escapeExpr.getLiteralValue(); final Character escapeChar; if (escape != null && escape.length() != 1) { throw new IllegalArgumentException("Escape must be null or a single character"); } else { escapeChar = (escape == null || escape.isEmpty()) ? null : escape.charAt(0); } final LikeDimFilter.LikeMatcher likeMatcher = LikeDimFilter.LikeMatcher.from( (String) patternExpr.getLiteralValue(), escapeChar ); class LikeExtractExpr implements Expr { @Nonnull @Override public ExprEval eval(final ObjectBinding bindings) { return ExprEval.of(likeMatcher.matches(arg.eval(bindings).asString()), ExprType.LONG); } @Override public void visit(final Visitor visitor) { arg.visit(visitor); visitor.visit(this); } } return new LikeExtractExpr(); }</code><technical_language>[%s] is</technical_language>

Target:
public Expr apply(final List<Expr> args) { if (args.size() < 2 || args.size() > 3) { throw new IAE("Function[%s] must have 2 or 3 arguments", name()); } final Expr arg = args.get(0); final Expr patternExpr = args.get(1); final Expr escapeExpr = args.size() > 2 ? args.get(2) : null; if (!patternExpr.isLiteral() || (escapeExpr != null && !escapeExpr.isLiteral())) { throw new IAE("pattern and escape must be literals"); } final String escape = escapeExpr == null ? null : (String) escapeExpr.getLiteralValue(); final Character escapeChar; if (escape != null && escape.length() != 1) { throw new IllegalArgumentException("Escape must be null or a single character"); } else { escapeChar = escape == null ? null : escape.charAt(0); } final LikeDimFilter.LikeMatcher likeMatcher = LikeDimFilter.LikeMatcher.from( (String) patternExpr.getLiteralValue(), escapeChar ); class LikeExtractExpr implements Expr { @Nonnull @Override public ExprEval eval(final ObjectBinding bindings) { return ExprEval.of(likeMatcher.matches(arg.eval(bindings).asString()), ExprType.LONG); } @Override public void visit(final Visitor visitor) { arg.visit(visitor); visitor.visit(this); } } return new LikeExtractExpr(); }
Source:
<code>public Void visitCall(CallExpression call, AtomicBoolean result) { <START> FunctionMetadata function = functionManager.getFunctionMetadata(call.getFunctionHandle()); <END> Optional<OperatorType> operator = function.getOperatorType(); if (operator.isPresent()) { switch (operator.get()) { case CAST: { checkArgument(call.getArguments().size() == 1); Type sourceType = call.getArguments().get(0).getType(); Type targetType = call.getType(); if (!typeManager.isTypeOnlyCoercion(sourceType, targetType)) { result.set(true); } } case SUBSCRIPT: result.set(true); } } else if (!functionReturnsNullForNotNullInput(function)) { result.set(true); } return super.visitCall(call, result); }</code><technical_language>StandardFunctionResolution instead of OperatorType</technical_language>

Target:
public Void visitCall(CallExpression call, AtomicBoolean result) { FunctionMetadata function = functionManager.getFunctionMetadata(call.getFunctionHandle()); Optional<OperatorType> operator = function.getOperatorType(); if (operator.isPresent()) { switch (operator.get()) { case SATURATED_FLOOR_CAST: case CAST: { checkArgument(call.getArguments().size() == 1); Type sourceType = call.getArguments().get(0).getType(); Type targetType = call.getType(); if (!typeManager.isTypeOnlyCoercion(sourceType, targetType)) { result.set(true); } } case SUBSCRIPT: result.set(true); } } else if (!functionReturnsNullForNotNullInput(function)) { result.set(true); } call.getArguments().forEach(argument -> argument.accept(this, result)); return null; }
Source:
<code>public void testCreateDeleteFolder() throws Exception { FileService fileService = new FileService(); authenticateEndpoint(fileService.getEndpoint(), USERNAME, PASSWORD); String name = "testCreateFolder" + System.currentTimeMillis(); <START> String description = "Vimal's testCreateFolder"; <END> File folder = fileService.createFolder(name, description, ""); assertEquals(folder.getTitle(), name); fileService.deleteFolder(folder.getFileId()); }</code><technical_language>replace description else</technical_language>

Target:
public void testCreateDeleteFolder() throws Exception { FileService fileService = new FileService(); authenticateEndpoint(fileService.getEndpoint(), USERNAME, PASSWORD); String name = "testCreateFolder" + System.currentTimeMillis(); String description = "testCreateFolder"; File folder = fileService.createFolder(name, description, ""); assertEquals(folder.getTitle(), name); fileService.deleteFolder(folder.getFileId()); }
Source:
<code>public void service(HttpRequest request, HttpResponse response) throws IOException { <START> System.out.println("I am an info log to stdout!"); System.err.println("I am an info log to stderr!"); LOGGER.info("I am an info log to Stackdriver!"); LOGGER.warning("I am an info log to Stackdriver!"); <END> BufferedWriter writer = response.getWriter(); writer.write("Messages successfully logged!"); }</code><technical_language>I thought for WARNING INFO other key words fill stackdriver</technical_language>

Target:
public void service(HttpRequest request, HttpResponse response) throws IOException { System.out.println("I am a log to stdout!"); System.err.println("I am a log to stderr!"); LOGGER.info("I am an info log!"); LOGGER.warning("I am a warning log!"); BufferedWriter writer = response.getWriter(); writer.write("Messages successfully logged!"); }
Source:
<code>public FilterExpression parseGlobalExpression(String path, MultivaluedMap<String, String> filterParams) throws ParseException { List<FilterPredicate> filterPredicates; filterPredicates = extractPredicates(filterParams); String normalizedPath = JsonApiParser.normalizePath(path); String[] pathComponents = normalizedPath.split("/"); String firstPathComponent = ""; if (pathComponents.length > 0) { firstPathComponent = pathComponents[0]; } FilterExpression joinedExpression = null; for (FilterPredicate filterPredicate : filterPredicates) { Class firstClass = filterPredicate.getPath().getPathElements().get(0).getType(); if (!dictionary.getJsonAliasFor(firstClass).equals(firstPathComponent)) { throw new ParseException(String.format("Invalid predicate: %s", filterPredicate)); } <START> if ((filterPredicate.getOperator().equals(Operator.HASMEMBER) <END> || filterPredicate.getOperator().equals(Operator.HASNOMEMBER)) && !FilterPredicate.checkLastPathElementType(dictionary, filterPredicate.getPath(), Collection.class)) { throw new ParseException("Invalid Path: Last Path Element has to be a collection type"); } if (joinedExpression == null) { joinedExpression = filterPredicate; } else { joinedExpression = new AndFilterExpression(joinedExpression, filterPredicate); } } return joinedExpression; }</code><technical_language>This check redundant validation logic below. Do need this check</technical_language>

Target:
public FilterExpression parseGlobalExpression(String path, MultivaluedMap<String, String> filterParams) throws ParseException { List<FilterPredicate> filterPredicates; filterPredicates = extractPredicates(filterParams); String normalizedPath = JsonApiParser.normalizePath(path); String[] pathComponents = normalizedPath.split("/"); String firstPathComponent = ""; if (pathComponents.length > 0) { firstPathComponent = pathComponents[0]; } FilterExpression joinedExpression = null; for (FilterPredicate filterPredicate : filterPredicates) { Class firstClass = filterPredicate.getPath().getPathElements().get(0).getType(); if (!dictionary.getJsonAliasFor(firstClass).equals(firstPathComponent)) { throw new ParseException(String.format("Invalid predicate: %s", filterPredicate)); } if ((filterPredicate.getOperator().equals(Operator.HASMEMBER) || filterPredicate.getOperator().equals(Operator.HASNOMEMBER)) && !FilterPredicate.isLastPathElementAssignableFrom( dictionary, filterPredicate.getPath(), Collection.class)) { throw new ParseException("Invalid Path: Last Path Element has to be a collection type"); } if (joinedExpression == null) { joinedExpression = filterPredicate; } else { joinedExpression = new AndFilterExpression(joinedExpression, filterPredicate); } } return joinedExpression; }
Source:
<code>public static void deleteNonLocalClientsAndTabs(Context context) { final String LOG_TAG = "FennecTabsRepository"; final String nonLocalTabsSelection = BrowserContract.Tabs.CLIENT_GUID + " IS NOT NULL"; ContentProviderClient tabsProvider = context.getContentResolver() .acquireContentProviderClient(BrowserContractHelpers.TABS_CONTENT_URI); if (tabsProvider == null) { Logger.warn(LOG_TAG, "Unable to create tabsProvider!"); return; } try { Logger.info(LOG_TAG, "Clearing all non-local tabs."); tabsProvider.delete(BrowserContractHelpers.TABS_CONTENT_URI, nonLocalTabsSelection, null); } catch (RemoteException e) { Logger.warn(LOG_TAG, "Error while deleting", e); <START> return; <END> } finally { try { tabsProvider.release(); } catch (Exception e) { Logger.warn(LOG_TAG, "Got exception releasing tabsProvider!", e); } } }</code><technical_language>need for this return</technical_language>

Target:
public static void deleteNonLocalClientsAndTabs(Context context) { final String nonLocalTabsSelection = BrowserContract.Tabs.CLIENT_GUID + " IS NOT NULL"; ContentProviderClient tabsProvider = context.getContentResolver() .acquireContentProviderClient(BrowserContractHelpers.TABS_CONTENT_URI); if (tabsProvider == null) { Logger.warn(LOG_TAG, "Unable to create tabsProvider!"); return; } try { Logger.info(LOG_TAG, "Clearing all non-local tabs for default profile."); tabsProvider.delete(BrowserContractHelpers.TABS_CONTENT_URI, nonLocalTabsSelection, null); } catch (RemoteException e) { Logger.warn(LOG_TAG, "Error while deleting", e); } finally { try { tabsProvider.release(); } catch (Exception e) { Logger.warn(LOG_TAG, "Got exception releasing tabsProvider!", e); } } }
Source:
<code>public static Collection<MdbValidityStatus> assertMDBClassValidity(final ClassInfo mdbClass) throws DeploymentUnitProcessingException { Collection<MdbValidityStatus> mdbComplianceIssueList = new ArrayList<>(MdbValidityStatus.values().length); final String className = mdbClass.name().toString(); verifyModifiers(className, mdbClass.flags(), mdbComplianceIssueList); for (MethodInfo method : mdbClass.methods()) { final String methodName = method.name(); if ("onMessage".equals(methodName)) { <START> verifyOnMessageMethod(className, methodName, method.flags(), mdbComplianceIssueList); <END> } if ("finalize".equals(method.name())) { EjbLogger.DEPLOYMENT_LOGGER.mdbCantHaveFinalizeMethod(className); mdbComplianceIssueList.add(MdbValidityStatus.MDB_SHOULD_NOT_HAVE_FINALIZE_METHOD); } } return mdbComplianceIssueList; }</code><technical_language>I a JMS expert, onMessage method name (or is triggers checks here), I need method name in resulting log messages</technical_language>

Target:
public static Collection<MdbValidityStatus> assertMDBClassValidity(final ClassInfo mdbClass) throws DeploymentUnitProcessingException { Collection<MdbValidityStatus> mdbComplianceIssueList = new ArrayList<>(MdbValidityStatus.values().length); final String className = mdbClass.name().toString(); verifyModifiers(className, mdbClass.flags(), mdbComplianceIssueList); for (MethodInfo method : mdbClass.methods()) { if ("onMessage".equals(method.name())) { verifyOnMessageMethod(className, method.flags(), mdbComplianceIssueList); } if ("finalize".equals(method.name())) { EjbLogger.DEPLOYMENT_LOGGER.mdbCantHaveFinalizeMethod(className); mdbComplianceIssueList.add(MdbValidityStatus.MDB_SHOULD_NOT_HAVE_FINALIZE_METHOD); } } return mdbComplianceIssueList; }
Source:
<code>public String get() { <START> if (Strings.isNullOrEmpty(javaOpts)) { <END> return ""; } return DockerInstanceRuntimeInfo.JAVA_OPTS_VARIABLE + "=" + javaOpts; }</code><technical_language>Field null in case Nullable annotation</technical_language>

Target:
public String get() { return DockerInstanceRuntimeInfo.JAVA_OPTS_VARIABLE + '=' + javaOpts; }
Source:
<code>protected void doMergeDiffWithConflicts(boolean leftToRight, Registry mergerRegistry, List<Diff> affectedDiffs, Monitor emfMonitor, Diff diff) { if <START> (diff.getState() != MERGED) { <END> affectedDiffs.add(diff); final IMerger merger = mergerRegistry.getHighestRankingMerger(diff); if (LOGGER.isDebugEnabled()) { LOGGER.debug( "mergeWithConflicts(Collection<Diff>, boolean, Registry) - Selected merger for diff " + diff.hashCode() + ": " + merger.getClass().getSimpleName()); } if (getMergeMode() == LEFT_TO_RIGHT) { merger.copyLeftToRight(diff, emfMonitor); } else if (getMergeMode() == RIGHT_TO_LEFT) { merger.copyRightToLeft(diff, emfMonitor); } else if (getMergeMode() == ACCEPT || getMergeMode() == REJECT) { MergeOperation mergeAction = getMergeOperation(diff); if (mergeAction == MARK_AS_MERGE) { markAsMerged(diff, getMergeMode(), leftToRight, mergerRegistry); } else { if (isLeftEditable() && !leftToRight) { merger.copyRightToLeft(diff, emfMonitor); } else if (isRightEditable() && leftToRight) { merger.copyLeftToRight(diff, emfMonitor); } } } else { throw new IllegalStateException(); } } }</code><technical_language>AbstractMerger.isTerminalState() instead</technical_language>

Target:
protected void doMergeDiffWithConflicts(boolean leftToRight, Registry mergerRegistry, List<Diff> affectedDiffs, Monitor emfMonitor, Diff diff) { if (isInTerminalState(diff)) { affectedDiffs.add(diff); final IMerger merger = mergerRegistry.getHighestRankingMerger(diff); if (LOGGER.isDebugEnabled()) { LOGGER.debug( "mergeWithConflicts(Collection<Diff>, boolean, Registry) - Selected merger for diff " + diff.hashCode() + ": " + merger.getClass().getSimpleName()); } if (getMergeMode() == LEFT_TO_RIGHT) { merger.copyLeftToRight(diff, emfMonitor); } else if (getMergeMode() == RIGHT_TO_LEFT) { merger.copyRightToLeft(diff, emfMonitor); } else if (getMergeMode() == ACCEPT || getMergeMode() == REJECT) { MergeOperation mergeAction = getMergeOperation(diff); if (mergeAction == MARK_AS_MERGE) { markAsMerged(diff, getMergeMode(), leftToRight, mergerRegistry); } else { if (isLeftEditable() && !leftToRight) { merger.copyRightToLeft(diff, emfMonitor); } else if (isRightEditable() && leftToRight) { merger.copyLeftToRight(diff, emfMonitor); } } } else { throw new IllegalStateException(); } } }
Source:
<code>private void connect() throws ConnectionException { <START> if( clusterUri != null){ <END> clusterConnection = LeasedConnectionFactory.connect(clusterUri, connectionProperties); } else { clusterConnection = LeasedConnectionFactory.connect(servers, connectionProperties); } entityFactory = new ClusterTierManagerClientEntityFactory(clusterConnection, timeouts); }</code><technical_language>this "If state is do this, do that" is hiding fact a type hierarchy exist here</technical_language>

Target:
private void connect() throws ConnectionException { clusterConnection = connectionSource.connect(connectionProperties); entityFactory = new ClusterTierManagerClientEntityFactory(clusterConnection, timeouts); }
Source:
<code>public void start() throws Exception { if (trace) { log.tracef("Starting StateTransferManager of cache %s on node %s", cacheName, rpcManager.getAddress()); } Hash hashFunction = configuration.clustering().hash().hash(); <START> componentRegistry.registerComponent(hashFunction, Hash.class); <END> CacheJoinInfo joinInfo = new CacheJoinInfo( pickConsistentHashFactory(), hashFunction, configuration.clustering().hash().numSegments(), configuration.clustering().hash().numOwners(), configuration.clustering().stateTransfer().timeout(), configuration.transaction().transactionProtocol().isTotalOrder(), configuration.clustering().cacheMode().isDistributed(), configuration.clustering().hash().capacityFactor()); CacheTopology initialTopology = localTopologyManager.join(cacheName, joinInfo, new CacheTopologyHandler() { @Override public void updateConsistentHash(CacheTopology cacheTopology) { doTopologyUpdate(cacheTopology, false); } @Override public void rebalance(CacheTopology cacheTopology) { doTopologyUpdate(cacheTopology, true); } }, partitionHandlingManager); if (trace) { log.tracef("StateTransferManager of cache %s on node %s received initial topology %s", cacheName, rpcManager.getAddress(), initialTopology); } }</code><technical_language>I need a HashFunctionFactory, similar TransportFactory</technical_language>

Target:
public void start() throws Exception { if (trace) { log.tracef("Starting StateTransferManager of cache %s on node %s", cacheName, rpcManager.getAddress()); } CacheJoinInfo joinInfo = new CacheJoinInfo( pickConsistentHashFactory(), hash, configuration.clustering().hash().numSegments(), configuration.clustering().hash().numOwners(), configuration.clustering().stateTransfer().timeout(), configuration.transaction().transactionProtocol().isTotalOrder(), configuration.clustering().cacheMode().isDistributed(), configuration.clustering().hash().capacityFactor()); CacheTopology initialTopology = localTopologyManager.join(cacheName, joinInfo, new CacheTopologyHandler() { @Override public void updateConsistentHash(CacheTopology cacheTopology) { doTopologyUpdate(cacheTopology, false); } @Override public void rebalance(CacheTopology cacheTopology) { doTopologyUpdate(cacheTopology, true); } }, partitionHandlingManager); if (trace) { log.tracef("StateTransferManager of cache %s on node %s received initial topology %s", cacheName, rpcManager.getAddress(), initialTopology); } }
Source:
<code>private void validateAuditLogDir() { List<String> nodesWithNoAuditLogDirs = cluster.getStripes() .stream() .flatMap(s -> s.getNodes().stream()) <START> .filter(node -> !node.getSecurityAuditLogDir().asOptional().isPresent()) <END> .map(Node::getName) .collect(toList()); if (nodesWithNoAuditLogDirs.size() != 0 && nodesWithNoAuditLogDirs.size() != cluster.getNodeCount()) { throw new MalformedClusterException("Nodes with names: " + nodesWithNoAuditLogDirs + " don't have audit log directories " + "defined, but other nodes in the cluster do. Audit log directories, if configured, need to be defined on all nodes in the cluster"); } }</code><technical_language>node.getSecurityAuditLogDir().isConfigured() new API, need asOptional in some special cases</technical_language>

Target:
private void validateAuditLogDir() { List<String> nodesWithNoAuditLogDirs = cluster.getStripes() .stream() .flatMap(s -> s.getNodes().stream()) .filter(node -> !node.getSecurityAuditLogDir().isConfigured()) .map(Node::getName) .collect(toList()); if (nodesWithNoAuditLogDirs.size() != 0 && nodesWithNoAuditLogDirs.size() != cluster.getNodeCount()) { throw new MalformedClusterException("Nodes with names: " + nodesWithNoAuditLogDirs + " don't have audit log directories " + "defined, but other nodes in the cluster do. Audit log directories, if configured, need to be defined on all nodes in the cluster"); } }
Source:
<code><START> public List<CertificateDTO> getCertificateInfo() { <END> List<CertificateDTO> certs = new ArrayList<CertificateDTO>(); List<CertificateDTO> expiredCerts = new ArrayList<CertificateDTO>(); List<CertificateDTO> warnningCerts = new ArrayList<CertificateDTO>(); try { certs.addAll(certificateService.fetchKeyStores()); certs.addAll(certificateService.fetchTrustStores()); for (CertificateDTO dto : certs) { if (dto.getExpiresInDays() <= 30) { dto.setExpiryColorCoding(COLOR_CODING_CSS.RED.toString()); expiredCerts.add(dto); } else if (dto.getExpiresInDays() > 30 && dto.getExpiresInDays() <= 90) { dto.setExpiryColorCoding(COLOR_CODING_CSS.YELLOW.toString()); warnningCerts.add(dto); } } certDTOs.addAll(expiredCerts); certDTOs.addAll(warnningCerts); } catch (CertificateManagerException e) { LOG.error("Unable to get certificate details {}", e.getLocalizedMessage(), e); HelperUtil.addMessageError(KEY_STORE_MSG, "Unable to fetch certificate details"); } return certDTOs; }</code><technical_language>This method pretty expensive. Lots of "addAll"s. I need need expiredCerts warnningCerts (Misspelled too, way). consider ordered list instead? I imagine want certificates amount of valid days left UI - order list amount of remaining days. Another potential improvement is simply iterate result of certificate service in a private method include lines 218 226 here. eliminate need add of results (which is a list) a bigger list for sake of iteration. - certDTO is cleared this method is run! get duplicated certificates time this method is run..</technical_language>

Target:
public List<CertificateDTO> getCertificateInfo() { try { certificateList = new ArrayList<>(); addCertificates(certificateService.fetchKeyStores(), certificateList); addCertificates(certificateService.fetchTrustStores(), certificateList); Collections.sort(certificateList, new Comparator<CertificateDTO>() { @Override public int compare(CertificateDTO o1, CertificateDTO o2) { return (int) o1.getExpiresInDays() - (int) o2.getExpiresInDays(); } }); return certificateList; } catch (CertificateManagerException e) { LOG.error("Unable to get certificate details {}", e.getLocalizedMessage(), e); HelperUtil.addMessageError(GET_CERT_STORE_MSG, "Unable to fetch certificate details"); } return new ArrayList<>(); }
Source:
<code><START> private <T extends Message, F extends MessageField> Map<String, Map<String, String>> doList(Class<T> entityType, List<String> entityNames) { <END> if (entityNames.size() == 0) return doListAll(entityType); final Map<String,Map<String,String>> result = new LinkedHashMap<String, Map<String, String>>(); for(String entityName : entityNames) { T config = null; Exception thrown = null; try { config = (T) getDaoByObjectType(entityType).get(entityName).getOrElse(null); } catch (Exception e) { thrown = e; } final String errMgs = thrown != null ? thrown.getMessage() : config == null ? CONFIG_NOT_FOUND : null; result.put(entityName, errMgs != null ? new HashMap<String, String>() {{ put(ERR_MSG_FIELD, errMgs); }} : JavaConversions.mapAsJavaMap(config)); } return result; }</code><technical_language>Is "F" used? used</technical_language>

Target:
private <T extends Message> Map<String, Map<String, String>> doList(Class<T> entityType, List<String> entityNames) { if (entityNames.size() == 0) return doListAll(entityType); final Map<String,Map<String,String>> result = new LinkedHashMap<String, Map<String, String>>(); for(String entityName : entityNames) { T config = null; Exception thrown = null; try { config = (T) getDaoByObjectType(entityType).get(entityName).getOrElse(null); } catch (Exception e) { thrown = e; } final String errMgs = thrown != null ? thrown.getMessage() : config == null ? CONFIG_NOT_FOUND : null; result.put(entityName, errMgs != null ? new HashMap<String, String>() {{ put(ERR_MSG_FIELD, errMgs); }} : JavaConversions.mapAsJavaMap(config)); } return result; }