auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Subscriber<? super T> call(final Subscriber<? super T> child) { final Subscriber<T> parent = new Subscriber<T>() { int count = 0; boolean completed = false; @Override public void onCompleted() { if (!completed) { child.onCompleted(); } } @Override public void onError(Throwable e) { if (!completed) { child.onError(e); } } @Override public void onNext(T i) { if (!isUnsubscribed()) { if (++count >= limit) { completed = true; } child.onNext(i); if (completed) { child.onCompleted(); unsubscribe(); } } } @Override public void setProducer(final Producer producer) { child.setProducer(new Producer() { final AtomicLong requested = new AtomicLong(0); @Override public void request(long n) { if (n >0 && !completed) { while (true) { long r = requested.get(); <START> long c = Math.min(n, limit - requested.get()); <END> if (requested.compareAndSet(r, r + c)) { producer.request(c); break; } } } } }); } }; if (limit == 0) { child.onCompleted(); parent.unsubscribe(); } child.add(parent); return parent; }</code><technical_language>Re-read of a volatile value, need limit - r</technical_language>

Target:
public Subscriber<? super T> call(final Subscriber<? super T> child) { final Subscriber<T> parent = new Subscriber<T>() { int count = 0; boolean completed = false; @Override public void onCompleted() { if (!completed) { child.onCompleted(); } } @Override public void onError(Throwable e) { if (!completed) { child.onError(e); } } @Override public void onNext(T i) { if (!isUnsubscribed()) { if (++count >= limit) { completed = true; } child.onNext(i); if (completed) { child.onCompleted(); unsubscribe(); } } } @Override public void setProducer(final Producer producer) { child.setProducer(new Producer() { final AtomicLong requested = new AtomicLong(0); @Override public void request(long n) { if (n >0 && !completed) { while (true) { long r = requested.get(); long c = Math.min(n, limit - r); if (c == 0) break; else if (requested.compareAndSet(r, r + c)) { producer.request(c); break; } } } } }); } }; if (limit == 0) { child.onCompleted(); parent.unsubscribe(); } child.add(parent); return parent; }
Source:
<code>public void prepareRun(BatchJoinerContext context) { if (conf.getNumPartitions() != null) { context.setNumPartitions(conf.getNumPartitions()); } FailureCollector collector = context.getFailureCollector(); Map<String, Schema> inputSchemas = context.getInputSchemas(); <START> if (!inputSchemas.isEmpty()) { <END> init(inputSchemas, collector); collector.getOrThrowException(); Collection<OutputFieldInfo> outputFieldInfos = createOutputFieldInfos(inputSchemas, collector); collector.getOrThrowException(); context.record(createFieldOperations(outputFieldInfos, perStageJoinKeys)); } }</code><technical_language>nit: more readable in situations do: if (inputSchemas.isEmpty()) { return; } // rest of logic difference here, is more true if logic block is longer</technical_language>

Target:
public void prepareRun(BatchJoinerContext context) { if (conf.getNumPartitions() != null) { context.setNumPartitions(conf.getNumPartitions()); } FailureCollector collector = context.getFailureCollector(); Map<String, Schema> inputSchemas = context.getInputSchemas(); if (!conf.inputSchemasAvailable(inputSchemas)) { return; } init(inputSchemas, collector); collector.getOrThrowException(); Collection<OutputFieldInfo> outputFieldInfos = createOutputFieldInfos(inputSchemas, collector); collector.getOrThrowException(); context.record(createFieldOperations(outputFieldInfos, perStageJoinKeys)); }
Source:
<code>public void setUp() throws Throwable { server = createServer(); server.init(); <START> assertFalse( canConnect( server.address(), clientGroup ) ); <END> }</code><technical_language>canConnect( server.address(), clientGroup ) extracted a no-params method</technical_language>

Target:
public void setUp() throws Throwable { server = createServer(); server.init(); assertFalse( canConnect() ); }
Source:
<code>public void handleChildChange(String parentPath, List<String> currentChildren) { <START> if (skip("ZkBarrierChangeHandler")) { <END> return; } if (currentChildren == null) { LOG.info("Got ZkBarrierChangeHandler handleChildChange with null currentChildren"); return; } LOG.info("list of children in the barrier = " + parentPath + ":" + Arrays.toString(currentChildren.toArray())); LOG.info("list of children to compare against = " + parentPath + ":" + Arrays.toString(names.toArray())); if (currentChildren.size() == names.size() && CollectionUtils.containsAll(currentChildren, names)) { String barrierDonePath = keyBuilder.getBarrierStatePath(barrierVersion); LOG.info("Writing BARRIER DONE to " + barrierDonePath); zkUtils.writeData(barrierDonePath, State.DONE); zkUtils.unsubscribeChildChanges(barrierDonePath, this); } }</code><technical_language>Please log debug level skipping this event</technical_language>

Target:
public void handleChildChange(String parentPath, List<String> currentChildren) { if (notAValidEvent()) { return; } if (currentChildren == null) { LOG.info("Got ZkBarrierChangeHandler handleChildChange with null currentChildren"); return; } LOG.info("list of children in the barrier = " + parentPath + ":" + Arrays.toString(currentChildren.toArray())); LOG.info("list of children to compare against = " + parentPath + ":" + Arrays.toString(names.toArray())); if (currentChildren.size() == names.size() && CollectionUtils.containsAll(currentChildren, names)) { String barrierDonePath = keyBuilder.getBarrierStatePath(barrierVersion); LOG.info("Writing BARRIER DONE to " + barrierDonePath); zkUtils.writeData(barrierDonePath, State.DONE); zkUtils.unsubscribeChildChanges(barrierDonePath, this); } }
Source:
<code>private static SSLFactory getSSLFactoryIfRequired(VerifiableProperties verifiableProperties) <START> throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, <END> IllegalAccessException { boolean sslRequired = new NettyConfig(verifiableProperties).nettyServerEnableSSL || new ClusterMapConfig(verifiableProperties).clusterMapSslEnabledDatacenters.length() > 0; return sslRequired? SSLFactory.getNewInstance(new SSLConfig(verifiableProperties)) : null; }</code><technical_language>throws Exception</technical_language>

Target:
private static SSLFactory getSSLFactoryIfRequired(VerifiableProperties verifiableProperties) throws Exception { boolean sslRequired = new NettyConfig(verifiableProperties).nettyServerEnableSSL || new ClusterMapConfig(verifiableProperties).clusterMapSslEnabledDatacenters.length() > 0; return sslRequired ? SSLFactory.getNewInstance(new SSLConfig(verifiableProperties)) : null; }
Source:
<code>public void run() { StreamBuildListener listener; try { listener = new StreamBuildListener(new FileOutputStream(getLogFile()), Charsets.UTF_8); } catch (IOException x) { LOGGER.log(Level.WARNING, null, x); result = Result.FAILURE; return; } timestamp = System.currentTimeMillis(); listener.started(getCauses()); Result _result = Result.NOT_BUILT; try { folder.updateChildren(listener); _result = Result.SUCCESS; } catch (InterruptedException x) { listener.getLogger().println("Aborted"); _result = Result.ABORTED; } catch (Exception x) { String message = "Failed to recompute children of " + folder.getFullDisplayName(); if (x instanceof AbortException) { <START> listener.fatalError(message + ": " + x.getMessage()); <END> } else { x.printStackTrace(listener.fatalError(message)); } _result = Result.FAILURE; } finally { duration = System.currentTimeMillis() - timestamp; if (durations == null) { durations = new ArrayList<Long>(); } while (durations.size() > 32) { durations.remove(0); } durations.add(duration); listener.finished(_result); listener.closeQuietly(); result = _result; try { save(); } catch (IOException x) { LOGGER.log(Level.WARNING, null, x); } } }</code><technical_language>@jglick In this **forcing** message _Failed recompute children of_. I prefer that: listener.fatalError("%n" + x.getMessage() + "%n%n");</technical_language>

Target:
public void run() { StreamBuildListener listener; try { listener = new StreamBuildListener(new FileOutputStream(getLogFile()), Charsets.UTF_8); } catch (IOException x) { LOGGER.log(Level.WARNING, null, x); result = Result.FAILURE; return; } timestamp = System.currentTimeMillis(); listener.started(getCauses()); Result _result = Result.NOT_BUILT; try { folder.updateChildren(listener); _result = Result.SUCCESS; } catch (InterruptedException x) { LOGGER.log(Level.FINE, "recomputation of " + folder.getFullName() + " was aborted", x); listener.getLogger().println("Aborted"); _result = Result.ABORTED; } catch (Exception x) { LOGGER.log(Level.FINE, "recomputation of " + folder.getFullName() + " failed", x); if (x instanceof AbortException) { listener.fatalError(x.getMessage()); } else { x.printStackTrace(listener.fatalError("Failed to recompute children of " + folder.getFullDisplayName())); } _result = Result.FAILURE; } finally { duration = System.currentTimeMillis() - timestamp; if (durations == null) { durations = new ArrayList<Long>(); } while (durations.size() > 32) { durations.remove(0); } durations.add(duration); listener.finished(_result); listener.closeQuietly(); result = _result; try { save(); } catch (IOException x) { LOGGER.log(Level.WARNING, null, x); } } }
Source:
<code>protected abstract long getCurrentValue() throws IOException; protected abstract boolean atomicIncrement(long nextValue) throws IOException; public abstract void close() throws IOException; private void allocateBlock(boolean peek) throws StandardException{ boolean success=false; long absIncrement = incrementSteps < 0 ? -incrementSteps : incrementSteps; long blockBoundary = incrementSteps < 0 ? -blockAllocationSize : blockAllocationSize; <START> while(!success){ <END> updateLock.lock(); try{ if(remaining.getAndDecrement()>0) return; currPosition.set(getCurrentValue()); long remainingCount = blockAllocationSize/absIncrement; success=atomicIncrement(currPosition.get()+ (absIncrement>blockAllocationSize?incrementSteps: incrementSteps*remainingCount)); if(success){ long v = remainingCount; remaining.set(peek?v:v-1); } }catch(IOException e){ throw Exceptions.parseException(e); }finally{ updateLock.unlock(); } } }</code><technical_language>minor issue: blockBoundary is</technical_language>

Target:
protected abstract long getCurrentValue() throws IOException; protected abstract boolean atomicIncrement(long nextValue) throws IOException; public abstract void close() throws IOException; private void allocateBlock(boolean peek) throws StandardException{ boolean success=false; long absIncrement = incrementSteps < 0 ? -incrementSteps : incrementSteps; while(!success){ updateLock.lock(); try{ if(remaining.getAndDecrement()>0) return; currPosition.set(getCurrentValue()); long remainingCount = blockAllocationSize/absIncrement; success=atomicIncrement(currPosition.get()+ (absIncrement>blockAllocationSize?incrementSteps: incrementSteps*remainingCount)); if(success){ long v = remainingCount; remaining.set(peek?v:v-1); } }catch(IOException e){ throw Exceptions.parseException(e); }finally{ updateLock.unlock(); } } }
Source:
<code>public Tuple next() throws IOException { if (finished) { return null; } while (!context.isStopped()) { Tuple tuple = child.next(); if (tuple == null) { finished = true; if (prevTuple == null) { return null; } if (prevSeq == 0 && nonDistinctAggrFunctions != null) { terminatedNonDistinctAggr(prevTuple); } outTuple.put(prevTuple.getValues()); return outTuple; } int distinctSeq = tuple.getInt2(0); Tuple keyTuple = getKeyTuple(distinctSeq, tuple); if (prevKeyTuple == null) { if (distinctSeq == 0 && nonDistinctAggrFunctions != null) { initNonDistinctAggrContext(); mergeNonDistinctAggr(tuple); } prevKeyTuple = getKeyTuple(prevKeyTupleMap, keyTuple.getValues()); prevTuple = new VTuple(tuple.getValues()); prevSeq = distinctSeq; continue; } if (!prevKeyTuple.equals(keyTuple)) { if (prevSeq == 0 && nonDistinctAggrFunctions != null) { terminatedNonDistinctAggr(prevTuple); } outTuple.put(prevTuple.getValues()); prevKeyTuple = getKeyTuple(prevKeyTupleMap, keyTuple.getValues()); prevTuple.put(tuple.getValues()); <START> prevTuple.put(tuple.getValues()); <END> prevSeq = distinctSeq; if (distinctSeq == 0 && nonDistinctAggrFunctions != null) { initNonDistinctAggrContext(); mergeNonDistinctAggr(tuple); } return outTuple; } else { prevKeyTuple = getKeyTuple(prevKeyTupleMap, keyTuple.getValues()); prevTuple.put(tuple.getValues()); prevSeq = distinctSeq; if (distinctSeq == 0 && nonDistinctAggrFunctions != null) { mergeNonDistinctAggr(tuple); } } } return null; }</code><technical_language>codes again</technical_language>

Target:
public Tuple next() throws IOException { if (finished) { return null; } while (!context.isStopped()) { Tuple tuple = child.next(); if (tuple == null) { finished = true; if (prevTuple == null) { return null; } if (prevSeq == 0 && nonDistinctAggrFunctions != null) { terminatedNonDistinctAggr(prevTuple); } outTuple.put(prevTuple.getValues()); return outTuple; } int distinctSeq = tuple.getInt2(0); Tuple keyTuple = getKeyTuple(distinctSeq, tuple); if (prevKeyTuple == null) { if (distinctSeq == 0 && nonDistinctAggrFunctions != null) { initNonDistinctAggrContext(); mergeNonDistinctAggr(tuple); } prevKeyTuple = getKeyTuple(prevKeyTupleMap, keyTuple.getValues()); prevTuple = new VTuple(tuple.getValues()); prevSeq = distinctSeq; continue; } if (!prevKeyTuple.equals(keyTuple)) { if (prevSeq == 0 && nonDistinctAggrFunctions != null) { terminatedNonDistinctAggr(prevTuple); } outTuple.put(prevTuple.getValues()); prevKeyTuple = getKeyTuple(prevKeyTupleMap, keyTuple.getValues()); prevTuple.put(tuple.getValues()); prevSeq = distinctSeq; if (distinctSeq == 0 && nonDistinctAggrFunctions != null) { initNonDistinctAggrContext(); mergeNonDistinctAggr(tuple); } return outTuple; } else { prevKeyTuple = getKeyTuple(prevKeyTupleMap, keyTuple.getValues()); prevTuple.put(tuple.getValues()); prevSeq = distinctSeq; if (distinctSeq == 0 && nonDistinctAggrFunctions != null) { mergeNonDistinctAggr(tuple); } } } return null; }
Source:
<code>private void handleFinalizingCleanup(final StateContext context) { log.info("Cleaning up after cancelled transfer. {}", getTransferDescription()); <START> stopImageTransferSession(context.entity); if (!Guid.isNullOrEmpty(getParameters().getImageGroupID())) { setImageStatus(getParameters().getTransferType() == TransferType.Upload ? ImageStatus.ILLEGAL : ImageStatus.OK); } Guid vdsId = context.entity.getVdsId() != null ? context.entity.getVdsId() : getVdsId(); tearDownImage(vdsId, context.entity.getImagedTicketId(), context.entity.getBackupId()); <END> updateEntityPhase(ImageTransferPhase.FINISHED_CLEANUP); setAuditLogTypeFromPhase(ImageTransferPhase.FINISHED_CLEANUP); }</code><technical_language>This is a duplication of lines 823-833, extract a method prevent this dup</technical_language>

Target:
private void handleFinalizingCleanup(final StateContext context) { cleanup(context, false); }
Source:
<code>protected void selectExternalProvider() { final Network network = getNetwork(); if (network.isExternal()) { getExternalProviders().setSelectedItem(Linq.firstOrDefault((Iterable<Provider>) getExternalProviders().getItems(), new Linq.IPredicate<Provider>() { <START> @Override <END> public boolean match(Provider provider) { return provider.getId().equals(network.getProvidedBy().getProviderId()); } })); } }</code><technical_language>I nicer predicate in Linq for re-use... I.e. add ProviderPredicate Linq class</technical_language>

Target:
protected void selectExternalProvider() { final Network network = getNetwork(); getExternalProviders().setSelectedItem(Linq.firstOrDefault((Iterable<Provider>) getExternalProviders().getItems(), new Linq.NetworkSameProviderPredicate(network))); }
Source:
<code>public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack) { <START> } <END></code><technical_language>Add java player.addStat(StatList.getBlockStats(this)); player.addExhaustion(0.005F); lines in parent classes method want</technical_language>

Target:
public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack) { player.addStat(StatList.getBlockStats(this)); player.addExhaustion(0.005F); }
Source:
<code>private void validateTag(Annotation webAnnotation) throws ParamValidationException, PropertyValidationException { Body body = webAnnotation.getBody(); if (body.getType() != null && body.getType().contains(WebAnnotationFields.SPECIFIC_RESOURCE)) { validateTagWithSpecificResource(body); <START> } else if (body.getType() != null && body.getType().contains(WebAnnotationFields.FULL_TEXT_RESOURCE)) { <END> validateTagWithFullTextResource(body); } else if (BodyInternalTypes.isSemanticTagBody(body.getInternalType())) { validateSemanticTagUrl(body); } else if (BodyInternalTypes.isAgentBodyTag(body.getInternalType())) { validateAgentBody(body); } else if (BodyInternalTypes.isGeoTagBody(body.getInternalType())) { validateGeoTag(body); } else if (BodyInternalTypes.isVcardAddressTagBody(body.getInternalType())) { validateVcardAddressBody(body); } else { validateTagWithValue(body); } }</code><technical_language>a usecase, allowed fulltext resources motivation is tagging. Please remove</technical_language>

Target:
private void validateTag(Annotation webAnnotation) throws ParamValidationException, PropertyValidationException { Body body = webAnnotation.getBody(); if (body.getType() != null && body.getType().contains(WebAnnotationFields.SPECIFIC_RESOURCE)) { validateTagWithSpecificResource(body); } else if (BodyInternalTypes.isSemanticTagBody(body.getInternalType())) { validateSemanticTagUrl(body); } else if (BodyInternalTypes.isAgentBodyTag(body.getInternalType())) { validateAgentBody(body); } else if (BodyInternalTypes.isGeoTagBody(body.getInternalType())) { validateGeoTag(body); } else if (BodyInternalTypes.isVcardAddressTagBody(body.getInternalType())) { validateVcardAddressBody(body); } else { validateTagWithValue(body); } }
Source:
<code>public void sendRequest(final ITmfEventRequest request) { synchronized (fLock) { if (TmfCoreTracer.isRequestTraced()) { TmfCoreTracer.traceRequest(request.getRequestId(), "SENT to provider " + getName()); } if (request.getProviderFilter() == null) { request.setProviderFilter(this); } if (sendWithParent(request)) { return; } if (request.getExecType() == ExecutionType.FOREGROUND) { if ((fSignalDepth > 0) || (fRequestPendingCounter > 0)) { coalesceEventRequest(request); } else { queueRequest(request); } return; } <START> if ((fTimer == null)) { <END> queueRequest(request); return; } coalesceEventRequest(request); if (fIsTimerEnabled) { fCurrentTask.cancel(); fCurrentTask = new TimerTask() { @Override public void run() { synchronized (fLock) { fireRequest(true); } } }; fTimer.schedule(fCurrentTask, DELAY); } } }</code><technical_language>extra ()</technical_language>

Target:
public void sendRequest(final ITmfEventRequest request) { synchronized (fLock) { if (TmfCoreTracer.isRequestTraced()) { TmfCoreTracer.traceRequest(request.getRequestId(), "SENT to provider " + getName()); } if (request.getProviderFilter() == null) { request.setProviderFilter(this); } if (sendWithParent(request)) { return; } if (request.getExecType() == ExecutionType.FOREGROUND) { if ((fSignalDepth > 0) || (fRequestPendingCounter > 0)) { coalesceEventRequest(request); } else { queueRequest(request); } return; } if (fTimer == null) { queueRequest(request); return; } coalesceEventRequest(request); if (fIsTimerEnabled) { fCurrentTask.cancel(); fCurrentTask = new TimerTask() { @Override public void run() { synchronized (fLock) { fireRequest(true); } } }; fTimer.schedule(fCurrentTask, DELAY); } } }
Source:
<code>public void testRootOfElementNode() throws Exception { final String xpath = " final List<Item> nodes = getXpathItems(xpath, rootNode); assertEquals("Invalid number of nodes", 1, nodes.size()); final AbstractNode root = (AbstractNode) ((NodeInfo) nodes.get(0)).getRoot(); <START> assertEquals("Invalid number of nodes", TokenTypes.EOF, root.getTokenType()); <END> assertTrue("Should return true, because selected node is RootNode", root instanceof RootNode); }</code><technical_language>invalid token type</technical_language>

Target:
public void testRootOfElementNode() throws Exception { final String xpath = " final List<Item> nodes = getXpathItems(xpath, rootNode); assertEquals("Invalid number of nodes", 1, nodes.size()); final AbstractNode root = (AbstractNode) ((NodeInfo) nodes.get(0)).getRoot(); assertEquals("Invalid token type", TokenTypes.EOF, root.getTokenType()); assertTrue("Should return true, because selected node is RootNode", root instanceof RootNode); }
Source:
<code>public void readBatch( int total, ColumnVector column, TypeInfo columnType) throws IOException { StructColumnVector structColumnVector = (StructColumnVector) column; StructTypeInfo structTypeInfo = (StructTypeInfo) columnType; ColumnVector[] vectors = structColumnVector.fields; for (int i = 0; i < vectors.length; i++) { fieldReaders.get(i) .readBatch(total, vectors[i], structTypeInfo.getAllStructFieldTypeInfos().get(i)); structColumnVector.isRepeating = structColumnVector.isRepeating && vectors[i].isRepeating; for (int j = 0; j < vectors[i].isNull.length; j++) { structColumnVector.isNull[j] = (i == 0) ? vectors[i].isNull[j] : structColumnVector.isNull[j] && vectors[i].isNull[j]; <START> structColumnVector.noNulls = (i == 0) ? structColumnVector.isNull[j] : <END> structColumnVector.noNulls && vectors[i].isNull[j]; } } }</code><technical_language>Hmm.. this needs in loop. do: structColumnVector.noNulls = (i == 0) ? vectors[i].noNulls : structColumnVector.noNulls && vectors[i].noNulls;</technical_language>

Target:
public void readBatch( int total, ColumnVector column, TypeInfo columnType) throws IOException { StructColumnVector structColumnVector = (StructColumnVector) column; StructTypeInfo structTypeInfo = (StructTypeInfo) columnType; ColumnVector[] vectors = structColumnVector.fields; for (int i = 0; i < vectors.length; i++) { fieldReaders.get(i) .readBatch(total, vectors[i], structTypeInfo.getAllStructFieldTypeInfos().get(i)); structColumnVector.isRepeating = structColumnVector.isRepeating && vectors[i].isRepeating; for (int j = 0; j < vectors[i].isNull.length; j++) { structColumnVector.isNull[j] = (i == 0) ? vectors[i].isNull[j] : structColumnVector.isNull[j] && vectors[i].isNull[j]; } structColumnVector.noNulls = (i == 0) ? vectors[i].noNulls : structColumnVector.noNulls && vectors[i].noNulls; } }
Source:
<code>protected Locale resolveLocale(Locale locale) { if (codeListTable.containsRow(locale)) { <START> if (logger.isDebugEnabled()) { <END> logger.debug("Found codelist for specified locale '{}'.", locale); } return locale; } String lang = locale.getLanguage(); if (StringUtils.hasLength(lang) && !lang.equals(locale.toString())) { Locale langOnlyLocale = new Locale(lang); if (codeListTable.containsRow(langOnlyLocale)) { if (logger.isDebugEnabled()) { logger.debug( "Found codelist for specified locale '{}' (language only).", locale); } return langOnlyLocale; } } if (logger.isDebugEnabled()) { logger.debug( "There is no codelist for specified locale '{}'. Use '{}' as fallback.", locale, fallbackTo); } return fallbackTo; }</code><technical_language>[x] required check isDebugEnabled, heavy function logging</technical_language>

Target:
protected Locale resolveLocale(Locale locale) { if (codeListTable.containsRow(locale)) { logger.debug("Found codelist for specified locale '{}'.", locale); return locale; } String lang = locale.getLanguage(); if (StringUtils.hasLength(lang) && !lang.equals(locale.toString())) { Locale langOnlyLocale = new Locale(lang); if (codeListTable.containsRow(langOnlyLocale)) { logger.debug( "Found codelist for specified locale '{}' (language only).", locale); return langOnlyLocale; } } logger.debug( "There is no codelist for specified locale '{}'. Use '{}' as fallback.", locale, fallbackTo); return fallbackTo; }
Source:
<code>public Object getDefaultValue() { <START> if (Boolean.class.isAssignableFrom(this.getType())) <END> { return false; } else return null; }</code><technical_language>want support "boolean.class"</technical_language>

Target:
public Object getDefaultValue() { if (Boolean.class.isAssignableFrom(this.getType()) || boolean.class.isAssignableFrom(this.getType()) ) { return false; } else return null; }
Source:
<code>private void pollNotifications(@NonNull final Context context) { if (!User.isLoggedIn() || <START> !lastDescriptionEditedWithin(R.integer.notification_poll_timeout_days)) { <END> return; } NotificationClient.instance().getNotifications(new Notification.Callback() { @Override public void success(@NonNull List<Notification> notifications) { if (notifications.isEmpty()) { return; } NotificationClient.instance().markRead(notifications); for (final Notification n : notifications) { if (isFromWikidata(n)) { EntityClient.instance().getLabelForLang(n.title().full(), WikipediaApp.getInstance().getWikiSite().languageCode(), new Entity.LabelCallback() { @Override public void success(@NonNull String label) { n.title().setFull(label); showNotification(context, n); } @Override public void failure(Throwable t) { L.e(t); } }); } else { showNotification(context, n); } } } @Override public void failure(Throwable t) { L.e(t); } }, EntityClient.WIKIDATA_WIKI); }</code><technical_language>Sorry, I missed this pass. Is work this timer interval itself? nice a day a network request x minutes launching app do nothing. alarm enabled if user logged in edited recently. benefit of this change code run for users needed instead of frequently for users</technical_language>

Target:
private void pollNotifications(@NonNull final Context context) { NotificationClient.instance().getNotifications(new NotificationClient.Callback() { @Override public void success(@NonNull List<Notification> notifications) { if (notifications.isEmpty()) { return; } NotificationClient.instance().markRead(notifications); for (final Notification n : notifications) { if (n.isFromWikidata()) { EntityClient.instance().getLabelForLang(n.title().full(), WikipediaApp.getInstance().getWikiSite().languageCode(), new EntityClient.LabelCallback() { @Override public void success(@NonNull String label) { n.title().setFull(label); NotificationPresenter.showNotification(context, n); } @Override public void failure(Throwable t) { L.e(t); } }); } else { NotificationPresenter.showNotification(context, n); } } } @Override public void failure(Throwable t) { L.e(t); } }, EntityClient.WIKIDATA_WIKI); }
Source:
<code>public void verifyVideoOoyalaEmbed() { WebElement container = videoEmbed.findElement(By.tagName("div")); String containerId = "ooyalaplayer-"; Assertion.assertStringContains(container.getAttribute("id"), containerId); WebElement object = container.findElement(By.tagName("object")); <START> Assertion.assertTrue( object.isDisplayed() ); <END> PageObjectLogging.log("verifyVideoOoyalaEmbed", "Ooyala video is embedded", true); }</code><technical_language>consider waitForElementVisibleByElement(element) for cases assertion is elment isDisplayed()</technical_language>

Target:
public void verifyVideoOoyalaEmbed() { WebElement container = videoEmbed.findElement(By.tagName("div")); String containerId = "ooyalaplayer-"; Assertion.assertStringContains(container.getAttribute("id"), containerId); waitForElementVisibleByElement(container.findElement(By.tagName("object"))); PageObjectLogging.log("verifyVideoOoyalaEmbed", "Ooyala video is embedded", true); }
Source:
<code>public void testTimeout() throws SystemException, RemoteException { <START> log.info("Method stateless #testTimeout called"); <END> Transaction txn; txn = tm.getTransaction(); TxTestUtil.enlistTestXAResource(txn); TxTestUtil.enlistTestXAResource(txn); try { TxTestUtil.waitForTimeout(tm); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new RemoteException("Interupted during waiting for transaction timeout", ie); } }</code><technical_language>log.trace if</technical_language>

Target:
public void testTimeout() throws SystemException, RemoteException { log.trace("Method stateless #testTimeout called"); Transaction txn; txn = tm.getTransaction(); TxTestUtil.enlistTestXAResource(txn); TxTestUtil.enlistTestXAResource(txn); try { TxTestUtil.waitForTimeout(tm); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new RemoteException("Interupted during waiting for transaction timeout", ie); } }
Source:
<code>public static void mkdir(final File d, boolean skipExisting) throws IOException { <START> if (skipExisting && d.exists() && d.isDirectory()) <END> return; if (!d.mkdir()) throw new IOException(MessageFormat.format( JGitText.get().mkDirFailed, d.getAbsolutePath())); }</code><technical_language>I put this failure path: if (!d.mkdir()) { if (skipExisting && d.isDirectory()) return; throw new IOException(...); } odds caller wants a new directory assume exist yet. If does, fail mkdir check mode, if a directory, fine, if not, fail</technical_language>

Target:
public static void mkdir(final File d, boolean skipExisting) throws IOException { if (!d.mkdir()) { if (skipExisting && d.isDirectory()) return; throw new IOException(MessageFormat.format( JGitText.get().mkDirFailed, d.getAbsolutePath())); } }
Source:
<code>public void run() { while (!terminate) { Job runningJob = null; try { runningJob = queue.take(); } catch (InterruptedException e) { <START> LOGGER.warn("FIFOScheduler is interrupted", e); <END> break; } runJobInScheduler(runningJob); } }</code><technical_language>name of scheduler needs corrected cut+paste. be: java LOGGER.warn("{} is interrupted", getClass().getSimpleName(), e);</technical_language>

Target:
public void run() { while (!terminate) { Job runningJob = null; try { runningJob = queue.take(); } catch (InterruptedException e) { LOGGER.warn("{} is interrupted", getClass().getSimpleName(), e); break; } runJobInScheduler(runningJob); } }
Source:
<code>public boolean hasNestedTargetReferences() { boolean found = false; Iterator<List<Mapping>> mapIterator = mappings.values().iterator(); <START> while ( mapIterator.hasNext() && !found ) { <END> Iterator<Mapping> listIterator = mapIterator.next().iterator(); while ( listIterator.hasNext() && !found ) { TargetReference targetReference = listIterator.next().getTargetReference(); found = targetReference.isValid() && targetReference.getPropertyEntries().size() > 1; } } return found; }</code><technical_language>2 for iterators in other methods</technical_language>

Target:
public boolean hasNestedTargetReferences() { for ( List<Mapping> mappingList : mappings.values() ) { for ( Mapping mapping : mappingList ) { TargetReference targetReference = mapping.getTargetReference(); if ( targetReference.isValid() && targetReference.getPropertyEntries().size() > 1 ) { return true; } } } return false; }
Source:
<code>public final Attribute getAttribute(String name) { if (StringUtils.isEmpty(name)) { return null; } if (Metacard.ID.equals(name)) { return this.id; } return attributes .stream() <START> .filter(attr -> !StringUtils.isEmpty(attr.getName())) <END> .filter(attr -> name.equals(attr.getName())) .findFirst() .orElse(null); }</code><technical_language>Need filter for null entries in attributes set: .filter(Objects::nonNull)</technical_language>

Target:
public final Attribute getAttribute(String name) { if (StringUtils.isEmpty(name)) { return null; } if (Metacard.ID.equals(name)) { return this.id; } return attributes .stream() .filter(Objects::nonNull) .filter(attr -> name.equals(attr.getName())) .findFirst() .orElse(null); }
Source:
<code>public ChangeLogSet<? extends Entry> parseRun(Run build, SCM scm, File changelogFile) throws IOException, SAXException { <START> if (build instanceof AbstractBuild && Util.isOverridden(ChangeLogParser.class, getClass(), "parse", AbstractBuild.class, SCM.class, File.class)) { <END> return parseRun((AbstractBuild) build, scm, changelogFile); } else { throw new AbstractMethodError("You must override the newer overload of parse"); } }</code><technical_language>Method renamed, AME needs adapting</technical_language>

Target:
public ChangeLogSet<? extends Entry> parseRun(Run build, SCM scm, File changelogFile) throws IOException, SAXException { if (build instanceof AbstractBuild && Util.isOverridden(ChangeLogParser.class, getClass(), "parse", AbstractBuild.class, SCM.class, File.class)) { return parse((AbstractBuild) build, scm, changelogFile); } else { throw new AbstractMethodError("You must override the newer overload of parseRun"); } }
Source:
<code>public void execute(final Talks talks) throws IOException { if (talks == null) { <START> return; <END> } int idx = this.index(talks); for (final Talk talk : talks.active()) { final XML xml = talk.read(); final List<XML> requestNodes = xml.nodes("/talk/request"); final int current = idx + 1; final String index = "index"; if (requestNodes.isEmpty()) { talk.modify(new Directives().xpath("/talk").addIf("request") .attr(index, Integer.toString(current)) .attr("id", this.generateRequestID()).add("type") .set(index).up().add("args") ); idx = current; } } }</code><technical_language>discourage multiple return points in methods</technical_language>

Target:
public void execute(final Talks talks) throws IOException { int idx = this.index(talks); for (final Talk talk : talks.active()) { idx += 1; talk.modify( new Directives() .xpath("/talk/request") .attr("index", Integer.toString(idx)) ); } }
Source:
<code>public static SelectorHandler getHandler(final String selectorStr) { <START> for (final Entry<String, SelectorHandler> handler : selectorHandlers.entrySet()) <END> if (selectorStr.startsWith(handler.getKey())) return handler.getValue(); return vanillaHandler; }</code><technical_language>This optimised. selectorHandlers.headMap(selectorStr, true).entrySet() trim range iterate over</technical_language>

Target:
public static SelectorHandler getHandler(final String selectorStr) { if (!selectorStr.isEmpty()) { for (final Entry<String, SelectorHandler> handler : selectorHandlers.subMap(selectorStr, true, selectorStr.substring(0, 1), true).entrySet()) { if (selectorStr.startsWith(handler.getKey())) { return handler.getValue(); } } } return vanillaHandler; }
Source:
<code>public OSProcessBuilder createForkedProcessBuilder(TaskContext context, File serializedContext, PrintStream outputSink, PrintStream errorSink, File workingDir) throws Exception { OSProcessBuilder processBuilder; String nativeScriptPath = context.getSchedulerHome(); ScriptResult forkEnvironmentScriptResult = null; <START> if (context.isRunAsUser()) { <END> shareWorkingDirWithRunAsMeUser(workingDir); processBuilder = ForkerUtils.getOSProcessBuilderFactory(nativeScriptPath).getBuilder( ForkerUtils.checkConfigAndGetUser(context.getDecrypter())); } else { processBuilder = ForkerUtils.getOSProcessBuilderFactory(nativeScriptPath).getBuilder(); } ForkEnvironment forkEnvironment = context.getInitializer().getForkEnvironment(); if (forkEnvironment != null) { if (forkEnvironment.getEnvScript() != null) { forkEnvironmentScriptResult = forkEnvironmentScriptExecutor .executeForkEnvironmentScript(context, outputSink, errorSink); } try { processBuilder.environment().putAll( taskContextVariableExtractor .extractVariablesThirdPartyCredentialsAndSystemEnvironmentVariables(context)); } catch (IllegalArgumentException processEnvironmentReadOnly) { throw new IllegalStateException( "Cannot use runAsMe mode and set system environment properties", processEnvironmentReadOnly); } } processBuilder .command() .addAll(forkedJvmTaskExecutionCommandCreator .createForkedJvmTaskExecutionCommand(context, forkEnvironmentScriptResult, serializedContext.getAbsolutePath() )); processBuilder = processBuilder.directory(workingDir); return processBuilder; }</code><technical_language>extract a private method here</technical_language>

Target:
public OSProcessBuilder createForkedProcessBuilder(TaskContext context, File serializedContext, PrintStream outputSink, PrintStream errorSink, File workingDir) throws Exception { String nativeScriptPath = context.getSchedulerHome(); OSProcessBuilder processBuilder = getOsProcessBuilder(context, workingDir, nativeScriptPath); ScriptResult forkEnvironmentScriptResult = executeForkEnvironmentScriptAndExtractVariables(context, outputSink, errorSink, processBuilder); processBuilder .command() .addAll(forkedJvmTaskExecutionCommandCreator .createForkedJvmTaskExecutionCommand(context, forkEnvironmentScriptResult, serializedContext.getAbsolutePath() )); processBuilder = processBuilder.directory(workingDir); return processBuilder; }
Source:
<code>void assertWithHamcrestMatcher() { <START> assertThat(2 + 1, is(equalTo(calculator.subtract(4, 1)))); <END> }</code><technical_language>Please replace 2 + 1 3</technical_language>

Target:
void assertWithHamcrestMatcher() { assertThat(3, is(equalTo(calculator.subtract(4, 1)))); }
Source:
<code><START> public String getBucketRebuildMemoryHint() throws OperationNotSupportedException { <END> if (this.service.versionCompare("5.0") < 0) { throw new OperationNotSupportedException("bucketRebuildMemoryHint unavailable before Splunk 5.0"); } else { return getString("bucketRebuildMemoryHint"); } }</code><technical_language>migrating UnsupportedOperationException, please remove throws clauses method declarations. UOE is a runtime exception clauses necessary</technical_language>

Target:
public String getBucketRebuildMemoryHint() { return getString("bucketRebuildMemoryHint"); }
Source:
<code><START> private void createDirectories() { <END> if (jsonFile.getParentFile() != null) { File directory = new File(jsonFile.getParent()); if ((!directory.exists() || !directory.isDirectory()) && !directory.mkdirs()) { logger.warn("Could not create config file directory"); } } }</code><technical_language>This some for caller react error. exception</technical_language>

Target:
private void createDirectories() throws IOException { if (jsonFile.getParentFile() != null) { File directory = new File(jsonFile.getParent()); if ((!directory.exists() || !directory.isDirectory()) && !directory.mkdirs()) { throw new IOException("Could not create config file directory"); } } }
Source:
<code>public void application_is_listed_with_details() throws Throwable { <START> webDriver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); <END> Date presentDate = currentDateMinus(5); WebElement table = webDriver.findElement(By.id(APPLICATIONS_TABLE)); List<WebElement> lastRowInTheTable = getValuesFromTheLastRowFromTheTable(table); String positionName = lastRowInTheTable.get(COLUMN_ZEROTH).getText(); Date addedDate = SIMPLE_DATE_FORMAT.parse(lastRowInTheTable.get(COLUMN_FIRST).getText()); Date lastModifiedDate = SIMPLE_DATE_FORMAT.parse(lastRowInTheTable.get(COLUMN_SECOND).getText()); String stateName = lastRowInTheTable.get(COLUMN_THIRD).getText(); assertThat(positionName, equalTo(DEVELOPER_IN_HUN)); assertThat(addedDate, lessThanOrEqualTo(presentDate)); assertThat(lastModifiedDate, lessThanOrEqualTo(presentDate)); assertThat(stateName, equalTo(NEW_APPLY_IN_HUN)); }</code><technical_language>Place this setting driver provider</technical_language>

Target:
public void application_is_listed_with_details() throws Throwable { WebElement table = webDriver.findElement(By.id(APPLICATIONS_TABLE)); List<WebElement> lastRowInTheTable = getValuesFromTheLastRowFromTheTable(table); Date presentDate = currentDateMinus(15); String positionName = lastRowInTheTable.get(COLUMN_ZEROTH).getText(); Date addedDate = SIMPLE_DATE_FORMAT.parse(lastRowInTheTable.get(COLUMN_FIRST).getText()); Date lastModifiedDate = SIMPLE_DATE_FORMAT.parse(lastRowInTheTable.get(COLUMN_SECOND).getText()); String stateName = lastRowInTheTable.get(COLUMN_THIRD).getText(); assertThat(positionName, equalTo(DEVELOPER_IN_HUN)); assertThat(addedDate, greaterThan(presentDate)); assertThat(lastModifiedDate, greaterThan(presentDate)); assertThat(stateName, equalTo(NEW_APPLY_IN_HUN)); }
Source:
<code>public static String machineName(ObjectMeta podMeta, Container container) { final Map<String, String> annotations = podMeta.getAnnotations(); final String machineName; final String containerName = container.getName(); <START> if ((machineName = findMachineName(annotations, containerName)) != null) { <END> return machineName; } final String originalPodName; final Map<String, String> labels = podMeta.getLabels(); if (labels != null && (originalPodName = labels.get(CHE_ORIGINAL_NAME_LABEL)) != null) { return originalPodName + '/' + containerName; } return podMeta.getName() + '/' + containerName; }</code><technical_language>Please consider updating of java docs well. I java docs explain store machines names in annotations. I guess, previously java doc of MACHINE_NAME_ANNOTATION_FMT const some short info</technical_language>

Target:
public static String machineName(ObjectMeta podMeta, Container container) { final Map<String, String> annotations = podMeta.getAnnotations(); final String machineName; final String containerName = container.getName(); if (containerName != null && containerName.length() > MAX_CONTAINER_NAME_LENGTH) { throw new IllegalArgumentException( format( "The container name exceeds the allowed limit of %s characters.", MAX_CONTAINER_NAME_LENGTH)); } if (annotations != null && (machineName = annotations.get(format(CONTAINER_DISPLAY_NAMES_FMT, containerName))) != null) { return machineName; } final String originalPodName; final Map<String, String> labels = podMeta.getLabels(); if (labels != null && (originalPodName = labels.get(CHE_ORIGINAL_NAME_LABEL)) != null) { return originalPodName + '/' + containerName; } return podMeta.getName() + '/' + containerName; }
Source:
<code>public OcflSession Open(final String id) { return new OcflSession() { @Override public void put(final String path, final InputStream content) { <START> System.out.println("PUT content with path " + path); <END> client.createOrUpdateNonRDFResource(id + "/" + path, content, "foo/dontCare"); } @Override public void commit() { client.createVersionSnapshot(id, "foo"); } }; }</code><technical_language>Please change logging</technical_language>

Target:
public OcflSession Open(final String id) { return new OcflSession() { @Override public void put(final String path, final InputStream content) { client.createOrUpdateNonRDFResource(id + "/" + path, content, "foo/dontCare"); } @Override public void commit() { client.createVersionSnapshot(id, "foo"); } }; }
Source:
<code>protected void setupContent(ViewGroup rootView) { mEmailInput = (WPLoginInputRow) rootView.findViewById(R.id.login_email_row); autoFillFromBuildConfig("DEBUG_DOTCOM_LOGIN_EMAIL", mEmailInput.getEditText()); mEmailInput.addTextChangedListener(this); mEmailInput.setOnEditorCommitListener(this); LinearLayout googleLoginLayout = (LinearLayout) rootView.findViewById(R.id.login_google_layout); googleLoginLayout.setVisibility(BuildConfig.LOGIN_GOOGLE_ENABLED ? View.VISIBLE : View.GONE); LinearLayout googleLoginButton = (LinearLayout) rootView.findViewById(R.id.login_google_button); googleLoginButton.setOnClickListener(new OnClickListener() { @SuppressWarnings("PrivateMemberAccessBetweenOuterAndInnerClass") @Override public void onClick(View view) { AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_GOOGLE_TAPPED); WPActivityUtils.hideKeyboard(getActivity().getCurrentFocus()); if (NetworkUtils.checkConnection(getActivity())) { mOldSitesIDs = SiteUtils.getCurrentSiteIds(mSiteStore, false); <START> mLoginGoogleFragment = addGoogleFragment(); <END> } } }); }</code><technical_language>If child fragment is added, this silently fail. Example: Tap "Log in Google" button cancel process tapping "BACK". tap "Log in Google" again, this time happens. This means need handle child fragment's lifecycle in more detail, removing fragment appropriate</technical_language>

Target:
protected void setupContent(ViewGroup rootView) { mEmailInput = (WPLoginInputRow) rootView.findViewById(R.id.login_email_row); autoFillFromBuildConfig("DEBUG_DOTCOM_LOGIN_EMAIL", mEmailInput.getEditText()); mEmailInput.addTextChangedListener(this); mEmailInput.setOnEditorCommitListener(this); LinearLayout googleLoginButton = (LinearLayout) rootView.findViewById(R.id.login_google_button); googleLoginButton.setOnClickListener(new OnClickListener() { @SuppressWarnings("PrivateMemberAccessBetweenOuterAndInnerClass") @Override public void onClick(View view) { AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_GOOGLE_TAPPED); WPActivityUtils.hideKeyboard(getActivity().getCurrentFocus()); if (NetworkUtils.checkConnection(getActivity())) { mOldSitesIDs = SiteUtils.getCurrentSiteIds(mSiteStore, false); isSocialLogin = true; addGoogleFragment(); } } }); }
Source:
<code>public ContainerStats stats(final String containerId) throws DockerException, InterruptedException { <START> WebTarget resource = resource().path("containers").path(containerId).path("stats") <END> .queryParam("stream", "0"); try { return request(GET, ContainerStats.class, resource, resource.request(APPLICATION_JSON_TYPE)); } catch (DockerRequestException e) { switch (e.status()) { case 404: throw new ContainerNotFoundException(containerId); default: throw e; } } }</code><technical_language>final WebTarget resource</technical_language>

Target:
public ContainerStats stats(final String containerId) throws DockerException, InterruptedException { final WebTarget resource = resource().path("containers").path(containerId).path("stats") .queryParam("stream", "0"); try { return request(GET, ContainerStats.class, resource, resource.request(APPLICATION_JSON_TYPE)); } catch (DockerRequestException e) { switch (e.status()) { case 404: throw new ContainerNotFoundException(containerId); default: throw e; } } }
Source:
<code>public static @Nullable JSONObject getTempModel(@NonNull String tempModelFileName) { Timber.d("getTempModel() fetching tempModel %s", tempModelFileName); try (ByteArrayOutputStream target = new ByteArrayOutputStream()) { CompatHelper.getCompat().copyFile(tempModelFileName, target); return new JSONObject(target.toString()); <START> } catch (IOException | JSONException e) { <END> Timber.e(e, "Unable to read+parse tempModel from file %s", tempModelFileName); return null; } }</code><technical_language>sense catch Exception return null failure, specific failures</technical_language>

Target:
public static JSONObject getTempModel(@NonNull String tempModelFileName) throws IOException { Timber.d("getTempModel() fetching tempModel %s", tempModelFileName); try (ByteArrayOutputStream target = new ByteArrayOutputStream()) { CompatHelper.getCompat().copyFile(tempModelFileName, target); return new JSONObject(target.toString()); } catch (IOException e) { Timber.e(e, "Unable to read+parse tempModel from file %s", tempModelFileName); throw e; } }
Source:
<code>public void testModifyTable_HBase2_Async() throws IOException { super.testModifyTable(new Function<HTableDescriptor, Void>() { @Nullable @Override public Void apply(@Nullable HTableDescriptor descriptor) { try { <START> getAsyncAdmin().modifyTable(descriptor).get(20, TimeUnit.SECONDS); <END> } catch (Exception e) { throw new RuntimeException(e); } return null; } }); }</code><technical_language>Please update this 1 minute. This method potentially slow server</technical_language>

Target:
public void testModifyTable_HBase2_Async() throws IOException { super.testModifyTable(new Function<HTableDescriptor, Void>() { @Nullable @Override public Void apply(@Nullable HTableDescriptor descriptor) { try { getAsyncAdmin().modifyTable(descriptor).get(1, TimeUnit.MINUTES); } catch (Exception e) { throw new RuntimeException(e); } return null; } }); }