auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) { SimpleDateFormat sdf = new SimpleDateFormat("MMM d"); switch (viewHolder.getItemViewType()) { case 0: News news = this.dataset; NewsViewHolder newsViewHolder = (NewsViewHolder) viewHolder; newsViewHolder.getTitle().setText(news.getTitle()); newsViewHolder.getSubmitter().setText(news.getSubmitter()); newsViewHolder.getUrl().setText(news.getUrl()); newsViewHolder.getDate().setText(sdf.format(news.getDate())); newsViewHolder.getScore().setText(Integer.toString(news.getScore())); newsViewHolder.getCommentCount().setText(Integer.toString(news.getComments().size()) + " comments"); if (news.getBody() != null && !news.getBody().isEmpty()) { newsViewHolder.getBody().setText(news.getBody()); } else { newsViewHolder.getBody().setVisibility(View.GONE); } break; case 1: Comment comment = this.dataset.getComments().get(i - 1); CommentViewHolder commentViewHolder = (CommentViewHolder) viewHolder; commentViewHolder.getSubmitter().setText(comment.getSubmitter()); commentViewHolder.getDate().setText(sdf.format(comment.getDate())); commentViewHolder.getBody().setText(comment.getBody()); break; } }

Target:
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) { switch (viewHolder.getItemViewType()) { case 0: News news = this.dataset; NewsViewHolder newsViewHolder = (NewsViewHolder) viewHolder; newsViewHolder.getTitle().setText(news.getTitle()); newsViewHolder.getSubmitter().setText(news.getSubmitter()); newsViewHolder.getUrl().setText(Util.getDomainName(news.getUrl())); newsViewHolder.getDate().setText(this.dateFormatter.timeAgo(news.getDate())); newsViewHolder.getScore().setText(Integer.toString(news.getScore())); Resources r = this.fragment.getActivity().getResources(); int nComment = news.getComments().size(); String commentCountFormat = r.getQuantityString(R.plurals.comments, nComment, nComment); newsViewHolder.getCommentCount().setText(commentCountFormat); if (news.getBody() != null && !news.getBody().isEmpty()) { newsViewHolder.getBody().setText(news.getBody()); } else { newsViewHolder.getBody().setVisibility(View.GONE); } break; case 1: Comment comment = this.dataset.getComments().get(i - 1); CommentViewHolder commentViewHolder = (CommentViewHolder) viewHolder; commentViewHolder.getSubmitter().setText(comment.getSubmitter()); commentViewHolder.getDate().setText(this.dateFormatter.timeAgo(comment.getDate())); commentViewHolder.getBody().setText(comment.getBody()); break; } }
Source:
private static void addStates(final State current, final String value, final int i, final List<State> allStates) { if (i == value.length()) { return; } byte[] bytes = value.getBytes(Charset.forName("UTF-8")); final byte currentByte = bytes[i]; State newState = current.next.get(currentByte); if (newState == null) { current.next.put(currentByte, newState = new State(currentByte, value.substring(0, i + 1))); allStates.add(newState); } addStates(newState, value, i + 1, allStates); }

Target:
private static void addStates(final State current, final String value, final int i, final List<State> allStates) { if (i == value.length()) { return; } byte[] bytes = value.getBytes(StandardCharsets.UTF_8); final byte currentByte = bytes[i]; State newState = current.next.get(currentByte); if (newState == null) { current.next.put(currentByte, newState = new State(currentByte, value.substring(0, i + 1))); allStates.add(newState); } addStates(newState, value, i + 1, allStates); }
Source:
public String createAccount(Study study, Account account) { String userId = BridgeUtils.generateGuid(); account.setId(userId); account.setStudyId(study.getIdentifier()); DateTime timestamp = DateUtils.getCurrentDateTime(); account.setCreatedOn(timestamp); account.setModifiedOn(timestamp); account.setPasswordModifiedOn(DateUtils.getCurrentDateTime()); account.setMigrationVersion(AccountDao.MIGRATION_VERSION); hibernateHelper.create(account); return userId; }

Target:
public String createAccount(Study study, Account account) { String userId = BridgeUtils.generateGuid(); account.setId(userId); account.setStudyId(study.getIdentifier()); DateTime timestamp = DateUtils.getCurrentDateTime(); account.setCreatedOn(timestamp); account.setModifiedOn(timestamp); account.setPasswordModifiedOn(timestamp); account.setMigrationVersion(AccountDao.MIGRATION_VERSION); hibernateHelper.create(account); return userId; }
Source:
protected void initUniqueTag(String uniqueTag, Object ...valsForDefault) { if (Strings.isNonBlank(uniqueTag)) this.uniqueTag = uniqueTag; else if (Strings.isBlank(this.uniqueTag)) this.uniqueTag = getDefaultUniqueTag(valsForDefault); }

Target:
protected void initUniqueTag(String uniqueTag, Object ...valsForDefault) { if (Strings.isNonBlank(uniqueTag)) this.uniqueTag = uniqueTag; else this.uniqueTag = getDefaultUniqueTag(valsForDefault); }
Source:
protected boolean defaultAccountIndicatorIsActive(String rowIndicatorValue) { return StringUtils.equals(rowIndicatorValue, KFSConstants.ACTIVE_INDICATOR) ? true : false; }

Target:
protected boolean defaultAccountIndicatorIsActive(String rowIndicatorValue) { return StringUtils.equals(rowIndicatorValue, KFSConstants.ACTIVE_INDICATOR); }
Source:
private static Set<String> asSet(String... x) { HashSet<String> set=new HashSet<>(); for(String a:x) set.add(a); return set; }

Target:
private static Set<String> asSet(String... x) { return new HashSet<String>(Arrays.asList(x)); }
Source:
private Set<TypeElement> gather(Set<? extends TypeElement> annotations, RoundEnvironment roundEnvironment, Class<? extends Annotation> annotation, Set<TypeElement> sink) { if (annotations.stream() .map(TypeElement::getQualifiedName) .noneMatch(name -> name.contentEquals(annotation.getName()))) { return ImmutableSet.of(); } return roundEnvironment.getElementsAnnotatedWith(annotation).stream() .filter(element -> TypeElement.class.isAssignableFrom(element.getClass())) .map(element -> (TypeElement) element) .filter(element -> !sink.contains(element)) .collect(toImmutableSet()); }

Target:
private Set<TypeElement> gather(Set<? extends TypeElement> annotations, RoundEnvironment roundEnvironment, Class<? extends Annotation> annotation, Set<TypeElement> sink) { if (annotations.stream() .map(TypeElement::getQualifiedName) .noneMatch(name -> name.contentEquals(annotation.getName()))) { return ImmutableSet.of(); } return roundEnvironment.getElementsAnnotatedWith(annotation).stream() .filter(element -> TypeElement.class.isAssignableFrom(element.getClass())) .map(TypeElement.class::cast) .filter(element -> !sink.contains(element)) .collect(toImmutableSet()); }
Source:
private QueryRequest createQueryRequest(Filter filter) { QueryImpl query = new QueryImpl(filter); query.setPageSize(maxSubscriptions.get()); return new QueryRequestImpl(query, createProperties()); }

Target:
private QueryRequest createQueryRequest(Filter filter) { QueryImpl query = new QueryImpl(filter); query.setPageSize(maxSubscriptions); query.setSortBy(new SortByImpl(Core.MODIFIED, SortOrder.DESCENDING)); return new QueryRequestImpl(query, createProperties()); }
Source:
public Object setup(Map context, Object target, Member member, String propertyName) { Object result = null; if (isAccessible(context, target, member, propertyName)) { AccessibleObject accessible = (AccessibleObject) member; if (!accessible.isAccessible()) { result = Boolean.TRUE; accessible.setAccessible(true); } } return result; }

Target:
public Object setup(Map context, Object target, Member member, String propertyName) { Object result = null; if (isAccessible(context, target, member, propertyName)) { AccessibleObject accessible = (AccessibleObject) member; if (!accessible.isAccessible()) { result = Boolean.FALSE; accessible.setAccessible(true); } } return result; }
Source:
private void setSearchQuery(@Nullable String query) { if (readingList == null) { return; } currentSearchQuery = query; if (TextUtils.isEmpty(query)) { readingListPairs.clear(); for (ReadingListPage page : readingList.pages()) { readingListPairs.add(new Pair<>(readingList, page)); } adapter.notifyDataSetChanged(); updateEmptyState(query); } else { ReadingListSearchUtil.INSTANCE.searchListsAndPages(query, pairs -> { readingListPairs = pairs; adapter.notifyDataSetChanged(); updateEmptyState(query); }); } touchCallback.setSwipeableEnabled(TextUtils.isEmpty(query)); }

Target:
private void setSearchQuery(@Nullable String query) { if (readingList == null) { return; } currentSearchQuery = query; if (TextUtils.isEmpty(query)) { displayedLists.clear(); displayedLists.addAll(readingList.pages()); adapter.notifyDataSetChanged(); updateEmptyState(query); } else { ReadingListSearchUtil.INSTANCE.searchListsAndPages(query, lists -> { displayedLists = lists; adapter.notifyDataSetChanged(); updateEmptyState(query); }); } touchCallback.setSwipeableEnabled(TextUtils.isEmpty(query)); }
Source:
private void displayTournamentItem(TournamentBean tournamentBean) { String startingDate = i18n.get("tournament.noStartingDate"); if (tournamentBean.getStartingAt() != null) { startingDate = MessageFormat.format("{0} {1}", timeService.asDate(tournamentBean.getStartingAt()), timeService.asShortTime(tournamentBean.getStartingAt())); } String completedDate = i18n.get("tournament.noCompletionDate"); if (tournamentBean.getCompletedAt() != null) { completedDate = MessageFormat.format("{0} {1}", timeService.asDate(tournamentBean.getCompletedAt()), timeService.asShortTime(tournamentBean.getCompletedAt())); } try (Reader reader = new InputStreamReader(TOURNAMENT_DETAIL_HTML_RESOURCE.getInputStream())) { String html = CharStreams.toString(reader).replace("{name}", tournamentBean.getName()) .replace("{challonge-url}", tournamentBean.getChallongeUrl()) .replace("{tournament-type}", tournamentBean.getTournamentType()) .replace("{starting-date}", startingDate) .replace("{completed-date}", completedDate) .replace("{description}", tournamentBean.getDescription()) .replace("{tournament-image}", tournamentBean.getLiveImageUrl()); tournamentDetailWebView.getEngine().loadContent(html); } catch (IOException e) { throw new RuntimeException(e); } }

Target:
private void displayTournamentItem(TournamentBean tournamentBean) { String startingDate = i18n.get("tournament.noStartingDate"); if (tournamentBean.getStartingAt() != null) { startingDate = MessageFormat.format(i18n.get("dateWithTime"), timeService.asDate(tournamentBean.getStartingAt()), timeService.asShortTime(tournamentBean.getStartingAt())); } String completedDate = i18n.get("tournament.noCompletionDate"); if (tournamentBean.getCompletedAt() != null) { completedDate = MessageFormat.format(i18n.get("dateWithTime"), timeService.asDate(tournamentBean.getCompletedAt()), timeService.asShortTime(tournamentBean.getCompletedAt())); } Reader reader = new InputStreamReader(TOURNAMENT_DETAIL_HTML_RESOURCE.getInputStream()); String html = CharStreams.toString(reader).replace("{name}", tournamentBean.getName()) .replace("{challonge-url}", tournamentBean.getChallongeUrl()) .replace("{tournament-type}", tournamentBean.getTournamentType()) .replace("{starting-date}", startingDate) .replace("{completed-date}", completedDate) .replace("{description}", tournamentBean.getDescription()) .replace("{tournament-image}", tournamentBean.getLiveImageUrl()); tournamentDetailWebView.getEngine().loadContent(html); }
Source:
public void doOnTerminateErrorCrash() { Maybe.error(new TestException()) .doOnTerminate(new Action() { @Override public void run() { throw new TestException(); } }) .test() .assertFailure(CompositeException.class); }

Target:
public void doOnTerminateErrorCrash() { TestObserver<Object> to = Maybe.error(new TestException("Outer")) .doOnTerminate(new Action() { @Override public void run() { throw new TestException("Inner"); } }) .test() .assertFailure(CompositeException.class); List<Throwable> errors = TestHelper.compositeList(to.errors().get(0)); TestHelper.assertError(errors, 0, TestException.class, "Outer"); TestHelper.assertError(errors, 1, TestException.class, "Inner"); }
Source:
private void canTerminate(IProcessDMContext[] procDmcs, DataRequestMonitor<Boolean> rm) { if (procDmcs.length == 0) { rm.setData(false); rm.done(); return; } IMultiTerminate multiTerminate = fTracker.getService(IMultiTerminate.class); if (multiTerminate != null) { multiTerminate.canTerminateSome(procDmcs, rm); } else { IProcesses procService = fTracker.getService(IProcesses.class); if (procService != null && procDmcs.length == 1) { procService.canTerminate(procDmcs[0], rm); } else { rm.setData(false);; rm.done(); } } }

Target:
private void canTerminate(IProcessDMContext[] procDmcs, DataRequestMonitor<Boolean> rm) { if (procDmcs.length == 0) { IGDBControl gdbControl = fTracker.getService(IGDBControl.class); if (gdbControl != null) { rm.setData(true); } else { rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, "Service is not available.")); } rm.done(); return; } IMultiTerminate multiTerminate = fTracker.getService(IMultiTerminate.class); if (multiTerminate != null) { multiTerminate.canTerminateSome(procDmcs, rm); } else { IProcesses procService = fTracker.getService(IProcesses.class); if (procService != null && procDmcs.length == 1) { procService.canTerminate(procDmcs[0], rm); } else { rm.setData(false);; rm.done(); } } }
Source:
public ILifecycle getLifecycle() { ModelNode lifecycle = get(node, propertyKeys, LIFECYCLE); if (lifecycle.isDefined()) { return Lifecycle.fromJson(lifecycle); } else { return null; } }

Target:
public ILifecycle getLifecycle() { if (node.has(LIFECYCLE)) { return Lifecycle.fromJson(get(node, propertyKeys, LIFECYCLE)); } else { return new Lifecycle.Builder().build(); } }
Source:
public ValueMatcher makeMatcher(ColumnSelectorFactory factory) { return Filters.makeValueMatcher( factory, dimension, new DruidPredicateFactory() { @Override public Predicate<String> makeStringPredicate() { return new Predicate<String>() { @Override public boolean apply(String input) { if (input == null) { return false; } final float[] coordinate = SpatialDimensionRowTransformer.decode(input); return bound.contains(coordinate); } }; } @Override public DruidLongPredicate makeLongPredicate() { return new DruidLongPredicate() { @Override public boolean applyLong(long input) { return false; } }; } @Override public DruidFloatPredicate makeFloatPredicate() { return new DruidFloatPredicate() { @Override public boolean applyFloat(float input) { return false; } }; } } ); }

Target:
public ValueMatcher makeMatcher(ColumnSelectorFactory factory) { return Filters.makeValueMatcher( factory, dimension, new DruidPredicateFactory() { @Override public Predicate<String> makeStringPredicate() { return new Predicate<String>() { @Override public boolean apply(String input) { if (input == null) { return false; } final float[] coordinate = SpatialDimensionRowTransformer.decode(input); return bound.contains(coordinate); } }; } @Override public DruidLongPredicate makeLongPredicate() { return DruidLongPredicate.ALWAYS_FALSE; } @Override public DruidFloatPredicate makeFloatPredicate() { return DruidFloatPredicate.ALWAYS_FALSE; } } ); }
Source:
public final void execute(BlockingRunnable runnable) { if (shutdown) { throw new RejectedExecutionException("Executor Service is already shutdown"); } if (runnable.isReady()) { doExecute(runnable); } else { if (!blockedTasks.offer(runnable)) { throw new RejectedExecutionException("Queue is full"); } } checkForUnblockTasks(); if (log.isTraceEnabled()) { log.tracef("Added a new task: %s task(s) are waiting", blockedTasks.size()); } }

Target:
public final void execute(BlockingRunnable runnable) { if (shutdown) { throw new RejectedExecutionException("Executor Service is already shutdown"); } if (runnable.isReady()) { doExecute(runnable); } else { blockedTasks.offer(runnable); } if (log.isTraceEnabled()) { log.tracef("Added a new task: %s task(s) are waiting", blockedTasks.size()); } }
Source:
public Map<Tree, SymbolicBooleanConstraint> evaluateMethod(JavaFileScannerContext context, ExecutionState state, MethodTree tree) { result.clear(); if (tree.block() != null) { try { evaluateStatement(ImmutableList.of(state), tree.block()); } catch (SymbolicExecutionException e) { JavaTree javaTree = (JavaTree) tree; LOGGER.debug("in " + context.getFile() + ": analysis of " + tree.simpleName().name() + " at line " + javaTree.getLine() + " failed: " + e.getMessage(), e); result.clear(); } } return result; }

Target:
public Map<Tree, SymbolicBooleanConstraint> evaluateMethod(JavaFileScannerContext context, ExecutionState state, MethodTree tree) { result.clear(); if (tree.block() != null) { try { evaluateStatement(ImmutableList.of(state), tree.block()); } catch (SymbolicExecutionException e) { JavaTree javaTree = (JavaTree) tree; LOGGER.info("in " + context.getFile() + ": analysis of " + tree.simpleName().name() + " at line " + javaTree.getLine() + " failed: " + e.getMessage()); LOGGER.debug(e); result.clear(); } } return result; }
Source:
public void addItem(int category, Key<Technology> technology, UserProfileItem profileItem) { if (category == POSITIVE_RECOMMENDATION) { negativeRecItems.remove(technology.getString()); otherItems.remove(technology.getString()); positiveRecItems.put(technology.getString(), profileItem); } else if (category == NEGATIVE_RECOMMENDATION) { otherItems.remove(technology.getString()); positiveRecItems.remove(technology.getString()); negativeRecItems.put(technology.getString(), profileItem); } else if (category == OTHER) { positiveRecItems.remove(technology.getString()); negativeRecItems.remove(technology.getString()); otherItems.put(technology.getString(), profileItem); } }

Target:
public void addItem(int category, Key<Technology> technology, UserProfileItem profileItem) { switch (category) { case POSITIVE_RECOMMENDATION: negativeRecItems.remove(technology.getString()); otherItems.remove(technology.getString()); positiveRecItems.put(technology.getString(), profileItem); break; case NEGATIVE_RECOMMENDATION: otherItems.remove(technology.getString()); positiveRecItems.remove(technology.getString()); negativeRecItems.put(technology.getString(), profileItem); break; case OTHER: positiveRecItems.remove(technology.getString()); negativeRecItems.remove(technology.getString()); otherItems.put(technology.getString(), profileItem); break; default: break; } }
Source:
public void disablePlugins(Set<String> names) { synchronized (this) { for (String name : names) { Plugin active = running.get(name); if (active == null) { continue; } log.info(String.format("Disabling plugin %s", active.getName())); File off = new File(pluginsDir, active.getSrcFile() + ".disabled"); active.getSrcFile().renameTo(off); unloadPlugin(active); try { FileSnapshot snapshot = FileSnapshot.save(off); Plugin offPlugin = loadPlugin(name, off, snapshot); disabled.put(name, offPlugin); } catch (Throwable e) { log.warn(String.format( "Cannot load disabled plugin %s", active.getName()), e.getCause()); } } cleanInBackground(); } }

Target:
public void disablePlugins(Set<String> names) { synchronized (this) { for (String name : names) { Plugin active = running.get(name); if (active == null) { continue; } log.info(String.format("Disabling plugin %s", active.getName())); File off = new File(active.getSrcFile() + ".disabled"); active.getSrcFile().renameTo(off); unloadPlugin(active); try { FileSnapshot snapshot = FileSnapshot.save(off); Plugin offPlugin = loadPlugin(name, off, snapshot); disabled.put(name, offPlugin); } catch (Throwable e) { log.warn(String.format( "Cannot load disabled plugin %s", active.getName()), e.getCause()); } } cleanInBackground(); } }
Source:
protected DocumentModel getTokenDoc(NuxeoOAuth2ServiceProvider provider, String nxuser) throws RestOperationException { Map<String, Serializable> filter = new HashMap<>(); filter.put("serviceName", provider.getServiceName()); filter.put(NuxeoOAuth2Token.KEY_NUXEO_LOGIN, nxuser); List<DocumentModel> tokens = Framework.doPrivileged(() -> { List<DocumentModel> entries = provider.getCredentialDataStore().query(filter); return entries.stream().filter(doc -> doc != null).collect(Collectors.toList()); }); if (tokens.size() > 1) { throw new NuxeoException("Found multiple " + provider.getId() + " accounts for " + nxuser); } else if (tokens.size() == 0) { throw new RestOperationException("No token found for provider: " + provider.getId(), HttpServletResponse.SC_NOT_FOUND); } else { return tokens.get(0); } }

Target:
protected DocumentModel getTokenDoc(NuxeoOAuth2ServiceProvider provider, String nxuser) throws RestOperationException { Map<String, Serializable> filter = new HashMap<>(); filter.put("serviceName", provider.getServiceName()); filter.put(NuxeoOAuth2Token.KEY_NUXEO_LOGIN, nxuser); List<DocumentModel> tokens = Framework.doPrivileged(() -> { List<DocumentModel> entries = provider.getCredentialDataStore().query(filter); return entries.stream().filter(Objects::nonNull).collect(Collectors.toList()); }); if (tokens.size() > 1) { throw new NuxeoException("Found multiple " + provider.getId() + " accounts for " + nxuser); } else if (tokens.size() == 0) { throw new RestOperationException("No token found for provider: " + provider.getId(), HttpServletResponse.SC_NOT_FOUND); } else { return tokens.get(0); } }
Source:
public TimeGraphControl(Composite parent, TimeGraphColorScheme colors) { super(parent, colors, SWT.NO_BACKGROUND | SWT.DOUBLE_BUFFERED); fItemData = new ItemData(); addFocusListener(this); addMouseListener(this); addMouseMoveListener(this); addMouseTrackListener(this); addMouseWheelListener(this); addTraverseListener(this); addKeyListener(this); addMenuDetectListener(this); addListener(SWT.MouseWheel, this); addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { fResourceManager.dispose(); for (Font font : fFonts.values()) { font.dispose(); } } }); }

Target:
public TimeGraphControl(Composite parent, TimeGraphColorScheme colors) { super(parent, colors, SWT.NO_BACKGROUND | SWT.DOUBLE_BUFFERED); fItemData = new ItemData(); addFocusListener(this); addMouseListener(this); addMouseMoveListener(this); addMouseTrackListener(this); addMouseWheelListener(this); addTraverseListener(this); addKeyListener(this); addMenuDetectListener(this); addListener(SWT.MouseWheel, this); addDisposeListener((e) -> { fResourceManager.dispose(); for (Font font : fFonts.values()) { font.dispose(); } }); }
Source:
private int writeDebugInfo(final OutputStream os) throws IOException { int byteCount = 0; os.write(B_DEBUG_BEGIN); byteCount += B_DEBUG_BEGIN.length; final DateTime now = new DateTime(DateTimeZone.UTC); final InetAddress ip; try { ip = InetAddress.getLocalHost(); } catch (final UnknownHostException e) { throw new MyNakadiRuntimeException1("problem getting servers ip", e); } final String debugString = "Batch written at " + now.toString() + " from server " + ip.getHostAddress(); final byte[] debug = debugString.getBytes(UTF_8); os.write(debug); byteCount += debug.length; os.write(B_DEBUG_END); byteCount += B_DEBUG_END.length; return byteCount; }

Target:
private int writeDebugInfo(final OutputStream os) throws IOException { int byteCount = 0; os.write(B_DEBUG_BEGIN); byteCount += B_DEBUG_BEGIN.length; final DateTime now = new DateTime(DateTimeZone.UTC); final String stackVersion = System.getenv("STACK_VERSION"); final String debugString = "Batch written at " + now.toString() + " from server " + stackVersion; final byte[] debug = debugString.getBytes(UTF_8); os.write(debug); byteCount += debug.length; os.write(B_DEBUG_END); byteCount += B_DEBUG_END.length; return byteCount; }
Source:
public void testFullTokenIdentifierRoundTrip() throws Throwable { Text renewer = new Text("renewerName"); FullCredentialsTokenIdentifier id = new FullCredentialsTokenIdentifier( landsatUri, new Text(), renewer, new MarshalledCredentials("a", "b", ""), new EncryptionSecrets(), ""); FullCredentialsTokenIdentifier result = S3ATestUtils.roundTrip(id, null); String ids = id.toString(); assertEquals("URI in " + ids, id.getUri(), result.getUri()); assertEquals("credentials in " + ids, id.getMarshalledCredentials(), result.getMarshalledCredentials()); assertEquals(renewer, result.getRenewer()); }

Target:
public void testFullTokenIdentifierRoundTrip() throws Throwable { Text renewer = new Text("renewerName"); FullCredentialsTokenIdentifier id = new FullCredentialsTokenIdentifier( landsatUri, new Text(), renewer, new MarshalledCredentials("a", "b", ""), new EncryptionSecrets(), ""); FullCredentialsTokenIdentifier result = S3ATestUtils.roundTrip(id, null); String ids = id.toString(); assertEquals("URI in " + ids, id.getUri(), result.getUri()); assertEquals("credentials in " + ids, id.getMarshalledCredentials(), result.getMarshalledCredentials()); assertEquals("renewer in " + ids, renewer, result.getRenewer()); }
Source:
private void processStopFileRequest(Intent intent) { OCFile file = intent.getExtras().getParcelable(EXTRA_FILE); try { if(file.equals(mFile)) { processStopRequest(true); } } catch (NullPointerException e) { e.printStackTrace(); } }

Target:
private void processStopFileRequest(Intent intent) { OCFile file = intent.getExtras().getParcelable(EXTRA_FILE); try { if(file.equals(mFile)) { processStopRequest(true); } } catch (NullPointerException e) { Log_OC.e(TAG, "NullPointerException while stopping on OCFile ", e); } }
Source:
public void shouldCreateRabbitMQContainerWithExchange() throws IOException, InterruptedException { try (RabbitMQContainer container = new RabbitMQContainer()) { container.withExchange("test-exchange", "direct"); container.start(); container.waitUntilContainerStarted(); assertThat(container.execInContainer("rabbitmqctl", "list_exchanges").getStdout()) .containsPattern("test-exchange\\s+direct"); } }

Target:
public void shouldCreateRabbitMQContainerWithExchange() throws IOException, InterruptedException { try (RabbitMQContainer container = new RabbitMQContainer()) { container.withExchange("test-exchange", "direct"); container.start(); assertThat(container.execInContainer("rabbitmqctl", "list_exchanges").getStdout()) .containsPattern("test-exchange\\s+direct"); } }
Source:
public void testPurgeDocumentById() throws CouchbaseLiteException { String docID = "doc1"; MutableDocument doc = createMutableDocument(docID); doc.setValue("type", "profile"); doc.setValue("name", "Scott"); try { db.purge(docID); fail(); } catch (CouchbaseLiteException e) { if (e.getCode() == CBLError.Code.CBLErrorNotFound) ; else fail(); } assertEquals("profile", doc.getValue("type")); assertEquals("Scott", doc.getValue("name")); Document savedDoc = save(doc); db.purge(docID); assertNull(db.getDocument(docID)); }

Target:
public void testPurgeDocumentById() throws CouchbaseLiteException { String docID = "doc1"; MutableDocument doc = createMutableDocument(docID); doc.setValue("type", "profile"); doc.setValue("name", "Scott"); try { db.purge(docID); fail(); } catch (CouchbaseLiteException e) { assertEquals(e.getCode(), CBLError.Code.CBLErrorNotFound); } assertEquals("profile", doc.getValue("type")); assertEquals("Scott", doc.getValue("name")); Document savedDoc = save(doc); db.purge(docID); assertNull(db.getDocument(docID)); }
Source:
public List<Attribute> getAttributes(PerunSession sess, Facility facility) throws InternalErrorException { List<Attribute> attributesCache = null; if(!CacheManager.isCacheDisabled() && !perun.getCacheManager().wasCacheUpdatedInTransaction()) { List<Attribute> attrs = perun.getCacheManager().getAllNonEmptyAttributes(new Holder(facility.getId(), Holder.HolderType.FACILITY)); attributesCache = this.setValuesOfAttributes(sess, attrs, facility, null); } try { List<Attribute> attributesDB = jdbc.query("select " + getAttributeMappingSelectQuery("fac") + " from attr_names " + "left join facility_attr_values fac on id=fac.attr_id and fac.facility_id=? " + "where namespace=? or (namespace in (?,?) and (attr_value is not null or attr_value_text is not null))", new SingleBeanAttributeRowMapper<>(sess, this, facility), facility.getId(), AttributesManager.NS_FACILITY_ATTR_CORE, AttributesManager.NS_FACILITY_ATTR_DEF, AttributesManager.NS_FACILITY_ATTR_OPT); if (attributesCache != null) { Collections.sort(attributesDB); Collections.sort(attributesCache); if (!attributesDB.equals(attributesCache)) { log.error("The attributes do not match, attributes from cache are: " + attributesCache + " while attributes from db are: " + attributesDB + " the attributes belong to " + facility); } } return attributesDB; } catch (EmptyResultDataAccessException ex) { log.debug("No attribute for facility exists."); return new ArrayList<>(); } catch (RuntimeException ex) { throw new InternalErrorException(ex); } }

Target:
public List<Attribute> getAttributes(PerunSession sess, Facility facility) throws InternalErrorException { try { return jdbc.query("select " + getAttributeMappingSelectQuery("fac") + " from attr_names " + "left join facility_attr_values fac on id=fac.attr_id and fac.facility_id=? " + "where namespace=? or (namespace in (?,?) and (attr_value is not null or attr_value_text is not null))", new SingleBeanAttributeRowMapper<>(sess, this, facility), facility.getId(), AttributesManager.NS_FACILITY_ATTR_CORE, AttributesManager.NS_FACILITY_ATTR_DEF, AttributesManager.NS_FACILITY_ATTR_OPT); } catch (EmptyResultDataAccessException ex) { log.debug("No attribute for facility exists."); return new ArrayList<>(); } catch (RuntimeException ex) { throw new InternalErrorException(ex); } }
Source:
private void validate() { if (format == null) { if (delimiter != null && delimiter != 0) { throw new IllegalArgumentException("Custom delimiter can only be used for format option 'Custom'."); } return; } if (!format.equalsIgnoreCase("DEFAULT") && !format.equalsIgnoreCase("EXCEL") && !format.equalsIgnoreCase("MYSQL") && !format.equalsIgnoreCase("RFC4180") && !format.equalsIgnoreCase("Tab Delimited") && !format.equalsIgnoreCase("Pipe Delimited") && !format.equalsIgnoreCase("Custom") && !format.equalsIgnoreCase("PDL") && !format.equalsIgnoreCase("TDF")) { throw new IllegalArgumentException(String.format("Format %s is not one of the allowed values. Allowed values " + "are DEFAULT, EXCEL, MYSQL, RFC4180, Pipe Delimited, Tab " + "Delimited or Custom", format)); } if (format.equalsIgnoreCase("Custom") && (delimiter == null || delimiter == 0)) { throw new IllegalArgumentException("Please specify the delimiter for format option 'Custom'."); } if (!format.equalsIgnoreCase("Custom") && delimiter != null && delimiter != 0) { throw new IllegalArgumentException("Custom delimiter can only be used for format option 'Custom'."); } }

Target:
private void validate() { if (!format.equalsIgnoreCase("DEFAULT") && !format.equalsIgnoreCase("EXCEL") && !format.equalsIgnoreCase("MYSQL") && !format.equalsIgnoreCase("RFC4180") && !format.equalsIgnoreCase("Tab Delimited") && !format.equalsIgnoreCase("Pipe Delimited") && !format.equalsIgnoreCase("Custom") && !format.equalsIgnoreCase("PDL") && !format.equalsIgnoreCase("TDF")) { throw new IllegalArgumentException(String.format("Format %s is not one of the allowed values. Allowed values " + "are %s", format, Joiner.on(", ").join(FORMATS))); } if (format.equalsIgnoreCase("Custom") && (delimiter == null || delimiter == 0)) { throw new IllegalArgumentException("Please specify the delimiter for format option 'Custom'."); } if (!format.equalsIgnoreCase("Custom") && delimiter != null && delimiter != 0) { throw new IllegalArgumentException("Custom delimiter can only be used for format option 'Custom'."); } }
Source:
public void trendVisible(){ FreeStyleJob job = jenkins.jobs.create(FreeStyleJob.class, "simple-job"); job.configure(); LogParserPublisher lpp = job.addPublisher(LogParserPublisher.class); lpp.setShowGraphs(true); lpp.setRule(LogParserPublisher.RuleType.GLOBAL, rules.get("sampleRule")); job.save(); job.startBuild().waitUntilFinished(); job.startBuild().waitUntilFinished(); job.open(); WebElement trend = driver.findElement(By.className("test-trend-caption")); assertThat(trend.getText(), containsString("Log Parser Trend")); WebElement img = driver.findElement(By.xpath(" assertThat(img.getAttribute("alt"), containsString("[Log Parser Chart]")); }

Target:
public void trendVisible(){ FreeStyleJob job = jenkins.jobs.create(FreeStyleJob.class, "simple-job"); job.configure(() -> { LogParserPublisher lpp = job.addPublisher(LogParserPublisher.class); lpp.setShowGraphs(true); lpp.setRule(LogParserPublisher.RuleType.GLOBAL, rules.get("sampleRule")); }); job.startBuild().waitUntilFinished(); job.startBuild().waitUntilFinished(); job.open(); WebElement trend = driver.findElement(By.className("test-trend-caption")); assertThat(trend.getText(), containsString("Log Parser Trend")); WebElement img = driver.findElement(By.xpath(" assertThat(img.getAttribute("alt"), containsString("[Log Parser Chart]")); }
Source:
private Map<Long, MetricPlotDTOs> createFromTree() { Map<Long, MetricPlotDTOs> taskPlots = Maps.newTreeMap(); try { RootNode rootNode = databaseService.getControlTreeForSessions(new HashSet<String>(Arrays.asList(sessionId))); DetailsNode detailsNode = rootNode.getDetailsNode(); for (AbstractIdentifyNode tDNode : detailsNode.getChildren()) { TestDetailsNode testDetailsNode = (TestDetailsNode) tDNode; for (AbstractIdentifyNode mGNode : testDetailsNode.getChildren()) { MetricGroupNode metricGroupNode = (MetricGroupNode) mGNode; Map<MetricNode, PlotSeriesDto> plots = databaseService.getPlotData(new HashSet<MetricNode>(metricGroupNode.getMetrics())); String groupTitle = metricGroupNode.getDisplayName(); for (MetricNode metricNode : plots.keySet()) { XYSeriesCollection plotCollection = new XYSeriesCollection(); for (PlotDatasetDto datasetDto : plots.get(metricNode).getPlotSeries()) { XYSeries plotEntry = new XYSeries(datasetDto.getLegend()); for (PointDto point : datasetDto.getPlotData()){ plotEntry.add(point.getX(),point.getY()); } plotCollection.addSeries(plotEntry); } Pair<String, XYSeriesCollection> pair = ChartHelper.adjustTime(plotCollection, null); plotCollection = pair.getSecond(); JFreeChart chartMetric = ChartHelper.createXYChart(null, plotCollection, "Time, sec", null, 2, 2, ChartHelper.ColorTheme.LIGHT); String title = metricNode.getDisplayName(); Long id = testDetailsNode.getTaskDataDto().getId(); if (!taskPlots.containsKey(id)) taskPlots.put(id, new MetricPlotDTOs()); taskPlots.get(id).getMetricPlotDTOs().add(new MetricPlotDTO(metricNode.getDisplayName(), title, groupTitle, new JCommonDrawableRenderer(chartMetric))); groupTitle = ""; } } } } catch (Exception e) { log.error("Failed to the get metrics for the report"); } return taskPlots; }

Target:
private void createFromTree() { plots = new HashMap<Long, MetricPlotDTOs>(); Set<MetricNode> allMetrics = new HashSet<MetricNode>(); RootNode rootNode = databaseService.getControlTreeForSessions(new HashSet<String>(Arrays.asList(sessionId))); DetailsNode detailsNode = rootNode.getDetailsNode(); if (detailsNode.getTests().isEmpty() && detailsNode.getChildren().isEmpty()) return; for (TestDetailsNode testDetailsNode : detailsNode.getTests()) { allMetrics.addAll(testDetailsNode.getMetrics()); } try { plotsReal = databaseService.getPlotData(allMetrics); } catch (Exception e) { log.error("Unable to get plots information for metrics"); } for (TestDetailsNode testDetailsNode : detailsNode.getTests()) { getReport(testDetailsNode, testDetailsNode.getTaskDataDto().getId()); } }
Source:
public RowKind getRowKind() { byte header = segments[0].get(offset); return RowKind.values()[header]; }

Target:
public RowKind getRowKind() { byte kindValue = segments[0].get(offset); return RowKind.fromByteValue(kindValue); }
Source:
public void loadPageShouldRespondCandidateCollectionWhenOrderByNameAscWithFilterByEmailAndPhone() throws Exception { final SearchOptions searchOptions = SearchOptions.builder().name(EMPTY_STRING).email(CANDIDATE_EMAIL).phone(CANDIDATE_PHONE).build(); final FilterRequest filterRequest = FilterRequest.builder().order(SortingRequest.Order.ASC) .fieldName(SortingRequest.Field.NAME).searchOptions(searchOptions).build(); val filterRequestArgumentCaptor = ArgumentCaptor.forClass(FilterRequest.class); this.mockMvc.perform(get(REQUEST_URL) .param("filter", JSON_CANDIDATE_EMAIL_AND_PHONE).param("sort", NAME).param("order", ASC)) .andExpect(status().isOk()); then(candidateService).should().getAllCandidate(filterRequestArgumentCaptor.capture()); assertThat(filterRequestArgumentCaptor.getValue(), equalTo(filterRequest)); verifyNoMoreInteractions(candidateService); }

Target:
public void loadPageShouldRespondCandidateCollectionWhenOrderByNameAscWithFilterByEmailAndPhone() throws Exception { final SearchOptions searchOptions = SearchOptions.builder().name(StringUtils.EMPTY).email(CANDIDATE_EMAIL).phone(CANDIDATE_PHONE).build(); final FilterRequest filterRequest = FilterRequest.builder().order(SortingRequest.Order.ASC) .fieldName(SortingRequest.Field.NAME).searchOptions(searchOptions).build(); ArgumentCaptor<FilterRequest> filterRequestArgumentCaptor = ArgumentCaptor.forClass(FilterRequest.class); this.mockMvc.perform(get(REQUEST_URL) .param(FILTER, JSON_CANDIDATE_EMAIL_AND_PHONE).param(SORT, NAME).param(ORDER, ASC)) .andExpect(status().isOk()); then(candidateService).should().getAllCandidate(filterRequestArgumentCaptor.capture()); assertThat(filterRequestArgumentCaptor.getValue(), equalTo(filterRequest)); verifyNoMoreInteractions(candidateService); }
Source:
public WorkspaceMetacardImpl() { super(TYPE); Set<String> setOfTags = new HashSet<>(); setTags(Collections.singleton(WorkspaceAttributes.WORKSPACE_TAG)); }

Target:
public WorkspaceMetacardImpl() { super(TYPE); setTags(Collections.singleton(WorkspaceAttributes.WORKSPACE_TAG)); }
Source:
public Mono<AccessToken> authenticateWithClientSecret(String clientSecret, TokenRequestContext request) { String authorityUrl = options.getAuthorityHost().replaceAll("/+$", "") + "/" + tenantId; try { ConfidentialClientApplication.Builder applicationBuilder = ConfidentialClientApplication.builder(clientId, ClientCredentialFactory.createFromSecret(clientSecret)) .authority(authorityUrl); if (options.getHttpPipeline() != null) { applicationBuilder.httpClient(new HttpPipelineAdapter(options.getHttpPipeline())); } else { if (options.getHttpClient() != null) { HttpPipeline pipeline = setupPipeline(options.getHttpClient()); applicationBuilder.httpClient(new HttpPipelineAdapter(pipeline)); } else if (options.getProxyOptions() != null) { applicationBuilder.proxy(proxyOptionsToJavaNetProxy(options.getProxyOptions())); } } ConfidentialClientApplication application = applicationBuilder.build(); return Mono.fromFuture(application.acquireToken( ClientCredentialParameters.builder(new HashSet<>(request.getScopes())) .build())) .map(ar -> new AccessToken(ar.accessToken(), OffsetDateTime.ofInstant(ar.expiresOnDate().toInstant(), ZoneOffset.UTC))); } catch (MalformedURLException e) { return Mono.error(e); } }

Target:
public Mono<AccessToken> authenticateWithClientSecret(String clientSecret, TokenRequestContext request) { String authorityUrl = options.getAuthorityHost().replaceAll("/+$", "") + "/" + tenantId; try { ConfidentialClientApplication.Builder applicationBuilder = ConfidentialClientApplication.builder(clientId, ClientCredentialFactory.createFromSecret(clientSecret)) .authority(authorityUrl); if (httpPipelineAdapter != null) { applicationBuilder.httpClient(httpPipelineAdapter); } else if (options.getProxyOptions() != null) { applicationBuilder.proxy(proxyOptionsToJavaNetProxy(options.getProxyOptions())); } ConfidentialClientApplication application = applicationBuilder.build(); return Mono.fromFuture(application.acquireToken( ClientCredentialParameters.builder(new HashSet<>(request.getScopes())) .build())) .map(ar -> new AccessToken(ar.accessToken(), OffsetDateTime.ofInstant(ar.expiresOnDate().toInstant(), ZoneOffset.UTC))); } catch (MalformedURLException e) { return Mono.error(e); } }
Source:
public void close() throws IOException, InterruptedException { try { m_outstandingWriteTasksLock.lock(); try { while (m_outstandingWriteTasks.get() > 0) { m_noMoreOutstandingWriteTasksCondition.await(); } } finally { m_outstandingWriteTasksLock.unlock(); } m_syncTask.cancel(false); ListenableFuture<?> task = m_syncService.submit(new Runnable() { @Override public void run() { } }); try { task.get(); } catch (ExecutionException e) { SNAP_LOG.error("Error waiting on snapshot sync task cancellation", e); } m_channel.force(false); } finally { m_bytesAllowedBeforeSync.release(m_bytesWrittenSinceLastSync.getAndSet(0)); } m_channel.position(8); ByteBuffer completed = ByteBuffer.allocate(1); if (m_writeFailed) { completed.put((byte)0).flip(); } else { completed.put((byte)1).flip(); } m_channel.write(completed); m_channel.force(false); m_channel.close(); if (m_onCloseHandler != null) { m_onCloseHandler.run(); } if (m_reportedSerializationFailure != null) { throw m_reportedSerializationFailure; } }

Target:
public void close() throws IOException, InterruptedException { try { m_outstandingWriteTasksLock.lock(); try { while (m_outstandingWriteTasks.get() > 0) { m_noMoreOutstandingWriteTasksCondition.await(); } } finally { m_outstandingWriteTasksLock.unlock(); } m_syncTask.cancel(false); ListenableFuture<?> task = m_syncService.submit(new Runnable() { @Override public void run() { } }); try { task.get(); } catch (ExecutionException e) { SNAP_LOG.error("Error waiting on snapshot sync task cancellation", e); } m_channel.force(false); } finally { m_bytesAllowedBeforeSync.release(m_bytesWrittenSinceLastSync.getAndSet(0)); } m_channel.position(8); ByteBuffer completed = ByteBuffer.allocate(1); if (m_writeFailed || m_reportedSerializationFailure != null) { completed.put((byte)0).flip(); } else { completed.put((byte)1).flip(); } m_channel.write(completed); m_channel.force(false); m_channel.close(); if (m_onCloseHandler != null) { m_onCloseHandler.run(); } if (m_reportedSerializationFailure != null) { throw m_reportedSerializationFailure; } }
Source:
public static RpcConnectionEventNotifier createLocalEventLogger(final Logger log) { final RpcConnectionEventNotifier rpcEventNotifier = new RpcConnectionEventNotifier(); @SuppressWarnings("PMD.CommentRequired") final RpcConnectionEventListener listener = new RpcConnectionEventListener() { @Override public void connectionReestablished(final RpcClientChannel clientChannel) { log.info("connectionReestablished " + clientChannel); } @Override public void connectionOpened(final RpcClientChannel clientChannel) { log.info("connectionOpened " + clientChannel); } @Override public void connectionLost(final RpcClientChannel clientChannel) { log.info("connectionLost " + clientChannel); } @Override public void connectionChanged(final RpcClientChannel clientChannel) { log.info("connectionChanged " + clientChannel); } }; rpcEventNotifier.setEventListener(listener); return rpcEventNotifier; }

Target:
public static RpcConnectionEventNotifier createLocalEventLogger(final Logger log) { final RpcConnectionEventNotifier rpcEventNotifier = new RpcConnectionEventNotifier(); @SuppressWarnings("PMD.CommentRequired") final RpcConnectionEventListener listener = new RpcConnectionEventListener() { @Override public void connectionReestablished(final RpcClientChannel clientChannel) { log.info("connectionReestablished: " + clientChannel); } @Override public void connectionOpened(final RpcClientChannel clientChannel) { log.info("connectionOpened: " + clientChannel); } @Override public void connectionLost(final RpcClientChannel clientChannel) { log.info("connectionLost: " + clientChannel); } @Override public void connectionChanged(final RpcClientChannel clientChannel) { log.info("connectionChanged: " + clientChannel); } }; rpcEventNotifier.setEventListener(listener); return rpcEventNotifier; }
Source:
private void fillTagDialog() { IStructuredSelection selection = (IStructuredSelection) tagViewer .getSelection(); Object firstSelected = selection.getFirstElement(); if (firstSelected instanceof Tag) { tag = (Tag) firstSelected; if (!overwriteButton.isEnabled()) { String tagMessageValue = tag.getMessage(); if (tagMessageValue != null && !tagMessageValue.trim().isEmpty()) overwriteButton.setEnabled(true); tagNameText.setEnabled(false); commitCombo.setEnabled(false); tagMessageText.setEnabled(false); } setTagImpl(); } }

Target:
private void fillTagDialog() { IStructuredSelection selection = (IStructuredSelection) tagViewer .getSelection(); Object firstSelected = selection.getFirstElement(); if (firstSelected instanceof Tag) { tag = (Tag) firstSelected; if (!overwriteButton.isEnabled()) { String tagMessageValue = tag.getMessage(); if (tagMessageValue != null && tagMessageValue.trim().length() != 0) overwriteButton.setEnabled(true); tagNameText.setEnabled(false); commitCombo.setEnabled(false); tagMessageText.setEnabled(false); } setTagImpl(); } }
Source:
protected void executeCommand() { VDSStatus statusBeforeUpgrade = getVds().getStatus(); if (statusBeforeUpgrade != VDSStatus.Maintenance) { if (getVds().getClusterSupportsGlusterService()) { boolean returnValue = resourceManager.runVdsCommand(VDSCommandType.GlusterServersList, new VdsIdVDSCommandParametersBase(getVdsId())).getSucceeded(); if (returnValue) { isStopGluster = true; } } Future<ActionReturnValue> maintenanceCmd = commandCoordinatorUtil.executeAsyncCommand(ActionType.MaintenanceNumberOfVdss, createMaintenanceParams(), cloneContext()); ActionReturnValue result; try { result = maintenanceCmd.get(); if (!result.getSucceeded()) { propagateFailure(result); return; } } catch (InterruptedException | ExecutionException e) { log.error("Exception", e); return; } } setSucceeded(true); }

Target:
protected void executeCommand() { VDSStatus statusBeforeUpgrade = getVds().getStatus(); if (statusBeforeUpgrade != VDSStatus.Maintenance) { boolean stopGlusterService = false; if (getVds().getClusterSupportsGlusterService()) { boolean returnValue = resourceManager.runVdsCommand(VDSCommandType.GlusterServersList, new VdsIdVDSCommandParametersBase(getVdsId())).getSucceeded(); if (returnValue) { stopGlusterService = true; } } Future<ActionReturnValue> maintenanceCmd = commandCoordinatorUtil.executeAsyncCommand(ActionType.MaintenanceNumberOfVdss, createMaintenanceParams(stopGlusterService), cloneContext()); ActionReturnValue result; try { result = maintenanceCmd.get(); if (!result.getSucceeded()) { propagateFailure(result); return; } } catch (InterruptedException | ExecutionException e) { log.error("Exception", e); return; } } setSucceeded(true); }
Source:
public void onCommitClicked() { DevMachine devMachine = appContext.getDevMachine(); Path location = project.getLocation(); Path[] filesToCommitArray = new Path[filesToCommit.size()]; filesToCommit.forEach(file -> filesToCommitArray[filesToCommit.indexOf(file)] = Path.valueOf(file)); service.add(devMachine, location, false, filesToCommitArray) .then(arg -> { service.commit(devMachine, location, view.getMessage(), false, filesToCommitArray, view.isAmend()) .then(revision -> { onCommitSuccess(revision); if (view.isPushAfterCommit()) { String remoteBranch = view.getRemoteBranch(); String remote = remoteBranch.split("/")[0]; String branch = remoteBranch.split("/")[1]; service.push(devMachine, location, singletonList(branch), remote, false) .then(result -> { notificationManager.notify(constant.pushSuccess(remote), SUCCESS, FLOAT_MODE); }) .catchError(error -> { notificationManager.notify(constant.pushFail(), FAIL, FLOAT_MODE); }); } view.close(); }) .catchError(error -> { handleError(error.getCause()); }); }) .catchError(error -> { notificationManager.notify(constant.addFailed(), FAIL, FLOAT_MODE); }); }

Target:
public void onCommitClicked() { DevMachine devMachine = appContext.getDevMachine(); Path location = project.getLocation(); Path[] filesToCommitArray = getFilesToCommitArray(); service.add(devMachine, location, false, filesToCommitArray) .then(arg -> { service.commit(devMachine, location, view.getMessage(), false, filesToCommitArray, view.isAmend()) .then(revision -> { onCommitSuccess(revision); if (view.isPushAfterCommit()) { push(devMachine, location); } view.close(); }) .catchError(error -> { handleError(error.getCause()); }); }) .catchError(error -> { notificationManager.notify(constant.addFailed(), FAIL, FLOAT_MODE); }); }