auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public PaxosLeadershipCreator( <START> TimeLockInstallConfiguration install, <END> Observable<TimeLockRuntimeConfiguration> runtime, Consumer<Object> registrar) { this.install = install; Preconditions.checkState(install.algorithm() instanceof PaxosInstallConfiguration, "Cannot create a Paxos leadership agent with a non-Paxos install configuration"); this.paxosInstall = (PaxosInstallConfiguration) install.algorithm(); this.runtime = runtime.map(config -> config.algorithm().map(algo -> (PaxosRuntimeConfiguration) algo)); this.registrar = registrar; }</code><technical_language>Again, if this is Paxos specific argument leave impetus consumer</technical_language>

Target:
public PaxosLeadershipCreator( TimeLockInstallConfiguration install, Observable<TimeLockRuntimeConfiguration> runtime, Consumer<Object> registrar) { this.install = install; this.runtime = runtime.map(TimeLockRuntimeConfiguration::algorithm); this.registrar = registrar; }
Source:
<code>private String getAuthorizationCommonEndpoint(final URL authorizationEndpointUrl) { <START> return String.format("https://%s%s", authorizationEndpointUrl.getHost(), AUTHORIZATION_COMMON_ENDPOINT); <END> }</code><technical_language>please add locale in</technical_language>

Target:
private String getAuthorizationCommonEndpoint(final URL authorizationEndpointUrl) { return new Uri.Builder().scheme("https") .authority(authorizationEndpointUrl.getHost()) .appendPath(AUTHORIZATION_COMMON_ENDPOINT).build().toString(); }
Source:
<code>private Object getSingletonInstance(RenderingContext ctx) { if (!servicesInjected) { synchronized (this) { <START> if (!servicesInjected) { <END> injectServices(singleton); servicesInjected = true; } } } for (Field contextField : contextFields) { ThreadSafeRenderingContext value; try { value = (ThreadSafeRenderingContext) contextField.get(singleton); } catch (IllegalArgumentException | IllegalAccessException e) { log.error("unable to create a marshaller instance for clazz " + clazz.getName(), e); return null; } value.configureThread(ctx); } return singleton; }</code><technical_language>servicesInjected a volatile if want double-checked locking</technical_language>

Target:
private Object getSingletonInstance(RenderingContext ctx) { if (!servicesInjected) { synchronized (this) { if (!servicesInjected) { injectServices(singleton); servicesInjected = true; } } } for (Field contextField : contextFields) { ThreadSafeRenderingContext value; try { value = (ThreadSafeRenderingContext) contextField.get(singleton); } catch (IllegalArgumentException | IllegalAccessException e) { throw new NuxeoException("unable to create a marshaller instance for clazz " + clazz.getName(), e); } value.configureThread(ctx); } return singleton; }
Source:
<code><START> protected <I, T extends I> @Nullable I getService(Class<T> clazz, Class<I> implementationClass) { <END> final List<I> services = getServices(clazz, implementationClass); return getSingleServiceInstance(clazz, services); }</code><technical_language>turned T & I here, declared as: protected <T, I extends T> @Nullable I getService(Class<T> clazz, Class<I> implementationClass)</technical_language>

Target:
protected <T, I extends T> @Nullable I getService(Class<T> clazz, Class<I> implementationClass) { final List<I> services = getServices(clazz, implementationClass); return getSingleServiceInstance(clazz, services); }
Source:
<code>public Object[] getChildren(final Object parentElement) { if (parentElement instanceof IRepositoryStore) { if (!cache.containsKey(parentElement)) { final List<IRepositoryFileStore> result = new ArrayList<IRepositoryFileStore>(); for (final IRepositoryFileStore child : ((IRepositoryStore<IRepositoryFileStore>) parentElement).getChildren()) { if (child != null && child.canBeExported()) { result.add(child); } } cache.put((IRepositoryStore<?>) parentElement, result.toArray()); } return cache.get(parentElement); } <START> return null; <END> }</code><technical_language>return empty array null, changing null here</technical_language>

Target:
public Object[] getChildren(final Object parentElement) { if (parentElement instanceof IRepositoryStore) { if (!cache.containsKey(parentElement)) { final List<IRepositoryFileStore> result = new ArrayList<IRepositoryFileStore>(); for (final IRepositoryFileStore child : ((IRepositoryStore<IRepositoryFileStore>) parentElement).getChildren()) { if (child != null && child.canBeExported()) { result.add(child); } } cache.put((IRepositoryStore<?>) parentElement, result.toArray()); } return cache.get(parentElement); } return new Object[0]; }
Source:
<code>public void addFeature(PhoneNumberFeature... features) { <START> for (PhoneNumberFeature feature: features) { <END> this.features.add(feature); } }</code><technical_language>Collections.addAll(this.features, features) instead of for loop</technical_language>

Target:
public void addFeature(PhoneNumberFeature... features) { Collections.addAll(this.features, features); }
Source:
<code>public void onPartitionBecomeStandbyFromLeader(String partitionName) { try { PartitionStateChangeListener cloudToStoreReplicationListener = partitionStateChangeListeners.get(StateModelListenerType.CloudToStoreReplicationManagerListener); if (cloudToStoreReplicationListener != null) { cloudToStoreReplicationListener.onPartitionBecomeStandbyFromLeader(partitionName); } } catch (Exception e) { <START> participantMetrics.leaderCount.addAndGet(-1); <END> participantMetrics.errorStateCount.addAndGet(1); throw e; } participantMetrics.leaderCount.addAndGet(-1); participantMetrics.standbyCount.addAndGet(1); }</code><technical_language>finally</technical_language>

Target:
public void onPartitionBecomeStandbyFromLeader(String partitionName) { try { PartitionStateChangeListener cloudToStoreReplicationListener = partitionStateChangeListeners.get(StateModelListenerType.CloudToStoreReplicationManagerListener); if (cloudToStoreReplicationListener != null) { cloudToStoreReplicationListener.onPartitionBecomeStandbyFromLeader(partitionName); } } catch (Exception e) { participantMetrics.errorStateCount.addAndGet(1); throw e; } finally { participantMetrics.leaderCount.addAndGet(-1); } participantMetrics.standbyCount.addAndGet(1); }
Source:
<code>public static VerificationClientService verificationClientServiceDialogue( VerificationClientRule verificationClientRule) { Channel channel = ApacheHttpClientChannels.create(ClientConfiguration.builder() .from(verificationClientRule.getClientConfiguration()) <START> .userAgent(getUserAgent()) <END> .build()); return JaxRsClient.create( VerificationClientService.class, DefaultConjureRuntime.builder().build(), channel); }</code><technical_language>thoughts pushing this .userAgent() getClientConfiguration() method</technical_language>

Target:
public static VerificationClientService verificationClientServiceDialogue( VerificationClientRule verificationClientRule) { Channel channel = ApacheHttpClientChannels.create(verificationClientRule.getClientConfiguration()); return JaxRsClient.create( VerificationClientService.class, channel, DefaultConjureRuntime.builder().build()); }
Source:
<code>void setOperationException(Exception exception) { if (exception instanceof RouterException) { RouterErrorCode routerErrorCode = ((RouterException) exception).getErrorCode(); if (operationException.get() == null) { operationException.set(exception); } else { if (getPrecedenceLevel(routerErrorCode) < getPrecedenceLevel( <START> ((RouterException) operationException.get()).getErrorCode())) { <END> operationException.set(exception); } } } else { if (operationException.get() == null) { operationException.set(exception); } } }</code><technical_language>this casting dereferencing unsafe? if operationException is of type RouterException? need a policy for precedence/overriding work if existing exception is a RouterException. leave override RouterExceptions</technical_language>

Target:
void setOperationException(Exception exception) { if (exception instanceof RouterException) { RouterErrorCode routerErrorCode = ((RouterException) exception).getErrorCode(); if (operationException.get() == null) { operationException.set(exception); } else { Integer currentOperationExceptionLevel = null; if (operationException.get() instanceof RouterException) { currentOperationExceptionLevel = getPrecedenceLevel(((RouterException) operationException.get()).getErrorCode()); } else { currentOperationExceptionLevel = getPrecedenceLevel(RouterErrorCode.UnexpectedInternalError); } if (getPrecedenceLevel(routerErrorCode) < currentOperationExceptionLevel) { operationException.set(exception); } } } else { if (operationException.get() == null) { operationException.set(exception); } } }
Source:
<code>public void setSplitRules(final Collection<SplitRule> splitRules) { this.splitRules = splitRules; if (this.splitRules.size() != 0) { <START> addUnsavedProperty("splitRules"); <END> } }</code><technical_language>Is property in form? If not, is this line required</technical_language>

Target:
public void setSplitRules(final Collection<SplitRule> splitRules) { this.splitRules = splitRules; }
Source:
<code>public String printTopologyFromLevel(Set<Integer> bridgeIds, int level) { Set<Integer> bridgesDownLevel = new HashSet<Integer>(); StringBuffer strbfr = new StringBuffer(); strbfr.append("------level "); strbfr.append(level); strbfr.append(" -----\n"); strbfr.append("bridges on level:"); strbfr.append(bridgeIds); strbfr.append("\n"); for (Integer bridgeid : bridgeIds) { final Bridge bridge = getBridge(bridgeid); if (bridge == null) { <START> continue; <END> } strbfr.append(bridge.printTopology()); for (SharedSegment segment: getSharedSegmentOnTopologyForBridge(bridgeid)) { if (segment.getDesignatedBridge().intValue() == bridgeid.intValue()) { strbfr.append(segment.printTopology()); bridgesDownLevel.addAll(segment.getBridgeIdsOnSegment()); } } } strbfr.append("------level "); strbfr.append(level); strbfr.append(" -----\n"); bridgesDownLevel.removeAll(bridgeIds); if (!bridgesDownLevel.isEmpty()) strbfr.append(printTopologyFromLevel(bridgesDownLevel,level+1)); return strbfr.toString(); }</code><technical_language>Java Stream API instead filter for bridges instead of continue here. this: java bridgeIds.stream() .map(id -> getBridge(id)) .filter(bridge -> bridge != null) .forEach(bridge -> { .... });</technical_language>

Target:
public String printTopologyFromLevel(Set<Integer> bridgeIds, int level) { Set<Integer> bridgesDownLevel = new HashSet<Integer>(); StringBuffer strbfr = new StringBuffer(); strbfr.append("------level "); strbfr.append(level); strbfr.append(" -----\n"); strbfr.append("bridges on level:"); strbfr.append(bridgeIds); strbfr.append("\n"); bridgeIds.stream() .map(id -> getBridge(id)) .filter(bridge -> bridge != null) .forEach(bridge -> { strbfr.append(bridge.printTopology()); for (SharedSegment segment: getSharedSegmentOnTopologyForBridge(bridge.getId())) { if (segment.getDesignatedBridge().intValue() == bridge.getId().intValue()) { strbfr.append(segment.printTopology()); bridgesDownLevel.addAll(segment.getBridgeIdsOnSegment()); } } }); strbfr.append("------level "); strbfr.append(level); strbfr.append(" -----\n"); bridgesDownLevel.removeAll(bridgeIds); if (!bridgesDownLevel.isEmpty()) strbfr.append(printTopologyFromLevel(bridgesDownLevel,level+1)); return strbfr.toString(); }
Source:
<code>public CSVNameSource(Reader reader) throws IOException { <START> this.name = "Reader " + reader.toString(); <END> this.reader = new CSVReader(reader); this.collectColumns(); }</code><technical_language>System.identityHashCode more consistent reader.toString in terms of making name contains a massive chunk of information if toString serialises entire Reader a String</technical_language>

Target:
public CSVNameSource(Reader reader) throws IOException { this.name = "Reader " + System.identityHashCode(reader); this.reader = new CSVReader(reader); this.collectColumns(); }
Source:
<code>public Result runTestSuite() { Result result = new Result(); result.testRunStarted(); Class<? extends SPITester> testClass = getClass(); ArrayList<Method> beforeMethodList = new ArrayList<Method>(); ArrayList<Method> afterMethodList = new ArrayList<Method>(); for(Method m : testClass.getDeclaredMethods()){ if (m.isAnnotationPresent(Before.class)) { beforeMethodList.add(m); } if (m.isAnnotationPresent(After.class)) { afterMethodList.add(m); } } <START> if(!beforeMethodList.isEmpty()) { <END> for (Method bm : beforeMethodList) { try { bm.invoke(this, (Object[]) null); } catch (Exception e) { throw new RuntimeException(e); } } } for (Method m : testClass.getDeclaredMethods()) { if (m.isAnnotationPresent(SPITest.class)) { if (m.isAnnotationPresent(Ignore.class)) { result.testSkipped(new ResultState(testClass, m.getName(), m.getAnnotation(Ignore.class).reason())); } else try { m.invoke(this, (Object[]) null); result.testFinished(); } catch (InvocationTargetException wrappedExc) { result.testFailed(new ResultState(testClass, m.getName(), wrappedExc.getCause())); } catch (Exception e) { throw new RuntimeException(e); } finally { if (!afterMethodList.isEmpty()) { for (Method am : afterMethodList) { try { am.invoke(this, (Object[]) null); } catch (Exception e) { throw new RuntimeException(e); } } } } } } result.testRunFinished(); return result; }</code><technical_language>match JUnit behavior consistent introduced @After, @Before methods executed for test method</technical_language>

Target:
public Result runTestSuite() { Result result = new Result(); result.testRunStarted(); Class<? extends SPITester> testClass = getClass(); ArrayList<Method> beforeMethodList = new ArrayList<Method>(); ArrayList<Method> afterMethodList = new ArrayList<Method>(); for(Method m : testClass.getDeclaredMethods()){ if (m.isAnnotationPresent(Before.class)) { beforeMethodList.add(m); } if (m.isAnnotationPresent(After.class)) { afterMethodList.add(m); } } for (Method m : testClass.getDeclaredMethods()) { if (m.isAnnotationPresent(SPITest.class)) { if (m.isAnnotationPresent(Ignore.class)) { result.testSkipped(new ResultState(testClass, m.getName(), m.getAnnotation(Ignore.class).reason())); } else try { for (Method bm : beforeMethodList) { try { bm.invoke(this, (Object[]) null); } catch (Exception e) { throw new RuntimeException(e); } } m.invoke(this, (Object[]) null); result.testFinished(); } catch (InvocationTargetException wrappedExc) { result.testFailed(new ResultState(testClass, m.getName(), wrappedExc.getCause())); } catch (Exception e) { throw new RuntimeException(e); } finally { if (!afterMethodList.isEmpty()) { for (Method am : afterMethodList) { try { am.invoke(this, (Object[]) null); } catch (Exception e) { throw new RuntimeException(e); } } } } } } result.testRunFinished(); return result; }
Source:
<code>public MethodDefinition( ClassDefinition declaringClass, EnumSet<Access> access, String name, ParameterizedType returnType, Iterable<Parameter> parameters ) { int parameterCount = Iterables.size(parameters); checkArgument( parameterCount > MAX_ALLOWED_VARARG_ARGUMENTS, <START> "Number of arguments (%d) for vararg functions exceeds limit (%d)", <END> parameterCount, MAX_ALLOWED_VARARG_ARGUMENTS); this.declaringClass = declaringClass; body = new BytecodeBlock(); this.access = access; this.name = name; if (returnType != null) { this.returnType = returnType; } else { this.returnType = type(void.class); } this.parameters = ImmutableList.copyOf(parameters); this.parameterTypes = Lists.transform(this.parameters, Parameter::getType); this.parameterAnnotations = ImmutableList.copyOf(transform(parameters, input -> new ArrayList<>())); Optional<ParameterizedType> thisType = Optional.empty(); if (!access.contains(STATIC)) { thisType = Optional.of(declaringClass.getType()); } scope = new Scope(thisType, parameters); }</code><technical_language>This do varargs. message like: "Methods 255 parameters" (use term "parameters" consistent JVMS)</technical_language>

Target:
public MethodDefinition( ClassDefinition declaringClass, EnumSet<Access> access, String name, ParameterizedType returnType, Iterable<Parameter> parameters ) { checkArgument(Iterables.size(parameters) <= 254, "Too many parameters for method"); this.declaringClass = declaringClass; body = new BytecodeBlock(); this.access = access; this.name = name; if (returnType != null) { this.returnType = returnType; } else { this.returnType = type(void.class); } this.parameters = ImmutableList.copyOf(parameters); this.parameterTypes = Lists.transform(this.parameters, Parameter::getType); this.parameterAnnotations = ImmutableList.copyOf(transform(parameters, input -> new ArrayList<>())); Optional<ParameterizedType> thisType = Optional.empty(); if (!declaringClass.isInterface() && !access.contains(STATIC)) { thisType = Optional.of(declaringClass.getType()); } scope = new Scope(thisType, parameters); }
Source:
<code>public void clickUndoSwapLink() { firstUndoLink.click(); PageObjectLogging.log("undoSwap", "undo link clicked", true); <START> } <END></code><technical_language>please separate methods empty lines</technical_language>

Target:
public void clickUndoSwapLink() { firstUndoLink.click(); PageObjectLogging.log("clickUndoSwapLink", "undo link clicked", true); }
Source:
<code>private void updateNoUpstreamNotification() { final boolean tetheringInactive = mDownstreamTypesMask <START> <= DOWNSTREAM_NONE; <END> if (tetheringInactive || !mNoUpstream || setupNoUpstreamNotification() == NO_NOTIFY) { clearNotification(NO_UPSTREAM_NOTIFICATION_ID); getHandler().removeMessages(EVENT_SHOW_NO_UPSTREAM); } }</code><technical_language>(especially for loop conditions) I this style in this case this is a mask, if top bit this broken unexpectedly. == instead</technical_language>

Target:
private void updateNoUpstreamNotification() { final boolean tetheringInactive = mDownstreamTypesMask == DOWNSTREAM_NONE; if (tetheringInactive || !mNoUpstream || setupNoUpstreamNotification() == NO_NOTIFY) { clearNotification(NO_UPSTREAM_NOTIFICATION_ID); mHandler.removeMessages(EVENT_SHOW_NO_UPSTREAM); } }
Source:
<code>static HandledState newInstance(SeverityReasonType severityReason, Severity severity) { <START> return newInstance(severityReason, null, severity, false); <END> }</code><technical_language>nice consider passing in Collections.emptyMap assume field is non-null. getter annotated a setter prevent empty object serialised</technical_language>

Target:
static HandledState newInstance(SeverityReasonType severityReason, Severity severity) { return newInstance(severityReason, Collections.<String, String>emptyMap(), severity, false); }
Source:
<code>private String buildUrl(String cache, K key) { <START> String s = new StringBuffer(buildCacheUrl(cache)).append("/").append(key).toString(); <END> log.trace("buildUrl(String cache, K key) = " + s); return s; }</code><technical_language>StringBuilder please</technical_language>

Target:
private String buildUrl(String cache, K key) { String s = new StringBuilder(buildCacheUrl(cache)).append("/").append(key).toString(); log.trace("buildUrl(String cache, K key) = " + s); return s; }
Source:
<code>protected abstract Object visitDataReadCommand(InvocationContext ctx, DataCommand command) throws Throwable; protected abstract Object visitDataWriteCommand(InvocationContext ctx, DataWriteCommand command) throws Throwable; protected final Object visitNonTxDataWriteCommand(InvocationContext ctx, DataWriteCommand command) throws Throwable { Object key; <START> if (hasSkipLocking(command) || ((key = command.getKey()) == ctx.getLockOwner()) || !shouldLockKey(key)) { <END> return invokeNext(ctx, command); } try { lockAndRecord(ctx, key, getLockTimeoutMillis(command)); } catch (Throwable t) { lockManager.unlockAll(ctx); throw t; } return invokeNextAndFinally(ctx, command, unlockAllReturnHandler); }</code><technical_language>thinking other possibilities: providing forEach consumer a Cache check for already-locked one, add Flag.SKIP_LOCKING for commands affect key? This simple for putAll, - issue putAll() for other entries put() flag independently</technical_language>

Target:
protected abstract Object visitDataReadCommand(InvocationContext ctx, DataCommand command) throws Throwable; protected abstract Object visitDataWriteCommand(InvocationContext ctx, DataWriteCommand command) throws Throwable; protected final Object visitNonTxDataWriteCommand(InvocationContext ctx, DataWriteCommand command) throws Throwable { Object key; if (hasSkipLocking(command) || !shouldLockKey((key = command.getKey()))) { return invokeNext(ctx, command); } try { lockAndRecord(ctx, key, getLockTimeoutMillis(command)); } catch (Throwable t) { lockManager.unlockAll(ctx); throw t; } return invokeNextAndFinally(ctx, command, unlockAllReturnHandler); }
Source:
<code>void setCountryComboBoxAction(ComboBox<Country> countryComboBox) { countryComboBox.setOnAction(e -> { <START> selectedCountry = countryComboBox.getSelectionModel().getSelectedItem(); updateFromInputs(); <END> }); }</code><technical_language>need reset input field validation work expected. selectedCountry = countryComboBox.getSelectionModel().getSelectedItem(); accountIdInputTextField.resetValidation(); accountIdInputTextField.validate(); updateFromInputs();</technical_language>

Target:
void setCountryComboBoxAction(ComboBox<Country> countryComboBox) { countryComboBox.setOnAction(e -> { selectedCountry = countryComboBox.getSelectionModel().getSelectedItem(); updateFromInputs(); accountIdInputTextField.resetValidation(); accountIdInputTextField.validate(); accountIdInputTextField.requestFocus(); countryComboBox.requestFocus(); }); }
Source:
<code>public Cursor queryDocument(String documentId, String[] projection) throws FileNotFoundException { final long docId = Long.parseLong(documentId); updateCurrentStorageManagerIfNeeded(docId); final FileCursor result = new FileCursor(projection); <START> result.addFile(mCurrentStorageManager.getFileById(docId)); <END> return result; }</code><technical_language>is generated a NullPointer exception, mCurrentStorageManager is in StorageManager Map a id of current storage managers</technical_language>

Target:
public Cursor queryDocument(String documentId, String[] projection) throws FileNotFoundException { final long docId = Long.parseLong(documentId); updateCurrentStorageManagerIfNeeded(docId); final FileCursor result = new FileCursor(projection); if (result != null) result.addFile(mCurrentStorageManager.getFileById(docId)); return result; }
Source:
<code>public static @NonNull String buildCompatibilityTraceTypeId(@NonNull String traceTypeId) { int index = traceTypeId.lastIndexOf(SEPARATOR); if ((index != -1) && (traceTypeId.startsWith(LINUX_TOOLS_CUSTOM_TXT_TRACE_TYPE_PREFIX))) { String definitionName = index < traceTypeId.length() ? traceTypeId.substring(index + 1) : ""; if (traceTypeId.contains(CustomTxtTrace.class.getSimpleName() + SEPARATOR) && traceTypeId.indexOf(SEPARATOR) == index) { return buildTraceTypeId(CustomTxtTraceDefinition.CUSTOM_TXT_CATEGORY, definitionName); } <START> return NonNullUtils.checkNotNull(traceTypeId.replace(LINUX_TOOLS_CUSTOM_TXT_TRACE_TYPE_PREFIX, CUSTOM_TXT_TRACE_TYPE_PREFIX)); <END> } return traceTypeId; }</code><technical_language>Do want compatibility early TraceCompass versions</technical_language>

Target:
public static @NonNull String buildCompatibilityTraceTypeId(@NonNull String traceTypeId) { if (traceTypeId.startsWith(EARLY_TRACE_COMPASS_CUSTOM_TXT_TRACE_TYPE_PREFIX)) { return NonNullUtils.checkNotNull(traceTypeId.replace(EARLY_TRACE_COMPASS_CUSTOM_TXT_TRACE_TYPE_PREFIX, CUSTOM_TXT_TRACE_TYPE_PREFIX)); } int index = traceTypeId.lastIndexOf(SEPARATOR); if ((index != -1) && (traceTypeId.startsWith(LINUX_TOOLS_CUSTOM_TXT_TRACE_TYPE_PREFIX))) { String definitionName = index < traceTypeId.length() ? traceTypeId.substring(index + 1) : ""; if (traceTypeId.contains(CustomTxtTrace.class.getSimpleName() + SEPARATOR) && traceTypeId.indexOf(SEPARATOR) == index) { return buildTraceTypeId(CustomTxtTraceDefinition.CUSTOM_TXT_CATEGORY, definitionName); } return NonNullUtils.checkNotNull(traceTypeId.replace(LINUX_TOOLS_CUSTOM_TXT_TRACE_TYPE_PREFIX, CUSTOM_TXT_TRACE_TYPE_PREFIX)); } return traceTypeId; }
Source:
<code><START> public String getTableName() { <END> Queryable queryable = getQueryable(); return ( queryable != null ) ? queryable.getTableName() : "{none}"; }</code><technical_language>I this is needed</technical_language>

Target:
private String getTableName() { Queryable queryable = getQueryable(); return ( queryable != null ) ? queryable.getTableName() : "{none}"; }
Source:
<code>public void onUnityAdsError(UnityAds.UnityAdsError unityAdsError, String message) { <START> if (unityAdsError == UnityAds.UnityAdsError.NOT_INITIALIZED || unityAdsError == UnityAds.UnityAdsError.INITIALIZE_FAILED <END> || unityAdsError == UnityAds.UnityAdsError.INIT_SANITY_CHECK_FAIL || unityAdsError == UnityAds.UnityAdsError.INVALID_ARGUMENT) { for (Listener listener : mListeners) { listener.onInitializeError(message); } mListeners.clear(); UnityAds.removeListener(getInstance().getUnitySingletonListenerInstance()); } }</code><technical_language>limit errors? If get error this stage, assuming expecting a success later. If other error types, adapter hang is timed out</technical_language>

Target:
public void onUnityAdsError(UnityAds.UnityAdsError unityAdsError, String message) { Log.w(TAG, "UnityAds error message: " + message); if (unityAdsError.equals(UnityAds.UnityAdsError.NOT_INITIALIZED) || unityAdsError.equals(UnityAds.UnityAdsError.INITIALIZE_FAILED) || unityAdsError.equals(UnityAds.UnityAdsError.INIT_SANITY_CHECK_FAIL) || unityAdsError.equals(UnityAds.UnityAdsError.INVALID_ARGUMENT) || unityAdsError.equals(UnityAds.UnityAdsError.AD_BLOCKER_DETECTED)) { for (HashMap.Entry<String, WeakReference<UnityAdapterDelegate>> entry : mPlacementsInUse.entrySet()) { if (entry.getValue().get() != null) { entry.getValue().get().onUnityAdsError(UnityAds.UnityAdsError.NOT_INITIALIZED, entry.getValue().get().getPlacementId()); } mPlacementsInUse.remove(entry.getKey()); } } else if (mAdShowingAdapterDelegate != null) { UnityAdapterDelegate delegate = mAdShowingAdapterDelegate.get(); if (delegate != null) { delegate.onUnityAdsError(unityAdsError, delegate.getPlacementId()); } } }
Source:
<code>public MainTableDataModel(BibDatabaseContext context) { ObservableList<BibEntry> allEntries = BindingsHelper.forUI(context.getDatabase().getEntries()); ObservableList<BibEntryTableViewModel> entriesViewModel = BindingsHelper.mapBacked(allEntries, BibEntryTableViewModel::new); entriesFiltered = new FilteredList<>(entriesViewModel); entriesFiltered.predicateProperty().bind( Bindings.createObjectBinding(() -> this::isMatched, Globals.stateManager.activeGroupProperty(), Globals.stateManager.activeSearchQueryProperty()) ); <START> entriesFiltered.addListener((ListChangeListener<BibEntryTableViewModel>) c -> { <END> Globals.stateManager.setSearchResultSize(entriesFiltered.size()); }); entriesSorted = new SortedList<>(entriesFiltered); }</code><technical_language>bindings: Bindings.size(entriesFiltered)</technical_language>

Target:
public MainTableDataModel(BibDatabaseContext context) { ObservableList<BibEntry> allEntries = BindingsHelper.forUI(context.getDatabase().getEntries()); ObservableList<BibEntryTableViewModel> entriesViewModel = BindingsHelper.mapBacked(allEntries, BibEntryTableViewModel::new); entriesFiltered = new FilteredList<>(entriesViewModel); entriesFiltered.predicateProperty().bind( Bindings.createObjectBinding(() -> this::isMatched, Globals.stateManager.activeGroupProperty(), Globals.stateManager.activeSearchQueryProperty()) ); IntegerProperty resultSize = new SimpleIntegerProperty(); resultSize.bind(Bindings.size(entriesFiltered)); Globals.stateManager.setActiveSearchResultSize(context, resultSize); entriesSorted = new SortedList<>(entriesFiltered); }
Source:
<code>public static String encryptPassword(String password) { String result = password; String keyFile = Config.<String> GetValue(ConfigValues.keystoreUrl, Config.DefaultConfigurationVersion); String passwd = Config.<String> GetValue(ConfigValues.keystorePass, Config.DefaultConfigurationVersion); String alias = Config.<String> GetValue(ConfigValues.CertAlias, Config.DefaultConfigurationVersion); try { result = EncryptionUtils.encrypt((String) result, keyFile, passwd, alias); } catch (Exception e) { <START> log.errorFormat("Failed to encrpyt password, error message: {0}", e.getMessage()); <END> throw new SecurityException(e); } return result; }</code><technical_language>is logging for in EncryptionUtils.encrypt catch block</technical_language>

Target:
public static String encryptPassword(String password) { String result = password; String keyFile = Config.<String> GetValue(ConfigValues.keystoreUrl, Config.DefaultConfigurationVersion); String passwd = Config.<String> GetValue(ConfigValues.keystorePass, Config.DefaultConfigurationVersion); String alias = Config.<String> GetValue(ConfigValues.CertAlias, Config.DefaultConfigurationVersion); try { result = EncryptionUtils.encrypt((String) result, keyFile, passwd, alias); } catch (Exception e) { throw new SecurityException(e); } return result; }
Source:
<code><START> public static ViewModelProvider.Factory provideViewModelFactory(ViewModelSubComponent.Builder subComponentBuilder) { <END> ArrayMap<Class<? extends ViewModel>, Provider<ViewModel>> viewModelMap = new ArrayMap<>(); final ViewModelSubComponent subComp = subComponentBuilder.build(); viewModelMap.put(PluginBrowserViewModel.class, new Provider<ViewModel>() { @Override public ViewModel get() { return subComp.pluginBrowserViewModel(); } }); return new ViewModelFactory(viewModelMap); }</code><technical_language>get rid of public accessor</technical_language>

Target:
static ViewModelProvider.Factory provideViewModelFactory(ViewModelSubComponent.Builder subComponentBuilder) { ArrayMap<Class<? extends ViewModel>, Provider<ViewModel>> viewModelMap = new ArrayMap<>(); final ViewModelSubComponent subComp = subComponentBuilder.build(); viewModelMap.put(PluginBrowserViewModel.class, new Provider<ViewModel>() { @Override public ViewModel get() { return subComp.pluginBrowserViewModel(); } }); return new ViewModelFactory(viewModelMap); }
Source:
<code>private PythonSensor sensor(@Nullable PythonCustomRuleRepository[] customRuleRepositories, @Nullable AnalysisWarnings analysisWarnings) { FileLinesContextFactory fileLinesContextFactory = mock(FileLinesContextFactory.class); FileLinesContext fileLinesContext = mock(FileLinesContext.class); when(fileLinesContextFactory.createFor(Mockito.any(InputFile.class))).thenReturn(fileLinesContext); CheckFactory checkFactory = new CheckFactory(activeRules); if(customRuleRepositories == null) { if (analysisWarnings == null) { return new PythonSensor(fileLinesContextFactory, checkFactory, new NoSonarFilter()); } else { <START> return new PythonSensor(fileLinesContextFactory, checkFactory, new NoSonarFilter(), analysisWarnings); <END> } } if (analysisWarnings == null){ return new PythonSensor(fileLinesContextFactory, checkFactory, customRuleRepositories, new NoSonarFilter()); } else { return new PythonSensor(fileLinesContextFactory, checkFactory, new NoSonarFilter(), customRuleRepositories, analysisWarnings); } }</code><technical_language>do need this if/else? pass analysisWarnings argument null</technical_language>

Target:
private PythonSensor sensor(@Nullable PythonCustomRuleRepository[] customRuleRepositories, @Nullable AnalysisWarnings analysisWarnings) { FileLinesContextFactory fileLinesContextFactory = mock(FileLinesContextFactory.class); FileLinesContext fileLinesContext = mock(FileLinesContext.class); when(fileLinesContextFactory.createFor(Mockito.any(InputFile.class))).thenReturn(fileLinesContext); CheckFactory checkFactory = new CheckFactory(activeRules); if(customRuleRepositories == null) { return new PythonSensor(fileLinesContextFactory, checkFactory, new NoSonarFilter(), analysisWarnings); } return new PythonSensor(fileLinesContextFactory, checkFactory, new NoSonarFilter(), customRuleRepositories, analysisWarnings); }
Source:
<code>private void runMoves(final String firstContextId, final String secondContextId) { String srcId = firstContextId; String destId = secondContextId; for (int i = 0; i < iterations; i++) { final long numToMove = getNumUnits(partitionManager.getRangeSet(srcId, SimpleEMTask.KEY)) / 2; <START> LOG.info("Move data of size " + numToMove + " from " + srcId + " to " + destId); <END> final Set<LongRange> ranges = getRangeSetToMove(srcId, destId, numToMove); for (final LongRange range : ranges) { LOG.info("- " + range + ", size: " + (range.getMaximumLong() - range.getMinimumLong() + 1)); } final TraceScope moveTraceScope = Trace.startSpan("simpleMove", Sampler.ALWAYS); try { emService.move(SimpleEMTask.KEY, ranges, srcId, destId); } finally { moveTraceScope.close(); } final String tmpContextId = srcId; srcId = destId; destId = tmpContextId; if (i != (iterations - 1)) { try { Thread.sleep(periodMillis); } catch (InterruptedException e) { throw new RuntimeException(e); } } } }</code><technical_language>size of partitions move numToMove, this number of actual data items moved equals numToMove. changing this log message more clear</technical_language>

Target:
private void runMoves(final String firstContextId, final String secondContextId) { String srcId = firstContextId; String destId = secondContextId; for (int i = 0; i < iterations; i++) { final Set<LongRange> srcRangeSet = partitionManager.getRangeSet(srcId, SimpleEMTask.KEY); final long numToMove = getNumUnits(srcRangeSet) / 2; LOG.info("Move partitions of total size " + numToMove + " from " + srcId + " to " + destId); final Set<LongRange> rangeSetToMove = getRangeSetToMove(srcId, destId, srcRangeSet, numToMove); for (final LongRange range : rangeSetToMove) { LOG.info("- " + range + ", size: " + (range.getMaximumLong() - range.getMinimumLong() + 1)); } final TraceScope moveTraceScope = Trace.startSpan("simpleMove", Sampler.ALWAYS); try { emService.move(SimpleEMTask.KEY, rangeSetToMove, srcId, destId); } finally { moveTraceScope.close(); } final String tmpContextId = srcId; srcId = destId; destId = tmpContextId; if (i != (iterations - 1)) { try { Thread.sleep(periodMillis); } catch (InterruptedException e) { throw new RuntimeException(e); } } } }
Source:
<code>public Optional<ImmutableZkWorker> findWorkerForTask( final ImmutableMap<String, ImmutableZkWorker> zkWorkers, final Task task ) { TreeSet<ImmutableZkWorker> sortedWorkers = Sets.newTreeSet( new Comparator<ImmutableZkWorker>() { @Override public int compare( ImmutableZkWorker zkWorker, ImmutableZkWorker zkWorker2 ) { int retVal = Ints.compare(zkWorker2.getCurrCapacityUsed(), zkWorker.getCurrCapacityUsed()); if (retVal == 0) { retVal = zkWorker.getWorker().getHost().compareTo(zkWorker2.getWorker().getHost()); } return retVal; } } ); sortedWorkers.addAll(zkWorkers.values()); final String minWorkerVer = config.getMinWorkerVersion(); for (ImmutableZkWorker zkWorker : sortedWorkers) { if (zkWorker.canRunTask(task) && zkWorker.isValidVersion(minWorkerVer)) { return Optional.of(zkWorker); } } <START> log.debug("Worker nodes %s do not have capacity to run any more tasks!", zkWorkers.values()); <END> return Optional.absent(); }</code><technical_language>Move this RTR, works for strategies</technical_language>

Target:
public Optional<ImmutableZkWorker> findWorkerForTask( final ImmutableMap<String, ImmutableZkWorker> zkWorkers, final Task task ) { TreeSet<ImmutableZkWorker> sortedWorkers = Sets.newTreeSet( new Comparator<ImmutableZkWorker>() { @Override public int compare( ImmutableZkWorker zkWorker, ImmutableZkWorker zkWorker2 ) { int retVal = Ints.compare(zkWorker2.getCurrCapacityUsed(), zkWorker.getCurrCapacityUsed()); if (retVal == 0) { retVal = zkWorker.getWorker().getHost().compareTo(zkWorker2.getWorker().getHost()); } return retVal; } } ); sortedWorkers.addAll(zkWorkers.values()); final String minWorkerVer = config.getMinWorkerVersion(); for (ImmutableZkWorker zkWorker : sortedWorkers) { if (zkWorker.canRunTask(task) && zkWorker.isValidVersion(minWorkerVer)) { return Optional.of(zkWorker); } } return Optional.absent(); }
Source:
<code>public void submitProductiveSheet(int centerId, ProductiveCollectionSheetPayload payload) { checkViewAttached(); getMvpView().showProgressbar(true); mSubscription.add(collectionDataManager.submitProductiveSheet(centerId, payload) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Subscriber<GenericResponse>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { getMvpView().showProgressbar(false); try { <START> if (e instanceof HttpException) { <END> String errorMessage = ((HttpException) e).response().errorBody() .string(); if (((HttpException) e).code() == 500) { getMvpView().showError(errorMessage); } else { getMvpView().showError(MFErrorParser.parseError(errorMessage) .getErrors().get(0).getDefaultUserMessage()); } } } catch (Throwable throwable) { RxJavaPlugins.getInstance().getErrorHandler().handleError(e); } } @Override public void onNext(GenericResponse response) { getMvpView().showProgressbar(false); getMvpView().showError(c.getResources().getString( R.string.collectionsheet_submit_success)); } })); }</code><technical_language>this utils method show error <LINK_0></technical_language>

Target:
public void submitProductiveSheet(int centerId, ProductiveCollectionSheetPayload payload) { checkViewAttached(); getMvpView().showProgressbar(true); mSubscription.add(collectionDataManager.submitProductiveSheet(centerId, payload) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Subscriber<GenericResponse>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { getMvpView().showProgressbar(false); getMvpView().showError(MFErrorParser.errorMessage(e)); } @Override public void onNext(GenericResponse genericResponse) { getMvpView().showProgressbar(false); getMvpView().showError(c.getResources().getString( R.string.collectionsheet_submit_success)); } })); }
Source:
<code>protected List querySelector(CSSRuleList ruleList, int selectorType, int selectorConditionType) { List list = new ArrayList(); int length = ruleList.getLength(); for (int i = 0; i < length; i++) { CSSRule rule = ruleList.item(i); if (rule.getType() == CSSRule.STYLE_RULE && rule instanceof ExtendedCSSRule) { ExtendedCSSRule r = (ExtendedCSSRule) rule; SelectorList selectorList = r.getSelectorList(); int l = selectorList.getLength(); for (int j = 0; j < l; j++) { Selector selector = (Selector) selectorList.item(j); <START> if (selector.getSelectorType() == selectorType && selectorType == Selector.SAC_CONDITIONAL_SELECTOR) { <END> ConditionalSelector conditionalSelector = (ConditionalSelector) selector; short conditionType = conditionalSelector.getCondition().getConditionType(); if (selectorConditionType == conditionType) { list.add(selector); } } } } } return list; }</code><technical_language>this transitively thing</technical_language>

Target:
protected List<Selector> querySelector(CSSRuleList ruleList, int selectorType, int selectorConditionType) { List<Selector> list = new ArrayList<Selector>(); if (selectorType == Selector.SAC_CONDITIONAL_SELECTOR) { int length = ruleList.getLength(); for (int i = 0; i < length; i++) { CSSRule rule = ruleList.item(i); if (rule.getType() == CSSRule.STYLE_RULE && rule instanceof ExtendedCSSRule) { ExtendedCSSRule r = (ExtendedCSSRule) rule; SelectorList selectorList = r.getSelectorList(); int l = selectorList.getLength(); for (int j = 0; j < l; j++) { Selector selector = (Selector) selectorList.item(j); if (selector.getSelectorType() == selectorType) { ConditionalSelector conditionalSelector = (ConditionalSelector) selector; short conditionType = conditionalSelector.getCondition().getConditionType(); if (selectorConditionType == conditionType) { list.add(selector); } } } } } } return list; }
Source:
<code>private void processContainer(ContainerID id) { lockManager.lock(id); try { final ContainerInfo container = containerManager.getContainer(id); final Set<ContainerReplica> replicas = containerManager .getContainerReplicas(container.containerID()); final LifeCycleState state = container.getState(); if (state == LifeCycleState.OPEN) { return; } if (state == LifeCycleState.CLOSING) { replicas.forEach(replica -> sendCloseCommand( container, replica.getDatanodeDetails(), false)); return; } updateInflightAction(container, inflightReplication, action -> replicas.stream() .anyMatch(r -> r.getDatanodeDetails().equals(action.datanode))); updateInflightAction(container, inflightDeletion, action -> replicas.stream() .noneMatch(r -> r.getDatanodeDetails().equals(action.datanode))); <START> if (state == LifeCycleState.QUASI_CLOSED) { <END> forceCloseContainer(container, replicas); } if (isContainerHealthy(container, replicas)) { return; } if (isContainerUnderReplicated(container, replicas)) { handleUnderReplicatedContainer(container, replicas); return; } if (isContainerOverReplicated(container, replicas)) { handleOverReplicatedContainer(container, replicas); return; } handleInconsistentContainer(container, replicas); } catch (ContainerNotFoundException ex) { LOG.warn("Missing container {}.", id); } finally { lockManager.unlock(id); } }</code><technical_language>handled handleInconsistentContainer method</technical_language>

Target:
private void processContainer(ContainerID id) { lockManager.lock(id); try { final ContainerInfo container = containerManager.getContainer(id); final Set<ContainerReplica> replicas = containerManager .getContainerReplicas(container.containerID()); final LifeCycleState state = container.getState(); if (state == LifeCycleState.OPEN) { return; } if (state == LifeCycleState.CLOSING) { replicas.forEach(replica -> sendCloseCommand( container, replica.getDatanodeDetails(), false)); return; } if (state == LifeCycleState.QUASI_CLOSED && canForceCloseContainer(container, replicas)) { forceCloseContainer(container, replicas); return; } updateInflightAction(container, inflightReplication, action -> replicas.stream() .anyMatch(r -> r.getDatanodeDetails().equals(action.datanode))); updateInflightAction(container, inflightDeletion, action -> replicas.stream() .noneMatch(r -> r.getDatanodeDetails().equals(action.datanode))); if (isContainerHealthy(container, replicas)) { return; } if (isContainerUnderReplicated(container, replicas)) { handleUnderReplicatedContainer(container, replicas); return; } if (isContainerOverReplicated(container, replicas)) { handleOverReplicatedContainer(container, replicas); return; } handleUnstableContainer(container, replicas); } catch (ContainerNotFoundException ex) { LOG.warn("Missing container {}.", id); } finally { lockManager.unlock(id); } }
Source:
<code>public static void setConversionProperties(Configuration conf) { if (conf != null) { useEnumId = conf.getBoolean(USE_ENUM_ID_CONF_KEY, false); <START> LOG.info("useEnumId is set to " + useEnumId); <END> } }</code><technical_language>this a debug log? easy if this config affect. Pig creates multiple of loaders lots of in log</technical_language>

Target:
public static void setConversionProperties(Configuration conf) { if (conf != null) { useEnumId = conf.getBoolean(USE_ENUM_ID_CONF_KEY, false); LOG.debug("useEnumId is set to " + useEnumId); } }
Source:
<code>public Dataset getDataset(String datasetID) throws IOException { <START> String path = "/datasets/" + datasetID; <END> logInfo("Calling dataset API").addParameter("path", path).log(); try (CloseableHttpResponse response = client.sendGet(path, null, null)) { String responseString = EntityUtils.toString(response.getEntity()); return ContentUtil.deserialise(responseString, Dataset.class); } }</code><technical_language>Check datasetID is empty null</technical_language>

Target:
public Dataset getDataset(String datasetID) throws IOException, DatasetNotFoundException, UnexpectedResponseException, BadRequestException { if (StringUtils.isEmpty(datasetID)) { throw new BadRequestException("A dataset ID must be provided."); } String path = "/datasets/" + datasetID; logInfo("Calling dataset API").addParameter("path", path).log(); HttpGet httpget = new HttpGet(datasetAPIURL + path); try (CloseableHttpResponse response = client.execute(httpget)) { switch (response.getStatusLine().getStatusCode()) { case HttpStatus.SC_OK: String responseString = EntityUtils.toString(response.getEntity()); return ContentUtil.deserialise(responseString, Dataset.class); case HttpStatus.SC_NOT_FOUND: throw new DatasetNotFoundException("The dataset API returned 404 for " + path); default: throw new UnexpectedResponseException( String.format("The dataset API returned a %s response for %s", response.getStatusLine().getStatusCode(), path)); } } }
Source:
<code>static Point[] getFillStartPoints(Point[] cellSelection) { final Map<Integer, Set<Integer>> rowToSelectedColumns = createSelectionMap(cellSelection); final Point[] result = new Point[rowToSelectedColumns.size()]; int startColumn = -1; final Set<Integer> columns = rowToSelectedColumns.values().iterator().next(); <START> for (final Integer integer : columns) { <END> if (startColumn == -1) { startColumn = integer; continue; } if (integer < startColumn) { startColumn = integer; } } int i = 0; for (final Integer startRow : rowToSelectedColumns.keySet()) { result[i++] = new Point(startColumn, startRow); } return result; }</code><technical_language>Collections.min here</technical_language>

Target:
static Point[] getFillStartPoints(Point[] cellSelection) { final Map<Integer, Set<Integer>> rowToSelectedColumns = createSelectionMap(cellSelection); final Point[] result = new Point[rowToSelectedColumns.size()]; final Set<Integer> columns = rowToSelectedColumns.values().iterator().next(); final int startColumn = Collections.min(columns); int i = 0; for (final Integer startRow : rowToSelectedColumns.keySet()) { result[i++] = new Point(startColumn, startRow); } return result; }
Source:
<code><START> public OauthGrantAuthenticationResult authenticate(RefreshGrantRequest refreshGrantRequest) { <END> RefreshGrantAuthenticator authenticator = RefreshGrantAuthenticators.forApplication(this, getDataStore()); return authenticator.authenticate(refreshGrantRequest); }</code><technical_language>please assert refreshGrantRequest is null</technical_language>

Target:
public OauthGrantAuthenticationResult authenticate(RefreshGrantRequest refreshGrantRequest) { Assert.notNull(refreshGrantRequest, "refreshGrantRequest is required and cannot be null."); RefreshGrantAuthenticator authenticator = RefreshGrantAuthenticators.forApplication(this, getDataStore()); return authenticator.authenticate(refreshGrantRequest); }
Source:
<code>private void addReward(Block block) { BigInteger totalBlockReward = BLOCK_REWARD; if (block.getUncleList().size() > 0) { for (BlockHeader uncle : block.getUncleList()) { track.addBalance(uncle.getCoinbase(), <START> new BigDecimal(BLOCK_REWARD).multiply(BigDecimal.valueOf(8 + uncle.getNumber() - block.getNumber()).divide(new BigDecimal(8), RoundingMode.HALF_UP)).toBigInteger()); <END> totalBlockReward = totalBlockReward.add(INCLUSION_REWARD); } } track.addBalance(block.getCoinbase(), totalBlockReward); }</code><technical_language>Alex, please change this BigInteger calculation. is place for decimal. Thanks BLOCK_REWARD, else get a conflict here. of integer div</technical_language>

Target:
private void addReward(Block block) { BigInteger standardTotalBlockReward = BLOCK_REWARD; if (block.getUncleList().size() > 0) { for (BlockHeader uncle : block.getUncleList()) { track.addBalance( uncle.getCoinbase(), BLOCK_REWARD.multiply(BigInteger.valueOf(MAGIC_REWARD_OFFSET + uncle.getNumber() - block.getNumber())).divide(BigInteger.valueOf(MAGIC_REWARD_OFFSET)) ); standardTotalBlockReward = standardTotalBlockReward.add(INCLUSION_REWARD); } } track.addBalance(block.getCoinbase(), standardTotalBlockReward); }