auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean accept(Path path) { if (!super.accept(path)) { return false; } String filename = path.getName(); Matcher m = HdfsSinkConnectorConstants.COMMITTED_FILENAME_PATTERN.matcher(filename); if (!m.matches()) { throw new AssertionError("match expected because of CommittedFileFilter"); } String topic = m.group(1); int partition = Integer.parseInt(m.group(2)); return topic.equals(tp.topic()) && partition == tp.partition(); }

Target:
public boolean accept(Path path) { if (!super.accept(path)) { return false; } String filename = path.getName(); Matcher m = HdfsSinkConnectorConstants.COMMITTED_FILENAME_PATTERN.matcher(filename); if (!m.matches()) { throw new AssertionError("match expected because of CommittedFileFilter"); } String topic = m.group(HdfsSinkConnectorConstants.PATTERN_TOPIC_GROUP); int partition = Integer.parseInt(m.group(HdfsSinkConnectorConstants.PATTERN_PARTITION_GROUP)); return topic.equals(tp.topic()) && partition == tp.partition(); }
Source:
public void init() throws DBException { Properties props = getProperties(); String configfile = props.getProperty(CONFIG_FILE_PROPERTY); if (configfile == null) { configfile = CONFIG_FILE_DEFAULT; } String id = props.getProperty(ID_PROPERTY); if (id == null) { id = ID_DEFAULT; } String pool = props.getProperty(POOL_PROPERTY); if (pool == null) { pool = POOL_DEFAULT; } rados = new Rados(id); try { rados.confReadFile(new File(configfile)); rados.connect(); ioctx = rados.ioCtxCreate(pool); } catch (RadosException e) { throw new DBException(e.getMessage() + ": " + e.getReturnValue()); } }

Target:
public void init() throws DBException { Properties props = getProperties(); String configfile = props.getProperty(CONFIG_FILE_PROPERTY); if (configfile == null) { configfile = CONFIG_FILE_DEFAULT; } String id = props.getProperty(ID_PROPERTY); if (id == null) { id = ID_DEFAULT; } String pool = props.getProperty(POOL_PROPERTY); if (pool == null) { pool = POOL_DEFAULT; } rados = new Rados(id); try { rados.confReadFile(new File(configfile)); rados.connect(); ioctx = rados.ioCtxCreate(pool); } catch (RadosException e) { throw new DBException(e.getMessage() + ": " + e.getReturnValue()); } isInited = true; }
Source:
public static byte[] stripZeroes(byte[] in) { if (in != null) { if (in.length == 1) return in; int firstValue = 0; while (firstValue < in.length && in[firstValue] == 0) { firstValue++; } byte[] out = new byte[in.length - firstValue]; for (int i = 0; i < out.length; i++) { out[i] = in[firstValue + i]; } if (out.length == 0) { byte[] res = new byte[1]; res[0] = (byte) 0x00; out = res.clone(); } return out; } else { LOGGER.severe(OSExceptionHandler.BYTE_ARRAY_NULL); throw new IllegalArgumentException(OSExceptionHandler.BYTE_ARRAY_NULL); } }

Target:
public static byte[] stripZeroes(byte[] in) { if (in != null) { if (in.length == 0) { return EMPTY; } if (in.length == 1) return in; int firstValue = 0; while (firstValue < in.length && in[firstValue] == 0) { firstValue++; } int newLength = in.length - firstValue; if (newLength == 0) { return ONE_ZERO; } byte[] out = new byte[newLength]; System.arraycopy(in, firstValue, out, 0, out.length); return out; } else { LOGGER.error(Error.BYTE_ARRAY_NULL); throw new NullPointerException(Error.BYTE_ARRAY_NULL); } }
Source:
public void onEventMainThread(PrefsEvents.MyProfileDataLoadSaveError event) { if (!isFinishing()) { if (event != null && event.mVolleyError != null && event.mVolleyError.networkResponse != null && event.mVolleyError.networkResponse.statusCode == 401) { ToastUtils.showToast(this, R.string.error_refresh_unauthorized_profile, ToastUtils.Duration.LONG); } else { ToastUtils.showToast(this, R.string.error_refresh_profile_not_loaded, ToastUtils.Duration.LONG); } } }

Target:
public void onEventMainThread(PrefsEvents.MyProfileDataLoadSaveError event) { if (!isFinishing()) { ToastUtils.showToast(this, R.string.error_refresh_profile_not_accessible, ToastUtils.Duration.LONG); } }
Source:
GetBlobInfoOperation(RouterConfig routerConfig, ClusterMap clusterMap, ResponseHandler responseHandler, String blobIdStr, FutureResult<BlobInfo> futureResult, Callback<BlobInfo> callback, Time time) throws RouterException { super(routerConfig, clusterMap, responseHandler, blobIdStr, futureResult, callback, time); operationTracker = new SimpleOperationTracker(routerConfig.routerDatacenterName, blobId.getPartition(), true, routerConfig.routerGetSuccessTarget, routerConfig.routerGetRequestParallelism); }

Target:
GetBlobInfoOperation(RouterConfig routerConfig, ClusterMap clusterMap, ResponseHandler responseHandler, String blobIdStr, FutureResult<BlobInfo> futureResult, Callback<BlobInfo> callback, Time time) throws RouterException { super(routerConfig, clusterMap, responseHandler, blobIdStr, futureResult, callback, time); operationTracker = new SimpleOperationTracker(routerConfig.routerDatacenterName, blobId.getPartition(), routerConfig.routerGetCrossDcEnabled, routerConfig.routerGetSuccessTarget, routerConfig.routerGetRequestParallelism); }
Source:
private TreeItem getDiskNode(ArrayList<Disk> disks) { if (disks.isEmpty()) { return null; } VerticalPanel vPanel = new VerticalPanel(); vPanel.setWidth("100%"); for (Disk disk : disks) { HorizontalPanel panel = new HorizontalPanel(); ImageResource image = resources.diskImage(); String name = disk.getDiskAlias(); addItemToPanel(panel, new Image(image), "25px"); addTextBoxToPanel(panel, new TextBoxLabel(), name, ""); addTextBoxToPanel(panel, new TextBoxLabel(), "", "80px"); addTextBoxToPanel(panel, new TextBoxLabel(), "", "160px"); Double actualSize = disk.getDiskStorageType() == DiskStorageType.IMAGE ? ((DiskImage) disk).getActualDiskWithSnapshotsSize() : (long) (((LunDisk) disk).getLun().getDeviceSize() * Math.pow(1024, 3)); Long virtualSize = disk.getDiskStorageType() == DiskStorageType.IMAGE ? ((DiskImage) disk).getsize() : (long) (((LunDisk) disk).getLun().getDeviceSize() * Math.pow(1024, 3)); addValueLabelToPanel(panel, new DiskSizeLabel<Long>(DiskSizeUnit.BYTE), virtualSize, "110px"); addValueLabelToPanel(panel, new DiskSizeLabel<Double>(DiskSizeUnit.BYTE), actualSize, "110px"); addValueLabelToPanel(panel, new FullDateTimeLabel(), disk.getDiskStorageType() == DiskStorageType.IMAGE ? ((DiskImage) disk).getcreation_date() : null, "140px"); panel.setSpacing(1); panel.setWidth("100%"); vPanel.add(panel); } TreeItem treeItem = new TreeItem(vPanel); treeItem.setUserObject(disks.get(0).getId()); return treeItem; }

Target:
private TreeItem getDiskNode(ArrayList<Disk> disks) { if (disks.isEmpty()) { return null; } VerticalPanel vPanel = new VerticalPanel(); vPanel.setWidth("100%"); for (Disk disk : disks) { HorizontalPanel panel = new HorizontalPanel(); ImageResource image = resources.diskImage(); String name = disk.getDiskAlias(); addItemToPanel(panel, new Image(image), "25px"); addTextBoxToPanel(panel, new TextBoxLabel(), name, ""); addTextBoxToPanel(panel, new TextBoxLabel(), "", "80px"); addTextBoxToPanel(panel, new TextBoxLabel(), "", "160px"); boolean isDiskImage = disk.getDiskStorageType() == DiskStorageType.IMAGE; Double actualSize = isDiskImage ? ((DiskImage) disk).getActualDiskWithSnapshotsSize() : (long) (((LunDisk) disk).getLun().getDeviceSize() * Math.pow(1024, 3)); Long virtualSize = isDiskImage ? ((DiskImage) disk).getsize() : (long) (((LunDisk) disk).getLun().getDeviceSize() * Math.pow(1024, 3)); addValueLabelToPanel(panel, new DiskSizeLabel<Long>(DiskSizeUnit.BYTE), virtualSize, "110px"); addValueLabelToPanel(panel, new DiskSizeLabel<Double>(DiskSizeUnit.BYTE), actualSize, "110px"); addValueLabelToPanel(panel, new FullDateTimeLabel(), disk.getDiskStorageType() == DiskStorageType.IMAGE ? ((DiskImage) disk).getcreation_date() : null, "140px"); panel.setSpacing(1); panel.setWidth("100%"); vPanel.add(panel); } TreeItem treeItem = new TreeItem(vPanel); treeItem.setUserObject(disks.get(0).getId()); return treeItem; }
Source:
private void execute() { synchronized (syncObj) { if (fStarted) { return; } fStarted = true; } fJob = new Job(String.format("Running analysis %s", getName())) { @Override protected IStatus run(final IProgressMonitor monitor) { monitor.beginTask("", IProgressMonitor.UNKNOWN); try { fAnalysisCancelled = !executeAnalysis(monitor); } catch (TmfAnalysisException e) { Activator.logError("Error executing analysis with trace " + getTrace().getName(), e); } finally { synchronized (syncObj) { monitor.done(); fStarted = false; fJob = null; fFinishedLatch.countDown(); } } if (!fAnalysisCancelled) { broadcast(new TmfAnalysisCompletedSignal(TmfAbstractAnalysisModule.this, TmfAbstractAnalysisModule.this)); return Status.OK_STATUS; } return Status.CANCEL_STATUS; } @Override protected void canceling() { TmfAbstractAnalysisModule.this.canceling(); fStarted = false; } }; fJob.schedule(); }

Target:
private void execute() { synchronized (syncObj) { if (fStarted) { return; } fStarted = true; } fJob = new Job(String.format(Messages.TmfAbstractAnalysisModule_RunningAnalysis, getName())) { @Override protected IStatus run(final IProgressMonitor monitor) { try { monitor.beginTask("", IProgressMonitor.UNKNOWN); broadcast(new TmfStartAnalysisSignal(TmfAbstractAnalysisModule.this, TmfAbstractAnalysisModule.this)); fAnalysisCancelled = !executeAnalysis(monitor); } catch (TmfAnalysisException e) { Activator.logError("Error executing analysis with trace " + getTrace().getName(), e); } finally { synchronized (syncObj) { monitor.done(); setAnalysisCompleted(); } } if (!fAnalysisCancelled) { return Status.OK_STATUS; } return Status.CANCEL_STATUS; } @Override protected void canceling() { TmfAbstractAnalysisModule.this.canceling(); } }; fJob.schedule(); }
Source:
private synchronized Map<String, String> getFlowMetadata(final FlowRunner flowRunner) { final ExecutableFlow flow = flowRunner.getExecutableFlow(); final Props props = ServiceProvider.SERVICE_PROVIDER.getInstance(Props.class); final Map<String, String> metaData = new HashMap<>(); metaData.put("flowName", flow.getId()); metaData.put("azkabanHost", props.getString(AZKABAN_SERVER_HOST_NAME, "unknown")); metaData.put("projectName", flow.getProjectName()); metaData.put("submitUser", flow.getSubmitUser()); metaData.put("executionId", String.valueOf(flow.getExecutionId())); metaData.put("startTime", String.valueOf(flow.getStartTime())); metaData.put("submitTime", String.valueOf(flow.getSubmitTime())); if (FlowLoaderUtils.isAzkabanFlowVersion20(flow.getAzkabanFlowVersion())) { propagateMetadataFromProps(metaData, flow.getInputProps(), "flow", flow.getId(), logger); } else { Props combinedProps = null; for (Props sharedProp : flowRunner.sharedProps.values()) { combinedProps = new Props(combinedProps, sharedProp); } combinedProps = new Props(combinedProps, flow.getInputProps()); propagateMetadataFromProps(metaData, combinedProps, "flow", flow.getId(), logger); } return metaData; }

Target:
private synchronized Map<String, String> getFlowMetadata(final FlowRunner flowRunner) { final ExecutableFlow flow = flowRunner.getExecutableFlow(); final Props props = ServiceProvider.SERVICE_PROVIDER.getInstance(Props.class); final Map<String, String> metaData = new HashMap<>(); metaData.put("flowName", flow.getId()); metaData.put("azkabanHost", props.getString(AZKABAN_SERVER_HOST_NAME, "unknown")); metaData.put("projectName", flow.getProjectName()); metaData.put("submitUser", flow.getSubmitUser()); metaData.put("executionId", String.valueOf(flow.getExecutionId())); metaData.put("startTime", String.valueOf(flow.getStartTime())); metaData.put("submitTime", String.valueOf(flow.getSubmitTime())); if (FlowLoaderUtils.isAzkabanFlowVersion20(flow.getAzkabanFlowVersion())) { propagateMetadataFromProps(metaData, flow.getInputProps(), "flow", flow.getId(), logger); } else { Props combinedProps = new Props(); for (Props sharedProp : flowRunner.sharedProps.values()) { combinedProps.putAll(sharedProp.getFlattened()); } combinedProps = new Props(combinedProps, flow.getInputProps()); propagateMetadataFromProps(metaData, combinedProps, "flow", flow.getId(), logger); } return metaData; }
Source:
public ResteasyProviderFactory(ResteasyProviderFactory parent, boolean local) { if (local) { this.parent = null; initialize(parent); } else { this.parent = parent; providerClasses = new CopyOnWriteArraySet<>(); providerInstances = new CopyOnWriteArraySet<>(); properties = new ConcurrentHashMap<>(); properties.putAll(parent.getProperties()); enabledFeatures = new CopyOnWriteArraySet<>(); reactiveClasses = new ConcurrentHashMap<>(); resourceBuilder = new ResourceBuilder(); } }

Target:
public ResteasyProviderFactory(ResteasyProviderFactory parent, boolean local) { if (local || parent == null) { this.parent = null; initialize(parent); } else { this.parent = parent; providerClasses = new CopyOnWriteArraySet<>(); providerInstances = new CopyOnWriteArraySet<>(); properties = new ConcurrentHashMap<>(); properties.putAll(parent.getProperties()); enabledFeatures = new CopyOnWriteArraySet<>(); reactiveClasses = new ConcurrentHashMap<>(); resourceBuilder = new ResourceBuilder(); } }
Source:
public static List<JTestSuite> jTestSuites() { JTestDescription description = JTestDescription.builder() .withComment("My comment") .withId("popa") .withEndpointsProvider(new ExampleEndpointsProvider()) .withQueryProvider(new ExampleQueriesProvider()) .withInvoker(new ExamplePageVisitorInvoker()) .build(); JLoad load = JLoadRps.builder() .withMaxLoadThreads(50) .withRequestPerSecond(100) .withWarmUpTimeInSeconds(24) .build(); JLoad load2 = JLoadRps.builder() .withMaxLoadThreads(500) .withRequestPerSecond(500) .withWarmUpTimeInSeconds(42) .build(); JTermination termination = JTerminationIterations.builder() .withIterationsCount(100) .withMaxDurationInSeconds(500) .build(); JTermination termination2 = JTerminationIterations.builder() .withIterationsCount(100) .withMaxDurationInSeconds(100) .build(); JTest test1 = JTest.builder() .withJTestDescription(description) .withLoad(load) .withTermination(termination) .withId("popa2") .build(); JTest test2 = JTest.builder() .withJTestDescription(description) .withLoad(load2) .withTermination(termination2) .withId("popa3") .build(); JTestGroup testGroup = JTestGroup.builder() .withId("anti popa") .withTests(Arrays.asList(test1, test2)) .build(); JTestSuite configuration = JTestSuite.builder("my_first_test") .withTestGroups(Collections.singletonList(testGroup)) .build(); return Collections.singletonList(configuration); }

Target:
public static List<JTestSuite> jTestSuites() { JTestDescription description = JTestDescription.builder() .withId("my_first_jagger_test_description") .withComment("no_comments") .withEndpointsProvider(new ExampleEndpointsProvider()) .withQueryProvider(new ExampleQueriesProvider()) .withInvoker(new ExamplePageVisitorInvoker()) .build(); JLoad load = JLoadRps.builder() .withMaxLoadThreads(50) .withRequestPerSecond(100) .withWarmUpTimeInSeconds(24) .build(); JLoad load2 = JLoadRps.builder() .withMaxLoadThreads(500) .withRequestPerSecond(500) .withWarmUpTimeInSeconds(42) .build(); JTermination termination = JTerminationIterations.builder() .withIterationsCount(100) .withMaxDurationInSeconds(500) .build(); JTermination termination2 = JTerminationIterations.builder() .withIterationsCount(100) .withMaxDurationInSeconds(100) .build(); JTest test1 = JTest.builder() .withJTestDescription(description) .withLoad(load) .withTermination(termination) .withId("my_first_test") .build(); JTest test2 = JTest.builder() .withId("yet_another_test") .withJTestDescription(description) .withLoad(load2) .withTermination(termination2) .build(); JTestGroup testGroup = JTestGroup.builder() .withId("my_first_test_group") .withTests(Arrays.asList(test1, test2)) .build(); JTestSuite jTestSuite = JTestSuite.builder() .withId("my_first_test_suite") .withTestGroups(Collections.singletonList(testGroup)) .build(); return Collections.singletonList(jTestSuite); }
Source:
public TagOperation(Repository repo, TagBuilder tag, boolean shouldMoveTag) { this.tag = tag; this.repo = repo; this.shouldMoveTag = shouldMoveTag; this.annotated = true; }

Target:
public TagOperation(Repository repo, TagBuilder tag, boolean shouldMoveTag) { this(repo, tag, shouldMoveTag, true); }
Source:
public void testExecuteQueryGetUnregisteredVm() throws OvfReaderException { setUpVm(); setUpQueryEntities(); getQuery().executeQueryCommand(); @SuppressWarnings("unchecked") VM result = getQuery().getQueryReturnValue().getReturnValue(); assertEquals(VmReturnForOvf, result, "Wrong VM entity in result"); }

Target:
public void testExecuteQueryGetUnregisteredVm() throws OvfReaderException { setUpVm(); setUpQueryEntities(); getQuery().executeQueryCommand(); @SuppressWarnings("unchecked") VM result = getQuery().getQueryReturnValue().getReturnValue(); assertEquals(VmReturnForOvf, result, "Wrong VM entity"); }
Source:
public void readFrom(ObjectInput input) throws IOException, ClassNotFoundException { timeoutMillis = input.readLong(); chunk = MarshallUtil.unmarshallArray(input, XSiteState::array); }

Target:
public void readFrom(ObjectInput input) throws IOException, ClassNotFoundException { timeoutMillis = input.readLong(); chunk = MarshallUtil.unmarshallArray(input, XSiteState[]::new); }
Source:
private Map<String, Object> mapIPv4(VmInitNetwork vmInitNetwork) { if (!vmInitNetwork.getBootProtocol().equals(Ipv4BootProtocol.NONE)) { Map<String, Object> networkIPv4 = new HashMap<>(); networkIPv4.put("id", vmInitNetwork.getName()); networkIPv4.put("link", vmInitNetwork.getName()); if (vmInitNetwork.getBootProtocol().equals(Ipv4BootProtocol.DHCP)) { networkIPv4.put("type", "dhcp4"); } else if (vmInitNetwork.getBootProtocol().equals(Ipv4BootProtocol.STATIC_IP)) { networkIPv4.put("type", "ipv4"); if (StringUtils.isNotEmpty(vmInitNetwork.getIp())) { networkIPv4.put("ip_address", vmInitNetwork.getIp()); } else { throw new IllegalArgumentException("IP address must be supplied for a static IPv4 configuration"); } if (StringUtils.isNotEmpty(vmInitNetwork.getNetmask())) { networkIPv4.put("netmask", vmInitNetwork.getNetmask()); } if (StringUtils.isNotEmpty(vmInitNetwork.getGateway())) { networkIPv4.put("gateway", vmInitNetwork.getGateway()); } } return networkIPv4; } return null; }

Target:
private Map<String, Object> mapIPv4(VmInitNetwork vmInitNetwork) { if (vmInitNetwork.getBootProtocol() == Ipv4BootProtocol.NONE) { return null; } Map<String, Object> networkIPv4 = new HashMap<>(); networkIPv4.put("id", vmInitNetwork.getName()); networkIPv4.put("link", vmInitNetwork.getName()); if (vmInitNetwork.getBootProtocol() == Ipv4BootProtocol.DHCP) { networkIPv4.put("type", "dhcp4"); } else if (vmInitNetwork.getBootProtocol() == Ipv4BootProtocol.STATIC_IP) { networkIPv4.put("type", "ipv4"); if (StringUtils.isNotEmpty(vmInitNetwork.getIp())) { networkIPv4.put("ip_address", vmInitNetwork.getIp()); } else { throw new IllegalArgumentException("IP address must be supplied for a static IPv4 configuration"); } if (StringUtils.isNotEmpty(vmInitNetwork.getNetmask())) { networkIPv4.put("netmask", vmInitNetwork.getNetmask()); } if (StringUtils.isNotEmpty(vmInitNetwork.getGateway())) { networkIPv4.put("gateway", vmInitNetwork.getGateway()); } } return networkIPv4; }
Source:
public ParametersParser(InputStream resource, String prefix) { this.properties = loadProperties(resource); this.prefix = prefix; parseProperties(); }

Target:
public ParametersParser(InputStream resource, String prefix) { this(loadProperties(resource), prefix); }
Source:
public void validateFormInputs() { if (!hasOneSelection(noSingleProjectComposite)) { setErrorMessageAndPageComplete("Please answer all yes/no questions!"); } else if (inputFieldDoesNotHaveMinimumSensibleInput(projectNameInput) && projectNameInput.getEnabled()) { setErrorMessageAndPageComplete("You must enter a project name longer than 2 chars."); } else if (!hasOneSelection(useJunit) || !hasOneSelection(otherTestingFrameworks) || !hasOneSelection(otherTestingForms)) { setErrorMessageAndPageComplete("Please answer all yes/no/don't know questions!"); } else { setErrorMessageAndPageComplete(null); } setTitle(TITLE + " (" + currentPageNumber + "/" + ((RegistrationWizard) getWizard()).getTotalPageNumber() + ")"); if (shouldSkipProjectSliderPage()) { setTitle(TITLE + " (" + currentPageNumber + "/" + (((RegistrationWizard) getWizard()).getTotalPageNumber() - 1) + ")"); } getWizard().getContainer().updateButtons(); }

Target:
public void validateFormInputs() { if (!hasOneSelection(noSingleProjectComposite)) { setErrorMessageAndPageComplete("Please answer all yes/no questions!"); } else if (inputFieldDoesNotHaveMinimumSensibleInput(projectNameInput) && projectNameInput.getEnabled()) { setErrorMessageAndPageComplete("You must enter a project name longer than 2 chars."); } else if (!hasOneSelection(useJunit) || !hasOneSelection(otherTestingFrameworks) || !hasOneSelection(otherTestingForms)) { setErrorMessageAndPageComplete("Please answer all yes/no/don't know questions!"); } else { setErrorMessageAndPageComplete(null); } setTitle(TITLE + " (" + currentPageNumber + "/" + ((RegistrationWizardBase) getWizard()).getTotalPages() + ")"); if (shouldSkipProjectSliderPage()) { setTitle(TITLE + " (" + currentPageNumber + "/" + (((RegistrationWizardBase) getWizard()).getTotalPages() - 1) + ")"); } getWizard().getContainer().updateButtons(); }
Source:
protected ReactiveOAuth2TokenIntrospectionClient getIntrospectionClient() { if (this.introspectionClient != null) { return this.introspectionClient; } if (this.introspectionUri != null || this.webClient != null) { return new NimbusReactiveOAuth2TokenIntrospectionClient(this.introspectionUri, this.webClient); } return getBean(ReactiveOAuth2TokenIntrospectionClient.class); }

Target:
protected ReactiveOAuth2TokenIntrospectionClient getIntrospectionClient() { if (this.introspectionClient != null) { return this.introspectionClient.get(); } return getBean(ReactiveOAuth2TokenIntrospectionClient.class); }
Source:
private void handleDummyTransactionTaskMessage(DummyTransactionTaskMessage message) { DummyTransactionTaskMessage msg = message; long uniqueId, newSpHandle; if (m_isLeader) { TxnEgo ego = advanceTxnEgo(); newSpHandle = ego.getTxnId(); uniqueId = m_uniqueIdGenerator.getNextUniqueId(); msg = new DummyTransactionTaskMessage(m_mailbox.getHSId(), m_mailbox.getHSId(), newSpHandle, uniqueId); msg.setSpHandle(newSpHandle); if (m_sendToHSIds.length > 0) { m_mailbox.send(m_sendToHSIds, msg); DuplicateCounter counter = new DuplicateCounter( HostMessenger.VALHALLA, msg.getTxnId(), m_replicaHSIds, msg); safeAddToDuplicateCounterMap(new DuplicateCounterKey(msg.getTxnId(), newSpHandle), counter); } } else { setMaxSeenTxnId(msg.getSpHandle()); } Iv2Trace.logDummyTransactionTaskMessage(msg, m_mailbox.getHSId()); DummyTransactionTask task = new DummyTransactionTask(m_mailbox, new SpTransactionState(msg), m_pendingTasks); m_pendingTasks.offer(task); }

Target:
private void handleDummyTransactionTaskMessage(DummyTransactionTaskMessage message) { DummyTransactionTaskMessage msg = message; if (m_isLeader) { TxnEgo ego = advanceTxnEgo(); long newSpHandle = ego.getTxnId(); updateMaxScheduledTransactionSpHandle(newSpHandle); long uniqueId = m_uniqueIdGenerator.getNextUniqueId(); msg = new DummyTransactionTaskMessage(m_mailbox.getHSId(), newSpHandle, uniqueId); if (m_sendToHSIds.length > 0) { m_mailbox.send(m_sendToHSIds, msg); DuplicateCounter counter = new DuplicateCounter( HostMessenger.VALHALLA, msg.getTxnId(), m_replicaHSIds, msg); safeAddToDuplicateCounterMap(new DuplicateCounterKey(msg.getTxnId(), newSpHandle), counter); } } else { setMaxSeenTxnId(msg.getSpHandle()); } Iv2Trace.logDummyTransactionTaskMessage(msg, m_mailbox.getHSId()); DummyTransactionTask task = new DummyTransactionTask(m_mailbox, new SpTransactionState(msg), m_pendingTasks); ListenableFuture<Object> durabilityBackpressureFuture = m_cl.log(null, msg.getSpHandle(), null, m_durabilityListener, task); if (m_cl.canOfferTask()) { assert durabilityBackpressureFuture != null; m_pendingTasks.offer(task.setDurabilityBackpressureFuture(durabilityBackpressureFuture)); } }
Source:
private List<BrickProfileDetails> prepareBrickProfileDetails(GlusterVolumeEntity volume, Object[] brickProfileDetails) { List<BrickProfileDetails> brickProfileDetailsList = new ArrayList<BrickProfileDetails>(); for (Object brickProfileObj : brickProfileDetails) { BrickProfileDetails brickProfileDetail = new BrickProfileDetails(); Map<String, Object> brickProfile = (Map<String, Object>) brickProfileObj; brickProfileDetail.setBrickId(GlusterCoreUtil.getBrickByQualifiedName(volume.getBricks(), (String) brickProfile.get(BRICK)).getId()); List<StatsInfo> statsInfo = new ArrayList<StatsInfo>(); statsInfo.add(getStatInfo((Map<String, Object>) brickProfile.get(CUMULATIVE_STATS), CUMULATIVE_STATS)); statsInfo.add(getStatInfo((Map<String, Object>) brickProfile.get(INTERVAL_STATS), INTERVAL_STATS)); brickProfileDetail.setStatsInfo(statsInfo); brickProfileDetailsList.add(brickProfileDetail); } return brickProfileDetailsList; }

Target:
private List<BrickProfileDetails> prepareBrickProfileDetails(GlusterVolumeEntity volume, Object[] brickProfileDetails) { List<BrickProfileDetails> brickProfileDetailsList = new ArrayList<BrickProfileDetails>(); for (Object brickProfileObj : brickProfileDetails) { BrickProfileDetails brickProfileDetail = new BrickProfileDetails(); Map<String, Object> brickProfile = (Map<String, Object>) brickProfileObj; Guid brickId = GlusterCoreUtil.getBrickByQualifiedName(volume.getBricks(), (String) brickProfile.get(BRICK)) .getId(); if (brickId != null) { brickProfileDetail.setBrickId(brickId); } List<StatsInfo> statsInfo = new ArrayList<StatsInfo>(); statsInfo.add(getStatInfo((Map<String, Object>) brickProfile.get(CUMULATIVE_STATS), CUMULATIVE_STATS)); statsInfo.add(getStatInfo((Map<String, Object>) brickProfile.get(INTERVAL_STATS), INTERVAL_STATS)); brickProfileDetail.setStatsInfo(statsInfo); brickProfileDetailsList.add(brickProfileDetail); } return brickProfileDetailsList; }
Source:
private String getTeamCityUrl() { String url = System.getProperty("teamcity.serverUrl"); String build_type = System.getProperty("teamcity.buildType.id"); String build_number = System.getProperty("build.number"); String result = url + "/repository/download/" + build_type + "/" + build_number + ":id/"; if (isEmpty(build_type) || isEmpty(build_number) || isEmpty(result)) { return null; } else { LOG.config("Using teamcity artifacts: " + result); return result; } }

Target:
private String getTeamCityUrl() { String url = System.getProperty("teamcity.serverUrl"); String build_type = System.getProperty("teamcity.buildType.id"); String build_number = System.getProperty("build.number"); if (isEmpty(build_type) || isEmpty(build_number) || isEmpty(url)) { return null; } return resolveUrlSource("%s/repository/download/%s/%s:id/", url, build_type, build_number); }
Source:
public void basicUsageTest() throws Exception{ EmbeddedCacheManager cacheManager = cacheManagers.iterator().next(); Cache cache = cacheManager.getCache(); AtomicObjectFactory factory = new AtomicObjectFactory(cache); SortedMap<Integer,Integer> map = factory.getInstanceOf(ShardedTreeMap.class,"test",false,null,false,3); for(int i=0; i<NCALLS; i++) { map.put(i,i); map.get(i); } factory.disposeInstanceOf(ShardedTreeMap.class,"test",true); map = factory.getInstanceOf(ShardedTreeMap.class,"test",false,null,false,3); int a = map.size(); log.debug(a); assert map.size() == NCALLS; assert map.subMap(0,NCALLS/2).size()==NCALLS/2; SortedMap<Integer,Integer> map2 = factory.getInstanceOf(ShardedTreeMap.class,"test2",false,null,false,3); Map<Integer,Integer> toAdd = new HashMap<Integer, Integer>(); for(int i=0; i<NCALLS; i++) { toAdd.put(i, i); toAdd.get(i); } map2.putAll(toAdd); assert map2.size() == NCALLS; assert map2.lastKey() == NCALLS-1; }

Target:
public void basicUsageTest() throws Exception{ EmbeddedCacheManager cacheManager = cacheManagers.iterator().next(); Cache cache = cacheManager.getCache(); AtomicObjectFactory factory = new AtomicObjectFactory(cache); SortedMap<Integer,Integer> map = factory.getInstanceOf(ShardedTreeMap.class,"test",false,null,false,3); for(int i=0; i<NCALLS; i++) { map.put(i,i); map.get(i); } factory.disposeInstanceOf(ShardedTreeMap.class,"test",true); map = factory.getInstanceOf(ShardedTreeMap.class,"test",false,null,false,3); int a = map.size(); log.debug(a); assertEquals(NCALLS,map.size()); assertEquals(NCALLS/2,map.subMap(0,NCALLS/2).size()); SortedMap<Integer,Integer> map2 = factory.getInstanceOf(ShardedTreeMap.class,"test2",false,null,false,3); Map<Integer,Integer> toAdd = new HashMap<Integer, Integer>(); for(int i=0; i<NCALLS; i++) { toAdd.put(i, i); toAdd.get(i); } map2.putAll(toAdd); assertEquals(NCALLS,map2.size()); assertEquals(map2.lastKey(),Integer.valueOf(NCALLS-1)); }
Source:
public void process(IProgressMonitor monitor) throws CoreException { if (monitor == null) monitor = new NullProgressMonitor(); SubMonitor subMonitor = SubMonitor.convert(monitor, "Searching unused members", this.units.length); for (ICompilationUnit unit : this.units) { doSearchCU(unit, subMonitor.newChild(1)); } }

Target:
public void process(IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, "Searching unused members", this.units.length); for (ICompilationUnit unit : this.units) { doSearchCU(unit, subMonitor.split(1)); } }
Source:
public void schedule(ClientContext context) throws InsertException { cb.onBlockSetFinished(this, context); storage.start(); SplitFileInserterSender s; synchronized(this) { s = sender; } if(!ctx.getCHKOnly) { s.clearWakeupTime(context); s.schedule(context); } }

Target:
public void schedule(ClientContext context) throws InsertException { cb.onBlockSetFinished(this, context); storage.start(); if(!ctx.getCHKOnly) { sender.clearWakeupTime(context); sender.schedule(context); } }
Source:
public Optional<ChargeResponse> create(ChargeCreateRequest chargeRequest, Long accountId, UriInfo uriInfo) { return gatewayAccountDao.findById(accountId).map(gatewayAccount -> { if (gatewayAccount.isLive() && !chargeRequest.getReturnUrl().startsWith("https://")) { logger.info(String.format("Gateway account %d is LIVE, but is configured to use a non-https return_url", accountId)); } SupportedLanguage language = chargeRequest.getLanguage() != null ? chargeRequest.getLanguage() : SupportedLanguage.ENGLISH; ChargeEntity chargeEntity = new ChargeEntity( chargeRequest.getAmount(), chargeRequest.getReturnUrl(), chargeRequest.getDescription(), ServicePaymentReference.of(chargeRequest.getReference()), gatewayAccount, chargeRequest.getEmail(), language, chargeRequest.isDelayedCapture(), chargeRequest.getExternalMetadata().orElse(null)); if (chargeRequest.getPrefilledCardHolderDetails().isPresent()) { PrefilledCardHolderDetails cardHolderDetails = chargeRequest.getPrefilledCardHolderDetails().get(); CardDetailsEntity cardDetailsEntity = new CardDetailsEntity(); if (cardHolderDetails.getCardHolderName().isPresent()) { cardDetailsEntity.setCardHolderName(cardHolderDetails.getCardHolderName().get()); } if (cardHolderDetails.getAddress().isPresent()) { AddressEntity addressEntity = new AddressEntity(cardHolderDetails.getAddress().get()); cardDetailsEntity.setBillingAddress(addressEntity); } chargeEntity.setCardDetails(cardDetailsEntity); } chargeDao.persist(chargeEntity); chargeEventDao.persistChargeEventOf(chargeEntity); return Optional.of(populateResponseBuilderWith(aChargeResponseBuilder(), uriInfo, chargeEntity).build()); }).orElseGet(Optional::empty); }

Target:
public Optional<ChargeResponse> create(ChargeCreateRequest chargeRequest, Long accountId, UriInfo uriInfo) { return gatewayAccountDao.findById(accountId).map(gatewayAccount -> { if (gatewayAccount.isLive() && !chargeRequest.getReturnUrl().startsWith("https://")) { logger.info(String.format("Gateway account %d is LIVE, but is configured to use a non-https return_url", accountId)); } SupportedLanguage language = chargeRequest.getLanguage() != null ? chargeRequest.getLanguage() : SupportedLanguage.ENGLISH; ChargeEntity chargeEntity = new ChargeEntity( chargeRequest.getAmount(), chargeRequest.getReturnUrl(), chargeRequest.getDescription(), ServicePaymentReference.of(chargeRequest.getReference()), gatewayAccount, chargeRequest.getEmail(), language, chargeRequest.isDelayedCapture(), chargeRequest.getExternalMetadata().orElse(null)); chargeRequest.getPrefilledCardHolderDetails() .map(this::createCardDetailsEntity) .ifPresent(chargeEntity::setCardDetails); chargeDao.persist(chargeEntity); chargeEventDao.persistChargeEventOf(chargeEntity); return populateResponseBuilderWith(aChargeResponseBuilder(), uriInfo, chargeEntity).build(); }); }
Source:
public void configure() { setName(NAME); setDescription("Performs incremental processing with MapReduce job"); addMapReduce(mapReduce); }

Target:
public void configure() { setName(NAME); setDescription("Performs incremental processing with ETL MapReduce"); addMapReduce(mapReduce); }
Source:
public void eventDispatched(final MIRunningEvent e) { if (fDisableNextRunningEvent) { super.eventDispatched(e); return; } if (fRunToLineActiveOperation == null && fStepInToSelectionActiveOperation == null) { super.eventDispatched(e); } else { if (fLatestEvent instanceof SuspendedEvent) { super.eventDispatched(e); } } }

Target:
public void eventDispatched(final MIRunningEvent e) { if (fDisableNextRunningEvent) { super.eventDispatched(e); return; } if (fRunToLineActiveOperation == null && fStepInToSelectionActiveOperation == null) { super.eventDispatched(e); } else { if (fLatestEvent instanceof ISuspendedDMEvent) { super.eventDispatched(e); } } }
Source:
public void getDosingInstructionsAsString_shouldInferCorrectly() { ChemoDosingInstructions chemoDosingInstructions = new ChemoDosingInstructions(); chemoDosingInstructions.setDosageAdjustmentPercentage(20.04); chemoDosingInstructions.setDosageDilutionInstructions("10% diluted"); chemoDosingInstructions.setDosageDeliveredTiming("once in 2 hours"); String shouldBeResult = "Dosage Adjustment Percentage : 20.04\nDosage Delivered Timing : once in 2 hours" + "\nDosage Dilution Instructions : 10% diluted\n"; String dosingInstructions = chemoDosingInstructions.getDosingInstructionsAsString(Locale.getDefault()); Assert.assertEquals(dosingInstructions, shouldBeResult); }

Target:
public void getDosingInstructionsAsString_shouldInferCorrectly() { ChemoDosingInstructions chemoDosingInstructions = new ChemoDosingInstructions(); chemoDosingInstructions.setDosageAdjustmentPercentage(ADJUSTMENT_PERCENTAGE_CONSTANT); chemoDosingInstructions.setDosageDilutionInstructions(DILUTION_INSTRUCTIONS_CONSTANT); chemoDosingInstructions.setDosageDeliveredTiming(DELIVERED_TIMING_CONSTANT); String shouldBeResult = ADJUSTMENT_PERCENTAGE + ADJUSTMENT_PERCENTAGE_CONSTANT + "\n" + DELIVERED_TIMING + DELIVERED_TIMING_CONSTANT + "\n" + DILUTION_INSTRUCTIONS + DILUTION_INSTRUCTIONS_CONSTANT + "\n"; String dosingInstructions = chemoDosingInstructions.getDosingInstructionsAsString(Locale.getDefault()); Assert.assertEquals(dosingInstructions, shouldBeResult); }
Source:
private AdminClient brokerAdminClient(KafkaProperties kafkaProperties) { Properties props = new Properties(); props.put(BOOTSTRAP_SERVERS_CONFIG, kafkaProperties.getBootstrapKafkaServer()); props.put(SECURITY_PROTOCOL_CONFIG, DEFAULT_SECURITY_PROTOCOL); props.put(REQUEST_TIMEOUT_MS_CONFIG, kafkaProperties.getKafkaServerRequestTimeoutMillis()); if (kafkaProperties.isSaslEnabled()) { props.put("sasl.mechanism", "PLAIN"); props.put("security.protocol", "SASL_PLAINTEXT"); props.put("sasl.jaas.config", kafkaProperties.getSaslJaasConfig()); } return AdminClient.create(props); }

Target:
private AdminClient brokerAdminClient(KafkaProperties kafkaProperties) { Properties props = new Properties(); props.put(BOOTSTRAP_SERVERS_CONFIG, kafkaProperties.getBootstrapKafkaServer()); props.put(SECURITY_PROTOCOL_CONFIG, DEFAULT_SECURITY_PROTOCOL); props.put(REQUEST_TIMEOUT_MS_CONFIG, kafkaProperties.getKafkaServerRequestTimeoutMillis()); if (kafkaProperties.isSaslEnabled()) { props.put(SASL_MECHANISM, kafkaProperties.getSaslMechanism()); props.put(SECURITY_PROTOCOL_CONFIG, kafkaProperties.getSaslProtocol()); props.put(SASL_JAAS_CONFIG, kafkaProperties.getSaslJaasConfig()); } return AdminClient.create(props); }
Source:
public void waitSignInDialogToClose() { info("Waiting for sign in dialog to be closed..."); (new WebDriverWait(driver, 10)).until(ExpectedConditions.invisibilityOfElementLocated(By.id(signInDialogFormSel))); info("Sign in dialog is closed"); }

Target:
public void waitSignInDialogToClose() { info("Waiting for sign in dialog to be closed..."); (new WebDriverWait(driver, SELENIUM_TIMEOUT_SEC)).until(ExpectedConditions.invisibilityOfElementLocated(By.id(signInDialogFormSel))); info("Sign in dialog is closed"); }
Source:
protected String[] getLocations() { String[] locations = StringUtils.commaDelimitedListToStringArray(getExtensionsLocations()); for (int i = 0; i < locations.length; i++) { if (!locations[i].contains(":")) { locations[i] = "classpath*:" + locations[i]; } locations[i] = locations[i] + " *.*"; } return locations; }

Target:
protected String[] getLocations() { String[] locations = StringUtils.commaDelimitedListToStringArray(getExtensionsLocations()); for (int i = 0; i < locations.length; i++) { if (!prefix.matcher(locations[i]).find()) { locations[i] = "classpath*:" + locations[i]; } if (!locations[i].endsWith("/")) { locations[i] = locations[i] + "/"; } locations[i] = locations[i] + "**/*.*"; } return locations; }
Source:
private void handleRepositoryChange( GitResourceVariantTreeSubscriber subscriber, RepositoryMapping which) { for (GitSynchronizeData gsd : gsds) { if (which.getRepository().equals(gsd.getRepository())) { try { gsd.updateRevs(); } catch (IOException e) { Activator .error(CoreText.GitSubscriberMergeContext_FailedUpdateRevs, e); return; } subscriber.reset(this.gsds); } } }

Target:
private void handleRepositoryChange( GitResourceVariantTreeSubscriber subscriber, RepositoryMapping which) { for (GitSynchronizeData gsd : gsds) { if (which.getRepository().equals(gsd.getRepository())) { try { gsd.updateRevs(); } catch (IOException e) { Activator .logError( CoreText.GitSubscriberMergeContext_FailedUpdateRevs, e); return; } subscriber.reset(this.gsds); } } }
Source:
public void destroy() { reactorClient.close(); }

Target:
public void destroy() throws Exception { reactorClient.close(); eventLoops.close(); proxy.close(); }
Source:
private List<AnnotationSpec> list(Class<?>... types) { if (types.length == 0) { return Collections.emptyList(); } List<AnnotationSpec> annotations = new ArrayList<>(); for (Class<?> type : types) { annotations.add(AnnotationSpec.builder(type).build()); } return annotations; }

Target:
private AnnotationSpec[] list(Class<?>... types) { AnnotationSpec[] annotations = new AnnotationSpec[types.length]; for (int i = 0; i < types.length; i++) { annotations[i] = AnnotationSpec.builder(types[i]).build(); } return annotations; }
Source:
public Block getRegion(int positionOffset, int length) { checkValidRegion(positionCount, positionOffset, length); return new DictionaryBlock(idsOffset + positionOffset, length, getDictionary(), ids, false, getDictionarySourceId()); }

Target:
public Block getRegion(int positionOffset, int length) { checkValidRegion(positionCount, positionOffset, length); return new DictionaryBlock(idsOffset + positionOffset, length, dictionary, ids, false, dictionarySourceId); }
Source:
@Nullable @Override protected Map<ClusterNode, VisorTxTaskResult> reduce0(List<ComputeJobResult> results) throws IgniteException { Map<ClusterNode, VisorTxTaskResult> mapRes = new TreeMap<>(); Map<UUID, ClusterNode> nodeMap = new HashMap<>(); for (ComputeJobResult result : results) { VisorTxTaskResult data = result.getData(); if (data == null || data.getInfos().isEmpty()) continue; mapRes.put(result.getNode(), data); nodeMap.put(result.getNode().id(), result.getNode()); } if (taskArg.txInfoArgument() == null) { for (VisorTxTaskResult result : mapRes.values()) { List<VisorTxInfo> infos = result.getInfos(); Iterator<VisorTxInfo> it = infos.iterator(); while (it.hasNext()) { VisorTxInfo info = it.next(); if (!info.getXid().equals(info.getNearXid())) { UUID nearNodeId = info.getMasterNodeIds().iterator().next(); ClusterNode node = nodeMap.get(nearNodeId); if (node == null) continue; VisorTxTaskResult res0 = mapRes.get(node); if (res0 == null) continue; boolean exists = false; for (VisorTxInfo txInfo : res0.getInfos()) { if (txInfo.getXid().equals(info.getNearXid())) { exists = true; break; } } if (exists) it.remove(); } } } } return mapRes; }

Target:
@Nullable @Override protected Map<ClusterNode, VisorTxTaskResult> reduce0(List<ComputeJobResult> results) throws IgniteException { Map<ClusterNode, VisorTxTaskResult> mapRes = new TreeMap<>(); Map<UUID, ClusterNode> nodeMap = new HashMap<>(); for (ComputeJobResult result : results) { VisorTxTaskResult data = result.getData(); if (data == null || data.getInfos().isEmpty()) continue; mapRes.put(result.getNode(), data); nodeMap.put(result.getNode().id(), result.getNode()); } if (!taskArg.verboseMode()) { for (VisorTxTaskResult result : mapRes.values()) { List<VisorTxInfo> infos = result.getInfos(); Iterator<VisorTxInfo> it = infos.iterator(); while (it.hasNext()) { VisorTxInfo info = it.next(); if (!info.getXid().equals(info.getNearXid())) { UUID nearNodeId = info.getMasterNodeIds().iterator().next(); ClusterNode node = nodeMap.get(nearNodeId); if (node == null) continue; VisorTxTaskResult res0 = mapRes.get(node); if (res0 == null) continue; boolean exists = false; for (VisorTxInfo txInfo : res0.getInfos()) { if (txInfo.getXid().equals(info.getNearXid())) { exists = true; break; } } if (exists) it.remove(); } } } } return mapRes; }
Source:
public ItemStack createStack() { net.minecraft.item.ItemStack itemStack = (net.minecraft.item.ItemStack) this.privateStack.copy(); itemStack.setTagCompound(this.compound); return (ItemStack) itemStack; }

Target:
public ItemStack createStack() { net.minecraft.item.ItemStack nativeStack = ItemStackUtil.cloneDefensiveNative(ItemStackUtil.toNative(this.privateStack.copy())); if(this.compound != null) { nativeStack.setTagCompound((NBTTagCompound) this.compound.copy()); } return ItemStackUtil.fromNative(nativeStack); }
Source:
public <R extends OlapResult> R execute(@Nonnull DistributedJob jobRequest) throws IOException,TimeoutException{ jobRequest.markSubmitted(); try{ Future<OlapResult> submit=networkLayerMap.get("default").submit(jobRequest); return (R)submit.get(timeoutMillis,TimeUnit.MILLISECONDS); }catch(InterruptedException e){ Thread.currentThread().interrupt(); throw new IOException(e); }catch(ExecutionException e){ throw Exceptions.rawIOException(e.getCause()); } }

Target:
public <R extends OlapResult> R execute(@Nonnull DistributedJob jobRequest) throws IOException,TimeoutException{ jobRequest.markSubmitted(); try{ Future<OlapResult> submit=networkLayerMap.get(SIConstants.OLAP_DEFAULT_QUEUE_NAME).submit(jobRequest); return (R)submit.get(timeoutMillis,TimeUnit.MILLISECONDS); }catch(InterruptedException e){ Thread.currentThread().interrupt(); throw new IOException(e); }catch(ExecutionException e){ throw Exceptions.rawIOException(e.getCause()); } }
Source:
public void test() throws IOException { TreeMap<Key,Value> sourceMap = new TreeMap<>(); Value emptyValue = new Value("".getBytes()); IteratorSetting iteratorSetting = new IteratorSetting(1, FirstEntryInRowIterator.class); FirstEntryInRowIterator.setNumScansBeforeSeek(iteratorSetting, 10); sourceMap.put(new Key("r1", "cf", "cq"), emptyValue); sourceMap.put(new Key("r2", "cf", "cq"), emptyValue); sourceMap.put(new Key("r3", "cf", "cq"), emptyValue); TreeMap<Key,Value> resultMap = new TreeMap<>(); long numSourceEntries = sourceMap.size(); long numNexts = process(sourceMap, resultMap, new Range(), iteratorSetting); assertEquals(numNexts, numSourceEntries); assertEquals(sourceMap.size(), resultMap.size()); for (int i = 0; i < 20; i++) { sourceMap.put(new Key("r2", "cf", "cq" + i), emptyValue); } resultMap.clear(); numNexts = process(sourceMap, resultMap, new Range(new Key("r1"), (new Key("r2")).followingKey(PartialKey.ROW)), iteratorSetting); assertEquals(numNexts, resultMap.size() + 10); assertEquals(resultMap.size(), 2); resultMap.clear(); numNexts = process(sourceMap, resultMap, new Range(new Key("r1"), new Key("r2", "cf2")), iteratorSetting); assertEquals(numNexts, resultMap.size() + 10); assertEquals(resultMap.size(), 2); resultMap.clear(); numNexts = process(sourceMap, resultMap, new Range(new Key("r1"), new Key("r4")), iteratorSetting); assertEquals(numNexts, resultMap.size() + 10); assertEquals(resultMap.size(), 3); }

Target:
public void test() throws IOException { TreeMap<Key,Value> sourceMap = new TreeMap<>(); Value emptyValue = new Value("".getBytes()); IteratorSetting iteratorSetting = new IteratorSetting(1, FirstEntryInRowIterator.class); FirstEntryInRowIterator.setNumScansBeforeSeek(iteratorSetting, 10); assertTrue(iteratorSetting.getOptions().containsKey(FirstEntryInRowIterator.NUM_SCANS_STRING_NAME)); sourceMap.put(new Key("r1", "cf", "cq"), emptyValue); sourceMap.put(new Key("r2", "cf", "cq"), emptyValue); sourceMap.put(new Key("r3", "cf", "cq"), emptyValue); TreeMap<Key,Value> resultMap = new TreeMap<>(); long numSourceEntries = sourceMap.size(); long numNexts = process(sourceMap, resultMap, new Range(), iteratorSetting); assertEquals(numNexts, numSourceEntries); assertEquals(sourceMap.size(), resultMap.size()); for (int i = 0; i < 20; i++) { sourceMap.put(new Key("r2", "cf", "cq" + i), emptyValue); } resultMap.clear(); numNexts = process(sourceMap, resultMap, new Range(new Key("r1"), (new Key("r2")).followingKey(PartialKey.ROW)), iteratorSetting); assertEquals(numNexts, resultMap.size() + 10); assertEquals(resultMap.size(), 2); resultMap.clear(); numNexts = process(sourceMap, resultMap, new Range(new Key("r1"), new Key("r2", "cf2")), iteratorSetting); assertEquals(numNexts, resultMap.size() + 10); assertEquals(resultMap.size(), 2); resultMap.clear(); numNexts = process(sourceMap, resultMap, new Range(new Key("r1"), new Key("r4")), iteratorSetting); assertEquals(numNexts, resultMap.size() + 10); assertEquals(resultMap.size(), 3); }
Source:
public static String getPath(String filename) { return "src/test/resources/com/puppycrawl/tools/checkstyle/gui/" + filename; }

Target:
private static String getPath(String filename) { return "src/test/resources/com/puppycrawl/tools/checkstyle/gui/" + filename; }
Source:
public AlluxioCachingHdfsFileInputStream( FileInStream inputStream, Optional<FSDataInputStream> dataTierInputStream, boolean cacheValidationEnabled) { this.inputStream = requireNonNull(inputStream); this.dataTierInputStream = requireNonNull(dataTierInputStream); verify(!cacheValidationEnabled || dataTierInputStream.isPresent(), "data tier input need to be non-null for data validation."); this.cacheValidationEnabled = cacheValidationEnabled; }

Target:
public AlluxioCachingHdfsFileInputStream( FileInStream inputStream, Optional<FSDataInputStream> dataTierInputStream, boolean cacheValidationEnabled) { this.inputStream = requireNonNull(inputStream, "InputStream is null"); this.dataTierInputStream = requireNonNull(dataTierInputStream, "DataTierInputStream is null"); verify(!cacheValidationEnabled || dataTierInputStream.isPresent(), "data tier input need to be non-null for data validation."); this.cacheValidationEnabled = cacheValidationEnabled; }
Source:
private String indent(int spaces) { String indent = ""; for (int i = 0; i < spaces; i++) { indent += " "; } return indent; }

Target:
private String indent(int spaces) { if (spaces == 0) { return ""; } else { return String.format("%" + spaces + "s", " "); } }
Source:
public PusherOptions setProxy(Proxy proxy){ this.proxy = proxy; return this; }

Target:
public PusherOptions setProxy(Proxy proxy){ if (proxy == null) { throw new IllegalArgumentException("proxy must not be null (instead use Proxy.NO_PROXY)"); } this.proxy = proxy; return this; }
Source:
public String toString() { StringBuilder s = new StringBuilder("BrowserExt: " + getId() + ", " + getName() + ", " + getOS() + ", " + getExecutable() + ", " + getParameters() + ", "); String[] locations = getDefaultLocations(); if (locations != null) { int size = locations.length; for (int i = 0; i < size; i++) { s.append(locations[i] + ";"); } } return s.toString(); }

Target:
public String toString() { StringBuilder s = new StringBuilder("BrowserExt: ").append(getId()).append(", " + getName()).append(", ") .append(getOS()).append(", ").append(getExecutable()).append(", ").append(getParameters()).append(", "); String[] locations = getDefaultLocations(); if (locations != null) { int size = locations.length; for (int i = 0; i < size; i++) { s.append(locations[i]).append(";"); } } return s.toString(); }