auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static String toTimePrecision(final TimeUnit t) { switch (t) { case HOURS: return "h"; case MINUTES: return "m"; case SECONDS: return "s"; case MILLISECONDS: return "ms"; case MICROSECONDS: return "u"; case NANOSECONDS: return "ns"; default: throw new IllegalArgumentException("time precision must be one of:" + ALLOWED_TIMEUNITS); } }

Target:
public static String toTimePrecision(final TimeUnit t) { switch (t) { case HOURS: return "h"; case MINUTES: return "m"; case SECONDS: return "s"; case MILLISECONDS: return "ms"; case MICROSECONDS: return "u"; case NANOSECONDS: return "n"; default: throw new IllegalArgumentException("time precision must be one of:" + ALLOWED_TIMEUNITS); } }
Source:
private Map<Guid, Map<Integer, NumaNodeMemoryConsumption>> vmNumaRequirements(List<VM> vmGroup, VDS host) { List<VM> filteredVms = vmGroup.stream() .filter(vm -> vm.getNumaTuneMode() != NumaTuneMode.PREFERRED) .filter(vm -> !host.getId().equals(vm.getRunOnVds())) .collect(Collectors.toList()); boolean considerCpuPinning = filteredVms.stream() .anyMatch(vm -> !StringUtils.isEmpty(vm.getCpuPinning())); Optional<Map<Guid, Integer>> nodeAssignment = Optional.empty(); if (considerCpuPinning) { nodeAssignment = NumaPinningHelper.findAssignment(filteredVms, host.getNumaNodeList(), true); } if (!nodeAssignment.isPresent()) { nodeAssignment = NumaPinningHelper.findAssignment(filteredVms, host.getNumaNodeList(), false); } if (!nodeAssignment.isPresent()) { return Collections.emptyMap(); } Map<Guid, Map<Integer, NumaNodeMemoryConsumption>> result = new HashMap<>(); for (VM vm : filteredVms) { if (vm.getvNumaNodeList().isEmpty()) { continue; } Map<Integer, NumaNodeMemoryConsumption> hostNumaMemRequirements = new HashMap<>(); for (VmNumaNode vmNode : vm.getvNumaNodeList()) { Integer hostNodeIndex = nodeAssignment.get().get(vmNode.getId()); if (hostNodeIndex == null) { continue; } Optional<Integer> hugePageSize = HugePageUtils.getHugePageSize(vm.getStaticData()); hostNumaMemRequirements.merge( hostNodeIndex, new NumaNodeMemoryConsumption(vmNode.getMemTotal(), hugePageSize), NumaNodeMemoryConsumption::merge); } result.put(vm.getId(), hostNumaMemRequirements); } return result; }

Target:
private Map<Guid, Map<Integer, NumaNodeMemoryConsumption>> vmNumaRequirements(List<VM> vmGroup, VDS host) { List<VM> filteredVms = vmGroup.stream() .filter(vm -> vm.getNumaTuneMode() != NumaTuneMode.PREFERRED) .filter(vm -> !host.getId().equals(vm.getRunOnVds())) .collect(Collectors.toList()); boolean considerCpuPinning = filteredVms.stream() .anyMatch(vm -> !StringUtils.isEmpty(vm.getCpuPinning())); Optional<Map<Guid, Integer>> nodeAssignment = Optional.empty(); if (considerCpuPinning) { nodeAssignment = NumaPinningHelper.findAssignment(filteredVms, host.getNumaNodeList(), true); } if (!nodeAssignment.isPresent()) { nodeAssignment = NumaPinningHelper.findAssignment(filteredVms, host.getNumaNodeList(), false); } if (!nodeAssignment.isPresent()) { return Collections.emptyMap(); } Map<Guid, Map<Integer, NumaNodeMemoryConsumption>> result = new HashMap<>(); for (VM vm : filteredVms) { if (vm.getvNumaNodeList().isEmpty()) { continue; } Map<Integer, NumaNodeMemoryConsumption> hostNumaMemRequirements = new HashMap<>(); Optional<Integer> hugePageSize = HugePageUtils.getHugePageSize(vm.getStaticData()); for (VmNumaNode vmNode : vm.getvNumaNodeList()) { Integer hostNodeIndex = nodeAssignment.get().get(vmNode.getId()); if (hostNodeIndex == null) { continue; } hostNumaMemRequirements.merge( hostNodeIndex, new NumaNodeMemoryConsumption(vmNode.getMemTotal(), hugePageSize), NumaNodeMemoryConsumption::merge); } result.put(vm.getId(), hostNumaMemRequirements); } return result; }
Source:
public Patient savePatient(Patient patient) { LOG.info("save-patient"); if (CollectionUtils.isNotEmpty(patient.getPersonnames())) { LOG.debug("Personname-set-patient"); Personname personnameRecord = patient.getPersonnames().get(0); personnameRecord.setPatient(patient); if (HelperUtil.isId(patient.getPatientId())) { LOG.debug("update-patient-byID"); patientDAO.update(patient); } else { LOG.debug("create-patient-new-record"); patientDAO.create(patient); } LOG.debug("Personname-Patient-patientId: " + personnameRecord.getPatient().getPatientId()); if (HelperUtil.isId(personnameRecord.getPersonnameId())) { LOG.debug("update-personname-byID"); personnameDAO.update(personnameRecord); } else { LOG.debug("create-personname-new-record"); personnameDAO.create(personnameRecord); } } else { LOG.info("save-patient: fail personname does not exist"); } return patient; }

Target:
public boolean savePatient(Patient patient) throws LoadTestDataException { boolean actionResult; LOG.info("Service-save-patient"); if (CollectionUtils.isNotEmpty(patient.getPersonnames())) { if (HelperUtil.isId(patient.getPatientId())) { LOG.debug("update-patient-byID"); actionResult = patientDAO.update(patient); } else { LOG.debug("create-patient-new-record"); actionResult = patientDAO.create(patient); } for (Personname personnameRecord : patient.getPersonnames()) { LOG.debug("Personname-Patient-patientId: ", personnameRecord.getPatient().getPatientId()); personnameRecord.setPatient(patient); if (HelperUtil.isId(personnameRecord.getPersonnameId())) { LOG.debug("update-personname-byID"); actionResult = personnameDAO.update(personnameRecord); } else { LOG.debug("create-personname-new-record"); actionResult = personnameDAO.create(personnameRecord); } } } else { throw new LoadTestDataException("Patient-Personname is required when trying to save-patient"); } LOG.info("save-patient: Action-result: ", actionResult); return actionResult; }
Source:
public Builder append(String key, String value) { if (isValid(key) && isValid(value)) { if (sb.length() > 0) { sb.append(separator); } sb.append(key + ":" + value); } return this; }

Target:
public Builder append(String key, String value) { if (isValid(key) && isValid(value)) { if (sb.length() > 0) { sb.append(fieldSeparator); } sb.append(key).append(KEY_VALUE_SEPARATOR).append(value); } return this; }
Source:
public static Text getSleepAlarmMessage(final String wakeTime, final int sleepDurationMinutes, final String preSleepTime, final String sleepTime) { final float sleepDurationHr = (float) sleepDurationMinutes/60; final String messageBody; if (sleepDurationHr % 1 == 0) { messageBody = String.format("You typically wake up at around %s. If you want to get %.0f hours of sleep, you should start preparing for bed at %s, and plan to sleep by %s.", wakeTime, sleepDurationHr, preSleepTime, sleepTime); } else { messageBody = String.format("You typically wake up at around %s. If you want to get %.1f hours of sleep, you should start preparing for bed at %s, and plan to sleep by %s.", wakeTime, sleepDurationHr, preSleepTime, sleepTime); } return new Text("Bed Time", messageBody); }

Target:
public static Text getSleepAlarmMessage(final String wakeTime, final int sleepDurationMinutes, final String preSleepTime, final String sleepTime) { final float sleepDurationHr = (float) sleepDurationMinutes/60; final String sleepDurationHrString; final String[] mySplit = String.format("%.1f", sleepDurationHr).split("\\."); if (mySplit.length > 1 && mySplit[1].equals("0")) { sleepDurationHrString = mySplit[0]; } else { sleepDurationHrString = String.format("%.1f", sleepDurationHr); } final String messageBody = String.format("You typically wake up at around %s. If you want to get %s hours of sleep, you should start preparing for bed at %s, and plan to sleep by %s.", wakeTime, sleepDurationHrString, preSleepTime, sleepTime); return new Text("Bed Time", messageBody); }
Source:
public void deleteGroupForbiddenTest() throws Exception { GroupService groupService = EPersonServiceFactory.getInstance().getGroupService(); Group parentGroup = null; try { context.turnOffAuthorisationSystem(); parentGroup = groupService.create(context); context.commit(); parentGroup = context.reloadEntity(parentGroup); String adminToken = getAuthToken(admin.getEmail(), password); String authToken = getAuthToken(eperson.getEmail(), password); getClient(adminToken).perform( get("/api/eperson/groups/" + parentGroup.getID()) ).andExpect(status().isOk()); getClient(authToken).perform( delete("/api/eperson/groups/" + parentGroup.getID()) ).andExpect(status().isForbidden()); getClient(adminToken).perform( get("/api/eperson/groups/" + parentGroup.getID()) ).andExpect(status().isOk()); } finally { if (parentGroup != null) { GroupBuilder.deleteGroup(parentGroup.getID()); } } }

Target:
public void deleteGroupForbiddenTest() throws Exception { context.turnOffAuthorisationSystem(); Group parentGroup = GroupBuilder.createGroup(context) .withName("test group") .build(); context.restoreAuthSystemState(); String adminToken = getAuthToken(admin.getEmail(), password); String authToken = getAuthToken(eperson.getEmail(), password); getClient(adminToken).perform( get("/api/eperson/groups/" + parentGroup.getID()) ).andExpect(status().isOk()); getClient(authToken).perform( delete("/api/eperson/groups/" + parentGroup.getID()) ).andExpect(status().isForbidden()); getClient(adminToken).perform( get("/api/eperson/groups/" + parentGroup.getID()) ).andExpect(status().isOk()); }
Source:
public LogReplicationEntry resend() { LogReplicationEntry ack = null; boolean force = false; try { ack = processAcks(); } catch (TimeoutException e) { log.warn("Caught a timeout exception ", e); force = true; } catch (Exception e) { log.trace("Caught an Exception and will notify discovery service ", e); } for (int i = 0; i < pendingMessages.getSize(); i++) { LogReplicationPendingEntry entry = pendingMessages.getList().get(i); if (entry.timeout(msgTimer) || force) { if (errorOnMsgTimeout && entry.retry >= maxRetry) { log.warn("Entry of type has been resent max times for timer {}.", entry.getData().getMetadata().getTimestamp(), entry.getData().getMetadata().getMessageMetadataType(), maxRetry, msgTimer); throw new LogEntrySyncTimeoutException("timeout"); } entry.retry(); CompletableFuture<LogReplicationEntry> cf = dataSender.send(entry.getData()); addCFToAcked(entry.getData(), cf); log.info("resend message " + entry.getData().getMetadata().getTimestamp()); } } return ack; }

Target:
public LogReplicationEntry resend() { LogReplicationEntry ack = null; boolean force = false; try { ack = processAcks(); } catch (TimeoutException e) { log.warn("Caught a timeout exception ", e); force = true; } catch (Exception e) { log.warn("Caught an Exception while processing ACKs.", e); return null; } for (int i = 0; i < pendingMessages.getSize(); i++) { LogReplicationPendingEntry entry = pendingMessages.getList().get(i); if (entry.timeout(msgTimer) || force) { if (errorOnMsgTimeout && entry.retry >= maxRetry) { log.warn("Entry of type has been resent max times for timer {}.", entry.getData().getMetadata().getTimestamp(), entry.getData().getMetadata().getMessageMetadataType(), maxRetry, msgTimer); throw new LogEntrySyncTimeoutException("timeout"); } entry.retry(); CompletableFuture<LogReplicationEntry> cf = dataSender.send(entry.getData()); addCFToAcked(entry.getData(), cf); log.info("resend message " + entry.getData().getMetadata().getTimestamp()); } } return ack; }
Source:
private Session getSession( Context context, SurfaceView mSurfaceView, int orientation ) { Session mSession = SessionBuilder.getInstance().setContext( context ).setAudioEncoder( SessionBuilder.AUDIO_AAC ) .setAudioQuality( new AudioQuality( 8000, 16000 ) ).setVideoEncoder( SessionBuilder.VIDEO_H264 ).setSurfaceView( mSurfaceView ) .setPreviewOrientation( orientation ).setCallback( (Session.Callback) context ).build(); return mSession; }

Target:
private Session getSession( Context context, SurfaceView mSurfaceView, int orientation ) { Session mSession = SessionBuilder.getInstance().setContext( context ).setAudioEncoder( SessionBuilder.AUDIO_AAC ) .setVideoEncoder( SessionBuilder.VIDEO_H264 ).setSurfaceView( mSurfaceView ) .setPreviewOrientation( orientation ).setCallback( (Session.Callback) context ).build(); return mSession; }
Source:
public Group removeAccount(Account account) { Assert.notNull(account, "account cannot be null"); GroupMembership groupMembership = null; for (GroupMembership accountGroupMembership : getAccountMemberships()) { if (accountGroupMembership.getAccount().getHref().equalsIgnoreCase(account.getHref())) { groupMembership = accountGroupMembership; break; } } if (groupMembership != null){ groupMembership.delete(); } else { throw new IllegalStateException("The specified account does not belong to this Group."); } return this; }

Target:
public Group removeAccount(Account account) { Assert.notNull(account, "account cannot be null"); GroupMembership groupMembership = null; for (GroupMembership accountGroupMembership : getAccountMemberships()) { if (accountGroupMembership.getAccount().getHref().equals(account.getHref())) { groupMembership = accountGroupMembership; break; } } if (groupMembership != null){ groupMembership.delete(); } else { throw new IllegalStateException("The specified account does not belong to this Group."); } return this; }
Source:
public void checkPagingOneByOneThroughReferences() throws AvroRemoteException { final List<ReferenceSet> allRefSets = Utils.getAllReferenceSets(client); assertThat(allRefSets).isNotEmpty(); final String refSetId = allRefSets.get(0).getId(); final List<Reference> listOfReferences = Utils.getAllReferences(client, refSetId); assertThat(listOfReferences).isNotEmpty(); final Set<Reference> setOfReferences = new HashSet<>(listOfReferences); assertThat(listOfReferences).hasSize(setOfReferences.size()); String pageToken = null; for (Reference ignored : listOfReferences) { final SearchReferencesRequest pageReq = SearchReferencesRequest.newBuilder() .setReferenceSetId(refSetId) .setPageSize(1) .setPageToken(pageToken) .build(); final SearchReferencesResponse pageResp = client.references.searchReferences(pageReq); final List<Reference> pageOfReferences = pageResp.getReferences(); pageToken = pageResp.getNextPageToken(); assertThat(pageOfReferences).hasSize(1); assertThat(setOfReferences).contains(pageOfReferences.get(0)); setOfReferences.remove(pageOfReferences.get(0)); } assertThat(pageToken).isNull(); assertThat(setOfReferences).isEmpty(); }

Target:
public void checkPagingOneByOneThroughReferences() throws AvroRemoteException { final List<ReferenceSet> allRefSets = Utils.getAllReferenceSets(client); assertThat(allRefSets).isNotEmpty(); final String refSetId = allRefSets.get(0).getId(); final List<Reference> listOfReferences = Utils.getAllReferences(client, refSetId); assertThat(listOfReferences).isNotEmpty(); final Set<Reference> setOfExpectedReferences = new HashSet<>(listOfReferences); assertThat(listOfReferences).hasSize(setOfExpectedReferences.size()); final Set<Reference> setOfReferencesGathered1By1 = new HashSet<>(setOfExpectedReferences.size()); String pageToken = null; do { final SearchReferencesRequest pageReq = SearchReferencesRequest.newBuilder() .setReferenceSetId(refSetId) .setPageSize(1) .setPageToken(pageToken) .build(); final SearchReferencesResponse pageResp = client.references.searchReferences(pageReq); final List<Reference> pageOfReferences = pageResp.getReferences(); pageToken = pageResp.getNextPageToken(); assertThat(pageOfReferences).hasSize(1); setOfReferencesGathered1By1.add(pageOfReferences.get(0)); } while (pageToken != null); assertThat(setOfReferencesGathered1By1).containsAll(setOfExpectedReferences); }
Source:
public void bulk_apply_template_by_template_uuid() throws Exception { OrganizationDto otherOrganization = db.organizations().insert(); db.components().insertPrivateProject(otherOrganization); ComponentDto privateProject = db.components().insertPrivateProject(organization); ComponentDto publicProject = db.components().insertPublicProject(organization); ComponentDto view = db.components().insertView(organization); loginAsAdmin(organization); newRequest() .setParam(PARAM_TEMPLATE_ID, template1.getUuid()) .setParam(PARAM_QUALIFIERS, String.join(",", Qualifiers.PROJECT, Qualifiers.VIEW)) .execute(); assertTemplate1AppliedToPrivateProject(privateProject); assertTemplate1AppliedToPublicProject(publicProject); assertTemplate1AppliedToPublicProject(view); }

Target:
public void bulk_apply_template_by_template_uuid() throws Exception { OrganizationDto otherOrganization = db.organizations().insert(); db.components().insertPrivateProject(otherOrganization); ComponentDto privateProject = db.components().insertPrivateProject(organization); ComponentDto publicProject = db.components().insertPublicProject(organization); loginAsAdmin(organization); newRequest() .setParam(PARAM_TEMPLATE_ID, template1.getUuid()) .execute(); assertTemplate1AppliedToPrivateProject(privateProject); assertTemplate1AppliedToPublicProject(publicProject); }
Source:
protected void onCreate(@Nullable Bundle savedInstanceState) { FragmentFactory fragmentFactory = ViewModelProviders.of(this) .get(FragmentFactoryHolderViewModel.class) .getFragmentFactory(); if (fragmentFactory != null) { getSupportFragmentManager().setFragmentFactory(fragmentFactory); } super.onCreate(savedInstanceState); }

Target:
protected void onCreate(@Nullable Bundle savedInstanceState) { ViewModelProvider viewModelProvider = new ViewModelProvider( this, ViewModelProvider.AndroidViewModelFactory.getInstance(getApplication())); FragmentFactory factory = viewModelProvider .get(FragmentFactoryHolderViewModel.class) .getFragmentFactory(); if (factory != null) { getSupportFragmentManager().setFragmentFactory(factory); } super.onCreate(savedInstanceState); }
Source:
private void loadDBProperties() { CoreWorkspace ws = (CoreWorkspace) Services.getService(CoreWorkspace.class); try { File propertiesFile = new File(ws.getWorkspaceFolder() + File.separator + dbPropertiesFile); if (propertiesFile.exists()) { dbProperties.load(new FileInputStream(propertiesFile)); } } catch (IOException e) { LOGGER.error(e); } }

Target:
private void loadDBProperties() { CoreWorkspace ws = Services.getService(CoreWorkspace.class); try { File propertiesFile = new File(ws.getWorkspaceFolder() + File.separator + dbPropertiesFile); if (propertiesFile.exists()) { dbProperties.load(new FileInputStream(propertiesFile)); } } catch (IOException e) { LOGGER.error(e); } }
Source:
protected boolean deleteTaskNonRecursive(Task<?> task) { Set<?> tags = checkNotNull(task, "task").getTags(); for (Object tag : tags) { synchronized (tasksByTag) { Set<Task<?>> tasks = tasksWithTagLiveOrNull(tag); if (tasks != null) { tasks.remove(task); if (tasks.isEmpty()) { tasksByTag.remove(tag); } } } } Task<?> removed = tasksById.remove(task.getId()); incompleteTaskIds.remove(task.getId()); if (removed!=null && removed.isSubmitted() && !removed.isDone()) { log.warn("Deleting submitted but incomplete task (cancel it first): "+removed); } return removed != null; }

Target:
protected boolean deleteTaskNonRecursive(Task<?> task) { Set<?> tags = checkNotNull(task, "task").getTags(); for (Object tag : tags) { synchronized (tasksByTag) { Set<Task<?>> tasks = tasksWithTagLiveOrNull(tag); if (tasks != null) { tasks.remove(task); if (tasks.isEmpty()) { tasksByTag.remove(tag); } } } } Task<?> removed = tasksById.remove(task.getId()); incompleteTaskIds.remove(task.getId()); if (removed!=null && removed.isSubmitted() && !removed.isDone()) { log.warn("Deleting submitted task before completion: "+removed+"; this task will continue to run in the background outwith "+this+", but perhaps it should have been cancelled?"); } return removed != null; }
Source:
public List<AggregatorFactory> getRequiredColumns() { return Collections.singletonList(new DoubleAnyAggregatorFactory(fieldName, fieldName)); }

Target:
public List<AggregatorFactory> getRequiredColumns() { return Collections.singletonList(new DoubleAnyAggregatorFactory(fieldName, fieldName, expression, macroTable)); }
Source:
protected BaseLoadBalancerResponseHandler(DateCodecFactory dateCodec, ServerListResponseHandler balancedServerResponseHandler, FirewallListResponseHandler firewallResponseHandler) { this.dateCodec = dateCodec.iso8601(); this.builder = LoadBalancer.builder(); this.balancedServerResponseHandler = balancedServerResponseHandler; this.firewallListResponseHandler = firewallResponseHandler; }

Target:
protected BaseLoadBalancerResponseHandler(DateCodecFactory dateCodec, ServerListResponseHandler balancedServerResponseHandler, FirewallListResponseHandler firewallResponseHandler) { if (dateCodec == null) throw new NullPointerException("DateCodecFactory cannot be null"); if (balancedServerResponseHandler == null) throw new NullPointerException("BalancedServerResponseHandler cannot be null"); if (firewallResponseHandler == null) throw new NullPointerException("FirewallListResponseHandler cannot be null"); this.dateCodec = dateCodec.iso8601(); this.builder = LoadBalancer.builder(); this.balancedServerResponseHandler = balancedServerResponseHandler; this.firewallListResponseHandler = firewallResponseHandler; }
Source:
public void setUp() throws Exception { boolean ascii; if (protocol.equals("ascii")) { ascii = true; servers = asciiServers; } else if (protocol.equals("binary")) { ascii = false; servers = binaryServers; } else { throw new IllegalArgumentException(protocol); } MemcacheClientBuilder<String> builder = MemcacheClientBuilder.newStringClient() .withAddresses(servers.getAddresses()) .withConnections(1) .withMaxOutstandingRequests(100) .withMetrics(NoopMetrics.INSTANCE) .withRetry(false) .withReplyExecutor(Utils.SAME_THREAD_EXECUTOR) .withRequestTimeoutMillis(10*1000); if (ascii) { client = builder.connectAscii(); } else { client = builder.connectBinary(); } allClientsConnected(client); ConnectFuture.connectFuture(client).get(); System.out.println("Using client: " + client + ", protocol: " + protocol); servers.flush(); }

Target:
public void setUp() throws Exception { boolean ascii; if (protocol.equals("ascii")) { ascii = true; servers = asciiServers; } else if (protocol.equals("binary")) { ascii = false; servers = binaryServers; } else { throw new IllegalArgumentException(protocol); } MemcacheClientBuilder<String> builder = MemcacheClientBuilder.newStringClient() .withAddresses(servers.getAddresses()) .withConnections(1) .withMaxOutstandingRequests(100) .withMetrics(NoopMetrics.INSTANCE) .withRetry(false) .withReplyExecutor(Utils.SAME_THREAD_EXECUTOR) .withRequestTimeoutMillis(10*1000); if (ascii) { client = builder.connectAscii(); } else { client = builder.connectBinary(); } allClientsConnected(client); System.out.println("Using client: " + client + ", protocol: " + protocol); servers.flush(); }
Source:
public void setMainTabSelectedItem(VDS selectedItem) { driver.edit(getDetailModel()); habInventory.clear(); if (selectedItem != null && getDetailModel().getHbaDevices() != null) { for (EnumMap<HostHardwareGeneralModel.HbaDeviceKeys, String> hbaDevice : getDetailModel().getHbaDevices()) { GeneralFormPanel hbaFormPanel = new GeneralFormPanel() { { getElement().getStyle().setFloat(Float.LEFT); getElement().getStyle().setBorderWidth(1, Unit.PX); getElement().getStyle().setBorderStyle(BorderStyle.SOLID); getElement().getStyle().setBorderColor("black"); getElement().getStyle().setProperty("width", "auto"); } }; TextBoxLabel interfaceName = new TextBoxLabel( hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.MODEL_NAME)); TextBoxLabel interfaceType = new TextBoxLabel( hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.TYPE)); TextBoxLabel interfaceWWNN = new TextBoxLabel( hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.WWNN)); TextBoxLabel portWWPNs = new TextBoxLabel( hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.WWNPS)); FormBuilder hbaFormBuilder = new FormBuilder(hbaFormPanel, 1, 4); hbaFormBuilder.addFormItem(new FormItem(constants.hbaModelName(), interfaceName, 0, 0)); hbaFormBuilder.addFormItem(new FormItem(constants.hbaDeviceType(), interfaceType, 1, 0)); hbaFormBuilder.addFormItem(new FormItem(constants.hbaWWNN(), interfaceWWNN, 2, 0)); hbaFormBuilder.addFormItem(new FormItem(constants.hbaWWPNs(), portWWPNs, 3, 0)); habInventory.add(hbaFormPanel); } } formBuilder.update(getDetailModel()); }

Target:
public void setMainTabSelectedItem(VDS selectedItem) { driver.edit(getDetailModel()); refreshHBADeviceInfo(selectedItem); formBuilder.update(getDetailModel()); }
Source:
public void retrieveFreeEntitlementsOfPools() { Pool pool1 = TestUtil.createPool(owner, product); poolCurator.create(pool1); Entitlement ent11 = new Entitlement(pool1, consumer, 1); entitlementCurator.create(ent11); Entitlement ent12 = new Entitlement(pool1, consumer, 1); entitlementCurator.create(ent12); Entitlement ent13 = new Entitlement(pool1, consumer, 1); entitlementCurator.create(ent13); Pool pool2 = TestUtil.createPool(owner, product); poolCurator.create(pool2); Entitlement ent21 = new Entitlement(pool2, consumer, 1); entitlementCurator.create(ent21); Pool pool3 = TestUtil.createPool(owner, product); poolCurator.create(pool3); Entitlement ent31 = new Entitlement(pool3, consumer, 1); entitlementCurator.create(ent31); List<Entitlement> ents = poolCurator.retrieveFreeEntitlementsOfPools(Arrays.asList(pool1, pool2), true); assertEquals(4, ents.size()); assertTrue(ents.contains(ent11)); assertTrue(ents.contains(ent12)); assertTrue(ents.contains(ent13)); assertTrue(ents.contains(ent21)); assertTrue(!ents.contains(ent31)); }

Target:
public void retrieveFreeEntitlementsOfPools() { Pool pool1 = TestUtil.createPool(owner, product); poolCurator.create(pool1); Entitlement ent11 = new Entitlement(pool1, consumer, 1); entitlementCurator.create(ent11); Entitlement ent12 = new Entitlement(pool1, consumer, 1); entitlementCurator.create(ent12); Entitlement ent13 = new Entitlement(pool1, consumer, 1); entitlementCurator.create(ent13); Pool pool2 = TestUtil.createPool(owner, product); poolCurator.create(pool2); Entitlement ent21 = new Entitlement(pool2, consumer, 1); entitlementCurator.create(ent21); Pool pool3 = TestUtil.createPool(owner, product); poolCurator.create(pool3); Entitlement ent31 = new Entitlement(pool3, consumer, 1); entitlementCurator.create(ent31); List<Entitlement> ents = poolCurator.retrieveFreeEntitlementsOfPools(Arrays.asList(pool1, pool2), true); assertEquals(4, ents.size()); assertThat(ents, hasItems(ent11, ent12, ent13, ent21)); assertThat(ents, not(hasItems(ent31))); }
Source:
private void _endJam(boolean force) { ClockModel pc = getClockModel(Clock.ID_PERIOD); ClockModel jc = getClockModel(Clock.ID_JAM); if (!jc.isRunning() && !force) { return; } requestBatchStart(); jc.stop(); getTeamModel("1").stopJam(); getTeamModel("2").stopJam(); setInOvertime(false); if (pc.getTimeRemaining() < 30000) { restartPcAfterTimeout = true; } if (pc.isRunning()) { _startLineup(); } else { _possiblyEndPeriod(); } requestBatchEnd(); }

Target:
private void _endJam(boolean force) { ClockModel pc = getClockModel(Clock.ID_PERIOD); ClockModel jc = getClockModel(Clock.ID_JAM); if (!jc.isRunning() && !force) { return; } requestBatchStart(); jc.stop(); getTeamModel(Team.ID_1).stopJam(); getTeamModel(Team.ID_2).stopJam(); setInOvertime(false); if (pc.getTimeRemaining() < 30000) { restartPcAfterTimeout = true; } if (pc.isRunning()) { _startLineup(); } else { _possiblyEndPeriod(); } requestBatchEnd(); }
Source:
public static CryptoRecord fromJSONRecord(ExtendedJSONObject jsonRecord) throws IOException, ParseException, NonObjectJSONException { String id = (String) jsonRecord.get(KEY_ID); String collection = (String) jsonRecord.get(KEY_COLLECTION); String jsonEncodedPayload = (String) jsonRecord.get(KEY_PAYLOAD); ExtendedJSONObject payload = ExtendedJSONObject.parseJSONObject(jsonEncodedPayload); CryptoRecord record = new CryptoRecord(payload); record.guid = id; record.collection = collection; if (jsonRecord.containsKey(KEY_MODIFIED)) { Long timestamp = jsonRecord.getTimestamp(KEY_MODIFIED); if (timestamp == null) { throw new IOException("timestamp could not be parsed"); } record.lastModified = timestamp.longValue(); } if (jsonRecord.containsKey(KEY_SORTINDEX)) { try { record.sortIndex = jsonRecord.getLong(KEY_SORTINDEX); } catch (Exception e) { throw new IOException("timestamp could not be parsed"); } } if (jsonRecord.containsKey(KEY_TTL)) { try { record.ttl = jsonRecord.getLong(KEY_TTL); } catch (Exception e) { throw new IOException("TTL could not be parsed"); } } return record; }

Target:
public static CryptoRecord fromJSONRecord(ExtendedJSONObject jsonRecord) throws IOException, ParseException, NonObjectJSONException, RecordParseException { String id = (String) jsonRecord.get(KEY_ID); String collection = (String) jsonRecord.get(KEY_COLLECTION); String jsonEncodedPayload = (String) jsonRecord.get(KEY_PAYLOAD); ExtendedJSONObject payload = ExtendedJSONObject.parseJSONObject(jsonEncodedPayload); CryptoRecord record = new CryptoRecord(payload); record.guid = id; record.collection = collection; if (jsonRecord.containsKey(KEY_MODIFIED)) { Long timestamp = jsonRecord.getTimestamp(KEY_MODIFIED); if (timestamp == null) { throw new RecordParseException("timestamp could not be parsed"); } record.lastModified = timestamp.longValue(); } if (jsonRecord.containsKey(KEY_SORTINDEX)) { try { record.sortIndex = jsonRecord.getLong(KEY_SORTINDEX); } catch (Exception e) { throw new RecordParseException("timestamp could not be parsed"); } } if (jsonRecord.containsKey(KEY_TTL)) { try { record.ttl = jsonRecord.getLong(KEY_TTL); } catch (Exception e) { throw new RecordParseException("TTL could not be parsed"); } } return record; }
Source:
public void setUp() throws Exception { workspaceName = testWorkspace.getName(); createMap(); URL resource = WorkspaceDetailsSingleMachineTest.this.getClass().getResource("/projects/guess-project"); testProjectServiceClient.importProject( testWorkspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, MAVEN_SPRING); dashboard.open(); dashboard.selectWorkspacesItemOnDashboard(); dashboard.waitToolbarTitleName("Workspaces"); workspaces.selectWorkspaceItemName(workspaceName); workspaces.waitToolbarTitleName(workspaceName); workspaceDetails.selectTabInWorkspaceMenu(OVERVIEW); workspaceDetails.checkStateOfWorkspace(RUNNING); workspaceDetails.clickOnStopWorkspace(); workspaceDetails.checkStateOfWorkspace(STOPPED); }

Target:
public void setUp() throws Exception { workspaceName = testWorkspace.getName(); URL resource = WorkspaceDetailsSingleMachineTest.this.getClass().getResource("/projects/guess-project"); testProjectServiceClient.importProject( testWorkspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, MAVEN_SPRING); dashboard.open(); dashboard.selectWorkspacesItemOnDashboard(); dashboard.waitToolbarTitleName("Workspaces"); workspaces.selectWorkspaceItemName(workspaceName); workspaces.waitToolbarTitleName(workspaceName); workspaceDetails.selectTabInWorkspaceMenu(OVERVIEW); workspaceDetails.checkStateOfWorkspace(RUNNING); workspaceDetails.clickOnStopWorkspace(); workspaceDetails.checkStateOfWorkspace(STOPPED); }
Source:
private static ColumnRangeSelection allPossibleColumns() { byte[] startCol = SweepableCellsTable.SweepableCellsColumn.of(0L, -TargetedSweepMetadata.MAX_DEDICATED_ROWS) .persistToBytes(); byte[] endCol = SweepableCellsTable.SweepableCellsColumn.of(SweepQueueUtils.TS_FINE_GRANULARITY + 1, 0) .persistToBytes(); return new ColumnRangeSelection(startCol, endCol); }

Target:
private static ColumnRangeSelection allPossibleColumns() { byte[] startCol = SweepableCellsTable.SweepableCellsColumn.of(0L, -TargetedSweepMetadata.MAX_DEDICATED_ROWS) .persistToBytes(); byte[] endCol = SweepableCellsTable.SweepableCellsColumn.of(SweepQueueUtils.TS_FINE_GRANULARITY, 0) .persistToBytes(); return new ColumnRangeSelection(startCol, endCol); }
Source:
public void close() { this.adminClient.close(Duration.ZERO); }

Target:
public void close() { this.adminClient.close(); }
Source:
public static String execWithFile(String filename) { try (BufferedReader br = new BufferedReader(new FileReader(filename))) { StringBuffer buffer = new StringBuffer(); String line; while ((line = br.readLine()) != null) { buffer.append(line.concat("\n")); } return exec(buffer.toString()); } catch (IOException e) { e.printStackTrace(); return ""; } }

Target:
public static String execWithFile(String filename) { try (BufferedReader br = new BufferedReader(new FileReader(filename))) { StringBuffer buffer = new StringBuffer(); String line; while ((line = br.readLine()) != null) { buffer.append(line.concat("\n")); } return exec(buffer.toString()); } catch (IOException e) { return ""; } }
Source:
public File serializeContext(TaskContext context, File directory) throws IOException { String tmpFilePrefix = Strings.padStart(context.getTaskId().value(), 3, '0'); File file = File.createTempFile(tmpFilePrefix, null, directory); try (ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream(file))) { objectOutputStream.writeObject(context); } if (context.isRunAsUser()) { ForkerUtils.setSharedPermissions(file, false); } return file; }

Target:
public File serializeContext(TaskContext context, File directory) throws IOException { String tmpFilePrefix = Strings.padStart(context.getTaskId().value(), 3, '0'); File file = File.createTempFile(tmpFilePrefix, null, directory); try (ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream(file))) { objectOutputStream.writeObject(context); } if (context.isRunAsUser()) { ForkerUtils.setSharedPermissions(file); } return file; }
Source:
private boolean isNodeResolvingTo(ASTNode node, String signature) { if (signature == null || signature.trim().length() == 0) { return true; } IBinding b = resolveNodeToBinding(node); if (b instanceof ITypeBinding) { ITypeBinding tb = (ITypeBinding) b; if (tb.isPrimitive()) { return (new String(b.getName()).equals(signature)); } else { return resolvesReferenceBindingTo(tb, signature); } } return true; }

Target:
private boolean isNodeResolvingTo(ASTNode node, String signature) { if (signature == null || signature.trim().length() == 0) { return true; } ITypeBinding tb = resolveNodeToBinding(node); if (tb != null && tb.isPrimitive()) { return (new String(tb.getQualifiedName()).equals(signature)); } else { return resolvesReferenceBindingTo(tb, signature); } }
Source:
public MeasurementData(final String label, final String value) { super(); this.label = label; this.value = value; this.changed = false; }

Target:
public MeasurementData(final String label, final String value) { super(); this.label = label; this.value = value; }
Source:
public static String getSafeJsInt(String s){ for(int i = 0; i < s.length(); i++){ if(!Character.isDigit(s.charAt(i))){ return "null"; } } return s; }

Target:
public static String getSafeJsInt(String s){ if(NumberUtils.isNumber(s)){ return s; }else{ return "null"; } }
Source:
public void testBuilder() { String prefix = "prefix_"; String auth = "U,V,W"; String visibility = "U,W"; String user = "user"; String password = "password"; boolean useMock = true; boolean useInference = true; boolean displayPlan = false; MongoDBRdfConfiguration conf = new MongoDBRdfConfiguration().getBuilder() .setVisibilities(visibility) .setUseInference(useInference) .setDisplayQueryPlan(displayPlan) .setUseMockMongo(useMock) .setMongoCollectionPrefix(prefix) .setMongoDBName("dbname") .setMongoHost("host") .setMongoPort("1000") .setAuths(auth) .setMongoUser(user) .setMongoPassword(password).build(); Assert.assertEquals(conf.getTablePrefix(), prefix); Assert.assertTrue(Arrays.equals(conf.getAuths(), new String[] { "U", "V", "W" })); Assert.assertEquals(conf.getCv(), visibility); Assert.assertEquals(conf.isInfer(), useInference); Assert.assertEquals(conf.isDisplayQueryPlan(), displayPlan); Assert.assertEquals(conf.getMongoInstance(), "host"); Assert.assertEquals(conf.getBoolean(".useMockInstance", false), useMock); Assert.assertEquals(conf.getMongoPort(), "1000"); Assert.assertEquals(conf.getMongoDBName(), "dbname"); Assert.assertEquals(conf.getCollectionName(), "prefix_"); Assert.assertEquals(conf.get(MongoDBRdfConfiguration.MONGO_USER), user); Assert.assertEquals(conf.get(MongoDBRdfConfiguration.MONGO_USER_PASSWORD), password); }

Target:
public void testBuilder() { String prefix = "prefix_"; String auth = "U,V,W"; String visibility = "U,W"; String user = "user"; String password = "password"; boolean useMock = true; boolean useInference = true; boolean displayPlan = false; MongoDBRdfConfiguration conf = new MongoDBRdfConfiguration().getBuilder() .setVisibilities(visibility) .setUseInference(useInference) .setDisplayQueryPlan(displayPlan) .setUseMockMongo(useMock) .setMongoCollectionPrefix(prefix) .setMongoDBName("dbname") .setMongoHost("host") .setMongoPort("1000") .setAuths(auth) .setMongoUser(user) .setMongoPassword(password).build(); assertEquals(conf.getTablePrefix(), prefix); assertTrue(Arrays.equals(conf.getAuths(), new String[] { "U", "V", "W" })); assertEquals(conf.getCv(), visibility); assertEquals(conf.isInfer(), useInference); assertEquals(conf.isDisplayQueryPlan(), displayPlan); assertEquals(conf.getMongoInstance(), "host"); assertEquals(conf.getBoolean(".useMockInstance", false), useMock); assertEquals(conf.getMongoPort(), "1000"); assertEquals(conf.getMongoDBName(), "dbname"); assertEquals(conf.getCollectionName(), "prefix_"); assertEquals(conf.get(MongoDBRdfConfiguration.MONGO_USER), user); assertEquals(conf.get(MongoDBRdfConfiguration.MONGO_USER_PASSWORD), password); }
Source:
public void testURLEncodeSpace() { String s1 = StringUtils.urlEncode("aaa bbb"); Assert.assertEquals(s1, "aaa%20bbb"); String s2 = StringUtils.urlEncode("fff+ggg"); Assert.assertEquals(s2, "fff%2Bggg"); }

Target:
public void testURLEncodeSpace() { String s1 = StringUtils.urlEncode("aaa bbb"); Assert.assertEquals(s1, "aaa%20bbb"); Assert.assertEquals("aaa bbb", StringUtils.urlDecode(s1)); String s2 = StringUtils.urlEncode("fff+ggg"); Assert.assertEquals(s2, "fff%2Bggg"); Assert.assertEquals("fff+ggg", StringUtils.urlDecode(s2)); }
Source:
public ScanUtil.ScanOpts getScanOpts() { return new ScanUtil.ScanOpts(startRow, endRow, columns, exactRow, rowPrefix, help, hexEncNonAscii, scanAccumuloTable, false, false); }

Target:
public ScanUtil.ScanOpts getScanOpts() { EnumSet<ScanFlags> flags = EnumSet.noneOf(ScanFlags.class); ScanUtil.setFlag(flags, help, ScanFlags.HELP); ScanUtil.setFlag(flags, hexEncNonAscii, ScanFlags.HEX); ScanUtil.setFlag(flags, scanAccumuloTable, ScanFlags.ACCUMULO); return new ScanUtil.ScanOpts(startRow, endRow, columns, exactRow, rowPrefix, flags); }
Source:
public NodeValue getAccValue() { double mode; if ( count == 0 ) return noValuesToMode ; if ( super.errorCount != 0 ) return null ; int indexsize = collection.size(); double[] arrDouble = new double[indexsize]; for(int i=0; i<indexsize; i++){ arrDouble[i] = collection.get(i).getDouble(); } Arrays.sort(arrDouble); if(indexsize==0) { mode = Double.NaN; }else if(indexsize%2!=0) { mode = arrDouble[(indexsize/2)]; }else { mode = ((arrDouble[(indexsize/2)]+arrDouble[((indexsize/2)-1)])/2); } return (NodeValue.makeDecimal((mode))); }

Target:
public NodeValue getAccValue() { double mode= Double.NaN; if ( count == 0 ) return noValuesToMode ; if ( super.errorCount != 0 ) return null ; int indexsize = collection.size(); double[] arrDouble = new double[indexsize]; for(int i=0; i<indexsize; i++){ arrDouble[i] = collection.get(i).getDouble(); } HashMap<Double,Integer> amode = new HashMap<Double,Integer>(); int max = 0; for(int i = 0; i < arrDouble.length; i++) { if (amode.get(arrDouble[i]) != null) { int count = amode.get(arrDouble[i]); count++; amode.put(arrDouble[i], count); if(count > max) { max = count; mode = arrDouble[i]; } } else { amode.put(arrDouble[i],1); if(mode==0) { mode = arrDouble[i]; } } } return NodeValue.makeDecimal(mode); }
Source:
private void tunePollReportTimeouts( Map<String, IClientRouter> clientRouters, Set<String> failedNodes, Set<String> allConnectedNodes) { networkStretcher.modifyDecreasedPeriod(); tuneRoutersResponseTimeout( clientRouters, allConnectedNodes, networkStretcher.getDecreasedPeriod() ); tuneRoutersResponseTimeout(clientRouters, failedNodes, networkStretcher.getMaxPeriod()); }

Target:
private void tunePollReportTimeouts( Map<String, IClientRouter> clientRouters, Set<String> failedNodes, Set<String> allConnectedNodes) { networkStretcher.modifyDecreasedPeriod(); tuneRoutersResponseTimeout( clientRouters, allConnectedNodes, networkStretcher.getCurrentPeriod() ); tuneRoutersResponseTimeout(clientRouters, failedNodes, networkStretcher.getMaxPeriod()); }
Source:
public void tearDown() throws Exception { if (m_completeShutdown) { m_config.shutDown(); } else { Client client = getClient(); VoltTable tableList = client.callProcedure("@SystemCatalog", "TABLES").getResults()[0]; ArrayList<String> tableNames = new ArrayList<>(tableList.getRowCount()); int tableNameColIdx = tableList.getColumnIndex("TABLE_NAME"); int tableTypeColIdx = tableList.getColumnIndex("TABLE_TYPE"); while (tableList.advanceRow()) { String tableType = tableList.getString(tableTypeColIdx); if (! tableType.equalsIgnoreCase("EXPORT")) { tableNames.add(tableList.getString(tableNameColIdx)); } } for (String tableName : tableNames) { try { client.callProcedure("@AdHoc", "TRUNCATE TABLE " + tableName); } catch (Exception ex) } } for (final Client c : m_clients) { c.close(); } synchronized (m_clientChannels) { for (final SocketChannel sc : m_clientChannels) { try { ConnectionUtil.closeConnection(sc); } catch (final IOException e) { e.printStackTrace(); } } m_clientChannels.clear(); } m_clients.clear(); }

Target:
public void tearDown() throws Exception { if (m_completeShutdown) { m_config.shutDown(); } else { Client client = getClient(); VoltTable tableList = client.callProcedure("@SystemCatalog", "TABLES").getResults()[0]; ArrayList<String> tableNames = new ArrayList<>(tableList.getRowCount()); int tableNameColIdx = tableList.getColumnIndex("TABLE_NAME"); int tableTypeColIdx = tableList.getColumnIndex("TABLE_TYPE"); while (tableList.advanceRow()) { String tableType = tableList.getString(tableTypeColIdx); if (! tableType.equalsIgnoreCase("EXPORT")) { tableNames.add(tableList.getString(tableNameColIdx)); } } for (String tableName : tableNames) { try { client.callProcedure("@AdHoc", "DELETE FROM " + tableName); } catch (ProcCallException pce) { if (! pce.getMessage().contains("Illegal to modify a materialized view.")) { fail("Hit an exception when cleaning up tables between tests: " + pce.getMessage()); } } } } for (final Client c : m_clients) { c.close(); } synchronized (m_clientChannels) { for (final SocketChannel sc : m_clientChannels) { try { ConnectionUtil.closeConnection(sc); } catch (final IOException e) { e.printStackTrace(); } } m_clientChannels.clear(); } m_clients.clear(); }
Source:
public Optional<CommandMapping> register(AbstractCommandModule module, CommandCallable callable, List<String> aliases, Function<List<String>, List<String>> callback) { checkNotNull(module, "module"); checkState(module.canBeInstalledOrConfigured(false), "The provided command module has been fully configured and " + "cannot be used to register commands."); PluginContainer container = module.getPlugin(); synchronized (this.lock) { List<String> aliasesWithPrefix = this.calculatePrefixesWithNamespace(container, aliases); Optional<CommandMapping> mapping = this.dispatcher.register(callable, aliasesWithPrefix, callback, (cc, al) -> new ImmutableModuleCommandMapping(module, callable, aliases.get(0), aliases.subList(1, aliases.size()))); if (mapping.isPresent()) { this.owners.put(container, mapping.get()); } return mapping; } }

Target:
public Optional<CommandMapping> register(AbstractCommandModule module, CommandCallable callable, List<String> aliases, Function<List<String>, List<String>> callback) { checkNotNull(module, "module"); checkState(module.canBeInstalledOrConfigured(false), "The provided command module has been fully configured and " + "cannot be used to register commands."); PluginContainer container = module.getPlugin(); synchronized (this.lock) { List<String> aliasesWithPrefix = this.calculatePrefixesWithNamespace(container, callable, aliases); Optional<CommandMapping> mapping = this.dispatcher.register(callable, aliasesWithPrefix, callback, (cc, al) -> new ImmutableModuleCommandMapping(module, callable, aliases.get(0), aliases.subList(1, aliases.size()))); if (mapping.isPresent()) { this.owners.put(container, mapping.get()); } return mapping; } }
Source:
public void refreshStereotypeStructure() { if (stereoList.size() != 0) { for (Stereotype stereotype : stereoList) { refreshStereotypeLabelStructure(stereotype); refreshStereotypeBraceStructure(stereotype); } } }

Target:
public void refreshStereotypeStructure() { if (!stereotypeList.isEmpty()) { for (Stereotype stereotype : stereotypeList) { refreshStereotypeLabelStructure(stereotype); refreshStereotypeBraceStructure(stereotype); } } }
Source:
private Object[][] testRemoveContentsAfterProvider() { return new Object[][] { { span(chunk(6,10), chunk(11,15)), null, span(chunk(6,10), chunk(11,15)) }, { span(chunk(6,10), chunk(11,15)), span(), span(chunk(6,10), chunk(11,15)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,6)), span() }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,7)), span(chunk(6,7)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,9)), span(chunk(6,9)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,10)), span(chunk(6,10)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,11)), span(chunk(6,10)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,12)), span(chunk(6,10), chunk(11,12)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,15)), span(chunk(6,10), chunk(11,15)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,16)), span(chunk(6,10), chunk(11,15)) }, }; }

Target:
private Object[][] testRemoveContentsAfterProvider() { return new Object[][] { { span(chunk(6,10), chunk(11,15)), null, span(chunk(6,10), chunk(11,15)) }, { span(chunk(6,10), chunk(11,15)), span(), span(chunk(6,10), chunk(11,15)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,6)), span() }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,7)), span(chunk(6,7)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,9)), span(chunk(6,9)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,10)), span(chunk(6,10)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,11)), span(chunk(6,10)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,12)), span(chunk(6,10), chunk(11,12)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,15)), span(chunk(6,10), chunk(11,15)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,16)), span(chunk(6,10), chunk(11,15)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,6), chunk(7,10)), span(chunk(6, 10)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,6), chunk(7,16)), span(chunk(6, 10), chunk(11,15)) }, }; }
Source:
protected void processTuple(GenericRecord tuple) { try { Object obj = getPOJOFromGenericRecord(tuple, getCls()); if (obj != null) { output.emit(obj); recordCnt++; } } catch (InstantiationException | IllegalAccessException e) { LOG.error("Could not initialize object of class - " + getClass().getName()); errorCnt++; } }

Target:
protected void processTuple(GenericRecord tuple) { try { Object obj = getPOJOFromGenericRecord(tuple); if (obj != null) { output.emit(obj); recordCount++; } else if (errorPort.isConnected()) { errorPort.emit(tuple); errorCount++; } } catch (InstantiationException | IllegalAccessException e) { LOG.error("Could not initialize object of class -" + getClass().getName(), e); errorCount++; } }
Source:
public Source getSource() { if (fileSource == null) { FileOrRendition thizz = this; fileSource = new Source() { Long size = null; URLConnection connection = null; @Override public String getName() { return name; } private URLConnection getConnection() throws IOException { if (connection == null) { URL theUrl = new URL(url); connection = theUrl.openConnection(); } return connection; } @Override public InputStream getStream() throws IOException { URLConnection c = getConnection(); connection = null; return c.getInputStream(); } @Override public long getLength() { if (size == null) { try { size = getConnection().getContentLengthLong(); } catch (IOException ex) { Logger.getLogger(FileOrRendition.class.getName()).log(Level.SEVERE, null, ex); size = -1L; } } return size; } @Override public HierarchialElement getElement() { return thizz; } }; } return fileSource; }

Target:
public Source getSource() { if (fileSource == null) { FileOrRendition thizz = this; if (url.toLowerCase().startsWith("http")) { fileSource = new HttpConnectionSource(thizz); } else { fileSource = new UrlConnectionSource(thizz); } } return fileSource; }