auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void initNearCache() { NearCacheConfig nearCacheConfig = getContext().getClientConfig().getNearCacheConfig(name); if (nearCacheConfig != null) { NearCacheConfig copyNearCacheConfig = new NearCacheConfig(nearCacheConfig); copyNearCacheConfig.setSerializeKeys(false); nearCache = getContext().getNearCacheManager(getServiceName()).getOrCreateNearCache(name, copyNearCacheConfig); if (nearCacheConfig.isInvalidateOnChange()) { registerInvalidationListener(); } } }

Target:
private void initNearCache() { NearCacheConfig nearCacheConfig = getContext().getClientConfig().getNearCacheConfig(name); if (nearCacheConfig != null) { if (nearCacheConfig.isSerializeKeys()) { throw new InvalidConfigurationException("ReplicatedMap doesn't support serializeKeys option of NearCacheConfig"); } nearCache = getContext().getNearCacheManager(getServiceName()).getOrCreateNearCache(name, nearCacheConfig); if (nearCacheConfig.isInvalidateOnChange()) { registerInvalidationListener(); } } }
Source:
public ProtocolRead(String p_message) { m_message = p_message; logger.debug("Instance created for message [" + p_message + "]"); }

Target:
public ProtocolRead(String p_message) { m_message = p_message; logger.debug("Instance created for message [{}]", p_message); }
Source:
protected void putForExternalReadInternal(K key, V value, Metadata metadata, ByRef.Boolean isCreatedRef) { boolean hasListeners = this.hasListeners; getDataContainer().compute(key, (k, oldEntry, factory) -> { if (isNull(oldEntry)) { if (hasListeners) { cacheNotifier.notifyCacheEntryCreated(k, value, metadata, true, ImmutableContext.INSTANCE, null); } isCreatedRef.set(true); return factory.create(k, value, metadata); } else { return oldEntry; } }); if (hasListeners && isCreatedRef.get()) { cacheNotifier.notifyCacheEntryCreated(key, value, metadata, false, ImmutableContext.INSTANCE, null); } }

Target:
protected void putForExternalReadInternal(K key, V value, Metadata metadata, ByRef.Boolean isCreatedRef) { Objects.requireNonNull(key, NULL_KEYS_NOT_SUPPORTED); Objects.requireNonNull(value, NULL_VALUES_NOT_SUPPORTED); boolean hasListeners = this.hasListeners; getDataContainer().compute(key, (k, oldEntry, factory) -> { if (isNull(oldEntry)) { if (hasListeners) { cacheNotifier.notifyCacheEntryCreated(k, value, metadata, true, ImmutableContext.INSTANCE, null); } isCreatedRef.set(true); return factory.create(k, value, metadata); } else { return oldEntry; } }); if (hasListeners && isCreatedRef.get()) { cacheNotifier.notifyCacheEntryCreated(key, value, metadata, false, ImmutableContext.INSTANCE, null); } }
Source:
private void handleEvent(final String type, final String payload, final String topic, final @Nullable String source) { final EventFactory eventFactory = typedEventFactories.get(type); if (eventFactory == null) { logger.warn("Could not find an Event Factory for the event type '{}'.", type); return; } final Set<EventSubscriber> eventSubscribers = getEventSubscribers(type); if (eventSubscribers.isEmpty()) { return; } final Event eshEvent = createESHEvent(eventFactory, type, payload, topic, source); if (eshEvent == null) { return; } dispatchESHEvent(eventSubscribers, eshEvent); }

Target:
private void handleEvent(final String type, final String payload, final String topic, final @Nullable String source) { final EventFactory eventFactory = typedEventFactories.get(type); if (eventFactory == null) { logger.debug("Could not find an Event Factory for the event type '{}'.", type); return; } final Set<EventSubscriber> eventSubscribers = getEventSubscribers(type); if (eventSubscribers.isEmpty()) { return; } final Event eshEvent = createESHEvent(eventFactory, type, payload, topic, source); if (eshEvent == null) { return; } dispatchESHEvent(eventSubscribers, eshEvent); }
Source:
private String getLocaleInformation() { ObjectNode node = mapper.createObjectNode(); String displayedLocales = " "; for (String localeString: UnsupportedLocaleHelper.getLocalesKeys(backend, ConfigurationValues.UnsupportedDisplayedLocales)) { displayedLocales += localeString + ","; } node.put(ConfigurationValues.UnsupportedDisplayedLocales.name(), displayedLocales.substring(0, displayedLocales.length() - 1)); String unSupportedLocales = " "; for (String localeString: UnsupportedLocaleHelper.getLocalesKeys(backend, ConfigurationValues.UnsupportedLocalesFilter)) { unSupportedLocales += localeString + ","; } node.put(ConfigurationValues.UnsupportedLocalesFilter.name(), unSupportedLocales.substring(0, unSupportedLocales.length() - 1)); return node.toString(); }

Target:
private String getLocaleInformation() { ObjectNode node = mapper.createObjectNode(); StringBuilder localeBuilder = new StringBuilder(); localeBuilder.append(' '); for (String localeString: UnsupportedLocaleHelper.getLocalesKeys(backend, ConfigurationValues.UnsupportedDisplayedLocales)) { localeBuilder.append(localeString); localeBuilder.append(','); } String displayedLocales = localeBuilder.toString(); node.put(ConfigurationValues.UnsupportedDisplayedLocales.name(), displayedLocales.substring(0, displayedLocales.length() - 1)); localeBuilder = new StringBuilder(); localeBuilder.append(' '); for (String localeString: UnsupportedLocaleHelper.getLocalesKeys(backend, ConfigurationValues.UnsupportedLocalesFilter)) { localeBuilder.append(localeString); localeBuilder.append(','); } String unSupportedLocales = localeBuilder.toString(); node.put(ConfigurationValues.UnsupportedLocalesFilter.name(), unSupportedLocales.substring(0, unSupportedLocales.length() - 1)); return node.toString(); }
Source:
void close() { if (isOpen.compareAndSet(true, false)) { synchronized (chunkFillerSynchronizer) { if (isChunkFillerThreadAsleep) { chunkFillerThreadSleepDisabled = true; chunkFillerSynchronizer.notify(); } } try { chunkFillerThread.join(NonBlockingRouter.SHUTDOWN_WAIT_MS); } catch (InterruptedException e) { logger.error("Caught interrupted exception while waiting for chunkFillerThread to finish"); Thread.currentThread().interrupt(); } completePendingOperations(); } }

Target:
void close() { if (isOpen.compareAndSet(true, false)) { synchronized (chunkFillerSynchronizer) { if (isChunkFillerThreadAsleep) { chunkFillerThreadMaySleep = false; chunkFillerSynchronizer.notify(); } } try { chunkFillerThread.join(NonBlockingRouter.SHUTDOWN_WAIT_MS); } catch (InterruptedException e) { logger.error("Caught interrupted exception while waiting for chunkFillerThread to finish"); Thread.currentThread().interrupt(); } completePendingOperations(); } }
Source:
public String getConfigLoaderFactory() { return get(CONFIG_LOADER_FACTORY); }

Target:
public Optional<String> getConfigLoaderFactory() { return Optional.ofNullable(get(CONFIG_LOADER_FACTORY)); }
Source:
public synchronized static SSLContext buildContext(String algorithm, String keypath, String keypass, String keytype, String trustpath, String trustpass, String trusttype) { try { KeyManager[] kms = buildKeyManagers(keypath, keypass, keytype); TrustManager[] tms = buildTrustManagers(trustpath, trustpass, trusttype); SSLContext context = SSLContext.getInstance(algorithm); context.init(kms, tms, null); return context; } catch (Exception e) { throw new SecurityException(e.getMessage(), e); } }

Target:
public synchronized static SSLContext buildContext(String algorithm, String keypath, String keypass, String keytype, String trustpath, String trustpass, String trusttype) throws UnrecoverableKeyException, KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, KeyManagementException { KeyManager[] kms = buildKeyManagers(keypath, keypass, keytype); TrustManager[] tms = buildTrustManagers(trustpath, trustpass, trusttype); SSLContext context = SSLContext.getInstance(algorithm); context.init(kms, tms, null); return context; }
Source:
public void setUp() throws Exception { BrickTestUtils.createProjectAndGetStartScript("PhiroMoveMotorBackwardBrickTest") .addBrick(new PhiroMotorMoveBackwardBrick( PhiroMotorMoveBackwardBrick.Motor.MOTOR_RIGHT, SET_SPEED_INITIALLY)); brickPosition = 1; baseActivityTestRule.launchActivity(null); }

Target:
public void setUp() { int setSpeed = -70; BrickTestUtils.createProjectAndGetStartScript("PhiroMoveMotorBackwardBrickTest") .addBrick(new PhiroMotorMoveBackwardBrick( PhiroMotorMoveBackwardBrick.Motor.MOTOR_RIGHT, setSpeed)); brickPosition = 1; baseActivityTestRule.launchActivity(null); }
Source:
public Map<String, Object> getConfigSetting(String interpreterGroupId) { InterpreterSetting interpreterSetting = get(interpreterGroupId); if (null != interpreterSetting) { List<InterpreterInfo> interpreterInfos = interpreterSetting.getInterpreterInfos(); for (InterpreterInfo intpInfo : interpreterInfos) { if (intpInfo.isDefaultInterpreter() || (interpreterInfos.size() == 1)) { if (intpInfo.getConfig() != null) { return intpInfo.getConfig(); } } } } return new HashMap<String, Object>(); }

Target:
public Map<String, Object> getConfigSetting(String interpreterGroupId) { InterpreterSetting interpreterSetting = get(interpreterGroupId); if (null != interpreterSetting) { List<InterpreterInfo> interpreterInfos = interpreterSetting.getInterpreterInfos(); int infoSize = interpreterInfos.size(); for (InterpreterInfo intpInfo : interpreterInfos) { if ((intpInfo.isDefaultInterpreter() || (infoSize == 1)) && (intpInfo.getConfig() != null)) { return intpInfo.getConfig(); } } } return new HashMap<>(); }
Source:
public void applyConfigChanges(int newDynamicUpdateInternal, int newDynamicSampleUpdateInterval, double newDynamicBadnessThreshold) { if (DatabaseDescriptor.isDaemonInitialized()) { if (dynamicUpdateInterval != newDynamicUpdateInternal || updateScoresScheduler == null) { cancelAndWait(updateScoresScheduler, Math.max(1, dynamicUpdateInterval), TimeUnit.MILLISECONDS); updateScoresScheduler = ScheduledExecutors.scheduledTasks.scheduleWithFixedDelay(this::updateScores, newDynamicUpdateInternal, newDynamicUpdateInternal, TimeUnit.MILLISECONDS); } if (dynamicSampleUpdateInterval != newDynamicSampleUpdateInterval || updateSamplesScheduler == null) { cancelAndWait(updateSamplesScheduler, Math.max(1, dynamicSampleUpdateInterval), TimeUnit.MILLISECONDS); if (newDynamicSampleUpdateInterval > 0) updateSamplesScheduler = ScheduledExecutors.scheduledTasks.scheduleWithFixedDelay(this::updateSamples, newDynamicSampleUpdateInterval, newDynamicSampleUpdateInterval, TimeUnit.MILLISECONDS); } } dynamicUpdateInterval = newDynamicUpdateInternal; dynamicSampleUpdateInterval = newDynamicSampleUpdateInterval; dynamicBadnessThreshold = newDynamicBadnessThreshold; if (dynamicSampleUpdateInterval > 0) probeRateLimiter.setRate(dynamicSampleUpdateInterval); }

Target:
public void applyConfigChanges(int newDynamicUpdateInternal, int newDynamicSampleUpdateInterval, double newDynamicBadnessThreshold) { if (DatabaseDescriptor.isDaemonInitialized()) { if (dynamicUpdateInterval != newDynamicUpdateInternal || updateScoresScheduler == null) { ensureCancelled(updateScoresScheduler); updateScoresScheduler = ScheduledExecutors.scheduledTasks.scheduleWithFixedDelay(this::updateScores, newDynamicUpdateInternal, newDynamicUpdateInternal, TimeUnit.MILLISECONDS); } if (dynamicSampleUpdateInterval != newDynamicSampleUpdateInterval || updateSamplesScheduler == null) { ensureCancelled(updateSamplesScheduler); if (newDynamicSampleUpdateInterval > 0) updateSamplesScheduler = ScheduledExecutors.scheduledTasks.scheduleWithFixedDelay(this::updateSamples, newDynamicSampleUpdateInterval, newDynamicSampleUpdateInterval, TimeUnit.MILLISECONDS); } } dynamicUpdateInterval = newDynamicUpdateInternal; dynamicUpdateInterval = newDynamicUpdateInternal; dynamicSampleUpdateInterval = newDynamicSampleUpdateInterval; dynamicBadnessThreshold = newDynamicBadnessThreshold; if (dynamicSampleUpdateInterval > 0) setProbeRateLimiter(dynamicSampleUpdateInterval); }
Source:
public BooleanParameter markRequired() { throw new UnsupportedOperationException( "A boolean parameter must not be marked as required as it is inherently so. Use markNullable() to make the parameter optional"); }

Target:
public BooleanParameter markRequired() { throw new UnsupportedOperationException( "A boolean parameter must not be marked as required as it is inherently so. Use markNullable() to make the parameter optional."); }
Source:
@Override public final boolean writeLog(FilePath workspace, OutputStream sink) throws IOException, InterruptedException { if (writeLogCs == null) { if (SYSTEM_DEFAULT_CHARSET.equals(charset)) { String cs = workspace.act(new TranscodingCharsetForSystemDefault()); writeLogCs = new AtomicReference<>(cs == null ? null : Charset.forName(cs)); } else { writeLogCs = new AtomicReference<>(transcodingCharset(charset)); } LOGGER.log(Level.FINE, "remote transcoding charset: {0}", writeLogCs); } FilePath log = getLogFile(workspace); OutputStream transcodedSink; if (writeLogCs.get() == null) { transcodedSink = sink; } else { CharsetDecoder decoder = writeLogCs.get().newDecoder().onMalformedInput(CodingErrorAction.REPLACE).onUnmappableCharacter(CodingErrorAction.REPLACE); transcodedSink = new WriterOutputStream(new OutputStreamWriter(sink, StandardCharsets.UTF_8), decoder, 1024, true); } CountingOutputStream cos = new CountingOutputStream(transcodedSink); try { log.act(new WriteLog(lastLocation, new RemoteOutputStream(cos))); sink.flush(); return cos.getByteCount() > 0; } finally { transcodedSink.flush(); long written = cos.getByteCount(); if (written > 0) { LOGGER.log(Level.FINE, "copied {0} bytes from {1}", new Object[] {written, log}); lastLocation += written; } } }

Target:
@Override public final boolean writeLog(FilePath workspace, OutputStream sink) throws IOException, InterruptedException { if (writeLogCs == null) { if (SYSTEM_DEFAULT_CHARSET.equals(charset)) { String cs = workspace.act(new TranscodingCharsetForSystemDefault()); writeLogCs = new AtomicReference<>(cs == null ? null : Charset.forName(cs)); } else { writeLogCs = new AtomicReference<>(transcodingCharset(charset)); } LOGGER.log(Level.FINE, "remote transcoding charset: {0}", writeLogCs); } FilePath log = getLogFile(workspace); OutputStream transcodedSink; if (writeLogCs.get() == null) { transcodedSink = sink; } else { CharsetDecoder decoder = writeLogCs.get().newDecoder().onMalformedInput(CodingErrorAction.REPLACE).onUnmappableCharacter(CodingErrorAction.REPLACE); transcodedSink = new WriterOutputStream(new OutputStreamWriter(sink, StandardCharsets.UTF_8), decoder, 1024, true); } CountingOutputStream cos = new CountingOutputStream(transcodedSink); try { log.act(new WriteLog(lastLocation, new RemoteOutputStream(cos))); return cos.getByteCount() > 0; } finally { transcodedSink.flush(); long written = cos.getByteCount(); if (written > 0) { LOGGER.log(Level.FINE, "copied {0} bytes from {1}", new Object[] {written, log}); lastLocation += written; } } }
Source:
@Override public void msync(long address, long byteCount, int flags) throws ErrnoException { BlockGuard.getThreadPolicy().onWriteToDisk(); os.msync(address, byteCount, flags); }

Target:
@Override public void msync(long address, long byteCount, int flags) throws ErrnoException { if ((flags & OsConstants.MS_SYNC) != 0) { BlockGuard.getThreadPolicy().onWriteToDisk(); } os.msync(address, byteCount, flags); }
Source:
private void resetMerge() throws IOException { try { repo.writeMergeHeads(null); repo.writeMergeCommitMsg(null); } catch (IOException e) { throw e; } }

Target:
private void resetMerge() throws IOException { repo.writeMergeHeads(null); repo.writeMergeCommitMsg(null); }
Source:
public StatisticsResource getStatisticsResource() { EntityIdResolver<Guid> resolver = new EntityIdResolver<Guid>() { @Override public VmNetworkInterface lookupEntity(Guid id) throws BackendFailureException { return collection.lookupEntity(guid); } }; NicStatisticalQuery query = new NicStatisticalQuery(resolver, newModel(id)); return inject(new BackendStatisticsResource<NIC, VmNetworkInterface>(entityType, guid, query)); }

Target:
public StatisticsResource getStatisticsResource() { EntityIdResolver<Guid> resolver = new EntityIdResolver<Guid>() { @Override public VmNetworkInterface lookupEntity(Guid guid) throws BackendFailureException { return collection.lookupEntity(guid); } }; NicStatisticalQuery query = new NicStatisticalQuery(resolver, newModel(id)); return inject(new BackendStatisticsResource<NIC, VmNetworkInterface>(entityType, guid, query)); }
Source:
private Observable<Integer> doFullTextSearchResultsCountObservable(final String searchTerm) { return Observable.fromIterable(WikipediaApp.getInstance().language().getAppLanguageCodes()) .concatMap(langCode -> ServiceFactory.get(WikiSite.forLanguageCode(langCode)).fullTextSearch(searchTerm, LARGE_BATCH_SIZE, null, null)) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .map(response -> response.query() != null ? response.query().pages().size() : 0); }

Target:
private Observable<Integer> doFullTextSearchResultsCountObservable(final String searchTerm) { return Observable.fromIterable(WikipediaApp.getInstance().language().getAppLanguageCodes()) .concatMap(langCode -> ServiceFactory.get(WikiSite.forLanguageCode(langCode)).fullTextSearch(searchTerm, BATCH_SIZE, null, null)) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .map(response -> response.query() != null ? response.query().pages().size() : 0); }
Source:
private SecurityDomain(Builder builder) { this.realmMap = unmodifiableMap(builder.realms); this.defaultRealmName = builder.defaultRealmName; this.preRealmRewriter = builder.preRealmRewriter; this.realmMapper = builder.realmMapper; this.postRealmRewriter = builder.postRealmRewriter; anonymousAllowed = false; }

Target:
SecurityDomain(Builder builder) { this.realmMap = unmodifiableMap(builder.realms); this.defaultRealmName = builder.defaultRealmName; this.preRealmRewriter = builder.preRealmRewriter; this.realmMapper = builder.realmMapper; this.roleMapper = builder.roleMapper; this.postRealmRewriter = builder.postRealmRewriter; anonymousAllowed = false; }
Source:
private boolean isRSA(ArrayInitializerTree config) { return config.arrayPairs().stream() .filter(pair -> { if (!"private_key_type".equals(trimQuotes((LiteralTree) pair.key()))) { return false; } if (pair.value().is(Kind.NAMESPACE_NAME)) { NamespaceNameTree value = (NamespaceNameTree) pair.value(); return "OPENSSL_KEYTYPE_RSA".equals(value.name().text()); } return false; }) .count() > 0; }

Target:
private static boolean isRSA(ArrayInitializerTree config) { return config.arrayPairs().stream().anyMatch(pair -> { if (!hasKey(pair, "private_key_type")) { return false; } if (pair.value().is(Kind.NAMESPACE_NAME)) { NamespaceNameTree value = (NamespaceNameTree) pair.value(); return "OPENSSL_KEYTYPE_RSA".equals(value.name().text()); } return false; }); }
Source:
public Type getType(String id) { Type type = types.get(id); if (type == null) { return null; } else { Map<String, SubType> allowedSubTypes = getCoreAllowedSubtypes(type); Type newType = type.clone(); newType.setAllowedSubTypes(allowedSubTypes); newType.setDeniedSubTypes(new String[0]); return newType; } }

Target:
public Type getType(String id) { return types.get(id); }
Source:
public void testFinishLocalSetupFullyInitialized() throws Exception { final Checker checker = new Checker(); final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); checker.setModuleClassLoader(contextClassLoader); final PackageObjectFactory factory = new PackageObjectFactory( new HashSet<>(), contextClassLoader); checker.setModuleFactory(factory); checker.setBasedir("testBaseDir"); checker.setLocaleLanguage("it"); checker.setLocaleCountry("IT"); checker.finishLocalSetup(); final Context context = Whitebox.getInternalState(checker, "childContext"); assertEquals("error", context.get("severity"), "Severity is set to unexpected value"); assertEquals("testBaseDir", context.get("basedir"), "Basedir is set to unexpected value"); final Field sLocale = LocalizedMessage.class.getDeclaredField("sLocale"); sLocale.setAccessible(true); final Locale locale = (Locale) sLocale.get(null); assertEquals(Locale.ITALY, locale, "Locale is set to unexpected value"); }

Target:
public void testFinishLocalSetupFullyInitialized() throws Exception { final Checker checker = new Checker(); final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); checker.setModuleClassLoader(contextClassLoader); final PackageObjectFactory factory = new PackageObjectFactory( new HashSet<>(), contextClassLoader); checker.setModuleFactory(factory); checker.setBasedir("testBaseDir"); checker.setLocaleLanguage("it"); checker.setLocaleCountry("IT"); checker.finishLocalSetup(); final Context context = Whitebox.getInternalState(checker, "childContext"); final String encoding = StandardCharsets.UTF_8.name(); assertEquals(encoding, context.get("charset"), "Charset was different than expected"); assertEquals("error", context.get("severity"), "Severity is set to unexpected value"); assertEquals("testBaseDir", context.get("basedir"), "Basedir is set to unexpected value"); final Field sLocale = LocalizedMessage.class.getDeclaredField("sLocale"); sLocale.setAccessible(true); final Locale locale = (Locale) sLocale.get(null); assertEquals(Locale.ITALY, locale, "Locale is set to unexpected value"); }
Source:
public void alterDatabase(String databaseName, CatalogDatabase newDatabase, boolean ignoreIfNotExists) throws DatabaseNotExistException, CatalogException { checkArgument(!StringUtils.isNullOrWhitespaceOnly(databaseName), "databaseName cannot be null or empty"); checkNotNull(newDatabase, "newDatabase cannot be null"); Database hiveDB; try { hiveDB = getHiveDatabase(databaseName); } catch (DatabaseNotExistException e) { if (!ignoreIfNotExists) { throw new DatabaseNotExistException(getName(), databaseName); } return; } Map<String, String> params = hiveDB.getParameters(); boolean isGeneric = getObjectIsGeneric(params); if (isGeneric) { hiveDB.setParameters(newDatabase.getProperties()); } else { String opStr = newDatabase.getProperties().remove(ALTER_DATABASE_OP); if (opStr == null) { throw new CatalogException(ALTER_DATABASE_OP + " property is missing for alter database statement"); } String newLocation = newDatabase.getProperties().remove(SqlCreateHiveDatabase.DATABASE_LOCATION_URI); Map<String, String> newParams = newDatabase.getProperties(); AlterHiveDatabaseOp op = AlterHiveDatabaseOp.valueOf(opStr); switch (op) { case CHANGE_PROPS: if (params == null) { hiveDB.setParameters(newParams); } else { params.putAll(newParams); } break; case CHANGE_LOCATION: hiveDB.setLocationUri(newLocation); break; case CHANGE_OWNER: String ownerName = newParams.remove(DATABASE_OWNER_NAME); String ownerType = newParams.remove(DATABASE_OWNER_TYPE); hiveDB.setOwnerName(ownerName); switch (ownerType) { case SqlAlterHiveDatabaseOwner.ROLE_OWNER: hiveDB.setOwnerType(PrincipalType.ROLE); break; case SqlAlterHiveDatabaseOwner.USER_OWNER: hiveDB.setOwnerType(PrincipalType.USER); break; default: throw new CatalogException("Unsupported database owner type: " + ownerType); } break; default: throw new CatalogException("Unsupported alter database op:" + opStr); } } try { client.alterDatabase(databaseName, hiveDB); } catch (TException e) { throw new CatalogException(String.format("Failed to alter database %s", databaseName), e); } }

Target:
public void alterDatabase(String databaseName, CatalogDatabase newDatabase, boolean ignoreIfNotExists) throws DatabaseNotExistException, CatalogException { checkArgument(!StringUtils.isNullOrWhitespaceOnly(databaseName), "databaseName cannot be null or empty"); checkNotNull(newDatabase, "newDatabase cannot be null"); Database hiveDB; try { hiveDB = getHiveDatabase(databaseName); } catch (DatabaseNotExistException e) { if (!ignoreIfNotExists) { throw new DatabaseNotExistException(getName(), databaseName); } return; } try { client.alterDatabase(databaseName, HiveDatabaseUtil.alterDatabase(hiveDB, newDatabase)); } catch (TException e) { throw new CatalogException(String.format("Failed to alter database %s", databaseName), e); } }
Source:
public BlockLease flatten(Block block) { requireNonNull(block, "block is null"); if (block instanceof DictionaryBlock) { return flattenDictionary((DictionaryBlock) block); } if (block instanceof RunLengthEncodedBlock) { return flattenRLE((RunLengthEncodedBlock) block); } return newLease(block); }

Target:
public BlockLease flatten(Block block) { requireNonNull(block, "block is null"); if (block instanceof DictionaryBlock) { return flattenDictionaryBlock((DictionaryBlock) block); } if (block instanceof RunLengthEncodedBlock) { return flattenRunLengthEncodedBlock((RunLengthEncodedBlock) block); } return newLease(block); }
Source:
public void handle(StageFeedEntry feedEntry, final PipelineInstanceLoader pipelineInstanceLoader) { StageIdentifier stageIdentifier = feedEntry.getStageIdentifier(); LOGGER.debug("handling stage:<" + stageIdentifier + ">..."); try { stageStorage.save(stageResourceImporter.load(stageIdentifier, new InMemoryTempGraphFactory(), transformerRegistry)); LOGGER.debug("importing stage:<" + stageIdentifier + "> finished."); } catch (GoIntegrationException e) { LOGGER.error("Can not import stage <" + stageIdentifier + ">, will skip to next...", e); } }

Target:
public void handle(StageFeedEntry feedEntry, final PipelineInstanceLoader pipelineInstanceLoader) { StageIdentifier stageIdentifier = feedEntry.getStageIdentifier(); LOGGER.debug("handling stage:<{}>...", stageIdentifier); try { stageStorage.save(stageResourceImporter.load(stageIdentifier, new InMemoryTempGraphFactory(), transformerRegistry)); LOGGER.debug("importing stage:<{}> finished.", stageIdentifier); } catch (GoIntegrationException e) { LOGGER.error("Can not import stage <{}>, will skip to next...", stageIdentifier, e); } }
Source:
public void displayNewPage(PageTitle title, HistoryEntry entry, boolean tryFromCache, boolean pushBackStack, int stagedScrollY, boolean savedPageRefreshed) { tocHandler.setEnabled(false); setToCButtonFadedIn(true); errorView.setVisibility(View.GONE); model.setTitle(title); model.setTitleOriginal(title); model.setCurEntry(entry); savedPagesFunnel = app.getFunnelManager().getSavedPagesFunnel(title.getSite()); getPageActivity().updateProgressBar(true, true, 0); checkIfPageIsSaved(title); refreshedIfSaved = savedPageRefreshed; pageLoadStrategy.onDisplayNewPage(pushBackStack, tryFromCache, stagedScrollY); }

Target:
public void displayNewPage(PageTitle title, HistoryEntry entry, boolean tryFromCache, boolean pushBackStack, int stagedScrollY, boolean savedPageRefreshed) { tocHandler.setEnabled(false); setToCButtonFadedIn(true); errorView.setVisibility(View.GONE); model.setTitle(title); model.setTitleOriginal(title); model.setCurEntry(entry); savedPagesFunnel = app.getFunnelManager().getSavedPagesFunnel(title.getSite()); getPageActivity().updateProgressBar(true, true, 0); savedPageCheckComplete = false; checkIfPageIsSaved(); refreshedIfSaved = savedPageRefreshed; pageLoadStrategy.onDisplayNewPage(pushBackStack, tryFromCache, stagedScrollY); }
Source:
SessionManager() { if (BitreserveClient.getApplicationContext() != null) { initSharedPreferences(); } else { sharedPreferences = null; } }

Target:
SessionManager() { if (BitreserveClient.getApplicationContext() != null) { initSharedPreferences(); } }
Source:
public Optional<ChargeStatus> getMappedGatewayStatus(ChargeEntity charge) { try { return getChargeGatewayStatus(charge).getMappedStatus(); } catch (WebApplicationException | UnsupportedOperationException | GatewayException | IllegalArgumentException e) { logger.info("Unable to retrieve status for charge for gateway {}: {}", charge.getExternalId(), charge.getPaymentGatewayName().toString(), e.getMessage()); return Optional.empty(); } }

Target:
public Optional<ChargeStatus> getMappedGatewayStatus(ChargeEntity charge) { try { return getChargeGatewayStatus(charge).getMappedStatus(); } catch (WebApplicationException | UnsupportedOperationException | GatewayException | IllegalArgumentException e) { logger.info(String.format("Unable to retrieve status for charge %s for gateway %s: %s", charge.getExternalId(), charge.getPaymentGatewayName().toString(), e.getMessage()), kv(PAYMENT_EXTERNAL_ID, charge.getExternalId()), kv(PROVIDER, charge.getPaymentGatewayName().toString())); return Optional.empty(); } }
Source:
public void process(K k, V v) { Span span = kafkaStreamsTracing.nextSpan(processorContext); if (!span.isNoop()) { span.name(spanName); span.start(); } Tracer.SpanInScope ws = tracer.withSpanInScope(span); Throwable error = null; try { delegateProcessor.process(k, v); } catch (RuntimeException | Error e) { error = e; Call.propagateIfFatal(e); throw e; } finally { kafkaStreamsTracing.injector.inject(span.context(), processorContext.headers()); if (error != null) span.error(error); span.finish(); ws.close(); } }

Target:
public void process(K k, V v) { Span span = kafkaStreamsTracing.nextSpan(processorContext); if (!span.isNoop()) { span.name(spanName); span.start(); } Tracer.SpanInScope ws = tracer.withSpanInScope(span); Throwable error = null; try { delegateProcessor.process(k, v); } catch (Throwable e) { error = e; propagateIfFatal(e); throw e; } finally { kafkaStreamsTracing.injector.inject(span.context(), processorContext.headers()); if (error != null) span.error(error); span.finish(); ws.close(); } }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } return this.hashCode() == obj.hashCode(); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } PropertiesImpl other = (PropertiesImpl) obj; return computeEqualityWith(this, other); }
Source:
public void writeContent(final XMLExtendedStreamWriter writer, final SubsystemMarshallingContext context) throws XMLStreamException { <<<<<<< HEAD context.startSubsystemElement(EJB3SubsystemNamespace.EJB3_3_1.getUriString(), false); ======= context.startSubsystemElement(EJB3SubsystemNamespace.EJB3_4_0.getUriString(), false); >>>>>>> a05507f... [WFLY-3290] Add cluster attribute to EJB3 subsystem remote element to allow specifying EJBClient cluster name. writeElements(writer, context); writer.writeEndElement(); }

Target:
public void writeContent(final XMLExtendedStreamWriter writer, final SubsystemMarshallingContext context) throws XMLStreamException { context.startSubsystemElement(EJB3SubsystemNamespace.EJB3_4_0.getUriString(), false); writeElements(writer, context); writer.writeEndElement(); }
Source:
public ACEReader(String aceCorpusHome, String[] sections, boolean is2004mode) throws Exception { super(CorpusReaderConfigurator.buildResourceManager(aceCorpusHome)); this.aceCorpusHome = aceCorpusHome; this.corpusId = is2004mode ? "ACE2004" : "ACE2005"; this.is2004mode = is2004mode; if (sections == null || sections.length == 0) { sections = IOUtils.lsDirectories(this.aceCorpusHome); } File corpusHomeDir = new File(this.aceCorpusHome); assert corpusHomeDir.isDirectory(); FilenameFilter apfFileFilter = new FilenameFilter() { public boolean accept(File directory, String fileName) { return ( new File(directory + "/" + fileName).isDirectory() || fileName.endsWith(".apf.xml") ); } }; List<Pair<String, String>> fileNames = new ArrayList<>(); for (String section : sections) { File sectionDir = new File(this.aceCorpusHome + File.separator + section); String[] xmlFiles = IOUtils.lsFilesRecursive(sectionDir.getAbsolutePath(), apfFileFilter); if (xmlFiles.length == 0) { logger.error("No valid xml file found. Skipping section " + section); continue; } for (String fileName : xmlFiles) { fileNames.add(new Pair<>(section, fileName)); } } this.fileList = Collections.unmodifiableList(fileNames); }

Target:
public ACEReader(String aceCorpusHome, String[] sections, boolean is2004mode) throws Exception { super(CorpusReaderConfigurator.buildResourceManager(aceCorpusHome)); this.aceCorpusHome = aceCorpusHome; this.corpusId = is2004mode ? "ACE2004" : "ACE2005"; this.is2004mode = is2004mode; if (sections == null || sections.length == 0) { sections = IOUtils.lsDirectories(this.aceCorpusHome); } File corpusHomeDir = new File(this.aceCorpusHome); assert corpusHomeDir.isDirectory(); FilenameFilter apfFileFilter = new FilenameFilter() { public boolean accept(File directory, String fileName) { return ( new File(directory + File.separator + fileName).isDirectory() || fileName.endsWith(".apf.xml") ); } }; List<Pair<String, String>> fileNames = new ArrayList<>(); for (String section : sections) { File sectionDir = new File(this.aceCorpusHome + File.separator + section); String[] xmlFiles = IOUtils.lsFilesRecursive(sectionDir.getAbsolutePath(), apfFileFilter); if (xmlFiles.length == 0) { logger.error("No valid xml file found. Skipping section " + section); continue; } for (String fileName : xmlFiles) { fileNames.add(new Pair<>(section, fileName)); } } this.fileList = Collections.unmodifiableList(fileNames); }
Source:
private Builder visitContainer(Container container) { Builder builder = visitContent(container); ContentRefSerializer refSerializer = new ContentRefSerializer(container.getSource()); for (ItemRef child : container.getItemRefs()) { builder.addChildren(refSerializer.serialize(child)); } for (Map.Entry<ItemRef, Iterable<BroadcastRef>> upcomingContent : container.getUpcomingContent() .entrySet()) { builder.addUpcomingContent( itemAndBroadcastRefSerializer.serialize( upcomingContent.getKey(), upcomingContent.getValue() ) ); } for (Map.Entry<ItemRef, Iterable<LocationSummary>> availableContent : container.getAvailableContent() .entrySet()) { builder.addAvailableContent( itemAndLocationSummarySerializer.serialize( availableContent.getKey(), availableContent.getValue() ) ); } if (container.getItemSummaries() != null) { builder.addAllItemSummaries( container.getItemSummaries().stream() .map(is -> { try { return itemSummarySerializer.serialize(is).build(); } catch (Exception e) { log.error("ItemSummary without title: {}", is.getItemRef().getId(), e); return null; } }) .filter(Objects::nonNull) .collect(Collectors.toList()) ); } if (container.getCertificates() != null) { builder.addAllCertificates(container.getCertificates().stream() .map(certificateSerializer::serialize) .collect(MoreCollectors.toImmutableSet())); } if (container.getYear() != null) { builder.addReleaseYears(container.getYear()); } return builder; }

Target:
private Builder visitContainer(Container container) { Builder builder = visitContent(container); ContentRefSerializer refSerializer = new ContentRefSerializer(container.getSource()); for (ItemRef child : container.getItemRefs()) { builder.addChildren(refSerializer.serialize(child)); } for (Map.Entry<ItemRef, Iterable<BroadcastRef>> upcomingContent : container.getUpcomingContent() .entrySet()) { builder.addUpcomingContent( itemAndBroadcastRefSerializer.serialize( upcomingContent.getKey(), upcomingContent.getValue() ) ); } for (Map.Entry<ItemRef, Iterable<LocationSummary>> availableContent : container.getAvailableContent() .entrySet()) { builder.addAvailableContent( itemAndLocationSummarySerializer.serialize( availableContent.getKey(), availableContent.getValue() ) ); } if (container.getItemSummaries() != null) { builder.addAllItemSummaries( container.getItemSummaries().stream() .map(this::serializeItemSummary) .filter(Objects::nonNull) .collect(Collectors.toList()) ); } if (container.getCertificates() != null) { builder.addAllCertificates(container.getCertificates().stream() .map(certificateSerializer::serialize) .collect(MoreCollectors.toImmutableSet())); } if (container.getYear() != null) { builder.addReleaseYears(container.getYear()); } return builder; }
Source:
public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { for (@NonNull LSPDocumentInfo info : LanguageServiceAccessor.getLSPDocumentInfosFor(textViewer.getDocument(), capabilities -> capabilities.getDocumentLinkProvider() != null)) { try { DocumentLinkParams params = new DocumentLinkParams( new TextDocumentIdentifier(info.getFileUri().toString())); CompletableFuture<List<DocumentLink>> documentLink = info.getInitializedLanguageClient() .get(500, TimeUnit.MILLISECONDS).getTextDocumentService() .documentLink(params); List<DocumentLink> links = documentLink.get(2, TimeUnit.SECONDS); if (links == null || links.isEmpty()) { continue; } List<IHyperlink> hyperlinks = new ArrayList<IHyperlink>(links.size()); for (DocumentLink link : links) { int start = LSPEclipseUtils.toOffset(link.getRange().getStart(), textViewer.getDocument()); int end = LSPEclipseUtils.toOffset(link.getRange().getEnd(), textViewer.getDocument()); IRegion linkRegion = new Region(start, end - start); if (TextUtilities.overlaps(region, linkRegion)) { if (link.getTarget() != null) { hyperlinks.add(new DocumentHyperlink(link.getTarget(), linkRegion)); } } } if (hyperlinks.isEmpty()) { return null; } return hyperlinks.toArray(new IHyperlink[hyperlinks.size()]); } catch (BadLocationException | InterruptedException | ExecutionException | TimeoutException e) { LanguageServerPlugin.logError(e); } } return null; }

Target:
public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { for (@NonNull LSPDocumentInfo info : LanguageServiceAccessor.getLSPDocumentInfosFor(textViewer.getDocument(), capabilities -> capabilities.getDocumentLinkProvider() != null)) { try { DocumentLinkParams params = new DocumentLinkParams( new TextDocumentIdentifier(info.getFileUri().toString())); CompletableFuture<List<DocumentLink>> documentLink = info.getInitializedLanguageClient() .thenCompose(languageServer -> languageServer.getTextDocumentService().documentLink(params)); List<DocumentLink> links = documentLink.get(2, TimeUnit.SECONDS); if (links == null || links.isEmpty()) { continue; } List<IHyperlink> hyperlinks = new ArrayList<IHyperlink>(links.size()); for (DocumentLink link : links) { int start = LSPEclipseUtils.toOffset(link.getRange().getStart(), textViewer.getDocument()); int end = LSPEclipseUtils.toOffset(link.getRange().getEnd(), textViewer.getDocument()); IRegion linkRegion = new Region(start, end - start); if (TextUtilities.overlaps(region, linkRegion)) { if (link.getTarget() != null) { hyperlinks.add(new DocumentHyperlink(link.getTarget(), linkRegion)); } } } if (hyperlinks.isEmpty()) { return null; } return hyperlinks.toArray(new IHyperlink[hyperlinks.size()]); } catch (BadLocationException | InterruptedException | ExecutionException | TimeoutException e) { LanguageServerPlugin.logError(e); } } return null; }
Source:
public synchronized CleanUpTabPageDescriptor[] getCleanUpTabPageDescriptors(int kind) { ensurePagesRegistered(); ArrayList<CleanUpTabPageDescriptor> result= new ArrayList<>(); for (CleanUpTabPageDescriptor fPageDescriptor : fPageDescriptors) { if (fPageDescriptor.getKind() == kind) { result.add(fPageDescriptor); } } return result.toArray(new CleanUpTabPageDescriptor[result.size()]); }

Target:
public synchronized CleanUpTabPageDescriptor[] getCleanUpTabPageDescriptors(int kind) { ensurePagesRegistered(); ArrayList<CleanUpTabPageDescriptor> result= new ArrayList<>(); for (CleanUpTabPageDescriptor descriptor : fPageDescriptors) { if (descriptor.getKind() == kind) { result.add(descriptor); } } return result.toArray(new CleanUpTabPageDescriptor[result.size()]); }
Source:
public void checkFormMappingResolutionShouldNotAddProblemsIfThereIsNONE() throws Exception { ArrayList<Problem> problems = new ArrayList<>(); SFormMappingImpl sFormMappingTask = new SFormMappingImpl(321324, FormMappingType.TASK.getId(), "Step1", SFormMapping.TARGET_NONE); SFormMappingImpl sFormMappingProcessOverview = new SFormMappingImpl(321324, FormMappingType.PROCESS_OVERVIEW.getId(), null, SFormMapping.TARGET_NONE); SFormMappingImpl sFormMappingProcessStart = new SFormMappingImpl(321324, FormMappingType.PROCESS_START.getId(), null, SFormMapping.TARGET_NONE); formMappingAndPageDependencyDeployer.checkFormMappingResolution(tenantServiceAccessor, sFormMappingTask, problems); formMappingAndPageDependencyDeployer.checkFormMappingResolution(tenantServiceAccessor, sFormMappingProcessOverview, problems); formMappingAndPageDependencyDeployer.checkFormMappingResolution(tenantServiceAccessor, sFormMappingProcessStart, problems); assertThat(problems).as("the problem list should contain three mapping problems").hasSize(0); }

Target:
public void checkFormMappingResolutionShouldNotAddProblemsIfThereIsNONE() throws Exception { ArrayList<Problem> problems = new ArrayList<>(); SFormMappingImpl sFormMappingTask = new SFormMappingImpl(321324, FormMappingType.TASK.getId(), "Step1", SFormMapping.TARGET_NONE); SFormMappingImpl sFormMappingProcessOverview = new SFormMappingImpl(321324, FormMappingType.PROCESS_OVERVIEW.getId(), null, SFormMapping.TARGET_NONE); SFormMappingImpl sFormMappingProcessStart = new SFormMappingImpl(321324, FormMappingType.PROCESS_START.getId(), null, SFormMapping.TARGET_NONE); formMappingAndPageDependencyDeployer.checkFormMappingResolution(tenantServiceAccessor, sFormMappingTask, problems); formMappingAndPageDependencyDeployer.checkFormMappingResolution(tenantServiceAccessor, sFormMappingProcessOverview, problems); formMappingAndPageDependencyDeployer.checkFormMappingResolution(tenantServiceAccessor, sFormMappingProcessStart, problems); assertThat(problems).as("the problem list should not contain any mapping problem").hasSize(0); }
Source:
public static void evaluateFinal(BooleanDistinctState state, BlockBuilder out) { switch (state.getInt()) { case 0: BIGINT.writeLong(out, 0); break; case 1: case 2: BIGINT.writeLong(out, 1); break; case 3: BIGINT.writeLong(out, 2); break; } }

Target:
public static void evaluateFinal(BooleanDistinctState state, BlockBuilder out) { BIGINT.writeLong(out, Integer.bitCount(state.getByte())); }
Source:
private BtVodUpdater btVodUpdater() { return new BtVodUpdater( mergingContentWriter(), btVodData(btVodMpxProdFeedBaseUrl, btVodMpxProdFeedName, btVodMpxProdFeedQParam), URI_PREFIX, btVodContentGroupUpdater(Publisher.BT_VOD, URI_PREFIX, btVodMpxProdFeedBaseUrl, btVodMpxProdFeedQParam), Publisher.BT_VOD, oldContentDeactivator(Publisher.BT_VOD), noImageExtractor(), URI_PREFIX, noImageExtractor(), brandUriExtractor(URI_PREFIX), topicResolver, topicWriter, newFeedContentMatchingPredicate(btVodMpxProdFeedBaseUrl, btVodMpxProdFeedQParam), topicFor(feedNamepaceFor("prod", "config1"), BT_VOD_NEW_FEED, Publisher.BT_VOD), topicFor(btVodAppCategoryNamespaceFor("prod", "config1"), BT_VOD_KIDS_TOPIC, Publisher.BT_VOD), topicFor(btVodAppCategoryNamespaceFor("prod", "config1"), BT_VOD_TV_BOXSETS_TOPIC, Publisher.BT_VOD), topicFor(btVodAppCategoryNamespaceFor("prod", "config1"), BT_VOD_CATCHUP_TOPIC, Publisher.BT_VOD), staleTopicContentRemover(Publisher.BT_VOD, "prod", "config1"), seriesUriExtractor(URI_PREFIX), versionsExtractor(URI_PREFIX), describedFieldsExtractor(Publisher.BT_VOD,"prod", "config1", btVodMpxProdFeedBaseUrl, btVodMpxProdFeedQParam) ); }

Target:
private BtVodUpdater btVodUpdater() { return new BtVodUpdater( mergingContentWriter(), btVodData(btVodMpxProdFeedBaseUrl, btVodMpxProdFeedName, btVodMpxProdFeedQParam), URI_PREFIX, btVodContentGroupUpdater(Publisher.BT_VOD, URI_PREFIX, btVodMpxProdFeedBaseUrl, btVodMpxProdFeedQParam), Publisher.BT_VOD, oldContentDeactivator(Publisher.BT_VOD), noImageExtractor(), URI_PREFIX, noImageExtractor(), brandUriExtractor(URI_PREFIX), topicResolver, topicWriter, newFeedContentMatchingPredicate(btVodMpxProdFeedBaseUrl, btVodMpxProdFeedQParam), topicFor(feedNamepaceFor(BT_VOD_UPDATER_ENV, BT_VOD_UPDATER_CONFIG), BT_VOD_NEW_FEED, Publisher.BT_VOD), topicFor(btVodAppCategoryNamespaceFor(BT_VOD_UPDATER_ENV, BT_VOD_UPDATER_CONFIG), BT_VOD_KIDS_TOPIC, Publisher.BT_VOD), topicFor(btVodAppCategoryNamespaceFor(BT_VOD_UPDATER_ENV, BT_VOD_UPDATER_CONFIG), BT_VOD_TV_BOXSETS_TOPIC, Publisher.BT_VOD), topicFor(btVodAppCategoryNamespaceFor(BT_VOD_UPDATER_ENV, BT_VOD_UPDATER_CONFIG), BT_VOD_CATCHUP_TOPIC, Publisher.BT_VOD), staleTopicContentRemover(Publisher.BT_VOD, BT_VOD_UPDATER_ENV, BT_VOD_UPDATER_CONFIG), seriesUriExtractor(URI_PREFIX), versionsExtractor(URI_PREFIX, BT_VOD_UPDATER_ENV, BT_VOD_UPDATER_CONFIG), describedFieldsExtractor(Publisher.BT_VOD,BT_VOD_UPDATER_ENV, BT_VOD_UPDATER_CONFIG, btVodMpxProdFeedBaseUrl, btVodMpxProdFeedQParam) ); }
Source:
public void triggerNow() { if (updateTimerJobId != null) { SchedulerUtil scheduler = Injector.get(SchedulerUtilQuartzImpl.class); scheduler.triggerJob(updateTimerJobId); } }

Target:
public void triggerNow() { if (updateTimerJobId != null) { SchedulerUtil scheduler = getSchedulerInstance(); scheduler.triggerJob(updateTimerJobId); } }
Source:
private void handleAuthError(AccountStore.AuthenticationErrorType error, String errorMessage) { switch (error) { case INCORRECT_USERNAME_OR_PASSWORD: case NOT_AUTHENTICATED: showError(getString(R.string.username_or_password_incorrect)); break; case INVALID_OTP: case INVALID_TOKEN: case AUTHORIZATION_REQUIRED: case NEEDS_2FA: if (mIsWpcom) { mLoginListener.needs2fa(mRequestedUsername, mRequestedPassword); } else { showError("2FA not supported for self-hosted sites. Please use an app-password."); } break; default: AppLog.e(T.NUX, "Server response: " + errorMessage); ToastUtils.showToast(getActivity(), errorMessage == null ? getString(R.string.error_generic) : errorMessage); break; } }

Target:
private void handleAuthError(AccountStore.AuthenticationErrorType error, String errorMessage) { switch (error) { case INCORRECT_USERNAME_OR_PASSWORD: case NOT_AUTHENTICATED: showError(getString(R.string.username_or_password_incorrect)); break; case INVALID_OTP: case INVALID_TOKEN: case AUTHORIZATION_REQUIRED: case NEEDS_2FA: if (mIsWpcom) { if (mLoginListener != null) { mLoginListener.needs2fa(mRequestedUsername, mRequestedPassword); } } else { showError("2FA not supported for self-hosted sites. Please use an app-password."); } break; default: AppLog.e(T.NUX, "Server response: " + errorMessage); ToastUtils.showToast(getActivity(), errorMessage == null ? getString(R.string.error_generic) : errorMessage); break; } }
Source:
public static Map<String, Object> request(OP op, String uri, Map<String, String> payload, String body, ArrayList<HashMap<String, String>> postHeaders) throws Exception { HashMap<String, String> headers = new HashMap<>(); for (HashMap<String, String> map : postHeaders) { for (Map.Entry<String, String> entry : map.entrySet()) { headers.put(entry.getKey(), entry.getValue()); } } if (body == null) { return request(op, uri, headers, payload); } else { return request(op,uri, headers, body, ContentType.DEFAULT_TEXT); } }

Target:
public static Map<String, Object> request(OP op, String uri, Map<String, String> payload, String body, ArrayList<HashMap<String, String>> postHeaders) throws Exception { HashMap<String, String> headers = new HashMap<>(); for (HashMap<String, String> map : postHeaders) { for (Map.Entry<String, String> entry : map.entrySet()) { headers.put(entry.getKey(), entry.getValue()); } } HashMap<String, Object> newPayload = new HashMap<>(); for (Map.Entry<String, String> entry : payload.entrySet()) { newPayload.put(entry.getKey(), entry.getValue()); } if (body == null) { return request(op, uri, headers, newPayload); } else { return request(op, uri, headers, body, ContentType.DEFAULT_TEXT); } }
Source:
public Optional<IdentifiedVersion> lastKnownVersion() { return Optional.empty(); }

Target:
public Optional<IdentifiedVersion> lastKnownVersion() { return FAKE_OPTIONAL_VERSION; }
Source:
public long countLocationsByType(final Integer type, final String programUUID) throws MiddlewareQueryException { return this.countAllByMethod(this.getLocationDao(), COUNT_BY_TYPE, new Object[] { type, programUUID }, new Class[] { Integer.class, String.class }); }

Target:
public long countLocationsByType(final Integer type, final String programUUID) throws MiddlewareQueryException { return this.countAllByMethod(this.getLocationDao(), LocationDataManagerImpl.COUNT_BY_TYPE, new Object[] { type, programUUID }, new Class[] { Integer.class, String.class }); }
Source:
public void testGetUnit() { final String result = DlmsUnitTypeDto.getUnit(1); Assert.assertTrue("Y".equals(result)); }

Target:
public void testGetUnit() { final String result = DlmsUnitTypeDto.getUnit(1); assertEquals("Y", result); }
Source:
public OSBTreeCollectionManager getSBtreeCollectionManager() { try { return sbTreeCollectionManager; } catch (RuntimeException e) { throw logAndPrepareForRethrow(e); } catch (Error e) { throw logAndPrepareForRethrow(e); } catch (Throwable t) { throw logAndPrepareForRethrow(t); } }

Target:
public OSBTreeCollectionManager getSBtreeCollectionManager() { return sbTreeCollectionManager; }