auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void updateDataSourceStringValue(CorrelationDataSource eamDataSource, String column, String value) throws EamDbException { if (eamDataSource == null) { throw new EamDbException("Correlation data source is null"); } Connection conn = connect(); PreparedStatement preparedStatement = null; String sql = "UPDATE data_sources " + "SET " + column + "=? " + "WHERE id=?"; try { preparedStatement = conn.prepareStatement(sql); preparedStatement.setString(1, value); preparedStatement.setInt(2, eamDataSource.getID()); preparedStatement.executeUpdate(); dataSourceCacheByDsObjectId.put(getDataSourceByDSObjectIdCacheKey(eamDataSource.getCaseID(), eamDataSource.getDataSourceObjectID()), eamDataSource); dataSourceCacheById.put(getDataSourceByIdCacheKey(eamDataSource.getCaseID(), eamDataSource.getID()), eamDataSource); } catch (SQLException ex) { throw new EamDbException("Error updating data source.", ex); } finally { EamDbUtil.closeStatement(preparedStatement); EamDbUtil.closeConnection(conn); } }

Target:
private void updateDataSourceStringValue(CorrelationDataSource eamDataSource, String column, String value) throws EamDbException { if (eamDataSource == null) { throw new EamDbException("Correlation data source is null"); } Connection conn = connect(); PreparedStatement preparedStatement = null; String sql = "UPDATE data_sources " + "SET " + column + "=? " + "WHERE id=?"; try { preparedStatement = conn.prepareStatement(sql); preparedStatement.setString(1, value); preparedStatement.setInt(2, eamDataSource.getID()); preparedStatement.executeUpdate(); dataSourceCacheByDsObjectId.put(getDataSourceByDSObjectIdCacheKey(eamDataSource.getCaseID(), eamDataSource.getDataSourceObjectID()), eamDataSource); dataSourceCacheById.put(getDataSourceByIdCacheKey(eamDataSource.getCaseID(), eamDataSource.getID()), eamDataSource); } catch (SQLException ex) { throw new EamDbException(String.format("Error updating data source (obj_id=%d).", eamDataSource.getDataSourceObjectID()), ex); } finally { EamDbUtil.closeStatement(preparedStatement); EamDbUtil.closeConnection(conn); } }
Source:
public BulkLoadingListener() { this.counter = 0L; this.isNewVertex = false; ; }

Target:
public BulkLoadingListener() { this.counter = 0L; this.isNewVertex = false; }
Source:
public void testSaveBulkNullId() throws Exception { List<Document> documents = new Vector<Document>(); documents.add(new Document(null, System.currentTimeMillis(), mapper.valueToTree(Collections.singletonMap("TEST_NAME", "SINGLE_SAVE_TEST")))); documents.add(new Document(UUID.randomUUID().toString(), System.currentTimeMillis(), mapper.valueToTree(Collections.singletonMap("TEST_NAME", "SINGLE_SAVE_TEST")))); queryStore.save(TestUtils.TEST_TABLE_NAME, documents); }

Target:
public void testSaveBulkNullId() throws Exception { List<Document> documents = new Vector<Document>(); documents.add(new Document(null, System.currentTimeMillis(), mapper.valueToTree(Collections.singletonMap("TEST_NAME", "SINGLE_SAVE_TEST")))); documents.add(new Document(UUID.randomUUID().toString(), System.currentTimeMillis(), mapper.valueToTree(Collections.singletonMap("TEST_NAME", "SINGLE_SAVE_TEST")))); try { queryStore.save(TestUtils.TEST_TABLE_NAME, documents); } catch (QueryStoreException e) { assertEquals(QueryStoreException.ErrorCode.INVALID_REQUEST, e.getErrorCode()); throw e; } }
Source:
long getSlice(String jobType, String jobId, long usedSinceLastCall) throws InterruptedException { Throttler throttler = throttlers.get(jobType); if (throttler != null) { throttler.maybeThrottle(usedSinceLastCall); } return Long.MAX_VALUE; }

Target:
long getSlice(String jobType, String jobId, long usedSinceLastCall) { Throttler throttler = throttlers.get(jobType); if (throttler != null) { try { throttler.maybeThrottle(usedSinceLastCall); } catch (InterruptedException e) { throw new IllegalStateException("Throttler call interrupted", e); } } return Long.MAX_VALUE; }
Source:
public DocumentModel createEntryWithoutReferences(Map<String, Object> fieldMap) { checkClose(); Object rawId = fieldMap.get(getIdField()); if (rawId == null) { throw new DirectoryException("Missing id"); } String id = String.valueOf(rawId); Map<String, Object> map = data.get(id); if (map != null) { throw new DirectoryException( String.format("Entry with id %s already exists on directory '%s'", id, directory.getName())); } map = new HashMap<>(); data.put(id, map); for (Entry<String, Object> e : fieldMap.entrySet()) { String fieldName = e.getKey(); if (!getDirectory().schemaSet.contains(fieldName)) { continue; } map.put(fieldName, e.getValue()); } return getEntry(id); }

Target:
public DocumentModel createEntryWithoutReferences(Map<String, Object> fieldMap) { checkClose(); Object rawId = fieldMap.get(getIdField()); if (rawId == null) { throw new DirectoryException("Missing id"); } String id = String.valueOf(rawId); Map<String, Object> map = data.get(id); if (map != null) { throw new DirectoryException( String.format("Entry with id %s already exists in directory %s", id, directory.getName())); } map = new HashMap<>(); data.put(id, map); for (Entry<String, Object> e : fieldMap.entrySet()) { String fieldName = e.getKey(); if (!getDirectory().schemaSet.contains(fieldName)) { continue; } map.put(fieldName, e.getValue()); } return getEntry(id); }
Source:
private Fix createCheckArgumentOrStateCall( MethodInvocationTree methodInvocationTree, VisitorState state, ExpressionTree arg1) { SuggestedFix.Builder fix = SuggestedFix.builder(); String replacementMethod = "checkState"; if (hasMethodParameter(state.getPath(), arg1)) { replacementMethod = "checkArgument"; } StringBuilder replacement = new StringBuilder(); if (methodInvocationTree.getMethodSelect().getKind() == Kind.IDENTIFIER) { replacement.append(replacementMethod).append("("); fix.addStaticImport("com.google.common.base.Preconditions." + replacementMethod); } else { replacement.append("Preconditions.").append(replacementMethod).append("("); } Joiner.on(", ").appendTo(replacement, methodInvocationTree.getArguments()); replacement.append(")"); fix.replace(methodInvocationTree, replacement.toString()); return fix.build(); }

Target:
private Fix createCheckArgumentOrStateCall( MethodInvocationTree methodInvocationTree, VisitorState state, ExpressionTree arg1) { SuggestedFix.Builder fix = SuggestedFix.builder(); String replacementMethod = "checkState"; if (hasMethodParameter(state.getPath(), arg1)) { replacementMethod = "checkArgument"; } StringBuilder replacement = new StringBuilder(); if (methodInvocationTree.getMethodSelect().getKind() == Kind.IDENTIFIER) { fix.addStaticImport("com.google.common.base.Preconditions." + replacementMethod); } else { replacement.append("Preconditions."); } replacement.append(replacementMethod).append('('); Joiner.on(", ").appendTo(replacement, methodInvocationTree.getArguments()); replacement.append(")"); fix.replace(methodInvocationTree, replacement.toString()); return fix.build(); }
Source:
default void register(SystemStreamPartition systemStreamPartition, Startpoint startpoint) { throw new UnsupportedOperationException("This operation is not supported."); }

Target:
default void register(SystemStreamPartition systemStreamPartition, Startpoint startpoint) { throw new UnsupportedOperationException(String.format("Registering the ssp: %s with startpoint: %s is not supported.", systemStreamPartition, startpoint)); }
Source:
public void testComponentActionManager() { setupActionList(); setupActionGetViewId(); ComponentActionManager actionManager = new ComponentActionManager(actionList); assertNotNull(actionManager); }

Target:
public void testComponentActionManager() { setupActionList(); ComponentActionManager actionManager = new ComponentActionManager(actionList); assertNotNull(actionManager); }
Source:
protected List<DiskImage> manualAggregateSnapshots() { List<DiskImage> diskImageWithAggregatedSnapshots = new ArrayList<>(); DiskImage diskWithSnaps = diskWithSnapshots; diskWithSnaps.getSnapshots().addAll(snapshotsList); diskImageWithAggregatedSnapshots.add(diskWithSnapshots); return diskImageWithAggregatedSnapshots; }

Target:
protected List<DiskImage> manualAggregateSnapshots() { diskWithSnapshots.getSnapshots().addAll(snapshotsList); return Collections.singletonList(diskWithSnapshots); }
Source:
public String getMail(Model model, HttpSession session, @RequestParam(value = "inbox", required = false) String inbox, @RequestParam(value = "sentmail", required = false) String sentmail, @RequestParam(value = "drafts", required = false) String drafts) { if (session.getAttribute("member") == null) return "redirect:denied"; Member member = (Member) session.getAttribute("member"); Set<Message> messages; if (inbox != null) messages = member.getMail().getMessages(); else if (sentmail != null) messages = member.getMail().getSentMail(); else if (drafts != null) messages = member.getMail().getDrafts(); else messages = member.getMail().getMessages(); List<Message> reversedMessages = new ArrayList<>(messages); Collections.reverse(reversedMessages); model.addAttribute("messages", reversedMessages); session.setAttribute("message", null); return "mail"; }

Target:
public String getMail( Model model, HttpSession session, @RequestParam(value = "inbox", required = false) String inbox, @RequestParam(value = "sentmail", required = false) String sentmail, @RequestParam(value = "drafts", required = false) String drafts) { Member member = (Member) session.getAttribute("member"); MemberDao memberDao = new MemberDao(); member = memberDao.getMemberById(member.getId()); if (member == null) { return "redirect:/denied"; } Set<Message> messages; if (sentmail != null) messages = member.getMail().getSentMail(); else if (drafts != null) messages = member.getMail().getDrafts(); else messages = member.getMail().getMessages(); List<Message> reversedMessages = new ArrayList<>(messages); Collections.reverse(reversedMessages); model.addAttribute("messages", reversedMessages); session.setAttribute("message", null); Set<Team> teams = member.getTeams(); model.addAttribute("teams", teams); TournamentDao tournamentDao = new TournamentDao(); List<Tournament> tournaments = tournamentDao.getLastXTournaments(5); model.addAttribute("tournaments", tournaments); return "mail"; }
Source:
public ValueDerivatives(double value, double[] derivatives) { this._value = value; this._derivatives = derivatives; }

Target:
public ValueDerivatives(double value, double[] derivatives) { this._value = value; this._derivatives = derivatives.clone(); }
Source:
public boolean register(String target, String xp, Descriptor descriptor) { log.trace("Register to {}/{}", descriptor.getId(), target, xp); return descriptors.computeIfAbsent(target, k -> new HashMap<>()) .computeIfAbsent(xp, k -> new LinkedHashMap<>()) .computeIfAbsent(descriptor.getId(), k -> new ArrayList<>()) .add(descriptor); }

Target:
public boolean register(String target, String xp, Descriptor descriptor) { log.debug("Register to {}/{}", descriptor.getId(), target, xp); return descriptors.computeIfAbsent(target, k -> new HashMap<>()) .computeIfAbsent(xp, k -> new LinkedHashMap<>()) .computeIfAbsent(descriptor.getId(), k -> new ArrayList<>()) .add(descriptor); }
Source:
static int getPriority(TableName tableName) { if (tableName.isSystemTable() && !tableName.equals(SlowLogTableAccessor.SLOW_LOG_TABLE_NAME)) { return HConstants.SYSTEMTABLE_QOS; } else { return HConstants.NORMAL_QOS; } }

Target:
static int getPriority(TableName tableName) { if (tableName.isSystemTable()) { return HConstants.SYSTEMTABLE_QOS; } else { return HConstants.NORMAL_QOS; } }
Source:
public void getElementTest() throws Exception { String craigsUrl = "<LINK_0>"; String expH2 = "san francisco"; iface.go(craigsUrl); WebDriverElement header = ((WebDriverElement) iface.getWebDriverElement(Strategy.ID, "topban")); ((WebDriverElement) header.getElement(new Hook(Strategy.TAG, "a"), 1)).click(); header = ((WebDriverElement) iface.getWebDriverElement(Strategy.ID, "topban")); WebDriverElement h2Control = ((WebDriverElement) header.getElement(new Hook(Strategy.TAG, "h2"), 0)); String actH2 = h2Control.getText().trim(); Assert.assertEquals(expH2, actH2); }

Target:
public void getElementTest() throws Exception { String craigsUrl = "<LINK_0>"; String expH2 = "san francisco"; iface.go(craigsUrl); WebDriverElement header = iface.getWebDriverElement(Strategy.ID, "topban"); ((WebDriverElement) header.getElement(new Hook(Strategy.TAG, "a"), 1)).click(); header = iface.getWebDriverElement(Strategy.ID, "topban"); WebDriverElement h2Control = ((WebDriverElement) header.getElement(new Hook(Strategy.TAG, "h2"), 0)); String actH2 = h2Control.getText().trim(); Assert.assertEquals(expH2, actH2); }
Source:
public Mono<ServiceBusReceiverAsyncClient> acceptNextSession() { return unNamedSessionManager.getActiveLink().flatMap(receiveLink -> receiveLink.getSessionId() .map(sessionId -> { ReceiverOptions newReceiverOptions = new ReceiverOptions(receiverOptions.getReceiveMode(), receiverOptions.getPrefetchCount(), sessionId, null, receiverOptions.getMaxLockRenewDuration()); final ServiceBusSessionManager sessionSpecificManager = new ServiceBusSessionManager(entityPath, entityType, connectionProcessor, tracerProvider, messageSerializer, newReceiverOptions, receiveLink); return new ServiceBusReceiverAsyncClient(fullyQualifiedNamespace, entityPath, entityType, newReceiverOptions, connectionProcessor, ServiceBusConstants.OPERATION_TIMEOUT, tracerProvider, messageSerializer, onClientClose, sessionSpecificManager); })); }

Target:
public Mono<ServiceBusReceiverAsyncClient> acceptNextSession() { return unNamedSessionManager.getActiveLink().flatMap(receiveLink -> receiveLink.getSessionId() .map(sessionId -> { final ReceiverOptions newReceiverOptions = new ReceiverOptions(receiverOptions.getReceiveMode(), receiverOptions.getPrefetchCount(), receiverOptions.getMaxLockRenewDuration(), receiverOptions.isAutoLockRenewEnabled(), sessionId, null); final ServiceBusSessionManager sessionSpecificManager = new ServiceBusSessionManager(entityPath, entityType, connectionProcessor, tracerProvider, messageSerializer, newReceiverOptions, receiveLink); return new ServiceBusReceiverAsyncClient(fullyQualifiedNamespace, entityPath, entityType, newReceiverOptions, connectionProcessor, ServiceBusConstants.OPERATION_TIMEOUT, tracerProvider, messageSerializer, () -> { }, sessionSpecificManager); })); }
Source:
private String visitSyntheticModuleTypes(ObjectType type) { Node source = type.getConstructor().getSource(); InputId id = source.getInputId(); while (id == null) { source = source.getParent(); id = source.getInputId(); } try { String code = compiler.getInput(id).getCode(); for (String line : Splitter.on('\n').split(code)) { Matcher matcher = GOOG_MODULE_EXTRACT.matcher(line); if (matcher.find()) { return Constants.INTERNAL_NAMESPACE + "." + matcher.group(1); } } } catch (IOException e) { throw new RuntimeException("Failed to read input while processing type for " + type.getDisplayName(), e); } throw new RuntimeException("Did not find a matching goog.module while processing type " + type.getDisplayName()); }

Target:
private String visitSyntheticModuleTypes(ObjectType type) { String code = getSource(type.getConstructor()); for (String line : Splitter.on('\n').split(code)) { Matcher matcher = GOOG_MODULE_EXTRACT.matcher(line); if (matcher.find()) { return Constants.INTERNAL_NAMESPACE + "." + matcher.group(1); } } throw new RuntimeException("Did not find a matching goog.module while processing type " + type.getDisplayName()); }
Source:
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RequestCodes.SITE_PICKER && resultCode == Activity.RESULT_OK) { int siteLocalId = data.getIntExtra(SitePickerActivity.KEY_LOCAL_ID, -1); SiteModel site = mSiteStore.getSiteByLocalId(siteLocalId); ActivityLauncher.openEditorForReblog(getActivity(), site, this.mPostToReblog); } }

Target:
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RequestCodes.SITE_PICKER && resultCode == Activity.RESULT_OK) { int siteLocalId = data.getIntExtra(SitePickerActivity.KEY_LOCAL_ID, -1); mViewModel.onReblogSiteSelected(siteLocalId); } }
Source:
public Set<EngineError> getExpectedEngineErrors() { return expectedEngineErrors.orElse(Collections.EMPTY_SET); }

Target:
public Set<EngineError> getExpectedEngineErrors() { return expectedEngineErrors.orElse(Collections.<EngineError>emptySet()); }
Source:
protected MixpanelNotificationData.PushTapAction buildOnTap(String onTapStr) { MixpanelNotificationData.PushTapAction onTap = null; if (null != onTapStr) { try { final JSONObject onTapJSON = new JSONObject(onTapStr); final String typeFromJSON = onTapJSON.getString("type"); if (!typeFromJSON.equals(MixpanelNotificationData.PushTapTarget.HOMESCREEN.getTarget())) { final String uriFromJSON = onTapJSON.getString("uri"); onTap = new MixpanelNotificationData.PushTapAction(MixpanelNotificationData.PushTapTarget.fromString(typeFromJSON), uriFromJSON); } else { onTap = new MixpanelNotificationData.PushTapAction(MixpanelNotificationData.PushTapTarget.fromString(typeFromJSON)); } if (onTap.getActionType().getTarget().equals(MixpanelNotificationData.PushTapTarget.ERROR.getTarget())) { hasOnTapError = true; } } catch (JSONException e){ MPLog.d(LOGTAG, "Exception occurred while parsing ontap"); onTap = null; } } return onTap; }

Target:
protected MixpanelNotificationData.PushTapAction buildOnTap(String onTapStr) { MixpanelNotificationData.PushTapAction onTap = null; if (null != onTapStr) { try { final JSONObject onTapJSON = new JSONObject(onTapStr); final String typeFromJSON = onTapJSON.getString("type"); if (!typeFromJSON.equals(MixpanelNotificationData.PushTapTarget.HOMESCREEN.getTarget())) { final String uriFromJSON = onTapJSON.getString("uri"); onTap = new MixpanelNotificationData.PushTapAction(MixpanelNotificationData.PushTapTarget.fromString(typeFromJSON), uriFromJSON); } else { onTap = new MixpanelNotificationData.PushTapAction(MixpanelNotificationData.PushTapTarget.fromString(typeFromJSON)); } if (onTap.getActionType().getTarget().equals(MixpanelNotificationData.PushTapTarget.ERROR.getTarget())) { hasOnTapError = true; onTap = new MixpanelNotificationData.PushTapAction(MixpanelNotificationData.PushTapTarget.HOMESCREEN); } } catch (JSONException e){ MPLog.d(LOGTAG, "Exception occurred while parsing ontap"); onTap = null; } } return onTap; }
Source:
public Condition getCondition() throws AppException { Condition preCondition = super.getCondition(); Condition condition = new Condition(); List<Condition.Entry> entries = preCondition.getEntries(); for(int i = 0; i < entries.size(); i++) { Condition.Entry entry =entries.get(i); if(entry.getValue() instanceof Enum) { Enum tmpValue = (Enum)entry.getValue(); condition.addEntry(entry.getFieldName(), entry.getConditionType(), tmpValue.ordinal()); } else { condition.addEntry(entry); } } if (contestId != null) { if (contestId == -1) { condition.addEntry("contestId", Condition.ConditionType.IS_NULL, null); } else { condition.addEntry("contestId", Condition.ConditionType.EQUALS, contestId); } } if (!StringUtil.isNullOrWhiteSpace(userName)) { condition.addEntry("userByUserId.userName", ConditionType.LIKE, userName); } if (!isForAdmin) { condition.addEntry("userByUserId.type", ConditionType.NOT_EQUALS, AuthenticationType.ADMIN.ordinal()); } if (result != null) { results.add(result); } if (!results.contains(OnlineJudgeResultType.OJ_ALL)) { Condition typeCondition = new Condition(JoinedType.OR); Set<Integer> affectedResults = new HashSet<>(); for (OnlineJudgeResultType result : results) { affectedResults.addAll(result.getResults()); } for (Integer result : affectedResults) { typeCondition.addEntry("result", ConditionType.EQUALS, result); } condition.addEntry(typeCondition); } return condition; }

Target:
public Condition getCondition() throws AppException { Condition condition = EnumTypeUtil.toOrdinalCondition(super.getCondition()); if (contestId != null) { if (contestId == -1) { condition.addEntry("contestId", Condition.ConditionType.IS_NULL, null); } else { condition.addEntry("contestId", Condition.ConditionType.EQUALS, contestId); } } if (!StringUtil.isNullOrWhiteSpace(userName)) { condition.addEntry("userByUserId.userName", ConditionType.LIKE, userName); } if (!isForAdmin) { condition.addEntry("userByUserId.type", ConditionType.NOT_EQUALS, AuthenticationType.ADMIN.ordinal()); } if (result != null) { results.add(result); } if (!results.contains(OnlineJudgeResultType.OJ_ALL)) { Condition typeCondition = new Condition(JoinedType.OR); Set<Integer> affectedResults = new HashSet<>(); for (OnlineJudgeResultType result : results) { affectedResults.addAll(result.getResults()); } for (Integer result : affectedResults) { typeCondition.addEntry("result", ConditionType.EQUALS, result); } condition.addEntry(typeCondition); } return condition; }
Source:
public void onEventMainThread(UploadService.UploadMediaRetryEvent event) { if (!isAdded()) { return; } if (event.mediaModelList != null && !event.mediaModelList.isEmpty()) { Set<PostModel> postsToRefresh = PostUtils.getPostsThatIncludeThisMedia(mPostStore, event.mediaModelList); for (PostModel post : postsToRefresh) { if (post != null) { getPostListAdapter().notifyItemChanged(getPostListAdapter().getPositionForPost(post)); } } } }

Target:
public void onEventMainThread(UploadService.UploadMediaRetryEvent event) { if (!isAdded()) { return; } if (event.mediaModelList != null && !event.mediaModelList.isEmpty()) { Set<PostModel> postsToRefresh = PostUtils.getPostsThatIncludeThisMedia(mPostStore, event.mediaModelList); for (PostModel post : postsToRefresh) { int position = getPostListAdapter().getPositionForPost(post); if (position > -1) { getPostListAdapter().notifyItemChanged(position); } } } }
Source:
static void casLeaders( HazelcastInstance hazelcastInstance, LeaderInfo leaderInfo, String dbName ) { IAtomicReference<LeaderInfo> leaderRef = hazelcastInstance.getAtomicReference( DB_NAME_LEADER_TERM_PREFIX + dbName ); LeaderInfo expected = leaderRef.get(); boolean noUpdate = Optional.ofNullable( expected ).map( LeaderInfo::memberId ).equals( Optional.ofNullable( leaderInfo.memberId() ) ); boolean greaterOrEqualTermExists = Optional.ofNullable( expected ).map(l -> l.term() >= leaderInfo.term() ).orElse( false ); if ( (greaterOrEqualTermExists || noUpdate) && !leaderInfo.isStepDown() ) { return; } leaderRef.compareAndSet( expected, leaderInfo ); }

Target:
static void casLeaders( HazelcastInstance hazelcastInstance, LeaderInfo leaderInfo, String dbName ) { IAtomicReference<LeaderInfo> leaderRef = hazelcastInstance.getAtomicReference( DB_NAME_LEADER_TERM_PREFIX + dbName ); LeaderInfo current = leaderRef.get(); Optional<LeaderInfo> currentOpt = Optional.ofNullable( current ); boolean noUpdate = currentOpt.map( LeaderInfo::memberId ).equals( Optional.ofNullable( leaderInfo.memberId() ) ); int termComparison = currentOpt.map( l -> Long.compare( l.term(), leaderInfo.term() ) ).orElse( -1 ); boolean greaterTermExists = termComparison > 0; boolean invalidTerm = greaterTermExists || ( termComparison == 0 && !leaderInfo.isSteppingDown() ); boolean success = !( invalidTerm || noUpdate); if ( !success ) { return; } leaderRef.compareAndSet( current, leaderInfo ); }
Source:
public static <R> Single<R> zip(Iterable<? extends Single<?>> singles, FuncN<? extends R> zipFunction) { List<Observable<?>> listOfSingles = new ArrayList<Observable<?>>(); for (Single<?> single : singles) { listOfSingles.add(asObservable(single)); } return just(listOfSingles.toArray(new Observable<?>[listOfSingles.size()])).lift(new OperatorZip<R>(zipFunction)); }

Target:
public static <R> Single<R> zip(Iterable<? extends Single<?>> singles, FuncN<? extends R> zipFunction) { return SingleOperatorZip.zip(iterableToArray(singles), zipFunction); }
Source:
public void should_not_loose_InnerClasses_attribute() throws Exception { final ClassWriter cw = new ClassWriter(0); final ClassReader cr = new ClassReader( TargetLoader.getClassDataAsBytes(Inner.class)); cr.accept(new ClassVisitor(InstrSupport.ASM_API_VERSION, cw) { @Override public void visitEnd() { final MethodVisitor mv = cv.visitMethod(0, "m", "()V", null, null); mv.visitCode(); addCauseOfResizeInstructions(mv); mv.visitMaxs(2, 1); mv.visitEnd(); super.visitEnd(); } }, 0); final byte[] bytes = instrumenter.instrument(cw.toByteArray(), ""); final TargetLoader targetLoader = new TargetLoader(); final Class<?> outer = targetLoader.add(ResizeInstructionsTest.class, TargetLoader.getClassDataAsBytes(ResizeInstructionsTest.class)); final Class<?> inner = targetLoader.add(Inner.class, bytes); assertSame(outer, inner.getEnclosingClass()); assertNotNull(inner.getEnclosingClass()); assertSame(outer, inner.getDeclaringClass()); assertNotNull(inner.getDeclaringClass()); }

Target:
public void should_not_loose_InnerClasses_attribute() throws Exception { final ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES); final ClassReader cr = new ClassReader( TargetLoader.getClassDataAsBytes(Inner.class)); cr.accept(new ClassVisitor(InstrSupport.ASM_API_VERSION, cw) { @Override public void visitEnd() { final MethodVisitor mv = cv.visitMethod(0, "m", "()V", null, null); mv.visitCode(); addCauseOfResizeInstructions(mv); mv.visitMaxs(2, 1); mv.visitEnd(); super.visitEnd(); } }, 0); final byte[] bytes = instrumenter.instrument(cw.toByteArray(), ""); final TargetLoader targetLoader = new TargetLoader(); final Class<?> outer = targetLoader.add(ResizeInstructionsTest.class, TargetLoader.getClassDataAsBytes(ResizeInstructionsTest.class)); final Class<?> inner = targetLoader.add(Inner.class, bytes); assertSame(outer, inner.getEnclosingClass()); assertNotNull(inner.getEnclosingClass()); assertSame(outer, inner.getDeclaringClass()); assertNotNull(inner.getDeclaringClass()); }
Source:
public void visitName(Name name) { if (!callGlobalsOrLocals && !hasWildcardImport && name.isVariable() && name.symbol() == null) { nameIssues.computeIfAbsent(name.name(), k -> new ArrayList<>()).add(name); } }

Target:
public void visitName(Name name) { if (name.isVariable() && name.symbol() == null) { nameIssues.computeIfAbsent(name.name(), k -> new ArrayList<>()).add(name); } }
Source:
public void test_json_support_and_other_files() throws Exception { Fs fs = startCrawlerDefinition() .setJsonSupport(true) .build(); startCrawler(getCrawlerName(), fs, endCrawlerDefinition(getCrawlerName()), null); assertThat("We should have 2 docs only...", awaitBusy(() -> { try { SearchResponse response = elasticsearchClient.search(getCrawlerName(), FsCrawlerUtil.INDEX_TYPE_DOC, (String) null); return response.getHits().getTotal() == 3; } catch (IOException e) { logger.warn("Caught exception while running the test", e); return false; } }), equalTo(true)); }

Target:
public void test_json_support_and_other_files() throws Exception { Fs fs = startCrawlerDefinition() .setJsonSupport(true) .build(); startCrawler(getCrawlerName(), fs, endCrawlerDefinition(getCrawlerName()), null); assertThat("We should have 3 docs only...", awaitBusy(() -> { try { SearchResponse response = elasticsearchClient.search(getCrawlerName(), FsCrawlerUtil.INDEX_TYPE_DOC, (String) null); return response.getHits().getTotal() == 3; } catch (IOException e) { logger.warn("Caught exception while running the test", e); return false; } }), equalTo(true)); }
Source:
protected void waitForTasksToBeCleared() throws InterruptedException { while (true) { Thread.sleep(3000); List<Guid> tasks = getDbFacade().getAsyncTaskDao().getAsyncTaskIdsByEntity(getStorageDomainId()); if (tasks.isEmpty()) { return; } } }

Target:
protected void waitForTasksToBeCleared() throws InterruptedException { while (true) { TimeUnit.SECONDS.sleep(3); List<Guid> tasks = getDbFacade().getAsyncTaskDao().getAsyncTaskIdsByEntity(getStorageDomainId()); if (tasks.isEmpty()) { log.infoFormat("no tasks for the deactivated domain {0}, proceeding with deactivation", getStorageDomainId()); return; } } }
Source:
private static Path getPath(String resource) throws Exception { String filePath = Resources.getResource(resource).getFile(); return (System.getProperty("os.name").toLowerCase().contains("win") && filePath.charAt(0) == '/') ? Paths.get(filePath.substring(1)) : Paths.get(filePath); }

Target:
private static Path getPath(String resource) throws Exception { String filePath = Resources.getResource(resource).getFile(); return Paths.get( System.getProperty("os.name").toLowerCase().contains("win") && filePath.startsWith("/") ? filePath.substring(1) : filePath); }
Source:
public Mono<Response<Key>> getKeyWithResponse(String name, String version) { if (version == null) { return withContext(context -> getKey(name, "", context)); } return withContext(context -> getKey(name, version, context)); }

Target:
public Mono<Response<Key>> getKeyWithResponse(String name, String version) { return withContext(context -> getKeyWithResponse(name, version == null ? "" : version, context)); }
Source:
public void save(Writer writer) { JsonObject jsonObject = new JsonObject(); for (Map.Entry<SimpleUri, Setting> entry : settings.entrySet()) { Setting setting = entry.getValue(); if (!setting.getValue().equals(setting.getDefaultValue())) { jsonObject.add(entry.getKey().toString(), setting.getValueAsJson()); } } for (Map.Entry<SimpleUri, String> entry : temporarilyParkedSettings.entrySet()) { jsonObject.addProperty(entry.getKey().toString(), entry.getValue()); } gson.toJson(jsonObject, writer); }

Target:
public void save(Writer writer) { JsonObject jsonObject = new JsonObject(); jsonObject.addProperty(DESCRIPTION_PROPERTY_NAME, description); for (Map.Entry<SimpleUri, Setting> entry : settings.entrySet()) { Setting setting = entry.getValue(); if (!setting.getValue().equals(setting.getDefaultValue())) { jsonObject.add(entry.getKey().toString(), setting.getValueAsJson()); } } for (Map.Entry<SimpleUri, String> entry : temporarilyParkedSettings.entrySet()) { jsonObject.addProperty(entry.getKey().toString(), entry.getValue()); } gson.toJson(jsonObject, writer); }
Source:
public void testFindTaskEventsForNotExistingTask() { String invalidId = "-9.999"; try { taskClient.findTaskEvents(CONTAINER_ID, -9999L, 0, 10); fail("KieServicesException should be thrown when task not found"); } catch (KieServicesException e) { if(configuration.isRest()) { KieServerAssert.assertResultContainsString(e.getMessage(), "Could not find task instance with id \"" + invalidId + "\""); KieServicesHttpException httpEx = (KieServicesHttpException) e; assertEquals(Integer.valueOf(404), httpEx.getHttpCode()); } else { assertTrue(e.getMessage().contains("No task found with id " + invalidId)); } } catch (TaskNotFoundException tnfe) { assertTrue(tnfe.getMessage().contains("No task found with id " + invalidId)); } }

Target:
public void testFindTaskEventsForNotExistingTask() { String invalidId = "-999"; try { taskClient.findTaskEvents(CONTAINER_ID, -999L, 0, 10); fail("KieServicesException should be thrown when task not found"); } catch (KieServicesException e) { if(configuration.isRest()) { KieServerAssert.assertResultContainsString(e.getMessage(), "Could not find task instance with id \"" + invalidId + "\""); KieServicesHttpException httpEx = (KieServicesHttpException) e; assertEquals(Integer.valueOf(404), httpEx.getHttpCode()); } else { assertTrue(e.getMessage().contains("No task found with id " + invalidId)); } } catch (TaskNotFoundException tnfe) { assertTrue(tnfe.getMessage().contains("No task found with id " + invalidId)); } }
Source:
public void testGetFileIteratorWithBothBaseDirAndDuplicateFilesIteratingFilesOnlyOnce() throws IOException { File baseDir = temporaryFolder.newFolder(); List<File> filesInBaseDir = new ArrayList<>(); for (int i = 0; i < 10; i++) { final File file = File.createTempFile("local-input-source", ".data", baseDir); try (FileWriter writer = new FileWriter(file)) { writer.write("test"); } filesInBaseDir.add(file); } Set<File> files = new HashSet<>(filesInBaseDir.subList(0, 5)); for (int i = 0; i < 3; i++) { final File file = File.createTempFile("local-input-source", ".data", baseDir); try (FileWriter writer = new FileWriter(file)) { writer.write("test"); } files.add(file); } Set<File> expectedFiles = new HashSet<>(filesInBaseDir); expectedFiles.addAll(files); File.createTempFile("local-input-source", ".filtered", baseDir); Iterator<File> fileIterator = new LocalInputSource(baseDir, "*.data", files).getFileIterator(); Set<File> actualFiles = Streams.sequentialStreamFrom(fileIterator).collect(Collectors.toSet()); Assert.assertEquals(expectedFiles, actualFiles); }

Target:
public void testGetFileIteratorWithBothBaseDirAndDuplicateFilesIteratingFilesOnlyOnce() throws IOException { File baseDir = temporaryFolder.newFolder(); List<File> filesInBaseDir = new ArrayList<>(); for (int i = 0; i < 10; i++) { final File file = File.createTempFile("local-input-source", ".data", baseDir); try (Writer writer = Files.newBufferedWriter(file.toPath(), StandardCharsets.UTF_8)) { writer.write("test"); } filesInBaseDir.add(file); } Set<File> files = new HashSet<>(filesInBaseDir.subList(0, 5)); for (int i = 0; i < 3; i++) { final File file = File.createTempFile("local-input-source", ".data", baseDir); try (Writer writer = Files.newBufferedWriter(file.toPath(), StandardCharsets.UTF_8)) { writer.write("test"); } files.add(file); } Set<File> expectedFiles = new HashSet<>(filesInBaseDir); expectedFiles.addAll(files); File.createTempFile("local-input-source", ".filtered", baseDir); Iterator<File> fileIterator = new LocalInputSource(baseDir, "*.data", files).getFileIterator(); Set<File> actualFiles = Streams.sequentialStreamFrom(fileIterator).collect(Collectors.toSet()); Assert.assertEquals(expectedFiles, actualFiles); }
Source:
protected void run(Date lastRun) { HttpRequest request; try { request = HttpRequest.get("<LINK_0>"); } catch (HttpRequest.HttpRequestException e) { return; } JSONObject meta; try { meta = new JSONObject(request.body()); } catch (JSONException e) { throw new RuntimeException(e); } SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); if (prefs.contains(PREFERENCE_KEY_ALPHA_COMMIT)) { if (!prefs.getString(PREFERENCE_KEY_ALPHA_COMMIT, "").equals(meta.optString("commit_hash", ""))) { showNotification(); } } prefs.edit().putString(PREFERENCE_KEY_ALPHA_COMMIT, meta.optString("commit_hash")).commit(); }

Target:
protected void run(Date lastRun) { String responseJSON; try { HttpRequest request = HttpRequest.get("<LINK_0>"); responseJSON = request.body(); } catch (HttpRequest.HttpRequestException e) { return; } JSONObject meta; try { meta = new JSONObject(responseJSON); } catch (JSONException e) { throw new RuntimeException(e); } SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); if (prefs.contains(PREFERENCE_KEY_ALPHA_COMMIT)) { if (!prefs.getString(PREFERENCE_KEY_ALPHA_COMMIT, "").equals(meta.optString("commit_hash", ""))) { showNotification(); } } prefs.edit().putString(PREFERENCE_KEY_ALPHA_COMMIT, meta.optString("commit_hash")).commit(); }
Source:
private void addEdge(OutputComponent from, InputComponent to, String streamId, Stream.Grouping groupingType, List<String> fields) { LinkFluxComponent fluxComponent = new LinkFluxComponent(); Map<String, Object> config = new HashMap<>(); Map<String, Object> grouping = new LinkedHashMap<>(); if (Stream.Grouping.FIELDS.equals(groupingType)) { grouping.put(StormTopologyLayoutConstants.YAML_KEY_TYPE, StormTopologyLayoutConstants.YAML_KEY_CUSTOM_GROUPING); Map customGroupingClass = new HashMap<>(); customGroupingClass.put(StormTopologyLayoutConstants.YAML_KEY_CLASS_NAME, StormTopologyLayoutConstants.YAML_KEY_CUSTOM_GROUPING_CLASSNAME); customGroupingClass.put(StormTopologyLayoutConstants.YAML_KEY_CONSTRUCTOR_ARGS, fields); grouping.put(StormTopologyLayoutConstants.YAML_KEY_CUSTOM_GROUPING_CLASS, customGroupingClass); } else { grouping.put(StormTopologyLayoutConstants.YAML_KEY_TYPE, String.valueOf(groupingType)); } grouping.put(StormTopologyLayoutConstants.YAML_KEY_STREAM_ID, streamId); fluxComponent.updateLinkComponentWithGrouping(grouping); config.put(StormTopologyLayoutConstants.YAML_KEY_FROM, getFluxId(from)); config.put(StormTopologyLayoutConstants.YAML_KEY_TO, getFluxId(to)); fluxComponent.withConfig(config); Map<String, Object> yamlComponent = fluxComponent.getComponent(); keysAndComponents.add(makeEntry(StormTopologyLayoutConstants.YAML_KEY_STREAMS, yamlComponent)); }

Target:
private void addEdge(OutputComponent from, InputComponent to, String streamId, Stream.Grouping groupingType, List<String> fields) { LinkFluxComponent fluxComponent = new LinkFluxComponent(); Map<String, Object> config = new HashMap<>(); Map<String, Object> grouping = new LinkedHashMap<>(); if (Stream.Grouping.FIELDS.equals(groupingType)) { grouping.put(StormTopologyLayoutConstants.YAML_KEY_TYPE, StormTopologyLayoutConstants.YAML_KEY_CUSTOM_GROUPING); Map customGroupingClass = new HashMap<>(); customGroupingClass.put(StormTopologyLayoutConstants.YAML_KEY_CLASS_NAME, StormTopologyLayoutConstants.YAML_KEY_CUSTOM_GROUPING_CLASSNAME); customGroupingClass.put(StormTopologyLayoutConstants.YAML_KEY_CONSTRUCTOR_ARGS, fields); grouping.put(StormTopologyLayoutConstants.YAML_KEY_CUSTOM_GROUPING_CLASS, customGroupingClass); } else if (Stream.Grouping.SHUFFLE.equals(groupingType)) { grouping.put(StormTopologyLayoutConstants.YAML_KEY_TYPE, StormTopologyLayoutConstants.YAML_KEY_LOCAL_OR_SHUFFLE_GROUPING); } else { throw new RuntimeException("Unsupported grouping type: " + groupingType + " for storm link "); } grouping.put(StormTopologyLayoutConstants.YAML_KEY_STREAM_ID, streamId); fluxComponent.updateLinkComponentWithGrouping(grouping); config.put(StormTopologyLayoutConstants.YAML_KEY_FROM, getFluxId(from)); config.put(StormTopologyLayoutConstants.YAML_KEY_TO, getFluxId(to)); fluxComponent.withConfig(config); Map<String, Object> yamlComponent = fluxComponent.getComponent(); keysAndComponents.add(makeEntry(StormTopologyLayoutConstants.YAML_KEY_STREAMS, yamlComponent)); }
Source:
private List<Entity> validateExtensionAndGetEntities(String extensionName, String jobName, InputStream configStream) { ClientResponse clientResponse = new ResourceBuilder() .path(ExtensionOperations.DETAIL.path, extensionName) .call(ExtensionOperations.DETAIL); JSONObject responseJson; try { responseJson = new JSONObject(clientResponse.getEntity(String.class)); } catch (JSONException e) { OUT.get().print("Submit failed. Failed to get details for the given extension"); throw new FalconCLIException("Submit failed. Failed to get details for the given extension"); } String extensionType; String extensionBuildLocation; try { extensionType = responseJson.get("type").toString(); extensionBuildLocation = responseJson.get("location").toString(); } catch (JSONException e) { OUT.get().print("Error. " + extensionName + " not found "); throw new FalconCLIException("Submit failed. Failed to get details for the given extension"); } List<Entity> entities = null; if (!extensionType.equals(ExtensionType.CUSTOM.name())) { try { entities = ExtensionHandler.loadAndPrepare(extensionName, jobName, configStream, extensionBuildLocation); } catch (Exception e) { OUT.get().println("Error in building the extension"); throw new FalconCLIException("Submit failed. Failed to get details for the given extension"); } if (entities == null || entities.isEmpty()) { OUT.get().println("No entities got built"); throw new FalconCLIException("Submit failed. Failed to get details for the given extension"); } try { EntityUtil.applyTags(extensionName, jobName, entities); } catch (FalconException e) { OUT.get().println("Error in applying tags to generated entities"); throw new FalconCLIException("Submit failed. Failed to get details for the given extension"); } } return entities; }

Target:
private List<Entity> validateExtensionAndGetEntities(String extensionName, String jobName, InputStream configStream) { ClientResponse clientResponse = getExtensionDetailResponse(extensionName); List<Entity> entities = getEntities(extensionName, jobName, configStream, clientResponse); return entities; }
Source:
public SamIndexes getIndexType() { if (mIndexFile != null) { if (mIndexFile.getName().toLowerCase().endsWith(BAMIndex.BAI_INDEX_SUFFIX)) { return SamIndexes.BAI; } else if (mIndexFile.getName().toLowerCase().endsWith(BAMIndex.CSI_INDEX_SUFFIX)) { return SamIndexes.CSI; } } return null; }

Target:
public SamIndexes getIndexType() { if (mIndexFile != null) { if (mIndexFile.getName().toLowerCase().endsWith(BAMIndex.BAI_INDEX_SUFFIX)) { return SamIndexes.BAI; } else if (mIndexFile.getName().toLowerCase().endsWith(BAMIndex.CSI_INDEX_SUFFIX)) { return SamIndexes.CSI; } throw new SAMFormatException("Unknown BAM index file type: " + mIndexFile.getName()); } return null; }
Source:
public void handleDataDeleted(String dataPath) throws Exception { LOGGER.info(zLog("Data deleted on path " + dataPath + ". Predecessor went away. So, trying to become leader again...")); tryBecomeLeader(leaderElectorListener); }

Target:
public void handleDataDeleted(String dataPath) throws Exception { LOG.info( zLog("Data deleted on path " + dataPath + ". Predecessor went away. So, trying to become leader again...")); tryBecomeLeader(leaderElectorListener); }
Source:
public void zoom(boolean zoomIn) { Point cursorLocation = getDisplay().getCursorLocation(); Point origin = toDisplay(0,0); Rectangle size = getBounds(); Rectangle displayBounds = new Rectangle(origin.x + size.x, origin.y + size.y, size.width, size.height); if (!displayBounds.contains(cursorLocation)) { return; } int globalX = cursorLocation.x; Point p = toControl(globalX, 0); int nameSpace = fTimeProvider.getNameSpace(); int timeSpace = fTimeProvider.getTimeSpace(); int xPos = Math.max(nameSpace, Math.min(nameSpace + timeSpace, p.x)); long time0 = fTimeProvider.getTime0(); long time1 = fTimeProvider.getTime1(); long interval = time1 - time0; if (interval == 0) { interval = 1; } long newInterval; if (zoomIn) { newInterval = Math.max(Math.round(interval * ZOOM_IN_FACTOR), fTimeProvider.getMinTimeInterval()); } else { newInterval = (long) Math.ceil(interval * ZOOM_OUT_FACTOR); } long center = time0 + Math.round(((double) (xPos - nameSpace) / timeSpace * interval)); long newTime0 = center - Math.round((double) newInterval * (center - time0) / interval); newTime0 = Math.max(fTimeProvider.getMinTime(), Math.min(newTime0, fTimeProvider.getMaxTime() - newInterval)); long newTime1 = newTime0 + newInterval; fTimeProvider.setStartFinishTimeNotify(newTime0, newTime1); }

Target:
public void zoom(boolean zoomIn) { Point cursorDisplayLocation = getDisplay().getCursorLocation(); Point cursorControlLocation = toControl(cursorDisplayLocation); Point cursorScaleLocation = fTimeGraphScale.toControl(cursorDisplayLocation); if (!getBounds().contains(cursorControlLocation) && !fTimeGraphScale.getBounds().contains(cursorScaleLocation)) { return; } int nameSpace = fTimeProvider.getNameSpace(); int timeSpace = fTimeProvider.getTimeSpace(); int xPos = Math.max(nameSpace, Math.min(nameSpace + timeSpace, cursorControlLocation.x)); long time0 = fTimeProvider.getTime0(); long time1 = fTimeProvider.getTime1(); long interval = time1 - time0; if (interval == 0) { interval = 1; } long newInterval; if (zoomIn) { newInterval = Math.max(Math.round(interval * ZOOM_IN_FACTOR), fTimeProvider.getMinTimeInterval()); } else { newInterval = (long) Math.ceil(interval * ZOOM_OUT_FACTOR); } long center = time0 + Math.round(((double) (xPos - nameSpace) / timeSpace * interval)); long newTime0 = center - Math.round((double) newInterval * (center - time0) / interval); newTime0 = Math.max(fTimeProvider.getMinTime(), Math.min(newTime0, fTimeProvider.getMaxTime() - newInterval)); long newTime1 = newTime0 + newInterval; fTimeProvider.setStartFinishTimeNotify(newTime0, newTime1); }
Source:
public void onDisplayErrorVideoDialog() { DialogFactory.createErrorFetchingYoutubeVideoDialog(this, new ActionCallback() { @Override public void onButtonClick(final Dialog which, final Action action) { finish(); } }).show(); }

Target:
public void onDisplayErrorVideoDialog() { DialogFactory.createErrorFetchingYoutubeVideoDialog(this, new ActionCallback() { @Override public void onButtonClick(final Dialog which, final @Action int action) { finish(); } }).show(); }
Source:
@Override public Step newInstance(Map<String, Object> arguments) throws Exception { if (arguments.containsKey("url") || arguments.containsKey("credentialsId")) { if (arguments.containsKey("registry")) { throw new IllegalArgumentException("cannot mix url/credentialsId with registry"); } arguments.put("registry", new DockerRegistryEndpoint((String) arguments.remove("url"), (String) arguments.remove("credentialsId"))); } else if (!arguments.containsKey("registry")) { throw new IllegalArgumentException("must specify url/credentialsId (or registry)"); } return super.newInstance(arguments); }

Target:
@Override public Step newInstance(Map<String, Object> arguments) throws Exception { arguments = new HashMap<>(arguments); if (arguments.containsKey("url") || arguments.containsKey("credentialsId")) { if (arguments.containsKey("registry")) { throw new IllegalArgumentException("cannot mix url/credentialsId with registry"); } arguments.put("registry", new DockerRegistryEndpoint((String) arguments.remove("url"), (String) arguments.remove("credentialsId"))); } else if (!arguments.containsKey("registry")) { throw new IllegalArgumentException("must specify url/credentialsId (or registry)"); } return super.newInstance(arguments); }
Source:
public PrefetchGetRecordsCache(final int maxPendingProcessRecordsInput, final int maxByteSize, final int maxRecordsCount, final int maxRecordsPerCall, @NonNull final GetRecordsRetrievalStrategy getRecordsRetrievalStrategy, @NonNull final ExecutorService executorService, long idleMillisBetweenCalls, @NonNull final IMetricsFactory metricsFactory, @NonNull String operation) { this.getRecordsRetrievalStrategy = getRecordsRetrievalStrategy; this.maxRecordsPerCall = maxRecordsPerCall; this.maxPendingProcessRecordsInput = maxPendingProcessRecordsInput; this.maxByteSize = maxByteSize; this.maxRecordsCount = maxRecordsCount; this.getRecordsResultQueue = new LinkedBlockingQueue<>(this.maxPendingProcessRecordsInput); this.prefetchCounters = new PrefetchCounters(); this.executorService = executorService; this.metricsFactory = new ThreadSafeMetricsDelegatingFactory(metricsFactory); this.idleMillisBetweenCalls = idleMillisBetweenCalls; this.defaultGetRecordsCacheDaemon = new DefaultGetRecordsCacheDaemon(); this.operation = operation; }

Target:
public PrefetchGetRecordsCache(final int maxPendingProcessRecordsInput, final int maxByteSize, final int maxRecordsCount, final int maxRecordsPerCall, @NonNull final GetRecordsRetrievalStrategy getRecordsRetrievalStrategy, @NonNull final ExecutorService executorService, long idleMillisBetweenCalls, @NonNull final IMetricsFactory metricsFactory, @NonNull String operation) { this.getRecordsRetrievalStrategy = getRecordsRetrievalStrategy; this.maxRecordsPerCall = maxRecordsPerCall; this.maxPendingProcessRecordsInput = maxPendingProcessRecordsInput; this.maxByteSize = maxByteSize; this.maxRecordsCount = maxRecordsCount; this.getRecordsResultQueue = new LinkedBlockingQueue<>(this.maxPendingProcessRecordsInput); this.prefetchCounters = new PrefetchCounters(); this.executorService = executorService; this.metricsFactory = new ThreadSafeMetricsDelegatingFactory(metricsFactory); this.idleMillisBetweenCalls = idleMillisBetweenCalls; this.defaultGetRecordsCacheDaemon = new DefaultGetRecordsCacheDaemon(); Validate.notEmpty(operation, "Operation cannot be empty"); this.operation = operation; }