auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void cleanupArtifacts() throws Exception { restAPIPublisher.deleteAPI(apiId); }

Target:
public void cleanupArtifacts() throws Exception { restAPIPublisher.deleteAPI(apiId); super.cleanUp(); }
Source:
protected MetaData getNonGeneratedContentMetaData(String parameterName) { MetaData metaData = new MetaData(); Type contentType; if (this.contentDescriptor != null) { contentType = this.contentDescriptor.getType(); } else { contentType = DefaultContentDescriptor.DEFAULT_CONTENT_TYPE; } String converted = this.converterManager.convert(String.class, contentType); metaData.addMetaData(MetaData.NON_GENERATED_CONTENT, converted); metaData.addMetaData(MetaData.PARAMETER_NAME, parameterName); return metaData; }

Target:
protected MetaData getNonGeneratedContentMetaData(String parameterName) { MetaData metaData = new MetaData(); Type contentType; if (this.macroDescriptor != null && this.macroDescriptor.getParameterDescriptorMap() != null && this.macroDescriptor.getParameterDescriptorMap().containsKey(parameterName)) { contentType = this.macroDescriptor.getParameterDescriptorMap().get(parameterName).getDisplayType(); } else { contentType = DefaultParameterDescriptor.DEFAULT_PARAMETER_TYPE; } String converted = this.converterManager.convert(String.class, contentType); metaData.addMetaData(MetaData.NON_GENERATED_CONTENT, converted); metaData.addMetaData(MetaData.PARAMETER_NAME, parameterName); return metaData; }
Source:
protected void updateResourceType(Node node, String resourceType) throws RepositoryException { String currentResourceType = node.getProperty(SLING_RESOURCE_TYPE).getString(); if (!resourceType.equals(currentResourceType)) { logger.info("Updating node at to resource type: {}", node.getPath(), resourceType); node.setProperty(SLING_RESOURCE_TYPE, resourceType); } else { logger.info("Node at is already resource type: {}", node.getPath(), resourceType); } }

Target:
protected void updateResourceType(Node node, String resourceType) throws RepositoryException { boolean hasResourceType = node.hasProperty(SLING_RESOURCE_TYPE); if (!hasResourceType || !resourceType.equals(node.getProperty(SLING_RESOURCE_TYPE).getString())) { logger.info("Updating node at to resource type: {}", node.getPath(), resourceType); node.setProperty(SLING_RESOURCE_TYPE, resourceType); } else { logger.info("Node at is already resource type: {}", node.getPath(), resourceType); } }
Source:
private Scrubber(KeyValueService keyValueService, ScrubberStore scrubberStore, Supplier<Long> backgroundScrubFrequencyMillisSupplier, Supplier<Boolean> isScrubEnabled, Supplier<Long> unreadableTimestampSupplier, Supplier<Long> immutableTimestampSupplier, TransactionService transactionService, final boolean aggressiveScrub, Supplier<Integer> batchSizeSupplier, int threadCount, int readThreadCount, Collection<Follower> followers, MetricsManager metricsManager) { this.keyValueService = keyValueService; this.scrubberStore = scrubberStore; this.backgroundScrubFrequencyMillisSupplier = backgroundScrubFrequencyMillisSupplier; this.isScrubEnabled = isScrubEnabled; this.immutableTimestampSupplier = immutableTimestampSupplier; this.unreadableTimestampSupplier = unreadableTimestampSupplier; this.transactionService = transactionService; this.aggressiveScrub = aggressiveScrub; this.batchSizeSupplier = batchSizeSupplier; this.threadCount = threadCount; this.readThreadCount = readThreadCount; this.followers = followers; this.metricsManager = metricsManager; this.enqueuedCells = metricsManager.registerOrGetMeter(Scrubber.class, AtlasDbMetricNames.ENQUEUED_CELLS); this.scrubbedCells = metricsManager.registerOrGetMeter(Scrubber.class, AtlasDbMetricNames.SCRUBBED_CELLS); this.deletedCells = metricsManager.registerOrGetMeter(Scrubber.class, AtlasDbMetricNames.DELETED_CELLS); this.scrubRetries = metricsManager.registerOrGetMeter(Scrubber.class, AtlasDbMetricNames.SCRUB_RETRIES); NamedThreadFactory threadFactory = new NamedThreadFactory(SCRUBBER_THREAD_PREFIX, true); this.readerExec = PTExecutors.newFixedThreadPool(readThreadCount, threadFactory); this.exec = PTExecutors.newFixedThreadPool(threadCount, threadFactory); }

Target:
private Scrubber(KeyValueService keyValueService, ScrubberStore scrubberStore, Supplier<Long> backgroundScrubFrequencyMillisSupplier, Supplier<Boolean> isScrubEnabled, Supplier<Long> unreadableTimestampSupplier, Supplier<Long> immutableTimestampSupplier, TransactionService transactionService, final boolean aggressiveScrub, Supplier<Integer> batchSizeSupplier, int threadCount, int readThreadCount, Collection<Follower> followers, MetricsManager metricsManager) { this.keyValueService = keyValueService; this.scrubberStore = scrubberStore; this.backgroundScrubFrequencyMillisSupplier = backgroundScrubFrequencyMillisSupplier; this.isScrubEnabled = isScrubEnabled; this.immutableTimestampSupplier = immutableTimestampSupplier; this.unreadableTimestampSupplier = unreadableTimestampSupplier; this.transactionService = transactionService; this.aggressiveScrub = aggressiveScrub; this.batchSizeSupplier = batchSizeSupplier; this.threadCount = threadCount; this.readThreadCount = readThreadCount; this.followers = followers; this.metricsManager = metricsManager; NamedThreadFactory threadFactory = new NamedThreadFactory(SCRUBBER_THREAD_PREFIX, true); this.readerExec = PTExecutors.newFixedThreadPool(readThreadCount, threadFactory); this.exec = PTExecutors.newFixedThreadPool(threadCount, threadFactory); }
Source:
private void toggleFollowStatus(final View followButton) { if (!NetworkUtils.checkConnection(getContext())) { return; } final boolean isAskingToFollow; if (mIsFeed) { isAskingToFollow = !ReaderBlogTable.isFollowedFeed(mFeedId); } else { isAskingToFollow = !ReaderBlogTable.isFollowedBlog(mBlogId); } if (mFollowListener != null) { if (isAskingToFollow && !mIsFeed) { mFollowListener.onFollowTapped( followButton, mBlogInfo.getName(), mBlogInfo.blogId); } else { mFollowListener.onFollowingTapped(); } } ReaderActions.ActionListener listener = new ReaderActions.ActionListener() { @Override public void onActionResult(boolean succeeded) { if (getContext() == null) { return; } mFollowButton.setEnabled(true); if (!succeeded) { int errResId = isAskingToFollow ? R.string.reader_toast_err_follow_blog : R.string.reader_toast_err_unfollow_blog; ToastUtils.showToast(getContext(), errResId); mFollowButton.setIsFollowed(!isAskingToFollow); } } }; mFollowButton.setEnabled(false); boolean result; if (mIsFeed) { result = ReaderBlogActions.followFeedById(mFeedId, isAskingToFollow, listener); } else { result = ReaderBlogActions.followBlogById(mBlogId, isAskingToFollow, listener); } if (result) { mFollowButton.setIsFollowed(isAskingToFollow); } }

Target:
private void toggleFollowStatus(final View followButton) { if (!NetworkUtils.checkConnection(getContext())) { return; } final boolean isAskingToFollow; if (mIsFeed) { isAskingToFollow = !ReaderBlogTable.isFollowedFeed(mFeedId); } else { isAskingToFollow = !ReaderBlogTable.isFollowedBlog(mBlogId); } if (mFollowListener != null) { if (isAskingToFollow) { mFollowListener.onFollowTapped( followButton, mBlogInfo.getName(), mIsFeed ? 0 : mBlogInfo.blogId); } else { mFollowListener.onFollowingTapped(); } } ReaderActions.ActionListener listener = new ReaderActions.ActionListener() { @Override public void onActionResult(boolean succeeded) { if (getContext() == null) { return; } mFollowButton.setEnabled(true); if (!succeeded) { int errResId = isAskingToFollow ? R.string.reader_toast_err_follow_blog : R.string.reader_toast_err_unfollow_blog; ToastUtils.showToast(getContext(), errResId); mFollowButton.setIsFollowed(!isAskingToFollow); } } }; mFollowButton.setEnabled(false); boolean result; if (mIsFeed) { result = ReaderBlogActions.followFeedById(mFeedId, isAskingToFollow, listener); } else { result = ReaderBlogActions.followBlogById(mBlogId, isAskingToFollow, listener); } if (result) { mFollowButton.setIsFollowed(isAskingToFollow); } }
Source:
protected String computeRedirectionToServer(final HttpServletRequest request) { final String relayStateValue = CommonUtils.safeGetParameter(request, this.relayStateParameterName); if (StringUtils.isNotBlank(relayStateValue)) { final StringBuffer buffer = new StringBuffer(); buffer.append(casServerUrlPrefix); if (!this.casServerUrlPrefix.endsWith("/")) { buffer.append("/"); } buffer.append("logout?_eventId=next&"); buffer.append(this.relayStateParameterName); buffer.append("="); buffer.append(CommonUtils.urlEncode(relayStateValue)); final String redirectUrl = buffer.toString(); logger.debug("Redirection url to the CAS server: {}", redirectUrl); return redirectUrl; } return null; }

Target:
private String computeRedirectionToServer(final HttpServletRequest request) { final String relayStateValue = CommonUtils.safeGetParameter(request, this.relayStateParameterName); if (StringUtils.isNotBlank(relayStateValue)) { final StringBuilder buffer = new StringBuilder(); buffer.append(casServerUrlPrefix); if (!this.casServerUrlPrefix.endsWith("/")) { buffer.append("/"); } buffer.append("logout?_eventId=next&"); buffer.append(this.relayStateParameterName); buffer.append("="); buffer.append(CommonUtils.urlEncode(relayStateValue)); final String redirectUrl = buffer.toString(); logger.debug("Redirection url to the CAS server: {}", redirectUrl); return redirectUrl; } return null; }
Source:
protected ProxyGrantingTicket produceTicketWithAdequateExpirationPolicy( final RegisteredServiceProxyGrantingTicketExpirationPolicy servicePgtPolicy, final ServiceTicket serviceTicket, final Authentication authentication, final String pgtId) { if (servicePgtPolicy != null) { LOGGER.debug("Overriding PGT policy with the specific policy: {}", servicePgtPolicy); return serviceTicket.grantProxyGrantingTicket(pgtId, authentication, new HardTimeoutExpirationPolicy(servicePgtPolicy.getMaxTimeToLiveInSeconds())); } else { LOGGER.debug("Using default TGT policy for PGT"); return serviceTicket.grantProxyGrantingTicket(pgtId, authentication, this.ticketGrantingTicketExpirationPolicy.buildTicketExpirationPolicy()); } }

Target:
protected ProxyGrantingTicket produceTicketWithAdequateExpirationPolicy( final RegisteredServiceProxyGrantingTicketExpirationPolicy servicePgtPolicy, final ServiceTicket serviceTicket, final Authentication authentication, final String pgtId) { if (servicePgtPolicy != null) { LOGGER.trace("Overriding proxy-granting ticket policy with the specific policy: [{}]", servicePgtPolicy); return serviceTicket.grantProxyGrantingTicket(pgtId, authentication, new HardTimeoutExpirationPolicy(servicePgtPolicy.getMaxTimeToLiveInSeconds())); } LOGGER.trace("Using default ticket-granting ticket policy for proxy-granting ticket"); return serviceTicket.grantProxyGrantingTicket(pgtId, authentication, this.ticketGrantingTicketExpirationPolicy.buildTicketExpirationPolicy()); }
Source:
public boolean shouldJetify(String group, String name, String packaging) { if (aarOnly && packaging.equals(ExternalDependency.JAR)) { return false; } return enableJetifier && getExcludePatterns() .stream() .noneMatch(pattern -> pattern.matcher(group + ":" + name).matches()); }

Target:
public boolean shouldJetify(String group, String name, String packaging) { if (!enableJetifier) { return false; } if (aarOnly && packaging.equals(ExternalDependency.JAR)) { return false; } return getExcludePatterns() .stream() .noneMatch(pattern -> pattern.matcher(group + ":" + name).matches()); }
Source:
public void passThrough_ProxyProtocolEnabled_nonProxyBytes() { EmbeddedChannel channel = new EmbeddedChannel(); channel.pipeline().addLast(ElbProxyProtocolChannelHandler.NAME, new ElbProxyProtocolChannelHandler( true)); ByteBuf buf = Unpooled.wrappedBuffer( "TCP4 192.168.0.1 124.123.111.111 10008 443\r\n".getBytes(StandardCharsets.US_ASCII)); channel.writeInbound(buf); Object dropped = channel.readInbound(); assertEquals(dropped, buf); assertNull(channel.pipeline().context(ElbProxyProtocolChannelHandler.NAME)); assertNull(channel.pipeline().context("HAProxyMessageChannelHandler")); assertNull(channel.attr(HAProxyMessageChannelHandler.ATTR_HAPROXY_VERSION).get()); assertNull(channel.attr(HAProxyMessageChannelHandler.ATTR_HAPROXY_MESSAGE).get()); assertNull(channel.attr(SourceAddressChannelHandler.ATTR_LOCAL_ADDRESS).get()); assertNull(channel.attr(SourceAddressChannelHandler.ATTR_LOCAL_ADDR).get()); assertNull(channel.attr(SourceAddressChannelHandler.ATTR_LOCAL_PORT).get()); assertNull(channel.attr(SourceAddressChannelHandler.ATTR_SOURCE_ADDRESS).get()); assertNull(channel.attr(SourceAddressChannelHandler.ATTR_SOURCE_PORT).get()); assertNull(channel.attr(SourceAddressChannelHandler.ATTR_REMOTE_ADDR).get()); }

Target:
public void passThrough_ProxyProtocolEnabled_nonProxyBytes() { EmbeddedChannel channel = new EmbeddedChannel(); channel.pipeline().addLast(ElbProxyProtocolChannelHandler.NAME, new ElbProxyProtocolChannelHandler(true)); ByteBuf buf = Unpooled.wrappedBuffer( "TCP4 192.168.0.1 124.123.111.111 10008 443\r\n".getBytes(StandardCharsets.US_ASCII)); channel.writeInbound(buf); Object dropped = channel.readInbound(); assertEquals(dropped, buf); buf.release(); assertNull(channel.pipeline().context(ElbProxyProtocolChannelHandler.NAME)); assertNull(channel.pipeline().context("HAProxyMessageChannelHandler")); assertNull(channel.attr(HAProxyMessageChannelHandler.ATTR_HAPROXY_VERSION).get()); assertNull(channel.attr(HAProxyMessageChannelHandler.ATTR_HAPROXY_MESSAGE).get()); assertNull(channel.attr(SourceAddressChannelHandler.ATTR_LOCAL_ADDRESS).get()); assertNull(channel.attr(SourceAddressChannelHandler.ATTR_LOCAL_ADDR).get()); assertNull(channel.attr(SourceAddressChannelHandler.ATTR_LOCAL_PORT).get()); assertNull(channel.attr(SourceAddressChannelHandler.ATTR_SOURCE_ADDRESS).get()); assertNull(channel.attr(SourceAddressChannelHandler.ATTR_SOURCE_PORT).get()); assertNull(channel.attr(SourceAddressChannelHandler.ATTR_REMOTE_ADDR).get()); }
Source:
private boolean authenticate() throws HttpAuthenticationException { List<HttpServerAuthenticationMechanism> authenticationMechanisms = mechanismSupplier.get(); responders = new ArrayList<>(authenticationMechanisms.size()); try { for (HttpServerAuthenticationMechanism nextMechanism : authenticationMechanisms) { currentMechanism = nextMechanism; nextMechanism.evaluateRequest(this); if (isAuthenticated()) { if (successResponder != null) { statusCodeAllowed = true; successResponder.sendResponse(this); if (statusCode > 0) { httpExchangeSpi.setStatusCode(statusCode); return false; } } return true; } } currentMechanism = null; if (required || (authenticationAttempted && ignoreOptionalFailures == false)) { statusCodeAllowed = true; if (responders.size() > 0) { boolean statusSet = false; for (HttpServerMechanismsResponder responder : responders) { responder.sendResponse(this); if (statusSet == false && statusCode > 0 && statusCode != OK) { httpExchangeSpi.setStatusCode(statusCode); statusSet = true; } } if (statusSet == false) { httpExchangeSpi.setStatusCode(OK); } } else { httpExchangeSpi.setStatusCode(FORBIDDEN); } return false; } return true; } finally { authenticationMechanisms.forEach(m -> { m.dispose(); }); } }

Target:
private boolean authenticate() throws HttpAuthenticationException { List<HttpServerAuthenticationMechanism> authenticationMechanisms = mechanismSupplier.get(); responders = new ArrayList<>(authenticationMechanisms.size()); try { for (HttpServerAuthenticationMechanism nextMechanism : authenticationMechanisms) { currentMechanism = nextMechanism; nextMechanism.evaluateRequest(this); if (isAuthenticated()) { if (successResponder != null) { statusCodeAllowed = true; successResponder.sendResponse(this); if (statusCode > 0) { httpExchangeSpi.setStatusCode(statusCode); return false; } } return true; } } currentMechanism = null; if (required || (authenticationAttempted && ignoreOptionalFailures == false)) { statusCodeAllowed = true; if (responders.size() > 0) { boolean statusSet = false; for (HttpServerMechanismsResponder responder : responders) { responder.sendResponse(this); if (statusSet == false && statusCode > 0 && statusCode != OK) { httpExchangeSpi.setStatusCode(statusCode); statusSet = true; } } if (statusSet == false) { httpExchangeSpi.setStatusCode(OK); } } else { httpExchangeSpi.setStatusCode(FORBIDDEN); } return false; } return true; } finally { authenticationMechanisms.forEach(m -> m.dispose()); } }
Source:
public AuditLogType getAuditLogTypeValue() { if(getSucceeded()) { return (VMStatus) getActionReturnValue() == VMStatus.Up ? AuditLogType.VM_MIGRATION_DONE : AuditLogType.VM_MIGRATION_START; } else { if(_isRerun) { return AuditLogType.VM_MIGRATION_TRYING_RERUN; } else { return getVds().getstatus() == VDSStatus.PreparingForMaintenance ? AuditLogType.VM_MIGRATION_FAILED_DURING_MOVE_TO_MAINTANANCE : AuditLogType.VM_MIGRATION_FAILED; } } }

Target:
public AuditLogType getAuditLogTypeValue() { if (getSucceeded()) { return (VMStatus) getActionReturnValue() == VMStatus.Up ? AuditLogType.VM_MIGRATION_DONE : AuditLogType.VM_MIGRATION_START; } if (getActionReturnValue() == VMStatus.MigratingFrom) { return AuditLogType.VM_MIGRATION_START; } if (_isRerun) { return AuditLogType.VM_MIGRATION_TRYING_RERUN; } return getVds().getstatus() == VDSStatus.PreparingForMaintenance ? AuditLogType.VM_MIGRATION_FAILED_DURING_MOVE_TO_MAINTANANCE : AuditLogType.VM_MIGRATION_FAILED; }
Source:
public Collection<E> makeConfirmedCollection() { final ArrayList<E> list = new ArrayList<>(); return list; }

Target:
public Collection<E> makeConfirmedCollection() { return new ArrayList<>(); }
Source:
public EntityBuilder newBuilder(String prefabName) { if (prefabName != null && !prefabName.isEmpty()) { Prefab prefab = entityManager.getPrefabManager().getPrefab(prefabName); if (prefab == null) { logger.warn("Unable to instantiate unknown prefab: \"{}\"", prefabName); return new EntityBuilder(this); } return newBuilder(prefab); } return newBuilder(); }

Target:
public EntityBuilder newBuilder(String prefabName) { EntityBuilder builder = newBuilder(); if (!builder.addPrefab(prefabName)) { logger.warn("Unable to instantiate unknown prefab: \"{}\"", prefabName); } return builder; }
Source:
private InsertType updateDropInteraction(int dropAction, @Nullable Transferable transferable) { DragDropInteraction interaction = (DragDropInteraction)myCurrentInteraction; assert interaction != null; if (transferable == null) { return null; } DnDTransferItem item = NlModel.getTransferItem(transferable, false ); if (item == null) { return null; } ScreenView screenView = mySurface.getScreenView(myLastMouseX, myLastMouseY); if (screenView == null) { return null; } NlModel model = screenView.getModel(); DragType dragType = dropAction == DnDConstants.ACTION_COPY ? DragType.COPY : DragType.MOVE; InsertType insertType = model.determineInsertType(dragType, item, false ); interaction.setType(dragType); interaction.setTransferItem(item); List<NlComponent> dragged = interaction.getDraggedComponents(); List<NlComponent> components; if (insertType.isMove()) { components = model.getSelectionModel().getSelection(); } else { components = model.createComponents(screenView, item, insertType); if (components == null) { return null; } } if (dragged.size() != components.size()) { return null; } for (int index=0; index < dragged.size(); index++) { components.get(index).x = dragged.get(index).x; components.get(index).y = dragged.get(index).y; } dragged.clear(); dragged.addAll(components); return insertType; }

Target:
private InsertType updateDropInteraction(int dropAction, @Nullable Transferable transferable) { DragDropInteraction interaction = (DragDropInteraction)myCurrentInteraction; assert interaction != null; if (transferable == null) { return null; } DnDTransferItem item = NlModel.getTransferItem(transferable, false ); if (item == null) { return null; } ScreenView screenView = mySurface.getScreenView(myLastMouseX, myLastMouseY); if (screenView == null) { return null; } NlModel model = screenView.getModel(); DragType dragType = dropAction == DnDConstants.ACTION_COPY ? DragType.COPY : DragType.MOVE; InsertType insertType = model.determineInsertType(dragType, item, false ); interaction.setType(dragType); interaction.setTransferItem(item); List<NlComponent> dragged = interaction.getDraggedComponents(); List<NlComponent> components; if (insertType.isMove()) { components = model.getSelectionModel().getSelection(); } else { components = model.createComponents(screenView, item, insertType); if (components == null) { return null; } } if (dragged.size() != components.size()) { throw new AssertionError("Problem with drop: dragged.size != components.size"); } for (int index = 0; index < dragged.size(); index++) { components.get(index).x = dragged.get(index).x; components.get(index).y = dragged.get(index).y; } dragged.clear(); dragged.addAll(components); return insertType; }
Source:
public MergeableInfo apply(RevisionResource resource) throws AuthException, ResourceConflictException, BadRequestException, OrmException, IOException { Change change = resource.getChange(); change.getProject(); PatchSet ps = resource.getPatchSet(); MergeableInfo result = new MergeableInfo(); if (!change.getStatus().isOpen()) { throw new ResourceConflictException("change is " + Submit.status(change)); } else if (!ps.getId().equals(change.currentPatchSetId())) { return result; } result.submitType = submitType.apply(resource); result.mergeable = change.isMergeable(); Repository git = gitManager.openRepository(change.getProject()); try { Map<String, Ref> refs = git.getRefDatabase().getRefs(RefDatabase.ALL); Ref ref = refs.get(change.getDest().get()); if (force || isStale(change, ref)) { result.mergeable = refresh(change, ps, result.submitType, git, refs, ref); } if (otherBranches) { result.mergeableInto = new ArrayList<>(); ProjectConfig cfg = projectCache.get(change.getProject()).getConfig(); BranchOrderSection branchOrder = cfg.getBranchOrderSection(); int prefixLen = Constants.R_HEADS.length(); for (String n : branchOrder.getMoreStable(ref.getName())) { Ref other = git.getRef(n); if (isMergeable(change, ps, SubmitType.CHERRY_PICK, git, refs, other)) { result.mergeableInto.add(other.getName().substring(prefixLen)); } } } } finally { git.close(); } return result; }

Target:
public MergeableInfo apply(RevisionResource resource) throws AuthException, ResourceConflictException, BadRequestException, OrmException, IOException { Change change = resource.getChange(); PatchSet ps = resource.getPatchSet(); MergeableInfo result = new MergeableInfo(); if (!change.getStatus().isOpen()) { throw new ResourceConflictException("change is " + Submit.status(change)); } else if (!ps.getId().equals(change.currentPatchSetId())) { return result; } result.submitType = submitType.apply(resource); result.mergeable = change.isMergeable(); Repository git = gitManager.openRepository(change.getProject()); try { Map<String, Ref> refs = git.getRefDatabase().getRefs(RefDatabase.ALL); Ref ref = refs.get(change.getDest().get()); if (force || isStale(change, ref)) { result.mergeable = refresh(change, ps, result.submitType, git, refs, ref); } if (otherBranches) { result.mergeableInto = new ArrayList<>(); BranchOrderSection branchOrder = projectCache.get(change.getProject()).getBranchOrderSection(); if (branchOrder != null) { int prefixLen = Constants.R_HEADS.length(); for (String n : branchOrder.getMoreStable(ref.getName())) { Ref other = refs.get(n); if (other == null) { continue; } if (isMergeable(change, ps, SubmitType.CHERRY_PICK, git, refs, other)) { result.mergeableInto.add(other.getName().substring(prefixLen)); } } } } } finally { git.close(); } return result; }
Source:
private void createBranchesArea(Composite parent, FormToolkit toolkit, int span) { branchSection = createSection(parent, toolkit, span); branchSection.setText(UIText.CommitEditorPage_SectionBranchesEmpty); Composite branchesArea = createSectionClient(branchSection, toolkit); branchViewer = new TableViewer(toolkit.createTable(branchesArea, SWT.V_SCROLL | SWT.H_SCROLL)); Control control = branchViewer.getControl(); if (control != null) { control.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER); GridDataFactory.fillDefaults().grab(true, true) .hint(SWT.DEFAULT, 50).applyTo(control); addToFocusTracking(control); } branchViewer.setSorter(new ViewerSorter()); branchViewer.setLabelProvider(new GitLabelProvider() { @Override public String getText(Object element) { return Repository.shortenRefName(super.getText(element)); } }); branchViewer.setContentProvider(ArrayContentProvider.getInstance()); updateSectionClient(branchSection, branchesArea, toolkit); }

Target:
private void createBranchesArea(Composite parent, FormToolkit toolkit, int span) { branchSection = createSection(parent, toolkit, span); branchSection.setText(UIText.CommitEditorPage_SectionBranchesEmpty); Composite branchesArea = createSectionClient(branchSection, toolkit); branchViewer = new TableViewer(toolkit.createTable(branchesArea, SWT.V_SCROLL | SWT.H_SCROLL)); Control control = branchViewer.getControl(); control.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER); GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 50) .applyTo(control); addToFocusTracking(control); branchViewer.setSorter(new ViewerSorter()); branchViewer.setLabelProvider(new GitLabelProvider() { @Override public String getText(Object element) { return Repository.shortenRefName(super.getText(element)); } }); branchViewer.setContentProvider(ArrayContentProvider.getInstance()); updateSectionClient(branchSection, branchesArea, toolkit); }
Source:
public Builder maxEntries(int maxEntries) { if (maxEntries == 0) throw new NullPointerException("maxEntries == 0"); this.maxEntries = maxEntries; return this; }

Target:
public Builder maxEntries(int maxEntries) { if (maxEntries <= 0) throw new IllegalArgumentException("maxEntries <= 0"); this.maxEntries = maxEntries; return this; }
Source:
TotpAuthenticator(BukkitService bukkitService) { this(new GoogleAuthenticator(), bukkitService); }

Target:
TotpAuthenticator(BukkitService bukkitService) { this.authenticator = createGoogleAuthenticator(); this.bukkitService = bukkitService; }
Source:
long getsurePressReleaseProc (long gesture, int n_press, double x, double y, long user_data) { long event = GTK.gtk_get_current_event(); long result = 0; switch ((int) user_data) { case GESTURE_PRESSED: result = gtk_gesture_press_event(gesture, n_press, x, y); break; case GESTURE_RELEASED: result = gtk_gesture_release_event(gesture, n_press, x, y); break; } gdk_event_free(event); return result; }

Target:
long getsurePressReleaseProc (long gesture, int n_press, double x, double y, long user_data) { long event = GTK.gtk_get_current_event(); long result = 0; switch ((int) user_data) { case GESTURE_PRESSED: result = gtk_gesture_press_event(gesture, n_press, x, y, event); break; case GESTURE_RELEASED: result = gtk_gesture_release_event(gesture, n_press, x, y, event); break; } gdk_event_free(event); return result; }
Source:
void receiveTwoMessagesAndComplete(MessagingEntityType entityType, boolean isSessionEnabled) { setSenderAndReceiver(entityType, isSessionEnabled); int maxMessages = 2; final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, isSessionEnabled); sendMessage(message); sendMessage(message); IterableStream<ServiceBusReceivedMessage> messages = receiver.receive(maxMessages, TIMEOUT); final List<ServiceBusReceivedMessage> asList = messages.stream().collect(Collectors.toList()); assertEquals(maxMessages, asList.size()); for (ServiceBusReceivedMessage receivedMessage : asList) { assertMessageEquals(receivedMessage, messageId, isSessionEnabled); receiver.complete(receivedMessage); messagesPending.decrementAndGet(); } }

Target:
void receiveTwoMessagesAndComplete(MessagingEntityType entityType, boolean isSessionEnabled) { setSenderAndReceiver(entityType, isSessionEnabled); int maxMessages = 2; final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, isSessionEnabled); sendMessage(message); sendMessage(message); IterableStream<ServiceBusReceivedMessage> messages = receiver.receive(maxMessages, TIMEOUT); int receivedMessageCount = 0; for (ServiceBusReceivedMessage receivedMessage : messages) { assertMessageEquals(receivedMessage, messageId, isSessionEnabled); receiver.complete(receivedMessage); messagesPending.decrementAndGet(); ++receivedMessageCount; } assertEquals(maxMessages, receivedMessageCount); }
Source:
public List<RpslObject> handleAutNumQuery(final Query query, final HttpServletRequest request) { final int contextId = System.identityHashCode(Thread.currentThread()); final InetAddress remoteAddress = InetAddresses.forString(request.getRemoteAddr()); final List<RpslObject> resultAutNum = Lists.newArrayList(); final List<RpslObject> resultAsBlock = Lists.newArrayList(); try { queryHandler.streamResults(query, remoteAddress, contextId, new ApiResponseHandler() { @Override public void handle(final ResponseObject responseObject) { if (responseObject instanceof RpslObject && ((RpslObject) responseObject).getType() == AUT_NUM) { resultAutNum.add((RpslObject) responseObject); } else if(responseObject instanceof RpslObject && ((RpslObject) responseObject).getType() == AS_BLOCK) { resultAsBlock.add((RpslObject) responseObject); } } }); return resultAutNum.isEmpty() ? resultAsBlock : resultAutNum; } catch (final QueryException e) { if (e.getCompletionInfo() == QueryCompletionInfo.BLOCKED) { throw tooManyRequests(); } else { LOGGER.error(e.getMessage(), e); throw new IllegalStateException("query error"); } } }

Target:
public List<RpslObject> handleAutNumQuery(final Query query, final HttpServletRequest request) { final InetAddress remoteAddress = InetAddresses.forString(request.getRemoteAddr()); final List<RpslObject> resultAutNum = Lists.newArrayList(); final List<RpslObject> resultAsBlock = Lists.newArrayList(); try { queryHandler.streamResults(query, remoteAddress, 0, new ApiResponseHandler() { @Override public void handle(final ResponseObject responseObject) { if (responseObject instanceof RpslObject) { ObjectType objectType = ((RpslObject) responseObject).getType(); switch (objectType) { case AUT_NUM: { resultAutNum.add((RpslObject) responseObject); break; } case AS_BLOCK: { resultAsBlock.add((RpslObject) responseObject); break; } default: { throw new UnexpectedException("Expected AUT_NUM or AS_Block but found " + objectType); } } } } }); return resultAutNum.isEmpty() ? resultAsBlock : resultAutNum; } catch (final QueryException e) { if (e.getCompletionInfo() == QueryCompletionInfo.BLOCKED) { throw tooManyRequests(); } else { LOGGER.error(e.getMessage(), e); throw new IllegalStateException("query error"); } } }
Source:
public void shouldExistEnumHashToValueMapping() throws Exception { for (Map.Entry<Locator, List<IMetric>> entry : locatorToMetrics.entrySet()) { Locator locator = entry.getKey(); List<IMetric> metrics = entry.getValue(); for (IMetric metric : metrics) { datastaxEnumIO.putAsync(locator, metric.getCollectionTime(), (BluefloodEnumRollup) metric.getMetricValue(), Granularity.FULL); } } AstyanaxReader reader = AstyanaxReader.getInstance(); final List<Locator> locators = new ArrayList<Locator>() {{ addAll(locatorToMetrics.keySet()); }}; Map<Locator, List<String>> mapping = reader.getEnumStringMappings(locators); org.junit.Assert.assertEquals("locator -> enum string mapping size", locatorToMetrics.size(), mapping.size()); for (Map.Entry<Locator, List<String>> entry : mapping.entrySet()) { List<String> enumValues = entry.getValue(); assertTrue(String.format("metrics size for locator %s is not bigger than possible enum values defined for these tests", entry.getKey()), enumValues.size() <= enumValueList.size()); } }

Target:
public void shouldExistEnumHashToValueMapping() throws Exception { for (Map.Entry<Locator, List<IMetric>> entry : locatorToMetrics.entrySet()) { Locator locator = entry.getKey(); List<IMetric> metrics = entry.getValue(); for (IMetric metric : metrics) { ResultSetFuture future = datastaxEnumIO.putAsync(locator, metric.getCollectionTime(), (BluefloodEnumRollup) metric.getMetricValue(), Granularity.FULL); future.get().all(); } } AstyanaxReader reader = AstyanaxReader.getInstance(); final List<Locator> locators = new ArrayList<Locator>() {{ addAll(locatorToMetrics.keySet()); }}; Map<Locator, List<String>> mapping = reader.getEnumStringMappings(locators); assertEquals("locator -> enum string mapping size", locatorToMetrics.size(), mapping.size()); for (Map.Entry<Locator, List<String>> entry : mapping.entrySet()) { List<String> enumValues = entry.getValue(); assertTrue(String.format("metrics size for locator %s is not bigger than possible enum values defined for these tests", entry.getKey()), enumValues.size() <= enumValueList.size()); } }
Source:
public void testConcat() throws Exception { FileSystem mockFs = Mockito.mock(FileSystem.class); Mockito.doAnswer(invocation -> { Object[] args = invocation.getArguments(); Path target = (Path)args[0]; Path[] src = (Path[]) args[1]; mockConcat(target, src); return null; }).when(mockFs).concat(any(Path.class), any(Path[].class)); Concat.setTstFs(mockFs); shellRun(0, "-concat", dstPath.toString(), testRootDir+"/file-*"); assertTrue(lfs.exists(dstPath)); assertEquals(1, lfs.listStatus(testRootDir).length); }

Target:
public void testConcat() throws Exception { ByteArrayOutputStream out = new ByteArrayOutputStream(); for (int i = 0; i < 10; i++) { try (InputStream in = lfs .open(new Path(testRootDir, String.format("file-%02d", i)))) { IOUtils.copyBytes(in, out, 1024); } } byte[] expectContent = out.toByteArray(); FileSystem mockFs = Mockito.mock(FileSystem.class); Mockito.doAnswer(invocation -> { Object[] args = invocation.getArguments(); Path target = (Path)args[0]; Path[] src = (Path[]) args[1]; mockConcat(target, src); return null; }).when(mockFs).concat(any(Path.class), any(Path[].class)); Concat.setTestFs(mockFs); shellRun(0, "-concat", dstPath.toString(), testRootDir+"/file-*"); ContractTestUtils .assertPathExists(lfs, "The target file doesn't exist.", dstPath); Assertions.assertThat(lfs.listStatus(testRootDir).length).isEqualTo(1); assertEquals(expectContent.length, lfs.getFileStatus(dstPath).getLen()); out = new ByteArrayOutputStream(); try (InputStream in = lfs.open(dstPath)) { IOUtils.copyBytes(in, out, 1024); } byte[] concatedContent = out.toByteArray(); assertEquals(expectContent.length, concatedContent.length); ContractTestUtils.compareByteArrays(expectContent, concatedContent, expectContent.length); }
Source:
public void parseArguments(List<String> argsList) throws Exception { args = new ParametersParser( Util.loadProperties(getClass(), "arguments.properties") ).parse(argsList); }

Target:
public void parseArguments(List<String> argsList) throws Exception { args = new ParametersParser( getClass().getResourceAsStream("arguments.properties") ).parse(argsList); }
Source:
public CaseModelQuerySetMatcher(String modelId, Map<Integer, Integer> multiplicityMap) { caseDbRoot = XPathReference.getPathExpr("instance('" + modelId + "')/casedb/case").getReference(); caseDbRoot.setMultiplicity(0, 0); this.multiplicityMap = multiplicityMap; membershipIndexes = new Vector<>(); membershipIndexes.add(CaseInstanceTreeElement.CASE_ID_EXPR); membershipIndexes.add(CaseInstanceTreeElement.CASE_ID_EXPR_TWO); querySetTransforms.add(new CaseIdentityQuerySetTransform()); }

Target:
private CaseModelQuerySetMatcher(String modelId, Map<Integer, Integer> multiplicityMap) { caseDbRoot = XPathReference.getPathExpr("instance('" + modelId + "')/casedb/case").getReference(); caseDbRoot.setMultiplicity(0, 0); this.multiplicityMap = multiplicityMap; membershipIndexes = new Vector<>(); membershipIndexes.add(CaseInstanceTreeElement.CASE_ID_EXPR); membershipIndexes.add(CaseInstanceTreeElement.CASE_ID_EXPR_TWO); addQuerySetTransform(new CaseIdentityQuerySetTransform()); }
Source:
protected void configure() { System.out.println("JunitGuiceModule binder"); newSetBinder(binder(), TestRunner.class).addBinding().to(JUnitTestRunner.class); }

Target:
protected void configure() { newSetBinder(binder(), TestRunner.class).addBinding().to(JUnitTestRunner.class); }
Source:
public void shouldReturnExpectedAccessibilityServiceList() throws Exception { List<ServiceInfo> expected = new ArrayList<>(Arrays.asList(new ServiceInfo())); shadowAccessibilityManager.setAccessibilityServiceList(expected); assertThat(getAccessibilityManager().getAccessibilityServiceList()).isEqualTo(expected); }

Target:
public void shouldReturnExpectedAccessibilityServiceList() { List<ServiceInfo> expected = new ArrayList<>(Arrays.asList(new ServiceInfo())); shadowAccessibilityManager.setAccessibilityServiceList(expected); assertThat(accessibilityManager.getAccessibilityServiceList()).isEqualTo(expected); }
Source:
protected void onReveal() { super.onReveal(); commonModelProvider.get().setUiPluginTabSelected(this.getProxy().getNameToken()); }

Target:
protected void onReveal() { super.onReveal(); commonModelProvider.get().setPluginTabSelected(getProxy().getTargetHistoryToken()); }
Source:
public void create(final String identifier, final ServerSideConfiguration config) throws EntityAlreadyExistsException, EhcacheEntityCreationException, EhcacheEntityBusyException, TimeoutException { Hold existingMaintenance = maintenanceHolds.get(identifier); Hold localMaintenance = null; if (existingMaintenance == null) { localMaintenance = createAccessLockFor(identifier).tryWriteLock(); } if (existingMaintenance == null && localMaintenance == null) { throw new EhcacheEntityBusyException("Unable to create clustered tier manager for id " + identifier + ": another client owns the maintenance lease"); } else { try { EntityRef<EhcacheClientEntity, UUID> ref = getEntityRef(identifier); try { while (true) { ref.create(UUID.randomUUID()); try { EhcacheClientEntity entity = ref.fetchEntity(); try { entity.setTimeouts(entityTimeouts); entity.configure(config); return; } finally { entity.close(); } } catch (ClusteredTierManagerConfigurationException e) { try { ref.tryDestroy(); } catch (EntityNotFoundException f) { } throw new EhcacheEntityCreationException("Unable to configure clustered tier manager for id " + identifier, e); } catch (EntityNotFoundException e) { } } } catch (EntityNotProvidedException e) { LOGGER.error("Unable to create clustered tier manager for id {}", identifier, e); throw new AssertionError(e); } catch (EntityVersionMismatchException e) { LOGGER.error("Unable to create clustered tier manager for id {}", identifier, e); throw new AssertionError(e); } } finally { if (localMaintenance != null) { localMaintenance.unlock(); } } } }

Target:
public void create(final String identifier, final ServerSideConfiguration config) throws EntityAlreadyExistsException, EhcacheEntityCreationException, EntityBusyException, TimeoutException { Hold existingMaintenance = maintenanceHolds.get(identifier); Hold localMaintenance = null; if (existingMaintenance == null) { localMaintenance = createAccessLockFor(identifier).tryWriteLock(); } if (existingMaintenance == null && localMaintenance == null) { throw new EntityBusyException("Unable to create clustered tier manager for id " + identifier + ": another client owns the maintenance lease"); } else { try { EntityRef<EhcacheClientEntity, UUID> ref = getEntityRef(identifier); try { while (true) { ref.create(UUID.randomUUID()); try { EhcacheClientEntity entity = ref.fetchEntity(); try { entity.setTimeouts(entityTimeouts); entity.configure(config); return; } finally { entity.close(); } } catch (ClusteredTierManagerConfigurationException e) { try { ref.tryDestroy(); } catch (EntityNotFoundException f) { } throw new EhcacheEntityCreationException("Unable to configure clustered tier manager for id " + identifier, e); } catch (EntityNotFoundException e) { } } } catch (EntityNotProvidedException e) { LOGGER.error("Unable to create clustered tier manager for id {}", identifier, e); throw new AssertionError(e); } catch (EntityVersionMismatchException e) { LOGGER.error("Unable to create clustered tier manager for id {}", identifier, e); throw new AssertionError(e); } } finally { if (localMaintenance != null) { localMaintenance.unlock(); } } } }
Source:
public static void loadToStore(KeyStore keyStore, char[] keyStorePassword, String keyStorePath) throws KeyStoreGenerationException { FileInputStream fileInputStream = null; try { if (keyStorePath != null) { fileInputStream = new FileInputStream(keyStorePath); keyStore.load(fileInputStream, keyStorePassword); } } catch (NoSuchAlgorithmException e) { String msg = "Requested cryptographic algorithm is not available in the environment."; logger.error(msg, e); throw new KeyStoreGenerationException(msg, e); } catch (CertificateException e) { String msg = "Error working with certificate related to, " + keyStorePath; logger.error(msg, e); throw new KeyStoreGenerationException(msg, e); } catch (IOException e) { String msg = "File error while working with file, " + keyStorePath; logger.error(msg, e); throw new KeyStoreGenerationException(msg, e); } finally { try { if (fileInputStream != null) { fileInputStream.close(); } } catch (IOException e) { String msg = "File error while closing the file, " + keyStorePath; logger.error(msg, e); throw new KeyStoreGenerationException(msg,e); } } }

Target:
public static void loadToStore(KeyStore keyStore, char[] keyStorePassword, String keyStorePath) throws KeyStoreGenerationException { FileInputStream fileInputStream = null; try { if (keyStorePath != null) { fileInputStream = new FileInputStream(keyStorePath); keyStore.load(fileInputStream, keyStorePassword); } } catch (NoSuchAlgorithmException e) { throw new KeyStoreGenerationException( "Requested cryptographic algorithm is not available in the environment.", e); } catch (CertificateException e) { throw new KeyStoreGenerationException("Error working with certificate related to, " + keyStorePath, e); } catch (IOException e) { throw new KeyStoreGenerationException("File error while working with file, " + keyStorePath, e); } finally { try { if (fileInputStream != null) { fileInputStream.close(); } } catch (IOException e) { throw new KeyStoreGenerationException("File error while closing the file, " + keyStorePath,e); } } }
Source:
public int bruteForceSite(SiteNode siteNode, File payloadFile) { ScanTarget scanTarget = createScanTarget(siteNode); BruteForce bf = this.startScan(scanTarget, null, payloadFile, false); return bf.getScanId(); }

Target:
public int bruteForceSite(SiteNode siteNode, File payloadFile) { if (siteNode == null) { throw new IllegalArgumentException("Null site node supplied"); } ScanTarget scanTarget = createScanTarget(siteNode); BruteForce bf = this.startScan(scanTarget, null, payloadFile, false); return bf.getScanId(); }
Source:
ReferencedEnvelope initTileRequest(ReferencedEnvelope bbox, int width, int height, String time) throws IOException { ReferencedEnvelope gridEnvelope = bbox; String requestSrs = srsName; try { String code = null; Integer epsgCode = CRS.lookupEpsgCode(bbox.getCoordinateReferenceSystem(), false); if (epsgCode != null) { code = "EPSG:" + epsgCode; } else { code = CRS.lookupIdentifier(bbox.getCoordinateReferenceSystem(), false); } if (code != null && validSRS.contains(code)) { requestSrs = code; } else { gridEnvelope = bbox.transform(getCoordinateReferenceSystem(), true); if (gridEnvelope.getWidth() < gridEnvelope.getHeight()) { height = (int) Math .round(width * gridEnvelope.getHeight() / gridEnvelope.getWidth()); } else { width = (int) Math .round(height * gridEnvelope.getWidth() / gridEnvelope.getHeight()); } } } catch (Exception e) { throw new IOException("Could not reproject the request envelope", e); } GetTileRequest tileRequest = wmts.createGetTileRequest(); setTileRequest(tileRequest); tileRequest.setCRS(gridEnvelope.getCoordinateReferenceSystem()); tileRequest.setLayer(layer); tileRequest.setRequestedHeight(height); tileRequest.setRequestedWidth(width); tileRequest.setRequestedBBox(gridEnvelope); tileRequest.setRequestedTime(time); try { this.requestCRS = CRS.decode(requestSrs); } catch (Exception e) { throw new IOException("Could not decode request SRS " + requestSrs); } ReferencedEnvelope requestEnvelope = gridEnvelope; this.width = width; this.height = height; return gridEnvelope; }

Target:
ReferencedEnvelope initTileRequest(ReferencedEnvelope bbox, int width, int height, String time) throws IOException { ReferencedEnvelope gridEnvelope = bbox; String requestSrs = srsName; try { String code = null; Integer epsgCode = CRS.lookupEpsgCode(bbox.getCoordinateReferenceSystem(), false); if (epsgCode != null) { code = "EPSG:" + epsgCode; } else { code = CRS.lookupIdentifier(bbox.getCoordinateReferenceSystem(), false); } if (code != null && validSRS.contains(code)) { requestSrs = code; } else { gridEnvelope = bbox.transform(getCoordinateReferenceSystem(), true); if (gridEnvelope.getWidth() < gridEnvelope.getHeight()) { height = (int) Math .round(width * gridEnvelope.getHeight() / gridEnvelope.getWidth()); } else { width = (int) Math .round(height * gridEnvelope.getWidth() / gridEnvelope.getHeight()); } } } catch (Exception e) { throw new IOException("Could not reproject the request envelope", e); } GetTileRequest tileRequest = wmts.createGetTileRequest(); setTileRequest(tileRequest); tileRequest.setCRS(gridEnvelope.getCoordinateReferenceSystem()); tileRequest.setLayer(layer); tileRequest.setRequestedHeight(height); tileRequest.setRequestedWidth(width); tileRequest.setRequestedBBox(gridEnvelope); tileRequest.setRequestedTime(time); try { this.requestCRS = CRS.decode(requestSrs); } catch (Exception e) { throw new IOException("Could not decode request SRS " + requestSrs); } this.width = width; this.height = height; return gridEnvelope; }
Source:
protected boolean validateInputManagementNetwork() { if (!findInputManagementNetwork()) return false; final NetworkClusterValidatorBase networkClusterValidator = createNetworkClusterValidator(); return validate(networkClusterValidator.networkBelongsToClusterDataCenter(getCluster(), managementNetwork)) && validate(networkClusterValidator.managementNetworkRequired(managementNetwork)) && validate(networkClusterValidator.managementNetworkNotExternal(managementNetwork)); }

Target:
protected boolean validateInputManagementNetwork() { if (!findInputManagementNetwork()) { return false; } final NetworkClusterValidatorBase networkClusterValidator = createNetworkClusterValidator(); return validate(networkClusterValidator.networkBelongsToClusterDataCenter(getCluster(), managementNetwork)) && validate(networkClusterValidator.managementNetworkRequired(managementNetwork)) && validate(networkClusterValidator.managementNetworkNotExternal(managementNetwork)); }
Source:
private void setOldImportsAsPatternAndState(final String oldImports) { PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(); List<String> oldPatterns = new ArrayList<>(); List<String> oldStates = new ArrayList<>(); if (oldImports != null) { List<String> oldImportsList = Arrays.asList(oldImports.split(DELIMITER)); for (String oldImport : oldImportsList) { oldPatterns.add(oldImport); oldStates.add(TRUE); } } propertiesComponent.setValues(RefreshAction.EXCLUDE_IMPORT_PATTERN, oldPatterns.toArray(new String[oldPatterns.size()])); propertiesComponent.setValues(RefreshAction.EXCLUDE_IMPORT_STATE, oldStates.toArray(new String[oldStates.size()])); }

Target:
private void setOldImportsAsPatternAndState(final String oldImports) { PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(); List<String> oldPatterns = new ArrayList<>(); List<String> oldStates = new ArrayList<>(); if (oldImports != null) { List<String> oldImportsList = Arrays.asList(oldImports.split(DELIMITER)); for (String oldImport : oldImportsList) { String trimmedImport = oldImport.trim(); if (!trimmedImport.isEmpty()) { oldPatterns.add(trimmedImport); oldStates.add(TRUE); } } } propertiesComponent.setValues(RefreshAction.EXCLUDE_IMPORT_PATTERN, oldPatterns.toArray(new String[oldPatterns.size()])); propertiesComponent.setValues(RefreshAction.EXCLUDE_IMPORT_STATE, oldStates.toArray(new String[oldStates.size()])); }