auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ExecutionResult execute(Item item) { ProcessType processType = getProcessType(item); if (getProject().getLanguage() != ECodeLanguage.JAVA || processType == null) { return ExecutionResult.NOTHING_TO_DO; } try { String componentsName = new String("tFTPFileExist"); IComponentFilter filter = new NameComponentFilter(componentsName); IComponentConversion addOption = new IComponentConversion() { @Override public void transform(NodeType node) { if (ComponentUtilities.getNodeProperty(node, PROPERTY_NAME) == null) { ComponentUtilities.addNodeProperty(node, PROPERTY_NAME, PROPERTY_TYPE); } ComponentUtilities.setNodeValue(node, PROPERTY_NAME, "false"); } }; ModifyComponentsAction.searchAndModify(item, processType, filter, Arrays.<IComponentConversion> asList(addOption)); return ExecutionResult.SUCCESS_NO_ALERT; } catch (Exception e) { ExceptionHandler.process(e); return ExecutionResult.FAILURE; } }

Target:
public ExecutionResult execute(Item item) { ProcessType processType = getProcessType(item); if (getProject().getLanguage() != ECodeLanguage.JAVA || processType == null) { return ExecutionResult.NOTHING_TO_DO; } String componentsName = new String(COMPONENT_NAME); IComponentFilter filter = new NameComponentFilter(componentsName); IComponentConversion addOption = new IComponentConversion() { @Override public void transform(NodeType node) { if (ComponentUtilities.getNodeProperty(node, PROPERTY_NAME) == null) { ComponentUtilities.addNodeProperty(node, PROPERTY_NAME, PROPERTY_TYPE); } ComponentUtilities.setNodeValue(node, PROPERTY_NAME, "false"); } }; try { ModifyComponentsAction.searchAndModify(item, processType, filter, Arrays.<IComponentConversion> asList(addOption)); return ExecutionResult.SUCCESS_NO_ALERT; } catch (PersistenceException e) { ExceptionHandler.process(e); return ExecutionResult.FAILURE; } }
Source:
public SegmentEvent transform(org.atlasapi.media.entity.simple.SegmentEvent simple, PublisherDetails publisher) { checkArgument(Strings.isNullOrEmpty(simple.getUri()), "You must specify a URI on the item"); checkArgument(simple.getSegment() != null, "You must specify a Segment on the SegmentEvent"); SegmentEvent complex = new SegmentEvent(); complex.setCanonicalUri(simple.getUri()); complex.setDescription(Description.description() .withSynopsis(simple.getDescription()) .withTitle(simple.getTitle()) .build()); complex.setPosition(simple.getPosition()); if (simple.getOffset() != null) { complex.setOffset(Duration.standardMinutes(simple.getOffset())); } complex.setIsChapter(simple.getIsChapter()); if (Strings.isNullOrEmpty(simple.getSegment().getId())) { complex.setSegment(writeSegment(simple.getSegment(), publisher)); } else { complex.setSegment(new SegmentRef(codec.decode(simple.getSegment().getId()).longValue())); } return complex; }

Target:
public SegmentEvent transform(org.atlasapi.media.entity.simple.SegmentEvent simple, PublisherDetails publisher) { checkNotNull(simple.getSegment() != null, "You must specify a Segment on the SegmentEvent"); SegmentEvent complex = new SegmentEvent(); complex.setCanonicalUri(simple.getUri()); complex.setDescription(Description.description() .withSynopsis(simple.getDescription()) .withTitle(simple.getTitle()) .build()); complex.setPosition(simple.getPosition()); if (simple.getOffset() != null) { complex.setOffset(Duration.standardMinutes(simple.getOffset())); } complex.setIsChapter(simple.getIsChapter()); if (Strings.isNullOrEmpty(simple.getSegment().getId())) { complex.setSegment(writeSegment(simple.getSegment(), publisher)); } else { complex.setSegment(new SegmentRef(codec.decode(simple.getSegment().getId()).longValue())); } return complex; }
Source:
public Single<Integer> getUploadCount(String userName) { HttpUrl.Builder urlBuilder = wikiMediaToolforgeUrl.newBuilder(); urlBuilder .addPathSegments("uploadsbyuser.py") .addQueryParameter("user", userName); if (ConfigUtils.isBetaFlavour()) { urlBuilder.addQueryParameter("labs", "commonswiki"); } Request request = new Request.Builder() .url(urlBuilder.build()) .build(); return Single.fromCallable(() -> { Response response = okHttpClient.newCall(request).execute(); if (response != null && response.isSuccessful()) { ResponseBody responseBody = response.body(); if(null!=responseBody) { String responseBodyString = responseBody.toString(); if (!TextUtils.isEmpty(responseBodyString.trim())) { return Integer.parseInt(responseBodyString.trim()); } } } return 0; }); }

Target:
public Single<Integer> getUploadCount(String userName) { HttpUrl.Builder urlBuilder = wikiMediaToolforgeUrl.newBuilder(); urlBuilder .addPathSegments("uploadsbyuser.py") .addQueryParameter("user", userName); if (ConfigUtils.isBetaFlavour()) { urlBuilder.addQueryParameter("labs", "commonswiki"); } Request request = new Request.Builder() .url(urlBuilder.build()) .build(); return Single.fromCallable(() -> { Response response = okHttpClient.newCall(request).execute(); if (response != null && response.isSuccessful()) { ResponseBody responseBody = response.body(); if (null != responseBody) { String responseBodyString = responseBody.string().trim(); if (!TextUtils.isEmpty(responseBodyString)) { try { return Integer.parseInt(responseBodyString); } catch (NumberFormatException e) { Timber.e(e); } } } } return 0; }); }
Source:
protected void testExecute() { InstructorAttributes instructor1ofCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); loginAsAdmin(); ______TS("Not enough parameters"); verifyHttpParameterFailure(); ______TS("Typical case"); String[] params = { Const.ParamsNames.INSTRUCTOR_ID, instructor1ofCourse1.getGoogleId(), }; DowngradeAccountAction a = getAction(params); JsonResult r = getJsonResult(a); MessageOutput response = (MessageOutput) r.getOutput(); assertEquals(HttpStatus.SC_OK, r.getStatusCode()); assertEquals("Instructor account is successfully downgraded to student.", response.getMessage()); ______TS("Failure: Downgrades an invalid account"); String[] invalidParams = { Const.ParamsNames.INSTRUCTOR_ID, "invalid-google-id", }; assertThrows(EntityNotFoundException.class, () -> getJsonResult(getAction(invalidParams))); }

Target:
protected void testExecute() { InstructorAttributes instructor1ofCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); StudentAttributes student1InCourse1 = typicalBundle.students.get("student1InCourse1"); loginAsAdmin(); ______TS("Not enough parameters"); verifyHttpParameterFailure(); ______TS("Typical case"); String[] params = { Const.ParamsNames.INSTRUCTOR_ID, instructor1ofCourse1.getGoogleId(), }; DowngradeAccountAction a = getAction(params); JsonResult r = getJsonResult(a); MessageOutput response = (MessageOutput) r.getOutput(); assertEquals(HttpStatus.SC_OK, r.getStatusCode()); assertEquals("Instructor account is successfully downgraded to student.", response.getMessage()); assertFalse(logic.getAccount(instructor1ofCourse1.getGoogleId()).isInstructor); ______TS("Failure: Downgrades an invalid account"); String[] invalidParams = { Const.ParamsNames.INSTRUCTOR_ID, "invalid-google-id", }; assertThrows(EntityNotFoundException.class, () -> getJsonResult(getAction(invalidParams))); ______TS("Failure: Tries to downgrade a student account"); String[] paramsStudent = { Const.ParamsNames.INSTRUCTOR_ID, student1InCourse1.getId(), }; assertThrows(EntityNotFoundException.class, () -> getJsonResult(getAction(paramsStudent))); }
Source:
private IReadOnlyListener createReadOnlyListener() { return new IReadOnlyListener() { @Override public void readOnlyStateChanged(ReadOnlyEvent event) { switch (event.getEventType()) { case ReadOnlyEvent.RESOURCE_READ_ONLY_STATE_CHANGED: scheduleRefresh(); break; case ReadOnlyEvent.OBJECT_READ_ONLY_STATE_CHANGED: CommonViewer viewer = getCommonViewer(); if ((viewer != null) && (viewer.getControl() != null) && !viewer.getControl().isDisposed()) { viewer.refresh(event.getObject()); } break; default: Activator.log.warn(Messages.ModelExplorerView_WarningReadOnlyEvent + event.getEventType()); break; } } }; }

Target:
private IReadOnlyListener createReadOnlyListener() { return new IReadOnlyListener() { @Override public void readOnlyStateChanged(ReadOnlyEvent event) { switch (event.getEventType()) { case ReadOnlyEvent.RESOURCE_READ_ONLY_STATE_CHANGED: scheduleRefresh(); break; case ReadOnlyEvent.OBJECT_READ_ONLY_STATE_CHANGED: CommonViewer viewer = getCommonViewer(); if ((viewer != null) && (viewer.getControl() != null) && !viewer.getControl().isDisposed()) { viewer.refresh(event.getObject()); } break; default: Activator.log.warn("Unsupported read-only event type: " + event.getEventType()); break; } } }; }
Source:
public void shouldComputeMaxOfOneValue() { assertThat(Iterator.of(5).max()).isEqualTo(Option.some(5)); }

Target:
public void shouldComputeMaxOfOneValue() { assertThat(of(5).max()).isEqualTo(Option.some(5)); }
Source:
public void batchAutomaticRouting() { EventHubProducerAsyncClient producer = new EventHubClientBuilder() .connectionString( "Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};SharedAccessKey={key}", "event-hub-name") .buildAsyncProducerClient(); producer.createBatch().flatMap(batch -> { batch.tryAdd(new EventData("test-event-1")); batch.tryAdd(new EventData("test-event-2")); return producer.send(batch); }).block(); END: com.azure.messaging.eventhubs.eventhubasyncproducerclient.createBatch producer.close(); }

Target:
public void batchAutomaticRouting() { EventHubProducerAsyncClient producer = new EventHubClientBuilder() .connectionString( "Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};SharedAccessKey={key}", "event-hub-name") .buildAsyncProducerClient(); producer.createBatch().flatMap(batch -> { batch.tryAdd(new EventData("test-event-1")); batch.tryAdd(new EventData("test-event-2")); return producer.send(batch); }).subscribe(unused -> { }, error -> System.err.println("Error occurred while sending batch:" + error), () -> System.out.println("Send complete.")); END: com.azure.messaging.eventhubs.eventhubasyncproducerclient.createBatch producer.close(); }
Source:
public void testPingFailOn500() throws Exception { MockWebServer server = mockOpenStackServer(); server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json")))); server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(500))); try { PoppyApi poppyApi = api(server.getUrl("/").toString(), "openstack-poppy", overrides); boolean online = poppyApi.ping(); assertThat(server.getRequestCount()).isEqualTo(2); assertAuthentication(server); assertRequest(server.takeRequest(), "GET", BASE_URI + "/ping"); assertThat(online).isTrue(); } finally { server.shutdown(); } }

Target:
public void testPingFailOn500() throws Exception { MockWebServer server = mockOpenStackServer(); server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json")))); server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(500))); server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(500))); try { PoppyApi poppyApi = api(server.getUrl("/").toString(), "openstack-poppy", overrides); boolean online = poppyApi.ping(); assertThat(server.getRequestCount()).isEqualTo(3); assertAuthentication(server); assertRequest(server.takeRequest(), "GET", BASE_URI + "/ping"); assertThat(online).isFalse(); } finally { server.shutdown(); } }
Source:
private void populateRepositoryFactoryInformation(ListableBeanFactory factory) { Set<Map.Entry<String, RepositoryFactoryInformation>> repositoryFactoryBeans = BeanFactoryUtils .beansOfTypeIncludingAncestors(factory, RepositoryFactoryInformation.class).entrySet(); for (Map.Entry<String, RepositoryFactoryInformation> entry : repositoryFactoryBeans) { String beanName = entry.getKey(); if (BeanFactoryUtils.isFactoryDereference(beanName)) { RepositoryFactoryInformation repositoryFactoryInformation = entry.getValue(); Class<?> userDomainType = ClassUtils.getUserClass(repositoryFactoryInformation.getRepositoryInformation() .getDomainType()); this.repositoryFactoryInfos.put(userDomainType, repositoryFactoryInformation); this.repositoryBeanNames.put(userDomainType, BeanFactoryUtils.transformedBeanName(beanName)); } } }

Target:
private void populateRepositoryFactoryInformation(ListableBeanFactory factory) { Set<Map.Entry<String, RepositoryFactoryInformation>> repositoryFactoryBeans = BeanFactoryUtils .beansOfTypeIncludingAncestors(factory, RepositoryFactoryInformation.class).entrySet(); for (Map.Entry<String, RepositoryFactoryInformation> entry : repositoryFactoryBeans) { String beanName = entry.getKey(); RepositoryFactoryInformation repositoryFactoryInformation = entry.getValue(); Class<?> userDomainType = ClassUtils.getUserClass(repositoryFactoryInformation.getRepositoryInformation() .getDomainType()); this.repositoryFactoryInfos.put(userDomainType, repositoryFactoryInformation); this.repositoryBeanNames.put(userDomainType, BeanFactoryUtils.transformedBeanName(beanName)); } }
Source:
public void shouldUpgradeFromClean1_9To1_10() throws IOException, SQLException { upgradeTestUtil.upgrade(); }

Target:
public void shouldUpgradeFromClean1_9To1_10() throws IOException, SQLException { upgradeTestUtil.upgrade(); List<Map<String, String>> orderFrequencySelect = upgradeTestUtil.select("order_frequency", "order_frequency_id"); Assert.assertThat(orderFrequencySelect.size(), Matchers.is(0)); List<Map<String, String>> drugOrderSelect = upgradeTestUtil.select("drug_order", "order_id"); Assert.assertThat(drugOrderSelect.size(), Matchers.is(0)); }
Source:
public PushOperatorBuilder atPosition(int position) { if (position < 0) { throw new IllegalArgumentException("Position must be greater or equal to zero."); } this.modifiers.addModifier(new PositionModifier(position)); return this; }

Target:
public PushOperatorBuilder atPosition(int position) { if (position < 0) { throw new IllegalArgumentException("Position must be greater than or equal to zero."); } this.modifiers.addModifier(new PositionModifier(position)); return this; }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { rebuildJob.cancel(); rebuildJob.schedule(); return null; }

Target:
public Object execute(ExecutionEvent event) { rebuildJob.cancel(); rebuildJob.schedule(); return null; }
Source:
protected WappalyzerPassiveScanner createScanner() { Logger.getLogger(WappalyzerPassiveScanner.class).setLevel(Level.DEBUG); getDefaultHolder().resetApplicationsToSite(); return new WappalyzerPassiveScanner(getDefaultHolder()); }

Target:
protected WappalyzerPassiveScanner createScanner() { getDefaultHolder().resetApplicationsToSite(); return new WappalyzerPassiveScanner(getDefaultHolder()); }
Source:
public void testSimpleEnvironmentNothingTodo() throws IOException, InterruptedException, FormException { TestableDockerContainerWatchdog subject = new TestableDockerContainerWatchdog(); final String nodeName = "unittest-12345"; final String containerId = UUID.randomUUID().toString(); List<DockerCloud> listOfCloud = new LinkedList<DockerCloud>(); Map<String, String> labelMap = new HashMap<>(); labelMap.put(DockerContainerLabelKeys.NODE_NAME, nodeName); labelMap.put(DockerContainerLabelKeys.REMOVE_VOLUMES, "false"); List<Container> containerList = new LinkedList<Container>(); Container c = TestableDockerContainerWatchdog.createMockedContainer(containerId, "Running", 0L, labelMap); containerList.add(c); DockerAPI dockerApi = TestableDockerContainerWatchdog.createMockedDockerAPI(containerList); DockerCloud cloud = new DockerCloud("unittestcloud", dockerApi, new LinkedList<DockerTemplate>()); listOfCloud.add(cloud); subject.setAllClouds(listOfCloud); LinkedList<Node> allNodes = new LinkedList<Node>(); DockerTransientNode node = TestableDockerContainerWatchdog.createMockedDockerTransientNode(containerId, nodeName, cloud, false); allNodes.add(node); subject.setAllNodes(allNodes); subject.runExecute(); Assert.assertEquals(0, subject.getAllRemovedNodes().size()); }

Target:
public void testSimpleEnvironmentNothingTodo() throws IOException, InterruptedException { TestableDockerContainerWatchdog subject = new TestableDockerContainerWatchdog(); final String nodeName = "unittest-12345"; final String containerId = UUID.randomUUID().toString(); List<DockerCloud> listOfCloud = new LinkedList<DockerCloud>(); Map<String, String> labelMap = new HashMap<>(); labelMap.put(DockerContainerLabelKeys.NODE_NAME, nodeName); labelMap.put(DockerContainerLabelKeys.REMOVE_VOLUMES, "false"); List<Container> containerList = new LinkedList<Container>(); Container c = TestableDockerContainerWatchdog.createMockedContainer(containerId, "Running", 0L, labelMap); containerList.add(c); DockerAPI dockerApi = TestableDockerContainerWatchdog.createMockedDockerAPI(containerList); DockerCloud cloud = new DockerCloud("unittestcloud", dockerApi, new LinkedList<DockerTemplate>()); listOfCloud.add(cloud); subject.setAllClouds(listOfCloud); LinkedList<Node> allNodes = new LinkedList<Node>(); DockerTransientNode node = TestableDockerContainerWatchdog.createMockedDockerTransientNode(containerId, nodeName, cloud, false); allNodes.add(node); subject.setAllNodes(allNodes); subject.runExecute(); Assert.assertEquals(0, subject.getAllRemovedNodes().size()); }
Source:
private Map<String, Object> computeKeyValues(List<String> fieldNames, List<String> values) { Map<String, Object> retVal = new LinkedHashMap<>(); Iterator<String> keysIter = fieldNames.iterator(); Iterator<String> valsIter = values.iterator(); while (keysIter.hasNext()) { final String key = keysIter.next(); if (valsIter.hasNext()) { Object splitedValue = spliteValue(key, valsIter.next()); retVal.put(key, splitedValue); } else { break; } } return retVal; }

Target:
private Map<String, Object> computeKeyValues(List<String> fieldNames, List<String> values) { Map<String, Object> retVal = new LinkedHashMap<>(); Iterator<String> valsIter = values.iterator(); for (String key : fieldNames) { if (valsIter.hasNext()) { Object splitedValue = spliteValue(key, valsIter.next()); retVal.put(key, splitedValue); } else { break; } } return retVal; }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_ballot, container, false); final VIPTabBarActivity myActivity = (VIPTabBarActivity)this.getActivity(); SimpleDateFormat election_date_api_format = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat election_date_display_format = new SimpleDateFormat("MMMM d, yyyy"); TextView election_name_label = (TextView)rootView.findViewById(R.id.ballot_election_name); TextView election_date_label = (TextView)rootView.findViewById(R.id.ballot_election_date); election_name_label.setText(voterInfo.election.name); try { Date election_date = election_date_api_format.parse(voterInfo.election.electionDay); election_date_label.setText(election_date_display_format.format(election_date)); } catch (ParseException e) { Log.e("BallotFragment", "Failed to parse election date " + voterInfo.election.electionDay); election_date_label.setText(voterInfo.election.electionDay); } ArrayList contestInfo = (ArrayList) voterInfo.contests; ArrayAdapter adapter = new ArrayAdapter<String>(myActivity, android.R.layout.simple_selectable_list_item, contestInfo); ListView contestList = (ListView)rootView.findViewById(R.id.ballot_contests_list); contestList.setAdapter(adapter); contestList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Log.d("ContestsList", "clicked: " + voterInfo.contests.get(position).office); myActivity.showContestDetails(position); } }); return rootView; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_ballot, container, false); final VIPTabBarActivity myActivity = (VIPTabBarActivity)this.getActivity(); TextView election_name_label = (TextView)rootView.findViewById(R.id.ballot_election_name); TextView election_date_label = (TextView)rootView.findViewById(R.id.ballot_election_date); election_name_label.setText(voterInfo.election.name); election_date_label.setText(voterInfo.election.getFormattedDate()); ArrayList contestInfo = new ArrayList<String>(voterInfo.contests.size()); for (Contest contest : voterInfo.contests) { if (contest.type == "Referendum") { contestInfo.add(contest.referendumTitle + "\n" + contest.referendumSubtitle); } else { contestInfo.add(contest.office + "\n" + voterInfo.election.name); } } ArrayAdapter adapter = new ArrayAdapter<String>(myActivity, android.R.layout.simple_selectable_list_item, contestInfo); ListView contestList = (ListView)rootView.findViewById(R.id.ballot_contests_list); contestList.setAdapter(adapter); contestList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Log.d("ContestsList", "clicked: " + voterInfo.contests.get(position).office); myActivity.showContestDetails(position); } }); return rootView; }
Source:
public KmlMarshaller() { try { this.jaxbContext = JAXBContext.newInstance(Kml.class); this.unmarshaller = jaxbContext.createUnmarshaller(); } catch (JAXBException e) { LOGGER.info("Unable to create JAXB Context. Setting to null."); this.jaxbContext = null; } }

Target:
public KmlMarshaller() { try { this.jaxbContext = JAXBContext.newInstance(Kml.class); this.unmarshaller = jaxbContext.createUnmarshaller(); } catch (JAXBException e) { LOGGER.debug("Unable to create JAXB Context. Setting to null."); this.jaxbContext = null; } }
Source:
private void buildVmGraphicsDevicesFromDb(Map<String, Object> extraSpecParams) { String spiceDeviceName = "spice"; Comparator<VmDevice> spiceLastDeviceComparator = Comparator.comparing( VmDevice::getDevice, ComparatorUtils.sortLast(spiceDeviceName, ComparatorUtils.noOrdering())); buildVmDevicesFromDb(VmDeviceGeneralType.GRAPHICS, false, extraSpecParams, spiceLastDeviceComparator); String legacyDisplay = deriveDisplayTypeLegacy(); if (legacyDisplay != null) { createInfo.put(VdsProperties.display, legacyDisplay); } }

Target:
private void buildVmGraphicsDevicesFromDb(Map<String, Object> extraSpecParams) { Comparator<VmDevice> spiceLastDeviceComparator = Comparator.comparing( VmDevice::getDevice, ComparatorUtils.sortLast(VmDeviceType.SPICE.getName())); buildVmDevicesFromDb(VmDeviceGeneralType.GRAPHICS, false, extraSpecParams, spiceLastDeviceComparator); String legacyDisplay = deriveDisplayTypeLegacy(); if (legacyDisplay != null) { createInfo.put(VdsProperties.display, legacyDisplay); } }
Source:
public static byte[] newByteArray(byte[] data, int finalSize) { byte[] filledArray = new byte[finalSize]; int diff = finalSize - data.length; if (diff >= 0) { for (int i = 0; i < diff; i++) filledArray[i] = '0'; System.arraycopy(data, 0, filledArray, diff, data.length); } else System.arraycopy(data, 0, filledArray, 0, finalSize); return filledArray; }

Target:
public static byte[] newByteArray(byte[] data, int finalSize) { if (data == null) throw new NullPointerException("Data cannot be null."); byte[] filledArray = new byte[finalSize]; int diff = finalSize - data.length; if (diff >= 0) { for (int i = 0; i < diff; i++) filledArray[i] = '0'; System.arraycopy(data, 0, filledArray, diff, data.length); } else System.arraycopy(data, 0, filledArray, 0, finalSize); return filledArray; }
Source:
public void testPolicyDelete(String path) throws Exception { URL fileURL = Thread.currentThread().getContextClassLoader().getResource(path); Path policyDir = Paths.get(fileURL.toURI()).getParent(); assertTrue(RoleRegistry.get().getRegisteredRoles().isEmpty()); deployer.deployPolicy(policyDir); ArgumentCaptor<AuthorizationPolicy> policyCaptor = ArgumentCaptor.forClass(AuthorizationPolicy.class); ArgumentCaptor<Group> groupCaptor = ArgumentCaptor.forClass(Group.class); verify(storage).loadPolicy(); verify(storage).savePolicy(policyCaptor.capture()); Group group = new GroupImpl("group1"); storage.deletePolicyByGroup(group, policyCaptor.getValue()); verify(storage).deletePolicyByGroup(groupCaptor.capture(), policyCaptor.capture()); verify(event).fire(any()); AuthorizationPolicy policy = policyCaptor.getValue(); verify(permissionManager).setAuthorizationPolicy(policy); Set<Group> roles = policyCaptor.getValue().getGroups(); assertEquals(1, roles.size()); PermissionCollection permissions = policy.getPermissions(group); Permission permission = permissions.get("perspective.read"); assertNotNull(permission); assertEquals(AuthorizationResult.ACCESS_GRANTED, permission.getResult()); ; }

Target:
public void testPolicyDelete(String path) throws Exception { URL fileURL = Thread.currentThread().getContextClassLoader().getResource(path); Path policyDir = Paths.get(fileURL.toURI()).getParent(); assertTrue(RoleRegistry.get().getRegisteredRoles().isEmpty()); deployer.deployPolicy(policyDir); ArgumentCaptor<AuthorizationPolicy> policyCaptor = ArgumentCaptor.forClass(AuthorizationPolicy.class); verify(storage).loadPolicy(); verify(storage).savePolicy(policyCaptor.capture()); vfsstorage.savePolicy(policyCaptor.getValue()); AuthorizationPolicy policy = vfsstorage.loadPolicyFromVfs(); Set<Group> groups = policy.getGroups(); assertEquals(1, groups.size()); Group group = new GroupImpl("group1"); PermissionCollection permissions = policy.getPermissions(group); Permission permission = permissions.get("perspective.read"); assertNotNull(permission); assertEquals(AuthorizationResult.ACCESS_GRANTED, permission.getResult()); vfsstorage.deletePolicyByGroup(group, policyCaptor.getValue()); verify(event).fire(any()); policy = vfsstorage.loadPolicyFromVfs(); groups = policy.getGroups(); assertEquals(0, groups.size()); }
Source:
public static Job create(String name, final ICoreRunnable runnable) { return new Job(name) { @Override protected IStatus run(IProgressMonitor monitor) { try { runnable.run(monitor); } catch (CoreException e) { return toStatusPreservingCause(e); } finally { monitor.done(); } return Status.OK_STATUS; } private IStatus toStatusPreservingCause(CoreException e) { IStatus status = e.getStatus(); if (status.getException() != null) return status; return new Status(status.getSeverity(), status.getPlugin(), status.getCode(), status.getMessage(), e); } }; }

Target:
public static Job create(String name, final ICoreRunnable runnable) { return new Job(name) { @Override protected IStatus run(IProgressMonitor monitor) { try { runnable.run(monitor); } catch (CoreException e) { IStatus st = e.getStatus(); return new Status(st.getSeverity(), st.getPlugin(), st.getCode(), st.getMessage(), e); } finally { monitor.done(); } return Status.OK_STATUS; } }; }
Source:
public DataOutputStream getTempOutputStream() throws IOException { File tempFile = File.createTempFile("test", ".dat"); tempFilename = tempFile.getAbsolutePath(); Path path = new Path("file:/ Configuration conf = new Configuration(); FileSystem fs = path.getFileSystem(conf); return fs.create(path); }

Target:
public DataOutputStream getTempOutputStream() throws IOException { tempPath = Files.createTempDir(); tempPath.mkdirs(); File tempFile = File.createTempFile("test", ".dat", tempPath); tempFilename = tempFile.getAbsolutePath(); Path path = new Path("file:/ Configuration conf = new Configuration(); FileSystem fs = path.getFileSystem(conf); return fs.create(path); }
Source:
protected boolean canMutate(MutatableCode mutatableCode) { for (MInsn mInsn : mutatableCode.getInstructions()) { return (mInsn.insn.info.opcode == Opcode.NEW_INSTANCE); } Log.debug("No New Instance in method, skipping..."); return false; }

Target:
protected boolean canMutate(MutatableCode mutatableCode) { for (MInsn mInsn : mutatableCode.getInstructions()) { if (mInsn.insn.info.opcode == Opcode.NEW_INSTANCE) { return true; } } Log.debug("No New Instance in method, skipping..."); return false; }
Source:
public void publish(Message message, Topic topic, MessageState messageState, RequestTimeoutLock requestTimeoutLock, BrokerListeners listeners, PublishingCallback callback) { if (requestTimeoutLock.tryLock()) { messageState.setState(SENDING_TO_KAFKA_PRODUCER_QUEUE); brokerMessageProducer.send(message, topic, callback); messageState.setState(SENDING_TO_KAFKA); } }

Target:
public void publish(Message message, Topic topic, MessageState messageState, RequestTimeoutLock requestTimeoutLock, BrokerListeners listeners, PublishingCallback callback) { if (requestTimeoutLock.tryLock()) { messageState.setState(SENDING_TO_KAFKA_PRODUCER_QUEUE); brokerMessageProducer.send(message, topic, callback); messageState.setState(SENDING_TO_KAFKA); requestTimeoutLock.unlock(); } }
Source:
public T editHosted(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Entry to modify.", required = true) @PathParam("entryId") Long entryId, @ApiParam(value = "Set of updated sourcefiles, add files by adding new files with unknown paths, delete files by including them with emptied content", required = true) Set<SourceFile> sourceFiles) { T entry = getEntryDAO().findById(entryId); checkEntry(entry); checkUser(user, entry); checkHosted(entry); U version = getVersion(entry); Set<SourceFile> versionSourceFiles = handleSourceFileMerger(entryId, sourceFiles, entry, version); boolean isValidVersion = checkValidVersion(versionSourceFiles, entry); if (!isValidVersion) { throw new WebApplicationException("The reversion is not valid", HttpStatus.SC_BAD_REQUEST); } version.setValid(isValidVersion); version.setVersionEditor(user); long l = getVersionDAO().create(version); entry.getVersions().add(getVersionDAO().findById(l)); userDAO.clearCache(); T newTool = getEntryDAO().findById(entryId); elasticManager.handleIndexUpdate(newTool, ElasticMode.UPDATE); return newTool; }

Target:
public T editHosted(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Entry to modify.", required = true) @PathParam("entryId") Long entryId, @ApiParam(value = "Set of updated sourcefiles, add files by adding new files with unknown paths, delete files by including them with emptied content", required = true) Set<SourceFile> sourceFiles) { T entry = getEntryDAO().findById(entryId); checkEntry(entry); checkUser(user, entry); checkHosted(entry); U version = getVersion(entry); Set<SourceFile> versionSourceFiles = handleSourceFileMerger(entryId, sourceFiles, entry, version); boolean isValidVersion = checkValidVersion(versionSourceFiles, entry); if (!isValidVersion) { throw new WebApplicationException("Your edited files are invalid. No new version was created. Please check your syntax and try again.", HttpStatus.SC_BAD_REQUEST); } version.setValid(isValidVersion); version.setVersionEditor(user); long l = getVersionDAO().create(version); entry.getVersions().add(getVersionDAO().findById(l)); userDAO.clearCache(); T newTool = getEntryDAO().findById(entryId); elasticManager.handleIndexUpdate(newTool, ElasticMode.UPDATE); return newTool; }
Source:
protected void executeQueryCommand() { setReturnValue(getDbFacade().getVdsGroupDao().getClustersHavingHosts()); }

Target:
protected void executeQueryCommand() { setReturnValue(vdsGroupDao.getClustersHavingHosts()); }
Source:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command.equals(getNewSnapshotCommand())) { newSnapshot(); } else if (command.getName().equalsIgnoreCase("onCreateSnapshot")) { onCreateSnapshot(); } else if (command.getName().equalsIgnoreCase("Cancel")) { setWindow(null); } else if (command.equals(getEditSnapshotScheduleCommand())) { editSnapshotSchedule(); } else if (command.getName().equalsIgnoreCase("onEditSnapshotSchedule")) { onEditSnapshotSchedule(); } }

Target:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command.equals(getNewSnapshotCommand())) { newSnapshot(); } else if (command.getName().equalsIgnoreCase("onCreateSnapshot")) { onCreateSnapshot(); } else if (command.getName().equalsIgnoreCase("cancel")) { setWindow(null); } else if (command.equals(getEditSnapshotScheduleCommand())) { editSnapshotSchedule(); } else if (command.getName().equalsIgnoreCase("onEditSnapshotSchedule")) { onEditSnapshotSchedule(); } }
Source:
public int getRowCountEstimate() { int estimate = rowCountEstimate; if (estimate < 1) { estimate = pageSize * 4; } if (estimate <= requestedRange.getEnd()) { estimate = requestedRange.getEnd() + pageSize; } return estimate; }

Target:
public int getRowCountEstimate() { if (rowCountEstimate < 1) { return pageSize * DEFAULT_PAGE_INCREASE_COUNT; } return rowCountEstimate; }
Source:
public MergeOp create(Branch.NameKey branch) { final ProjectState pe = mergeArguments.projectCache.get(branch.getParentKey()); if (pe == null) { log.error("No such project: " + branch.getParentKey()); return null; } final Project destProject = pe.getProject(); mergeArguments.destBranch = branch; mergeArguments.destProject = destProject; switch (destProject.getSubmitType()) { case CHERRY_PICK: return new CherryPick(mergeArguments); case FAST_FORWARD_ONLY: return new FastForwardOnly(mergeArguments); case MERGE_ALWAYS: return new MergeAlways(mergeArguments); case MERGE_IF_NECESSARY: return new MergeIfNecessary(mergeArguments); default: return null; } }

Target:
public MergeOp create(Branch.NameKey branch) throws MergeException { final ProjectState pe = mergeArguments.projectCache.get(branch.getParentKey()); if (pe == null) { final String errorMsg = "No such project: " + branch.getParentKey(); log.error(errorMsg); throw new MergeException(errorMsg); } final Project destProject = pe.getProject(); switch (destProject.getSubmitType()) { case CHERRY_PICK: return new CherryPick(mergeArguments, destProject, branch); case FAST_FORWARD_ONLY: return new FastForwardOnly(mergeArguments, destProject, branch); case MERGE_ALWAYS: return new MergeAlways(mergeArguments, destProject, branch); case MERGE_IF_NECESSARY: return new MergeIfNecessary(mergeArguments, destProject, branch); default: final String errorMsg = "No such submit type: " + destProject.getSubmitType(); log.error(errorMsg); throw new MergeException(errorMsg); } }
Source:
void peekMessage() { final String messageId = UUID.randomUUID().toString(); final String contents = "Some-contents"; final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, messageId, 0); final ReceiveMessageOptions options = new ReceiveMessageOptions().setAutoComplete(true); receiver = createBuilder() .receiveMessageOptions(options) .buildAsyncReceiverClient(); StepVerifier.create(sender.send(message).thenMany(receiver.peek())) .assertNext(receivedMessage -> { Assertions.assertEquals(contents, receivedMessage.getBodyAsString()); Assertions.assertTrue(receivedMessage.getProperties().containsKey(MESSAGE_TRACKING_ID)); Assertions.assertEquals(messageId, receivedMessage.getProperties().get(MESSAGE_TRACKING_ID)); }) .verifyComplete(); }

Target:
void peekMessage() { final String messageId = UUID.randomUUID().toString(); final String contents = "Some-contents"; final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, messageId, 0); StepVerifier.create(sender.send(message).then(receiver.peek())) .assertNext(receivedMessage -> { Assertions.assertEquals(contents, receivedMessage.getBodyAsString()); Assertions.assertTrue(receivedMessage.getProperties().containsKey(MESSAGE_TRACKING_ID)); Assertions.assertEquals(messageId, receivedMessage.getProperties().get(MESSAGE_TRACKING_ID)); }) .verifyComplete(); }
Source:
protected void executeVDSCommand() { vmManager.lock(); try { executeVmCommand(); vmManager.setLastUpdateDate(Calendar.getInstance().getTime()); } finally { vmManager.unlock(); } }

Target:
protected void executeVDSCommand() { vmManager.lock(); try { executeVmCommand(); updateVmDataChangedTime(); } finally { vmManager.unlock(); } }
Source:
public String validateInput() { File file = getSelectedFile(); if (file == null) { return I18N.tr("A file must be selected"); } boolean exists = getSelectedFile().exists(); if (exists && fileMustNotExist) { return UIFactory.getI18n().tr("The file already exists"); } else if(exists && confirmOverwrite) { if(JOptionPane.showConfirmDialog(getComponent(),"<html><body><p style='width: "+ getMessageWidth()+ "px;'>"+ I18N.tr("The file {0} already exists do you confirm overwrite ?" + "</body></html>", getSelectedFile()) , I18N.tr("Overwrite confirmation"), JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) { return I18N.tr("Overwrite canceled"); } } return null; }

Target:
public String validateInput() { File file = getSelectedFile(); if (file == null) { return I18N.tr("A file must be selected"); } boolean exists = getSelectedFile().exists(); if (exists && fileMustNotExist) { return UIFactory.getI18n().tr("The file already exists"); } else if(exists && confirmOverwrite) { if (JOptionPane.showConfirmDialog( getComponent(), "<html><body><p style='width: " + messageWidth + "px;'>" + I18N.tr("The file {0} already exists. Overwrite?" + "</body></html>", getSelectedFile()), I18N.tr("Confirm overwrite"), JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION) { return I18N.tr("Overwrite canceled"); } } return null; }
Source:
private GlusterVolumeTaskStatusEntity fetchRemobeBricksStatusDetails() { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeRemoveBricksStatus, new GlusterVolumeRemoveBricksVDSParameters(getUpServerId(clusterId), volume.getName(), getParameters().getBricks(), volume.getReplicaCount())); GlusterVolumeTaskStatusEntity entity = (GlusterVolumeTaskStatusEntity) returnValue.getReturnValue(); GlusterAsyncTask asyncTask = volume.getAsyncTask(); if (asyncTask != null && asyncTask.getTaskId() != null) { List<Step> stepsList = getStepDao().getStepsByExternalId(asyncTask.getTaskId()); if (stepsList != null && !stepsList.isEmpty()) { entity.setStartTime(stepsList.get(0).getStartTime()); } updateTaskStepDetails(asyncTask, entity.getStatusSummary().getStatus()); if (asyncTask.getStatus() == JobExecutionStatus.ABORTED) { entity.getStatusSummary().setStatus(JobExecutionStatus.ABORTED); } } updateHostIP(entity); return entity; }

Target:
private GlusterVolumeTaskStatusEntity fetchRemobeBricksStatusDetails() { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeRemoveBricksStatus, new GlusterVolumeRemoveBricksVDSParameters(getUpServerId(clusterId), volume.getName(), getParameters().getBricks(), volume.getReplicaCount())); GlusterVolumeTaskStatusEntity entity = (GlusterVolumeTaskStatusEntity) returnValue.getReturnValue(); GlusterAsyncTask asyncTask = volume.getAsyncTask(); if (asyncTask != null && asyncTask.getTaskId() != null) { List<Step> stepsList = getStepDao().getStepsByExternalId(asyncTask.getTaskId()); if (stepsList != null && !stepsList.isEmpty()) { entity.setStartTime(stepsList.get(0).getStartTime()); } updateTaskStepDetails(asyncTask, entity.getStatusSummary().getStatus(), stepsList); if (asyncTask.getStatus() == JobExecutionStatus.ABORTED) { entity.getStatusSummary().setStatus(JobExecutionStatus.ABORTED); } } updateHostIP(entity); return entity; }
Source:
private EnvVars addVarsToBuildEnv(final EnvVars envs, final ArrayList<ParameterValue> vars) { for (ParameterValue p : vars) { envs.putIfNotNull(p.getName(), String.valueOf(p.getValue())); } return envs; }

Target:
private EnvVars addVarsToBuildEnv(final EnvVars envs, final ArrayList<ParameterValue> vars) { for (final ParameterValue p : vars) { envs.putIfNotNull(p.getName(), String.valueOf(p.getValue())); } return envs; }
Source:
public AbstractChannelTypeBuilder(ChannelTypeUID channelTypeUID, String label) { this.channelTypeUID = channelTypeUID; this.label = label; }

Target:
public AbstractChannelTypeBuilder(ChannelTypeUID channelTypeUID, String label) { if (channelTypeUID == null) { throw new IllegalArgumentException("ChannelTypeUID must be set."); } if (StringUtils.isEmpty(label)) { throw new IllegalArgumentException("Label for a ChannelType must not be empty."); } this.channelTypeUID = channelTypeUID; this.label = label; }
Source:
public static void fhirResourceSearchGet(String resourceName) throws IOException, URISyntaxException { CloudHealthcare client = createClient(); HttpClient httpClient = HttpClients.createDefault(); String uri = String.format( "%sv1beta1/%s", client.getRootUrl(), resourceName); URIBuilder uriBuilder = new URIBuilder(uri) .setParameter("access_token", getAccessToken()); HttpUriRequest request = RequestBuilder .get() .setUri(uriBuilder.build()) .addHeader("Content-Type", "application/fhir+json") .addHeader("Accept-Charset", "utf-8") .addHeader("Accept", "application/fhir+json; charset=utf-8") .build(); HttpResponse response = httpClient.execute(request); HttpEntity responseEntity = response.getEntity(); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { System.err.print(String.format( "Exception searching FHIR resources: %s\n", response.getStatusLine().toString())); responseEntity.writeTo(System.err); throw new RuntimeException(); } System.out.println("FHIR resource search results: "); responseEntity.writeTo(System.out); }

Target:
public static void fhirResourceSearchGet(String resourceName) throws IOException, URISyntaxException { CloudHealthcare client = createClient(); HttpClient httpClient = HttpClients.createDefault(); String uri = String.format( "%sv1/%s", client.getRootUrl(), resourceName); URIBuilder uriBuilder = new URIBuilder(uri) .setParameter("access_token", getAccessToken()); HttpUriRequest request = RequestBuilder .get() .setUri(uriBuilder.build()) .addHeader("Content-Type", "application/fhir+json") .addHeader("Accept-Charset", "utf-8") .addHeader("Accept", "application/fhir+json; charset=utf-8") .build(); HttpResponse response = httpClient.execute(request); HttpEntity responseEntity = response.getEntity(); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { System.err.print(String.format( "Exception searching FHIR resources: %s\n", response.getStatusLine().toString())); responseEntity.writeTo(System.err); throw new RuntimeException(); } System.out.println("FHIR resource search results: "); responseEntity.writeTo(System.out); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ColumnStatistics that = (ColumnStatistics) o; return hasNumberOfValues == that.hasNumberOfValues && numberOfValues == that.numberOfValues && Objects.equals(booleanStatistics, that.booleanStatistics) && Objects.equals(integerStatistics, that.integerStatistics) && Objects.equals(doubleStatistics, that.doubleStatistics) && Objects.equals(stringStatistics, that.stringStatistics) && Objects.equals(dateStatistics, that.dateStatistics) && Objects.equals(decimalStatistics, that.decimalStatistics) && Objects.equals(bloomFilter, that.bloomFilter); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ColumnStatistics that = (ColumnStatistics) o; return Objects.equals(hasNumberOfValues, that.hasNumberOfValues) && Objects.equals(getNumberOfValues(), that.getNumberOfValues()) && Objects.equals(booleanStatistics, that.booleanStatistics) && Objects.equals(integerStatistics, that.integerStatistics) && Objects.equals(doubleStatistics, that.doubleStatistics) && Objects.equals(stringStatistics, that.stringStatistics) && Objects.equals(dateStatistics, that.dateStatistics) && Objects.equals(decimalStatistics, that.decimalStatistics) && Objects.equals(bloomFilter, that.bloomFilter); }
Source:
public static CreateServer create(List<String> servers) { return new AutoValue_PrivateNetwork_Server_CreateServer(servers == null ? ImmutableList.<String>of() : servers); }

Target:
public static CreateServer create(List<String> servers) { return new AutoValue_PrivateNetwork_Server_CreateServer(servers == null ? ImmutableList.<String>of() : ImmutableList.copyOf(servers)); }
Source:
default Set<User> calculateCulprits() { Set<User> r = new HashSet<User>(); RunT p = ((RunT)this).getPreviousCompletedBuild(); if (p != null && ((RunT)this).isBuilding()) { Result pr = p.getResult(); if (pr != null && pr.isWorseThan(Result.SUCCESS)) { r.addAll(p.getCulprits()); } } for (ChangeLogSet<? extends ChangeLogSet.Entry> c : getChangeSets()) { for (ChangeLogSet.Entry e : c) r.add(e.getAuthor()); } return r; }

Target:
default Set<User> calculateCulprits() { Set<User> r = new HashSet<>(); RunT p = ((RunT)this).getPreviousCompletedBuild(); if (p != null) { Result pr = p.getResult(); if (pr != null && pr.isWorseThan(Result.SUCCESS)) { r.addAll(p.getCulprits()); } } for (ChangeLogSet<? extends ChangeLogSet.Entry> c : getChangeSets()) { for (ChangeLogSet.Entry e : c) { r.add(e.getAuthor()); } } return r; }
Source:
public static ColumnarArray toColumnarArray(Block block) { requireNonNull(block, "block is null"); if (block instanceof LazyBlock) { return toColumnarArray((LazyBlock) block); } if (block instanceof DictionaryBlock) { return toColumnarArray((DictionaryBlock) block); } if (block instanceof RunLengthEncodedBlock) { return toColumnarArray((RunLengthEncodedBlock) block); } if (!(block instanceof AbstractArrayBlock)) { throw new IllegalArgumentException("Invalid array block: " + block.getClass().getName()); } AbstractArrayBlock arrayBlock = (AbstractArrayBlock) block; Block elementsBlock = arrayBlock.getValues(); int elementsOffset = 0; int elementsLength = 0; if (arrayBlock.getPositionCount() > 0) { elementsOffset = arrayBlock.getOffset(0); elementsLength = arrayBlock.getOffset(arrayBlock.getPositionCount()) - elementsOffset; } elementsBlock = elementsBlock.getRegion(elementsOffset, elementsLength); return new ColumnarArray(block, arrayBlock.getOffsetBase(), arrayBlock.getOffsets(), elementsBlock); }

Target:
public static ColumnarArray toColumnarArray(Block block) { requireNonNull(block, "block is null"); if (block instanceof DictionaryBlock) { return toColumnarArray((DictionaryBlock) block); } if (block instanceof RunLengthEncodedBlock) { return toColumnarArray((RunLengthEncodedBlock) block); } if (!(block instanceof AbstractArrayBlock)) { throw new IllegalArgumentException("Invalid array block: " + block.getClass().getName()); } AbstractArrayBlock arrayBlock = (AbstractArrayBlock) block; Block elementsBlock = arrayBlock.getValues(); int elementsOffset = 0; int elementsLength = 0; if (arrayBlock.getPositionCount() > 0) { elementsOffset = arrayBlock.getOffset(0); elementsLength = arrayBlock.getOffset(arrayBlock.getPositionCount()) - elementsOffset; } elementsBlock = elementsBlock.getRegion(elementsOffset, elementsLength); return new ColumnarArray(block, arrayBlock.getOffsetBase(), arrayBlock.getOffsets(), elementsBlock); }
Source:
private void prepareHandlers() { for (Map.Entry<Class<?>, SortedSet<MessageHandlingMember<? super T>>> typeHandlers : handlerInspector.getAllHandlers().entrySet()) { for (MessageHandlingMember<? super T> handler : typeHandlers.getValue()) { Class<?> type = typeHandlers.getKey(); if (handler.unwrap(CommandMessageHandlingMember.class).isPresent()) { if (Modifier.isAbstract(type.getModifiers()) && handler.unwrap(Constructor.class).isPresent()) { throw new AggregateModellingException(format( "An abstract aggregate %s cannot have @CommandHandler on constructor.", type)); } addHandler(allCommandHandlers, type, handler); } else if (handler.unwrap(CommandHandlerInterceptorHandlingMember.class).isPresent()) { addHandler(allCommandHandlerInterceptors, type, handler); } else { addHandler(allEventHandlers, type, handler); } } } validateCommandHandlers(); }

Target:
private void prepareHandlers() { for (Map.Entry<Class<?>, SortedSet<MessageHandlingMember<? super T>>> handlersPerType : handlerInspector.getAllHandlers().entrySet()) { Class<?> type = handlersPerType.getKey(); for (MessageHandlingMember<? super T> handler : handlersPerType.getValue()) { if (handler.unwrap(CommandMessageHandlingMember.class).isPresent()) { if (Modifier.isAbstract(type.getModifiers()) && handler.unwrap(Constructor.class).isPresent()) { throw new AggregateModellingException(format( "An abstract aggregate %s cannot have @CommandHandler on constructor.", type)); } addHandler(allCommandHandlers, type, handler); } else if (handler.unwrap(CommandHandlerInterceptorHandlingMember.class).isPresent()) { addHandler(allCommandHandlerInterceptors, type, handler); } else { addHandler(allEventHandlers, type, handler); } } } validateCommandHandlers(); }
Source:
default Builder result(ItemStack result) { return result(result.createSnapshot()); }

Target:
default Builder result(ItemStack result) { checkNotNull(result, "result"); return result(result.createSnapshot()); }