auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void testStayLocalIfAllSegmentsPresentLocally(boolean rehashAware) throws Exception { Cache<Object, String> cache0 = cache(0, CACHE_NAME); ClusterStreamManager clusterStreamManager = replaceWithSpy(cache0); IntStream.rangeClosed(0, 499).boxed().forEach(i -> cache0.put(i, i.toString())); ConsistentHash ch = cache0.getAdvancedCache().getDistributionManager().getConsistentHash(); Set<Integer> segmentsCache0 = ch.getSegmentsForOwner(cache0.getCacheManager().getAddress()); CacheStream<Map.Entry<Object, String>> stream = cache0.entrySet().stream(); if (!rehashAware) stream.disableRehashAware(); Map<Object, String> entries = mapFromIterator(stream.filterKeySegments(segmentsCache0).iterator()); Map<Integer, Set<Map.Entry<Object, String>>> entriesPerSegment = generateEntriesPerSegment(ch, entries.entrySet()); assertEquals(segmentsCache0, entriesPerSegment.keySet()); verify(clusterStreamManager, never()).awaitCompletion(any(UUID.class), anyLong(), any(TimeUnit.class)); }

Target:
private void testStayLocalIfAllSegmentsPresentLocally(boolean rehashAware) throws Exception { Cache<Object, String> cache0 = cache(0, CACHE_NAME); ClusterStreamManager clusterStreamManager = replaceWithSpy(cache0); IntStream.rangeClosed(0, 499).boxed().forEach(i -> cache0.put(i, i.toString())); ConsistentHash ch = cache0.getAdvancedCache().getDistributionManager().getConsistentHash(); Set<Integer> segmentsCache0 = ch.getSegmentsForOwner(cache0.getCacheManager().getAddress()); CacheStream<Map.Entry<Object, String>> stream = cache0.entrySet().stream(); if (!rehashAware) stream = stream.disableRehashAware(); Map<Object, String> entries = mapFromIterator(stream.filterKeySegments(segmentsCache0).iterator()); Map<Integer, Set<Map.Entry<Object, String>>> entriesPerSegment = generateEntriesPerSegment(ch, entries.entrySet()); assertEquals(segmentsCache0, entriesPerSegment.keySet()); verify(clusterStreamManager, never()).awaitCompletion(any(UUID.class), anyLong(), any(TimeUnit.class)); }
Source:
public void openSpecialDesignerPage(String wikiURL) { getUrl(wikiURL+"wiki/Special:ThemeDesigner"); PageObjectLogging.log("openSpecialDesignerPage", "special designer page opened", true, driver); }

Target:
public void openSpecialDesignerPage(String wikiURL) { getUrl(wikiURL+URLsContent.specialThemeDesigner); PageObjectLogging.log("openSpecialDesignerPage", "special designer page opened", true, driver); }
Source:
private int hash(String nodePinValue) { return Hashing.consistentHash(Hashing.crc32c().hashString(nodePinValue, StandardCharsets.UTF_8), nodes.size()); }

Target:
private int hash(String nodePinValue) { return Hashing.consistentHash(Hashing.murmur3_32().hashString(nodePinValue, StandardCharsets.UTF_8), nodes.size()); }
Source:
public CommitCombo(Composite parent, int style) { super(parent, style); combo = new Combo(this, style | SWT.DROP_DOWN); commits = new ArrayList<ComboCommitEnt>(); setLayout(GridLayoutFactory.swtDefaults().create()); setLayoutData(GridDataFactory.fillDefaults().create()); GridData totalLabelData = new GridData(); totalLabelData.horizontalAlignment = SWT.FILL; totalLabelData.grabExcessHorizontalSpace = true; combo.setLayoutData(totalLabelData); ContentProposalAdapter adapter = new ContentProposalAdapter(combo, new ComboContentAdapter(), new CommitContentProposalProvider(), null, null); adapter.setPropagateKeys(true); adapter .setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); }

Target:
public CommitCombo(Composite parent, int style) { super(parent, style); combo = new Combo(this, SWT.DROP_DOWN); commits = new ArrayList<ComboCommitEnt>(); setLayout(GridLayoutFactory.swtDefaults().create()); setLayoutData(GridDataFactory.fillDefaults().create()); GridData totalLabelData = new GridData(); totalLabelData.horizontalAlignment = SWT.FILL; totalLabelData.grabExcessHorizontalSpace = true; combo.setLayoutData(totalLabelData); combo.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { if (null == getValue()) combo.setText(""); } }); UIUtils.addBulbDecorator(combo, UIText.CommitCombo_showSuggestedCommits); ContentProposalAdapter adapter = new ContentProposalAdapter(combo, new ComboContentAdapter(), new CommitContentProposalProvider(), null, null); adapter.setPropagateKeys(true); adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); }
Source:
public void validate() throws APITemplateException, APIManagementException { super.validate(); if (api != null) { JSONParser parser = new JSONParser(); String config_json = api.getEndpointConfig(); if (config_json != null && !"".equals(config_json)) { try { Object config = parser.parse(config_json); JSONObject endpointConfig = (JSONObject) config; if (endpointConfig.get(APIConstants.ENDPOINT_SECURITY) != null) { JSONObject endpointSecurity = (JSONObject) endpointConfig.get(APIConstants.ENDPOINT_SECURITY); if (endpointSecurity.get(APIConstants.ENDPOINT_SECURITY_PRODUCTION) != null) { productionEndpointSecurity = (JSONObject) endpointSecurity.get(APIConstants.ENDPOINT_SECURITY_PRODUCTION); } if (endpointSecurity.get(APIConstants.ENDPOINT_SECURITY_SANDBOX) != null) { sandboxEndpointSecurity = (JSONObject) endpointSecurity.get(APIConstants.ENDPOINT_SECURITY_SANDBOX); } } } catch (ParseException e) { this.handleException("Unable to pass the endpoint JSON config"); } } } }

Target:
public void validate() throws APITemplateException, APIManagementException { super.validate(); if (api != null) { JSONParser parser = new JSONParser(); String apiEndpointConfig = api.getEndpointConfig(); if (StringUtils.isNotEmpty(apiEndpointConfig)) { try { Object config = parser.parse(apiEndpointConfig); JSONObject endpointConfig = (JSONObject) config; if (endpointConfig.get(APIConstants.ENDPOINT_SECURITY) != null) { JSONObject endpointSecurity = (JSONObject) endpointConfig.get(APIConstants.ENDPOINT_SECURITY); if (endpointSecurity.get(APIConstants.ENDPOINT_SECURITY_PRODUCTION) != null) { productionEndpointSecurity = (JSONObject) endpointSecurity.get(APIConstants.ENDPOINT_SECURITY_PRODUCTION); } if (endpointSecurity.get(APIConstants.ENDPOINT_SECURITY_SANDBOX) != null) { sandboxEndpointSecurity = (JSONObject) endpointSecurity.get(APIConstants.ENDPOINT_SECURITY_SANDBOX); } } } catch (ParseException e) { this.handleException("Unable to pass the endpoint JSON config"); } } } }
Source:
public void testGetCommandIdsByEntity() { Guid storageId = Guid.newGuid(); CommandEntity cmdEntity1 = generateNewEntity(); dao.save(cmdEntity1); Set<CommandAssociatedEntity> cocoCmdEntities1 = new HashSet<>(); cocoCmdEntities1.add(new CommandAssociatedEntity(cmdEntity1.getId(), VdcObjectType.Storage, storageId)); cocoCmdEntities1.add(new CommandAssociatedEntity(cmdEntity1.getId(), VdcObjectType.Disk, Guid.newGuid())); dao.insertCommandAssociatedEntities(cocoCmdEntities1); CommandEntity cmdEntity2 = generateNewEntity(); dao.save(cmdEntity2); Set<CommandAssociatedEntity> cocoCmdEntities2 = new HashSet<>(); cocoCmdEntities2.add(new CommandAssociatedEntity(cmdEntity2.getId(), VdcObjectType.Storage, storageId)); cocoCmdEntities2.add(new CommandAssociatedEntity(cmdEntity2.getId(), VdcObjectType.Disk, Guid.newGuid())); dao.insertCommandAssociatedEntities(cocoCmdEntities2); List<Guid> cmIds = dao.getCommandIdsByEntity(storageId); assertNotNull(cmIds); assertEquals(2, cmIds.size()); assertTrue(cmIds.contains(cmdEntity1.getId())); assertTrue(cmIds.contains(cmdEntity2.getId())); }

Target:
public void testGetCommandIdsByEntity() { Guid storageId = Guid.newGuid(); CommandEntity cmdEntity1 = generateNewEntity(); dao.save(cmdEntity1); Set<CommandAssociatedEntity> cocoCmdEntities1 = new HashSet<>(); cocoCmdEntities1.add(new CommandAssociatedEntity(cmdEntity1.getId(), VdcObjectType.Storage, storageId)); cocoCmdEntities1.add(new CommandAssociatedEntity(cmdEntity1.getId(), VdcObjectType.Disk, Guid.newGuid())); dao.insertCommandAssociatedEntities(cocoCmdEntities1); CommandEntity cmdEntity2 = generateNewEntity(); dao.save(cmdEntity2); Set<CommandAssociatedEntity> cocoCmdEntities2 = new HashSet<>(); cocoCmdEntities2.add(new CommandAssociatedEntity(cmdEntity2.getId(), VdcObjectType.Storage, storageId)); cocoCmdEntities2.add(new CommandAssociatedEntity(cmdEntity2.getId(), VdcObjectType.Disk, Guid.newGuid())); dao.insertCommandAssociatedEntities(cocoCmdEntities2); List<Guid> cmIds = dao.getCommandIdsByEntity(storageId); assertNotNull(cmIds); assertThat(cmIds, hasSize(2)); assertThat(cmIds, hasItems(cmdEntity1.getId(), cmdEntity2.getId())); }
Source:
private boolean isKnoxSSOEnabled() { Collection realmsList = SecurityUtils.getRealmsList(); if (realmsList != null) { for (Iterator<Realm> iterator = realmsList.iterator(); iterator.hasNext(); ) { Realm realm = iterator.next(); String name = realm.getClass().getName(); LOG.debug("RealmClass.getName: " + name); if (realm instanceof KnoxJwtRealm) { return true; } } } return false; }

Target:
private boolean isKnoxSSOEnabled() { Collection realmsList = SecurityUtils.getRealmsList(); if (realmsList != null) { for (Iterator<Realm> iterator = realmsList.iterator(); iterator.hasNext(); ) { Realm realm = iterator.next(); if (realm instanceof KnoxJwtRealm) { return true; } } } return false; }
Source:
private void prestartVms(VmPool vmPool, int numOfVmsToPrestart) { AtomicInteger failedAttempts = new AtomicInteger(0); AtomicInteger prestartedVmsCounter = new AtomicInteger(0); int maxFailedAttempts = Config.<Integer> getValue(ConfigValues.VmPoolMonitorMaxAttempts); Map<String, Set<Guid>> failureReasons = new HashMap<>(); Iterator<Guid> iterator = vmPoolHandler .selectNonPrestartedVms(vmPool.getVmPoolId(), (vmId, messages) -> collectVmPrestartFailureReasons(vmId, failureReasons, messages)) .iterator(); while (failedAttempts.intValue() < maxFailedAttempts && prestartedVmsCounter.intValue() < numOfVmsToPrestart && iterator.hasNext()) { Guid vmId = iterator.next(); if (prestartVm(vmId, !vmPool.isStateful(), vmPool.getName())) { prestartedVmsCounter.incrementAndGet(); failedAttempts.set(0); } else { failedAttempts.incrementAndGet(); } } logResultOfPrestartVms(prestartedVmsCounter.intValue(), numOfVmsToPrestart, vmPool.getVmPoolId(), failureReasons); if (prestartedVmsCounter.intValue() == 0) { log.info("No VMs available for prestarting"); } }

Target:
private void prestartVms(VmPool vmPool, int numOfVmsToPrestart) { int failedAttempts = 0; int prestartedVms = 0; int maxFailedAttempts = Config.<Integer> getValue(ConfigValues.VmPoolMonitorMaxAttempts); Map<String, Set<Guid>> failureReasons = new HashMap<>(); Iterator<Guid> iterator = vmPoolHandler .selectNonPrestartedVms(vmPool.getVmPoolId(), (vmId, messages) -> collectVmPrestartFailureReasons(vmId, failureReasons, messages)) .iterator(); while (failedAttempts < maxFailedAttempts && prestartedVms < numOfVmsToPrestart && iterator.hasNext()) { Guid vmId = iterator.next(); if (prestartVm(vmId, !vmPool.isStateful(), vmPool.getName())) { prestartedVms++; failedAttempts = 0; } else { failedAttempts++; } } logResultOfPrestartVms(prestartedVms, numOfVmsToPrestart, vmPool.getVmPoolId(), failureReasons); if (prestartedVms == 0) { log.info("No VMs available for prestarting"); } }
Source:
private void dispatchEvent(long startTimeOfNewAggregates, BaseIncrementalValueStore aBaseIncrementalValueStore) { if (aBaseIncrementalValueStore.isProcessed()) { ComplexEventChunk<StreamEvent> eventChunk = new ComplexEventChunk<>(true); ComplexEventChunk<StreamEvent> tableEventChunk = new ComplexEventChunk<>(true); eventChunk.add(aBaseIncrementalValueStore.createStreamEvent()); tableEventChunk.add(aBaseIncrementalValueStore.createStreamEvent()); if (LOG.isDebugEnabled()) { LOG.debug("Event dispatched by " + this.duration + " incremental executor: " + eventChunk.toString()); } if (isProcessingExecutor) { executorService.execute(() -> { try { table.addEvents(tableEventChunk, 1); } catch (Throwable t) { LOG.error("Exception occurred when writing to aggregation table of duration '" + this.duration + "'. This should be investigated as this can cause accuracy loss.", t); } }); } if (getNextExecutor() != null) { next.execute(eventChunk); } } cleanBaseIncrementalValueStore(startTimeOfNewAggregates, aBaseIncrementalValueStore); }

Target:
private void dispatchEvent(long startTimeOfNewAggregates, BaseIncrementalValueStore aBaseIncrementalValueStore) { if (aBaseIncrementalValueStore.isProcessed()) { ComplexEventChunk<StreamEvent> eventChunk = new ComplexEventChunk<>(true); ComplexEventChunk<StreamEvent> tableEventChunk = new ComplexEventChunk<>(true); eventChunk.add(aBaseIncrementalValueStore.createStreamEvent()); tableEventChunk.add(aBaseIncrementalValueStore.createStreamEvent()); if (LOG.isDebugEnabled()) { LOG.debug("Event dispatched by " + this.duration + " incremental executor: " + eventChunk.toString()); } if (isProcessingExecutor) { executorService.execute(() -> { try { table.addEvents(tableEventChunk, 1); } catch (Throwable t) { LOG.error("Exception occurred at siddhi app '" + siddhiAppContext.getName() + "' when performing table writes of aggregation '" + this.aggregatorName + "' for duration '" + this.duration + "'. This should be investigated as this can " + "cause accuracy loss.", t); } }); } if (getNextExecutor() != null) { next.execute(eventChunk); } } cleanBaseIncrementalValueStore(startTimeOfNewAggregates, aBaseIncrementalValueStore); }
Source:
public GHSubscription subscribe(boolean subscribed, boolean ignored) throws IOException { return root.retrieve() .method("POST") .with("subscribed", subscribed) .with("ignored", ignored) .method("PUT") .withUrlPath(subscription_url) .to(GHSubscription.class) .wrapUp(root); }

Target:
public GHSubscription subscribe(boolean subscribed, boolean ignored) throws IOException { return root.createRequest() .method("PUT") .with("subscribed", subscribed) .with("ignored", ignored) .withUrlPath(subscription_url) .fetch(GHSubscription.class) .wrapUp(root); }
Source:
private Set<String> getIndexSequencesWithMinimumEditDistance(int minimumDistance) { Set<String> sequences = new HashSet<>(); List<PoolableElementView> views = new ArrayList<>(getPoolableElementViews()); for (int i = 0; i < views.size(); i++) { String sequence1 = getCombinedIndexSequences(views.get(i)); for (int j = i + 1; j < views.size(); j++) { String sequence2 = getCombinedIndexSequences(views.get(j)); if ((Index.checkEditDistance(sequence1, sequence2) < minimumDistance) && !((hasFakeSequence(views.get(i)) || hasFakeSequence(views.get(j))) && minimumDistance > 1)) { sequences.add(sequence1); sequences.add(sequence2); } } } return sequences; }

Target:
private Set<String> getIndexSequencesWithMinimumEditDistance(int minimumDistance) { Set<String> sequences = new HashSet<>(); List<PoolableElementView> views = new ArrayList<>(getPoolableElementViews()); if (minimumDistance > 1 && views.stream().anyMatch(PoolImpl::hasFakeSequence)) return Collections.emptySet(); for (int i = 0; i < views.size(); i++) { String sequence1 = getCombinedIndexSequences(views.get(i)); for (int j = i + 1; j < views.size(); j++) { String sequence2 = getCombinedIndexSequences(views.get(j)); if (Index.checkEditDistance(sequence1, sequence2) < minimumDistance) { sequences.add(sequence1); sequences.add(sequence2); } } } return sequences; }
Source:
public CreateStack build() { String missing = ""; if (name == null) { missing += " name"; } if (template == null && templateUrl == null) { missing += " template and templateUrl"; } if (!missing.isEmpty()) { throw new IllegalStateException("Missing required properties:" + missing); } CreateStack result = new AutoValue_CreateStack( this.name, this.template != null ? template : null, this.templateUrl != null ? templateUrl : null, this.parameters != null ? ImmutableMap.copyOf(this.parameters) : null, this.disableRollback, this.files != null ? ImmutableMap.copyOf(this.files) : null, this.environment != null ? environment : null ); return result; }

Target:
public CreateStack build() { CreateStack result = new AutoValue_CreateStack( this.name, this.template, this.templateUrl, this.parameters != null ? ImmutableMap.copyOf(this.parameters) : null, this.disableRollback, this.files != null ? ImmutableMap.copyOf(this.files) : null, this.environment); return result; }
Source:
public String getSubnetHostname() { String publicHostname = jcloudsParent.getPrivateHostname(node, Optional.<HostAndPort>absent(), config().getBag()); return publicHostname; }

Target:
public String getSubnetHostname() { String privateHostname = jcloudsParent.getPrivateHostname(node, Optional.<HostAndPort>absent(), config().getBag()); return privateHostname; }
Source:
protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) { EObject element = view.getElement(); if (element instanceof DRepresentationDescriptor) { markAsLinkNote(view); } super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted); }

Target:
protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) { super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted); EObject element = view.getElement(); if (element instanceof DRepresentationDescriptor) { markAsLinkNote(view); } }
Source:
void loadINodeDirectorySection(InputStream in) throws IOException { final List<INodeReference> refList = parent.getLoaderContext() .getRefList(); ArrayList<INode> inodeList = new ArrayList<>(); while (true) { INodeDirectorySection.DirEntry e = INodeDirectorySection.DirEntry .parseDelimitedFrom(in); if (e == null) { break; } INodeDirectory p = dir.getInode(e.getParent()).asDirectory(); for (long id : e.getChildrenList()) { INode child = dir.getInode(id); if (addToParent(p, child)) { if (child.isFile()) { inodeList.add(child); } if (inodeList.size() >= 1000) { addToCacheAndBlockMap(inodeList); inodeList.clear(); } } } for (int refId : e.getRefChildrenList()) { INodeReference ref = refList.get(refId); if (addToParent(p, ref)) { if (ref.isFile()) { inodeList.add(ref); } if (inodeList.size() >= 1000) { addToCacheAndBlockMap(inodeList); inodeList.clear(); } } } } addToCacheAndBlockMap(inodeList); }

Target:
void loadINodeDirectorySection(InputStream in) throws IOException { final List<INodeReference> refList = parent.getLoaderContext() .getRefList(); ArrayList<INode> inodeList = new ArrayList<>(); while (true) { INodeDirectorySection.DirEntry e = INodeDirectorySection.DirEntry .parseDelimitedFrom(in); if (e == null) { break; } INodeDirectory p = dir.getInode(e.getParent()).asDirectory(); for (long id : e.getChildrenList()) { INode child = dir.getInode(id); if (addToParent(p, child)) { if (child.isFile()) { inodeList.add(child); } if (inodeList.size() >= DIRECTORY_ENTRY_BATCH_SIZE) { addToCacheAndBlockMap(inodeList); inodeList.clear(); } } else { LOG.warn("Failed to add the inode to the directory {}", child.getId(), p.getId()); } } for (int refId : e.getRefChildrenList()) { INodeReference ref = refList.get(refId); if (addToParent(p, ref)) { if (ref.isFile()) { inodeList.add(ref); } if (inodeList.size() >= DIRECTORY_ENTRY_BATCH_SIZE) { addToCacheAndBlockMap(inodeList); inodeList.clear(); } } else { LOG.warn("Failed to add the inode reference to the directory {}", ref.getId(), p.getId()); } } } addToCacheAndBlockMap(inodeList); }
Source:
public static IBlockStateMatcher create(crafttweaker.api.block.IBlockState... blockStates) { if (blockStates == null || blockStates.length == 0) return null; if (blockStates.length == 1) { return new BlockStateMatcher(blockStates[0]); } else { return new BlockStateMatcherOr(Arrays.copyOf(blockStates, blockStates.length)); } }

Target:
public static IBlockStateMatcher create(crafttweaker.api.block.IBlockState... blockStates) { if (blockStates == null) { throw new IllegalArgumentException("Cannot create matcher for null blockstate"); } for (Object o : blockStates) { if (o == null) { throw new IllegalArgumentException("Cannot create matcher for null blockstate"); } } if (blockStates.length == 1) { return new BlockStateMatcher(blockStates[0]); } else { return new BlockStateMatcherOr(Arrays.copyOf(blockStates, blockStates.length)); } }
Source:
public WorkspaceActivityManager( WorkspaceManager workspaceManager, WorkspaceActivityDao activityDao, EventService eventService, @Named("che.limits.workspace.idle.timeout") long timeout) { this.workspaceManager = workspaceManager; this.eventService = eventService; this.activityDao = activityDao; this.defaultTimeout = timeout; if (timeout < MINIMAL_TIMEOUT) { LOG.warn( "Value of property \"che.limits.workspace.idle.timeout\" is below recommended minimum (" + TimeUnit.MILLISECONDS.toMinutes(MINIMAL_TIMEOUT) + " minutes). This may cause problems with workspace components startup and can cause premature workspace shutdown."); } this.workspaceEventsSubscriber = new EventSubscriber<WorkspaceStatusEvent>() { @Override public void onEvent(WorkspaceStatusEvent event) { switch (event.getStatus()) { case RUNNING: try { Workspace workspace = workspaceManager.getWorkspace(event.getWorkspaceId()); if (workspace.getAttributes().remove(WORKSPACE_STOPPED_BY) != null) { workspaceManager.updateWorkspace(event.getWorkspaceId(), workspace); } } catch (Exception ex) { LOG.warn( "Failed to remove stopped information attribute for workspace " + event.getWorkspaceId()); } update(event.getWorkspaceId(), System.currentTimeMillis()); break; case STOPPED: try { activityDao.removeExpiration(event.getWorkspaceId()); } catch (ServerException e) { LOG.error(e.getLocalizedMessage(), e); } break; default: } } }; }

Target:
public WorkspaceActivityManager( WorkspaceManager workspaceManager, WorkspaceActivityDao activityDao, EventService eventService, @Named("che.limits.workspace.idle.timeout") long timeout) { this.workspaceManager = workspaceManager; this.eventService = eventService; this.activityDao = activityDao; this.defaultTimeout = timeout; if (timeout < MINIMAL_TIMEOUT) { LOG.warn( "Value of property \"che.limits.workspace.idle.timeout\" is below recommended minimum (" + TimeUnit.MILLISECONDS.toMinutes(MINIMAL_TIMEOUT) + " minutes). This may cause problems with workspace components startup and/or premature workspace shutdown."); } this.workspaceEventsSubscriber = new EventSubscriber<WorkspaceStatusEvent>() { @Override public void onEvent(WorkspaceStatusEvent event) { switch (event.getStatus()) { case RUNNING: try { Workspace workspace = workspaceManager.getWorkspace(event.getWorkspaceId()); if (workspace.getAttributes().remove(WORKSPACE_STOPPED_BY) != null) { workspaceManager.updateWorkspace(event.getWorkspaceId(), workspace); } } catch (Exception ex) { LOG.warn( "Failed to remove stopped information attribute for workspace " + event.getWorkspaceId()); } update(event.getWorkspaceId(), System.currentTimeMillis()); break; case STOPPED: try { activityDao.removeExpiration(event.getWorkspaceId()); } catch (ServerException e) { LOG.error(e.getLocalizedMessage(), e); } break; default: } } }; }
Source:
private void syncExec(final Runnable runnable) { final AtomicReference<RuntimeException> exception = new AtomicReference<RuntimeException>(); browser .getDisplay() .syncExec( () -> { try { runnable.run(); } catch (RuntimeException e) { exception.set(e); } }); if (exception.get() != null) { throw exception.get(); } }

Target:
private void syncExec(final Runnable runnable) { syncExec( () -> { runnable.run(); return null; }); }
Source:
public List<ObjectModel> parse(InputStream inputStream, String streamName) throws InvalidDDFFileException, IOException { streamName = streamName == null ? "" : streamName; LOG.debug("Parsing DDF file {}", streamName); try { DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(inputStream); Version lwm2mVersion; DDFFileValidator ddfFileValidator; if (ddfValidatorFactory != null) { lwm2mVersion = ddfValidatorFactory.extractLWM2MVersion(document, streamName); ddfFileValidator = ddfValidatorFactory.create(lwm2mVersion); } else { lwm2mVersion = null; ddfFileValidator = ddfValidator; } if (ddfFileValidator != null) { ddfFileValidator.validate(document); } ArrayList<ObjectModel> objects = new ArrayList<>(); NodeList nodeList = document.getDocumentElement().getElementsByTagName("Object"); for (int i = 0; i < nodeList.getLength(); i++) { objects.add(parseObject(nodeList.item(i), streamName, lwm2mVersion, ddfValidatorFactory != null)); } return objects; } catch (InvalidDDFFileException | SAXException e) { throw new InvalidDDFFileException(e, "Invalid DDF file %s", streamName); } catch (ParserConfigurationException e) { throw new IllegalStateException("Unable to create Document Builder", e); } }

Target:
public List<ObjectModel> parse(InputStream inputStream, String streamName) throws InvalidDDFFileException, IOException { streamName = streamName == null ? "" : streamName; LOG.debug("Parsing DDF file {}", streamName); try { DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(inputStream); Version lwm2mVersion; DDFFileValidator ddfFileValidator; if (ddfValidatorFactory != null) { lwm2mVersion = ddfValidatorFactory.extractLWM2MVersion(document, streamName); ddfFileValidator = ddfValidatorFactory.create(lwm2mVersion); } else { lwm2mVersion = null; ddfFileValidator = ddfValidator; } boolean validateDdf = ddfFileValidator != null; if (validateDdf) { ddfFileValidator.validate(document); } ArrayList<ObjectModel> objects = new ArrayList<>(); NodeList nodeList = document.getDocumentElement().getElementsByTagName("Object"); for (int i = 0; i < nodeList.getLength(); i++) { objects.add(parseObject(nodeList.item(i), streamName, lwm2mVersion, validateDdf)); } return objects; } catch (InvalidDDFFileException | SAXException e) { throw new InvalidDDFFileException(e, "Invalid DDF file %s", streamName); } catch (ParserConfigurationException e) { throw new IllegalStateException("Unable to create Document Builder", e); } }
Source:
public CommandResult<CanvasViolation> execute(AbstractCanvasHandler context) { ShapeUtils.removeControlPoints(candidate, context, controlPoints); ShapeUtils.hideControlPoints(candidate, context); ShapeUtils.showControlPoints(candidate, context); return buildResult(); }

Target:
public CommandResult<CanvasViolation> execute(AbstractCanvasHandler context) { ShapeUtils.hideControlPoints(candidate, context); ShapeUtils.removeControlPoints(candidate, context, controlPoints); ShapeUtils.showControlPoints(candidate, context); return buildResult(); }
Source:
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException { if (getRoleId() != null && getRoleId() < 1L) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role id provided"); } List<RolePermission> rolePermissions = roleService.findAllPermissionsBy(getRoleId()); ListResponse<RolePermissionResponse> response = new ListResponse<>(); List<RolePermissionResponse> rolePermissionResponses = new ArrayList<>(); for (RolePermission rolePermission : rolePermissions) { Role role = roleService.findRole(rolePermission.getRoleId()); if (role == null) { continue; } RolePermissionResponse rolePermissionResponse = new RolePermissionResponse(); rolePermissionResponse.setRoleId(role.getUuid()); rolePermissionResponse.setRoleName(role.getName()); rolePermissionResponse.setId(rolePermission.getUuid()); rolePermissionResponse.setRule(rolePermission.getRule()); rolePermissionResponse.setRulePermission(rolePermission.getPermission()); rolePermissionResponse.setDescription(rolePermission.getDescription()); rolePermissionResponse.setObjectName("rolepermission"); rolePermissionResponses.add(rolePermissionResponse); } response.setResponses(rolePermissionResponses); response.setResponseName(getCommandName()); setResponseObject(response); }

Target:
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException { final List<RolePermission> rolePermissions = roleService.findAllPermissionsBy(getRoleId()); setupResponse(rolePermissions, getRoleId()); }
Source:
public void fromRelativeURLTest() throws IOException { GeoServerResourceLoader loader = new GeoServerResourceLoader(); tempFolder.create(); File tempDir = tempFolder.getRoot(); loader.setBaseDirectory(tempDir); Resource res = loader.fromURL("file:relative/with/special+characters%23"); assertEquals("relative/with/special characters#", res.path()); try (OutputStream out = res.out()) { out.write("someText".getBytes()); } assertEquals("someText", Files.asCharSource(res.file(), Charset.defaultCharset()).read()); }

Target:
public void fromRelativeURLTest() throws IOException { GeoServerResourceLoader loader = new GeoServerResourceLoader(); tempFolder.create(); File tempDir = tempFolder.getRoot(); loader.setBaseDirectory(tempDir); Resource res = loader.fromURL("file:relative/with/special+characters%23%C3%BC"); assertEquals("relative/with/special characters#ü", res.path()); try (OutputStream out = res.out()) { out.write("someText".getBytes()); } assertEquals("someText", Files.asCharSource(res.file(), Charset.defaultCharset()).read()); }
Source:
public void listOnePageOfQueuesFail() throws Exception { MockWebServer server = mockOpenStackServer(); server.enqueue(new MockResponse().setBody(accessRackspace)); server.enqueue(new MockResponse().setResponseCode(404).setBody("")); try { MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi"); QueueApi queueApi = api.getQueueApiForZoneAndClient("DFW", CLIENT_ID); List<Queue> queues = queueApi.list(false).concat().toList(); assertEquals(queues.size(), 0); } finally { server.shutdown(); } }

Target:
public void listOnePageOfQueuesFail() throws Exception { MockWebServer server = mockOpenStackServer(); server.enqueue(new MockResponse().setBody(accessRackspace)); server.enqueue(new MockResponse().setResponseCode(404)); try { MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi"); QueueApi queueApi = api.getQueueApiForZoneAndClient("DFW", CLIENT_ID); FluentIterable<Queue> queues = queueApi.list(false).concat(); assertTrue(queues.isEmpty(), "Expecting empty queues but was " + queues.toString()); } finally { server.shutdown(); } }
Source:
private boolean enableButtonSubComponents(Boolean enable) { boolean ingestRunning = IngestManager.getInstance().isIngestRunning(); pnCorrelationProperties.setEnabled(enable && !ingestRunning); bnManageTypes.setEnabled(enable && !ingestRunning); correlationPropertiesTextArea.setEnabled(enable && !ingestRunning); organizationPanel.setEnabled(enable && !ingestRunning); organizationTextArea.setEnabled(enable && !ingestRunning); manageOrganizationButton.setEnabled(enable && !ingestRunning); showCasesButton.setEnabled(enable && !ingestRunning); return true; }

Target:
private boolean enableButtonSubComponents(Boolean enable) { boolean ingestRunning = IngestManager.getInstance().isIngestRunning(); pnCorrelationProperties.setEnabled(enable && !ingestRunning); bnManageTypes.setEnabled(enable && !ingestRunning); correlationPropertiesTextArea.setEnabled(enable && !ingestRunning); organizationPanel.setEnabled(enable && !ingestRunning); organizationTextArea.setEnabled(enable && !ingestRunning); manageOrganizationButton.setEnabled(enable && !ingestRunning); showCasesButton.setEnabled(enable && !ingestRunning); casesPanel.setEnabled(enable && !ingestRunning); casesTextArea.setEnabled(enable && !ingestRunning); return true; }
Source:
public void test() { connect(); click(jq("@button").eq(0)); waitResponse(); System.out.println(jq(".z-listheader-sorticon").eq(2).width()); Assert.assertTrue(jq(".z-listheader-sorticon").eq(2).width() > 0); click(jq("@button").eq(1)); waitResponse(); System.out.println(jq(".z-listheader-sorticon").eq(2).isVisible()); Assert.assertEquals(jq(".z-listheader-sorticon").eq(2).width(), 0); }

Target:
public void test() { connect(); click(jq("@button").eq(0)); waitResponse(); Assert.assertNotEquals(0, jq(".z-listheader").eq(2).width()); Assert.assertNotEquals(400, jq(".z-listhead").width()); click(jq("@button").eq(1)); waitResponse(); Assert.assertEquals(400, jq(".z-listhead").width()); }
Source:
private EntitySearchFilter createOrderFilter(RestListRequest requestList) { String groupBy = requestList.getSort(); String key = IResourceManager.RESOURCE_DESCR_FILTER_KEY; if ("description".equals(groupBy)) { key = IResourceManager.RESOURCE_DESCR_FILTER_KEY; } else if ("updatedAt".equals(groupBy)) { key = IResourceManager.RESOURCE_MODIFY_DATE_FILTER_KEY; } else if ("createdAt".equals(groupBy)) { key = IResourceManager.RESOURCE_CREATION_DATE_FILTER_KEY; } else if ("name".equals(groupBy)) { key = IResourceManager.RESOURCE_FILENAME_FILTER_KEY; } EntitySearchFilter filter = new EntitySearchFilter(key, true); filter.setOrder(requestList.getDirection().equals(EntitySearchFilter.DESC_ORDER) ? EntitySearchFilter.DESC_ORDER : EntitySearchFilter.ASC_ORDER); return filter; }

Target:
private EntitySearchFilter createOrderFilter(RestListRequest requestList) { String groupBy = requestList.getSort(); String key = IResourceManager.RESOURCE_DESCR_FILTER_KEY; if ("description".equals(groupBy)) { key = IResourceManager.RESOURCE_DESCR_FILTER_KEY; } else if ("updatedAt".equals(groupBy)) { key = IResourceManager.RESOURCE_MODIFY_DATE_FILTER_KEY; } else if ("createdAt".equals(groupBy)) { key = IResourceManager.RESOURCE_CREATION_DATE_FILTER_KEY; } else if ("name".equals(groupBy)) { key = IResourceManager.RESOURCE_FILENAME_FILTER_KEY; } else if ("owner".equals(groupBy)) { key = IResourceManager.RESOURCE_OWNER_FILTER_KEY; } EntitySearchFilter filter = new EntitySearchFilter(key, true); filter.setOrder(requestList.getDirection().equals(EntitySearchFilter.DESC_ORDER) ? EntitySearchFilter.DESC_ORDER : EntitySearchFilter.ASC_ORDER); return filter; }
Source:
protected MessageHandler createHandler(Object bean, Method method, List<Annotation> annotations) { String applySequence = MessagingAnnotationUtils.resolveAttribute(annotations, "applySequence", String.class); AbstractMessageSplitter splitter; if (AnnotatedElementUtils.isAnnotated(method, Bean.class.getName())) { Object target = this.resolveTargetBeanFromMethodWithBeanAnnotation(method); splitter = this.extractTypeIfPossible(target, AbstractMessageSplitter.class); if (splitter == null) { if (target instanceof MessageHandler) { Assert.hasText(applySequence, "'applySequence' can be applied to 'AbstractMessageSplitter', but " + "target handler is: " + target.getClass()); return (MessageHandler) target; } else { splitter = new MethodInvokingSplitter(target); } } } else { splitter = new MethodInvokingSplitter(bean, method); } if (StringUtils.hasText(applySequence)) { String applySequenceValue = this.environment.resolvePlaceholders(applySequence); if (StringUtils.hasText(applySequenceValue)) { splitter.setApplySequence(Boolean.parseBoolean(applySequenceValue)); } } this.setOutputChannelIfPresent(annotations, splitter); return splitter; }

Target:
protected MessageHandler createHandler(Object bean, Method method, List<Annotation> annotations) { String applySequence = MessagingAnnotationUtils.resolveAttribute(annotations, "applySequence", String.class); AbstractMessageSplitter splitter; if (AnnotatedElementUtils.isAnnotated(method, Bean.class.getName())) { Object target = this.resolveTargetBeanFromMethodWithBeanAnnotation(method); splitter = this.extractTypeIfPossible(target, AbstractMessageSplitter.class); if (splitter == null) { if (target instanceof MessageHandler) { Assert.hasText(applySequence, "'applySequence' can be applied to 'AbstractMessageSplitter', but " + "target handler is: " + target.getClass()); return (MessageHandler) target; } else { splitter = new MethodInvokingSplitter(target); } } else { return splitter; } } else { splitter = new MethodInvokingSplitter(bean, method); } if (StringUtils.hasText(applySequence)) { String applySequenceValue = this.environment.resolvePlaceholders(applySequence); if (StringUtils.hasText(applySequenceValue)) { splitter.setApplySequence(Boolean.parseBoolean(applySequenceValue)); } } this.setOutputChannelIfPresent(annotations, splitter); return splitter; }
Source:
public static void reportVideoPlayEvent(String videoName, long videoDuration, long videoStartTime) { String videoUsage; if (videoDuration == -1) { videoUsage = VIDEO_USAGE_OTHER; } else { long timeSpend = new Date().getTime() - videoStartTime; timeSpend = timeSpend + VIDEO_USAGE_ERROR_APPROXIMATION; double timeSpendInFraction = timeSpend / videoDuration; if (timeSpendInFraction <= 0.25) { videoUsage = VIDEO_USAGE_IMMEDIATE; } else if (timeSpendInFraction <= 0.5) { videoUsage = VIDEO_USAGE_PARTIAL; } else if (timeSpendInFraction <= 0.75) { videoUsage = VIDEO_USAGE_MOST; } else if (timeSpendInFraction <= 2) { videoUsage = VIDEO_USAGE_FULL; } else { videoUsage = VIDEO_USAGE_OTHER; } } reportEvent(CCAnalyticsEvent.VIEW_QUESTION_MEDIA, new String[]{FirebaseAnalytics.Param.ITEM_ID, CCAnalyticsParam.USER_RETURNED}, new String[]{videoName, videoUsage}); }

Target:
public static void reportVideoPlayEvent(String videoName, long videoDuration, long videoStartTime) { String videoUsage; if (videoDuration == -1) { videoUsage = VIDEO_USAGE_LENGTH_UNKNOWN; } else { long timeSpend = new Date().getTime() - videoStartTime; timeSpend = timeSpend + VIDEO_USAGE_ERROR_APPROXIMATION; double timeSpendInFraction = timeSpend / videoDuration; if (timeSpendInFraction <= 0.25) { videoUsage = VIDEO_USAGE_IMMEDIATE; } else if (timeSpendInFraction <= 0.5) { videoUsage = VIDEO_USAGE_PARTIAL; } else if (timeSpendInFraction <= 0.75) { videoUsage = VIDEO_USAGE_MOST; } else if (timeSpendInFraction <= 2) { videoUsage = VIDEO_USAGE_FULL; } else { videoUsage = VIDEO_USAGE_OTHER; } } reportEvent(CCAnalyticsEvent.VIEW_QUESTION_MEDIA, new String[]{FirebaseAnalytics.Param.ITEM_ID, CCAnalyticsParam.USER_RETURNED}, new String[]{videoName, videoUsage}); }
Source:
public void unexpectedBodyLength() { HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, "http://localhost") .setBody(EXPECTED); StepVerifier.create(collectRequest(httpRequest.setHeader("Content-Length", "4"))) .verifyError(UnexpectedLengthException.class); StepVerifier.create(collectRequest(httpRequest.setHeader("Content-Length", "6"))) .verifyError(UnexpectedLengthException.class); }

Target:
public void unexpectedBodyLength() { HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, "http://localhost") .setBody(EXPECTED); StepVerifier.create(collectRequest(httpRequest.setHeader("Content-Length", "4"))) .verifyErrorSatisfies(throwable -> { assertTrue(throwable instanceof UnexpectedLengthException); assertEquals("Request body emitted 5 bytes, more than the expected 4 bytes.", throwable.getMessage()); }); StepVerifier.create(collectRequest(httpRequest.setHeader("Content-Length", "6"))) .verifyErrorSatisfies(throwable -> { assertTrue(throwable instanceof UnexpectedLengthException); assertEquals("Request body emitted 5 bytes, less than the expected 6 bytes.", throwable.getMessage()); }); }
Source:
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { String analyticsLabelForPref = prefKeyToAnalyticsEvent.get(key); if (analyticsLabelForPref != null) { GoogleAnalyticsUtils.reportEditPref(GoogleAnalyticsFields.CATEGORY_DEV_PREFS, analyticsLabelForPref, getEditPrefValue(key)); } switch (key) { case ENABLE_AUTO_LOGIN: if (!isAutoLoginEnabled()) { DevSessionRestorer.clearPassword(sharedPreferences); } break; case EDIT_SAVE_SESSION: String sessionString = CommCareApplication.instance().getCurrentApp().getAppPreferences().getString(EDIT_SAVE_SESSION, ""); if (!"".equals(sessionString)) { setSessionStateFromEditText(sessionString); } break; case ENABLE_SAVE_SESSION: if (!isSessionSavingEnabled()) { DevSessionRestorer.clearSession(); } setSessionEditText(); break; case PREFS_CUSTOM_RESTORE_DOC_LOCATION: String filePath = getCustomRestoreDocLocation(); if (!filePath.isEmpty()) { if (FilenameUtils.getExtension(filePath).contentEquals("xml")) { getActivity().setResult(DeveloperPreferences.RESULT_SYNC_CUSTOM); getActivity().finish(); } else { Toast.makeText(getActivity(), Localization.get("file.wrong.type", "xml"), Toast.LENGTH_LONG).show(); } } break; } }

Target:
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { String analyticsLabelForPref = prefKeyToAnalyticsEvent.get(key); if (analyticsLabelForPref != null) { GoogleAnalyticsUtils.reportEditPref(GoogleAnalyticsFields.CATEGORY_DEV_PREFS, analyticsLabelForPref, getEditPrefValue(key)); } switch (key) { case ENABLE_AUTO_LOGIN: if (!isAutoLoginEnabled()) { DevSessionRestorer.clearPassword(sharedPreferences); } break; case EDIT_SAVE_SESSION: String sessionString = CommCareApplication.instance().getCurrentApp().getAppPreferences().getString(EDIT_SAVE_SESSION, ""); if (!"".equals(sessionString)) { setSessionStateFromEditText(sessionString); } break; case ENABLE_SAVE_SESSION: if (!isSessionSavingEnabled()) { DevSessionRestorer.clearSession(); } setSessionEditText(); break; case PREFS_CUSTOM_RESTORE_DOC_LOCATION: String filePath = getCustomRestoreDocLocation(); if (!filePath.isEmpty()) { getActivity().setResult(DeveloperPreferences.RESULT_SYNC_CUSTOM); getActivity().finish(); } break; } }
Source:
public static SWTBotTreeItem getTreeItem(final SWTBotTreeItem[] treeElements, final String name) { SWTBotTreeItem foundTreeItem = null; if (treeElements != null && treeElements.length > 0) { for (SWTBotTreeItem swtBotTreeItem : treeElements) { if (swtBotTreeItem.getText().equals(name)) { foundTreeItem = swtBotTreeItem; break; } foundTreeItem = getTreeItem(swtBotTreeItem.getItems(), name); if (foundTreeItem != null) { break; } } } return foundTreeItem; }

Target:
public static SWTBotTreeItem getTreeItem(final SWTBotTreeItem[] treeElements, final String name) { SWTBotTreeItem foundTreeItem = null; if (treeElements != null) { for (SWTBotTreeItem swtBotTreeItem : treeElements) { if (swtBotTreeItem.getText().equals(name)) { foundTreeItem = swtBotTreeItem; break; } foundTreeItem = getTreeItem(swtBotTreeItem.getItems(), name); if (foundTreeItem != null) { break; } } } return foundTreeItem; }
Source:
public int setCurrentSecretVersionByName(String name, long versionId) { checkArgument(!name.isEmpty()); checkArgument(versionId >= 0); SecretSeriesDAO secretSeriesDAO = secretSeriesDAOFactory.using(dslContext.configuration()); Optional<SecretSeries> series = secretSeriesDAO.getSecretSeriesByName(name); if (series.isPresent()) { secretSeriesDAO.setCurrentVersion(series.get().id(), versionId); return 0; } return 1; }

Target:
public void setCurrentSecretVersionByName(String name, long versionId) { checkArgument(!name.isEmpty()); checkArgument(versionId >= 0); SecretSeriesDAO secretSeriesDAO = secretSeriesDAOFactory.using(dslContext.configuration()); SecretSeries series = secretSeriesDAO.getSecretSeriesByName(name).orElseThrow( NotFoundException::new); secretSeriesDAO.setCurrentVersion(series.id(), versionId); }
Source:
private static InsnNode simplifyArith(ArithNode arith) { if (arith.getArgsCount() != 2) { return null; } InsnArg litArg = null; InsnArg secondArg = arith.getArg(1); if (secondArg.isInsnWrap()) { InsnNode wr = ((InsnWrapArg) secondArg).getWrapInsn(); if (wr.getType() == InsnType.CONST) { litArg = wr.getArg(0); } } else if (secondArg.isLiteral()) { litArg = secondArg; } if (litArg != null) { long lit = ((LiteralArg) litArg).getLiteral(); if (arith.getOp() == ArithOp.ADD && lit < 0) { return new ArithNode(ArithOp.SUB, arith.getResult(), arith.getArg(0), InsnArg.lit(-lit, litArg.getType())); } InsnArg firstArg = arith.getArg(0); if (arith.getOp() == ArithOp.XOR && firstArg.getType() == ArgType.BOOLEAN) { InsnNode node = new InsnNode(lit == 0 ? InsnType.MOVE : InsnType.NOT, 1); RegisterArg result = arith.getResult(); result.setType(ArgType.BOOLEAN); node.setResult(result); node.addArg(firstArg); return node; } } return null; }

Target:
private static InsnNode simplifyArith(ArithNode arith) { if (arith.getArgsCount() != 2) { return null; } InsnArg litArg = null; InsnArg secondArg = arith.getArg(1); if (secondArg.isInsnWrap()) { InsnNode wr = ((InsnWrapArg) secondArg).getWrapInsn(); if (wr.getType() == InsnType.CONST) { litArg = wr.getArg(0); } } else if (secondArg.isLiteral()) { litArg = secondArg; } if (litArg != null) { long lit = ((LiteralArg) litArg).getLiteral(); if (arith.getOp() == ArithOp.ADD && lit < 0) { return new ArithNode(ArithOp.SUB, arith.getResult(), arith.getArg(0), InsnArg.lit(-lit, litArg.getType())); } InsnArg firstArg = arith.getArg(0); if (arith.getOp() == ArithOp.XOR && firstArg.getType() == ArgType.BOOLEAN && (lit == 0 || lit == 1)) { InsnNode node = new InsnNode(lit == 0 ? InsnType.MOVE : InsnType.NOT, 1); node.setResult(arith.getResult()); node.addArg(firstArg); return node; } } return null; }
Source:
public Judgment sortJudges(Judgment judgment) { List<Judge> judges = judgment.getJudges().stream().collect(Collectors.toList()); Collections.sort(judges, new JudgeComparator()); judgment.removeAllJudges(); judges.forEach(p -> judgment.addJudge(p)); return judgment; }

Target:
public Judgment sortJudges(Judgment judgment) { List<Judge> judges = Lists.newArrayList(judgment.getJudges()); Collections.sort(judges, new JudgeComparator()); judgment.removeAllJudges(); judges.forEach(p -> judgment.addJudge(p)); return judgment; }
Source:
public boolean onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == RC_SAVE) { if (resultCode == Activity.RESULT_OK) { mResultLiveData.setValue(Resource.forVoidSuccess()); } else { Log.e(TAG, "SAVE: Canceled by user."); mResultLiveData.setValue(Resource.<Void>forFailure(new Exception("Save canceled by user."))); } return true; } return super.onActivityResult(requestCode, resultCode, data); }

Target:
public boolean onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == ResolutionCodes.RC_CRED_SAVE) { if (resultCode == Activity.RESULT_OK) { mResultLiveData.setValue(Resource.forVoidSuccess()); } else { Log.e(TAG, "SAVE: Canceled by user."); FirebaseUiException exception = new FirebaseUiException( ErrorCodes.UNKNOWN_ERROR, "Save canceled by user."); mResultLiveData.setValue(Resource.<Void>forFailure(exception)); } return true; } return super.onActivityResult(requestCode, resultCode, data); }
Source:
public void bye() throws UnableToStopException { try { client.done(); client.join(); } catch (InterruptedException | IOException e) { throw new UnableToStopException("Unable to stop Fit client", e); } finally { testSystemStopped(null); } }

Target:
public void bye() throws UnableToStopException { try { client.done(); client.join(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new UnableToStopException("Unable to stop Fit client", e); } catch (IOException e) { throw new UnableToStopException("Unable to stop Fit client", e); } finally { testSystemStopped(null); } }
Source:
private ColumnChunk readArray(GroupField field) throws IOException { List<Type> parameters = field.getType().getTypeParameters(); checkArgument(parameters.size() == 1, "Arrays must have a single type parameter, found %d", parameters.size()); Field elementField = field.getChildren().get(0).get(); ColumnChunk columnChunk = readColumnChunk(elementField); IntList offsets = new IntArrayList(); BooleanList valueIsNull = new BooleanArrayList(); ParquetListColumnReader.calculateCollectionOffsets(field, offsets, valueIsNull, columnChunk.getDefinitionLevels(), columnChunk.getRepetitionLevels()); Block arrayBlock = ArrayBlock.fromElementBlock(valueIsNull.size(), valueIsNull.toBooleanArray(), offsets.toIntArray(), columnChunk.getBlock()); return new ColumnChunk(arrayBlock, columnChunk.getDefinitionLevels(), columnChunk.getRepetitionLevels()); }

Target:
private ColumnChunk readArray(GroupField field) throws IOException { List<Type> parameters = field.getType().getTypeParameters(); checkArgument(parameters.size() == 1, "Arrays must have a single type parameter, found %d", parameters.size()); Field elementField = field.getChildren().get(0).get(); ColumnChunk columnChunk = readColumnChunk(elementField); IntList offsets = new IntArrayList(); BooleanList valueIsNull = new BooleanArrayList(); calculateCollectionOffsets(field, offsets, valueIsNull, columnChunk.getDefinitionLevels(), columnChunk.getRepetitionLevels()); Block arrayBlock = ArrayBlock.fromElementBlock(valueIsNull.size(), valueIsNull.toBooleanArray(), offsets.toIntArray(), columnChunk.getBlock()); return new ColumnChunk(arrayBlock, columnChunk.getDefinitionLevels(), columnChunk.getRepetitionLevels()); }