auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public int put(CharSequence symbol) { if (symbol == null) { offsetMem.putBool(HEADER_NULL_FLAG, true); return SymbolTable.VALUE_IS_NULL; } if (cache != null) { int index = cache.keyIndex(symbol); return index < 0 ? cache.valueAt(index) : lookupPutAndCache(index, symbol); } return lookupAndPut(symbol); }

Target:
public int put(CharSequence symbol) { if (symbol == null) { if (!nullValue) { nullValue = true; offsetMem.putBool(HEADER_NULL_FLAG, true); } return SymbolTable.VALUE_IS_NULL; } if (cache != null) { int index = cache.keyIndex(symbol); return index < 0 ? cache.valueAt(index) : lookupPutAndCache(index, symbol); } return lookupAndPut(symbol); }
Source:
private void closeStream() { if (dataStream != null) { try { dataStream.close(); dataStream = null; } catch (IOException ex) { logger.log(Level.WARNING, "SafariCookieReader unable to close DataInputStream for file {0} {1}", new Object[]{cookieFile.getName(), ex}); } } }

Target:
private void closeStream() { if (dataStream != null) { try { dataStream.close(); dataStream = null; } catch (IOException ex) { String errorMessage = String.format("An error occurred trying to close stream for file %s", cookieFile.getName()); LOG.log(Level.WARNING, errorMessage, ex); } } }
Source:
protected void initSelectedType() { VmInterfaceType selectedNicType = VmInterfaceType.forValue(getNic().getType()); final Collection<VmInterfaceType> vnicTypes = supportedVnicTypes == null ? new ArrayList<VmInterfaceType>() : supportedVnicTypes; if (selectedNicType == null || !vnicTypes.contains(selectedNicType)) { selectedNicType = getDeafultNicTypeByProfile(); } if (getNicType().getItems() != vnicTypes) { getNicType().setItems(vnicTypes, selectedNicType); } else { getNicType().setSelectedItem(selectedNicType); } }

Target:
protected void initSelectedType() { VmInterfaceType selectedNicType = VmInterfaceType.forValue(getNic().getType()); final Collection<VmInterfaceType> vnicTypes = supportedVnicTypes == null ? new ArrayList<VmInterfaceType>() : supportedVnicTypes; if (selectedNicType == null || !vnicTypes.contains(selectedNicType)) { selectedNicType = getDeafultNicTypeByProfile(); } if (getNicType().getItems() == null) { getNicType().setItems(vnicTypes, selectedNicType); } else { getNicType().setSelectedItem(selectedNicType); } }
Source:
private DNodeContainer getComponentDNodeContainer(final String componentName) { DNodeContainer container = componentDiagram.getDiagramElements().stream().filter(DNodeContainer.class::isInstance).map(DNodeContainer.class::cast) .filter(n -> isElementEqualsToComponent(n, componentName)).findFirst().get(); assertNotNull("The DNodeContainer for the component " + componentName + " should exist", container); return container; }

Target:
private DNodeContainer getComponentDNodeContainer(final String componentName) { DNodeContainer container = componentDiagram.getDiagramElements().stream().filter(DNodeContainer.class::isInstance).map(DNodeContainer.class::cast) .filter(n -> isElementEqualsToComponent(n, componentName)).findFirst().orElse(null); assertNotNull("The DNodeContainer for the component " + componentName + " should exist", container); return container; }
Source:
public String toString() { return "TaskStatusPlus{" + "id='" + id + '\'' + "groupId='" + groupId + '\'' + ", type='" + type + '\'' + ", createdTime=" + createdTime + ", queueInsertionTime=" + queueInsertionTime + ", statusCode=" + statusCode + ", duration=" + duration + ", location=" + location + ", dataSource='" + dataSource + '\'' + ", errorMsg='" + errorMsg + '\'' + '}'; }

Target:
public String toString() { return "TaskStatusPlus{" + "id='" + id + '\'' + ", groupId='" + groupId + '\'' + ", type='" + type + '\'' + ", createdTime=" + createdTime + ", queueInsertionTime=" + queueInsertionTime + ", statusCode=" + statusCode + ", duration=" + duration + ", location=" + location + ", dataSource='" + dataSource + '\'' + ", errorMsg='" + errorMsg + '\'' + '}'; }
Source:
public void matchRemainder() { matchingRemainder = true; if (condition.isAlwaysFalse()) { currentIterator = extractor.iterable().iterator(); } else if (condition.isAlwaysTrue()) { currentIterator = Collections.emptyIterator(); } else { currentIterator = Iterators.filter( extractor.iterable().iterator(), entry -> entry != null && !matchedKeys.contains(entry.getKey()) ); } nextMatch(); }

Target:
public void matchRemainder() { matchingRemainder = true; if (condition.isAlwaysFalse()) { currentIterator = extractor.iterable().iterator(); } else if (condition.isAlwaysTrue()) { currentIterator = Collections.emptyIterator(); } else { currentIterator = Iterators.filter( extractor.iterable().iterator(), entry -> !matchedKeys.contains(entry.getKey()) ); } nextMatch(); }
Source:
protected void removeServices(OperationContext context, ServiceName parentService, ModelNode parentModel) throws OperationFailedException { incrementAttachedCounter(context, REMOVE_COUNTER); context.addStep(new OperationStepHandler() { @Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { Integer counter = decrementAttachedCounter(context, REMOVE_COUNTER); if (counter == 0) { SubsystemRemove.INSTANCE.performRuntime(context, null, parentModel); } else if (counter < 0) { throw new OperationFailedException("The removeServices step got added more times than needed - " + "This shouldn't happen."); } } }, OperationContext.Stage.RUNTIME); }

Target:
protected void removeServices(OperationContext context, ServiceName parentService, ModelNode parentModel) throws OperationFailedException { incrementAttachedCounter(context, REMOVE_COUNTER); context.addStep(new OperationStepHandler() { @Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { Integer counter = decrementAttachedCounter(context, REMOVE_COUNTER); if (counter == 0) { SubsystemRemove.INSTANCE.performRuntime(context, null, parentModel); } else if (counter < 0) { throw new OperationFailedException("The removeServices step got added more times than needed - " + "This shouldn't happen."); } WildflyCompatibilityUtils.operationContextStepCompleted(context); } }, OperationContext.Stage.RUNTIME); }
Source:
void computeAndCreateTopicPartitions() throws InterruptedException, ExecutionException { Map<String, Long> partitionCounts = knownSourceTopicPartitions.stream() .collect(Collectors.groupingBy(x -> x.topic(), Collectors.counting())).entrySet().stream() .collect(Collectors.toMap(x -> formatRemoteTopic(x.getKey()), x -> x.getValue())); Set<String> knownTargetTopics = knownTargetTopicPartitions.stream() .map(x -> x.topic()) .distinct() .collect(Collectors.toSet()); List<NewTopic> newTopics = partitionCounts.entrySet().stream() .filter(x -> !knownTargetTopics.contains(x.getKey())) .map(x -> new NewTopic(x.getKey(), x.getValue().intValue(), (short) replicationFactor)) .collect(Collectors.toList()); Map<String, NewPartitions> newPartitions = partitionCounts.entrySet().stream() .filter(x -> knownTargetTopics.contains(x.getKey())) .collect(Collectors.toMap(x -> x.getKey(), x -> NewPartitions.increaseTo(x.getValue().intValue()))); createTopicPartitions(partitionCounts, newTopics, newPartitions); }

Target:
void computeAndCreateTopicPartitions() throws InterruptedException, ExecutionException { Map<String, Long> partitionCounts = knownSourceTopicPartitions.stream() .collect(Collectors.groupingBy(x -> x.topic(), Collectors.counting())).entrySet().stream() .collect(Collectors.toMap(x -> formatRemoteTopic(x.getKey()), x -> x.getValue())); Set<String> knownTargetTopics = toTopics(knownTargetTopicPartitions); List<NewTopic> newTopics = partitionCounts.entrySet().stream() .filter(x -> !knownTargetTopics.contains(x.getKey())) .map(x -> new NewTopic(x.getKey(), x.getValue().intValue(), (short) replicationFactor)) .collect(Collectors.toList()); Map<String, NewPartitions> newPartitions = partitionCounts.entrySet().stream() .filter(x -> knownTargetTopics.contains(x.getKey())) .collect(Collectors.toMap(x -> x.getKey(), x -> NewPartitions.increaseTo(x.getValue().intValue()))); createTopicPartitions(partitionCounts, newTopics, newPartitions); }
Source:
public void createPatientFromSummaryNoAccess() throws Exception { Object[] summary = {new Object()}; when(this.stringResolver.resolve(Matchers.anyString())).thenReturn(null); when(this.access.hasAccess(Right.VIEW, null, null)).thenReturn(false); assertNull(this.mocker.getComponentUnderTest().createPatientSummary(summary, this.uriInfo)); }

Target:
public void createPatientFromSummaryNoAccess() throws Exception { Object[] summary = {"", "", "", new Date(), "", "", new Date()}; when(this.stringResolver.resolve(Matchers.anyString())).thenReturn(null); when(this.access.hasAccess(Right.VIEW, null, null)).thenReturn(false); assertNull(this.mocker.getComponentUnderTest().createPatientSummary(summary, this.uriInfo)); }
Source:
public void process(TransactionBase tx, Bytes row, Column col) { String r = row.toString(); String totalStr = tx.gets(r, STAT_TOTAL); if (totalStr == null) { return; } Integer total = Ints.tryParse(totalStr); if (total == null) { return; } String processedStr = tx.gets(r, STAT_PROCESSED); Integer processed = 0; if (processedStr != null) { processed = Ints.tryParse(tx.gets(r, STAT_PROCESSED)); if (processed == null) { processed = 0; } } tx.set(r, new Column("stat", "processed"), total + ""); TestUtil.increment(tx, "all", new Column("stat", "total"), total - processed); }

Target:
public void process(TransactionBase tx, Bytes row, Column col) { String r = row.toString(); String totalStr = tx.gets(r, STAT_TOTAL); if (totalStr == null) { return; } Integer total = Integer.parseInt(totalStr); int processed = TestUtil.getOrDefault(tx, r, STAT_PROCESSED, 0); tx.set(r, new Column("stat", "processed"), total + ""); TestUtil.increment(tx, "all", new Column("stat", "total"), total - processed); }
Source:
public void stripeAccountExists() { DatabaseFixtures .withDatabaseTestHelper(dbHelper) .aTestAccount() .withAccountId(42) .withPaymentProvider("stripe") .insert(); }

Target:
public void stripeAccountExists() { DatabaseFixtures .withDatabaseTestHelper(dbHelper) .aTestAccount() .withAccountId(42L) .withPaymentProvider("stripe") .insert(); }
Source:
public void performCommand(String[] cmd, int fd) { BufferedReader buffData = null; BufferedReader buffTemp = null; URI pathWorkDirURI = null; try { Process proc = null; RemoteConnection exeRC = null; try { pathWorkDirURI = new URI(pathWorkDir.toPortableString()); exeRC = new RemoteConnection(pathWorkDirURI); } catch (RemoteConnectionException e) { e.printStackTrace(); } catch (URISyntaxException e) { e.printStackTrace(); } IFileStore workDirStore = exeRC.getRmtFileProxy().getResource(pathWorkDirURI.getPath() + IPath.SEPARATOR); proc = RuntimeProcessFactory.getFactory().exec(cmd, null, workDirStore, project); StringBuffer data = new StringBuffer(); StringBuffer temp = new StringBuffer(); switch (fd) { case 2: buffData = new BufferedReader(new InputStreamReader(proc.getErrorStream())); buffTemp = new BufferedReader(new InputStreamReader(proc.getInputStream())); readStream(buffTemp, temp); readStream(buffData, data); break; case 1: default: buffData = new BufferedReader(new InputStreamReader(proc.getInputStream())); buffTemp = new BufferedReader(new InputStreamReader(proc.getErrorStream())); readStream(buffData, data); readStream(buffTemp, temp); break; } joinAll(); text = data.toString(); printToConsole(proc, temp.toString()); } catch (IOException e) { text = ""; } catch (InterruptedException e){ text = ""; }finally { try { if (buffData != null) { buffData.close(); } if (buffTemp != null) { buffTemp.close(); } } catch (IOException e) { } } }

Target:
public void performCommand(String[] cmd, int fd) { BufferedReader buffData = null; BufferedReader buffTemp = null; URI pathWorkDirURI = null; try { Process proc = null; RemoteConnection exeRC = null; try { pathWorkDirURI = new URI(pathWorkDir.toPortableString()); exeRC = new RemoteConnection(pathWorkDirURI); } catch (RemoteConnectionException e) { MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.MsgProxyError, Messages.MsgProxyError); } catch (URISyntaxException e) { MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.MsgProxyError, Messages.MsgProxyError); } IFileStore workDirStore = exeRC.getRmtFileProxy().getResource(pathWorkDirURI.getPath() + IPath.SEPARATOR); proc = RuntimeProcessFactory.getFactory().exec(cmd, null, workDirStore, project); StringBuffer data = new StringBuffer(); StringBuffer temp = new StringBuffer(); switch (fd) { case 2: buffData = new BufferedReader(new InputStreamReader(proc.getErrorStream())); buffTemp = new BufferedReader(new InputStreamReader(proc.getInputStream())); readStream(buffTemp, temp); readStream(buffData, data); break; case 1: default: buffData = new BufferedReader(new InputStreamReader(proc.getInputStream())); buffTemp = new BufferedReader(new InputStreamReader(proc.getErrorStream())); readStream(buffData, data); readStream(buffTemp, temp); break; } joinAll(); text = data.toString(); printToConsole(proc, temp.toString()); } catch (IOException e) { text = ""; } catch (InterruptedException e){ text = ""; }finally { try { if (buffData != null) { buffData.close(); } if (buffTemp != null) { buffTemp.close(); } } catch (IOException e) { } } }
Source:
public void testFilterProjectionExecutedConditionally() { assertions.assertQuery("select sum(1 / a) filter (where a <> 0) from (values (1), (0)) t(a)", "VALUES (BIGINT '1')"); }

Target:
public void testFilterProjectionExecutedConditionally() { assertions.assertQuery( "select sum(1 / a) filter (where a <> 0) from (values (1), (0)) t(a)", "VALUES (BIGINT '1')"); assertions.assertQuery( "WITH test AS (" + " SELECT * FROM (" + " VALUES" + " ('1', 'a', 'good')," + " ('2', 'b', 'good')," + " ('x', 'c', 'bad')" + " ) AS t (v, k, name)" + ")" + "SELECT" + " SUM(CAST(v AS BIGINT)) FILTER (WHERE name = 'good') AS col2\n" + "FROM test", "VALUES (BIGINT '3')"); }
Source:
public void putTimeout() throws Exception { mConf.set(PropertyKey.USER_CLIENT_CACHE_STORE_TIMEOUT, "10s"); mPageStoreOptions = PageStoreOptions.create(mConf); HangingPageStore pageStore = new HangingPageStore(); mCacheManager = LocalCacheManager.create(mConf, mMetaStore, new TimeLimitedPageStore(pageStore, mPageStoreOptions.getTimeout()), mPageStoreOptions); assertTrue(mCacheManager.put(PAGE_ID1, PAGE1)); pageStore.setPutHanging(true); assertFalse(mCacheManager.put(PAGE_ID2, PAGE2)); pageStore.setPutHanging(false); }

Target:
public void putTimeout() throws Exception { HangingPageStore pageStore = new HangingPageStore(mPageStoreOptions); mConf.set(PropertyKey.USER_CLIENT_CACHE_TIMEOUT_DURATION, "2s"); mPageStoreOptions = PageStoreOptions.create(mConf); mCacheManager = LocalCacheManager.create(mConf, mMetaStore, new TimeBoundPageStore(pageStore, mPageStoreOptions)); assertTrue(mCacheManager.put(PAGE_ID1, PAGE1)); pageStore.setPutHanging(true); assertFalse(mCacheManager.put(PAGE_ID2, PAGE2)); pageStore.setPutHanging(false); }
Source:
public InputStream getResourceStream(final String filePath) throws ResourceNotFoundException { if (!UtilMethods.isSet(filePath)) { throw new ResourceNotFoundException("cannot find resource"); } synchronized (filePath.intern()) { VelocityResourceKey key = new VelocityResourceKey(filePath); Logger.debug(this, "DotResourceLoader:\t: " + key); try { switch (key.type) { case CONTAINER: { return new ContainerLoader().writeObject(key); } case TEMPLATE: { return new TemplateLoader().writeObject(key); } case CONTENT: { return new ContentletLoader().writeObject(key); } case FIELD: { return new FieldLoader().writeObject(key); } case CONTENT_TYPE: { return new ContentTypeLoader().writeObject(key); } case SITE: { return new SiteLoader().writeObject(key); } case HTMLPAGE: { return new PageLoader().writeObject(key); } case VELOCITY_MACROS: { return VTLLoader.instance().writeObject(key); } case VTL: { return VTLLoader.instance().writeObject(key); } case VELOCITY_LEGACY_VL: { return VTLLoader.instance().writeObject(key); } default: { return IncludeLoader.instance().writeObject(key); } } } catch (Exception e) { Logger.error(this, e.getMessage(), e); CacheLocator.getVeloctyResourceCache().addMiss(key.path); throw new ResourceNotFoundException("Cannot parse velocity file : " + key.path, e); } } }

Target:
public InputStream getResourceStream(final String filePath) throws ResourceNotFoundException { if (!UtilMethods.isSet(filePath)) { throw new ResourceNotFoundException("cannot find resource"); } synchronized (filePath.intern()) { VelocityResourceKey key = new VelocityResourceKey(filePath); Logger.debug(this, "DotResourceLoader:\t: " + key); try { switch (key.type) { case CONTAINER: { return new ContainerLoader().writeObject(key); } case TEMPLATE: { return new TemplateLoader().writeObject(key); } case CONTENT: { return new ContentletLoader().writeObject(key); } case FIELD: { return new FieldLoader().writeObject(key); } case CONTENT_TYPE: { return new ContentTypeLoader().writeObject(key); } case SITE: { return new SiteLoader().writeObject(key); } case HTMLPAGE: { return new PageLoader().writeObject(key); } case VELOCITY_MACROS: { return VTLLoader.instance().writeObject(key); } case VTL: { return VTLLoader.instance().writeObject(key); } case VELOCITY_LEGACY_VL: { return VTLLoader.instance().writeObject(key); } default: { return IncludeLoader.instance().writeObject(key); } } } catch (Exception e) { Logger.error(this, "filePath: " + filePath + ", msg:" + e.getMessage(), e); CacheLocator.getVeloctyResourceCache().addMiss(key.path); throw new ResourceNotFoundException("Cannot parse velocity file : " + key.path, e); } } }
Source:
public Overtime(Person person, LocalDate startDate, LocalDate endDate, BigDecimal numberOfHours) { Assert.notNull(person, "Person must be given."); Assert.notNull(startDate, "Start date must be given."); Assert.notNull(endDate, "End date must be given."); Assert.notNull(numberOfHours, "Number of hours must be given."); this.person = person; this.startDate = startDate; this.endDate = endDate; this.hours = numberOfHours; this.lastModificationDate = ZonedDateTime.now(UTC).toLocalDate(); }

Target:
public Overtime(Person person, LocalDate startDate, LocalDate endDate, BigDecimal numberOfHours) { Assert.notNull(person, "Person must be given."); Assert.notNull(startDate, "Start date must be given."); Assert.notNull(endDate, "End date must be given."); Assert.notNull(numberOfHours, "Number of hours must be given."); this.person = person; this.startDate = startDate; this.endDate = endDate; this.hours = numberOfHours; this.lastModificationDate = LocalDate.now(UTC); }
Source:
public AzureKeyCredential update(String key) { Objects.requireNonNull(key); if (key.isEmpty()) { throw logger.logExceptionAsError(new IllegalArgumentException("'key' cannot be empty.")); } this.key = key; return this; }

Target:
public AzureKeyCredential update(String key) { Objects.requireNonNull(key, "'key' cannot be null."); if (key.isEmpty()) { throw logger.logExceptionAsError(new IllegalArgumentException("'key' cannot be empty.")); } this.key = key; return this; }
Source:
public void setup() { stubFor(get(urlEqualTo("/rest/v1.1/me/")) .inScenario("Sign up") .whenScenarioStateIs("No")); mAppContext = (WordPress) InstrumentationRegistry.getInstrumentation().getTargetContext().getApplicationContext(); mMockedAppComponent = DaggerAppComponentTest.builder() .application(mAppContext) .build(); }

Target:
public void setup() { mAppContext = (WordPress) InstrumentationRegistry.getInstrumentation().getTargetContext().getApplicationContext(); mMockedAppComponent = DaggerAppComponentTest.builder() .application(mAppContext) .build(); }
Source:
public PageProcessorOutput process(ConnectorSession session, Page page) { dictionarySourceIdFunction.reset(); if (page.getPositionCount() == 0) { return EMPTY_PAGE_PROCESSOR_OUTPUT; } if (filter.isPresent()) { SelectedPositions selectedPositions = filter.get().filter(session, filter.get().getInputChannels().getInputChannels(page)); if (selectedPositions.isEmpty()) { return EMPTY_PAGE_PROCESSOR_OUTPUT; } if (projections.isEmpty()) { return new PageProcessorOutput(() -> calculatePageRetainedSizeWithoutLoading(page), singletonIterator(new Page(selectedPositions.size()))); } if (selectedPositions.size() != page.getPositionCount()) { PositionsPageProcessorIterator pages = new PositionsPageProcessorIterator(session, page, selectedPositions); return new PageProcessorOutput(pages::getRetainedSizeInBytes, pages); } } PositionsPageProcessorIterator pages = new PositionsPageProcessorIterator(session, page, positionsRange(0, page.getPositionCount())); return new PageProcessorOutput(pages::getRetainedSizeInBytes, pages); }

Target:
public PageProcessorOutput process(ConnectorSession session, Page page) { dictionarySourceIdFunction.reset(); if (page.getPositionCount() == 0) { return EMPTY_PAGE_PROCESSOR_OUTPUT; } if (filter.isPresent()) { SelectedPositions selectedPositions = filter.get().filter(session, filter.get().getInputChannels().getInputChannels(page)); if (selectedPositions.isEmpty()) { return EMPTY_PAGE_PROCESSOR_OUTPUT; } if (projections.isEmpty()) { return new PageProcessorOutput(() -> calculateRetainedSizeWithoutLoading(page), singletonIterator(new Page(selectedPositions.size()))); } if (selectedPositions.size() != page.getPositionCount()) { PositionsPageProcessorIterator pages = new PositionsPageProcessorIterator(session, page, selectedPositions); return new PageProcessorOutput(pages::getRetainedSizeInBytes, pages); } } PositionsPageProcessorIterator pages = new PositionsPageProcessorIterator(session, page, positionsRange(0, page.getPositionCount())); return new PageProcessorOutput(pages::getRetainedSizeInBytes, pages); }
Source:
@Override public void onStoryComposerLoadRequested(ArrayList<Object> mediaFiles, String blockId) { LoadStoryFromStoriesPrefsUseCase loadStoryFromStoriesPrefsUseCase = new LoadStoryFromStoriesPrefsUseCase( new StoryRepositoryWrapper(), mSite, mMediaStore, this ); ArrayList<String> mediaIds = loadStoryFromStoriesPrefsUseCase.getMediaIdsFromStoryBlockBridgeMediaFiles(mediaFiles); boolean allStorySlidesAreEditable = loadStoryFromStoriesPrefsUseCase.areAllStorySlidesEditable(mSite, mediaIds); boolean failedLoadingOrReCreatingStory = false; int storyIndex = StoryRepository.findStoryContainingStoryFrameItemsByIds(mediaIds); if (storyIndex == StoryRepository.DEFAULT_NONE_SELECTED) { ReCreateStoryResult result = loadStoryFromStoriesPrefsUseCase.loadOrReCreateStoryFromStoriesPrefs(mediaIds); failedLoadingOrReCreatingStory = result.getNoSlidesLoaded(); if (allStorySlidesAreEditable) { allStorySlidesAreEditable = result.getAllStorySlidesAreEditable(); } storyIndex = result.getStoryIndex(); } if (!failedLoadingOrReCreatingStory) { ActivityLauncher.editStoryForResult(this, mSite, storyIndex, allStorySlidesAreEditable, true); } else { AlertDialog.Builder builder = new MaterialAlertDialogBuilder(this); builder.setTitle(getString(R.string.dialog_edit_story_unavailable_title)); builder.setMessage(getString(R.string.dialog_edit_story_unavailable_message)); builder.setPositiveButton(R.string.dialog_button_ok, (dialog, id) -> { dialog.dismiss(); }); AlertDialog dialog = builder.create(); dialog.show(); } }

Target:
@Override public void onStoryComposerLoadRequested(ArrayList<Object> mediaFiles, String blockId) { ReCreateStoryResult result = mLoadStoryFromStoriesPrefsUseCase .loadStoryFromMemoryOrRecreateFromPrefs(mSite, mediaFiles); if (!result.getNoSlidesLoaded()) { ActivityLauncher.editStoryForResult( this, mSite, result.getStoryIndex(), result.getAllStorySlidesAreEditable(), true ); } else { if (mNetworkErrorOnLastMediaFetchAttempt) { AlertDialog.Builder builder = new MaterialAlertDialogBuilder(this); builder.setTitle(getString(R.string.dialog_edit_story_unavailable_title)); builder.setMessage(getString(R.string.dialog_edit_story_unavailable_message)); builder.setPositiveButton(R.string.dialog_button_ok, (dialog, id) -> { fetchMediaList(); dialog.dismiss(); }); AlertDialog dialog = builder.create(); dialog.show(); } else { AlertDialog.Builder builder = new MaterialAlertDialogBuilder(this); builder.setTitle(getString(R.string.dialog_edit_story_unrecoverable_title)); builder.setMessage(getString(R.string.dialog_edit_story_unrecoverable_message)); builder.setPositiveButton(R.string.dialog_button_ok, (dialog, id) -> { dialog.dismiss(); }); AlertDialog dialog = builder.create(); dialog.show(); } } }
Source:
public void prepareForMasterPasswordChange(char[] oldPassword, char[] newPassword) throws IOException{ Resource dir = getResource().parent(); Resource newKSFile = dir.get(PREPARED_FILE_NAME); if (newKSFile.getType() != Type.UNDEFINED) { newKSFile.delete(); } try { KeyStore oldKS=KeyStore.getInstance(KEYSTORETYPE); InputStream fin = getResource().in(); oldKS.load(fin, oldPassword); fin.close(); KeyStore newKS = KeyStore.getInstance(KEYSTORETYPE); newKS.load(null, newPassword); KeyStore.PasswordProtection protectionparam = new KeyStore.PasswordProtection(newPassword); Enumeration<String> enumeration = oldKS.aliases(); while (enumeration.hasMoreElements()) { String alias =enumeration.nextElement(); Key key = oldKS.getKey(alias, oldPassword); KeyStore.Entry entry =null; if (key instanceof SecretKey) entry = new KeyStore.SecretKeyEntry((SecretKey)key); if (key instanceof PrivateKey) entry = new KeyStore.PrivateKeyEntry((PrivateKey)key, oldKS.getCertificateChain(alias)); if (key instanceof PublicKey) entry = new KeyStore.TrustedCertificateEntry(oldKS.getCertificate(alias)); if (entry == null) LOGGER.warning("Unknown key in store, alias: "+alias+ " class: "+ key.getClass().getName()); else newKS.setEntry(alias, entry, protectionparam); } OutputStream fos = newKSFile.out(); newKS.store(fos, newPassword); fos.close(); } catch (Exception ex) { throw new IOException(ex); } }

Target:
public void prepareForMasterPasswordChange(char[] oldPassword, char[] newPassword) throws IOException{ Resource dir = getResource().parent(); Resource newKSFile = dir.get(PREPARED_FILE_NAME); if (newKSFile.getType() != Type.UNDEFINED) { newKSFile.delete(); } try { KeyStore oldKS=KeyStore.getInstance(KEYSTORETYPE); try (InputStream fin = getResource().in()) { oldKS.load(fin, oldPassword); } KeyStore newKS = KeyStore.getInstance(KEYSTORETYPE); newKS.load(null, newPassword); KeyStore.PasswordProtection protectionparam = new KeyStore.PasswordProtection(newPassword); Enumeration<String> enumeration = oldKS.aliases(); while (enumeration.hasMoreElements()) { String alias =enumeration.nextElement(); Key key = oldKS.getKey(alias, oldPassword); KeyStore.Entry entry =null; if (key instanceof SecretKey) entry = new KeyStore.SecretKeyEntry((SecretKey)key); if (key instanceof PrivateKey) entry = new KeyStore.PrivateKeyEntry((PrivateKey)key, oldKS.getCertificateChain(alias)); if (key instanceof PublicKey) entry = new KeyStore.TrustedCertificateEntry(oldKS.getCertificate(alias)); if (entry == null) LOGGER.warning("Unknown key in store, alias: "+alias+ " class: "+ key.getClass().getName()); else newKS.setEntry(alias, entry, protectionparam); } try (OutputStream fos = newKSFile.out()) { newKS.store(fos, newPassword); } } catch (Exception ex) { throw new IOException(ex); } }
Source:
public @Nullable SerialPortIdentifier getIdentifier(String name) { if (registry == null) { return null; } URI portUri = URI.create(name); SerialPortProvider portCreator = registry.getPortProviderForPortName(portUri); if (portCreator == null) { logger.warn("No SerialPortProvider found for: " + name); return null; } return portCreator.getPortIdentifier(portUri); }

Target:
public @Nullable SerialPortIdentifier getIdentifier(String name) { if (registry == null) { return null; } URI portUri = URI.create(name); SerialPortProvider portCreator = registry.getPortProviderForPortName(portUri); if (portCreator == null) { logger.warn("No SerialPortProvider found for: {}", name); return null; } return portCreator.getPortIdentifier(portUri); }
Source:
public UserRemovedFromBlackListOfSecurityTeam(User user, SecurityTeam securityTeam) { this.user = user; this.securityTeam = securityTeam; this.message = formatMessage("%s remove from blacklist of '%s'.", user, securityTeam); }

Target:
public UserRemovedFromBlackListOfSecurityTeam(User user, SecurityTeam securityTeam) { this.user = user; this.securityTeam = securityTeam; this.message = formatMessage("%s remove from blacklist of %s.", user, securityTeam); }
Source:
public Note merge(Note base, Note ours, Note theirs, ObjectReader reader, ObjectInserter inserter) throws IOException { if (ours == null) { return theirs; } if (theirs == null) { return ours; } if (ours.getData().equals(theirs.getData())) { return ours; } ObjectLoader lo = reader.open(ours.getData()); byte[] sep = new byte[] {'\n'}; ObjectLoader lt = reader.open(theirs.getData()); try (ByteArrayInputStream b = new ByteArrayInputStream(sep); UnionInputStream union = new UnionInputStream( lo.openStream(), b, lt.openStream())) { ObjectId noteData = inserter.insert(Constants.OBJ_BLOB, lo.getSize() + sep.length + lt.getSize(), union); return new Note(ours, noteData); } }

Target:
public Note merge(Note base, Note ours, Note theirs, ObjectReader reader, ObjectInserter inserter) throws IOException { if (ours == null) { return theirs; } if (theirs == null) { return ours; } if (ours.getData().equals(theirs.getData())) { return ours; } ObjectLoader lo = reader.open(ours.getData()); byte[] sep = new byte[] {'\n'}; ObjectLoader lt = reader.open(theirs.getData()); try (ObjectStream os = lo.openStream(); ByteArrayInputStream b = new ByteArrayInputStream(sep); ObjectStream ts = lt.openStream(); UnionInputStream union = new UnionInputStream(os, b, ts)) { ObjectId noteData = inserter.insert(Constants.OBJ_BLOB, lo.getSize() + sep.length + lt.getSize(), union); return new Note(ours, noteData); } }
Source:
public List<PageUpdateCommand> notifyAndGetUpdateCommands(ResourceSetChangeEvent resourceSetChangeEvent) { return null; }

Target:
public PageUpdateCommand notifyAndGetUpdateCommands(ResourceSetChangeEvent resourceSetChangeEvent) { return null; }
Source:
public <T extends Comparable<? super T>> void assertLessThan(AssertionInfo info, T actual, T other) { this.assertLessThan(info, actual, other, ShouldBeLess::shouldBeLess); }

Target:
public <T extends Comparable<? super T>> void assertLessThan(AssertionInfo info, T actual, T other) { assertLessThan(info, actual, other, ShouldBeLess::shouldBeLess); }
Source:
public Weld addExtensions(Class<? extends Extension>... extensionClasses) { Object[] constructorParams = new Object[] {}; for (Class<? extends Extension> extensionClass : extensionClasses) { try { Extension extension = extensionClass.getDeclaredConstructor(new Class[] {}).newInstance(constructorParams); addExtension(extension); } catch (Exception ex) { CommonLogger.LOG.unableToInstantiate(extensionClass, constructorParams, ex); } } return this; }

Target:
public Weld addExtensions(Class<? extends Extension>... extensionClasses) { for (Class<? extends Extension> extensionClass : extensionClasses) { try { Extension extension = SecurityActions.newInstance(extensionClass); addExtension(extension); } catch (Exception ex) { CommonLogger.LOG.unableToInstantiate(extensionClass, new Object[] {}, ex); } } return this; }
Source:
public boolean onHttpResponseReceive(HttpMessage msg) { if (options.isEnabled() && msg.getResponseHeader().isHtml()) { try { String html = msg.getResponseBody().toString(); Source document = new Source(html); List<Element> heads = document.getAllElements("head"); Element head = heads.isEmpty() ? null : heads.get(0); if (head != null && msg.getHistoryRef() != null) { String host = msg.getRequestHeader().getHeader("host"); String frontEndApiUrl = API.getInstance().getCallBackUrl(this.api, "https://" + host); int historyReferenceId = msg.getHistoryRef().getHistoryId(); StringBuilder injectedContentBuilder = new StringBuilder(200) .append("<script src='") .append(frontEndApiUrl) .append("?action=getFile") .append("&filename=front-end-scanner.js") .append("&historyReferenceId=") .append(historyReferenceId) .append("'></script>"); String injectedContent = injectedContentBuilder.toString(); OutputDocument newResponseBody = new OutputDocument(document); int insertPosition = head.getChildElements().get(0).getBegin(); newResponseBody.insert(insertPosition, injectedContent); msg.getResponseBody().setBody(newResponseBody.toString()); int newLength = msg.getResponseBody().length(); msg.getResponseHeader().setContentLength(newLength); } else { LOGGER.debug("<head></head> is missing in the response"); } } catch (Exception e) { LOGGER.error(e.getMessage(), e); } } return true; }

Target:
public boolean onHttpResponseReceive(HttpMessage msg) { if (options.isEnabled() && msg.getResponseHeader().isHtml()) { try { String html = msg.getResponseBody().toString(); if (msg.getHistoryRef() != null) { String host = msg.getRequestHeader().getHeader("host"); String frontEndApiUrl = API.getInstance().getCallBackUrl(this.api, "https://" + host); int historyReferenceId = msg.getHistoryRef().getHistoryId(); String scriptToInject = getScriptToInject(frontEndApiUrl, historyReferenceId); OutputDocument newResponseBody = makeNewDocument(html, scriptToInject); msg.getResponseBody().setBody(newResponseBody.toString()); int newLength = msg.getResponseBody().length(); msg.getResponseHeader().setContentLength(newLength); for (String header : CSP_HEADERS) { msg.getResponseHeader().setHeader(header, null); } } else { LOGGER.debug("No historyRef found in the HttpMessage."); } } catch (Exception e) { LOGGER.error(e.getMessage(), e); } } return true; }
Source:
public HeaderWriterFilter(List<HeaderWriter> headerWriters) { Assert.notEmpty(headerWriters, "headerWriters cannot be null or empty"); compositeHeaderWriter = new CompositeHeaderWriter(headerWriters); }

Target:
public HeaderWriterFilter(List<HeaderWriter> headerWriters) { Assert.notEmpty(headerWriters, "headerWriters cannot be null or empty"); this.headerWriter = new CompositeHeaderWriter(headerWriters); }
Source:
private void printCommands( Consumer<String> output ) { Map<AdminCommandSection,List<AdminCommand.Provider>> groupedProviders = groupProvidersBySegment(); AdminCommandSection.general() .printAllCommandsUnderSection( output, groupedProviders.remove( AdminCommandSection.general() ) ); groupedProviders.entrySet().stream() .sorted( Comparator.comparing( groupedProvider -> groupedProvider.getKey().printable() ) ) .forEach(entry -> entry.getKey().printAllCommandsUnderSection( output, entry.getValue() ) ); }

Target:
private void printCommands( Consumer<String> output ) { Map<AdminCommandSection,List<AdminCommand.Provider>> groupedProviders = groupProvidersBySection(); AdminCommandSection.general() .printAllCommandsUnderSection( output, groupedProviders.remove( AdminCommandSection.general() ) ); groupedProviders.entrySet().stream() .sorted( Comparator.comparing( groupedProvider -> groupedProvider.getKey().printable() ) ) .forEach(entry -> entry.getKey().printAllCommandsUnderSection( output, entry.getValue() ) ); }
Source:
public ContainerRequest filter(ContainerRequest request) { if (getAuthConfig().isEnabled()) { final String resourceName; if (request.getPath().startsWith("druid/broker/v1")) { resourceName = "BROKER"; } else if (request.getPath().startsWith("druid/coordinator/v1")) { resourceName = "COORDINATOR"; } else if (request.getPath().startsWith("druid/historical/v1")) { resourceName = "HISTORICAL"; } else if (request.getPath().startsWith("druid/indexer/v1")) { resourceName = "OVERLORD"; } else if (request.getPath().startsWith("druid/coordinator/v1/rules")) { resourceName = "RULES"; } else if (request.getPath().startsWith("druid/coordinator/v1/tiers")) { resourceName = "TIER"; } else if (request.getPath().startsWith("druid/worker/v1")) { resourceName = "WORKER"; } else if (request.getPath().startsWith("druid/coordinator/v1/servers")) { resourceName = "SERVER"; } else if (request.getPath().startsWith("status")) { resourceName = "STATUS"; } else { throw new WebApplicationException( Response.status(Response.Status.BAD_REQUEST).entity( String.format( "Do not know how to authorize this request path [%s] with StateResourceFilter", request.getPath() ) ).build() ); } final AuthorizationInfo authorizationInfo = (AuthorizationInfo) getReq().getAttribute(AuthConfig.DRUID_AUTH_TOKEN); Preconditions.checkNotNull( authorizationInfo, "Security is enabled but no authorization info found in the request" ); final Access authResult = authorizationInfo.isAuthorized( new Resource(resourceName, ResourceType.STATE), getAction(request) ); if (!authResult.isAllowed()) { throw new WebApplicationException( Response.status(Response.Status.FORBIDDEN) .entity(String.format("Access-Check-Result: %s", authResult.toString())) .build() ); } } return request; }

Target:
public ContainerRequest filter(ContainerRequest request) { if (getAuthConfig().isEnabled()) { final String resourceName = "STATE"; final AuthorizationInfo authorizationInfo = (AuthorizationInfo) getReq().getAttribute(AuthConfig.DRUID_AUTH_TOKEN); Preconditions.checkNotNull( authorizationInfo, "Security is enabled but no authorization info found in the request" ); final Access authResult = authorizationInfo.isAuthorized( new Resource(resourceName, ResourceType.STATE), getAction(request) ); if (!authResult.isAllowed()) { throw new WebApplicationException( Response.status(Response.Status.FORBIDDEN) .entity(String.format("Access-Check-Result: %s", authResult.toString())) .build() ); } } return request; }
Source:
DiscoveryOptionsResource(Resource delegate) { if (delegate == null) { throw HostControllerLogger.ROOT_LOGGER.nullVar("delegate"); } this.delegate = delegate; }

Target:
DiscoveryOptionsResource(Resource delegate) { assert delegate != null : "delegate is null"; this.delegate = delegate; }
Source:
private SiteMap.LinkElement getSiteMapLinkElement(Page page){ ValueMap map = page.adaptTo(ValueMap.class); String updationFreq = map.get("updationFreq", "daily"); String priority = map.get("priority","0.5"); String lastModifiedDate = getDateAsString( page.getLastModified().getTime(), "yyyy-MM-dd'T'hh:mm:ss XXX"); return new SiteMap.LinkElement(page.getPath()+".html", lastModifiedDate, updationFreq, priority); }

Target:
private SiteMap.LinkElement getSiteMapLinkElement(Page page){ ValueMap map = page.getProperties(); String updationFreq = map.get(PAGE_PROP_UPD_FREQ, PAGE_PROP_UPD_FREQ_DEFAULT); String priority = map.get(PRIORITY,PAGE_PROP_PRIORITY_DEFAULT); String lastModifiedDate = getDateAsString( page.getLastModified().getTime(), DEFAULT_DATE_FORMAT); return new SiteMap.LinkElement(page.getPath()+"."+DEFAULT_LINK_EXTENSION, lastModifiedDate, updationFreq, priority); }
Source:
public boolean push(Context ctx,List<Survey> surveys){ Log.d(TAG, "Starting PUSH process..."); if(isPushing) return false; isPushing =true; context=ctx; if(surveys==null || surveys.size()==0){ postException(new Exception(context.getString(R.string.progress_push_no_survey))); isPushing =false; return false; } try { postProgress(context.getString(R.string.progress_push_preparing_survey)); Log.d(TAG, "Preparing survey for pushing..."); PullDhisSDKDataSource.wipeDataBase(); convertToSDK(surveys); isPushing =EventExtended.getAllEvents().size()>0; if(!isPushing) return false; postProgress(context.getString(R.string.progress_push_posting_survey)); Log.d(TAG, "Pushing survey data to server..."); SdkPushController.sendEventChanges(); }catch (Exception ex) { Log.e(TAG, "push: " + ex.getLocalizedMessage()); unregister(); postException(ex); isPushing =false; return false; } return true; }

Target:
public boolean push(Context ctx,List<Survey> surveys){ Log.d(TAG, "Starting PUSH process..."); if(isPushing) return false; isPushing =true; context=ctx; if(surveys==null || surveys.size()==0){ postException(new Exception(context.getString(R.string.progress_push_no_survey))); isPushing =false; return false; } try { postProgress(context.getString(R.string.progress_push_preparing_survey)); Log.d(TAG, "Preparing survey for pushing..."); Delete.tables( EventFlow.class, TrackedEntityDataValueFlow.class, StateFlow.class ); convertToSDK(surveys); isPushing =EventExtended.getAllEvents().size()>0; if(!isPushing) return false; postProgress(context.getString(R.string.progress_push_posting_survey)); Log.d(TAG, "Pushing survey data to server..."); SdkPushController.sendEventChanges(); }catch (Exception ex) { Log.e(TAG, "push: " + ex.getLocalizedMessage()); postException(ex); isPushing =false; return false; } return true; }
Source:
private int persistColumnStats(Hive db) throws HiveException, MetaException, IOException { ColumnStatistics colStats = constructColumnStatsFromInput(); ColumnStatisticsDesc colStatsDesc = colStats.getStatsDesc(); if (AcidUtils.isTransactionalTable(getHive().getTable(colStatsDesc.getDbName(), colStatsDesc.getTableName())) && work.getColStats() != null) { LOG.debug("Skipped updating column stats for table " + TableName.getDbTable(colStatsDesc.getDbName(), colStatsDesc.getTableName()) + " because it is converted to a transactional table during replication."); return 0; } SetPartitionsStatsRequest request = new SetPartitionsStatsRequest(Collections.singletonList(colStats)); db.setPartitionColumnStatistics(request); return 0; }

Target:
private int persistColumnStats(Hive db) throws HiveException, MetaException, IOException { ColumnStatistics colStats = constructColumnStatsFromInput(); ColumnStatisticsDesc colStatsDesc = colStats.getStatsDesc(); if (work.getColStats() != null && AcidUtils.isTransactionalTable(getHive().getTable(colStatsDesc.getDbName(), colStatsDesc.getTableName()))) { LOG.debug("Skipped updating column stats for table " + TableName.getDbTable(colStatsDesc.getDbName(), colStatsDesc.getTableName()) + " because it is converted to a transactional table during replication."); return 0; } SetPartitionsStatsRequest request = new SetPartitionsStatsRequest(Collections.singletonList(colStats)); db.setPartitionColumnStatistics(request); return 0; }
Source:
public OUT nextRecord(OUT tuple) throws IOException { try { resultSet.next(); int column_count = resultSetMetaData.getColumnCount(); for (int pos = 0; pos < column_count; pos++) { int type = resultSetMetaData.getColumnType(pos + 1); addValue(pos, type, tuple); } return tuple; } catch (SQLException se) { close(); throw new IOException("Couldn't read data - " + se.getMessage(), se); } catch (NullPointerException npe) { close(); throw new IOException("Couldn't access resultSet", npe); } }

Target:
public OUT nextRecord(OUT tuple) throws IOException { try { resultSet.next(); if (columnTypes == null) { extractTypes(tuple); } addValue(tuple); return tuple; } catch (SQLException se) { close(); throw new IOException("Couldn't read data - " + se.getMessage(), se); } catch (NullPointerException npe) { close(); throw new IOException("Couldn't access resultSet", npe); } }
Source:
public void onMapReady(@NonNull MapboxMap mapboxMap) { this.mapboxMap = mapboxMap; mapboxMap.setStyle(Style.LIGHT, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { initLayerIcons(); addClusteredGeoJsonSource(); Toast.makeText(ImageClusteringActivity.this, R.string.zoom_map_in_and_out_instruction, Toast.LENGTH_SHORT).show(); } }); }

Target:
public void onMapReady(@NonNull MapboxMap mapboxMap) { mapboxMap.setStyle(Style.LIGHT, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { initLayerIcons(style); addClusteredGeoJsonSource(style); Toast.makeText(ImageClusteringActivity.this, R.string.zoom_map_in_and_out_instruction, Toast.LENGTH_SHORT).show(); } }); }
Source:
public void addBondToParameters(CreateOrUpdateBond bond) { assert bond.getId() == null : "When adding a bond to the parameters its id should be null"; Guid originalIdOfBondWithTheSameName = originalBondNameToId.get(bond.getName()); bond.setId(originalIdOfBondWithTheSameName); if (originalIdOfBondWithTheSameName != null) { removedBonds.remove(originalIdOfBondWithTheSameName); } bonds.add(bond); }

Target:
public void addBondToParameters(CreateOrUpdateBond bond) { if (bond.getId() != null) { throw new IllegalArgumentException("When adding a bond to the parameters its id should be null"); } CreateOrUpdateBond originalBondWithTheSameName = originalBondsByName.get(bond.getName()); if (originalBondWithTheSameName != null) { bond.setId(originalBondWithTheSameName.getId()); removedBonds.remove(originalBondWithTheSameName); } bonds.add(bond); }
Source:
public void testImportVMFromConfigurationXMLCouldNotGetParsed() { OvfEntityData ovfEntity = getOvfEntityData(); ovfEntity.setOvfData("This is not a valid XML"); initCommand(ovfEntity); when(unregisteredOVFDataDao.getByEntityIdAndStorageDomain(vmId, storageDomainId)).thenReturn(ovfEntity); assertFalse(cmd.canDoAction()); assertTrue(cmd.getReturnValue() .getCanDoActionMessages() .contains(VdcBllMessages.ACTION_TYPE_FAILED_OVF_CONFIGURATION_NOT_SUPPORTED.toString())); }

Target:
public void testImportVMFromConfigurationXMLCouldNotGetParsed() { OvfEntityData ovfEntity = getOvfEntityData(); ovfEntity.setOvfData("This is not a valid XML"); initCommand(ovfEntity); when(unregisteredOVFDataDao.getByEntityIdAndStorageDomain(vmId, storageDomainId)).thenReturn(ovfEntity); CanDoActionTestUtils.runAndAssertCanDoActionFailure(cmd, VdcBllMessages.ACTION_TYPE_FAILED_OVF_CONFIGURATION_NOT_SUPPORTED); }
Source:
public static void deleteQueue(String projectId, String locationId, String queueId) throws Exception { try (CloudTasksClient client = CloudTasksClient.create()) { String queuePath = QueueName.of(projectId, locationId, queueId).toString(); client.deleteQueue(queuePath); System.out.println("Queue deleted: " + queueId); } }

Target:
public static void deleteQueue(String projectId, String locationId, String queueId) throws IOException { try (CloudTasksClient client = CloudTasksClient.create()) { String queuePath = QueueName.of(projectId, locationId, queueId).toString(); client.deleteQueue(queuePath); System.out.println("Queue deleted: " + queueId); } }
Source:
public void shouldAcceptIndel() throws Exception { Variant input = new Variant("1", 1000, 1002, "AT", "T"); Variant output = processor.process(input); assertEquals(Variant.VariantType.INDEL, input.getType()); assertNotNull(output); assertEquals(input, output); }

Target:
public void shouldAcceptIndel() throws Exception { Variant input = new Variant("1", 1000, 1001, "AT", "T"); Variant output = processor.process(input); assertEquals(Variant.VariantType.INDEL, input.getType()); assertNotNull(output); assertEquals(input, output); }
Source:
private void showStatusDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.post_settings_status); int checkedItem = getCurrentPostStatusIndex(); if (checkedItem == -1) { checkedItem = 0; } builder.setSingleChoiceItems(R.array.post_settings_statuses, checkedItem, null); builder.setPositiveButton(R.string.dialog_button_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { ListView lw = ((AlertDialog)dialog).getListView(); String newStatus = (String) lw.getAdapter().getItem(lw.getCheckedItemPosition()); mStatusTextView.setText(newStatus); updatePostSettingsAndSaveButton(); } }); builder.setNegativeButton(R.string.cancel, null); builder.show(); }

Target:
private void showStatusDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.post_settings_status); int checkedItem = getCurrentPostStatusIndex(); if (checkedItem == -1) { checkedItem = 0; } builder.setSingleChoiceItems(R.array.post_settings_statuses, checkedItem, null); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { ListView listView = ((AlertDialog)dialog).getListView(); String newStatus = (String) listView.getAdapter().getItem(listView.getCheckedItemPosition()); mStatusTextView.setText(newStatus); updatePostSettingsAndSaveButton(); } }); builder.setNegativeButton(R.string.cancel, null); builder.show(); }