auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void setNewHeaderColumnWidth(Integer size, String representationName) { try { ResourceSet set = new ResourceSetImpl(); Resource vsm = set.getResource(URI.createPlatformResourceURI(TEMPORARY_PROJECT_NAME + "/" + VSM_NAME, true), true); Group group = (Group) vsm.getContents().get(0); final TableDescription desc; if (EDITION_TABLE_NAME.equals(representationName)) { desc = (TableDescription) group.getOwnedViewpoints().get(0).getOwnedRepresentations().get(0); } else { desc = (TableDescription) group.getOwnedViewpoints().get(0).getOwnedRepresentations().get(1); } TransactionalEditingDomain domain = new TransactionalEditingDomainImpl(new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE)); domain.getCommandStack().execute(new RecordingCommand(domain) { @Override protected void doExecute() { desc.setInitialHeaderColumnWidth(size); } }); vsm.save(Collections.emptyMap()); } catch (IOException e) { fail(e.getMessage()); } }

Target:
private void setNewHeaderColumnWidth(Integer size, String representationName) { try { ResourceSet set = new ResourceSetImpl(); Resource vsm = set.getResource(URI.createPlatformResourceURI(TEMPORARY_PROJECT_NAME + "/" + VSM_NAME, true), true); Group group = (Group) vsm.getContents().get(0); EList<RepresentationDescription> ownedRepresentations = group.getOwnedViewpoints().get(0).getOwnedRepresentations(); Optional<RepresentationDescription> description = ownedRepresentations.stream().filter(d -> d.getName().equals(representationName)).findFirst(); if (description.isPresent()) { final TableDescription desc = (TableDescription) description.get(); TransactionalEditingDomain domain = new TransactionalEditingDomainImpl(new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE)); domain.getCommandStack().execute(new RecordingCommand(domain) { @Override protected void doExecute() { desc.setInitialHeaderColumnWidth(size); } }); vsm.save(Collections.emptyMap()); } } catch (IOException e) { fail(e.getMessage()); } }
Source:
public boolean deleteFromModel(EObject self) { Boolean cancelled = null; ConfirmDeleteDialog dialog = new ConfirmDeleteDialog(Display.getCurrent().getActiveShell()); int status = dialog.open(); if (status == Dialog.OK) { try { if (deletefromModel) { DomainSpecification domainSpecification = (DomainSpecification) self; if (null != domainSpecification.getNamespacePrefix()) { EcoreUtil.remove(domainSpecification.getNamespacePrefix()); } } } catch (java.lang.ClassCastException e) { } return deletefromModel; } return cancelled; }

Target:
public boolean deleteFromModel(EObject self) { Boolean cancelled = null; ConfirmDeleteDialog dialog = new ConfirmDeleteDialog(Display.getCurrent().getActiveShell()); int status = dialog.open(); if (status == Dialog.OK) { return deletefromModel; } return cancelled; }
Source:
protected void executeQueryCommand() { List<Disk> allDisks = diskDao.getAllFromDisksIncludingSnapshotsByDiskId(getParameters().getId(), getUserID(), getParameters().isFiltered()); if (allDisks.size() == 1){ getQueryReturnValue().setReturnValue(allDisks.get(0)); return; } List<Disk> diskWithSnapshots = (List<Disk>)imagesHandler.aggregateDiskImagesSnapshots(allDisks.stream() .map(DiskImage.class::cast) .collect(Collectors.toList())); getQueryReturnValue().setReturnValue(diskWithSnapshots.get(0)); }

Target:
protected void executeQueryCommand() { List<Disk> allDisks = diskDao.getAllFromDisksIncludingSnapshotsByDiskId(getParameters().getId(), getUserID(), getParameters().isFiltered()); if (allDisks.size() == 1){ getQueryReturnValue().setReturnValue(allDisks.get(0)); return; } DiskImage diskWithSnapshots = imagesHandler.aggregateDiskImagesSnapshots(allDisks.stream() .map(DiskImage.class::cast) .collect(Collectors.toList())).stream().findFirst().orElse(null); getQueryReturnValue().setReturnValue(diskWithSnapshots); }
Source:
public ElideResponse get(String baseUrlEndPoint, String path, MultivaluedMap<String, String> queryParams, User opaqueUser, String apiVersion, UUID requestId) { return get(baseUrlEndPoint, path, queryParams, null, opaqueUser, apiVersion, requestId); }

Target:
public ElideResponse get(String baseUrlEndPoint, String path, MultivaluedMap<String, String> queryParams, User opaqueUser, String apiVersion, UUID requestId) { return get(baseUrlEndPoint, path, queryParams, Collections.emptyMap(), opaqueUser, apiVersion, requestId); }
Source:
protected String getFilePath() { if (path != null){ return path.toOSString(); } IEditorPart ed = fWindow.getActivePage().getActiveEditor(); if(ed.getEditorInput() instanceof PathEditorInput) return ((PathEditorInput)ed.getEditorInput()).getPath().toString(); else return ResourceUtil.getFile(ed.getEditorInput()).getLocation().toString(); }

Target:
protected String getFilePath() { if (path != null){ return path.toOSString(); } IEditorPart ed = fWindow.getActivePage().getActiveEditor(); if(ed.getEditorInput() instanceof PathEditorInput){ return ((PathEditorInput)ed.getEditorInput()).getPath().toString(); } else { return ResourceUtil.getFile(ed.getEditorInput()).getLocation().toString(); } }
Source:
void failWithNull() { Class<M> cls1 = typeOf(createMessage()); @SuppressWarnings("CheckReturnValue") AssertionError error = expectFailure(whenTesting -> whenTesting.that(null) .withType(cls1)); TruthFailureSubject assertError = assertThat(error); assertError.factValue(FactKey.ACTUAL.value()) .isEqualTo("null"); }

Target:
void failWithNull() { Class<M> type = typeOf(createMessage()); @SuppressWarnings("CheckReturnValue") AssertionError error = expectFailure(whenTesting -> whenTesting.that(null) .withType(type)); TruthFailureSubject assertError = assertThat(error); assertError.factValue(FactKey.ACTUAL.value()) .isEqualTo("null"); }
Source:
protected Integer calculateRecordsGraphQL(String jsonStr) { Integer rec = null; try { JsonReader jsonReader = new JsonReader(new StringReader(jsonStr)); JsonElement jsonTree = JsonParser.parseString(jsonStr); if (!jsonTree.isJsonObject()) { return null; } JsonObject jsonObject = jsonTree.getAsJsonObject(); while (jsonReader.hasNext()) { JsonToken nextToken = jsonReader.peek(); if (JsonToken.BEGIN_OBJECT.equals(nextToken)) { jsonReader.beginObject(); jsonObject = jsonTree.getAsJsonObject(); } else if (JsonToken.NAME.equals(nextToken)) { String name = jsonReader.nextName(); jsonTree = jsonObject.get(name); if (name.equals("edges")) { if (jsonTree.isJsonArray()) { JsonArray jsonArray = jsonTree.getAsJsonArray(); rec = jsonArray.size(); } break; } } } } catch (IOException e) { log.error("Exception: {}", e); throw new IllegalStateException(e); } return rec; }

Target:
protected Integer calculateRecordsGraphQL(String jsonStr) throws IOException { List<Integer> countList = JsonPath.read(jsonStr, "$..edges.length()"); Integer count = countList.size() > 0 ? countList.get(0) : 0; return count; }
Source:
public boolean commit() { if (os != null) { unlock(); throw new IllegalStateException(MessageFormat.format(JGitText.get().lockOnNotClosed, ref)); } saveStatInformation(); try { FileUtils.rename(lck, ref, StandardCopyOption.ATOMIC_MOVE); haveLck = false; token.close(); return true; } catch (IOException e) { unlock(); return false; } }

Target:
public boolean commit() { if (os != null) { unlock(); throw new IllegalStateException(MessageFormat.format(JGitText.get().lockOnNotClosed, ref)); } saveStatInformation(); try { FileUtils.rename(lck, ref, StandardCopyOption.ATOMIC_MOVE); haveLck = false; token.close(); token = null; return true; } catch (IOException e) { unlock(); return false; } }
Source:
public static void loadDriver(String dbDriver) { String driverClass = s_drivers.get(dbDriver); if (driverClass == null) { s_logger.error("DB driver type " + dbDriver + " is not supported!"); throw new CloudRuntimeException("DB driver type " + dbDriver + " is not supported!"); } if (s_loadedDrivers.contains(dbDriver)) { s_logger.debug("DB driver " + driverClass + " was already loaded."); return; } try { Class.forName(driverClass).newInstance(); s_loadedDrivers.add(dbDriver); s_logger.debug("Successfully loaded DB driver " + driverClass); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { s_logger.error("Failed to load DB driver " + driverClass); throw new CloudRuntimeException("Failed to load DB driver " + driverClass, e); } }

Target:
public static void loadDriver(String dbDriver) { String driverClass = DRIVERS.get(dbDriver); if (driverClass == null) { LOGGER.error("DB driver type " + dbDriver + " is not supported!"); throw new CloudRuntimeException("DB driver type " + dbDriver + " is not supported!"); } if (LOADED_DRIVERS.contains(dbDriver)) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("DB driver " + driverClass + " was already loaded."); } return; } try { Class.forName(driverClass).newInstance(); LOADED_DRIVERS.add(dbDriver); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Successfully loaded DB driver " + driverClass); } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { LOGGER.error("Failed to load DB driver " + driverClass); throw new CloudRuntimeException("Failed to load DB driver " + driverClass, e); } }
Source:
private void renderChangeInfo(ChangeInfo info) { changeInfo = info; lastDisplayedUpdate = info.updated(); labels.set(info); renderOwner(info); renderActionTextDate(info); renderDiffBaseListBox(info); initReplyButton(info, revision); initIncludedInAction(info); initDownloadAction(info, revision); initProjectLinks(info); initBranchLink(info); initEditMode(info, revision); actions.display(info, revision); star.setValue(info.starred()); permalink.setHref(ChangeLink.permalink(changeId)); permalink.setText(String.valueOf(info.legacy_id())); topic.set(info, revision); commit.set(commentLinkProcessor, info, revision); related.set(info, revision); reviewers.set(info); if (Gerrit.isNoteDbEnabled()) { hashtags.set(info); } else { setVisible(hashtagTableRow, false); } StringBuilder sb = new StringBuilder(); sb.append(Util.M.changeScreenTitleId(info.id_abbreviated())); if (info.subject() != null) { sb.append(": "); sb.append(info.subject()); } setWindowTitle(sb.toString()); NativeMap<ActionInfo> actionMap = info.has_actions() ? info.actions() : NativeMap.<ActionInfo> create(); initChangeAction(info, actionMap); renderRevisionInfo(info, actionMap); }

Target:
private void renderChangeInfo(ChangeInfo info) { changeInfo = info; lastDisplayedUpdate = info.updated(); labels.set(info); renderOwner(info); renderActionTextDate(info); renderDiffBaseListBox(info); initReplyButton(info, revision); initIncludedInAction(info); initChangeAction(info); initDownloadAction(info, revision); initProjectLinks(info); initBranchLink(info); initEditMode(info, revision); actions.display(info, revision); star.setValue(info.starred()); permalink.setHref(ChangeLink.permalink(changeId)); permalink.setText(String.valueOf(info.legacy_id())); topic.set(info, revision); commit.set(commentLinkProcessor, info, revision); related.set(info, revision); reviewers.set(info); if (Gerrit.isNoteDbEnabled()) { hashtags.set(info); } else { setVisible(hashtagTableRow, false); } StringBuilder sb = new StringBuilder(); sb.append(Util.M.changeScreenTitleId(info.id_abbreviated())); if (info.subject() != null) { sb.append(": "); sb.append(info.subject()); } setWindowTitle(sb.toString()); RevisionInfo revInfo = info.revision(revision); NativeMap<ActionInfo> actionMap = revInfo.has_actions() ? info.actions() : NativeMap.<ActionInfo> create(); renderRevisionInfo(info, actionMap); }
Source:
public T build() { final String lbl = label; if (lbl == null) { throw new IllegalStateException("The label has not been set yet"); } switch (channelKind) { case STATE: return (T) new StateProfileTypeImpl(profileTypeUID, lbl, supportedItemTypes); case TRIGGER: return (T) new TriggerProfileTypeImpl(profileTypeUID, lbl, supportedItemTypes, supportedChannelTypeUIDs); default: throw new IllegalArgumentException("Unknown type " + channelKind); } }

Target:
public T build() { return profileTypeFactory.create(profileTypeUID, label, supportedItemTypes, supportedChannelTypeUIDs); }
Source:
private void refresh(SessionInfo sessionInfo) { Date now = new Date(); synchronized (sessionInfo) { Date softLimit = (Date) sessionInfo.contentOfSession.get(SOFT_LIMIT_PARAMETER_NAME); if (softLimit == null) { softLimit = now; } softLimit = DateUtils.addMinutes(softLimit, Config.<Integer> getValue(ConfigValues.UserSessionTimeOutInterval)); sessionInfo.contentOfSession.put(SOFT_LIMIT_PARAMETER_NAME, softLimit); } }

Target:
private void refresh(SessionInfo sessionInfo) { Date now = new Date(); Date softLimit = (Date) sessionInfo.contentOfSession.get(SOFT_LIMIT_PARAMETER_NAME); if (softLimit == null) { softLimit = now; } int softLimitValue = Config.<Integer> getValue(ConfigValues.UserSessionTimeOutInterval); if (softLimitValue > 0) { sessionInfo.contentOfSession.put(SOFT_LIMIT_PARAMETER_NAME, DateUtils.addMinutes(now, softLimitValue)); } }
Source:
private HttpHeaders generateWarningHeaders(final EventTypeBase eventType) { final HttpHeaders headers = new HttpHeaders(); final List<String> warnings = Lists.newArrayList(nakadiSettings.getWarnAllDataAccessMessage()); if (eventType.getCleanupPolicy().equals(CleanupPolicy.COMPACT) || eventType.getCleanupPolicy().equals(CleanupPolicy.COMPACT_AND_DELETE)) { warnings.add(nakadiSettings.getLogCompactionWarnMessage()); } final String warningMessage = warnings.stream() .filter(s -> !s.isEmpty()).collect(Collectors.joining(". ")); if (!warnings.isEmpty()) { headers.add(HttpHeaders.WARNING, String.format("299 nakadi \"%s\"", warningMessage)); } return headers; }

Target:
private HttpHeaders generateWarningHeaders(final EventTypeBase eventType) { final HttpHeaders headers = new HttpHeaders(); final List<String> warnings = Lists.newArrayList(nakadiSettings.getWarnAllDataAccessMessage()); if (eventType.getCleanupPolicy().equals(CleanupPolicy.COMPACT)) { warnings.add(nakadiSettings.getLogCompactionWarnMessage()); } final String warningMessage = warnings.stream() .filter(s -> !s.isEmpty()).collect(Collectors.joining(". ")); if (!warnings.isEmpty()) { headers.add(HttpHeaders.WARNING, String.format("299 nakadi \"%s\"", warningMessage)); } return headers; }
Source:
public void closeEditors() { IFile file = getBookmarksFile(); FileEditorInput input = new FileEditorInput(file); IWorkbench wb = PlatformUI.getWorkbench(); for (IWorkbenchWindow wbWindow : wb.getWorkbenchWindows()) { for (IWorkbenchPage wbPage : wbWindow.getPages()) { for (IEditorReference editorReference : wbPage.getEditorReferences()) { try { if (editorReference.getEditorInput().equals(input)) { wbPage.closeEditor(editorReference.getEditor(false), false); } } catch (PartInitException e) { Activator.getDefault().logError("Error closing editor for " + getName(), e); } } } } }

Target:
public void closeEditors() { IFile file = getBookmarksFile(); FileEditorInput input = new FileEditorInput(file); IWorkbench wb = PlatformUI.getWorkbench(); for (IWorkbenchWindow wbWindow : wb.getWorkbenchWindows()) { for (IWorkbenchPage wbPage : wbWindow.getPages()) { for (IEditorReference editorReference : wbPage.getEditorReferences()) { try { if (editorReference.getEditorInput().equals(input)) { wbPage.closeEditor(editorReference.getEditor(false), false); } } catch (PartInitException e) { Activator.getDefault().logError(Messages.TmfCommonProjectElement_ErrorClosingEditor + getName(), e); } } } } }
Source:
public void checkSearchField() throws Exception { int nameLength = WORKSPACE_NAME.length(); int existingWorkspacesCount = getWorkspacesCount(); String sequenceForSearch = WORKSPACE_NAME.substring(nameLength - 5, nameLength); workspaces.waitVisibleWorkspacesCount(existingWorkspacesCount); workspaces.typeToSearchInput(sequenceForSearch); try { workspaces.waitVisibleWorkspacesCount(EXPECTED_SORTED_WORKSPACES_COUNT); } catch (TimeoutException ex) { fail("Known permanent failure <LINK_0>"); } List<Workspaces.WorkspaceListItem> items = workspaces.getVisibleWorkspaces(); assertEquals(items.get(0).getWorkspaceName(), WORKSPACE_NAME); workspaces.typeToSearchInput(""); workspaces.waitVisibleWorkspacesCount(getWorkspacesCount()); workspaces.waitWorkspaceIsPresent(WORKSPACE_NAME); Assert.assertEquals(workspaces.getWorkspaceProjectsValue(WORKSPACE_NAME), "1"); workspaces.waitWorkspaceIsPresent(WORKSPACE_NAME2); Assert.assertEquals(workspaces.getWorkspaceProjectsValue(WORKSPACE_NAME), "1"); }

Target:
public void checkSearchField() throws Exception { int nameLength = WORKSPACE_NAME.length(); int existingWorkspacesCount = testWorkspaceServiceClient.getWorkspacesCount(); String sequenceForSearch = WORKSPACE_NAME.substring(nameLength - 5, nameLength); workspaces.waitVisibleWorkspacesCount(existingWorkspacesCount); workspaces.typeToSearchInput(sequenceForSearch); try { workspaces.waitVisibleWorkspacesCount(EXPECTED_SEARCHED_WORKSPACES_COUNT); } catch (TimeoutException ex) { fail("Known permanent failure <LINK_0>"); } List<Workspaces.WorkspaceListItem> items = workspaces.getVisibleWorkspaces(); assertEquals(items.get(0).getWorkspaceName(), WORKSPACE_NAME); workspaces.typeToSearchInput(""); workspaces.waitVisibleWorkspacesCount(testWorkspaceServiceClient.getWorkspacesCount()); workspaces.waitWorkspaceIsPresent(WORKSPACE_NAME); Assert.assertEquals(workspaces.getWorkspaceProjectsValue(WORKSPACE_NAME), "1"); workspaces.waitWorkspaceIsPresent(WORKSPACE_NAME2); Assert.assertEquals(workspaces.getWorkspaceProjectsValue(WORKSPACE_NAME), "1"); }
Source:
public long getActualFilter() { long mandatory = BluetoothPbapVcardComposer.FILTER_VERSION | BluetoothPbapVcardComposer.FILTER_N | BluetoothPbapVcardComposer.FILTER_TEL; if (!vcard21) mandatory |= BluetoothPbapVcardComposer.FILTER_FN; return filter | mandatory; }

Target:
public long getActualFilter() { if (filter == 0L) return -1L; long mandatory = BluetoothPbapVcardComposer.FILTER_VERSION | BluetoothPbapVcardComposer.FILTER_N | BluetoothPbapVcardComposer.FILTER_TEL; if (!vcard21) mandatory |= BluetoothPbapVcardComposer.FILTER_FN; return filter | mandatory; }
Source:
public void setLineWidth(float width) { if (width < 0) { throw new AssertionError(); } mLineWidth = width; }

Target:
public void setLineWidth(float width) { Utils.assertTrue(width >= 0); mLineWidth = width; }
Source:
public final Expr asExpr() { Expr expr = new Ident(getName()); for (InputAnchor in : getInputs()) expr = new Apply(expr, in.asExpr()); return expr; }

Target:
public final Expr asExpr() { Expr expr = new Ident(getName()); for (InputAnchor in : getInputs()) { expr = new Apply(expr, in.asExpr()); } return expr; }
Source:
public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.help) { mLoginListener.help(); return true; } return false; }

Target:
public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.help) { if (mLoginListener != null) { mLoginListener.help(); } return true; } return false; }
Source:
private void startMetricsService() { if (state != State.STARTING) { return; } log.infoInitializing(); connectionAttempts++; try { session = createSession(); } catch (Exception t) { Throwable rootCause = Throwables.getRootCause(t); log.warnCouldNotConnectToCassandra(rootCause.getLocalizedMessage()); long delay = 1L + ((connectionAttempts - 1L) % 4L); log.warnRetryingConnectingToCassandra(connectionAttempts, delay); lifecycleExecutor.schedule(this::startMetricsService, delay, SECONDS); return; } try { initSchema(); dataAcces = new DataAccessImpl(session); initTaskScheduler(); metricsService = new MetricsServiceImpl(); metricsService.setDataAccess(dataAcces); metricsService.setTaskScheduler(taskScheduler); metricsService.setDateTimeService(createDateTimeService()); metricsService.setDefaultTTL(getDefaultTTL()); MetricRegistry metricRegistry = MetricRegistryProvider.INSTANCE.getMetricRegistry(); jmxReporter = JmxReporter.forRegistry(metricRegistry).inDomain("hawkular.metrics").build(); jmxReporter.start(); metricsService.startUp(session, keyspace, false, false, metricRegistry); initJobs(); metricsServiceReady.fire(new ServiceReadyEvent(metricsService.insertedDataEvents())); state = State.STARTED; log.infoServiceStarted(); } catch (Exception e) { log.fatalCannotConnectToCassandra(e); state = State.FAILED; } finally { if (state != State.STARTED && metricsService != null) { try { metricsService.shutdown(); } catch (Exception e) { log.errorCouldNotCloseServiceInstance(e); } } } }

Target:
private void startMetricsService() { if (state != State.STARTING) { return; } log.infoInitializing(); connectionAttempts++; try { session = createSession(); } catch (Exception t) { Throwable rootCause = Throwables.getRootCause(t); log.warnCouldNotConnectToCassandra(rootCause.getLocalizedMessage()); long delay = 1L + ((connectionAttempts - 1L) % 4L); log.warnRetryingConnectingToCassandra(connectionAttempts, delay); lifecycleExecutor.schedule(this::startMetricsService, delay, SECONDS); return; } try { initSchema(); dataAcces = new DataAccessImpl(session); initTaskScheduler(); metricsService = new MetricsServiceImpl(); metricsService.setDataAccess(dataAcces); metricsService.setTaskScheduler(taskScheduler); metricsService.setDateTimeService(createDateTimeService()); metricsService.setDefaultTTL(getDefaultTTL()); MetricRegistry metricRegistry = MetricRegistryProvider.INSTANCE.getMetricRegistry(); if (!Boolean.parseBoolean(disableMetricsJmxReporting)) { jmxReporter = JmxReporter.forRegistry(metricRegistry).inDomain("hawkular.metrics").build(); jmxReporter.start(); } metricsService.startUp(session, keyspace, false, false, metricRegistry); initJobs(); metricsServiceReady.fire(new ServiceReadyEvent(metricsService.insertedDataEvents())); state = State.STARTED; log.infoServiceStarted(); } catch (Exception e) { log.fatalCannotConnectToCassandra(e); state = State.FAILED; } finally { if (state != State.STARTED && metricsService != null) { try { metricsService.shutdown(); } catch (Exception e) { log.errorCouldNotCloseServiceInstance(e); } } } }
Source:
AxisDirection(final int signum) { this.signum = signum; }

Target:
private AxisDirection(final int signum) { this.signum = signum; }
Source:
public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException { List<ResourceTraversal> result= new ArrayList<>(); if (context instanceof RemoteResourceMappingContext) { for (IPackageFragment fFragment : fFragments) { result.addAll(Arrays.asList(getRemotePackageFragmentTraversals(fFragment, (RemoteResourceMappingContext)context, monitor))); } } else { for (IPackageFragment fFragment : fFragments) { result.addAll(Arrays.asList(getPackageFragmentTraversals(fFragment))); } } return result.toArray(new ResourceTraversal[result.size()]); }

Target:
public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException { List<ResourceTraversal> result= new ArrayList<>(); if (context instanceof RemoteResourceMappingContext) { for (IPackageFragment fragment : fFragments) { result.addAll(Arrays.asList(getRemotePackageFragmentTraversals(fragment, (RemoteResourceMappingContext)context, monitor))); } } else { for (IPackageFragment fragment : fFragments) { result.addAll(Arrays.asList(getPackageFragmentTraversals(fragment))); } } return result.toArray(new ResourceTraversal[result.size()]); }
Source:
protected ViewModel onValidSubmit(HttpServletRequest request, HttpServletResponse response, Form form) throws Exception { String password = form.getFieldValue("password"); Application application = (Application) request.getAttribute(Application.class.getName()); String sptoken = form.getFieldValue("sptoken"); application.resetPassword(sptoken, password); return new DefaultViewModel(getNextUri()).setRedirect(true); }

Target:
protected ViewModel onValidSubmit(HttpServletRequest request, HttpServletResponse response, Form form) throws Exception { String password = form.getFieldValue("password"); Application application = (Application) request.getAttribute(Application.class.getName()); String sptoken = form.getFieldValue("sptoken"); application.resetPassword(sptoken, password); return new DefaultViewModel(nextUri).setRedirect(true); }
Source:
public void stop(BundleContext bc) throws Exception { }

Target:
public void stop(BundleContext bc) throws Exception { LOGGER.info(I18N.tr("Groovy console stoping...")); }
Source:
private static NotificationDispatcher getNotificationDispatcher(MuleContextWithRegistry muleContext) throws RegistrationException { return muleContext.getRegistry().lookupObject(NotificationDispatcher.class); }

Target:
private static NotificationDispatcher getNotificationDispatcher(MuleContextWithRegistry muleContext) { try { return muleContext.getRegistry().lookupObject(NotificationDispatcher.class); } catch (RegistrationException e) { throw new MuleRuntimeException(e); } }
Source:
public void someUnitTest() { assertTrue(this::doSomething); }

Target:
void someUnitTest() { assertTrue(doSomething()); }
Source:
private void queueWants(final Collection<Ref> want) throws TransportException { final HashSet<ObjectId> inWorkQueue = new HashSet<ObjectId>(); for (final Ref r : want) { final ObjectId id = r.getObjectId(); if (id == null) { throw new TransportException(MessageFormat .format(JGitText.get().cannotRead, r.getName())); } try { final RevObject obj = revWalk.parseAny(id); if (obj.has(COMPLETE)) continue; if (inWorkQueue.add(id)) { obj.add(IN_WORK_QUEUE); workQueue.add(obj); } } catch (MissingObjectException e) { if (inWorkQueue.add(id)) workQueue.add(id); } catch (IOException e) { throw new TransportException(MessageFormat.format(JGitText.get().cannotRead, id.name()), e); } } }

Target:
private void queueWants(final Collection<Ref> want) throws TransportException { final HashSet<ObjectId> inWorkQueue = new HashSet<ObjectId>(); for (final Ref r : want) { final ObjectId id = r.getObjectId(); if (id == null) { throw new NullPointerException(MessageFormat.format( JGitText.get().transportProvidedRefWithNoObjectId, r.getName())); } try { final RevObject obj = revWalk.parseAny(id); if (obj.has(COMPLETE)) continue; if (inWorkQueue.add(id)) { obj.add(IN_WORK_QUEUE); workQueue.add(obj); } } catch (MissingObjectException e) { if (inWorkQueue.add(id)) workQueue.add(id); } catch (IOException e) { throw new TransportException(MessageFormat.format(JGitText.get().cannotRead, id.name()), e); } } }
Source:
public void statusOrdering() { List<TurboIssue> issues = new ArrayList<>(); for (int i = 0; i < 8; i++) { TurboIssue issue = new TurboIssue(FilterEvalTests.REPO, i, ""); if (i < 4) { issue.setOpen(true); } else { issue.setOpen(false); } issues.add(issue); } IModel model = TestUtils.singletonModel( new Model(FilterEvalTests.REPO, issues, new ArrayList<>(), new ArrayList<>(), new ArrayList<>())); List<TurboIssue> renderedIssues = new ArrayList<>(issues); Collections.sort(renderedIssues, Qualifier.getSortComparator(model, "status", false, false)); assertEquals(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7), renderedIssues.stream() .map(TurboIssue::getId) .collect(Collectors.toList())); Collections.sort(renderedIssues, Qualifier.getSortComparator(model, "status", true, false)); assertEquals(Arrays.asList(4, 5, 6, 7, 0, 1, 2, 3), renderedIssues.stream() .map(TurboIssue::getId) .collect(Collectors.toList())); Collections.sort(renderedIssues, Qualifier.getSortComparator(model, "st", false, false)); assertEquals(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7), renderedIssues.stream() .map(TurboIssue::getId) .collect(Collectors.toList())); }

Target:
public void statusOrdering() { List<TurboIssue> issues = new ArrayList<>(); for (int i = 0; i < 8; i++) { TurboIssue issue = new TurboIssue(FilterEvalTests.REPO, i, ""); if (i < 4) { issue.setOpen(true); } else { issue.setOpen(false); } issues.add(issue); } IModel model = TestUtils.singletonModel( new Model(FilterEvalTests.REPO, issues, new ArrayList<>(), new ArrayList<>(), new ArrayList<>())); List<TurboIssue> renderedIssues = new ArrayList<>(issues); assertSorted(renderedIssues, Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7), model, "status", false, false); assertSorted(renderedIssues, Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7), model, "st", false, false); assertSorted(renderedIssues, Arrays.asList(4, 5, 6, 7, 0, 1, 2, 3), model, "status", true, false); }
Source:
public static String getClassURL() { return String.format("%s/v1/%s", Stripe.getApiBase(), "apple_pay/domains"); }

Target:
private static String getClassURL() { return String.format("%s/v1/%s", Stripe.getApiBase(), "apple_pay/domains"); }
Source:
private void updateCurrentMemory(VM newVm) { int currentMemory = getVm().getMemSizeMb(); int newAmountOfMemory = newVm.getMemSizeMb(); if (getVm().getStatus().isNotRunning()) { newVmStatic.setMemSizeMb(newAmountOfMemory); return; } if (getVm().getStatus() != VMStatus.Up) { newVmStatic.setMemSizeMb(currentMemory); log.warn("Memory update {}MB -> {}MB of VM ({}) left out. Memory can't be updated in current VM state ({}).", currentMemory, newAmountOfMemory, getVm().getName(), getVm().getId(), getVm().getStatus()); return; } if (!VmCommonUtils.isMemoryToBeHotplugged(getVm(), newVm)) { return; } final int memoryAddedMb = newAmountOfMemory - currentMemory; final int factor = Config.<Integer>getValue(ConfigValues.HotPlugMemoryMultiplicationSizeMb); final boolean isMemoryDividable = memoryAddedMb % factor == 0; if (!isMemoryDividable) { addCustomValue("memoryAdded", String.valueOf(memoryAddedMb)); addCustomValue("requiredFactor", String.valueOf(factor)); auditLogDirector.log(this, AuditLogType.FAILED_HOT_SET_MEMORY_NOT_DIVIDABLE); return; } hotSetMemory(currentMemory, newAmountOfMemory); }

Target:
private void updateCurrentMemory(VM newVm) { int currentMemory = getVm().getMemSizeMb(); int newAmountOfMemory = newVm.getMemSizeMb(); if (getVm().getStatus().isNotRunning()) { newVmStatic.setMemSizeMb(newAmountOfMemory); return; } if (getVm().getStatus() != VMStatus.Up) { newVmStatic.setMemSizeMb(currentMemory); log.warn("Memory update {}MB -> {}MB of VM ({}) left out. Memory can't be updated in current VM state ({}).", currentMemory, newAmountOfMemory, getVm().getName(), getVm().getId(), getVm().getStatus()); return; } if (!VmCommonUtils.isMemoryToBeHotplugged(getVm(), newVm)) { return; } final int memoryAddedMb = newAmountOfMemory - currentMemory; final int factor = Config.<Integer>getValue(ConfigValues.HotPlugMemoryMultiplicationSizeMb); final boolean memoryDividable = memoryAddedMb % factor == 0; if (!memoryDividable) { addCustomValue("memoryAdded", String.valueOf(memoryAddedMb)); addCustomValue("requiredFactor", String.valueOf(factor)); auditLogDirector.log(this, AuditLogType.FAILED_HOT_SET_MEMORY_NOT_DIVIDABLE); return; } hotSetMemory(currentMemory, newAmountOfMemory); }
Source:
public void save(File file, String content) { try { File dir = file.getAbsoluteFile().getParentFile(); if (!dir.exists() && !dir.mkdirs()) { throw KExceptionManager.criticalError("Could not create directory " + dir); } FileUtils.writeStringToFile(file, content); } catch (IOException e) { throw KExceptionManager.criticalError("Could not write to file " + file.getAbsolutePath(), e); } }

Target:
public static void save(File file, String content) { try { File dir = file.getAbsoluteFile().getParentFile(); if (!dir.exists() && !dir.mkdirs()) { throw KExceptionManager.criticalError("Could not create directory " + dir); } FileUtils.writeStringToFile(file, content); } catch (IOException e) { throw KExceptionManager.criticalError("Could not write to file " + file.getAbsolutePath(), e); } }
Source:
public Tuple toTuple(Message msg, ProtobufExtensionRegistry extensionRegistry) { if (msg == null) { return null; } Descriptor msgDescriptor = msg.getDescriptorForType(); Set<FieldDescriptor> fdSet = new LinkedHashSet<FieldDescriptor>(); fdSet.addAll(msgDescriptor.getFields()); if(extensionRegistry != null) { fdSet.addAll(extensionRegistry.getExtensionDescriptorFields(msgDescriptor)); } Tuple tuple = tupleFactory_.newTuple(fdSet.size()); int curField = 0; try { for (FieldDescriptor fieldDescriptor : fdSet) { Object fieldValue = getFieldValue(msg, fieldDescriptor); if (fieldDescriptor.getType() == FieldDescriptor.Type.MESSAGE) { tuple.set(curField++, messageToTuple(fieldDescriptor, fieldValue, extensionRegistry)); } else { tuple.set(curField++, singleFieldToTuple(fieldDescriptor, fieldValue, extensionRegistry)); } } } catch (ExecException e) { LOG.warn("Could not convert msg " + msg + " to tuple", e); } return tuple; }

Target:
public Tuple toTuple(Message msg, ProtobufExtensionRegistry extensionRegistry) { if (msg == null) { return null; } Descriptor msgDescriptor = msg.getDescriptorForType(); List<FieldDescriptor> fdSet = msgDescriptor.getFields(); if(extensionRegistry != null) { List<FieldDescriptor> extFdSet = extensionRegistry.getExtensionDescriptorFields(msgDescriptor); List<FieldDescriptor> newFdSet = new ArrayList<FieldDescriptor>(fdSet.size() + extFdSet.size()); newFdSet.addAll(fdSet); newFdSet.addAll(extFdSet); fdSet = newFdSet; } Tuple tuple = tupleFactory_.newTuple(fdSet.size()); int curField = 0; try { for (FieldDescriptor fieldDescriptor : fdSet) { Object fieldValue = getFieldValue(msg, fieldDescriptor); if (fieldDescriptor.getType() == FieldDescriptor.Type.MESSAGE) { tuple.set(curField++, messageToTuple(fieldDescriptor, fieldValue, extensionRegistry)); } else { tuple.set(curField++, singleFieldToTuple(fieldDescriptor, fieldValue, extensionRegistry)); } } } catch (ExecException e) { LOG.warn("Could not convert msg " + msg + " to tuple", e); } return tuple; }
Source:
public static void inject(Object instance, Object... components) { List<Field> fields = ReflectionUtil.getAllFields(instance.getClass(), Inject.class); for (Field f : fields) { for (Object component : components) { if (f.getType().isInstance(component)) { ReflectionUtil.setAccessibly(instance, f, component); break; } } } }

Target:
public static void inject(Object instance, Object... components) { List<Field> fields = ReflectionUtil.getAllFields(instance.getClass(), Inject.class); for (Field f : fields) { Object matching = null; for (Object component : components) { Object currentMatch = null; if (component instanceof NamedComponent) { NamedComponent nc = (NamedComponent) component; if (!f.getType().isInstance(nc.component)) { continue; } ComponentName componentName = f.getAnnotation(ComponentName.class); if (componentName != null && componentName.value().equals(nc.name)) { currentMatch = nc.component; } } else if (f.getType().isInstance(component)) { currentMatch = component; } if (currentMatch != null) { if (matching != null) { throw new IllegalArgumentException("Two components match the field " + f + ": " + matching + " and " + component); } ReflectionUtil.setAccessibly(instance, f, currentMatch); matching = currentMatch; } } } }
Source:
private List<Partition> batchGetPartition(String databaseName, String tableName, List<String> partitionNames) { try { List<PartitionValueList> partitionValueLists = partitionNames.stream() .map(p -> new PartitionValueList().withValues(toPartitionValues(p))).collect(toList()); List<List<PartitionValueList>> batchedPartitionValueLists = Lists.partition(partitionValueLists, BATCH_GET_PARTITION_MAX_PAGE_SIZE); List<Future<BatchGetPartitionResult>> batchGetPartitionFutures = new ArrayList<>(); List<Partition> result = new ArrayList<>(); for (List<PartitionValueList> partitions : batchedPartitionValueLists) { batchGetPartitionFutures.add(glueClient.batchGetPartitionAsync(new BatchGetPartitionRequest() .withDatabaseName(databaseName) .withTableName(tableName) .withPartitionsToGet(partitions))); } for (Future<BatchGetPartitionResult> future : batchGetPartitionFutures) { BatchGetPartitionResult batchResult = future.get(); batchResult.getPartitions().stream().forEach(p -> result.add(GlueToPrestoConverter.convertPartition(p))); } return result; } catch (AmazonServiceException | InterruptedException | ExecutionException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } }

Target:
private List<Partition> batchGetPartition(String databaseName, String tableName, List<String> partitionNames) { try { List<PartitionValueList> partitionValueLists = partitionNames.stream() .map(partitionName -> new PartitionValueList().withValues(toPartitionValues(partitionName))).collect(toList()); List<List<PartitionValueList>> batchedPartitionValueLists = Lists.partition(partitionValueLists, BATCH_GET_PARTITION_MAX_PAGE_SIZE); List<Future<BatchGetPartitionResult>> batchGetPartitionFutures = new ArrayList<>(); List<Partition> result = new ArrayList<>(); for (List<PartitionValueList> partitions : batchedPartitionValueLists) { batchGetPartitionFutures.add(glueClient.batchGetPartitionAsync(new BatchGetPartitionRequest() .withDatabaseName(databaseName) .withTableName(tableName) .withPartitionsToGet(partitions))); } for (Future<BatchGetPartitionResult> future : batchGetPartitionFutures) { BatchGetPartitionResult batchResult = future.get(); batchResult.getPartitions().stream().forEach(partition -> result.add(GlueToPrestoConverter.convertPartition(partition))); } return result; } catch (AmazonServiceException | InterruptedException | ExecutionException e) { if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); } throw new PrestoException(HIVE_METASTORE_ERROR, e); } }
Source:
public Pair<Integer,Integer> getWidthHeight(int widthMeasureSpec, int heightMeasureSpec, Drawable drawable, double scaleFactor){ int wMode = MeasureSpec.getMode(widthMeasureSpec); int hMode = MeasureSpec.getMode(heightMeasureSpec); int maxWidth = wMode == MeasureSpec.AT_MOST ? Math.min(MeasureSpec.getSize(widthMeasureSpec), mMaxWidth) : mMaxWidth; int maxHeight = hMode == MeasureSpec.AT_MOST ? Math.min(MeasureSpec.getSize(heightMeasureSpec), mMaxHeight) : mMaxHeight; float dWidth = dipToPixels(getContext(), drawable.getIntrinsicWidth()); float dHeight = dipToPixels(getContext(), drawable.getIntrinsicHeight()); float ratio = (dWidth) / dHeight; int width = (int) Math.min(Math.max(dWidth, getSuggestedMinimumWidth()), maxWidth); int height = (int) (width / ratio); height = Math.min(Math.max(height, getSuggestedMinimumHeight()), maxHeight); width = (int) (height * ratio); if (width > maxWidth) { width = maxWidth; height = (int) (width / ratio); } Pair<Integer,Integer> mPair = new Pair<Integer,Integer>(new Double(width * scaleFactor).intValue(), new Double(height * scaleFactor).intValue()); return mPair; }

Target:
public Pair<Integer,Integer> getWidthHeight(int widthMeasureSpec, int heightMeasureSpec, Drawable drawable, double scaleFactor){ int wMode = MeasureSpec.getMode(widthMeasureSpec); int hMode = MeasureSpec.getMode(heightMeasureSpec); int maxWidth = wMode == MeasureSpec.AT_MOST ? Math.min(MeasureSpec.getSize(widthMeasureSpec), mMaxWidth) : mMaxWidth; int maxHeight = hMode == MeasureSpec.AT_MOST ? Math.min(MeasureSpec.getSize(heightMeasureSpec), mMaxHeight) : mMaxHeight; float dWidth = dipToPixels(getContext(), drawable.getIntrinsicWidth()); float dHeight = dipToPixels(getContext(), drawable.getIntrinsicHeight()); float ratio = (dWidth) / dHeight; int width = (int) Math.min(Math.max(dWidth, getSuggestedMinimumWidth()), maxWidth); int height = (int) (width / ratio); height = Math.min(Math.max(height, getSuggestedMinimumHeight()), maxHeight); width = (int) (height * ratio); if (width > maxWidth) { width = maxWidth; height = (int) (width / ratio); } Pair<Integer,Integer> mPair = new Pair<Integer,Integer>((int)(width * scaleFactor), (int)(height * scaleFactor)); return mPair; }
Source:
private Set<File> findDotProjectFiles(List<File> files, Repository repo) { Set<File> result = new HashSet<File>(); Path workingTreeRoot = repo.getWorkTree().toPath(); for (File changedFile : files) { if (changedFile.isFile()) { File projectFile = searchProjectFileUpwardsInRepo(changedFile .toPath().getParent(), workingTreeRoot); if (projectFile != null) { result.add(projectFile); } } } return result; }

Target:
private Set<File> findDotProjectFiles(List<File> files, Repository repo) { Set<File> result = new HashSet<File>(); String workingTreeRootPath = repo.getWorkTree().toString(); for (File changedFile : files) { if (changedFile.isFile()) { File projectFile = searchProjectFileUpwardsInRepo( changedFile.getParentFile(), workingTreeRootPath); if (projectFile != null) result.add(projectFile); } } return result; }
Source:
public Object[] factory() { List<Object> tests = new ArrayList<>(3 * 3 * 2); for (TransactionMode txMode : TransactionMode.values()) { if (txMode == NONE) { continue; } for (LockingMode lockingMode : LockingMode.values()) { tests.add(new MultipleCacheTxFunctionalTest<byte[], byte[]>().keyValueGenerator(BYTE_ARRAY_GENERATOR).transactionMode(txMode).lockingMode(lockingMode)); tests.add(new MultipleCacheTxFunctionalTest<String, String>().keyValueGenerator(STRING_GENERATOR).transactionMode(txMode).lockingMode(lockingMode)); tests.add(new MultipleCacheTxFunctionalTest<Object[], Object[]>().keyValueGenerator(GENERIC_ARRAY_GENERATOR).transactionMode(txMode).javaSerialization().lockingMode(lockingMode)); } } return tests.toArray(); }

Target:
public Object[] factory() { return Arrays.stream(TransactionMode.values()) .filter(tMode -> tMode != NONE) .flatMap(txMode -> Arrays.stream(LockingMode.values()) .flatMap(lockingMode -> Stream.builder() .add(new MultipleCacheTxFunctionalTest<byte[], byte[]>() .keyValueGenerator(BYTE_ARRAY_GENERATOR) .transactionMode(txMode) .lockingMode(lockingMode)) .add(new MultipleCacheTxFunctionalTest<String, String>() .keyValueGenerator(STRING_GENERATOR) .transactionMode(txMode) .lockingMode(lockingMode)) .add(new MultipleCacheTxFunctionalTest<Object[], Object[]>() .keyValueGenerator(GENERIC_ARRAY_GENERATOR).javaSerialization() .transactionMode(txMode) .lockingMode(lockingMode)) .build())).toArray(); }
Source:
private FileInfo waitForChange() { IntByReference rcount = new IntByReference(); ULONG_PTRByReference rkey = new ULONG_PTRByReference(); PointerByReference roverlap = new PointerByReference(); if (! Kernel32.INSTANCE.GetQueuedCompletionStatus(port, rcount, rkey, roverlap, WinBase.INFINITE)) return null; synchronized (this) { return handleMap.get(new HANDLE(new Pointer(rkey.getValue().longValue()))); } }

Target:
private FileInfo waitForChange() { IntByReference rcount = new IntByReference(); ULONG_PTRByReference rkey = new ULONG_PTRByReference(); PointerByReference roverlap = new PointerByReference(); if (! Kernel32.INSTANCE.GetQueuedCompletionStatus(port, rcount, rkey, roverlap, WinBase.INFINITE)) return null; synchronized (this) { return handleMap.get(new HANDLE(rkey.getValue().toPointer())); } }
Source:
public CloseableIteration<RyaStatement, RyaDAOException> query( final RyaStatement stmt, MongoDBRdfConfiguration conf) throws RyaDAOException { Entry<RyaStatement, BindingSet> entry = new AbstractMap.SimpleEntry<>(stmt, new MapBindingSet()); Collection<Entry<RyaStatement, BindingSet>> collection = Collections.singleton(entry); return new RyaStatementCursorIterator(queryWithBindingSet(collection, conf)); }

Target:
public CloseableIteration<RyaStatement, RyaDAOException> query( final RyaStatement stmt, MongoDBRdfConfiguration conf) throws RyaDAOException { Preconditions.checkNotNull(stmt); Preconditions.checkNotNull(conf); Entry<RyaStatement, BindingSet> entry = new AbstractMap.SimpleEntry<>(stmt, new MapBindingSet()); Collection<Entry<RyaStatement, BindingSet>> collection = Collections.singleton(entry); return new RyaStatementCursorIterator(queryWithBindingSet(collection, conf)); }
Source:
public ProtobufMatcherEvalContext(Object userContext, Object eventType, Object instance, Descriptor wrappedMessageDescriptor, SerializationContext serializationContext) { super(userContext, eventType, instance); this.serializationContext = serializationContext; try { Object inst = getInstance(); if (inst instanceof WrappedByteArray) { ProtobufParser.INSTANCE.parse(this, wrappedMessageDescriptor, ((WrappedByteArray) inst).getBytes()); } else { ProtobufParser.INSTANCE.parse(this, wrappedMessageDescriptor, (byte[]) inst); } } catch (IOException e) { throw new RuntimeException(e); } }

Target:
public ProtobufMatcherEvalContext(Object userContext, Object eventType, Object instance, Descriptor wrappedMessageDescriptor, SerializationContext serializationContext) { super(userContext, eventType, instance); this.serializationContext = serializationContext; try { Object inst = getInstance(); if (inst != null && inst.getClass() == WrappedByteArray.class) { ProtobufParser.INSTANCE.parse(this, wrappedMessageDescriptor, ((WrappedByteArray) inst).getBytes()); } else { ProtobufParser.INSTANCE.parse(this, wrappedMessageDescriptor, (byte[]) inst); } } catch (IOException e) { throw new RuntimeException(e); } }
Source:
private void readStatus(int status) { byte[] rawArray = null; if (status == 1) { rawArray = status1.read(); } else if (status == 2) { rawArray = status1.read(); } else if (status == 3) { readStatus3(); } if (rawArray != null) { double[] tempCurrents = new double[6]; tempCurrents[0] = ((rawArray[0] & 0xFF) << 2 | ((rawArray[1] & 0xC0) >> 6)) * 0.125; tempCurrents[1] = (((rawArray[1] & 0x3F) << 4) | ((rawArray[2] & 0xF0) >> 4)) * 0.125; tempCurrents[2] = (((rawArray[2] & 0x0F) << 6) | ((rawArray[3] & 0x3F) >> 2)) * 0.125; tempCurrents[3] = (((rawArray[3] & 0xC0) << 8) | ((rawArray[4] & 0xFF))) * 0.125; tempCurrents[4] = (((rawArray[5] & 0xFF) << 2) | ((rawArray[6] & 0xC0) >> 6)) * 0.125; tempCurrents[5] = (((rawArray[6] & 0x3F) << 4) | ((rawArray[7] & 0xF0) >> 4)) * 0.125; for (int i = 0; i < 6; i++) { if (tempCurrents[i] < 128) { cachedChannelCurrents[i + (status - 1) * 6] = tempCurrents[i]; } } lastRead = System.currentTimeMillis(); } }

Target:
private void readStatus(int status) { byte[] rawArray = null; int numberCurrents = 6; if (status == 1) { rawArray = status1.read(); } else if (status == 2) { rawArray = status2.read(); } else if (status == 3) { rawArray = status3.read(); numberCurrents = 4; } if (rawArray != null) { double[] tempCurrents = new double[numberCurrents]; tempCurrents[0] = ((rawArray[0] & 0xFF) << 2 | ((rawArray[1] & 0xC0) >> 6)) * 0.125; tempCurrents[1] = (((rawArray[1] & 0x3F) << 4) | ((rawArray[2] & 0xF0) >> 4)) * 0.125; tempCurrents[2] = (((rawArray[2] & 0x0F) << 6) | ((rawArray[3] & 0x3F) >> 2)) * 0.125; tempCurrents[3] = (((rawArray[3] & 0xC0) << 8) | ((rawArray[4] & 0xFF))) * 0.125; if (numberCurrents == 6) { tempCurrents[4] = (((rawArray[5] & 0xFF) << 2) | ((rawArray[6] & 0xC0) >> 6)) * 0.125; tempCurrents[5] = (((rawArray[6] & 0x3F) << 4) | ((rawArray[7] & 0xF0) >> 4)) * 0.125; } else { cachedResistance = (rawArray[5] & 0xFF) / 1000.0; cachedVoltage = (rawArray[6] & 0xFF) * 0.05 + 4.0; } for (int i = 0; i < numberCurrents; i++) { if (tempCurrents[i] < 128) { cachedChannelCurrents[i + (status - 1) * 6] = tempCurrents[i]; } } lastRead = System.currentTimeMillis(); } }
Source:
private IMethod[] getAllRippleMethods(IProgressMonitor pm, WorkingCopyOwner owner) throws CoreException { IMethod[] rippleMethods= findAllRippleMethods(pm, owner); if (fDeclarationToMatch == null) return rippleMethods; List<IMethod> rippleMethodsList= Arrays.asList(rippleMethods); List<IMethod> filteredMethods= new ArrayList<>(rippleMethodsList.size()); for (Iterator<IMethod> iter= rippleMethodsList.iterator(); iter.hasNext(); ) { IMethod currentMethod= iter.next(); Object match= fDeclarationToMatch.get(currentMethod); if (match != null) { fBinaryRefs.add((SearchMatch) match); } else { filteredMethods.add(currentMethod); } } fDeclarationToMatch= null; return toArray(filteredMethods); }

Target:
private IMethod[] getAllRippleMethods(IProgressMonitor pm, WorkingCopyOwner owner) throws CoreException { IMethod[] rippleMethods= findAllRippleMethods(pm, owner); if (fDeclarationToMatch == null) return rippleMethods; List<IMethod> filteredMethods= new ArrayList<>(rippleMethods.length / 2); for (IMethod currentMethod : rippleMethods) { Object match= fDeclarationToMatch.get(currentMethod); if (match != null) { fBinaryRefs.add((SearchMatch) match); } else { filteredMethods.add(currentMethod); } } fDeclarationToMatch= null; return toArray(filteredMethods); }