auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void showToast(String message, ToastUtil.ToastType toastType) { <START> if (getActivity() != null) <END> ToastUtil.showShortToast(getActivity(), toastType, message); }</code><technical_language>put braces { } for if statement advised <LINK_0></technical_language>

Target:
public void showToast(String message, ToastUtil.ToastType toastType) { if (getActivity() != null) { ToastUtil.showShortToast(getActivity(), toastType, message); } }
Source:
<code>public void onNext(Object t) { if (get() != SubscriptionHelper.CANCELLED) { <START> get().cancel(); <END> lazySet(SubscriptionHelper.CANCELLED); parent.onTimeout(idx); } }</code><technical_language>Extract get() result local var here</technical_language>

Target:
public void onNext(Object t) { Subscription upstream = get(); if (upstream != SubscriptionHelper.CANCELLED) { upstream.cancel(); lazySet(SubscriptionHelper.CANCELLED); parent.onTimeout(idx); } }
Source:
<code>protected ProducerConfig createKafkaProducerConfig(){ if(brokerList != null) { getConfigProperties().setProperty(BROKER_KEY, brokerList); } <START> getConfigProperties().setProperty(BATCH_NUM_KEY, String.valueOf(batchSize)); <END> producerConfig = super.createKafkaProducerConfig(); return producerConfig; }</code><technical_language>Enforce this if is in batch mode, right? set producer.type true batch mode work</technical_language>

Target:
protected ProducerConfig createKafkaProducerConfig() { if (brokerList != null) { getConfigProperties().setProperty(BROKER_KEY, brokerList); } if (isBatchProcessing) { if (batchSize != 0) { getConfigProperties().setProperty(BATCH_NUM_KEY, String.valueOf(batchSize)); } getConfigProperties().setProperty(PRODUCER_KEY, ASYNC_PRODUCER_TYPE); } return super.createKafkaProducerConfig(); }
Source:
<code>@Override public Pair<RelTraitSet, List<RelTraitSet>> passThroughTraits( RelTraitSet required) { RelCollation collation = required.getTrait(RelCollationTraitDef.INSTANCE); <START> if (collation == null || collation.getFieldCollations().size() == 0) { <END> return null; } return Pair.of(required, ImmutableList.of(required)); }</code><technical_language>assert</technical_language>

Target:
@Override public Pair<RelTraitSet, List<RelTraitSet>> passThroughTraits( RelTraitSet required) { if (required.getCollation() == null || required.isDefaultSansConvention()) { return null; } RelCollation collation = required.getCollation(); RelTraitSet traits = traitSet.replace(collation); return Pair.of(traits, ImmutableList.of(traits)); }
Source:
<code>public RefundEntityFixture withUserExternalId(String userExternalId) { <START> RefundEntityFixture.userExternalId = userExternalId; <END> return this; }</code><technical_language>I correct change is userExternalId static</technical_language>

Target:
public RefundEntityFixture withUserExternalId(String userExternalId) { this.userExternalId = userExternalId; return this; }
Source:
<code>public void testLoadOpportunityMRUObjectsFromCache() throws Exception { final List<SalesforceObject> mruObjects_before = metadataManager.loadMRUObjects(Constants.OPPORTUNITY, MAX_QUERY_LIMIT, CachePolicy.RELOAD_AND_RETURN_CACHE_DATA, REFRESH_INTERVAL, null); Map<String, String> idToNames = new HashMap<String, String>(); int numberOfRecords = 1; <START> idToNames = createRecordsOnServer(1, Constants.OPPORTUNITY); <END> String[] names = idToNames.values().toArray(new String[1]);; String[] ids = idToNames.keySet().toArray(new String[1]); try { Thread.sleep(2000); final List<SalesforceObject> mruObjects = metadataManager.loadMRUObjects(Constants.OPPORTUNITY, MAX_QUERY_LIMIT, CachePolicy.RETURN_CACHE_DATA_DONT_RELOAD, REFRESH_INTERVAL, null); assertNotNull("MRU list should not be null", mruObjects); assertEquals("MRU list size should not be changed", mruObjects_before.size(), mruObjects.size()); assertEquals("Recently viewed object name is incorrect", mruObjects_before.get(0).getName(), mruObjects.get(0).getName()); } finally { deleteRecordsOnServer(ids, Constants.OPPORTUNITY); } }</code><technical_language>initialize this line 254</technical_language>

Target:
public void testLoadOpportunityMRUObjectsFromCache() throws Exception { final List<SalesforceObject> mruObjects_before = metadataManager.loadMRUObjects(Constants.OPPORTUNITY, MAX_QUERY_LIMIT, CachePolicy.RELOAD_AND_RETURN_CACHE_DATA, REFRESH_INTERVAL, null); int numberOfRecords = 1; Map<String, String> idToNames = createRecordsOnServer(1, Constants.OPPORTUNITY); Set<String> ids = idToNames.keySet(); try { Thread.sleep(2000); final List<SalesforceObject> mruObjects = metadataManager.loadMRUObjects(Constants.OPPORTUNITY, MAX_QUERY_LIMIT, CachePolicy.RETURN_CACHE_DATA_DONT_RELOAD, REFRESH_INTERVAL, null); assertNotNull("MRU list should not be null", mruObjects); assertEquals("MRU list size should not be changed", mruObjects_before.size(), mruObjects.size()); assertEquals("Recently viewed object name is incorrect", mruObjects_before.get(0).getName(), mruObjects.get(0).getName()); } finally { deleteRecordsOnServer(ids, Constants.OPPORTUNITY); } }
Source:
<code>private Set<String> buildResourceNames() { Set<String> retval = new HashSet<>(); Properties props = new Properties(); try { <START> props.load(myVersion.getFhirVersionPropertiesFile()); <END> } catch (IOException theE) { throw new ConfigurationException("Failed to load version properties file"); } Enumeration<?> propNames = props.propertyNames(); while (propNames.hasMoreElements()) { String next = (String) propNames.nextElement(); if (next.startsWith("resource.")) { retval.add(next.substring("resource.".length()).trim()); } } return retval; }</code><technical_language>getFhirVersionPropertiesFile returns inputstream, closed. commit a fix do that</technical_language>

Target:
private Set<String> buildResourceNames() { Set<String> retVal = new HashSet<>(); Properties props = new Properties(); try (InputStream propFile = myVersion.getFhirVersionPropertiesFile()) { props.load(propFile); } catch (IOException e) { throw new ConfigurationException("Failed to load version properties file", e); } Enumeration<?> propNames = props.propertyNames(); while (propNames.hasMoreElements()) { String next = (String) propNames.nextElement(); if (next.startsWith("resource.")) { retVal.add(next.substring("resource.".length()).trim()); } } return retVal; }
Source:
<code>private void sortPropertyMappingsByDependencies() { final GraphAnalyzer graphAnalyzer = new GraphAnalyzer(); for ( PropertyMapping propertyMapping : propertyMappings ) { graphAnalyzer.addNode( propertyMapping.getName(), propertyMapping.getDependsOn() ); } graphAnalyzer.analyze(); if ( !graphAnalyzer.getCycles().isEmpty() ) { <START> Set<String> cycles = new HashSet<String>( graphAnalyzer.getCycles().size() ); <END> for ( List<String> cycle : graphAnalyzer.getCycles() ) { cycles.add( Strings.join( cycle, " -> " ) ); } ctx.getMessager().printMessage( method.getExecutable(), Message.BEANMAPPING_CYCLE_BETWEEN_PROPERTIES, Strings.join( cycles, ", " ) ); } else { Collections.sort( propertyMappings, new Comparator<PropertyMapping>() { @Override public int compare(PropertyMapping o1, PropertyMapping o2) { if ( graphAnalyzer.getAllDescendants( o1.getName() ).contains( o2.getName() ) ) { return 1; } else if ( graphAnalyzer.getAllDescendants( o2.getName() ).contains( o1.getName() ) ) { return -1; } else { return 0; } } } ); } }</code><technical_language>Setting this initial capacity result in a resizing, default load factor is 0.75. In order avoid resizing, Math.ceil( (float) expectedSize * 4.f / 3.f ) - a Maps.newHashMapWithExpectedSize in guava... :wink:</technical_language>

Target:
private void sortPropertyMappingsByDependencies() { GraphAnalyzerBuilder graphAnalyzerBuilder = GraphAnalyzer.builder(); for ( PropertyMapping propertyMapping : propertyMappings ) { graphAnalyzerBuilder.withNode( propertyMapping.getName(), propertyMapping.getDependsOn() ); } final GraphAnalyzer graphAnalyzer = graphAnalyzerBuilder.build(); if ( !graphAnalyzer.getCycles().isEmpty() ) { Set<String> cycles = new HashSet<String>(); for ( List<String> cycle : graphAnalyzer.getCycles() ) { cycles.add( Strings.join( cycle, " -> " ) ); } ctx.getMessager().printMessage( method.getExecutable(), Message.BEANMAPPING_CYCLE_BETWEEN_PROPERTIES, Strings.join( cycles, ", " ) ); } else { Collections.sort( propertyMappings, new Comparator<PropertyMapping>() { @Override public int compare(PropertyMapping o1, PropertyMapping o2) { if ( graphAnalyzer.getAllDescendants( o1.getName() ).contains( o2.getName() ) ) { return 1; } else if ( graphAnalyzer.getAllDescendants( o2.getName() ).contains( o1.getName() ) ) { return -1; } else { return 0; } } } ); } }
Source:
<code>public void update() { <START> final Map<String, TreeItem> fNodes = new HashMap<>(); <END> final Map<TreeItem, ArrayList<Path>> fChildren = new HashMap<>(); fTree.removeAll(); Path path = Paths.get(fXmlFilesPath.toString()); try { Files.walkFileTree(path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) { TreeItem itemParent = fNodes.get(dir.getParent().toString()); TreeItem item = null; if (itemParent == null) { item = new TreeItem(fTree, SWT.NONE); } else { item = new TreeItem(itemParent, SWT.NONE); } item.setText(dir.getFileName().toString()); fItemsPaths.put(item, dir); fNodes.put(dir.toString(), item); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path dir, BasicFileAttributes attrs) { TreeItem itemParent = fNodes.get(dir.getParent().toString()); if (fChildren.get(itemParent) == null) { fChildren.put(itemParent, new ArrayList<Path>()); } fChildren.get(itemParent).add(dir); return FileVisitResult.CONTINUE; } }); } catch (IOException e) { Activator.logError("Cannot walk through the XML Files directory!", e); } for (TreeItem p : fChildren.keySet()) { for (Path c : fChildren.get(p)) { TreeItem item = new TreeItem(p, SWT.NONE); fItemsPaths.put(item, c); item.setText(c.getFileName().toString()); } } fTree.layout(); }</code><technical_language>need final, hurt though</technical_language>

Target:
public void update() { final Map<String, TreeItem> Nodes = new HashMap<>(); final Map<TreeItem, ArrayList<Path>> Children = new HashMap<>(); fTree.removeAll(); Path path = Paths.get(fXmlFilesPath.toString()); try { Files.walkFileTree(path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) { TreeItem itemParent = Nodes.get(dir.getParent().toString()); TreeItem item = null; if (itemParent == null) { item = new TreeItem(fTree, SWT.NONE); } else { item = new TreeItem(itemParent, SWT.NONE); } item.setText(dir.getFileName().toString()); fItemsPaths.put(item, dir); Nodes.put(dir.toString(), item); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path dir, BasicFileAttributes attrs) { TreeItem itemParent = Nodes.get(dir.getParent().toString()); if (Children.get(itemParent) == null) { Children.put(itemParent, new ArrayList<Path>()); } Children.get(itemParent).add(dir); return FileVisitResult.CONTINUE; } }); } catch (IOException e) { Activator.logError("Cannot walk through the XML Files directory!", e); } for (TreeItem p : Children.keySet()) { for (Path c : Children.get(p)) { TreeItem item = new TreeItem(p, SWT.NONE); fItemsPaths.put(item, c); item.setText(c.getFileName().toString()); } } fTree.layout(); }
Source:
<code>public void start() { components.forEach(component -> { <START> log.info("calling publishInfo on ", component); <END> component.publishInfo(componentInfoPublisher); }); componentInfoPublisher.startupFinished(); components.forEach(component -> component.start()); }</code><technical_language>Debug</technical_language>

Target:
public void start() { components.forEach(component -> { if (log.isDebugEnabled()) { log.debug("calling publishInfo on ", component); } component.publishInfo(componentInfoPublisher); }); componentInfoPublisher.startupFinished(); components.forEach(component -> component.start()); }
Source:
<code>String toString(Binary value) { <START> return value.toStringUsingUTF8(); <END> }</code><technical_language>Delegating type here, work this Binary is for Decimal</technical_language>

Target:
String toString(Binary value) { return value == null ? "null" : value.toStringUsingUTF8(); }
Source:
<code>NendUnifiedNativeNormalAdMapper( Context context, NendNativeAdForwarder forwarder, NendAdNative ad, NendNativeMappedImage adImage, NendNativeMappedImage logoImage) { super(logoImage); this.forwarder = forwarder; nendAd = ad; connector = NativeAdLoader.createNativeAdConnector(ad); setAdvertiser(ad.getPromotionName()); setHeadline(ad.getTitleText()); setBody(ad.getContentText()); setCallToAction(ad.getActionText()); <START> if (adImage != null) { <END> List<NativeAd.Image> imagesList = new ArrayList<>(); imagesList.add(adImage); setImages(imagesList); Drawable drawable = adImage.getDrawable(); if (drawable != null) { ImageView imageView = new ImageView(context); imageView.setAdjustViewBounds(true); imageView.setImageDrawable(drawable); setMediaView(imageView); } } adChoicesMappingView = new TextView(context); adChoicesMappingView.setText(NendAdNative.AdvertisingExplicitly.PR.getText()); setAdChoicesContent(adChoicesMappingView); nendAd.setNendAdNativeListener(this); }</code><technical_language>If adImage is null, this fail ad request ads provide a MediaView</technical_language>

Target:
NendUnifiedNativeNormalAdMapper( Context context, NendNativeAdForwarder forwarder, NendAdNative ad, NendNativeMappedImage adImage, NendNativeMappedImage logoImage) { super(logoImage); this.forwarder = forwarder; nendAd = ad; connector = NendNativeAdConnectorFactory.createNativeAdConnector(ad); setAdvertiser(ad.getPromotionName()); setHeadline(ad.getTitleText()); setBody(ad.getContentText()); setCallToAction(ad.getActionText()); ImageView imageView = new ImageView(context); if (adImage == null) { Log.w(TAG, "Missing Image of nend's native ad, so MediaView will be unavailable..."); } else { List<NativeAd.Image> imagesList = new ArrayList<>(); imagesList.add(adImage); setImages(imagesList); Drawable drawable = adImage.getDrawable(); if (drawable != null) { imageView.setAdjustViewBounds(true); imageView.setImageDrawable(drawable); } } setMediaView(imageView); adChoicesMappingView = new TextView(context); adChoicesMappingView.setText(NendAdNative.AdvertisingExplicitly.PR.getText()); setAdChoicesContent(adChoicesMappingView); nendAd.setNendAdNativeListener(this); }
Source:
<code>public DataSourceMetadata minus(DataSourceMetadata other) { if (!(other instanceof KafkaDataSourceMetadata)) { throw new IAE( "Expected instance of %s, got %s", KafkaDataSourceMetadata.class.getCanonicalName(), other.getClass().getCanonicalName() ); } final KafkaDataSourceMetadata that = (KafkaDataSourceMetadata) other; if (that.getKafkaPartitions().getTopic().equals(kafkaPartitions.getTopic())) { final Map<Integer, Long> newMap = Maps.newHashMap(); for (Map.Entry<Integer, Long> entry : kafkaPartitions.getPartitionOffsetMap().entrySet()) { newMap.put(entry.getKey(), entry.getValue()); } for (Map.Entry<Integer, Long> entry : that.getKafkaPartitions().getPartitionOffsetMap().entrySet()) { newMap.remove(entry.getKey()); <START> } <END> return new KafkaDataSourceMetadata(new KafkaPartitions(kafkaPartitions.getTopic(), newMap)); } else { return this; } }</code><technical_language>skip put in place entry existed in "that"</technical_language>

Target:
public DataSourceMetadata minus(DataSourceMetadata other) { if (!(other instanceof KafkaDataSourceMetadata)) { throw new IAE( "Expected instance of %s, got %s", KafkaDataSourceMetadata.class.getCanonicalName(), other.getClass().getCanonicalName() ); } final KafkaDataSourceMetadata that = (KafkaDataSourceMetadata) other; if (that.getKafkaPartitions().getTopic().equals(kafkaPartitions.getTopic())) { final Map<Integer, Long> newMap = Maps.newHashMap(); for (Map.Entry<Integer, Long> entry : kafkaPartitions.getPartitionOffsetMap().entrySet()) { if(!that.getKafkaPartitions().getPartitionOffsetMap().containsKey(entry.getKey())) { newMap.put(entry.getKey(), entry.getValue()); } } return new KafkaDataSourceMetadata(new KafkaPartitions(kafkaPartitions.getTopic(), newMap)); } else { return this; } }
Source:
<code>public void test008() { this.runNegativeTest( new String[] { "X.java", "interface I {\n" + " void doit();\n" + " default void doitalso () {}\n" + "}\n" + "interface J {\n" + " void doit();\n" + " default void doitalso () {}\n" + "}\n" + "public class X {\n" + " Object p = (@Marker java.lang. @Readonly String & I & J) () -> {};\n" + "}\n" , }, "----------\n" + "1. ERROR in X.java (at line 10)\n" + " Object p = (@Marker java.lang. @Readonly String & I & J) () -> {};\n" + " ^^^^^^^\n" + "The annotation @Marker is disallowed for this location - type annotations must be placed directly before the type name (within the qualified name)\n" + "----------\n" + "2. ERROR in X.java (at line 10)\n" + " Object p = (@Marker java.lang. @Readonly String & I & J) () -> {};\n" + " ^^^^^^\n" + <START> "Marker cannot be resolved to a type\n" <END> + "----------\n" + "3. ERROR in X.java (at line 10)\n" + " Object p = (@Marker java.lang. @Readonly String & I & J) () -> {};\n" + " ^^^^^^^^\n" + "Readonly cannot be resolved to a type\n" + "----------\n" + "4. ERROR in X.java (at line 10)\n" + " Object p = (@Marker java.lang. @Readonly String & I & J) () -> {};\n" + " ^^^^^\n" + "The target type of this expression must be a functional interface\n" + "----------\n"); }</code><technical_language>a quick glance this contradictory me: Marker is a type annotation annotation type</technical_language>

Target:
public void test008() { this.runNegativeTest( new String[] { "X.java", "interface I {\n" + " void doit();\n" + " default void doitalso () {}\n" + "}\n" + "interface J {\n" + " void doit();\n" + " default void doitalso () {}\n" + "}\n" + "public class X {\n" + " Object p = (@Marker java.lang. @Readonly String & I & J) () -> {};\n" + "}\n" , }, "----------\n" + "1. ERROR in X.java (at line 10)\n" + " Object p = (@Marker java.lang. @Readonly String & I & J) () -> {};\n" + " ^^^^^^^\n" + "Illegally placed annotation: type annotations must directly precede the simple name of the type they are meant to affect (or the for arrays)\n" + "----------\n" + "2. ERROR in X.java (at line 10)\n" + " Object p = (@Marker java.lang. @Readonly String & I & J) () -> {};\n" + " ^^^^^^\n" + "Marker cannot be resolved to a type\n" + "----------\n" + "3. ERROR in X.java (at line 10)\n" + " Object p = (@Marker java.lang. @Readonly String & I & J) () -> {};\n" + " ^^^^^^^^\n" + "Readonly cannot be resolved to a type\n" + "----------\n" + "4. ERROR in X.java (at line 10)\n" + " Object p = (@Marker java.lang. @Readonly String & I & J) () -> {};\n" + " ^^^^^\n" + "The target type of this expression must be a functional interface\n" + "----------\n"); }
Source:
<code>public CompletableFuture<HermesResponse> send(URI uri, HermesMessage message) { String prefix = "hermes-client." + message.getSanitizedTopic(); Timer.Context ctx = metrics.timer(prefix + ".latency").time(); return sender.send(uri, message).whenComplete((resp, cause) -> { ctx.close(); if (resp != null) { metrics.counter(prefix + ".status." + resp.getHttpStatus()).inc(); } if (cause != null) { <START> metrics.counter(prefix + ".exception." + cause.getClass().getSimpleName()).inc(); <END> } }); }</code><technical_language>i dont include exception name: i inspect add metrics for some common exceptions like: - failure.timeout (for timeout exceptions) - failure.other (for unknown stuff)</technical_language>

Target:
public CompletableFuture<HermesResponse> send(URI uri, HermesMessage message) { String prefix = "hermes-client." + message.getSanitizedTopic(); Timer.Context ctx = metrics.timer(prefix + ".latency").time(); return sender.send(uri, message).whenComplete((resp, cause) -> { ctx.close(); if (resp != null) { metrics.counter(prefix + ".status." + resp.getHttpStatus()).inc(); } if (cause != null) { metrics.counter(prefix + ".failure").inc(); } }); }
Source:
<code>public void SDKHeaderIsIncludedInGetCalls() throws Exception { new Thread(new Runnable() { @Override public void run() { <START> OneSignalRestClient.getSync("URL", null, null); <END> } }, OS_REST_CLIENT).start(); threadAndTaskWait(); assertEquals(SDK_VERSION_HTTP_HEADER, getLastHTTPHeaderProp("SDK-Version")); }</code><technical_language>This changed OneSignalRestClient.get("URL", null, null); is asynchronous. This simplify this. this create issues tests stuck</technical_language>

Target:
public void SDKHeaderIsIncludedInGetCalls() throws Exception { OneSignalRestClient.get("URL", null, null); threadAndTaskWait(); assertEquals(SDK_VERSION_HTTP_HEADER, getLastHTTPHeaderProp("SDK-Version")); }
Source:
<code>public static OptionSet discardEOptions(OptionSet optionSet){ OptionSet result = new OptionSet(); boolean discard = false; for(Option opt : optionSet.asSortedList()){ Iterator<Integer> it = allEOptions.iterator(); <START> while(!discard && it.hasNext()){ <END> int tmp = it.next().intValue() - opt.getNumber(); if(tmp == 0){ discard = true; } } if(!discard){ result.addOption(opt); } discard = false; } return result; }</code><technical_language>whitespace</technical_language>

Target:
public static OptionSet discardEOptions(OptionSet optionSet) { OptionSet result = new OptionSet(); for (Option opt : optionSet.asSortedList()) { if (!allEOptions.contains(opt.getNumber())) { result.addOption(opt); } } return result; }
Source:
<code>public boolean addCredit(int creditDeltas) { numCreditsAvailable += creditDeltas; <START> return shouldAnnounceBacklog(); <END> }</code><technical_language>need trigger announce backlog while adding credit? I assume added creditDeltas is more zero, chance announce backlog sending BufferResponse</technical_language>

Target:
public void addCredit(int creditDeltas) throws Exception { numCreditsAvailable += creditDeltas; requestQueue.enqueueAvailableReader(this, this::isAvailable); }
Source:
<code>default Method resolveMethod(ProviderContext context) { List<Method> targetMethods = Arrays.stream(getClass().getMethods()) .filter(m -> m.getName().equals(context.getMapperMethod().getName())) <START> .filter(m -> CharSequence.class.isAssignableFrom(m.getReturnType())) <END> .collect(Collectors.toList()); if (targetMethods.size() == 1) { return targetMethods.get(0); } if (targetMethods.isEmpty()) { throw new BuilderException("Cannot resolve the provide method because '" + context.getMapperMethod().getName() + "' not found in SqlProvider '" + getClass().getName() + "'."); } else { throw new BuilderException("Cannot resolve the provide method because '" + context.getMapperMethod().getName() + "' is found multiple in SqlProvider '" + getClass().getName() + "'."); } }</code><technical_language>check return type throw clearer error message e.g. 'the return type of method CharSequence subclass'</technical_language>

Target:
default Method resolveMethod(ProviderContext context) { List<Method> sameNameMethods = Arrays.stream(getClass().getMethods()) .filter(m -> m.getName().equals(context.getMapperMethod().getName())) .collect(Collectors.toList()); if (sameNameMethods.isEmpty()) { throw new BuilderException("Cannot resolve the provider method because '" + context.getMapperMethod().getName() + "' not found in SqlProvider '" + getClass().getName() + "'."); } List<Method> targetMethods = sameNameMethods.stream() .filter(m -> CharSequence.class.isAssignableFrom(m.getReturnType())) .collect(Collectors.toList()); if (targetMethods.size() == 1) { return targetMethods.get(0); } if (targetMethods.isEmpty()) { throw new BuilderException("Cannot resolve the provider method because '" + context.getMapperMethod().getName() + "' does not return the CharSequence or its subclass in SqlProvider '" + getClass().getName() + "'."); } else { throw new BuilderException("Cannot resolve the provider method because '" + context.getMapperMethod().getName() + "' is found multiple in SqlProvider '" + getClass().getName() + "'."); } }
Source:
<code>public void configure(Binder binder) { <START> binder.bind(Key.get(Log4jShutterDowner.class, Names.named("ForTheEagerness"))) <END> .to(Log4jShutterDowner.class) .asEagerSingleton(); }</code><technical_language>Guice eager instantiation a pretty bad job of ensuring ordering. Please Lifecycle.register instead</technical_language>

Target:
public void configure(Binder binder) { try { final Class<?> logManagerClazz = Class.forName("org.apache.logging.log4j.LogManager"); final LoggerContextFactory contextFactory = LogManager.getFactory(); if (!(contextFactory instanceof Log4jContextFactory)) { log.warn( "Expected [%s] found [%s]. Unknown class for context factory. Not logging shutdown", Log4jContextFactory.class.getCanonicalName(), contextFactory.getClass().getCanonicalName() ); return; } final ShutdownCallbackRegistry registry = ((Log4jContextFactory) contextFactory).getShutdownCallbackRegistry(); if (!(registry instanceof Log4jShutdown)) { log.warn( "Shutdown callback registry expected class [%s] found [%s]. Skipping shutdown registry", Log4jShutdown.class.getCanonicalName(), registry.getClass().getCanonicalName() ); return; } binder.bind(Log4jShutdown.class).toInstance((Log4jShutdown) registry); binder.bind(Key.get(Log4jShutterDowner.class, Names.named("ForTheEagerness"))) .to(Log4jShutterDowner.class) .asEagerSingleton(); } catch (ClassNotFoundException | ClassCastException | LinkageError e) { log.warn(e, "Not registering log4j shutdown hooks. Not using log4j?"); } }
Source:
<code>public void write(DataOutput out) throws IOException { serialize(); byte hasValues = (values == null) ? 0 : (byte) 1; if (!replicationSources.isEmpty()) { hasValues = (byte) (0x02 | hasValues); } out.write((byte) (0x80 | hasValues)); <START> int size = UnsynchronizedBuffer.writeVInt(integerBuffer, 0, row.length); <END> out.write(integerBuffer, 0, size); out.write(row); size = UnsynchronizedBuffer.writeVInt(integerBuffer, 0, data.length); out.write(integerBuffer, 0, size); out.write(data); size = UnsynchronizedBuffer.writeVInt(integerBuffer, 0, entries); out.write(integerBuffer, 0, size); if (0x01 == (0x01 & hasValues)) { size = UnsynchronizedBuffer.writeVInt(integerBuffer, 0, values.size()); out.write(integerBuffer, 0, size); for (byte[] val : values) { size = UnsynchronizedBuffer.writeVInt(integerBuffer, 0, val.length); out.write(integerBuffer, 0, size); out.write(val); } } if (0x02 == (0x02 & hasValues)) { size = UnsynchronizedBuffer.writeVInt(integerBuffer, 0, replicationSources.size()); out.write(integerBuffer, 0, size); for (String source : replicationSources) { WritableUtils.writeString(out, source); } } }</code><technical_language>a utility method following, replace repeated lines a single line. java public static void writeVInt(OutputStream out, byte[] workBuffer, int i){ int size = writeVInt(workBuffer, 0, i); out.write(workBuffer, 0 size); }</technical_language>

Target:
public void write(DataOutput out) throws IOException { final byte[] integerBuffer = new byte[5]; serialize(); byte hasValues = (values == null) ? 0 : (byte) 1; if (!replicationSources.isEmpty()) { hasValues = (byte) (0x02 | hasValues); } out.write((byte) (0x80 | hasValues)); UnsynchronizedBuffer.writeVInt(out, integerBuffer, row.length); out.write(row); UnsynchronizedBuffer.writeVInt(out, integerBuffer, data.length); out.write(data); UnsynchronizedBuffer.writeVInt(out, integerBuffer, entries); if (0x01 == (0x01 & hasValues)) { UnsynchronizedBuffer.writeVInt(out, integerBuffer, values.size()); for (byte[] val : values) { UnsynchronizedBuffer.writeVInt(out, integerBuffer, val.length); out.write(val); } } if (0x02 == (0x02 & hasValues)) { UnsynchronizedBuffer.writeVInt(out, integerBuffer, replicationSources.size()); for (String source : replicationSources) { WritableUtils.writeString(out, source); } } }
Source:
<code>protected HttpResponse invoke(HttpURLConnection connection) throws IOException, InterruptedException { HttpResponse original = super.invoke(connection); HttpResponse.Builder<?> response = original.toBuilder(); if (hasPayload(original)) { InputStream in = null; InputStream originalInputStream = original.getPayload().openStream(); if (originalInputStream instanceof ByteArrayInputStream) { in = originalInputStream; } else { try { <START> in = new ByteArrayInputStream(ByteStreams.toByteArray(originalInputStream)); <END> } finally { close(originalInputStream, true); } } BaseResponse responseContent = errorParser.apply(in); if (responseContent != null && responseContent.getStatus() == Status.ERROR) { if (ACCESS_DENIED.equals(responseContent.getMessage())) { response.statusCode(401); } else if (NOT_FOUND.equals(responseContent.getMessage())) { response.statusCode(404); } else { response.statusCode(500); } response.message(responseContent.getDetails()); } in.reset(); Payload payload = newInputStreamPayload(in); contentMetadataCodec.fromHeaders(payload.getContentMetadata(), original.getHeaders()); response.payload(payload); } return response.build(); }</code><technical_language>Potential memory issue big responses here</technical_language>

Target:
protected HttpResponse invoke(HttpURLConnection connection) throws IOException, InterruptedException { HttpResponse original = super.invoke(connection); HttpResponse.Builder<?> response = original.toBuilder(); if (hasPayload(original)) { InputStream in = null; InputStream originalInputStream = original.getPayload().openStream(); if (originalInputStream instanceof ByteArrayInputStream) { in = originalInputStream; } else { try { in = new ByteArrayInputStream(ByteStreams.toByteArray(originalInputStream)); } finally { close(originalInputStream, true); } } BaseResponse responseContent = errorParser.apply(in); if (responseContent != null && responseContent.getStatus() == Status.ERROR) { String message = responseContent.getMessage(); if (ACCESS_DENIED.equals(message)) { response.statusCode(401); } else if (NOT_FOUND.equals(message)) { response.statusCode(404); } else { response.statusCode(500); } response.message(responseContent.getDetails()); } in.reset(); Payload payload = newInputStreamPayload(in); contentMetadataCodec.fromHeaders(payload.getContentMetadata(), original.getHeaders()); response.payload(payload); } return response.build(); }
Source:
<code>public final void runDevicePreInvocationSetup( IInvocationContext context, IConfiguration config, ITestLogger logger) throws DeviceNotAvailableException, TargetSetupError { <START> if (mPreInvocationSetupDone) { <END> return; } for (String deviceName : context.getDeviceConfigNames()) { ITestDevice device = context.getDevice(deviceName); CLog.d("Starting device pre invocation setup for : '%s'", device.getSerialNumber()); if (device instanceof ITestLoggerReceiver) { ((ITestLoggerReceiver) context.getDevice(deviceName)).setTestLogger(logger); } if (!config.getCommandOptions().shouldSkipPreDeviceSetup()) { device.preInvocationSetup(context.getBuildInfo(deviceName)); } } mPreInvocationSetupDone = true; }</code><technical_language>Is this avoid method called more once? If is expected behavior, raise exception</technical_language>

Target:
public final void runDevicePreInvocationSetup( IInvocationContext context, IConfiguration config, ITestLogger logger) throws DeviceNotAvailableException, TargetSetupError { for (String deviceName : context.getDeviceConfigNames()) { ITestDevice device = context.getDevice(deviceName); CLog.d("Starting device pre invocation setup for : '%s'", device.getSerialNumber()); if (device instanceof ITestLoggerReceiver) { ((ITestLoggerReceiver) context.getDevice(deviceName)).setTestLogger(logger); } if (!config.getCommandOptions().shouldSkipPreDeviceSetup()) { device.preInvocationSetup(context.getBuildInfo(deviceName)); } } }
Source:
<code>private static ICPPEvaluation callFunction(ICPPClassType classType, ICPPFunction func, ICPPEvaluation rangeEval, ActivationRecord record, ConstexprEvaluationContext context) { EvalFunctionCall call = null; if(func instanceof ICPPMethod) { EvalMemberAccess memberAccess = new EvalMemberAccess(classType, ValueCategory.LVALUE, func, rangeEval, false, context.getPoint()); ICPPEvaluation[] args = new ICPPEvaluation[]{ memberAccess }; call = new EvalFunctionCall(args, rangeEval, context.getPoint()); } else { ICPPASTName name = new CPPASTName(func.getNameCharArray()); name.setBinding(func); IASTIdExpression idExpr = new CPPASTIdExpression(name); <START> ICPPEvaluation op = EvalID.create(idExpr); <END> ICPPEvaluation[] args = new ICPPEvaluation[]{ op, rangeEval}; call = new EvalFunctionCall(args, null, context.getPoint()); } return call.computeForFunctionCall(record, context); }</code><technical_language>EvalBinding</technical_language>

Target:
private static ICPPEvaluation callFunction(ICPPClassType classType, ICPPFunction func, ICPPEvaluation rangeEval, ActivationRecord record, ConstexprEvaluationContext context) { EvalFunctionCall call = null; if(func instanceof ICPPMethod) { EvalMemberAccess memberAccess = new EvalMemberAccess(classType, ValueCategory.LVALUE, func, rangeEval, false, context.getPoint()); ICPPEvaluation[] args = new ICPPEvaluation[]{ memberAccess }; call = new EvalFunctionCall(args, rangeEval, context.getPoint()); } else { EvalBinding op = new EvalBinding(func, func.getType(), context.getPoint()); ICPPEvaluation[] args = new ICPPEvaluation[]{ op, rangeEval}; call = new EvalFunctionCall(args, null, context.getPoint()); } return call.computeForFunctionCall(record, context); }
Source:
<code>public final void mID() throws RecognitionException { try { int _type = ID; int _channel = DEFAULT_TOKEN_CHANNEL; <START> { <END> if ((input.LA(1) >= 'A' && input.LA(1) <= 'Z') || (input.LA(1) >= 'a' && input.LA(1) <= 'z') || input.LA( 1) == '(' || input.LA(1) == ')') { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null, input); recover(mse); throw mse; } loop1: do { int alt1 = 2; int LA1_0 = input.LA(1); if ((LA1_0 == ' ' || LA1_0 == '-' || (LA1_0 >= '0' && LA1_0 <= '9') || (LA1_0 >= 'A' && LA1_0 <= 'Z') || LA1_0 == '_' || input.LA( 1) == '(' || input.LA(1) == ')' || (LA1_0 >= 'a' && LA1_0 <= 'z'))) { alt1 = 1; } switch (alt1) { case 1: { if (input.LA(1) == ' ' || input.LA( 1) == '-' || (input.LA(1) >= '0' && input.LA(1) <= '9') || (input.LA( 1) >= 'A' && input.LA(1) <= 'Z') || input.LA( 1) == '_' || (input.LA(1) >= 'a' && input.LA(1) <= 'z') || input.LA( 1) == '(' || input.LA(1) == ')') { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null, input); recover(mse); throw mse; } } break; default: break loop1; } } while (true); } state.type = _type; state.channel = _channel; } finally { } }</code><technical_language>Please assign input.LA(1) a variable avoid repeated calls</technical_language>

Target:
public final void mID() throws RecognitionException { try { int _type = ID; int _channel = DEFAULT_TOKEN_CHANNEL; { if ((input.LA(1) >= 'A' && input.LA(1) <= 'Z') || (input.LA(1) >= 'a' && input.LA(1) <= 'z')) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null, input); recover(mse); throw mse; } loop1: do { int alt1 = 2; int LA1_0 = input.LA(1); if ((LA1_0 == ' ' || (LA1_0 >= '(' && LA1_0 <= ')') || LA1_0 == '-' || (LA1_0 >= '0' && LA1_0 <= '9') || (LA1_0 >= 'A' && LA1_0 <= 'Z') || LA1_0 == '_' || (LA1_0 >= 'a' && LA1_0 <= 'z'))) { alt1 = 1; } switch (alt1) { case 1: { if (input.LA(1) == ' ' || (input.LA(1) >= '(' && input.LA(1) <= ')') || input.LA( 1) == '-' || (input.LA(1) >= '0' && input.LA(1) <= '9') || (input.LA( 1) >= 'A' && input.LA(1) <= 'Z') || input.LA( 1) == '_' || (input.LA(1) >= 'a' && input.LA(1) <= 'z')) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null, input); recover(mse); throw mse; } } break; default: break loop1; } } while (true); } state.type = _type; state.channel = _channel; } finally { } }
Source:
<code><START> public DataRecord getRecordFromReference(String reference) throws DataStoreException { <END> return null; }</code><technical_language>Need implement</technical_language>

Target:
public DataRecord getRecordFromReference(String reference) throws DataStoreException { Iterator<DataStore> iter = delegateHandler.getAllDelegatesIterator(); while (iter.hasNext()) { DataStore ds = iter.next(); DataRecord rec = ds.getRecordFromReference(reference); if (null != rec) { return rec; } } return null; }
Source:
<code>public MesosCloud( String mesosMasterUrl, String frameworkName, String frameworkId, String role, String agentUser, String jenkinsURL, List<? extends MesosAgentSpecTemplate> mesosAgentSpecTemplates) throws InterruptedException, ExecutionException, IOException { super("MesosCloud", null); try { this.master = mesosMasterUrl; this.jenkinsURL = new URL(jenkinsURL); } catch (MalformedURLException e) { throw new RuntimeException( String.format("Mesos Cloud URL validation failed for Jenkins %s", jenkinsURL), e); } if (selfIsMesosTask()) { String mesosSandbox = System.getenv("MESOS_SANDBOX"); this.sslCert = Optional.ofNullable(loadDcosCert(mesosSandbox)); this.dcosAuthorization = Optional.ofNullable(loadDcosAuthorization()); } else { this.sslCert = Optional.empty(); this.dcosAuthorization = Optional.empty(); } this.agentUser = agentUser; this.role = role; this.mesosAgentSpecTemplates = mesosAgentSpecTemplates; this.frameworkName = frameworkName; this.frameworkId = frameworkId; if (StringUtils.isEmpty(this.frameworkId)) { <START> logger.info("Framework ID was null."); <END> this.frameworkId = UUID.randomUUID().toString(); } this.mesosApi = MesosApi.getInstance( this.master, this.jenkinsURL, this.agentUser, this.frameworkName, this.frameworkId, this.role, this.sslCert, this.dcosAuthorization); }</code><technical_language>I log this "Subscribing Mesos a new Framework ID" put this next line log actual ID well. more helpful for debugging</technical_language>

Target:
public MesosCloud( String mesosMasterUrl, String frameworkName, String frameworkId, String role, String agentUser, String jenkinsURL, List<? extends MesosAgentSpecTemplate> mesosAgentSpecTemplates) throws InterruptedException, ExecutionException, IOException { super("MesosCloud", null); try { this.master = mesosMasterUrl; this.jenkinsURL = new URL(jenkinsURL); } catch (MalformedURLException e) { throw new RuntimeException( String.format("Mesos Cloud URL validation failed for Jenkins %s", jenkinsURL), e); } if (selfIsMesosTask()) { String mesosSandbox = System.getenv("MESOS_SANDBOX"); this.sslCert = Optional.ofNullable(loadDcosCert(mesosSandbox)); this.dcosAuthorization = Optional.ofNullable(loadDcosAuthorization()); } else { this.sslCert = Optional.empty(); this.dcosAuthorization = Optional.empty(); } this.agentUser = agentUser; this.role = role; this.mesosAgentSpecTemplates = mesosAgentSpecTemplates; this.frameworkName = frameworkName; this.frameworkId = frameworkId; if (StringUtils.isEmpty(this.frameworkId)) { this.frameworkId = UUID.randomUUID().toString(); } this.mesosApi = MesosApi.getInstance( this.master, this.jenkinsURL, this.agentUser, this.frameworkName, this.frameworkId, this.role, this.sslCert, this.dcosAuthorization); }
Source:
<code>private FlumeEventAvroEventDeserializer(Context context, ResettableInputStream ris) { this.ris = ris; <START> schemaType = AvroSchemaType.valueOf( <END> context.getString(CONFIG_SCHEMA_TYPE_KEY, AvroSchemaType.HASH.toString()).toUpperCase(Locale.ENGLISH)); if (schemaType == AvroSchemaType.LITERAL) { logger.warn(CONFIG_SCHEMA_TYPE_KEY + " set to " + AvroSchemaType.LITERAL.toString() + ", so storing full Avro " + "schema in the header of each event, which may be inefficient. " + "Consider using the hash of the schema " + "instead of the literal schema."); } }</code><technical_language>This (line 48-57) is a copy-paste AvroEventDeserializer. please simplify pushing (from AvroEventDeserializer) AbstractAvroEventDeserializer? If logic is moved parent class schemaType field changed private final</technical_language>

Target:
private FlumeEventAvroEventDeserializer(Context context, ResettableInputStream ris) { super(context, ris); }
Source:
<code>private ILogicalExpression data(ILogicalExpression expr) throws SystemException { <START> ILogicalExpression atomizedExpr = new ScalarFunctionCallExpression(BuiltinFunctions.FN_DATA_1, <END> Collections.singletonList(mutable(expr))); return atomizedExpr; }</code><technical_language>this function is statement, remove variable return statement</technical_language>

Target:
private ILogicalExpression data(ILogicalExpression expr) throws SystemException { return new ScalarFunctionCallExpression(BuiltinFunctions.FN_DATA_1, Collections.singletonList(mutable(expr))); }
Source:
<code>public void testSortingUpdatesPreferences() { assertThat(preferencesService.getPreferences().getGameListSorting(), hasSize(0)); instance.initializeGameTable(FXCollections.observableArrayList( GameBuilder.create().defaultValues().get(), GameBuilder.create().defaultValues().state(GameStatus.CLOSED).get() )); TableColumn<Game, ?> column = instance.gamesTable.getColumns().get(0); column.setSortType(SortType.ASCENDING); instance.gamesTable.getSortOrder().add(column); <START> assertThat(preferencesService.getPreferences().getGameListSorting(), hasSize(1)); <END> }</code><technical_language>ckeck for colum id sorting type</technical_language>

Target:
public void testSortingUpdatesPreferences() { assertThat(preferencesService.getPreferences().getGameListSorting(), hasSize(0)); instance.initializeGameTable(FXCollections.observableArrayList( GameBuilder.create().defaultValues().get(), GameBuilder.create().defaultValues().state(GameStatus.CLOSED).get() )); TableColumn<Game, ?> column = instance.gamesTable.getColumns().get(0); column.setSortType(SortType.ASCENDING); instance.gamesTable.getSortOrder().add(column); assertThat(preferencesService.getPreferences().getGameListSorting(), hasSize(1)); assertThat( preferencesService.getPreferences().getGameListSorting().get(0), equalTo(new Pair<>("passwordProtectionColumn", SortType.ASCENDING)) ); }
Source:
<code>public <T> T getDefaultPlugin(Class<T> pluginType) { <START> if (pluginType == InstantiatorProvider.class) { <END> String className = DEFAULT_PLUGINS.get(InstantiatorProvider2.class.getName()); return (T)new InstantiatorProvider2Wrapper(create(InstantiatorProvider2.class, className)); } else { String className = DEFAULT_PLUGINS.get(pluginType.getName()); return create(pluginType, className); } }</code><technical_language>This is smart, thank you</technical_language>

Target:
public <T> T getDefaultPlugin(Class<T> pluginType) { if (pluginType == InstantiatorProvider.class) { String className = DEFAULT_PLUGINS.get(InstantiatorProvider2.class.getName()); return pluginType.cast(new InstantiatorProvider2Wrapper(create(InstantiatorProvider2.class, className))); } else { String className = DEFAULT_PLUGINS.get(pluginType.getName()); return create(pluginType, className); } }
Source:
<code>public void testNamespaceOps() throws Exception { String testNamespace = "testnamespace"; String testNamespace2 = "testnamespace2"; assertEquals("", client.defaultNamespace(creds)); assertEquals("accumulo", client.systemNamespace(creds)); client.createNamespace(creds, testNamespace); assertTrue(client.namespaceExists(creds, testNamespace)); <START> assertTrue(client.listNamespaces(creds).contains(testNamespace)); <END> client.renameNamespace(creds, testNamespace, testNamespace2); assertTrue(client.namespaceExists(creds, testNamespace2)); assertFalse(client.namespaceExists(creds, testNamespace)); client.deleteNamespace(creds, testNamespace2); assertFalse(client.namespaceExists(creds, testNamespace2)); }</code><technical_language>good check size of returned list. This test catch unexpected junk in returned list</technical_language>

Target:
public void testNamespaceOps() throws Exception { String testNamespace = "testnamespace"; String testNamespace2 = "testnamespace2"; assertEquals("", client.defaultNamespace(creds)); assertEquals("accumulo", client.systemNamespace(creds)); Set<String> namespaceList = client.listNamespaces(creds); for (String ns : namespaceList) { System.out.println("Found NS: " + ns); } assertEquals(2, namespaceList.size()); assertEquals(2, client.namespaceIdMap(creds).size()); client.createNamespace(creds, testNamespace); assertTrue(client.namespaceExists(creds, testNamespace)); assertTrue(client.listNamespaces(creds).contains(testNamespace)); client.renameNamespace(creds, testNamespace, testNamespace2); assertTrue(client.namespaceExists(creds, testNamespace2)); assertFalse(client.namespaceExists(creds, testNamespace)); client.deleteNamespace(creds, testNamespace2); assertFalse(client.namespaceExists(creds, testNamespace2)); client.createNamespace(creds, testNamespace); String systemTableSplitThreshold = client.getSystemConfiguration(creds).get("table.split.threshold"); Map<String,String> orig = client.getNamespaceProperties(creds, testNamespace); client.setNamespaceProperty(creds, testNamespace, "table.split.threshold", "500M"); Map<String,String> update = client.getNamespaceProperties(creds, testNamespace); assertEquals(update.get("table.split.threshold"), "500M"); assertEquals(systemTableSplitThreshold, client.getSystemConfiguration(creds).get("table.split.threshold")); client.removeNamespaceProperty(creds, testNamespace, "table.split.threshold"); update = client.getNamespaceProperties(creds, testNamespace); assertEquals(orig, update); }
Source:
<code>public void testUndefined() throws Exception { ModelNode node = new ModelNode(); node.get("result"); assertFalse(node, "result != undefined"); assertFalse(node, "result != \"undefined\""); <START> assertFalse(node, "result != 'undefined'"); <END> node.get("result").set("undefined"); assertFalse(node, "result != undefined"); }</code><technical_language>lines resolve true</technical_language>

Target:
public void testUndefined() throws Exception { ModelNode node = new ModelNode(); node.get("result"); assertFalse(node, "result != undefined"); assertTrue(node, "result != \"undefined\""); assertTrue(node, "result != 'undefined'"); node.get("result").set("undefined"); assertTrue(node, "result != undefined"); }
Source:
<code>public boolean currentUserExists() { Authentication principal = SecurityContextHolder.getContext().getAuthentication(); if (Objects.isNull(principal)) { <START> LOGGER.info("No current user"); <END> return false; } Optional<AthenaProfile> optional = UserProfileUtil.getProfile(principal); return optional.isPresent() && Objects.nonNull(optional.get().getAthenaUser()); }</code><technical_language>fired often. change debug logging</technical_language>

Target:
public boolean currentUserExists() { Authentication principal = SecurityContextHolder.getContext().getAuthentication(); if (Objects.isNull(principal) || "anonymousUser".equals(principal.getPrincipal())) { LOGGER.debug("No current user"); return false; } Optional<AthenaProfile> optional = UserProfileUtil.getProfile(principal); return optional.isPresent() && Objects.nonNull(optional.get().getAthenaUser()); }
Source:
<code>private void chooseNames() { names.clearAnimation(); <START> <END> if (listState.getNumNames() > 0) { List<Integer> chosenIndexes = NameUtils.getRandomNumsInRange( settings.getNumNamesToChoose(), listState.getNumInstances() - 1); chosenNamesText = listState.chooseNames(chosenIndexes, settings); names.setAlpha(0.0f); names.setText(chosenNamesText); playSound(); } else { UIUtils.showLongToast(R.string.no_names_left, this); } }</code><technical_language>need ask TextToSpeechManager stop speaking here</technical_language>

Target:
private void chooseNames() { names.clearAnimation(); textToSpeechManager.stopSpeaking(); if (listState.getNumNames() > 0) { List<Integer> chosenIndexes = NameUtils.getRandomNumsInRange( settings.getNumNamesToChoose(), listState.getNumInstances() - 1); chosenNamesText = listState.chooseNames(chosenIndexes, settings); names.setAlpha(0.0f); names.setText(chosenNamesText); playSound(); } else { UIUtils.showLongToast(R.string.no_names_left, this); } }