auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void test_findContentletByIdentifierAnyLanguage() throws DotSecurityException, DotDataException { final ContentletAPI contentletAPI = APILocator.getContentletAPI(); final User user = APILocator.systemUser(); final Language language1 = new LanguageDataGen().nextPersisted(); final Language language2 = new LanguageDataGen().nextPersisted(); final ContentType bannerLikeContentType = TestDataUtils.getBannerLikeContentType(); final Contentlet banner1 = TestDataUtils .getBannerLikeContent(true, language1.getId(), bannerLikeContentType.id(), null); Contentlet banner2 = contentletAPI.checkout(banner1.getInode(), APILocator.systemUser(), false); banner2.setLanguageId(language2.getId()); <START> banner2.setInode(""); <END> banner2 = contentletAPI.checkin(banner2, user, false); final Contentlet result = instance.findContentletByIdentifierAnyLanguage(banner1.getIdentifier()); assertNotNull(result); assertEquals(banner2.getIdentifier(), result.getIdentifier()); }</code><technical_language>checkout nulls inode</technical_language>

Target:
public void test_findContentletByIdentifierAnyLanguage() throws DotSecurityException, DotDataException { final ContentletAPI contentletAPI = APILocator.getContentletAPI(); final User user = APILocator.systemUser(); final Language language1 = new LanguageDataGen().nextPersisted(); final Language language2 = new LanguageDataGen().nextPersisted(); final ContentType bannerLikeContentType = TestDataUtils.getBannerLikeContentType(); final Contentlet banner1 = TestDataUtils .getBannerLikeContent(true, language1.getId(), bannerLikeContentType.id(), null); Contentlet banner2 = contentletAPI.checkout(banner1.getInode(), APILocator.systemUser(), false); banner2.setLanguageId(language2.getId()); banner2 = contentletAPI.checkin(banner2, user, false); final Contentlet result = instance.findContentletByIdentifierAnyLanguage(banner1.getIdentifier()); assertNotNull(result); assertEquals(banner2.getIdentifier(), result.getIdentifier()); }
Source:
<code><START> private boolean isNewerThanServer(String objectType, String objectId, <END> long lastModifiedDate) throws JSONException, IOException { boolean isNewer = false; long serverLastModified = UNCHANGED; final SOQLBuilder builder = SOQLBuilder.getInstanceWithFields(Constants.LAST_MODIFIED_DATE); builder.from(objectType); builder.where(Constants.ID + " = '" + objectId + "'"); final String query = builder.build(); RestResponse lastModResponse = null; lastModResponse = sendSyncWithSmartSyncUserAgent(RestRequest.getRequestForQuery(apiVersion, query)); if (lastModResponse != null && lastModResponse.isSuccess()) { final JSONObject responseJSON = lastModResponse.asJSONObject(); if (responseJSON != null) { final JSONArray records = responseJSON.optJSONArray("records"); if (records != null && records.length() > 0) { final JSONObject obj = records.optJSONObject(0); if (obj != null) { final String lastModStr = obj.optString(Constants.LAST_MODIFIED_DATE); if (!TextUtils.isEmpty(lastModStr)) { try { serverLastModified = TIMESTAMP_FORMAT.parse(lastModStr).getTime(); } catch (ParseException e) { Log.e("SmartSyncManager:isNewerThanServer", "Error during date parsing", e); } } } } } } if (serverLastModified < lastModifiedDate) { isNewer = true; } return isNewer; }</code><technical_language>I exhaust command of SOQL. :)</technical_language>

Target:
private boolean isNewerThanServer(String objectType, String objectId, long lastModifiedDate) throws JSONException, IOException { boolean isNewer = false; long serverLastModified = UNCHANGED; final SOQLBuilder builder = SOQLBuilder.getInstanceWithFields(Constants.LAST_MODIFIED_DATE); builder.from(objectType); builder.where(Constants.ID + " = '" + objectId + "'"); final String query = builder.build(); RestResponse lastModResponse = null; lastModResponse = sendSyncWithSmartSyncUserAgent(RestRequest.getRequestForQuery(apiVersion, query)); if (lastModResponse != null && lastModResponse.isSuccess()) { final JSONObject responseJSON = lastModResponse.asJSONObject(); if (responseJSON != null) { final JSONArray records = responseJSON.optJSONArray("records"); if (records != null && records.length() > 0) { final JSONObject obj = records.optJSONObject(0); if (obj != null) { final String lastModStr = obj.optString(Constants.LAST_MODIFIED_DATE); if (!TextUtils.isEmpty(lastModStr)) { try { serverLastModified = TIMESTAMP_FORMAT.parse(lastModStr).getTime(); } catch (ParseException e) { Log.e("SmartSyncManager:isNewerThanServer", "Error during date parsing", e); } } } } } } if (serverLastModified <= lastModifiedDate) { isNewer = true; } return isNewer; }
Source:
<code>public void persist(List<QueryResult> crawlResults) throws IOException, GitAPIException { try { gitHandler.updateLocalRepository(); } catch (GitAPIException e) { LOGGER.info("Updating repository from remote failed"); } persistResults(crawlResults); study.setLastSearchDate(LocalDate.now()); persistStudy(); try { gitHandler.updateRemoteRepository("Conducted search " + LocalDate.now()); } catch (GitAPIException e) { <START> LOGGER.info("Updating remote repository failed"); <END> } }</code><technical_language>suggestion LOGGER.error("Updating remote repository failed",e);</technical_language>

Target:
public void persist(List<QueryResult> crawlResults) throws IOException, GitAPIException { try { gitHandler.updateLocalRepository(); } catch (GitAPIException e) { LOGGER.error("Updating repository from remote failed"); } persistResults(crawlResults); study.setLastSearchDate(LocalDate.now()); persistStudy(); try { gitHandler.updateRemoteRepository("Conducted search " + LocalDate.now()); } catch (GitAPIException e) { LOGGER.error("Updating remote repository failed"); } }
Source:
<code>Mono<Response<RecognizePiiEntitiesResult>> recognizePiiEntitiesWithResponse(String text, String language, Context context) { return recognizeBatchPiiEntitiesWithResponse( <START> Arrays.asList(new TextDocumentInput(Integer.toString(0), text, language)), null, context) <END> .flatMap(response -> { Iterator<RecognizePiiEntitiesResult> responseItem = response.getValue().iterator(); return Mono.just(new SimpleResponse<>(response, responseItem.next())); }); }</code><technical_language>"0"</technical_language>

Target:
Mono<Response<RecognizePiiEntitiesResult>> recognizePiiEntitiesWithResponse(String text, String language, Context context) { Objects.requireNonNull(text, "'text' cannot be null."); return recognizeBatchPiiEntitiesWithResponse( Collections.singletonList(new TextDocumentInput("0", text, language)), null, context) .map(response -> new SimpleResponse<>(response, response.getValue().iterator().next())); }
Source:
<code>public Mono shutdown(ExecutorService executorService) { <START> if (executorService == null) { <END> return Mono.empty(); } EventLoopGroup eventLoopGroup = (EventLoopGroup) executorService; return Mono.defer(() -> FutureMono.from((Future) eventLoopGroup.shutdownGracefully())); }</code><technical_language>Wrap method Mono.defer</technical_language>

Target:
public Mono<Void> shutdown(ExecutorService executorService) { if (executorService == null) { return Mono.empty(); } EventLoopGroup eventLoopGroup = (EventLoopGroup) executorService; return Mono.defer(() -> FutureMono.from((Future) eventLoopGroup.shutdownGracefully())); }
Source:
<code>public boolean isGroupSeen(GroupKey<?> groupKey) { class GroupSeenQueryResultProcessor implements CaseDbAccessQueryCallback { private boolean seen = false; boolean getGroupSeen() { return seen; } @Override public void process(ResultSet resultSet) { try { if (resultSet != null) { while (resultSet.next()) { int count = resultSet.getInt("count"); <START> seen = count > 0; <END> return; } } } catch (SQLException ex) { LOGGER.log(Level.SEVERE, "failed to get group seen", ex); } } } try { String groupIdQuery = String.format("( SELECT group_id FROM " + GROUPS_TABLENAME + " WHERE attribute = \'%s\' AND value = \'%s\' )", groupKey.getAttribute().attrName.toString(), groupKey.getValueDisplayName() ); String groupSeenQueryStmt = String.format("COUNT((*) as count FROM " + GROUPS_SEEN_TABLENAME + " WHERE seen = 1 AND group_id in ( %s )", groupIdQuery); GroupSeenQueryResultProcessor queryResultProcessor = new GroupSeenQueryResultProcessor(); tskCase.getCaseDbAccessManager().select(groupSeenQueryStmt, queryResultProcessor); return queryResultProcessor.getGroupSeen(); } catch (TskCoreException ex) { String msg = String.format("Failed to get is group seen for group key %s", groupKey.getValueDisplayName()); LOGGER.log(Level.WARNING, msg, ex); } return false; }</code><technical_language>I inline count</technical_language>

Target:
public boolean isGroupSeen(GroupKey<?> groupKey) { class GroupSeenQueryResultProcessor implements CaseDbAccessQueryCallback { private boolean seen = false; boolean getGroupSeen() { return seen; } @Override public void process(ResultSet resultSet) { try { if (resultSet != null) { while (resultSet.next()) { int count = resultSet.getInt("count"); seen = count > 0; return; } } } catch (SQLException ex) { LOGGER.log(Level.SEVERE, "failed to get group seen", ex); } } } try { String groupIdQuery = ""; if (groupKey.getDataSourceObjId() != 0) { groupIdQuery = String.format("( SELECT group_id FROM " + GROUPS_TABLENAME + " WHERE attribute = \'%s\' AND value = \'%s\' AND data_source_obj_id = %d)", groupKey.getAttribute().attrName.toString(), groupKey.getValueDisplayName(), groupKey.getDataSourceObjId() ); } else { groupIdQuery = String.format("( SELECT group_id FROM " + GROUPS_TABLENAME + " WHERE attribute = \'%s\' AND value = \'%s\' )", groupKey.getAttribute().attrName.toString(), groupKey.getValueDisplayName() ); } String groupSeenQueryStmt = String.format("COUNT((*) as count FROM " + GROUPS_SEEN_TABLENAME + " WHERE seen = 1 AND group_id in ( %s )", groupIdQuery); GroupSeenQueryResultProcessor queryResultProcessor = new GroupSeenQueryResultProcessor(); tskCase.getCaseDbAccessManager().select(groupSeenQueryStmt, queryResultProcessor); return queryResultProcessor.getGroupSeen(); } catch (TskCoreException ex) { String msg = String.format("Failed to get is group seen for group key %s", groupKey.getValueDisplayName()); LOGGER.log(Level.WARNING, msg, ex); } return false; }
Source:
<code>public void handleError(HttpCommand command, HttpResponse response) { byte[] data = closeClientButKeepContentStream(response); String message = data != null ? new String(data) : null; Exception exception = message != null ? new HttpResponseException(command, response, message) : new HttpResponseException(command, response); message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(), response.getStatusLine()); switch (response.getStatusCode()) { case 400: break; case 401: case 403: exception = new AuthorizationException(message, exception); break; case 404: if (!command.getCurrentRequest().getMethod().equals("DELETE")) { exception = new ResourceNotFoundException(message, exception); <START> } <END> break; } command.setException(exception); }</code><technical_language>case 409: exception = new IllegalStateException(exception.getMessage(), exception); break;</technical_language>

Target:
public void handleError(HttpCommand command, HttpResponse response) { byte[] data = closeClientButKeepContentStream(response); String message = data != null ? new String(data) : null; Exception exception = message != null ? new HttpResponseException(command, response, message) : new HttpResponseException(command, response); message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(), response.getStatusLine()); switch (response.getStatusCode()) { case 400: break; case 401: case 403: exception = new AuthorizationException(message, exception); break; case 404: if (!command.getCurrentRequest().getMethod().equals("DELETE")) { exception = new ResourceNotFoundException(message, exception); } break; case 409: exception = new IllegalStateException(exception.getMessage(), exception); break; } command.setException(exception); }
Source:
<code>private String ehashDataKey(String key) throws UnsupportedOperationException { String hashtag = connPool.getConfiguration().getHashtag(); if (!validHashtag(hashtag)) { <START> throw new UnsupportedOperationException("hashtags not set"); <END> } return new StringBuilder(hashtag) .insert(1, key) .toString(); }</code><technical_language>throwing UnsupportedOperationException if hashtag is set another type of exception</technical_language>

Target:
private String ehashDataKey(String key) { String hashtag = connPool.getConfiguration().getHashtag(); if (!validHashtag(hashtag)) { throw new IllegalStateException("hashtags not set"); } return new StringBuilder(hashtag) .insert(1, key) .toString(); }
Source:
<code>private static MimeType getMimeType(String url) { <START> if (url.contains("_format=json")) { <END> return MimeType.JSON; } return MimeType.XML; }</code><technical_language>used: StringUtils.containsIgnoreCase(url, "_format=json")</technical_language>

Target:
private static MimeType getMimeType(String url) { if (containsIgnoreCaseOf(url, JSON_QUERY_PARAM)) { return MimeType.JSON; } return MimeType.XML; }
Source:
<code>private static String appendQueryParameters(Multimap<String, ?> queryParameters, String path) { if (!queryParameters.isEmpty()) { UrlParamBuilder paramBuilder = UrlParamBuilder.params(); for (Map.Entry<String, ?> paramEntry : queryParameters.entries()) { paramBuilder.add(paramEntry.getKey(), paramEntry.getValue().toString()); } path = path + "?" + paramBuilder.format(); } <START> return path.replace("%2F", "/"); <END> }</code><technical_language>I need this here, in UrlParamBuilder</technical_language>

Target:
private static String appendQueryParameters(Multimap<String, ?> queryParameters, String path) { if (!queryParameters.isEmpty()) { UrlParamBuilder paramBuilder = UrlParamBuilder.params(); for (Map.Entry<String, ?> paramEntry : queryParameters.entries()) { paramBuilder.add(paramEntry.getKey(), paramEntry.getValue().toString()); } path = path + "?" + paramBuilder.format(); } return path; }
Source:
<code>private void deleteFile(final OplogFile olf) { synchronized (this.lock) { if (olf.currSize != 0) { this.dirHolder.decrementTotalOplogSize(olf.currSize); olf.currSize = 0; } if (olf.f == null) return; if (!olf.f.exists()) return; assert olf.RAFClosed; <START> if (!olf.RAFClosed && olf.raf != null) { <END> try { olf.raf.close(); olf.RAFClosed = true; } catch (IOException ignore) { } } getParent().executeDelayedExpensiveWrite(new Runnable() { @Override public void run() { if (!olf.f.delete() && olf.f.exists()) { logger.warn("Could not delete the file for disk store {}.", Oplog.this.toString(), getFileType(olf), getParent().getName()); } else { logger.info("Deleted for disk store {}.", Oplog.this.toString(), getFileType(olf), getParent().getName()); } } }); } }</code><technical_language>Is part of test required? "if (!olf.RAFClosed" sits assert in order pass true</technical_language>

Target:
private void deleteFile(final OplogFile olf) { synchronized (this.lock) { if (olf.currSize != 0) { this.dirHolder.decrementTotalOplogSize(olf.currSize); olf.currSize = 0; } if (olf.f == null) return; if (!olf.f.exists()) return; assert olf.RAFClosed; if (olf.raf != null) { try { olf.raf.close(); olf.RAFClosed = true; } catch (IOException ignore) { } } getParent().executeDelayedExpensiveWrite(new Runnable() { @Override public void run() { if (!olf.f.delete() && olf.f.exists()) { logger.warn("Could not delete the file for disk store {}.", Oplog.this.toString(), getFileType(olf), getParent().getName()); } else { logger.info("Deleted for disk store {}.", Oplog.this.toString(), getFileType(olf), getParent().getName()); } } }); } }
Source:
<code>@BeforeAll static void testZ3Lib() { try { Context z3Context = new Context(); Expr x = z3Context.mkIntConst("x"); Expr one = z3Context.mkInt(1); BoolExpr eq = z3Context.mkEq(x, one); Solver solver = z3Context.mkSolver(); solver.add(eq); solver.check(); z3Loads = true; } catch (Error e) { <START> z3Loads = false; <END> } }</code><technical_language>assume work here, is duplicated tests</technical_language>

Target:
@BeforeAll static void testZ3Lib() { try { Context z3Context = new Context(); Expr x = z3Context.mkIntConst("x"); Expr one = z3Context.mkInt(1); BoolExpr eq = z3Context.mkEq(x, one); Solver solver = z3Context.mkSolver(); solver.add(eq); solver.check(); z3Loads = true; } catch (Error e) { assumeTrue(false); z3Loads = false; } }
Source:
<code>public static <T> T retry(Callable<T> callable, int retries, List<String> nonRetryableKeywords) { int retryCount = 0; while (true) { try { return callable.call(); } catch (Exception e) { retryCount++; if (retryCount > retries || containsAnyOf(e, nonRetryableKeywords)) { throw ExceptionUtil.rethrow(e); } long waitIntervalMs = backoffIntervalForRetry(retryCount); LOGGER.warning( <START> String.format("Couldn't find Hazelcast members using Kubernetes API, [%s] retrying in %s seconds...", <END> retryCount, waitIntervalMs / MS_IN_SECOND)); sleep(waitIntervalMs); } } }</code><technical_language>discover a word sure.. that, query 10 times if able get answer k8s api?. is want discover other member form cluster</technical_language>

Target:
public static <T> T retry(Callable<T> callable, int retries, List<String> nonRetryableKeywords) { int retryCount = 0; while (true) { try { return callable.call(); } catch (Exception e) { retryCount++; if (retryCount > retries || containsAnyOf(e, nonRetryableKeywords)) { throw ExceptionUtil.rethrow(e); } long waitIntervalMs = backoffIntervalForRetry(retryCount); LOGGER.warning( String.format("Couldn't discover Hazelcast members using Kubernetes API, [%s] retrying in %s seconds...", retryCount, waitIntervalMs / MS_IN_SECOND)); sleep(waitIntervalMs); } } }
Source:
<code>private PackList scanPacksImpl(PackList old) throws IOException { DfsBlockCache cache = DfsBlockCache.getInstance(); Map<DfsPackDescription, DfsPackFile> forReuse = reuseMap(old); List<DfsPackDescription> scanned = listPacks(); Collections.sort(scanned); List<DfsPackFile> list = new ArrayList<DfsPackFile>(scanned.size()); boolean foundNew = false; for (DfsPackDescription dsc : scanned) { DfsPackFile oldPack = forReuse.remove(dsc); if (oldPack != null) { list.add(oldPack); } else { list.add(cache.getOrCreate(dsc, null)); foundNew = true; } } for (DfsPackFile p : forReuse.values()) p.close(); if (list.isEmpty()) return new PackListImpl(NO_PACKS.packs); <START> if (!foundNew && list.size() == old.packs.length) { <END> if (old instanceof PackListImpl) { ((PackListImpl) old).dirty = false; } return old; } return new PackListImpl(list.toArray(new DfsPackFile[list.size()])); }</code><technical_language>is this condition necessary</technical_language>

Target:
private PackList scanPacksImpl(PackList old) throws IOException { DfsBlockCache cache = DfsBlockCache.getInstance(); Map<DfsPackDescription, DfsPackFile> forReuse = reuseMap(old); List<DfsPackDescription> scanned = listPacks(); Collections.sort(scanned); List<DfsPackFile> list = new ArrayList<DfsPackFile>(scanned.size()); boolean foundNew = false; for (DfsPackDescription dsc : scanned) { DfsPackFile oldPack = forReuse.remove(dsc); if (oldPack != null) { list.add(oldPack); } else { list.add(cache.getOrCreate(dsc, null)); foundNew = true; } } for (DfsPackFile p : forReuse.values()) p.close(); if (list.isEmpty()) return new PackListImpl(NO_PACKS.packs); if (!foundNew) { old.clearDirty(); return old; } return new PackListImpl(list.toArray(new DfsPackFile[list.size()])); }
Source:
<code>private Class<? extends Collection> convertParameterTypeToCollectionType() { <START> if (List.class.equals(type)) { <END> return ArrayList.class; } else if (SortedSet.class.equals(type)) { return TreeSet.class; } else if (Set.class.equals(type)) { return HashSet.class; } return null; }</code><technical_language>This worries me. I item 5 is a **bit** ambigious, ArrayList **is** a List, I interpretation is more plausible. But, StringParameterInjector.extractValues() returns a HashSet, > @GET >public Response singleValuedQueryParam(@QueryParam("date") HashSet dates) { >... >} work, right? excluding behavior work. good</technical_language>

Target:
private Class<? extends Collection> convertParameterTypeToCollectionType() { if (List.class.equals(type) || ArrayList.class.equals(type)) { return ArrayList.class; } else if (SortedSet.class.equals(type) || TreeSet.class.equals(type)) { return TreeSet.class; } else if (Set.class.equals(type) || HashSet.class.equals(type)) { return HashSet.class; } return null; }
Source:
<code>public void init() throws IOException { try (MDCCloseable mdc = Logging.withPrefixCloseable(MessageConsumerManager.LOG_PREFIX)) { registerJmxReporter(); awsConfig.clear(); final Dictionary<String, Object> properties = configAdmin.getConfiguration(AmazonSQSSinkConstants.AWS_CONFIG_PID).getProperties(); if (properties != null) { final Enumeration<String> keys = properties.keys(); while (keys.hasMoreElements()) { final String key = keys.nextElement(); awsConfig.put(key, properties.get(key)); } } LOG.info("AwsRemoteMessageDispatcherFactory: initializing the AWS SQS producer with: {}", awsConfig); <START> final ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); <END> try { Thread.currentThread().setContextClassLoader(null); sqs = AmazonSQSUtils.createSQSObject(awsConfig); } catch (AmazonSQSException e) { LOG.error("Can't create AWS SQS Producer", e); } finally { Thread.currentThread().setContextClassLoader(currentClassLoader); } } }</code><technical_language>I this a class-loader hack needed for Kafka, necessary here</technical_language>

Target:
public void init() throws IOException { try (MDCCloseable mdc = Logging.withPrefixCloseable(MessageConsumerManager.LOG_PREFIX)) { registerJmxReporter(); awsConfig.clear(); final Dictionary<String, Object> properties = configAdmin.getConfiguration(AmazonSQSSinkConstants.AWS_CONFIG_PID).getProperties(); if (properties != null) { final Enumeration<String> keys = properties.keys(); while (keys.hasMoreElements()) { final String key = keys.nextElement(); awsConfig.put(key, properties.get(key)); } } LOG.info("AwsRemoteMessageDispatcherFactory: initializing the AmazonSQS Object with: {}", awsConfig); try { sqs = awsSqsManager.createSQSObject(awsConfig); } catch (AmazonSQSException e) { LOG.error("Can't create an AmazonSQS Object", e); } } }
Source:
<code>public void blockingSourceAsnycCancel() throws Exception { BehaviorProcessor<Integer> bp = BehaviorProcessor.createDefault(1); <START> Flowable<Integer> o = bp <END> .replay(1) .refCount(); o.subscribe(); final AtomicBoolean interrupted = new AtomicBoolean(); o.switchMap(new Function<Integer, Publisher<? extends Object>>() { @Override public Publisher<? extends Object> apply(Integer v) throws Exception { return Flowable.create(new FlowableOnSubscribe<Object>() { @Override public void subscribe(FlowableEmitter<Object> emitter) throws Exception { while (!emitter.isCancelled()) { Thread.sleep(100); } interrupted.set(true); } }, BackpressureStrategy.MISSING); } }) .takeUntil(Flowable.timer(500, TimeUnit.MILLISECONDS)) .test() .awaitDone(5, TimeUnit.SECONDS) .assertResult(); assertTrue(interrupted.get()); }</code><technical_language>f</technical_language>

Target:
public void blockingSourceAsnycCancel() throws Exception { BehaviorProcessor<Integer> bp = BehaviorProcessor.createDefault(1); Flowable<Integer> f = bp .replay(1) .refCount(); f.subscribe(); final AtomicBoolean interrupted = new AtomicBoolean(); f.switchMap(new Function<Integer, Publisher<? extends Object>>() { @Override public Publisher<? extends Object> apply(Integer v) throws Exception { return Flowable.create(new FlowableOnSubscribe<Object>() { @Override public void subscribe(FlowableEmitter<Object> emitter) throws Exception { while (!emitter.isCancelled()) { Thread.sleep(100); } interrupted.set(true); } }, BackpressureStrategy.MISSING); } }) .takeUntil(Flowable.timer(500, TimeUnit.MILLISECONDS)) .test() .awaitDone(5, TimeUnit.SECONDS) .assertResult(); assertTrue(interrupted.get()); }
Source:
<code>synchronized private void shutDownDBExecutor() { if (dbExecutor != null) { dbExecutor.shutdownNow(); try { dbExecutor.awaitTermination(30, TimeUnit.SECONDS); } catch (InterruptedException ex) { logger.log(Level.WARNING, "Image Gallery failed to shutdown DB Task Executor in a timely fashion.", ex); } <START> dbExecutor = null; <END> } }</code><technical_language>is necessary null out dbExecutor? garbage collected enclosing ImageGalleryController is garbage collected</technical_language>

Target:
synchronized private void shutDownDBExecutor() { dbExecutor.shutdownNow(); try { dbExecutor.awaitTermination(30, TimeUnit.SECONDS); } catch (InterruptedException ex) { logger.log(Level.WARNING, "Image Gallery failed to shutdown DB Task Executor in a timely fashion.", ex); } }
Source:
<code>List<RevCommit> getMergeBases(RevCommit one, RevCommit two) throws IncorrectObjectTypeException, IOException { if (one == null) throw new IncorrectObjectTypeException(one, Constants.TYPE_COMMIT); if (two == null) throw new IncorrectObjectTypeException(two, Constants.TYPE_COMMIT); List<RevCommit> mergeBases = new ArrayList<RevCommit>(); walk.reset(); walk.setRevFilter(RevFilter.MERGE_BASE); walk.markStart(one); walk.markStart(two); int commitIdx = 0; for (RevCommit base : walk) { if (commitIdx < MAX_BASES) { mergeBases.add(base); commitIdx++; } else { throw new IOException(MessageFormat.format( JGitText.get().mergeRecursiveTooManyMergeBasesFor, <START> "TOO_MANY_BASES", one.name(), two.name(), <END> Integer.valueOf(commitIdx), base.name())); } } return mergeBases; }</code><technical_language>repated, bases</technical_language>

Target:
List<RevCommit> getMergeBases(RevCommit one, RevCommit two) throws IncorrectObjectTypeException, IOException { if (one == null) throw new IncorrectObjectTypeException(one, Constants.TYPE_COMMIT); if (two == null) throw new IncorrectObjectTypeException(two, Constants.TYPE_COMMIT); List<RevCommit> mergeBases = new ArrayList<RevCommit>(); walk.reset(); walk.setRevFilter(RevFilter.MERGE_BASE); walk.markStart(one); walk.markStart(two); int commitIdx = 0; for (RevCommit base : walk) { if (commitIdx < MAX_BASES) { mergeBases.add(base); commitIdx++; } else { throw new IOException(MessageFormat.format( JGitText.get().mergeRecursiveTooManyMergeBasesFor, Integer.valueOf(MAX_BASES), one.name(), two.name(), Integer.valueOf(commitIdx), base.name())); } } return mergeBases; }
Source:
<code>public boolean onOptionsItemSelected(MenuItem item) { if (optionsMenuDelegate.onOptionsItemSelected(item)) { return true; } <START> FormController formController = getFormController(); <END> switch (item.getItemId()) { case R.id.menu_languages: createLanguageDialog(); return true; case R.id.menu_save: saveForm(DO_NOT_EXIT, InstancesDaoHelper.isInstanceComplete(false), null); return true; case R.id.menu_goto: state = null; if (formController != null && formController.currentPromptIsQuestion()) { saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); } if (formController != null) { formController.getAuditEventLogger().flush(); formController.getAuditEventLogger().logEvent(AuditEvent.AuditEventType.HIERARCHY, true, System.currentTimeMillis()); } Intent i = new Intent(this, FormHierarchyActivity.class); startActivityForResult(i, RequestCodes.HIERARCHY_ACTIVITY); return true; } return super.onOptionsItemSelected(item); }</code><technical_language>File a good issue</technical_language>

Target:
public boolean onOptionsItemSelected(MenuItem item) { if (menuDelegate.onOptionsItemSelected(item)) { return true; } FormController formController = getFormController(); switch (item.getItemId()) { case R.id.menu_languages: createLanguageDialog(); return true; case R.id.menu_save: saveForm(DO_NOT_EXIT, InstancesDaoHelper.isInstanceComplete(false), null); return true; case R.id.menu_goto: state = null; if (formController != null && formController.currentPromptIsQuestion()) { saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); } if (formController != null) { formController.getAuditEventLogger().flush(); formController.getAuditEventLogger().logEvent(AuditEvent.AuditEventType.HIERARCHY, true, System.currentTimeMillis()); } Intent i = new Intent(this, FormHierarchyActivity.class); startActivityForResult(i, RequestCodes.HIERARCHY_ACTIVITY); return true; } return super.onOptionsItemSelected(item); }
Source:
<code>public void testElementOfJsonPathNoResult() { <START> JsonFixture cont = new JsonFixture(); <END> cont.load(JSON); Object result = cont.elementOfJsonPath(0,jsonPathNoResults); assertNull(result); }</code><technical_language>fixture</technical_language>

Target:
public void testElementOfJsonPathNoResult() { fixture.load(JSON); Object result = fixture.elementOfJsonPath(0, "$.store.book[?(@.category==\"test\")].author"); assertNull(result); result = fixture.elementOfJsonPath(3, "$.store.book[?(@.category==\"fiction\")].author"); assertNull(result); }
Source:
<code>public Transfer sell(Money amount, String paymentMethodId, Boolean commit) throws CoinbaseException, IOException { URL sellsUrl; try { sellsUrl = new URL(_baseApiUrl, "sells"); } catch (MalformedURLException ex) { throw new AssertionError(ex); } Request request = newAccountSpecificRequest(); request.setQty(amount.getAmount().doubleValue()); request.setPaymentMethodId(paymentMethodId); request.setCurrency(amount.getCurrencyUnit().getCurrencyCode()); <START> if(commit != null) <END> request.setCommit(commit); return post(sellsUrl, request, TransferResponse.class).getTransfer(); }</code><technical_language>setCommit takes a capital-B Boolean, need for this check, if null set null</technical_language>

Target:
public Transfer sell(Money amount, String paymentMethodId, Boolean commit) throws CoinbaseException, IOException { URL sellsUrl; try { sellsUrl = new URL(_baseApiUrl, "sells"); } catch (MalformedURLException ex) { throw new AssertionError(ex); } Request request = newAccountSpecificRequest(); request.setQty(amount.getAmount().doubleValue()); request.setPaymentMethodId(paymentMethodId); request.setCurrency(amount.getCurrencyUnit().getCurrencyCode()); request.setCommit(commit); return post(sellsUrl, request, TransferResponse.class).getTransfer(); }
Source:
<code>public static void beforeClass() throws Exception { <START> PrintWriter writer = new PrintWriter(new File(PqsConfiguration.DEFAULT_PHOENIX_PQS_FILE_SINK_FILENAME)); <END> writer.print(""); writer.close(); fileReader = new FileReader(PqsConfiguration.DEFAULT_PHOENIX_PQS_FILE_SINK_FILENAME); CONF = getTestClusterConfig(); assertTrue("no log message in the file ", checkIfTempFileIsEmpty()); CONF.setInt(QueryServices.QUERY_SERVER_HTTP_PORT_ATTRIB, 0); String url = getUrl(); AVATICA_SERVER = new QueryServerThread(new String[] { url }, CONF, QueryServerBasicsIT.class.getName()); AVATICA_SERVER.start(); AVATICA_SERVER.getQueryServer().awaitRunning(); final int port = AVATICA_SERVER.getQueryServer().getPort(); LOG.info("Avatica server started on port " + port); CONN_STRING = ThinClientUtil.getConnectionUrl("localhost", port); LOG.info("JDBC connection string is " + CONN_STRING); }</code><technical_language>Create this file in maven build dir "target"</technical_language>

Target:
public static void beforeClass() throws Exception { CONF = getTestClusterConfig(); if (!testRootDir.exists()) { testRootDir.mkdir(); } Files.deleteIfExists(pqsSinkFile.toPath()); Files.createFile(pqsSinkFile.toPath()); CONF.set(PHOENIX_PQS_FILE_SINK_FILENAME, pqsSinkFile.getCanonicalPath()); CONF.setInt(PHOENIX_PQS_METRIC_REPORTING_INTERVAL_MS,2000); boolean noMetrics = checkFileContainsMetricsData(global) && checkFileContainsMetricsData(overAllReadRequestMetrics) && checkFileContainsMetricsData(requestReadMetrics) && checkFileContainsMetricsData(writeMetricsMut); assertFalse(" metrics file should have no metrics", noMetrics); CONF.setInt(QueryServices.QUERY_SERVER_HTTP_PORT_ATTRIB, 0); String url = getUrl(); AVATICA_SERVER = new QueryServerThread(new String[] { url }, CONF, QueryServerBasicsIT.class.getName()); AVATICA_SERVER.start(); AVATICA_SERVER.getQueryServer().awaitRunning(); final int port = AVATICA_SERVER.getQueryServer().getPort(); LOG.info("Avatica server started on port " + port); CONN_STRING = ThinClientUtil.getConnectionUrl("localhost", port); LOG.info("JDBC connection string is " + CONN_STRING); }
Source:
<code>public RexNode eliminateCommonExprInCondition(RexNode node) { if (!(node instanceof RexCall)) { return node; } List<RexNode> operands = ((RexCall) node).getOperands(); <START> List<RexNode> simplifiedChildren = operands.stream() .map(this::eliminateCommonExprInCondition) .collect(Collectors.toList()); <END> switch (node.getKind()) { case AND: { List<List<RexNode>> disjunctions = simplifiedChildren.stream() .map(RelOptUtil::disjunctions) .collect(Collectors.toList()); List<RexNode> common = new ArrayList<>(disjunctions.get(0)); disjunctions.forEach(common::retainAll); if (common.isEmpty()) { return and(simplifiedChildren); } disjunctions.forEach(p -> p.removeAll(common)); if (disjunctions.stream().anyMatch(List::isEmpty)) { return or(common); } List<RexNode> splice = disjunctions.stream() .map(this::or) .collect(Collectors.toList()); return or(or(common), and(splice)); } case OR: { List<List<RexNode>> conjunctions = simplifiedChildren.stream() .map(RelOptUtil::conjunctions) .collect(Collectors.toList()); List<RexNode> common = new ArrayList<>(conjunctions.get(0)); conjunctions.forEach(common::retainAll); if (common.isEmpty()) { return or(simplifiedChildren); } conjunctions.forEach(p -> p.removeAll(common)); if (conjunctions.stream().anyMatch(List::isEmpty)) { return and(common); } List<RexNode> splice = conjunctions.stream() .map(this::and) .collect(Collectors.toList()); return and(and(common), or(splice)); } default: return node; } }</code><technical_language>This a non-trivial wasteful computation in case node.kind is</technical_language>

Target:
public RexNode eliminateCommonExprInCondition(RexNode node) { if (node.getKind() != SqlKind.AND && node.getKind() != SqlKind.OR) { return node; } List<RexNode> operands = ((RexCall) node).getOperands(); List<RexNode> simplifiedChildren = operands.stream() .map(this::eliminateCommonExprInCondition) .collect(Collectors.toList()); switch (node.getKind()) { case AND: { List<Set<RexNode>> disjunctions = simplifiedChildren.stream() .map(RelOptUtil::disjunctionSet) .collect(Collectors.toList()); Set<RexNode> common = new HashSet<>(disjunctions.get(0)); disjunctions.forEach(common::retainAll); if (common.isEmpty()) { return and(simplifiedChildren); } disjunctions.forEach(p -> p.removeAll(common)); if (disjunctions.stream().anyMatch(Collection::isEmpty)) { return or(common); } List<RexNode> splice = disjunctions.stream() .map(this::or) .collect(Collectors.toList()); return or(or(common), and(splice)); } case OR: { List<Set<RexNode>> conjunctions = simplifiedChildren.stream() .map(RelOptUtil::conjunctionSet) .collect(Collectors.toList()); Set<RexNode> common = new HashSet<>(conjunctions.get(0)); conjunctions.forEach(common::retainAll); if (common.isEmpty()) { return or(simplifiedChildren); } conjunctions.forEach(p -> p.removeAll(common)); if (conjunctions.stream().anyMatch(Collection::isEmpty)) { return and(common); } List<RexNode> splice = conjunctions.stream() .map(this::and) .collect(Collectors.toList()); return and(and(common), or(splice)); } default: return node; } }
Source:
<code>public static long folderSize(File directory, final OnProgressUpdate<Long[]> updateState, Long[] spaces) { long length = 0; try { for (File file:directory.listFiles()) { if (file.isFile()) { spaces[2] += file.length(); length += file.length();} else <START> length += folderSize(file, updateState, spaces); <END> } } catch (Exception e) { e.printStackTrace(); } if(updateState != null) updateState.onUpdate(spaces); return length; }</code><technical_language>Lines 124-127 difficult understand, is write easily understandable? standards (always brackets in if else, for else in else if)</technical_language>

Target:
public static long folderSize(File directory, final OnProgressUpdate<Long[]> updateState, Long[] spaces) { long length = 0; try { for (File file:directory.listFiles()) { if (file.isFile()) { spaces[2] += file.length(); length += file.length(); }else { length += folderSize(file, updateState, spaces); } } } catch (Exception e) { e.printStackTrace(); } if(updateState != null) updateState.onUpdate(spaces); return length; }
Source:
<code>public boolean attemptLogin() { <START> boolean validRepoId = RepoId.isWellFormedRepoIdString(owner + "/" + repo) <END> && !username.isEmpty() && !password.isEmpty(); boolean loginSuccessful = login(username, password); if (validRepoId && loginSuccessful) { logic.prefs.setLastLoginCredentials(username, password); return true; } return false; }</code><technical_language>isValidRepoId</technical_language>

Target:
public boolean attemptLogin() { boolean isValidRepoId = RepoId.isValidRepoId(owner + "/" + repo) && !username.isEmpty() && !password.isEmpty(); boolean loginSuccessful = login(username, password); if (isValidRepoId && loginSuccessful) { logic.prefs.setLastLoginCredentials(username, password); return true; } return false; }
Source:
<code>public void execute(CommandContext context) { Map<String, String> hostGroups = context.getAppConfig().getHostGroups(); AdminManager adminManager = context.getAdminManager(); HostManager mgr = new HostManager(context.getManageClient()); for (Map.Entry<String, String> entry : hostGroups.entrySet()) { String hostName = entry.getKey(); String groupName = entry.getValue(); ServerManager serverMgr = new ServerManager(context.getManageClient(), groupName); try { <START> String serverResponse = serverMgr.getPropertiesAsJson(MANAGE_SERVER_NAME, "group-id="+groupName); <END> System.out.println("serverResponse: " + serverResponse); } catch (Exception e) { if (e.getMessage().contains("404 Not Found")) { String manageServerPayload = format(MANAGE_SERVER_JSON_TEMPLATE, MANAGE_SERVER_NAME, groupName); serverMgr.save(manageServerPayload); } else { logger.error("Error checking for Manage server in target group: " + e.getMessage()); throw e; } } mgr.setHostToGroup(hostName, groupName); adminManager.waitForRestart(); } }</code><technical_language>I do "exists" call instead. avoid throwing/logging error, suspicious a new developer. I logging info level is warranted in cases - if Manage server exists, log a message confirming it, if exist, log a message stating a Manage server created in group (name)</technical_language>

Target:
public void execute(CommandContext context) { context.getAdminManager().invokeActionRequiringRestart(() -> assignHostsToGroups(context)); }
Source:
<code>public CompletableFuture<Void> visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable { ctx.onReturn(writeSkewReturnHandler); <START> if (streamSummaryContainer.isEnabled() && ctx.isOriginLocal()) { <END> streamSummaryContainer.addPut(command.getKey(), isRemote(command.getKey())); } return ctx.continueInvocation(); }</code><technical_language>move if ctx.onReturn() avoid invoking ctx.continueInvocation()</technical_language>

Target:
public CompletableFuture<Void> visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable { if (streamSummaryContainer.isEnabled() && ctx.isOriginLocal()) { streamSummaryContainer.addPut(command.getKey(), isRemote(command.getKey())); } return ctx.onReturn(writeSkewReturnHandler); }
Source:
<code>public void run() { final long oldTimeStamp = lastMeasuredTimestamp; lastMeasuredTimestamp = System.currentTimeMillis(); final boolean clusterOverloaded = isClusterOverloaded(); final boolean clusterIdle = isClusterIdle(); if (clusterOverloaded) { overloadedTimeElapsed += lastMeasuredTimestamp - oldTimeStamp; if (overloadedTimeElapsed > scaleOutGracePeriod && taskStatsMap.getTaskList().size() < maxTaskNum) { overloadedTimeElapsed = 0; return; } } else { overloadedTimeElapsed = 0; } if (clusterIdle) { idleTimeElapsed += lastMeasuredTimestamp - oldTimeStamp; if (idleTimeElapsed > scaleInGracePeriod && taskStatsMap.getTaskList().size() > minTaskNum) { LOG.log(Level.INFO, "Start scaling-in..."); final String minimalLoadedTask = taskStatsMap.getMinimumLoadTask(); try { <START> final boolean scaleInSuccess = scaleInManager.scaleIn(minimalLoadedTask); <END> if (!scaleInSuccess) { throw new RuntimeException("Automatic scale-in failed! - Task cannot be found"); } } catch (final Exception e) { e.printStackTrace(); } idleTimeElapsed = 0; } } else { idleTimeElapsed = 0; } }</code><technical_language>scaleIn a task is awkawrd. I finding min task implemented scaleInManager.scaleIn</technical_language>

Target:
public void run() { final long oldTimeStamp = lastMeasuredTimestamp; lastMeasuredTimestamp = System.currentTimeMillis(); final boolean clusterOverloaded = isClusterOverloaded(); final boolean clusterIdle = isClusterIdle(); if (clusterOverloaded) { overloadedTimeElapsed += lastMeasuredTimestamp - oldTimeStamp; if (overloadedTimeElapsed > scaleOutGracePeriod && taskStatsMap.getTaskList().size() < maxTaskNum) { overloadedTimeElapsed = 0; return; } } else { overloadedTimeElapsed = 0; } if (clusterIdle) { idleTimeElapsed += lastMeasuredTimestamp - oldTimeStamp; if (idleTimeElapsed > scaleInGracePeriod && taskStatsMap.getTaskList().size() > minTaskNum) { LOG.log(Level.INFO, "Start scaling-in..."); try { final boolean scaleInSuccess = scaleInManager.scaleIn(); if (!scaleInSuccess) { throw new RuntimeException("Automatic scale-in failed! - Task cannot be found"); } } catch (final Exception e) { e.printStackTrace(); } idleTimeElapsed = 0; } } else { idleTimeElapsed = 0; } }
Source:
<code>public String toString() { <START> return "ChronicleLogTailer{" + "basePath='" + basePath + '\'' + ", id=" + id + ", closed=" + closed + '}'; <END> }</code><technical_language>Add codec toString()</technical_language>

Target:
public String toString() { return "ChronicleLogTailer{" + "basePath='" + basePath + '\'' + ", id=" + id + ", closed=" + closed + ", codec=" + codec + '}'; }
Source:
<code>private EquivalenceUpdatingWorker equivUpdatingWorker() { return new EquivalenceUpdatingWorker( contentResolver, lookupStore, equivalenceResultStore, equivUpdater, Predicates.or(ImmutableList.<Predicate<? super Content>>of( sourceIsIn( BBC_REDUX, YOUVIEW, YOUVIEW_STAGE, YOUVIEW_BT, YOUVIEW_BT_STAGE, BETTY, BT_TVE_VOD, BT_VOD ), Predicates.and( Predicates.instanceOf(Container.class), sourceIsIn( BBC, C4_PMLSD, ITV, FIVE, BBC_REDUX, ITUNES, RADIO_TIMES, LOVEFILM, TALK_TALK, YOUVIEW, NETFLIX, <START> BBC_NITRO <END> ) ) )) ); }</code><technical_language>added container part of or</technical_language>

Target:
private EquivalenceUpdatingWorker equivUpdatingWorker() { return new EquivalenceUpdatingWorker( contentResolver, lookupStore, equivalenceResultStore, equivUpdater, Predicates.or(ImmutableList.<Predicate<? super Content>>of( sourceIsIn( BBC_REDUX, YOUVIEW, YOUVIEW_STAGE, YOUVIEW_BT, YOUVIEW_BT_STAGE, BETTY, BT_TVE_VOD, BT_VOD, BBC_NITRO ), Predicates.and( Predicates.instanceOf(Container.class), sourceIsIn( BBC, C4_PMLSD, ITV, FIVE, BBC_REDUX, ITUNES, RADIO_TIMES, LOVEFILM, TALK_TALK, YOUVIEW, NETFLIX, BBC_NITRO ) ) )) ); }
Source:
<code>public ServiceBusSenderAsyncClient buildAsyncClient() { final ServiceBusConnectionProcessor connectionProcessor = getOrCreateConnectionProcessor(messageSerializer); final MessagingEntityType entityType = validateEntityPaths(logger, connectionStringEntityName, topicName, queueName); <START> if (!CoreUtils.isNullOrEmpty(viaQueueName) && !CoreUtils.isNullOrEmpty(topicName)) { <END> throw logger.logExceptionAsError(new IllegalArgumentException(String.format( "(%s), Via queue feature work only with a queue.", viaQueueName))); } final String entityName; switch (entityType) { case QUEUE: entityName = queueName; break; case SUBSCRIPTION: entityName = topicName; break; case UNKNOWN: entityName = connectionStringEntityName; break; default: throw logger.logExceptionAsError( new IllegalArgumentException("Unknown entity type: " + entityType)); } return new ServiceBusSenderAsyncClient(entityName, viaQueueName, entityType, connectionProcessor, retryOptions, tracerProvider, messageSerializer, ServiceBusClientBuilder.this::onClientClose); }</code><technical_language>entityType instead of topicName for comparison</technical_language>

Target:
public ServiceBusSenderAsyncClient buildAsyncClient() { final ServiceBusConnectionProcessor connectionProcessor = getOrCreateConnectionProcessor(messageSerializer); final MessagingEntityType entityType = validateEntityPaths(logger, connectionStringEntityName, topicName, queueName); if (!CoreUtils.isNullOrEmpty(viaQueueName) && entityType == MessagingEntityType.SUBSCRIPTION) { throw logger.logExceptionAsError(new IllegalStateException(String.format( "(%s), Via queue feature work only with a queue.", viaQueueName))); } final String entityName; switch (entityType) { case QUEUE: entityName = queueName; break; case SUBSCRIPTION: entityName = topicName; break; case UNKNOWN: entityName = connectionStringEntityName; break; default: throw logger.logExceptionAsError( new IllegalArgumentException("Unknown entity type: " + entityType)); } return new ServiceBusSenderAsyncClient(entityName, entityType, connectionProcessor, retryOptions, tracerProvider, messageSerializer, ServiceBusClientBuilder.this::onClientClose, viaQueueName); }
Source:
<code>protected Constructor<A> getEntityConstructor() { if (this.entityConstructor == null) { final Constructor<A> result = getConstructor(entityClass, idClass); return result; } <START> return this.entityConstructor; <END> }</code><technical_language>need remember result in entityConstructor</technical_language>

Target:
protected Constructor<A> getEntityConstructor() { if (this.entityConstructor == null) { final Constructor<A> result = getAggregateConstructor(); return result; } return this.entityConstructor; }
Source:
<code>public void testConsumerConfig() { Properties props = new Properties(); props.put("consumer.someProperty", "someValue"); props.put("consumer.someProperty1", "someValue1"); props.put("consumer.someProperty2", "someValue2"); KafkaBasedConnectorConfig config = new KafkaBasedConnectorConfig(props); Properties actualProps = config.getConsumerProps(); Properties taskProps = new Properties(); taskProps.putAll(actualProps); <START> Assert.assertNotNull(taskProps); <END> Assert.assertEquals(taskProps.getProperty("someProperty"), "someValue"); Assert.assertEquals(taskProps.getProperty("someProperty1"), "someValue1"); Assert.assertEquals(taskProps.getProperty("someProperty2"), "someValue2"); }</code><technical_language>mentioned "KafkaMirrorMakerConnectorTask.createKafkaConsumer(), properties copied another object, causing defaults longer accessible." Guess helpful extend test config reaches final destination? this check in, another check in work too</technical_language>

Target:
public void testConsumerConfig() { Properties props = new Properties(); props.put("consumer.someProperty", "someValue"); props.put("consumer.someProperty1", "someValue1"); props.put("consumer.someProperty2", "someValue2"); KafkaBasedConnectorConfig config = new KafkaBasedConnectorConfig(props); Properties configProps = config.getConsumerProps(); Properties copiedProps = new Properties(); copiedProps.putAll(configProps); Assert.assertNotNull(copiedProps); Assert.assertEquals(copiedProps.getProperty("someProperty"), "someValue"); Assert.assertEquals(copiedProps.getProperty("someProperty1"), "someValue1"); Assert.assertEquals(copiedProps.getProperty("someProperty2"), "someValue2"); Properties taskProps = KafkaConnectorTask.getKafkaConsumerProperties(configProps, "groupId", KafkaConnectionString.valueOf("kafkassl://somewhere:777/topic")); Assert.assertEquals(taskProps.getProperty("someProperty"), "someValue"); Assert.assertEquals(taskProps.getProperty("someProperty1"), "someValue1"); Assert.assertEquals(taskProps.getProperty("someProperty2"), "someValue2"); }