auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Map<TopicPartition, OffsetAndMetadata> createOffset(Set<SubscriptionPartitionOffset> partitionOffsets) { <START> Set<TopicPartition> assignments = consumer.assignment(); <END> Map<TopicPartition, OffsetAndMetadata> offsetsData = new LinkedHashMap<>(); for (SubscriptionPartitionOffset partitionOffset : partitionOffsets) { TopicPartition topicAndPartition = new TopicPartition( partitionOffset.getKafkaTopicName().asString(), partitionOffset.getPartition()); if (assignments.contains(topicAndPartition)) { if (consumer.position(topicAndPartition) >= partitionOffset.getOffset()) { offsetsData.put(topicAndPartition, new OffsetAndMetadata(partitionOffset.getOffset())); } else { metrics.counter("offset-committer.skipped").inc(); } } else { logger.warn("Consumer is not assigned to partition of topic {}, ignoring offset to commit", topicAndPartition.partition(), topicAndPartition.topic(), partitionOffset.getOffset()); } } return offsetsData; }</code><technical_language>I wondering if check term sending commit Kafka? rebalance assigning partition is successfully commit offsets previous term. is a problem, thinking aloud here</technical_language>

Target:
private Map<TopicPartition, OffsetAndMetadata> createOffset(Set<SubscriptionPartitionOffset> partitionOffsets) { Map<TopicPartition, OffsetAndMetadata> offsetsData = new LinkedHashMap<>(); for (SubscriptionPartitionOffset partitionOffset : partitionOffsets) { TopicPartition topicAndPartition = new TopicPartition( partitionOffset.getKafkaTopicName().asString(), partitionOffset.getPartition()); if (partitionAssignmentState.isAssignedPartitionAtCurrentTerm(partitionOffset.getSubscriptionPartition())) { if (consumer.position(topicAndPartition) >= partitionOffset.getOffset()) { offsetsData.put(topicAndPartition, new OffsetAndMetadata(partitionOffset.getOffset())); } else { metrics.counter("offset-committer.skipped").inc(); } } else { logger.warn("Consumer is not assigned to partition of subscription at current term {}, ignoring offset from term to commit", partitionOffset.getPartition(), partitionOffset.getSubscriptionName(), partitionAssignmentState.currentTerm(partitionOffset.getSubscriptionName()), partitionOffset.getOffset(), partitionOffset.getPartitionAssignmentTerm()); } } return offsetsData; }
Source:
<code>public R inPeriods(@NonNull List<Period> periods) { List<DatePeriod> datePeriods = new ArrayList<>(); for (Period period : periods) { datePeriods.add(DatePeriod.builder().startDate(period.startDate()).endDate(period.endDate()).build()); } <START> return newWithWrappedScope(InPeriodQueryHelper.buildInPeriodsQuery(key, datePeriods)); <END> }</code><technical_language>suggestion return inPeriods(datePeriods);</technical_language>

Target:
public R inPeriods(@NonNull List<Period> periods) { List<DatePeriod> datePeriods = new ArrayList<>(); for (Period period : periods) { datePeriods.add(DatePeriod.builder().startDate(period.startDate()).endDate(period.endDate()).build()); } return inDatePeriods(datePeriods); }
Source:
<code>public void instrument(final InputStream input, final OutputStream output, final String name) throws IOException { try { output.write(instrument(input, name)); } catch (final RuntimeException e) { <START> throw instrumentError(name, e); <END> } }</code><technical_language>IMO addition of this is indication of regression in instrument(InputStream, String)</technical_language>

Target:
public void instrument(final InputStream input, final OutputStream output, final String name) throws IOException { output.write(instrument(input, name)); }
Source:
<code>public static CompletableFuture<Boolean> register(String username, SigningPrivateKeyAndPublicHash signer, Hasher hasher, NetworkAccess network, Consumer<String> progressCallback) { LocalDate now = LocalDate.now(); LocalDate expiry = now.plusMonths(2); LOG.info("claiming username: " + username + " with expiry " + expiry); return network.dhtClient.id() .thenCompose(id -> { List<UserPublicKeyLink> claimChain = UserPublicKeyLink.createInitial(signer, username, expiry, Arrays.asList(id)); return network.coreNode.getChain(username).thenCompose(existing -> { if (existing.size() > 0) throw new IllegalStateException("User already exists!"); byte[] data = new CborObject.CborList(claimChain).serialize(); <START> return hasher.generateProofOfWork(ProofOfWork.DEFAULT_DIFFICULTY, data) <END> .thenCompose(proof -> network.coreNode.updateChain(username, claimChain, proof)); }); }); }</code><technical_language>IIRC, this is called client? server setting difficulty? imho difficulty level configurable server-side</technical_language>

Target:
public static CompletableFuture<Boolean> register(String username, SigningPrivateKeyAndPublicHash signer, Hasher hasher, NetworkAccess network, Consumer<String> progressCallback) { LocalDate now = LocalDate.now(); LocalDate expiry = now.plusMonths(2); LOG.info("claiming username: " + username + " with expiry " + expiry); return network.dhtClient.id() .thenCompose(id -> { List<UserPublicKeyLink> claimChain = UserPublicKeyLink.createInitial(signer, username, expiry, Arrays.asList(id)); return network.coreNode.getChain(username).thenCompose(existing -> { if (existing.size() > 0) throw new IllegalStateException("User already exists!"); return updateChainWithRetry(username, claimChain, hasher, network, progressCallback); }); }); }
Source:
<code>public void shutdown(boolean join) { if (executor != null) { ThreadPoolExecutor pool = executor; executor = null; pool.shutdown(); try { <START> if (!pool.awaitTermination(WAIT_FOR_JOBS_SHUTDOWN_TIMEOUT, TimeUnit.SECONDS)) { <END> pool.shutdownNow(); if (!pool.awaitTermination(WAIT_FOR_JOBS_SHUTDOWN_TIMEOUT, TimeUnit.SECONDS)) { logger.error("Pool did not terminate"); } } } catch (InterruptedException ie) { pool.shutdownNow(); Thread.currentThread().interrupt(); } } }</code><technical_language>awaitTermination if join == true</technical_language>

Target:
public void shutdown(boolean join) { ThreadPoolExecutor pool = executor; executor = null; pool.shutdown(); if (join) { try { if (!pool.awaitTermination(WAIT_FOR_JOBS_SHUTDOWN_TIMEOUT, TimeUnit.SECONDS)) { pool.shutdownNow(); if (!pool.awaitTermination(WAIT_FOR_JOBS_SHUTDOWN_TIMEOUT, TimeUnit.SECONDS)) { logger.error("Pool did not terminate"); } } } catch (InterruptedException ie) { pool.shutdownNow(); Thread.currentThread().interrupt(); } } }
Source:
<code>private void addPLCookie(HttpServletRequest httpRequest, HttpServletResponse response) { Cookie plCookie = null; if (httpRequest.getCookies() != null) { for (Cookie c : httpRequest.getCookies()) { if (PL.equals(c.getName()) && c.getName() != null) { plCookie = c; break; } } } if (plCookie == null || !PL_SETTING.getValue().equalsIgnoreCase(plCookie.getValue())) { String plValue = PL_SETTING.getValue(); try { plValue = URLEncoder.encode(PL_SETTING.getValue(), "UTF-8"); } catch (IOException e) { <START> log.error("Failed to encode PL value with UTF-8.", e); <END> } plCookie = new Cookie(PL, plValue); plCookie.setPath("/"); response.addCookie(plCookie); } }</code><technical_language>return exception happens? cookie nil if exception</technical_language>

Target:
private void addPLCookie(HttpServletRequest httpRequest, HttpServletResponse response) { Cookie plCookie = null; if (httpRequest.getCookies() != null) { for (Cookie c : httpRequest.getCookies()) { if (PL.equals(c.getName()) && c.getName() != null) { plCookie = c; break; } } } if (plCookie == null || !PL_SETTING.getValue().equalsIgnoreCase(plCookie.getValue())) { String plValue = PL_SETTING.getValue(); try { plValue = URLEncoder.encode(PL_SETTING.getValue(), "UTF-8"); } catch (IOException e) { log.error("Failed to encode PL value with UTF-8.", e); return; } plCookie = new Cookie(PL, plValue); plCookie.setPath("/"); response.addCookie(plCookie); } }
Source:
<code>public AxisAlignedBB getRenderBoundingBox() { <START> return box == null ? super.getRenderBoundingBox() : BoundingBoxUtil.makeFrom(getPos(), box); <END> }</code><technical_language>BoundingBoxUtil checks if box is null, if is "pos". need null check, replace this java public AxisAlignedBB getRenderBoundingBox() { return BoundingBoxUtil.makeFrom(getPos(), box); } throw NPE</technical_language>

Target:
public AxisAlignedBB getRenderBoundingBox() { return BoundingBoxUtil.makeFrom(getPos(), box); }
Source:
<code>public void testClientQueryExecutedEvents() throws Exception { CountDownLatch execLatch = new CountDownLatch(9); IgnitePredicate<Event> lsnr = evt -> { assert evt instanceof QueryExecutionEvent; <START> System.out.println(">>> EVENT: " + evt); <END> QueryExecutionEvent qe = (QueryExecutionEvent)evt; assertNotNull(qe.clause()); execLatch.countDown(); return true; }; ignite().events().localListen(lsnr, EVT_QUERY_EXECUTION); ClientConfiguration cc = new ClientConfiguration().setAddresses(Config.SERVER); try (IgniteClient client = Ignition.startClient(cc)) { client.query(new SqlFieldsQuery("create table TEST_TABLE(key int primary key, val int)")) .getAll(); client.query(new SqlFieldsQuery("insert into TEST_TABLE values (?, ?)").setArgs(1, 1)) .getAll(); client.query(new SqlFieldsQuery("update TEST_TABLE set val = ?2 where key = ?1").setArgs(1, 2)) .getAll(); client.query(new SqlFieldsQuery("select * from TEST_TABLE")) .getAll(); client.query(new SqlFieldsQuery("create index idx_1 on TEST_TABLE(key)")) .getAll(); client.query(new SqlFieldsQuery("drop index idx_1")) .getAll(); client.query(new SqlFieldsQuery("alter table TEST_TABLE add column val2 int")) .getAll(); client.query(new SqlFieldsQuery("alter table TEST_TABLE drop val2")) .getAll(); client.query(new SqlFieldsQuery("drop table TEST_TABLE")) .getAll(); assert execLatch.await(3_000, MILLISECONDS); } finally { ignite().events().stopLocalListen(lsnr, EVT_QUERY_EXECUTION); } }</code><technical_language>Please, remove System.out.println test code</technical_language>

Target:
public void testClientQueryExecutedEvents() throws Exception { CountDownLatch execLatch = new CountDownLatch(9); IgnitePredicate<SqlQueryExecutionEvent> lsnr = evt -> { assertNotNull(evt.text()); execLatch.countDown(); return true; }; ignite().events().localListen(lsnr, EVT_SQL_QUERY_EXECUTION); ClientConfiguration cc = new ClientConfiguration().setAddresses(Config.SERVER); try (IgniteClient client = Ignition.startClient(cc)) { client.query(new SqlFieldsQuery("create table TEST_TABLE(key int primary key, val int)")) .getAll(); client.query(new SqlFieldsQuery("insert into TEST_TABLE values (?, ?)").setArgs(1, 1)) .getAll(); client.query(new SqlFieldsQuery("update TEST_TABLE set val = ?2 where key = ?1").setArgs(1, 2)) .getAll(); client.query(new SqlFieldsQuery("select * from TEST_TABLE")) .getAll(); client.query(new SqlFieldsQuery("create index idx_1 on TEST_TABLE(key)")) .getAll(); client.query(new SqlFieldsQuery("drop index idx_1")) .getAll(); client.query(new SqlFieldsQuery("alter table TEST_TABLE add column val2 int")) .getAll(); client.query(new SqlFieldsQuery("alter table TEST_TABLE drop val2")) .getAll(); client.query(new SqlFieldsQuery("drop table TEST_TABLE")) .getAll(); assert execLatch.await(3_000, MILLISECONDS); } finally { ignite().events().stopLocalListen(lsnr, EVT_SQL_QUERY_EXECUTION); } }
Source:
<code>private void timeoutAsyncQuery() { DataStoreTransaction tx = elide.getDataStore().beginTransaction(); try { EntityDictionary dictionary = elide.getElideSettings().getDictionary(); RSQLFilterDialect filterParser = new RSQLFilterDialect(dictionary); RequestScope scope = new RequestScope(null, null, tx, null, null, elide.getElideSettings()); FilterExpression filter = filterParser.parseFilterExpression("status=in=(" + QueryStatus.PROCESSING.toString() + "," + QueryStatus.QUEUED.toString() + ")", AsyncQuery.class, false); EntityProjection asyncQueryCollection = EntityProjection.builder() .type(AsyncQuery.class) .filterExpression(filter) .build(); Iterable<Object> loaded = tx.loadObjects(asyncQueryCollection, scope); Iterator<Object> itr = loaded.iterator(); while(itr.hasNext()) { AsyncQuery query = (AsyncQuery) itr.next(); <START> long differenceInMillies = Math.abs((new Date()).getTime() - query.getCreatedOn().getTime()); <END> long difference = TimeUnit.MINUTES.convert(differenceInMillies, TimeUnit.MILLISECONDS); if(difference > maxRunTime * 2) { log.info("Updating Async Query Status to TIMEDOUT"); query.setQueryStatus(QueryStatus.TIMEDOUT); tx.save(query, scope); tx.commit(scope); tx.flush(scope); } } } catch (Exception e) { log.error("Exception: {}", e.getMessage()); } finally { try { tx.close(); } catch (IOException e) { log.error("IOException: {}", e.getMessage()); } } }</code><technical_language>Move this math a separate function: java boolean isTimedOut(AsyncQuery query) { .. }</technical_language>

Target:
private void timeoutAsyncQuery() { String filterDateFormatted = evaluateFormattedFilterDate(Calendar.MINUTE, maxRunTimeMinutes); String filterExpression = "status=in=(" + QueryStatus.PROCESSING.toString() + "," + QueryStatus.QUEUED.toString() + ");createdOn=le='" + filterDateFormatted + "'"; asyncQueryDao.updateStatusAsyncQueryCollection(filterExpression, QueryStatus.TIMEDOUT); }
Source:
<code>@Test public void unexpectedSignatureToAdapters() throws Exception { try { Moshi moshi = new Moshi.Builder() <START> .add(new UnexpectedSignatureToJsonAdapter()).build(); <END> } catch (IllegalArgumentException expected){ assertThat(expected.getMessage()).contains( "<any access modifier> void toJson(JsonWriter writer, T value) throws <any>;", "pointToJson" ); } }</code><technical_language>needs a fail() call</technical_language>

Target:
@Test public void unexpectedSignatureToAdapters() throws Exception { Moshi.Builder builder = new Moshi.Builder(); try { builder.add(new UnexpectedSignatureToJsonAdapter()).build(); fail(); } catch (IllegalArgumentException expected) { assertThat(expected).hasMessage("Unexpected signature for void " + "com.squareup.moshi.AdapterMethodsTest$UnexpectedSignatureToJsonAdapter.pointToJson" + "(com.squareup.moshi.AdapterMethodsTest$Point).\n" + "@ToJson method signatures may have one of the following structures:\n" + " <any access modifier> void toJson(JsonWriter writer, T value) throws <any>;\n" + " <any access modifier> R toJson(T value) throws <any>;\n"); } }
Source:
<code>public static Path getPath(URI uri, Map<String, String> env) throws IOException, URISyntaxException { String uriString = uri.toString(); int indexOfExclamationMark = uriString.indexOf('!'); if (indexOfExclamationMark == -1) { return Paths.get(uri); } String zipFile = uriString.substring(0, indexOfExclamationMark); FileSystem fileSystem = fileSystemURIs.get(uri); if (fileSystem == null) { if (env == null) { env = new HashMap<>(); env.put("create", "true"); env.put("encoding", "UTF-8"); } fileSystem = FileSystems.newFileSystem(new URI(zipFile), env); <START> fileSystemURIs.put(uri, fileSystem); <END> } String fileName = uriString.substring(uriString.indexOf('!') + 1); return fileSystem.getPath(fileName); }</code><technical_language>is reason of caching of file systems here? some issues related concurrency. ConcurrentMap #putIfAbsent(). prefer if Wicket cache though. I foresee some issues redeployments OSGi usage</technical_language>

Target:
public static Path getPath(URI uri, Map<String, String> env) throws IOException, URISyntaxException { String uriString = uri.toString(); int indexOfExclamationMark = uriString.indexOf('!'); if (indexOfExclamationMark == -1) { return Paths.get(uri); } String zipFile = uriString.substring(0, indexOfExclamationMark); FileSystem fileSystem = null; synchronized (FILE_SYSTEM_META_DATA_KEY) { Map<URI, FileSystem> metaData = Application.get() .getMetaData(FILE_SYSTEM_META_DATA_KEY); if (metaData == null) { metaData = new HashMap<URI, FileSystem>(); Application.get().setMetaData(FILE_SYSTEM_META_DATA_KEY, metaData); } if (fileSystem == null) { if (env == null) { env = new HashMap<>(); env.put("create", "true"); env.put("encoding", "UTF-8"); } fileSystem = FileSystems.newFileSystem(new URI(zipFile), env); metaData.put(uri, fileSystem); } } String fileName = uriString.substring(uriString.indexOf('!') + 1); return fileSystem.getPath(fileName); }
Source:
<code>public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Timber.i("Upgrading database from version %d to %d", oldVersion, newVersion); switch (oldVersion) { case 1: upgradeToVersion2(db); case 2: case 3: upgradeToVersion4(db, oldVersion); case 4: upgradeToVersion5(db); case 5: upgradeToVersion6(db); case 6: upgradeToVersion7(db); break; default: Timber.i("Unknown version %s", oldVersion); } Timber.i("Upgrading database from version %d to %d completed with success.", oldVersion, newVersion); <START> isDatabaseBeingMigrated = false; <END> }</code><technical_language>If a failure rollback, ongoing migration flag true a relaunch, right? if failure caused fixed, user need kill app relaunch for migration run? If so, feel right me</technical_language>

Target:
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { try { Timber.i("Upgrading database from version %d to %d", oldVersion, newVersion); switch (oldVersion) { case 1: upgradeToVersion2(db); case 2: case 3: upgradeToVersion4(db, oldVersion); case 4: upgradeToVersion5(db); case 5: upgradeToVersion6(db); case 6: upgradeToVersion7(db); break; default: Timber.i("Unknown version %s", oldVersion); } Timber.i("Upgrading database from version %d to %d completed with success.", oldVersion, newVersion); isDatabaseBeingMigrated = false; } catch (SQLException e) { isDatabaseBeingMigrated = false; throw e; } }
Source:
<code>private void addLastReplNameIfEmptyText(Paragraph p) { String replName = lastReplName.get(); if (StringUtils.isEmpty(p.getText()) && StringUtils.isNotEmpty(replName) <START> && factory.isBinding(getId(), replName)) { <END> p.setText(getInterpreterName(replName) + " "); } }</code><technical_language>more sense move method, checks existence of note binding for current Note Note.java class? code like: java static import org.apache.commons.lang.StringUtils; //... if (isEmpty(p.getText()) && isNotEmpty(replName) && this.isBinded(replName)) { //... } public boolean isBinding(String replName) { return factory.getInterpreter(this.id, replName) != null; }</technical_language>

Target:
private void addLastReplNameIfEmptyText(Paragraph p) { String replName = lastReplName.get(); if (isEmpty(p.getText()) && isNotEmpty(replName) && isBinding(replName)) { p.setText(getInterpreterName(replName) + " "); } }
Source:
<code>private Handler buildBaseHandler(Class<?> sqlObjectType, Method method) { return Stream.of(method.getAnnotations()) .map(a -> a.annotationType().getAnnotation(SqlMethodAnnotation.class)) .filter(Objects::nonNull) .map(a -> buildFactory(a.value())) .map(factory -> factory.buildHandler(sqlObjectType, method)) <START> .findFirst() <END> .orElseGet(PassThroughHandler::new); }</code><technical_language>I worry this depends iteration order of annotations method, is undefined. impose ordering here, fail if multiple annotations matching</technical_language>

Target:
private Handler buildBaseHandler(Class<?> sqlObjectType, Method method) { Set<Class<?>> sqlMethodAnnotations = Stream.of(method.getAnnotations()) .map(Annotation::annotationType) .filter(type -> type.isAnnotationPresent(SqlMethodAnnotation.class)) .collect(toSet()); if (sqlMethodAnnotations.size() > 1) { throw new IllegalStateException( String.format("Mutually exclusive annotations on method %s.%s: %s", sqlObjectType.getName(), method.getName(), sqlMethodAnnotations)); } return sqlMethodAnnotations.stream() .map(type -> type.getAnnotation(SqlMethodAnnotation.class)) .map(a -> buildFactory(a.value())) .map(factory -> factory.buildHandler(sqlObjectType, method)) .findFirst() .orElseGet(PassThroughHandler::new); }
Source:
<code>private void logSecurityAuditRole() { SecurityToken IdpSecToken = getIdpSecurityToken(); if (shouldAuditSubject()) { SecurityLogger.audit( "Subject with admin privileges has logged out: {}", <START> new SecurityAssertionImpl(IdpSecToken).getPrincipal().getName()); <END> } }</code><technical_language>check IdpSecToken null well</technical_language>

Target:
private void logSecurityAuditRole() { SecurityToken idpSecToken = getIdpSecurityToken(); if (idpSecToken != null) { if (shouldAuditSubject(idpSecToken)) { SecurityLogger.audit( "Subject with admin privileges has logged out: {}", new SecurityAssertionImpl(idpSecToken).getPrincipal().getName()); } } }
Source:
<code>private void copyAllMemoryImages(Guid containerID) { for (Snapshot snapshot : snapshotsWithMemory) { List<Guid> guids = Guid.createGuidListFromString(snapshot.getMemoryVolume()); ActionReturnValue vdcRetValue = runInternalActionWithTasksContext( ActionType.CopyImageGroup, buildMoveOrCopyImageGroupParametersForMemoryDumpImage( containerID, guids.get(0), guids.get(2), guids.get(3))); if (!vdcRetValue.getSucceeded()) { throw new EngineException(vdcRetValue.getFault().getError(), "Failed during ExportVmCommand"); } <START> getReturnValue().getVdsmTaskIdList().addAll(vdcRetValue.getVdsmTaskIdList()); <END> vdcRetValue = runInternalActionWithTasksContext( ActionType.CopyImageGroup, buildMoveOrCopyImageGroupParametersForMemoryConfImage( containerID, guids.get(0), guids.get(4), guids.get(5))); if (!vdcRetValue.getSucceeded()) { throw new EngineException(vdcRetValue.getFault().getError(), "Failed during ExportVmCommand"); } getReturnValue().getVdsmTaskIdList().addAll(vdcRetValue.getVdsmTaskIdList()); } }</code><technical_language>Try call getTaskIdList()</technical_language>

Target:
private void copyAllMemoryImages(Guid containerID) { for (Snapshot snapshot : snapshotsWithMemory) { List<Guid> guids = Guid.createGuidListFromString(snapshot.getMemoryVolume()); ActionReturnValue vdcRetValue = runInternalActionWithTasksContext( ActionType.CopyImageGroup, buildMoveOrCopyImageGroupParametersForMemoryDumpImage( containerID, guids.get(0), guids.get(2), guids.get(3))); if (!vdcRetValue.getSucceeded()) { throw new EngineException(vdcRetValue.getFault().getError(), "Failed during ExportVmCommand"); } getTaskIdList().addAll(vdcRetValue.getVdsmTaskIdList()); vdcRetValue = runInternalActionWithTasksContext( ActionType.CopyImageGroup, buildMoveOrCopyImageGroupParametersForMemoryConfImage( containerID, guids.get(0), guids.get(4), guids.get(5))); if (!vdcRetValue.getSucceeded()) { throw new EngineException(vdcRetValue.getFault().getError(), "Failed during ExportVmCommand"); } getTaskIdList().addAll(vdcRetValue.getVdsmTaskIdList()); } }
Source:
<code>public void testShallowIsMinimal() throws Exception { FileRepository repo = createBareRepository(); TestRepository<Repository> r = new TestRepository<Repository>(repo); BranchBuilder bb = r.branch("refs/heads/master"); RevBlob contentA = r.blob("A"); RevBlob contentB = r.blob("B"); RevBlob contentC = r.blob("C"); RevBlob contentD = r.blob("D"); RevBlob contentE = r.blob("E"); RevCommit c1 = bb.commit().add("a", contentA).create(); RevCommit c2 = bb.commit().add("b", contentB).create(); RevCommit c3 = bb.commit().add("c", contentC).create(); RevCommit c4 = bb.commit().add("d", contentD).create(); RevCommit c5 = bb.commit().add("e", contentE).create(); r.getRevWalk().parseHeaders(c1); r.getRevWalk().parseHeaders(c2); r.getRevWalk().parseHeaders(c3); r.getRevWalk().parseHeaders(c4); r.getRevWalk().parseHeaders(c5); PackIndex idx = writeShallowPack(repo, 1, Collections.singleton(c2), NONE, NONE); assertContent(idx, Arrays.asList(c1.getId(), c2.getId(), c1.getTree().getId(), c2.getTree().getId(), contentA.getId(), contentB.getId())); <START> Set<ObjectId> haves = new HashSet<>(); haves.add(c1); haves.add(c2); <END> idx = writeShallowPack(repo, 1, Collections.singleton(c5), haves, Collections.singleton(c1)); assertContent(idx, Arrays.asList(c4.getId(), c5.getId(), c4.getTree().getId(), c5.getTree().getId(), contentC.getId(), contentD.getId(), contentE.getId())); }</code><technical_language>This is added removed in change. Reorder change refactoring of file is done first, this churn is necessary</technical_language>

Target:
public void testShallowIsMinimal() throws Exception { FileRepository repo = createBareRepository(); TestRepository<Repository> r = new TestRepository<Repository>(repo); BranchBuilder bb = r.branch("refs/heads/master"); RevBlob contentA = r.blob("A"); RevBlob contentB = r.blob("B"); RevBlob contentC = r.blob("C"); RevBlob contentD = r.blob("D"); RevBlob contentE = r.blob("E"); RevCommit c1 = bb.commit().add("a", contentA).create(); RevCommit c2 = bb.commit().add("b", contentB).create(); RevCommit c3 = bb.commit().add("c", contentC).create(); RevCommit c4 = bb.commit().add("d", contentD).create(); RevCommit c5 = bb.commit().add("e", contentE).create(); r.getRevWalk().parseHeaders(c1); r.getRevWalk().parseHeaders(c2); r.getRevWalk().parseHeaders(c3); r.getRevWalk().parseHeaders(c4); r.getRevWalk().parseHeaders(c5); PackIndex idx = writeShallowPack(repo, 1, wants(c2), NONE, NONE); assertContent(idx, Arrays.asList(c1.getId(), c2.getId(), c1.getTree().getId(), c2.getTree().getId(), contentA.getId(), contentB.getId())); idx = writeShallowPack(repo, 1, wants(c5), haves(c1, c2), shallows(c1)); assertContent(idx, Arrays.asList(c4.getId(), c5.getId(), c4.getTree().getId(), c5.getTree().getId(), contentC.getId(), contentD.getId(), contentE.getId())); }
Source:
<code>protected void recordLineage(BatchSourceContext context, String outputName, Schema tableSchema, String operationName, String description) { if (tableSchema == null) { LOG.warn("Schema for output %s is null. Field-level lineage will not be recorded.", outputName); return; } if (tableSchema.getFields() == null) { <START> LOG.warn("schema.getFields() for output %s is null. Field-level lineage will not be recorded.", outputName); <END> return; } LineageRecorder lineageRecorder = new LineageRecorder(context, outputName); lineageRecorder.createExternalDataset(tableSchema); List<String> fieldNames = tableSchema.getFields().stream().map(Schema.Field::getName).collect(Collectors.toList()); if (!fieldNames.isEmpty()) { lineageRecorder.recordRead(operationName, description, fieldNames); } }</code><technical_language>schema fields is empty</technical_language>

Target:
protected void recordLineage(BatchSourceContext context, String outputName, Schema tableSchema, String operationName, String description) { if (tableSchema == null) { LOG.warn("Schema for output %s is null. Field-level lineage will not be recorded.", outputName); return; } if (tableSchema.getFields() == null) { LOG.warn("Schema fields for output %s is empty. Field-level lineage will not be recorded", outputName); return; } LineageRecorder lineageRecorder = new LineageRecorder(context, outputName); lineageRecorder.createExternalDataset(tableSchema); List<String> fieldNames = tableSchema.getFields().stream().map(Schema.Field::getName).collect(Collectors.toList()); if (!fieldNames.isEmpty()) { lineageRecorder.recordRead(operationName, description, fieldNames); } }
Source:
<code>public void shouldCreateNewAutoGenerationOptionWithoutLocation() throws Exception { long originalCount = getAllCount(); <START> boolean automaticGenerationEnabled = true; <END> boolean manualEntryEnabled = true; SimpleObject autoGenerationOption = new SimpleObject(); autoGenerationOption.add("identifierType", IDENTIFIER_TYPE_UUID); autoGenerationOption.add("source", SOURCE); autoGenerationOption.add("automaticGenerationEnabled", automaticGenerationEnabled); autoGenerationOption.add("manualEntryEnabled", manualEntryEnabled); String json = new ObjectMapper().writeValueAsString(autoGenerationOption); MockHttpServletRequest req = request(RequestMethod.POST, getURI()); req.setContent(json.getBytes()); SimpleObject newAutoGenerationOption = deserialize(handle(req)); assertNotNull(PropertyUtils.getProperty(newAutoGenerationOption, "uuid")); assertEquals(originalCount + 1, getAllCount()); assertEquals(SOURCE, PropertyUtils.getProperty(newAutoGenerationOption, "source")); assertEquals(UNKNOWN_LOCATION, PropertyUtils.getProperty(newAutoGenerationOption, "location")); assertEquals(IDENTIFIER_TYPE_UUID, PropertyUtils.getProperty(newAutoGenerationOption, "identifierType")); }</code><technical_language>is of local variables? pass in actual values</technical_language>

Target:
public void shouldCreateNewAutoGenerationOptionWithoutLocation() throws Exception { long originalCount = getAllCount(); SimpleObject autoGenerationOption = new SimpleObject(); autoGenerationOption.add("identifierType", IDENTIFIER_TYPE_UUID); autoGenerationOption.add("source", SOURCE); autoGenerationOption.add("automaticGenerationEnabled", true); autoGenerationOption.add("manualEntryEnabled", true); String json = new ObjectMapper().writeValueAsString(autoGenerationOption); MockHttpServletRequest req = request(RequestMethod.POST, getURI()); req.setContent(json.getBytes()); SimpleObject newAutoGenerationOption = deserialize(handle(req)); assertNotNull(PropertyUtils.getProperty(newAutoGenerationOption, "uuid")); assertEquals(originalCount + 1, getAllCount()); assertEquals(SOURCE, PropertyUtils.getProperty(newAutoGenerationOption, "source")); assertEquals(UNKNOWN_LOCATION, PropertyUtils.getProperty(newAutoGenerationOption, "location")); assertEquals(IDENTIFIER_TYPE_UUID, PropertyUtils.getProperty(newAutoGenerationOption, "identifierType")); }
Source:
<code>public void tearDown() throws Exception { System.clearProperty("CONTAINER"); System.clearProperty("CONNECTIONS"); System.clearProperty("ACCOUNT_NAME"); System.clearProperty("ALLOW_ENV_PARAMETRIZATION"); <START> } <END></code><technical_language>clear ACCOUNT_KEY</technical_language>

Target:
public void tearDown() throws Exception { System.clearProperty("CONTAINER"); System.clearProperty("CONNECTIONS"); System.clearProperty("ACCOUNT_NAME"); System.clearProperty("ACCOUNT_KEY"); System.clearProperty("ALLOW_ENV_PARAMETRIZATION"); }
Source:
<code>public int selectAndUpdateExecutionWithLocking(final int executorId, final boolean isActive) throws ExecutorManagerException { final String UPDATE_EXECUTION = "UPDATE execution_flows SET executor_id = ?, update_time = ? " + "where exec_id = ?"; final String selectExecutionForUpdate = isActive ? SelectFromExecutionFlows.SELECT_EXECUTION_FOR_UPDATE_ACTIVE : SelectFromExecutionFlows.SELECT_EXECUTION_FOR_UPDATE_INACTIVE; final SQLTransaction<Integer> selectAndUpdateExecution = transOperator -> { int execId = -1; final boolean hasLocked = transOperator.query(PollingLockResultHandler.GET_POLLING_LOCK, new PollingLockResultHandler()); logger.info("ExecutionFlow polling lock value: " + hasLocked + " for executorId: " + executorId); if (hasLocked) { try { final List<Integer> execIds = transOperator.query(selectExecutionForUpdate, new SelectFromExecutionFlows(), executorId); if (CollectionUtils.isNotEmpty(execIds)) { execId = execIds.get(0); transOperator.update(UPDATE_EXECUTION, executorId, System.currentTimeMillis(), execId); } } finally { transOperator.query(PollingLockResultHandler.RELEASE_POLLING_LOCK, new PollingLockResultHandler()); logger.info("Released polling lock for executorId: " + executorId); } } <START> return execId; <END> }; try { return this.dbOperator.transaction(selectAndUpdateExecution); } catch (final SQLException e) { throw new ExecutorManagerException("Error selecting and updating execution with executor " + executorId, e); } }</code><technical_language>I need commit returning execId update before</technical_language>

Target:
public int selectAndUpdateExecutionWithLocking(final int executorId, final boolean isActive) throws ExecutorManagerException { final String UPDATE_EXECUTION = "UPDATE execution_flows SET executor_id = ?, update_time = ? " + "where exec_id = ?"; final String selectExecutionForUpdate = isActive ? SelectFromExecutionFlows.SELECT_EXECUTION_FOR_UPDATE_ACTIVE : SelectFromExecutionFlows.SELECT_EXECUTION_FOR_UPDATE_INACTIVE; final SQLTransaction<Integer> selectAndUpdateExecution = transOperator -> { final String POLLING_LOCK_NAME = "execution_flows_polling"; final int GET_LOCK_TIMEOUT_IN_SECONDS = 5; int execId = -1; final boolean hasLocked = this.mysqlNamedLock.getLock(transOperator, POLLING_LOCK_NAME, GET_LOCK_TIMEOUT_IN_SECONDS); logger.info("ExecutionFlow polling lock value: " + hasLocked + " for executorId: " + executorId); if (hasLocked) { try { final List<Integer> execIds = transOperator.query(selectExecutionForUpdate, new SelectFromExecutionFlows(), executorId); if (CollectionUtils.isNotEmpty(execIds)) { execId = execIds.get(0); transOperator.update(UPDATE_EXECUTION, executorId, System.currentTimeMillis(), execId); } } finally { this.mysqlNamedLock.releaseLock(transOperator, POLLING_LOCK_NAME); logger.info("Released polling lock for executorId: " + executorId); } } else { logger.info("Could not acquire polling lock for executorId: " + executorId); } return execId; }; try { return this.dbOperator.transaction(selectAndUpdateExecution); } catch (final SQLException e) { throw new ExecutorManagerException("Error selecting and updating execution with executor " + executorId, e); } }
Source:
<code>public void before() throws InterruptedException { builder = new StreamsBuilder(); CLUSTER.createTopics(STREAM_INPUT, STREAM_OUTPUT_1, STREAM_OUTPUT_2, STREAM_OUTPUT_3, STREAM_OUTPUT_4); streamsConfiguration = new Properties(); streamsConfiguration.put(StreamsConfig.APPLICATION_ID_CONFIG, APPLICATION_ID_VALUE); streamsConfiguration.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, CLUSTER.bootstrapServers()); streamsConfiguration.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.Integer().getClass()); streamsConfiguration.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.String().getClass()); streamsConfiguration.put(StreamsConfig.METRICS_RECORDING_LEVEL_CONFIG, Sensor.RecordingLevel.DEBUG.name); streamsConfiguration.put(StreamsConfig.CACHE_MAX_BYTES_BUFFERING_CONFIG, 10 * 1024 * 1024L); <START> streamsConfiguration.put(StreamsConfig.NUM_STREAM_THREADS_CONFIG, 2); <END> streamsConfiguration.put(StreamsConfig.STATE_DIR_CONFIG, TestUtils.tempDirectory().getPath()); }</code><technical_language>req: Please a constant for number of stream threads line 260</technical_language>

Target:
public void before() throws InterruptedException { builder = new StreamsBuilder(); CLUSTER.createTopics(STREAM_INPUT, STREAM_OUTPUT_1, STREAM_OUTPUT_2, STREAM_OUTPUT_3, STREAM_OUTPUT_4); streamsConfiguration = new Properties(); streamsConfiguration.put(StreamsConfig.APPLICATION_ID_CONFIG, APPLICATION_ID_VALUE); streamsConfiguration.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, CLUSTER.bootstrapServers()); streamsConfiguration.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.Integer().getClass()); streamsConfiguration.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.String().getClass()); streamsConfiguration.put(StreamsConfig.METRICS_RECORDING_LEVEL_CONFIG, Sensor.RecordingLevel.DEBUG.name); streamsConfiguration.put(StreamsConfig.CACHE_MAX_BYTES_BUFFERING_CONFIG, 10 * 1024 * 1024L); streamsConfiguration.put(StreamsConfig.NUM_STREAM_THREADS_CONFIG, NUM_THREADS); streamsConfiguration.put(StreamsConfig.STATE_DIR_CONFIG, TestUtils.tempDirectory().getPath()); }
Source:
<code>private AggregatorFactory[] getCombiningFactories(AggregatorFactory[] aggregatorFactories) { final AggregatorFactory[] combiningFactories = new AggregatorFactory[aggregatorFactories.length]; <START> for (int i = 0; i < aggregatorFactories.length; i++) { <END> combiningFactories[i] = aggregatorFactories[i].getCombiningFactory(); } return combiningFactories; }</code><technical_language>Arrays.setAll()</technical_language>

Target:
private AggregatorFactory[] getCombiningFactories(AggregatorFactory[] aggregatorFactories) { final AggregatorFactory[] combiningFactories = new AggregatorFactory[aggregatorFactories.length]; Arrays.setAll(combiningFactories, i -> aggregatorFactories[i].getCombiningFactory()); return combiningFactories; }
Source:
<code>public void addRepresentation (ImageData srcImageData, int zoom) { if (srcImageData == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); int imageSelectorIndex = DPIUtil.mapZoomToImageSelectorIndex(zoom); if (imageSelectorIndex == device.getImageSelector ()) { init(srcImageData); <START> init(); <END> } else { data [imageSelectorIndex] = srcImageData; } }</code><technical_language>ImageData for current image needs updated in array</technical_language>

Target:
public void addRepresentation (ImageData srcImageData, int zoom) { if (srcImageData == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); int imageSelectorIndex = DPIUtil.mapZoomToImageSelectorIndex(zoom); if (imageSelectorIndex == getImageSelector ()) { init(srcImageData); init(); } data [imageSelectorIndex] = srcImageData; }
Source:
<code>public Aws create(final TwilioRestClient client) { Request request = new Request( HttpMethod.POST, Domains.ACCOUNTS.toString(), "/v1/Credentials/AWS", client.getRegion() ); addPostParams(request); Response response = client.request(request); if (response == null) { throw new ApiConnectionException("Aws creation failed: Unable to connect to server"); } else if (!TwilioRestClient.SUCCESS.apply(response.getStatusCode())) { RestException restException = RestException.fromJson(response.getStream(), client.getObjectMapper()); if (restException == null) { throw new ApiException("Server Error, no content"); } throw new ApiException( restException.getMessage(), restException.getCode(), restException.getMoreInfo(), restException.getStatus(), <START> restException.getDetails(), <END> null ); } return Aws.fromJson(response.getStream(), client.getObjectMapper()); }</code><technical_language>pass restException ApiException constructor? future changes update files</technical_language>

Target:
public Aws create(final TwilioRestClient client) { Request request = new Request( HttpMethod.POST, Domains.ACCOUNTS.toString(), "/v1/Credentials/AWS", client.getRegion() ); addPostParams(request); Response response = client.request(request); if (response == null) { throw new ApiConnectionException("Aws creation failed: Unable to connect to server"); } else if (!TwilioRestClient.SUCCESS.apply(response.getStatusCode())) { RestException restException = RestException.fromJson(response.getStream(), client.getObjectMapper()); if (restException == null) { throw new ApiException("Server Error, no content"); } throw new ApiException(restException); } return Aws.fromJson(response.getStream(), client.getObjectMapper()); }
Source:
<code>public Map<String, AttributeValue> transform(final Parameters<?> parameters) { final ModelClassMetadata metadata = getModelClassMetadata(parameters); final Map<String, AttributeValue> attributeValues = parameters.getAttributeValues(); if (metadata.doNotTouch) { return attributeValues; } if (parameters.isPartialUpdate()) { <START> LOG.error("Use of AttributeEncryptor without SaveBehavior.CLOBBER is an error and may result in data-corruption. " + <END> "This occured while trying to save " + parameters.getModelClass()); } try { return encryptor.encryptRecord( attributeValues, metadata.getEncryptionFlags(), paramsToContext(parameters)); } catch (Exception ex) { throw new DynamoDBMappingException(ex); } }</code><technical_language>s/may/can/</technical_language>

Target:
public Map<String, AttributeValue> transform(final Parameters<?> parameters) { final ModelClassMetadata metadata = getModelClassMetadata(parameters); final Map<String, AttributeValue> attributeValues = parameters.getAttributeValues(); if (metadata.doNotTouch) { return attributeValues; } if (parameters.isPartialUpdate()) { LOG.error("Use of AttributeEncryptor without SaveBehavior.CLOBBER is an error and can result in data-corruption. " + "This occured while trying to save " + parameters.getModelClass()); } try { return encryptor.encryptRecord( attributeValues, metadata.getEncryptionFlags(), paramsToContext(parameters)); } catch (Exception ex) { throw new DynamoDBMappingException(ex); } }
Source:
<code>private synchronized void tryRollOver(AffinityTopologyVersion topVer) { if (entries == null) return; long ackedUpdCntr0 = ackedUpdCntr; <START> if (endCntr < ackedUpdCntr0) <END> rollOver(ackedUpdCntr0 + 1, 0, topVer); }</code><technical_language>check this curBatch, curBatch changed concurrently in this case fail assert rollOver</technical_language>

Target:
private synchronized Object tryRollOver(AffinityTopologyVersion topVer) { if (entries == null) return RETRY; long ackedUpdCntr0 = ackedUpdCntr.get(); if (endCntr < ackedUpdCntr0) { rollOver(ackedUpdCntr0 + 1, 0, topVer); return RETRY; } return null; }
Source:
<code>public void testCacheHitsAndMissesTheExpectedNumberOfTimes() throws IOException { try(final CachingBAMFileIndex index = getIndexWith200Contigs()) { index.getQueryResults(1); assertCacheStats(index, 0, 1); index.getQueryResults(1); assertCacheStats(index, 1, 1); index.getQueryResults(150); assertCacheStats(index, 1, 2); index.getQueryResults(150); assertCacheStats(index,2,2); index.getQueryResults(150); assertCacheStats(index,3,2); index.getQueryResults(1); <START> assertCacheStats(index, 3, 3); <END> } }</code><technical_language>Add additional query chromosome 1 put in cache</technical_language>

Target:
public void testCacheHitsAndMissesTheExpectedNumberOfTimes() throws IOException { try(final CachingBAMFileIndex index = getIndexWith200Contigs()) { index.getQueryResults(1); assertCacheStats(index, 0, 1); index.getQueryResults(1); assertCacheStats(index, 1, 1); index.getQueryResults(150); assertCacheStats(index, 1, 2); index.getQueryResults(150); assertCacheStats(index,2,2); index.getQueryResults(150); assertCacheStats(index,3,2); index.getQueryResults(1); assertCacheStats(index, 3, 3); index.getQueryResults(1); assertCacheStats(index, 4, 3); index.getQueryResults(1000); assertCacheStats(index,4,4); } }
Source:
<code>public void handleException(Exception e, HttpServletResponse response, HttpServletRequest request) throws IOException { logger.error("Internal Server Error", e); storeException(request, response, e); ResponseStatus responseStatus = e.getClass().getAnnotation(ResponseStatus.class); if (responseStatus != null) { <START> response.sendError(responseStatus.value().value(), e.getMessage()); <END> } else { response.sendError(HttpStatus.INTERNAL_SERVER_ERROR.value(), e.getMessage()); } }</code><technical_language>worth including responseStatus.reason() if present</technical_language>

Target:
public void handleException(Exception e, HttpServletResponse response, HttpServletRequest request) throws IOException { logger.error("Internal Server Error", e); storeException(request, response, e); ResponseStatus responseStatus = e.getClass().getAnnotation(ResponseStatus.class); if (responseStatus != null) { String message = e.getMessage(); if (message == null || message.trim().isEmpty()) { message = responseStatus.reason(); } response.sendError(responseStatus.value().value(), message); } else { response.sendError(HttpStatus.INTERNAL_SERVER_ERROR.value(), e.getMessage()); } }
Source:
<code>public void setParams(Object[] params) { if (this.hasDimension) { if (params.length != dim) { throw new IllegalArgumentException("expected " + dim + " arguments to setParams for UniformVector distribution. Got " + params.length + " dimensions"); } } else { this.numFilled = 0; this.dim = params.length; this.hasDimension = true; this.mins = new double[dim]; this.maxes = new double[dim]; this.dimensionSet = new boolean[dim]; } MatrixLib[] m = new MatrixLib[dim]; <START> for (int i = 0; i < dim; i++) { <END> m[i] = (MatrixLib) params[i]; } setParams(m); }</code><technical_language>arrays.copy</technical_language>

Target:
public void setParams(Object[] params) { if (this.hasDimension) { if (params.length != dim) { throw new IllegalArgumentException("expected " + dim + " arguments to setParams for UniformVector distribution. Got " + params.length + " dimensions"); } } else { this.numFilled = 0; this.dim = params.length; this.hasDimension = true; this.mins = new double[dim]; this.maxes = new double[dim]; this.dimensionSet = new boolean[dim]; } MatrixLib[] m = new MatrixLib[dim]; System.arraycopy(params, 0, m, 0, params.length); setParams(m); }
Source:
<code>public static BinaryData fromString(String data) { if (Objects.isNull(data)) { return new BinaryData(EMPTY_DATA); } else { <START> return new BinaryData(data.getBytes(StandardCharsets.UTF_8)); <END> } }</code><technical_language>getBytes return for a zero length string</technical_language>

Target:
public static BinaryData fromString(String data) { if (Objects.isNull(data) || data.length() == 0) { return EMPTY_DATA; } return new BinaryData(data.getBytes(StandardCharsets.UTF_8)); }
Source:
<code>public String toString() { StringBuilder sb = new StringBuilder(); sb.append("( "); for (Entry<K, V> entry : entrySet()) { sb.append('{').append(entry.getKey()).append(':').append(entry.getValue()).append("}, "); } final String result; if (!isEmpty()) { result = sb.substring(0, sb.length() - 2); } else { result = sb.toString(); } <START> return result + " )"; <END> }</code><technical_language>stringbuilder a + op is pretentious ;)</technical_language>

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("( "); for (Entry<K, V> entry : entrySet()) { sb.append('{').append(entry.getKey()).append(':').append(entry.getValue()).append("}, "); } if (!isEmpty()) { sb.replace(sb.length() - 2, sb.length(), ""); } return sb.append(" )").toString(); }
Source:
<code>public static SimpleBlobStore create( RemoteOptions options, @Nullable Credentials creds, @Nullable Path workingDirectory) throws IOException { <START> if (isRestUrlOptions(options) && isDiskCache(options)) { <END> return createCombinedCache(workingDirectory, options.diskCache, options, creds); } if (isRestUrlOptions(options)) { return createRest(options, creds); } if (workingDirectory != null && isDiskCache(options)) { return createDiskCache(workingDirectory, options.diskCache); } throw new IllegalArgumentException( "Unrecognized concurrent map RemoteOptions: must specify " + "either Rest URL, or local cache options."); }</code><technical_language>while it, rename occurrences of "Rest" http</technical_language>

Target:
public static SimpleBlobStore create( RemoteOptions options, @Nullable Credentials creds, @Nullable Path workingDirectory) throws IOException { if (isHttpUrlOptions(options) && isDiskCache(options)) { return createCombinedCache(workingDirectory, options.diskCache, options, creds); } if (isHttpUrlOptions(options)) { return createHttp(options, creds); } if (workingDirectory != null && isDiskCache(options)) { return createDiskCache(workingDirectory, options.diskCache); } throw new IllegalArgumentException( "Unrecognized RemoteOptions configuration: remote Http cache URL and/or local disk cache options expected."); }
Source:
<code>public void testLogAnnotation() { assertNotNull(this.loggingHandler); <START> org.apache.commons.logging.Log log = <END> spy(TestUtils.getPropertyValue(this.loggingHandler, "messageLogger", org.apache.commons.logging.Log.class)); given(log.isWarnEnabled()) .willReturn(true); new DirectFieldAccessor(this.loggingHandler) .setPropertyValue("messageLogger", log); this.loggingChannel.send(MessageBuilder.withPayload("foo") .setHeader("bar", "baz") .build()); ArgumentCaptor<Object> argumentCaptor = ArgumentCaptor.forClass(Object.class); verify(log) .warn(argumentCaptor.capture()); assertEquals("foo for baz", argumentCaptor.getValue()); }</code><technical_language>change interface name avoid this FQCN noise</technical_language>

Target:
public void testLogAnnotation() { assertNotNull(this.loggingHandler); Log log = spy(TestUtils.getPropertyValue(this.loggingHandler, "messageLogger", Log.class)); given(log.isWarnEnabled()) .willReturn(true); new DirectFieldAccessor(this.loggingHandler) .setPropertyValue("messageLogger", log); this.loggingChannel.send(MessageBuilder.withPayload("foo") .setHeader("bar", "baz") .build()); ArgumentCaptor<Object> argumentCaptor = ArgumentCaptor.forClass(Object.class); verify(log) .warn(argumentCaptor.capture()); assertEquals("foo for baz", argumentCaptor.getValue()); }