auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testStart() { Date date1 = new Date(2000, 01, 01); Date date2 = new Date(1995, 01, 01); ExpenseClaim claim1 = new ExpenseClaim(null, null, date1, null, null); ExpenseClaim claim2 = new ExpenseClaim(null, null, date2, null, null); ListModel<ExpenseClaim> listmodel = new ListModel<ExpenseClaim>("claims.dat", getContext()); listmodel.add(claim1); listmodel.add(claim2); List<ExpenseClaim> claims = listmodel.getItems(); Intent data = getStartDateAscendingIntent(); listmodel.setComparator((Comparator<ExpenseClaim>) data.getSerializableExtra(ExpenseClaimSortActivity.EXPENSE_CLAIM_SORT)); assertNotNull(data); assertEquals(claims.get(0), claim1); data = getStartDateDescendingIntent(); listmodel.setComparator((Comparator<ExpenseClaim>) data.getSerializableExtra(ExpenseClaimSortActivity.EXPENSE_CLAIM_SORT)); assertEquals(claims.get(1).getStartDate(),claim2.getStartDate()); data = getCreationDateDescendingIntent(); listmodel.setComparator((Comparator<ExpenseClaim>) data.getSerializableExtra(ExpenseClaimSortActivity.EXPENSE_CLAIM_SORT)); data = getCreationDateAscendingIntent(); listmodel.setComparator((Comparator<ExpenseClaim>) data.getSerializableExtra(ExpenseClaimSortActivity.EXPENSE_CLAIM_SORT)); }

Target:
public void testStart() throws InterruptedException { Date date1 = new Date(2000, 01, 01); Date date2 = new Date(1995, 01, 01); ExpenseClaim claim1 = new ExpenseClaim(null, null, date1, null, null, null); Thread.sleep(2000); ExpenseClaim claim2 = new ExpenseClaim(null, null, date2, null, null, null); ListModel<ExpenseClaim> listmodel = new ListModel<ExpenseClaim>("claims_test.dat", getContext()); listmodel.removeAll(); listmodel.add(claim1); listmodel.add(claim2); List<ExpenseClaim> claims = listmodel.getItems(); Intent data = getStartDateAscendingIntent(); Comparator<ExpenseClaim> comparator = (Comparator<ExpenseClaim>)data.getSerializableExtra(ExpenseClaimSortActivity.EXPENSE_CLAIM_SORT); listmodel.setComparator(comparator); assertNotNull(comparator); assertEquals(claims.get(0),claim2); data = getStartDateDescendingIntent(); listmodel.setComparator((Comparator<ExpenseClaim>) data.getSerializableExtra(ExpenseClaimSortActivity.EXPENSE_CLAIM_SORT)); assertEquals(claims.get(0),claim1); data = getCreationDateDescendingIntent(); listmodel.setComparator((Comparator<ExpenseClaim>) data.getSerializableExtra(ExpenseClaimSortActivity.EXPENSE_CLAIM_SORT)); assertEquals(claims.get(0),claim2); data = getCreationDateAscendingIntent(); listmodel.setComparator((Comparator<ExpenseClaim>) data.getSerializableExtra(ExpenseClaimSortActivity.EXPENSE_CLAIM_SORT)); assertEquals(claims.get(0),claim1); }
Source:
public String getReleaseStage() { try { int appFlags = appContext.getPackageManager().getApplicationInfo(packageName, 0).flags; if((appFlags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { return "development"; } } catch (PackageManager.NameNotFoundException e) { Logger.warn("Could not get releaseStage"); } return "production"; }

Target:
public String getReleaseStage() { if(config.releaseStage != null) { return config.releaseStage; } else { return guessedReleaseStage; } }
Source:
private InputStream getResource(String resource) throws IOException { File resourceFile = new File(resource); if (resourceFile.exists() && !resourceFile.isFile()) { throw new IOException(String.format("%s is not a file. ", resourceFile.getAbsolutePath())); } InputStream is = resourceFile.exists() ? new FileInputStream(resourceFile) : Thread.currentThread().getContextClassLoader().getResourceAsStream(resource); if (is == null) { throw new IOException(String.format("Not found resource: %s", resource)); } return is; }

Target:
private InputStream getResource(String resource) throws IOException { File resourceFile = new File(resource); if (resourceFile.exists() && !resourceFile.isFile()) { throw new IOException(String.format("%s is not a file. ", resourceFile.getAbsolutePath())); } InputStream is = resourceFile.exists() ? new FileInputStream(resourceFile) : Resources.getResource(resource).openStream(); if (is == null) { throw new IOException(String.format("Not found resource: %s", resource)); } return is; }
Source:
public void onPromoteComplete( @Observes final PromoteCompleteEvent event ) { if ( !eventAuditConfig.isEnabled() ) { return; } FileGroupingEvent fileGroupingEvent = new FileGroupingEvent( FileGroupingEventType.BY_PATH_PROMOTION ); transformFileGroupingEvent( event, fileGroupingEvent ); eventPublisher.publishFileGroupingEvent( fileGroupingEvent ); }

Target:
public void onPromoteComplete( @Observes final PromoteCompleteEvent event ) { if ( !eventAuditConfig.isEnabled() ) { return; } if ( event instanceof PathsPromoteCompleteEvent ) { FileGroupingEvent fileGroupingEvent = new FileGroupingEvent( FileGroupingEventType.BY_PATH_PROMOTION ); transformFileGroupingEvent( event, fileGroupingEvent ); eventPublisher.publishFileGroupingEvent( fileGroupingEvent ); } else { logger.trace( "Unsupported grouping event: {}", event.getClass() ); return; } }
Source:
protected ChronicleLogAppender(File basePath, int size, String retentionDuration) { if (size == 0) { if (!exists(basePath)) { String msg = "Cannot open Chronicle Queues, invalid path: " + basePath; log.error(msg); throw new IllegalArgumentException(msg); } this.nbQueues = findNbQueues(basePath); } else { if (exists(basePath)) { String msg = "Cannot create Chronicle Queues, already exists: " + basePath; log.error(msg); throw new IllegalArgumentException(msg); } if (!basePath.exists() && !basePath.mkdirs()) { String msg = "Cannot create Chronicle Queues in: " + basePath; log.error(msg); throw new IllegalArgumentException(msg); } this.nbQueues = size; } this.name = basePath.getName(); this.basePath = basePath; if (retentionDuration != null) { retentionNbCycles = Integer.valueOf(retentionDuration.substring(0, retentionDuration.length() - 1)); } RollCycle rollCycle = getRollCycle(retentionDuration); queues = new ArrayList<>(this.nbQueues); log.debug(String.format("%s chronicle queue: %s, path: %s, size: %d", (size == 0) ? "Opening" : "Creating", name, basePath, nbQueues)); for (int i = 0; i < nbQueues; i++) { File path = new File(basePath, String.format("%s%02d", QUEUE_PREFIX, i)); ChronicleQueue queue = SingleChronicleQueueBuilder.binary(path) .rollCycle(rollCycle) .storeFileListener(this) .build(); queues.add(queue); if (!queue.file().exists() && !queue.file().mkdirs()) { log.error("Fail to create directory: " + queue.file().getAbsolutePath()); } } }

Target:
protected ChronicleLogAppender(File basePath, int size, String retentionDuration) { if (size == 0) { if (!exists(basePath)) { String msg = "Cannot open Chronicle Queues, invalid path: " + basePath; log.error(msg); throw new IllegalArgumentException(msg); } this.nbQueues = findNbQueues(basePath); } else { if (exists(basePath)) { String msg = "Cannot create Chronicle Queues, already exists: " + basePath; log.error(msg); throw new IllegalArgumentException(msg); } if (!basePath.exists() && !basePath.mkdirs()) { String msg = "Cannot create Chronicle Queues in: " + basePath; log.error(msg); throw new IllegalArgumentException(msg); } this.nbQueues = size; } this.name = basePath.getName(); this.basePath = basePath; if (retentionDuration != null) { retentionNbCycles = Integer.parseInt(retentionDuration.substring(0, retentionDuration.length() - 1)); } RollCycle rollCycle = getRollCycle(retentionDuration); queues = new ArrayList<>(this.nbQueues); if (log.isDebugEnabled()) { log.debug(String.format("%s chronicle queue: %s, path: %s, size: %d", (size == 0) ? "Opening" : "Creating", name, basePath, nbQueues)); } for (int i = 0; i < nbQueues; i++) { File path = new File(basePath, String.format("%s%02d", QUEUE_PREFIX, i)); ChronicleQueue queue = SingleChronicleQueueBuilder.binary(path) .rollCycle(rollCycle) .storeFileListener(this) .build(); queues.add(queue); try { Files.createDirectories(queue.file().toPath()); } catch (IOException e) { throw new IllegalArgumentException("Cannot create directory: " + queue.file().getAbsolutePath(), e); } } }
Source:
private Optional<WindowPane<K, Object>> onTriggerFired( TriggerKey<K> triggerKey, MessageCollector collector, TaskCoordinator coordinator) { LOG.trace("Trigger key fired." , triggerKey); TriggerImplHandler wrapper = triggers.get(triggerKey); WindowKey<K> windowKey = triggerKey.getKey(); long timestamp = Long.parseLong(windowKey.getPaneId()); List<Object> existingState = getValues(windowKey); if (existingState == null || existingState.size() == 0) { LOG.trace("No state found for triggerKey: {}", triggerKey); return Optional.empty(); } Object windowVal = window.getFoldLeftFunction() == null ? existingState : existingState.get(0); WindowPane<K, Object> paneOutput = computePaneOutput(triggerKey, windowVal); if (window.getAccumulationMode() == AccumulationMode.DISCARDING) { LOG.trace("Clearing state for trigger key: {}", triggerKey); timeSeriesDb.remove(windowKey.getKey(), timestamp); } if (triggerKey.getType() == FiringType.DEFAULT) { LOG.trace("Default trigger fired. Canceling triggers for {}", triggerKey); cancelTrigger(triggerKey, true); cancelTrigger(new TriggerKey(FiringType.EARLY, triggerKey.getKey()), true); timeSeriesDb.remove(windowKey.getKey(), timestamp); } if (triggerKey.getType() == FiringType.EARLY && !wrapper.isRepeating()) { cancelTrigger(triggerKey, false); } return Optional.of(paneOutput); }

Target:
private Optional<WindowPane<K, Object>> onTriggerFired(TriggerKey<K> triggerKey, MessageCollector collector, TaskCoordinator coordinator) { LOG.trace("Trigger key fired." , triggerKey); TriggerImplHandler wrapper = triggers.get(triggerKey); long timestamp = triggerKey.getTimestamp(); K key = triggerKey.getKey(); List<Object> existingState = getValues(key, timestamp); if (existingState == null || existingState.size() == 0) { LOG.trace("No state found for triggerKey: {}", triggerKey); return Optional.empty(); } Object windowVal = window.getFoldLeftFunction() == null ? existingState : existingState.get(0); WindowPane<K, Object> paneOutput = computePaneOutput(triggerKey, windowVal); if (window.getAccumulationMode() == AccumulationMode.DISCARDING) { LOG.trace("Clearing state for trigger key: {}", triggerKey); timeSeriesStore.remove(key, timestamp); } if (triggerKey.getType() == FiringType.DEFAULT) { LOG.trace("Default trigger fired. Canceling triggers for {}", triggerKey); cancelTrigger(triggerKey, true); cancelTrigger(new TriggerKey(FiringType.EARLY, triggerKey.getKey(), triggerKey.getTimestamp()), true); timeSeriesStore.remove(key, timestamp); } if (triggerKey.getType() == FiringType.EARLY && !wrapper.isRepeating()) { cancelTrigger(triggerKey, false); } return Optional.of(paneOutput); }
Source:
private void initCreateTxt() { createTxt = new NpTextBox(); createTxt.setVisibleLength(50); createTxt.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if (event.getCharCode() == KeyCodes.KEY_ENTER) { doCreateProject(); } } }); createTxt.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { createButton.setEnabled(!createTxt.getText().trim().isEmpty()); } }); }

Target:
private void initCreateTxt() { createTxt = new NpTextBox(); createTxt.setVisibleLength(50); createTxt.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if (!createTxt.getText().trim().isEmpty() && event.getCharCode() == KeyCodes.KEY_ENTER) { doCreateProject(); } } }); createTxt.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { createButton.setEnabled(!createTxt.getText().trim().isEmpty()); } }); }
Source:
public static void main(String[] args) throws Exception { printHello(); Parameters param = getParameters(args); if (param.isStream()) { StatusListener listener = new StatusListener() { @Override public void onException(Exception e) { } @Override public void onStatus(Status status) { printStatus(status, param.isHideRetwitts()); try { sleep(PAUSE); } catch (InterruptedException e) { System.out.println(e.getMessage()); } } @Override public void onDeletionNotice(StatusDeletionNotice statusDeletionNotice) { } @Override public void onTrackLimitationNotice(int i) { } @Override public void onScrubGeo(long l, long l1) { } @Override public void onStallWarning(StallWarning stallWarning) { } }; try { stream(param, listener); } catch (TwitterException e) { System.out.println(e.getMessage()); stream(param, listener); } catch (Exception e) { System.out.println(e.getMessage()); System.exit(-1); } } else { try { search(param); } catch (TwitterException e) { System.out.println(e.getMessage()); search(param); } catch (Exception e) { System.out.println(e.getMessage()); System.exit(-1); } } }

Target:
public static void main(String[] args) throws Exception { printHello(); Parameters param = getParameters(args); if (param.isStream()) { StatusListener listener = new StatusListener() { @Override public void onException(Exception e) { } @Override public void onStatus(Status status) { printStatus(status, param.isHideRetwitts()); try { sleep(PAUSE); } catch (InterruptedException e) { System.out.println(e.getMessage()); } } @Override public void onDeletionNotice(StatusDeletionNotice statusDeletionNotice) { } @Override public void onTrackLimitationNotice(int i) { } @Override public void onScrubGeo(long l, long l1) { } @Override public void onStallWarning(StallWarning stallWarning) { } }; try { stream(param, listener); } catch (TwitterException e) { System.err.println(e.getMessage()); stream(param, listener); } catch (Exception e) { System.err.println(e.getMessage()); System.exit(-1); } } else { try { search(param); } catch (TwitterException e) { System.err.println(e.getMessage()); search(param); } catch (Exception e) { System.err.println(e.getMessage()); System.exit(-1); } } }
Source:
protected boolean delete(XWikiContext context) throws XWikiException { XWiki xwiki = context.getWiki(); XWikiRequest request = context.getRequest(); XWikiResponse response = context.getResponse(); XWikiDocument doc = context.getDoc(); String sindex = request.getParameter(RECYCLED_DOCUMENT_ID_PARAM); String emptyBin = request.getParameter(EMPTY_RECYCLE_BIN); String skipRecycleBinParam = request.getParameter(SKIP_RECYCLE_BIN_PARAM); boolean skipRecycleBin; if (skipRecycleBinParam == null) { skipRecycleBin = false; } else { skipRecycleBin = Boolean.parseBoolean(skipRecycleBinParam); } if ("true".equals(emptyBin)) { return deleteAllFromRecycleBin(context); } else if (sindex != null && xwiki.hasRecycleBin(context)) { deleteFromRecycleBin(Long.parseLong(sindex), context); return true; } else if (doc.isNew()) { sendRedirect(response, Utils.getRedirect("view", context)); return true; } else { return deleteToRecycleBin(context, skipRecycleBin); } }

Target:
protected boolean delete(XWikiContext context) throws XWikiException { XWiki xwiki = context.getWiki(); XWikiRequest request = context.getRequest(); XWikiResponse response = context.getResponse(); XWikiDocument doc = context.getDoc(); String sindex = request.getParameter(RECYCLED_DOCUMENT_ID_PARAM); String emptyBin = request.getParameter(EMPTY_RECYCLE_BIN); if ("true".equals(emptyBin)) { return deleteAllFromRecycleBin(context); } else if (sindex != null && xwiki.hasRecycleBin(context)) { deleteFromRecycleBin(Long.parseLong(sindex), context); return true; } else if (doc.isNew()) { sendRedirect(response, Utils.getRedirect("view", context)); return true; } else { boolean skipRecycleBin = Boolean.parseBoolean(request.getParameter(SKIP_RECYCLE_BIN_PARAM)); return deleteToRecycleBin(context, skipRecycleBin); } }
Source:
public CosmosPagedFlux<CosmosDatabaseProperties> queryDatabases(String query, CosmosQueryRequestOptions options) { return queryDatabasesInternal(new SqlQuerySpec(query), options); }

Target:
public CosmosPagedFlux<CosmosDatabaseProperties> queryDatabases(String query, CosmosQueryRequestOptions options) { if (options == null) { options = new CosmosQueryRequestOptions(); } return queryDatabasesInternal(new SqlQuerySpec(query), options); }
Source:
private void resolveBundles0(ResolverBundle[] bundles, Dictionary<Object, Object>[] platformProperties) { if (developmentMode) Arrays.sort(bundles); Collection<String> processedFragments = new HashSet<>(bundles.length); for (ResolverBundle bundle : bundles) { attachFragment(bundle, processedFragments); } List<ResolverBundle> cycle = new ArrayList<>(1); for (ResolverBundle bundle : bundles) { if (DEBUG) { ResolverImpl.log("** RESOLVING " + bundle + " **"); } cycle.clear(); resolveBundle(bundle, cycle); checkCycle(cycle); } if (unresolvedBundles.size() > 0) { ResolverBundle[] unresolved = unresolvedBundles.toArray(new ResolverBundle[unresolvedBundles.size()]); for (ResolverBundle unresolved1 : unresolved) { resolveFragment(unresolved1); } } checkUsesConstraints(bundles, platformProperties); checkComposites(bundles, platformProperties); }

Target:
private void resolveBundles0(ResolverBundle[] bundles, Dictionary<Object, Object>[] platformProperties) { if (developmentMode) Arrays.sort(bundles); Collection<String> processedFragments = new HashSet<>(bundles.length); for (ResolverBundle bundle : bundles) { attachFragment(bundle, processedFragments); } List<ResolverBundle> cycle = new ArrayList<>(1); for (ResolverBundle bundle : bundles) { if (DEBUG) { ResolverImpl.log("** RESOLVING " + bundle + " **"); } cycle.clear(); resolveBundle(bundle, cycle); checkCycle(cycle); } if (unresolvedBundles.size() > 0) { ResolverBundle[] unresolved = unresolvedBundles.toArray(new ResolverBundle[unresolvedBundles.size()]); for (ResolverBundle toResolve : unresolved) { resolveFragment(toResolve); } } checkUsesConstraints(bundles, platformProperties); checkComposites(bundles, platformProperties); }
Source:
public Map<String, String> getAllParameters() { Map<String, String> result = Maps.newHashMap(); Map<String, String> parameters = getSuite().getParameters(); for (Map.Entry<String, String> parameter : parameters.entrySet()) { result.put(parameter.getKey(), parameter.getValue()); } for (Map.Entry<String, String> entry : m_parameters.entrySet()) { result.put(entry.getKey(), entry.getValue()); } return result; }

Target:
public Map<String, String> getAllParameters() { Map<String, String> result = Maps.newHashMap(); result.putAll(getSuite().getParameters()); result.putAll(m_parameters); return result; }
Source:
protected synchronized void stopExecutionHereButKeepTheServerRunning() { Instant start = Instant.now(); while (!Thread.currentThread().isInterrupted()) { try { Instant end = Instant.now(); Duration timeElapsed = Duration.between(start, end); System.out.println(String.format("Server listening for %d minutes on port %d", timeElapsed.toMinutes(), getPort())); wait(60000); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } } }

Target:
protected synchronized void stopExecutionHereButKeepTheServerRunning() { Instant start = Instant.now(); while (true) { Duration timeElapsed = Duration.between(start, Instant.now()); System.out.println(String.format("Server listening for %d minutes on port %d", timeElapsed.toMinutes(), getPort())); Uninterruptibles.sleepUninterruptibly(1, TimeUnit.MINUTES); } }
Source:
private GroupByVisitor buildVisitor(String aggregateAttribute, String aggregateVisitor, String[] groupByAttributes) { GroupByVisitorBuilder visitorBuilder = new GroupByVisitorBuilder() .withAggregateAttribute(aggregateAttribute, buildingType) .withAggregateVisitor(aggregateVisitor); for (String groupByAttribute : groupByAttributes) { visitorBuilder.withGroupByAttribute(groupByAttribute, buildingType); } GroupByVisitor visitor = visitorBuilder.build(); return visitor; }

Target:
private GroupByVisitor buildVisitor(String aggregateAttribute, String aggregateVisitor, String[] groupByAttributes) { GroupByVisitorBuilder visitorBuilder = new GroupByVisitorBuilder() .withAggregateAttribute(aggregateAttribute, buildingType) .withAggregateVisitor(aggregateVisitor); for (String groupByAttribute : groupByAttributes) { visitorBuilder.withGroupByAttribute(groupByAttribute, buildingType); } return visitorBuilder.build(); }
Source:
Timeframe getTimeframe() { return this.timeframe; }

Target:
public Timeframe getTimeframe() { return this.timeframe; }
Source:
private synchronized void loadFrom(final File store) { if (store.length() != 0L) { try ( final RandomAccessFile file = new RandomAccessFile(store, "r"); final FileChannel channel = file.getChannel(); final FileLock lock = channel.lock(0L, Long.MAX_VALUE, true); final ObjectInputStream deserialize = new ObjectInputStream(new FileInputStream(store)) ) { this.index.clear(); this.index.putAll((Map<URI, String>) deserialize.readObject()); } catch (final IOException | ClassNotFoundException ex) { throw new IllegalStateException(ex); } } }

Target:
private void loadFrom(final File store) { if (store.length() != 0L) { try ( final RandomAccessFile file = new RandomAccessFile(store, "r"); final FileChannel channel = file.getChannel(); final FileLock lock = channel.lock(0L, Long.MAX_VALUE, true); final ObjectInputStream deserialize = new ObjectInputStream(new FileInputStream(store)) ) { this.index.clear(); this.index.putAll((Map<URI, String>) deserialize.readObject()); } catch (final IOException | ClassNotFoundException ex) { throw new IllegalStateException(ex); } } }
Source:
private double getAccrued(DayCount dayCount, Calendar calendar, ZonedDateTime valuationDate, AnnuityDefinition<? extends CouponDefinition> annuity, ZonedDateTimeDoubleTimeSeries indexTimeSeries) { double res = 0.0; CouponDefinition[] payments = annuity.getPayments(); for (CouponDefinition payment : payments) { if (payment.getAccrualStartDate().isBefore(valuationDate) && !payment.getPaymentDate().isBefore(valuationDate)) { double rate; if (payment instanceof CouponIborDefinition) { CouponIborDefinition casted = (CouponIborDefinition) payment; CouponFixed coupon = (CouponFixed) casted.toDerivative(valuationDate, indexTimeSeries); rate = coupon.getFixedRate(); } else if (payment instanceof CouponFixedDefinition) { rate = 1.0; } else { throw new IllegalArgumentException("This annuity type is not supported"); } res += getAccrued(dayCount, calendar, valuationDate, payment) * rate; } } return res; }

Target:
private double getAccrued(DayCount dayCount, Calendar calendar, ZonedDateTime valuationDate, AnnuityDefinition<? extends CouponDefinition> annuity, ZonedDateTimeDoubleTimeSeries indexTimeSeries) { LocalDate date = valuationDate.toLocalDate(); double res = 0.0; CouponDefinition[] payments = annuity.getPayments(); for (CouponDefinition payment : payments) { if (payment.getAccrualStartDate().toLocalDate().isBefore(date) && !payment.getPaymentDate().toLocalDate().isBefore(date)) { double rate; if (payment instanceof CouponIborDefinition) { CouponIborDefinition casted = (CouponIborDefinition) payment; Coupon coupon = casted.toDerivative(valuationDate, indexTimeSeries); ArgumentChecker.isTrue(coupon instanceof CouponFixed, "index should be fixed before accrual starts for standard vanilla swap"); CouponFixed couponFixed = (CouponFixed) coupon; rate = couponFixed.getFixedRate(); } else if (payment instanceof CouponFixedDefinition) { rate = 1.0; } else { throw new IllegalArgumentException("This annuity type is not supported"); } res += getAccrued(dayCount, calendar, valuationDate, payment) * rate; } } return res; }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("Y:" + this.getClass().getName(), "Start creating Message Activity"); setContentView(R.layout.activity_message); YieldsApplication.setApplicationContext(getApplicationContext()); YieldsApplication.setResources(getResources()); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); mActionBar = getSupportActionBar(); mActionBar.setDisplayHomeAsUpEnabled(true); mUser = YieldsApplication.getUser(); mGroup = YieldsApplication.getGroup(); mImage = null; mSendImage = false; mGroupMessageAdapter = new ListAdapterMessages(YieldsApplication .getApplicationContext(), R.layout.messagelayoutsender, new ArrayList<Message>()); mCommentAdapter = new ListAdapterMessages((YieldsApplication .getApplicationContext()), R.layout.messagelayoutsender, new ArrayList<Message>()); mInputField = (EditText) findViewById(R.id.inputMessageField); if (mUser == null || mGroup == null) { String message = "Couldn't get group information."; YieldsApplication.showToast(getApplicationContext(), message); mActionBar.setTitle("Unknown group"); } else { setHeaderBar(); } mSendButton = (ImageButton) findViewById(R.id.sendButton); mType = ContentType.GROUP_MESSAGES; mFragmentManager = getFragmentManager(); createGroupMessageFragment(); NodeHistoryRequest historyRequest = new NodeHistoryRequest(mGroup, new Date()); YieldsApplication.getBinder().sendRequest(historyRequest); mImageThumbnail = (ImageView) findViewById(R.id.imagethumbnail); mImageThumbnail.setPadding(0, 0, 0, 0); Log.d("Y:" + this.getClass().getName(), "Start creating Message Activity"); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_message); YieldsApplication.setApplicationContext(getApplicationContext()); YieldsApplication.setResources(getResources()); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); mActionBar = getSupportActionBar(); mActionBar.setDisplayHomeAsUpEnabled(true); mUser = YieldsApplication.getUser(); mGroup = YieldsApplication.getGroup(); mImage = null; mSendImage = false; mGroupMessageAdapter = new ListAdapterMessages(YieldsApplication .getApplicationContext(), R.layout.messagelayoutsender, new ArrayList<Message>()); mCommentAdapter = new ListAdapterMessages((YieldsApplication .getApplicationContext()), R.layout.messagelayoutsender, new ArrayList<Message>()); mInputField = (EditText) findViewById(R.id.inputMessageField); if (mUser == null || mGroup == null) { String message = "Couldn't get group information."; YieldsApplication.showToast(getApplicationContext(), message); mActionBar.setTitle("Unknown group"); } else { setHeaderBar(); } mSendButton = (ImageButton) findViewById(R.id.sendButton); mType = ContentType.GROUP_MESSAGES; mFragmentManager = getFragmentManager(); createGroupMessageFragment(); NodeHistoryRequest historyRequest = new NodeHistoryRequest(mGroup, new Date()); YieldsApplication.getBinder().sendRequest(historyRequest); mImageThumbnail = (ImageView) findViewById(R.id.imagethumbnail); mImageThumbnail.setPadding(0, 0, 0, 0); }
Source:
public boolean areRelated(Object object1, IRelationTypeSide relationType, Object object2) { boolean related = false; Artifact useArt1 = getArtifact(object1); Artifact useArt2 = getArtifact(object2); if (useArt1 != null & useArt2 != null) { related = useArt1.isRelated(relationType, useArt2); } return related; }

Target:
public boolean areRelated(Object object1, IRelationTypeSide relationType, Object object2) { boolean related = false; Artifact useArt1 = getArtifact(object1); Artifact useArt2 = getArtifact(object2); if (useArt1 != null && useArt2 != null) { related = useArt1.isRelated(relationType, useArt2); } return related; }
Source:
private <K, V> void assertContainsOnlyKeys(AssertionInfo info, Map<K, V> actual, String placeholderForErrorMessages, K... keys) { assertNotNull(info, actual); failIfNull(keys, ErrorMessages.keysToLookForIsNull(placeholderForErrorMessages)); if (actual.isEmpty() && keys.length == 0) { return; } failIfEmpty(keys, ErrorMessages.keysToLookForIsEmpty(placeholderForErrorMessages)); Set<K> notFound = new LinkedHashSet<>(); Set<K> notExpected = new LinkedHashSet<>(); compareActualMapAndExpectedKeys(actual, keys, notExpected, notFound); if (!notFound.isEmpty() || !notExpected.isEmpty()) throw failures.failure(info, shouldContainOnlyKeys(actual, keys, notFound, notExpected)); }

Target:
private <K, V> void assertContainsOnlyKeys(AssertionInfo info, Map<K, V> actual, String placeholderForErrorMessages, K... keys) { assertNotNull(info, actual); failIfNull(keys, keysToLookForIsNull(placeholderForErrorMessages)); if (actual.isEmpty() && keys.length == 0) { return; } failIfEmpty(keys, keysToLookForIsEmpty(placeholderForErrorMessages)); Set<K> notFound = new LinkedHashSet<>(); Set<K> notExpected = new LinkedHashSet<>(); compareActualMapAndExpectedKeys(actual, keys, notExpected, notFound); if (!notFound.isEmpty() || !notExpected.isEmpty()) throw failures.failure(info, shouldContainOnlyKeys(actual, keys, notFound, notExpected)); }
Source:
private void handleWifiP2pAction(Intent intent) { if (mConfig.isWifiP2pLegacyTetheringMode()) return; final WifiP2pInfo p2pInfo = (WifiP2pInfo) intent.getParcelableExtra(WifiP2pManager.EXTRA_WIFI_P2P_INFO); final WifiP2pGroup group = (WifiP2pGroup) intent.getParcelableExtra(WifiP2pManager.EXTRA_WIFI_P2P_GROUP); if (VDBG) { Log.d(TAG, "WifiP2pAction: P2pInfo: " + p2pInfo + " Group: " + group); } synchronized (Tethering.this.mPublicSync) { if (p2pInfo != null && group != null && group.isGroupOwner() && !TextUtils.isEmpty(group.getInterface())) { if (!TextUtils.isEmpty(mWifiP2pTetherInterface)) { if (mWifiP2pTetherInterface.equals(group.getInterface())) { return; } else { mLog.w("P2P tethered interface " + mWifiP2pTetherInterface + "is different from current interface " + group.getInterface() + ", re-tether it"); disableWifiP2pIpServingLocked(mWifiP2pTetherInterface); } } mWifiP2pTetherInterface = group.getInterface(); enableWifiIpServingLocked(mWifiP2pTetherInterface, IFACE_IP_MODE_LOCAL_ONLY); } else if (group == null && !TextUtils.isEmpty(mWifiP2pTetherInterface)) { disableWifiP2pIpServingLocked(mWifiP2pTetherInterface); mWifiP2pTetherInterface = null; } } }

Target:
private void handleWifiP2pAction(Intent intent) { if (mConfig.isWifiP2pLegacyTetheringMode()) return; final WifiP2pInfo p2pInfo = (WifiP2pInfo) intent.getParcelableExtra(WifiP2pManager.EXTRA_WIFI_P2P_INFO); final WifiP2pGroup group = (WifiP2pGroup) intent.getParcelableExtra(WifiP2pManager.EXTRA_WIFI_P2P_GROUP); if (VDBG) { Log.d(TAG, "WifiP2pAction: P2pInfo: " + p2pInfo + " Group: " + group); } synchronized (Tethering.this.mPublicSync) { if (p2pInfo == null || !p2pInfo.groupFormed) { disableWifiP2pIpServingLockedIfNeeded(mWifiP2pTetherInterface); mWifiP2pTetherInterface = null; return; } if (!isGroupOwner(group)) return; if (group.getInterface().equals(mWifiP2pTetherInterface)) return; if (!TextUtils.isEmpty(mWifiP2pTetherInterface)) { mLog.w("P2P tethered interface " + mWifiP2pTetherInterface + "is different from current interface " + group.getInterface() + ", re-tether it"); disableWifiP2pIpServingLockedIfNeeded(mWifiP2pTetherInterface); } mWifiP2pTetherInterface = group.getInterface(); enableWifiIpServingLocked(mWifiP2pTetherInterface, IFACE_IP_MODE_LOCAL_ONLY); } }
Source:
public int read(byte[] b, int off, int len) throws IOException { if (len == 0) { return 0; } if (mPosition == mStatus.getLength()) { return -1; } int bytesRead = 0; while (bytesRead < len && mPosition < mStatus.getLength()) { long currentPage = mPosition / mPageSize; int currentPageOffset = (int) (mPosition % mPageSize); int bytesLeftInPage = (int) Math.min(mPageSize - currentPageOffset, len - bytesRead); PageId pageId = new PageId(mStatus.getFileId(), currentPage); try (ReadableByteChannel cachedData = mCacheManager.get(pageId, currentPageOffset)) { if (cachedData != null) { ByteBuffer buf = ByteBuffer.wrap(b); buf.position(off + bytesRead); buf.limit(off + bytesRead + bytesLeftInPage); while (buf.position() != buf.limit()) { if (cachedData.read(buf) == -1) { break; } } Preconditions.checkState(buf.position() == buf.limit()); bytesRead += bytesLeftInPage; mPosition += bytesLeftInPage; } else { byte[] page = readExternalPage(mPosition); if (page.length > 0) { mCacheManager.put(pageId, page); System.arraycopy(page, currentPageOffset, b, off + bytesRead, bytesLeftInPage); bytesRead += bytesLeftInPage; mPosition += bytesLeftInPage; } } } } Preconditions.checkState(bytesRead == len || (bytesRead < len && remaining() == 0), "Invalid number of bytes read"); return bytesRead; }

Target:
public int read(byte[] b, int off, int len) throws IOException { Preconditions.checkArgument(len >= 0, "length should be non-negative"); Preconditions.checkArgument(off >= 0, "offset should be non-negative"); if (len == 0) { return 0; } if (mPosition >= mStatus.getLength()) { return -1; } int bytesRead = 0; while (bytesRead < len && mPosition < mStatus.getLength()) { long currentPage = mPosition / mPageSize; int currentPageOffset = (int) (mPosition % mPageSize); int bytesLeftInPage = (int) Math.min(mPageSize - currentPageOffset, len - bytesRead); PageId pageId = new PageId(mStatus.getFileId(), currentPage); try (ReadableByteChannel cachedData = mCacheManager.get(pageId, currentPageOffset)) { if (cachedData != null) { ByteBuffer buf = ByteBuffer.wrap(b); buf.position(off + bytesRead); buf.limit(off + bytesRead + bytesLeftInPage); while (buf.position() != buf.limit()) { if (cachedData.read(buf) == -1) { break; } } Preconditions.checkState(buf.position() == buf.limit()); bytesRead += bytesLeftInPage; mPosition += bytesLeftInPage; } else { byte[] page = readExternalPage(mPosition); if (page.length > 0) { mCacheManager.put(pageId, page); System.arraycopy(page, currentPageOffset, b, off + bytesRead, bytesLeftInPage); bytesRead += bytesLeftInPage; mPosition += bytesLeftInPage; } } } } Preconditions.checkState(bytesRead == len || (bytesRead < len && remaining() == 0), "Invalid number of bytes read - " + "bytes to read = %d, actual bytes read = %d, bytes remains in file %d", len, bytesRead, remaining()); return bytesRead; }
Source:
public static TimeLockAgent create( MetricsManager metricsManager, TimeLockInstallConfiguration install, Supplier<TimeLockRuntimeConfiguration> runtime, UserAgent userAgent, int threadPoolSize, long blockingTimeoutMs, Consumer<Object> registrar, Optional<Consumer<UndertowService>> undertowRegistrar) { ExecutorService executor = createSharedExecutor(metricsManager); PaxosResources paxosResources = PaxosResourcesFactory.create( ImmutableTimelockPaxosInstallationContext.of(install, userAgent), metricsManager, Suppliers.compose(TimeLockRuntimeConfiguration::paxos, runtime::get), executor); TimeLockAgent agent = new TimeLockAgent( metricsManager, install, runtime, undertowRegistrar, threadPoolSize, blockingTimeoutMs, registrar, paxosResources, userAgent); agent.createAndRegisterResources(paxosResources.leadershipContextFactory().sqliteDataSource()); return agent; }

Target:
public static TimeLockAgent create( MetricsManager metricsManager, TimeLockInstallConfiguration install, Supplier<TimeLockRuntimeConfiguration> runtime, UserAgent userAgent, int threadPoolSize, long blockingTimeoutMs, Consumer<Object> registrar, Optional<Consumer<UndertowService>> undertowRegistrar) { ExecutorService executor = createSharedExecutor(metricsManager); PaxosResourcesFactory.TimelockPaxosInstallationContext installationContext = ImmutableTimelockPaxosInstallationContext.of(install, userAgent); PaxosResources paxosResources = PaxosResourcesFactory.create( installationContext, metricsManager, Suppliers.compose(TimeLockRuntimeConfiguration::paxos, runtime::get), executor); TimeLockAgent agent = new TimeLockAgent( metricsManager, install, runtime, undertowRegistrar, threadPoolSize, blockingTimeoutMs, registrar, paxosResources, userAgent, installationContext.sqliteDataSource()); agent.createAndRegisterResources(); return agent; }
Source:
public void stop() throws LifeCycleStopException { if (!state.compareAndSet(State.STARTED, State.STOPPING)) { return; } Thread thread = shutdownHook.getAndSet(null); if (thread != null) { try { Runtime.getRuntime().removeShutdownHook(thread); } catch (IllegalStateException ignored) { } } log.info("Life cycle stopping..."); List<Object> reversedInstances = new ArrayList<>(managedInstances); Collections.reverse(reversedInstances); LifeCycleStopException stopException = null; for (Object obj : reversedInstances) { log.debug("Stopping %s", obj.getClass().getName()); LifeCycleMethods methods = methodsMap.get(obj.getClass()); for (Method preDestroy : methods.methodsFor(PreDestroy.class)) { log.debug("\t%s()", preDestroy.getName()); try { preDestroy.invoke(obj); } catch (Exception e) { Throwable t = (e instanceof InvocationTargetException) ? ((InvocationTargetException) e).getTargetException() : e; log.error("Exception in PreDestroy method %s::%s()", obj.getClass().getName(), preDestroy.getName(), t); if (stopException == null) { stopException = new LifeCycleStopException(); } stopException.addSuppressed(t); } } } state.set(State.STOPPED); if (stopException != null) { throw stopException; } log.info("Life cycle stopped."); }

Target:
public void stop() throws LifeCycleStopException { AtomicBoolean failure = new AtomicBoolean(false); stop((klass, method, exception) -> { failure.set(true); log.error(exception, "Exception in PreDestroy method %s::%s()", klass.getName(), method.getName()); }); if (failure.get()) { throw new LifeCycleStopException(); } }
Source:
private Grouping determineGrouping(String delimiter) { if (delimiter.isEmpty()) return Grouping.NONE; return delimiter.equals(EXCLUSIVE_DELIMITER) ? Grouping.EXCLUSIVE : Grouping.NON_EXCLUSIVE; }

Target:
private Grouping determineGrouping(String delimiter) { switch (delimiter) { case EXCLUSIVE_DELIMITER: return Grouping.EXCLUSIVE; case NONEXCLUSIVE_DELIMITER: return Grouping.NON_EXCLUSIVE; case "": return Grouping.NONE; default: assert false : "Unsupported delimiter found"; return Grouping.NONE; } }
Source:
private String getTextValue(Element element, String tagName) { NodeList nodes = element.getElementsByTagName(tagName); Element nodeElement = (Element) nodes.item(0); NodeList nodeList = nodeElement.getChildNodes(); return nodeList.item(0).getNodeValue().trim(); }

Target:
private String getTextValue(Element element, String tagName) { return element.getElementsByTagName(tagName).item(0).getChildNodes().item(0).getNodeValue().trim(); }
Source:
public void changeWorkingSolution(ScoreDirector<TestdataSolution> scoreDirector) { TestdataSolution solution = scoreDirector.getWorkingSolution(); TestdataValue firstValue = solution.getValueList().get(0); for (TestdataEntity entity : solution.getEntityList()) { scoreDirector.beforeVariableChanged(entity, "value"); entity.setValue(firstValue); scoreDirector.afterVariableChanged(entity, "value"); } scoreDirector.triggerVariableListeners(); Score<?> score = scoreDirector.calculateScore(); if (!score.isSolutionInitialized()) { throw new IllegalStateException( "The solution [" + TestdataEntity.class.getSimpleName() + "] was not fully initialized by CustomSolverPhase: " + this.getClass().getCanonicalName()); } }

Target:
public void changeWorkingSolution(ScoreDirector<TestdataSolution> scoreDirector) { TestdataSolution solution = scoreDirector.getWorkingSolution(); TestdataValue firstValue = solution.getValueList().get(0); for (TestdataEntity entity : solution.getEntityList()) { scoreDirector.beforeVariableChanged(entity, "value"); entity.setValue(firstValue); scoreDirector.afterVariableChanged(entity, "value"); } scoreDirector.triggerVariableListeners(); Score<?> score = scoreDirector.calculateScore(); if (!score.isSolutionInitialized()) { throw new IllegalStateException("The solution (" + TestdataEntity.class.getSimpleName() + ") was not fully initialized by CustomSolverPhase: (" + this.getClass().getCanonicalName() + ")"); } }
Source:
public String toQuadKey() { char[] quadKey = new char[this.zoomLevel]; for (int i = this.zoomLevel; i > 0; i--) { char digit = '0'; int mask = 1 << (i - 1); if ((this.x & mask) != 0) { digit++; } if ((this.y & mask) != 0) { digit++; digit++; } quadKey[this.zoomLevel - i] = digit; } return String.valueOf(quadKey); }

Target:
public String toQuadKey() { char[] quadKey = new char[this.zoomLevel]; for (int i = this.zoomLevel; i > 0; i--) { char digit = '0'; int mask = 1 << (i - 1); if ((this.x & mask) != 0) { digit++; } if ((this.y & mask) != 0) { digit += 2; } quadKey[this.zoomLevel - i] = digit; } return String.valueOf(quadKey); }
Source:
public void objectToString() { Object[] nums = {4, "hello", true, 0.01}; OffsetDateTime time = OffsetDateTime.parse("2017-01-02T01:02:03Z"); Assert.assertEquals("[4, hello, true, 0.01]", StringUtils.toString(nums)); Assert.assertEquals("", StringUtils.toString(null)); Assert.assertEquals("2017-01-02T01:02:03Z", StringUtils.toString(time)); }

Target:
public void objectToString() { Object nullObject = null; Object[] emptyArray = {}; Object[] objArray = {4, "hello", true, 0.01}; Object[][] multiArray = {{"OpenRefine", 12}, {13, 4.6}, {"data", "mining"}}; OffsetDateTime time = OffsetDateTime.parse("2017-01-02T01:02:03Z"); Assert.assertEquals("", StringUtils.toString(nullObject)); Assert.assertEquals("[]", StringUtils.toString(emptyArray)); Assert.assertEquals("[4, hello, true, 0.01]", StringUtils.toString(objArray)); Assert.assertEquals("[[OpenRefine, 12], [13, 4.6], [data, mining]]", StringUtils.toString(multiArray)); Assert.assertEquals("2017-01-02T01:02:03Z", StringUtils.toString(time)); }
Source:
public void testValidateUuidBothFormats() { uuidGenerator.setUseHyphens(true); assertThat(uuidGenerator.validateUuid(UUID.randomUUID().toString()), is(true)); uuidGenerator.setUseHyphens(true); assertThat(uuidGenerator.validateUuid(UUID.randomUUID().toString()), is(false)); }

Target:
public void testValidateUuidBothFormats() { uuidGenerator.setUseHyphens(false); assertThat(uuidGenerator.validateUuid(UUID.randomUUID().toString()), is(false)); uuidGenerator.setUseHyphens(true); assertThat(uuidGenerator.validateUuid(UUID.randomUUID().toString()), is(true)); }
Source:
protected void configure() { bind(CapabilityDefinition.class).annotatedWith( Exports.named(DeleteProjectCapability.DELETE_PROJECT_CAPABILITY)).to( DeleteProjectCapability.class); }

Target:
protected void configure() { bind(CapabilityDefinition.class) .annotatedWith(Exports.named(DELETE_PROJECT)) .to(DeleteProjectCapability.class); }
Source:
protected void executeVdsBrokerCommand() { String volumeName = getParameters().getVolumeName(); result = getBroker().glusterVolumeRebalanceStatus(volumeName); proceedProxyReturnValue(); GlusterVolumeTaskStatusEntity entity = result.getStatusDetails(); entity.setStatusTime(new Date()); setReturnValue(entity); }

Target:
protected void executeVdsBrokerCommand() { String volumeName = getParameters().getVolumeName(); result = getBroker().glusterVolumeRebalanceStop(volumeName); proceedProxyReturnValue(); GlusterVolumeTaskStatusEntity entity = result.getStatusDetails(); entity.setStatusTime(new Date()); setReturnValue(entity); }
Source:
private static void instantiateTemplateRule(String ruleTemplateKey, String instantiationKey, String params, Set<String> activatedRuleKeys) { if (!SUBSET_OF_ENABLED_RULES.isEmpty() && !SUBSET_OF_ENABLED_RULES.contains(instantiationKey)) { return; } activatedRuleKeys.add(instantiationKey); SonarClient sonarClient = orchestrator.getServer().adminWsClient(); String post2 = sonarClient.post("/api/rules/create", ImmutableMap.<String, Object>builder() .put("name", instantiationKey) .put("markdown_description", instantiationKey) .put("severity", "INFO") .put("status", "READY") .put("template_key", "squid:" + ruleTemplateKey) .put("custom_key", instantiationKey) .put("prevent_reactivation", "true") .put("params", "name=\"" + instantiationKey + "\";key=\"" + instantiationKey + "\";markdown_description=\"" + instantiationKey + "\";" + params) .build()); String post = sonarClient.get("api/rules/app"); String profileKey = null; Map map = GSON.fromJson(post, Map.class); for (Map qp : ((List<Map>) map.get("qualityprofiles"))) { if ("rules".equals(qp.get("name"))) { profileKey = (String) qp.get("key"); break; } } if (StringUtils.isEmpty(profileKey)) { LOG.error("Could not retrieve profile key : Template rule " + ruleTemplateKey + " has not been activated"); } else { String activateRuleResponse = sonarClient.post("api/qualityprofiles/activate_rule", ImmutableMap.of( "profile_key", profileKey, "rule_key", "squid:" + instantiationKey, "severity", "INFO", "params", "")); LOG.warn(activateRuleResponse); } }

Target:
private static void instantiateTemplateRule(String ruleTemplateKey, String instantiationKey, String params, Set<String> activatedRuleKeys) { if (!SUBSET_OF_ENABLED_RULES.isEmpty() && !SUBSET_OF_ENABLED_RULES.contains(instantiationKey)) { return; } activatedRuleKeys.add(instantiationKey); SonarClient sonarClient = orchestrator.getServer().adminWsClient(); sonarClient.post("/api/rules/create", ImmutableMap.<String, Object>builder() .put("name", instantiationKey) .put("markdown_description", instantiationKey) .put("severity", "INFO") .put("status", "READY") .put("template_key", "squid:" + ruleTemplateKey) .put("custom_key", instantiationKey) .put("prevent_reactivation", "true") .put("params", "name=\"" + instantiationKey + "\";key=\"" + instantiationKey + "\";markdown_description=\"" + instantiationKey + "\";" + params) .build()); String post = sonarClient.get("api/rules/app"); String profileKey = null; Map map = GSON.fromJson(post, Map.class); for (Map qp : ((List<Map>) map.get("qualityprofiles"))) { if ("rules".equals(qp.get("name"))) { profileKey = (String) qp.get("key"); break; } } if (StringUtils.isEmpty(profileKey)) { LOG.error("Could not retrieve profile key : Template rule " + ruleTemplateKey + " has not been activated"); } else { String activateRuleResponse = sonarClient.post("api/qualityprofiles/activate_rule", ImmutableMap.of( "profile_key", profileKey, "rule_key", "squid:" + instantiationKey, "severity", "INFO", "params", "")); LOG.warn(activateRuleResponse); } }
Source:
public DefaultFileRegion(File f, long position, long count) { this.f = ObjectUtil.checkNotNull(f, "file"); this.position = checkPositiveOrZero(position, "position"); this.count = checkPositiveOrZero(count, "count"); }

Target:
public DefaultFileRegion(File f, long position, long count) { this.f = ObjectUtil.checkNotNull(f, "f"); this.position = checkPositiveOrZero(position, "position"); this.count = checkPositiveOrZero(count, "count"); }
Source:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof AddCinderStorageDomainParameters)) return false; AddCinderStorageDomainParameters that = (AddCinderStorageDomainParameters) o; return Objects.equals(driverName, that.driverName) && Objects.equals(driverOptions, that.driverOptions); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof AddCinderStorageDomainParameters)) { return false; } AddCinderStorageDomainParameters that = (AddCinderStorageDomainParameters) o; return Objects.equals(driverName, that.driverName) && Objects.equals(driverOptions, that.driverOptions); }
Source:
protected void addItemFactory(ItemFactory itemFactory) { itemFactories.add(itemFactory); if (failedToCreate.size() > 0) { Iterator<String> iterator = failedToCreate.keySet().iterator(); while (iterator.hasNext()) { String itemName = iterator.next(); PersistedItem persistedItem = failedToCreate.get(itemName); ActiveItem item = itemFactory.createItem(persistedItem.itemType, itemName); if (item != null) { failedToCreate.remove(itemName); configureItem(persistedItem, item); notifyListenersAboutAddedElement(item); } else { logger.debug("The added item factory '{}' still could not instantiate item '{}'.", itemFactory, itemName); } } if (failedToCreate.isEmpty()) { logger.info("Finished loading the items which could not have been created before."); } } }

Target:
protected void addItemFactory(ItemFactory itemFactory) { itemFactories.add(itemFactory); if (failedToCreate.size() > 0) { Iterator<Entry<String, PersistedItem>> iterator = failedToCreate.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, PersistedItem> entry = iterator.next(); String itemName = entry.getKey(); PersistedItem persistedItem = entry.getValue(); ActiveItem item = itemFactory.createItem(persistedItem.itemType, itemName); if (item != null) { iterator.remove(); configureItem(persistedItem, item); notifyListenersAboutAddedElement(item); } else { logger.debug("The added item factory '{}' still could not instantiate item '{}'.", itemFactory, itemName); } } if (failedToCreate.isEmpty()) { logger.info("Finished loading the items which could not have been created before."); } } }
Source:
void onClickFab(){ Bundle bundle = new Bundle(); bundle.putString("state", "From Home"); AlertSetupFragment alertSetupFragment = new AlertSetupFragment(); alertSetupFragment.setArguments(bundle); adapter.addFragment(alertSetupFragment,"Setup Alert"); adapter.notifyDataSetChanged(); floatingActionButton.setVisibility(View.GONE); }

Target:
void onClickFab(){ startActivity(new Intent(getApplicationContext(), TriggerSetupActivity.class)); }