auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void proceedGuaranteedMemoryCheck() { for (VmInternalData vmInternalData : _runningVms.values()) { VM savedVm = _vmDict.get(vmInternalData.getVmDynamic().getId()); VmStatistics vmStatistics = vmInternalData.getVmStatistics(); if (vmStatistics.getCurrentMemory() != null && <START> savedVm.getMinAllocatedMem() > vmStatistics.getCurrentMemory()) { <END> AuditLogableBase auditLogable = new AuditLogableBase(); auditLogable.addCustomValue("VmName", savedVm.getName()); auditLogable.addCustomValue("VdsName", this._vds.getName()); auditLogable.addCustomValue("MemGuaranteed", String.valueOf(savedVm.getMinAllocatedMem())); auditLogable.addCustomValue("MemActual", vmStatistics.getCurrentMemory().toString()); auditLog(auditLogable, AuditLogType.VM_MEMORY_UNDER_GUARANTEED_VALUE); } } }</code><technical_language>getCurrentMemory return 0 null if balloon device, in case trigger a redundant alert. Please check if getCurrentMemory > 0 if guaranteed. Thanks</technical_language>

Target:
private void proceedGuaranteedMemoryCheck() { for (VmInternalData vmInternalData : _runningVms.values()) { VM savedVm = _vmDict.get(vmInternalData.getVmDynamic().getId()); VmStatistics vmStatistics = vmInternalData.getVmStatistics(); if (vmStatistics.getCurrentMemory() != null && vmStatistics.getCurrentMemory() > 0 && savedVm.getMinAllocatedMem() > vmStatistics.getCurrentMemory() / TO_MEGA_BYTES) { AuditLogableBase auditLogable = new AuditLogableBase(); auditLogable.addCustomValue("VmName", savedVm.getName()); auditLogable.addCustomValue("VdsName", this._vds.getName()); auditLogable.addCustomValue("MemGuaranteed", String.valueOf(savedVm.getMinAllocatedMem())); auditLogable.addCustomValue("MemActual", vmStatistics.getCurrentMemory().toString()); auditLog(auditLogable, AuditLogType.VM_MEMORY_UNDER_GUARANTEED_VALUE); } } }
Source:
<code>private void establishHistoryLimit() { int historyLimit= SearchPreferencePage.getHistoryLimit(); QueryManager searchManager= getSearchManager(); if (historyLimit >= searchManager.getSize()) { return; } int numberQueriesNotShown= 0; SearchViewManager searchViewManager= getSearchViewManager(); ISearchQuery[] queries= searchManager.getQueries(); <START> for (ISearchQuery querie : queries) { <END> ISearchQuery query= querie; if (!searchViewManager.isShown(query)) { if (++numberQueriesNotShown >= historyLimit) { removeQuery(query); } } } }</code><technical_language>need for intermediate querie - query line is needed</technical_language>

Target:
private void establishHistoryLimit() { int historyLimit= SearchPreferencePage.getHistoryLimit(); QueryManager searchManager= getSearchManager(); if (historyLimit >= searchManager.getSize()) { return; } int numberQueriesNotShown= 0; SearchViewManager searchViewManager= getSearchViewManager(); ISearchQuery[] queries= searchManager.getQueries(); for (ISearchQuery query : queries) { if (!searchViewManager.isShown(query)) { if (++numberQueriesNotShown >= historyLimit) { removeQuery(query); } } } }
Source:
<code>getTabletServers(@QueryParam("s") @Pattern(regexp = HOSTNAME_PORT_REGEX) String server) { Map<String,Object> model = getModel(); model.put("title", "Tablet Server Status"); <START> if (!server.isBlank()) { <END> model.put("template", "server.ftl"); model.put("js", "server.js"); model.put("server", server); return model; } model.put("template", "tservers.ftl"); model.put("js", "tservers.js"); return model; }</code><technical_language>This null, I think</technical_language>

Target:
getTabletServers(@QueryParam("s") @Pattern(regexp = HOSTNAME_PORT_REGEX) String server) { Map<String,Object> model = getModel(); model.put("title", "Tablet Server Status"); if (server != null && !server.isBlank()) { model.put("template", "server.ftl"); model.put("js", "server.js"); model.put("server", server); return model; } model.put("template", "tservers.ftl"); model.put("js", "tservers.js"); return model; }
Source:
<code>public void setCanonicalizationMethod(String cMethod) { if (Arrays.stream(VALID_CANONICALIZATION_METHODS.split("\\s*,\\s*")).noneMatch(cMethod.toUpperCase()::equals)) { <START> throw new SlimFixtureException(false, "Invalid canonicalization method: " + cMethod.toUpperCase() + ". Valid options: " + Arrays.toString(VALID_CANONICALIZATION_METHODS.split("\\s*,\\s*"))); <END> } signatureCanonicalizationMethod = getStringValueFromField(CanonicalizationMethod.class, cMethod.toUpperCase()); }</code><technical_language>suggestion throw new SlimFixtureException(false, "Invalid canonicalization method: " + cMethod.toUpperCase() + ". Valid options: " + VALID_CANONICALIZATION_METHODS);</technical_language>

Target:
public void setCanonicalizationMethod(String cMethod) { if (Arrays.stream(VALID_CANONICALIZATION_METHODS.split("\\s*,\\s*")).noneMatch(cMethod.toUpperCase()::equals)) { throw new SlimFixtureException(false, "Invalid canonicalization method: " + cMethod.toUpperCase() + ". Valid options: " + VALID_CANONICALIZATION_METHODS); } signatureCanonicalizationMethod = getStringValueFromField(CanonicalizationMethod.class, cMethod.toUpperCase()); }
Source:
<code>private BriefcaseAnalytics() { <START> config = new GoogleAnalyticsConfig(); <END> checkTrackingConsentState(); this.googleAnalytics = new GoogleAnalytics(config, GOOGLE_TRACKING_ID); }</code><technical_language>This line longer needed</technical_language>

Target:
private BriefcaseAnalytics() { }
Source:
<code>public void afterCompletion(int status) { <START> if (status == 3) { <END> StreamWorkManager.this.schedule(this.work, this.scheduling, false); } else { if (status != 4) { throw new IllegalArgumentException("Unsupported transaction status " + status); } } }</code><technical_language>status == Status.STATUS_COMMITTED</technical_language>

Target:
public void afterCompletion(int status) { if (status == Status.STATUS_COMMITTED) { StreamWorkManager.this.schedule(this.work, this.scheduling, false); } else { if (status != Status.STATUS_ROLLEDBACK) { throw new IllegalArgumentException("Unsupported transaction status " + status); } } }
Source:
<code>public void checkImmutability() throws Exception { final Collection<Class<?>> result = classpath.allTypes(); final Class<? extends Annotation> expected = Immutable.class; final Set<String> skip = this.skip(); for (final Class<?> clazz : result) { if (skip.contains(clazz.getName())) { continue; } <START> MatcherAssert.assertThat( <END> String.format( "Class %s should have annotation %s", clazz.getName(), expected.getSimpleName() ), clazz.isAnnotationPresent(expected), Matchers.is(true) ); } }</code><technical_language>is wrong this implementation is fail once, class. in order catch next run JUnit again. Instead, do: java MatcherAssert.assertThat( Iterables.filter( classpath.allTypes(), new Predicate<Class<?>>() { // filter out if of types want exclude } ), Matchers.everyItem( new CustomMatcher<Class<?>>("annotated type") { // .. } ) );</technical_language>

Target:
public void checkImmutability() throws Exception { MatcherAssert.assertThat( Iterables.filter( this.classpath.allTypes(), new Predicate<Class<?>>() { @Override public boolean apply(final Class<?> input) { return !skip().contains(input.getName()); } } ), Matchers.everyItem( new CustomTypeSafeMatcher<Class<?>>("annotated type") { @Override protected boolean matchesSafely(final Class<?> item) { return item.isAnnotationPresent(Immutable.class); } } ) ); }
Source:
<code>public RuleMatch[] match(AnalyzedSentence sentence) throws IOException { List<RuleMatch> matches = new ArrayList<>(); Set<String> ignoredWords = ignoredWordsCache.getUnchecked(language); for (AnalyzedTokenReadings token : sentence.getTokensWithoutWhitespace()) { <START> if (token.isSentenceStart() || token.isSentenceEnd() || token.isNonWord()) <END> continue; String word = token.getToken(); if (ignoredWords.contains(word)) { continue; } List<String> candidates = filterCandidates(getSpellerMatches(word, defaultDictSpeller)); List<String> userCandidates = getSpellerMatches(word, userDictSpeller); RuleMatch match = null; if (candidates.size() + userCandidates.size() == 0) { match = new RuleMatch(this, sentence, token.getStartPos(), token.getEndPos(), "Misspelling or unknown word!"); } else if (!(candidates.size() > 0 && candidates.get(0).equals(word) || userCandidates.size() > 0 && userCandidates.get(0).equals(word))) { match = new RuleMatch(this, sentence, token.getStartPos(), token.getEndPos(), "Misspelling!"); addSuggestionsToRuleMatch(token.getToken(), userCandidates, candidates, orderer, match); } if (match != null) { matches.add(match); } } return matches.toArray(new RuleMatch[0]); }</code><technical_language>token.isSentenceEnd()? cases sentence ends a word</technical_language>

Target:
public RuleMatch[] match(AnalyzedSentence sentence) throws IOException { List<RuleMatch> matches = new ArrayList<>(); Set<String> ignoredWords = ignoredWordsCache.getUnchecked(language); for (AnalyzedTokenReadings token : sentence.getTokensWithoutWhitespace()) { if (token.isSentenceStart() || token.isImmunized() || token.isIgnoredBySpeller() || token.isNonWord()) continue; String word = token.getToken(); if (ignoredWords.contains(word)) { continue; } List<String> candidates = filterCandidates(getSpellerMatches(word, defaultDictSpeller)); List<String> userCandidates = getSpellerMatches(word, userDictSpeller); RuleMatch match = null; if (candidates.size() + userCandidates.size() == 0) { match = new RuleMatch(this, sentence, token.getStartPos(), token.getEndPos(), "Misspelling or unknown word!"); } else if (!(candidates.size() > 0 && candidates.get(0).equals(word) || userCandidates.size() > 0 && userCandidates.get(0).equals(word))) { match = new RuleMatch(this, sentence, token.getStartPos(), token.getEndPos(), "Misspelling!"); addSuggestionsToRuleMatch(token.getToken(), userCandidates, candidates, orderer, match); } if (match != null) { matches.add(match); } } return matches.toArray(new RuleMatch[0]); }
Source:
<code><START> public void goToDiffPageFromHistoryPage() { <END> historySubmit.click(); waitForTextToBePresentInElementByElement(diffHeader, "Changes"); }</code><technical_language>this method suppose return instance of DiffPagePageObject class, redirecting diff page beginning of method be: public DiffPagePageObject goToDiffPageFromHistoryPage() step return new object: return new DiffPagePageObject(driver);</technical_language>

Target:
public DiffPagePageObject goToDiffPageFromHistoryPage() { historySubmit.click(); waitForTextToBePresentInElementByElement(diffHeader, "Changes"); return new DiffPagePageObject(driver); }
Source:
<code>public static void main(final String[] args) throws Exception { final LoadGeneratorCommandLineConfig config = new LoadGeneratorCommandLineConfig(); JCommander jCommander = new JCommander(config, args); if (config.displayUsage) { jCommander.usage(); } else { injector = Guice.createInjector( Stage.PRODUCTION, new ConfigurationModule(new ConfigurationFactory(ImmutableMap.<String, String>of())), new LifeCycleModule(), new ThriftCodecModule(), new ThriftClientModule(), new Module() { @Override public void configure(Binder binder) { thriftClientBinder(binder).bindThriftClient(AsyncClientWorker.LoadTest.class); thriftClientBinder(binder).bindThriftClient(SyncClientWorker.LoadTest.class); binder.bind(LoadGeneratorCommandLineConfig.class).toInstance(config); binder.bind(LoadGenerator.class).in(Singleton.class); if (!config.asyncMode) { binder.bind(AbstractClientWorker.class).to(SyncClientWorker.class); } else { binder.bind(AbstractClientWorker.class).to(AsyncClientWorker.class); } TypeLiteral<NiftyClientChannel.Factory<? extends NiftyClientChannel>> channelFactoryType = new TypeLiteral<NiftyClientChannel.Factory<? extends NiftyClientChannel>>() {}; if (config.transport == TransportType.FRAMED) { binder.bind(channelFactoryType) .to(FramedClientChannel.Factory.class); <START> } else if (config.transport == TransportType.UNFRAMED) { <END> binder.bind(channelFactoryType) .to(UnframedClientChannel.Factory.class); } else { throw new IllegalStateException("Unknown transport"); } } } ); injector.getInstance(LifeCycleManager.class).start(); } }</code><technical_language>this a switch(config.transport) { ... } config.getTransport()</technical_language>

Target:
public static void main(final String[] args) throws Exception { final LoadGeneratorCommandLineConfig config = new LoadGeneratorCommandLineConfig(); JCommander jCommander = new JCommander(config, args); if (config.displayUsage) { jCommander.usage(); } else { injector = Guice.createInjector( Stage.PRODUCTION, new ConfigurationModule(new ConfigurationFactory(ImmutableMap.<String, String>of())), new LifeCycleModule(), new ThriftCodecModule(), new ThriftClientModule(), new Module() { @Override public void configure(Binder binder) { thriftClientBinder(binder).bindThriftClient(AsyncClientWorker.LoadTest.class); thriftClientBinder(binder).bindThriftClient(SyncClientWorker.LoadTest.class); binder.bind(LoadGeneratorCommandLineConfig.class).toInstance(config); binder.bind(LoadGenerator.class).in(Singleton.class); if (!config.asyncMode) { binder.bind(AbstractClientWorker.class).to(SyncClientWorker.class); } else { binder.bind(AbstractClientWorker.class).to(AsyncClientWorker.class); } TypeLiteral<NiftyClientChannel.Factory<? extends NiftyClientChannel>> channelFactoryType = new TypeLiteral<NiftyClientChannel.Factory<? extends NiftyClientChannel>>() {}; switch (config.transport) { case FRAMED: binder.bind(channelFactoryType) .to(FramedClientChannel.Factory.class); break; case UNFRAMED: binder.bind(channelFactoryType) .to(UnframedClientChannel.Factory.class); break; default: throw new IllegalStateException("Unknown transport"); } } } ); injector.getInstance(LifeCycleManager.class).start(); } }
Source:
<code>public void testNativePlugin() throws Exception { BuildTarget pluginTarget = BuildTargetFactory.newInstance(" workspace.runBuckCommand("build", pluginTarget.toString()).assertSuccess(); BuildTarget binTarget = BuildTargetFactory.newInstance(" workspace.runBuckCommand("build", binTarget.toString()).assertSuccess(); Path ocamlNativePluginDir = <START> workspace.getDestPath().resolve("buck-out").resolve("gen").resolve("ce9b6f2e").resolve("ocaml_native_plugin"); <END> Path pluginCmxsFile = ocamlNativePluginDir.resolve("plugin#default").resolve("libplugin.cmxs"); Path testerExecutableFile = ocamlNativePluginDir.resolve("tester").resolve("tester"); String out = workspace .runCommand(testerExecutableFile.toString(), pluginCmxsFile.toString()) .getStdout() .get(); assertEquals("it works!\n", out); }</code><technical_language>if hard code this</technical_language>

Target:
public void testNativePlugin() throws Exception { BuildTarget pluginTarget = BuildTargetFactory.newInstance(" workspace.runBuckCommand("build", pluginTarget.toString()).assertSuccess(); BuildTarget binTarget = BuildTargetFactory.newInstance(" workspace.runBuckCommand("build", binTarget.toString()).assertSuccess(); Path ocamlNativePluginDir = workspace.getPath( BuildTargetPaths.getGenPath( workspace.getProjectFileSystem(), pluginTarget, "%s" )).getParent(); Path pluginCmxsFile = ocamlNativePluginDir.resolve("plugin#default").resolve("libplugin.cmxs"); Path testerExecutableFile = ocamlNativePluginDir.resolve("tester").resolve("tester"); String out = workspace .runCommand(testerExecutableFile.toString(), pluginCmxsFile.toString()) .getStdout() .get(); assertEquals("it works!\n", out); }
Source:
<code>protected <T> T handleError(Class<T> clz, Exception e, boolean notFoundAs404) { if ((e instanceof EntityNotFoundException) && (notFoundAs404)) { throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build()); } else if ((e instanceof BackendFailureException) && (!StringUtils.isEmpty(e.getMessage()))) { log.error(localize(Messages.BACKEND_FAILED_TEMPLATE), e.getMessage()); BackendFailureException e2 = (BackendFailureException) e; throw new WebFaultException(null, e.getMessage(), e2.getHttpStatus() != null ? e2.getHttpStatus() : Response.Status.BAD_REQUEST); } else if (e instanceof WebFaultException) { WebFaultException e2 = (WebFaultException) e; log.error(localize(Messages.BACKEND_FAILED_TEMPLATE), e2.getMessage()); <START> log.debug("Exception", e2); <END> throw e2; } else { log.error(localize(Messages.BACKEND_FAILED_TEMPLATE), e.getMessage()); log.debug("Exception", e); throw new WebFaultException(e, detail(e), Response.Status.INTERNAL_SERVER_ERROR); } }</code><technical_language>stack trace level message</technical_language>

Target:
protected <T> T handleError(Class<T> clz, Exception e, boolean notFoundAs404) { if ((e instanceof EntityNotFoundException) && (notFoundAs404)) { throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build()); } else if ((e instanceof BackendFailureException) && (!StringUtils.isEmpty(e.getMessage()))) { log.error(localize(Messages.BACKEND_FAILED_TEMPLATE), e.getMessage()); BackendFailureException e2 = (BackendFailureException) e; throw new WebFaultException(null, e.getMessage(), e2.getHttpStatus() != null ? e2.getHttpStatus() : Response.Status.BAD_REQUEST); } else if (e instanceof WebFaultException) { WebFaultException e2 = (WebFaultException) e; log.error(localize(Messages.BACKEND_FAILED_TEMPLATE), e2.getMessage()); log.error("Exception", e2); throw e2; } else { log.error(localize(Messages.BACKEND_FAILED_TEMPLATE), e.getMessage()); log.error("Exception", e); throw new WebFaultException(e, detail(e), Response.Status.INTERNAL_SERVER_ERROR); } }
Source:
<code>void handlePrefsDialog(final ClientPrefsOpenedEvent event) { final PreferencesCategory category = new PreferencesCategory("Channel Who", "Provides " + <START> "support for sendinw WHO requests to channels at regular intervals"); <END> category.addSetting(new PreferencesSetting(PreferencesType.DURATION, new NumericalValidator(0, Integer.MAX_VALUE), domain, "whointerval", "Who Interval", "The interval WHO requests will be sent to channels", event.getModel().getConfigManager(), event.getModel().getIdentity())); }</code><technical_language>s/sendinw/sending/</technical_language>

Target:
void handlePrefsDialog(final ClientPrefsOpenedEvent event) { final PreferencesCategory category = new PreferencesCategory("Channel Who", "Provides " + "support for sending WHO requests to channels at regular intervals"); category.addSetting(new PreferencesSetting(PreferencesType.DURATION, new NumericalValidator(0, Integer.MAX_VALUE), domain, "whointerval", "Who Interval", "The interval WHO requests will be sent to channels", event.getModel().getConfigManager(), event.getModel().getIdentity())); }
Source:
<code>private static void showNotification(int newEpisodes, Feed feed, Context context, NotificationManagerCompat notificationManager) { Resources res = context.getResources(); String text = res.getQuantityString( R.plurals.new_episode_notification_message, newEpisodes, newEpisodes, feed.getTitle() ); String title = res.getQuantityString(R.plurals.new_episode_notification_title, newEpisodes); Intent intent = new Intent(); intent.setComponent(new ComponentName(context, "de.danoeh.antennapod.activity.MainActivity")); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); intent.putExtra("fragment_feed_id", feed.getId()); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); Notification notification = new NotificationCompat.Builder( context, NotificationUtils.CHANNEL_ID_EPISODE_NOTIFICATIONS <START> ) <END> .setSmallIcon(R.drawable.ic_notification) .setContentTitle(title) .setContentText(text) .setContentIntent(pendingIntent) .setGroup(GROUP_KEY) .setAutoCancel(true) .build(); notificationManager.notify(NotificationUtils.CHANNEL_ID_EPISODE_NOTIFICATIONS, feed.hashCode(), notification); }</code><technical_language>Please move this ) line</technical_language>

Target:
private static void showNotification(int newEpisodes, Feed feed, Context context, NotificationManagerCompat notificationManager) { Resources res = context.getResources(); String text = res.getQuantityString( R.plurals.new_episode_notification_message, newEpisodes, newEpisodes, feed.getTitle() ); String title = res.getQuantityString(R.plurals.new_episode_notification_title, newEpisodes); Intent intent = new Intent(); intent.setComponent(new ComponentName(context, "de.danoeh.antennapod.activity.MainActivity")); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); intent.putExtra("fragment_feed_id", feed.getId()); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); Notification notification = new NotificationCompat.Builder( context, NotificationUtils.CHANNEL_ID_EPISODE_NOTIFICATIONS) .setSmallIcon(R.drawable.ic_notification) .setContentTitle(title) .setContentText(text) .setContentIntent(pendingIntent) .setGroup(GROUP_KEY) .setAutoCancel(true) .setCategory(res.getString(R.string.notification_group_news)) .build(); notificationManager.notify(NotificationUtils.CHANNEL_ID_EPISODE_NOTIFICATIONS, feed.hashCode(), notification); }
Source:
<code>public void consume(String message) { logger.info("[MQ] receive message: {}: {}.", this.queue(), message); if (Strings.isNullOrEmpty(message)) { logger.error("[MQ] message is empty"); return; } try { String loginName = message; Date date = new Date(); if (date.before(activityStartTime) || date.after(activityEndTime)) { logger.info("[MQ] NewYearActivity_Coupon, new year activity not in the activity time range"); return; } String key = MessageFormat.format(KEY, loginName); if (redisWrapperClient.exists(key)) { logger.info(MessageFormat.format("{0}:已经领取了新年更有钱优惠券", loginName)); return; } List<Long> coupons = Arrays.asList(481L, 481L, 481L, 482L, 482L, 482L, 482L, 482L); coupons.stream().forEach(couponId -> { logger.info(MessageFormat.format("[NewYearActivity_Coupon] loginName:{0},couponId:{1} send message begin", loginName, couponId)); <START> mqWrapperClient.sendMessage(MessageQueue.CouponAssigning, loginName + ":" + couponId); <END> logger.info(MessageFormat.format("[NewYearActivity_Coupon] loginName:{0},couponId:{1} send message end", loginName, couponId)); }); redisWrapperClient.setex(key, lifeSecond,"SUCCESS"); } catch (Exception e) { logger.error("[MQ] 程序內部异常: {}: {}.{}", this.queue(), message, e.getMessage()); } }</code><technical_language>try</technical_language>

Target:
public void consume(String message) { logger.info("[MQ] receive message: {}: {}.", this.queue(), message); if (Strings.isNullOrEmpty(message)) { logger.error("[MQ] message is empty"); return; } try { String loginName = message; Date date = new Date(); if (date.before(activityStartTime) || date.after(activityEndTime)) { logger.info("[MQ] NewYearActivity_Coupon, new year activity not in the activity time range"); return; } String key = MessageFormat.format(KEY, loginName); if (redisWrapperClient.exists(key)) { logger.info(MessageFormat.format("{0}:已经领取了新年更有钱优惠券", loginName)); return; } List<Long> coupons = Arrays.asList(481L, 481L, 481L, 482L, 482L, 482L, 482L, 482L); coupons.stream().forEach(couponId -> { try { logger.info(MessageFormat.format("[NewYearActivity_Coupon] loginName:{0},couponId:{1} send message begin", loginName, couponId)); mqWrapperClient.sendMessage(MessageQueue.CouponAssigning, loginName + ":" + couponId); logger.info(MessageFormat.format("[NewYearActivity_Coupon] loginName:{0},couponId:{1} send message end", loginName, couponId)); }catch (Exception e){ logger.error(MessageFormat.format("[NewYearActivity_Coupon] loginName:{0},couponId:{1} send message fail", loginName, couponId)); smsWrapperClient.sendFatalNotify(new SmsFatalNotifyDto(MessageFormat.format("【新年更有钱活动】用户:{0}, 优惠券:{1}, 发送优惠券失败, 业务处理异常", loginName, couponId))); } }); redisWrapperClient.setex(key, lifeSecond,"SUCCESS"); } catch (Exception e) { logger.error("[MQ] 程序內部异常: {}: {}.{}", this.queue(), message, e.getMessage()); } }
Source:
<code>public <T> T get(Class<T> type, String key) throws IOException { final DocumentMapping mapping = admin.mappings().getMapping(type); final GetResponse response = admin.client() .prepareGet(admin.name(), mapping.typeAsString(), key) .setRouting(mapping.typeAsString()) .setFetchSource(true) .get(); if (response.isExists()) { <START> return mapper.readValue(response.getSourceAsBytes(), type); <END> } else { return null; } }</code><technical_language>this counts, get BytesReference content response response.getSourceAsBytesRef() pass readValue(byte[], int, int, Class<?>) avoid back-and-forth conversions</technical_language>

Target:
public <T> T get(Class<T> type, String key) throws IOException { final DocumentMapping mapping = admin.mappings().getMapping(type); final GetResponse response = admin.client() .prepareGet(admin.name(), mapping.typeAsString(), key) .setRouting(mapping.typeAsString()) .setFetchSource(true) .get(); if (response.isExists()) { final BytesReference bytesRef = response.getSourceAsBytesRef(); return mapper.readValue(bytesRef.array(), bytesRef.arrayOffset(), bytesRef.length(), type); } else { return null; } }
Source:
<code><START> public Object clone() { <END> final RetryOptions cloned = (RetryOptions) getRetryOptions().clone(); return new FixedRetryPolicy(cloned); }</code><technical_language>Return type FixedRetryPolicy instead of Object. Also, is recommended a copy constructor override clone(). <LINK_0></technical_language>

Target:
public RetryPolicy clone() { final RetryOptions cloned = getRetryOptions().clone(); return new FixedRetryPolicy(cloned); }
Source:
<code>public void init() { <START> URI uri = spacesAPI.resolveFileSystemURI(SpacesAPI.Scheme.DEFAULT, <END> SpacesAPI.DASHBUILDER_SPACE, "navigation"); HashMap<String, Object> env = new HashMap<String, Object>() {{ put("init", Boolean.TRUE); put("internal", Boolean.TRUE); }}; fileSystem = ioService.getOrNewFileSystem(uri, env); root = fileSystem.getRootDirectories().iterator().next(); }</code><technical_language>If a producer inject this class here: @Named("navigationFS") Filesystem fileSystem</technical_language>

Target:
public void init() { root = fileSystem.getRootDirectories().iterator().next(); }
Source:
<code>public void populateSparkWebUrl(InterpreterContext ctx) { if (sparkUrl == null) { sparkUrl = getSparkUIUrl(); Map<String, String> infos = new java.util.HashMap<>(); if (sparkUrl != null) { infos.put("url", sparkUrl); <START> logger.info("Sending metainfos to Zeppelin server: {}", infos.toString()); <END> if (ctx != null && ctx.getClient() != null) { getZeppelinContext().setEventClient(ctx.getClient()); ctx.getClient().onMetaInfosReceived(infos); } } } }</code><technical_language>put logging in if block ? else block ? happen</technical_language>

Target:
public void populateSparkWebUrl(InterpreterContext ctx) { if (sparkUrl == null) { sparkUrl = getSparkUIUrl(); Map<String, String> infos = new java.util.HashMap<>(); if (sparkUrl != null) { infos.put("url", sparkUrl); if (ctx != null && ctx.getClient() != null) { logger.info("Sending metainfos to Zeppelin server: {}", infos.toString()); getZeppelinContext().setEventClient(ctx.getClient()); ctx.getClient().onMetaInfosReceived(infos); } } } }
Source:
<code>public void testDefaultScriptExtension() throws Exception { ScriptMetadata metadata = ScriptMetadataParser.parse("test", " assertEquals("test", metadata.name()); <START> metadata = ScriptMetadataParser.parse("test.", " "); <END> assertEquals("test.", metadata.name()); }</code><technical_language>This test divided 2 separate test cases</technical_language>

Target:
public void testDefaultScriptExtension() throws Exception { ScriptMetadata metadata = ScriptMetadataParser.parse("test", " assertEquals("test", metadata.name()); }
Source:
<code>private String listToSemicolonSeparatedString(List<String> cookieStrings) { StringBuilder builder = new StringBuilder(); int index = 1; for (String cookieString : cookieStrings) { builder.append(cookieString); <START> if (index != cookieStrings.size()) { <END> builder.append("; "); } } return builder.toString(); }</code><technical_language>I meant index++ here? do support java 7? Java 8 String.join()</technical_language>

Target:
private String listToSemicolonSeparatedString(List<String> cookieStrings) { StringBuilder builder = new StringBuilder(); int index = 0; for (String cookieString : cookieStrings) { builder.append(cookieString); if (++index != cookieStrings.size()) { builder.append("; "); } } return builder.toString(); }
Source:
<code>public String getMessage() { String baseMessage = super.getMessage(); if (this.errorCodeValue == null) { return super.getMessage(); } else { <START> baseMessage = String.format(Locale.US, "%s %s: {%s}", baseMessage, "ErrorCodeValue", <END> errorCodeValue); } if (this.target == null) { return baseMessage; } else { baseMessage = String.format(Locale.US, "%s %s: {%s}", baseMessage, "target", target); } return baseMessage; }</code><technical_language>Locale.ROOT instead of Locale.US</technical_language>

Target:
public String getMessage() { StringBuilder baseMessage = new StringBuilder().append(super.getMessage()).append(" ").append(ERROR_CODE) .append(": {").append(errorCodeValue).append("}"); if (this.target == null) { return baseMessage.toString(); } else { return baseMessage.append(", ").append(TARGET).append(": {").append(target).append("}").toString(); } }
Source:
<code>@Override public TraceContextOrSamplingFlags extract(C carrier) { if (carrier == null) throw new NullPointerException("carrier == null"); TraceContext.Builder result = TraceContext.newBuilder(); String sampled = getter.get(carrier, propagation.sampledKey); Boolean sampledV = sampled != null ? sampled.equals("1") || sampled.equalsIgnoreCase("true") : null; boolean debug = "1".equals(getter.get(carrier, propagation.debugKey)); if (!result.parseTraceId(getter, carrier, propagation.traceIdKey)) { return TraceContextOrSamplingFlags.create( debug ? SamplingFlags.DEBUG : SamplingFlags.Builder.build(sampledV) ); } if (result.parseSpanId(getter, carrier, propagation.spanIdKey) && result.parseParentId(getter, carrier, propagation.parentSpanIdKey)) { return TraceContextOrSamplingFlags.create(result.sampled(sampledV).debug(debug).build()); } <START> return TraceContextOrSamplingFlags.EMPTY; END> }</code><technical_language>sample information if parse of span/trace ID fail</technical_language>

Target:
@Override public TraceContextOrSamplingFlags extract(C carrier) { if (carrier == null) throw new NullPointerException("carrier == null"); String sampled = getter.get(carrier, propagation.sampledKey); Boolean sampledV = sampled != null ? sampled.equals("1") || sampled.equalsIgnoreCase("true") : null; boolean debug = "1".equals(getter.get(carrier, propagation.debugKey)); String traceIdString = getter.get(carrier, propagation.traceIdKey); if (traceIdString == null) { return TraceContextOrSamplingFlags.create( debug ? SamplingFlags.DEBUG : SamplingFlags.Builder.build(sampledV) ); } TraceContext.Builder result = TraceContext.newBuilder(); if (result.parseTraceId(traceIdString, propagation.traceIdKey) && result.parseSpanId(getter, carrier, propagation.spanIdKey) && result.parseParentId(getter, carrier, propagation.parentSpanIdKey)) { return TraceContextOrSamplingFlags.create(result.sampled(sampledV).debug(debug).build()); } return TraceContextOrSamplingFlags.EMPTY; }
Source:
<code>void sendAddSuccessCallbacks() { PendingAddOp pendingAddOp; while ((pendingAddOp = pendingAddOps.peek()) != null && blockAddCompletions.get() == 0) { if (!pendingAddOp.completed) { if (LOG.isDebugEnabled()) { LOG.debug("pending add not completed: {}", pendingAddOp); } return; } if (pendingAddOp.entryId != 0 && pendingAddOp.entryId != pendingAddsSequenceHead) { if (LOG.isDebugEnabled()) { LOG.debug("Head of the queue entryId: is not the expected value: {}", pendingAddOp.entryId, pendingAddsSequenceHead); } return; } pendingAddOps.remove(); explicitLacFlushPolicy.updatePiggyBackedLac(lastAddConfirmed); if (writeFlags.contains(WriteFlag.DEFERRED_SYNC)) { <START> this.lastAddConfirmed = lastAddSyncedManager.calculateCurrentLastAddSynced(); <END> } else { this.lastAddConfirmed = Math.max(lastAddConfirmed, pendingAddOp.entryId); } pendingAddsSequenceHead = pendingAddOp.entryId + 1; pendingAddOp.submitCallback(BKException.Code.OK); } }</code><technical_language>I is updating lastAddSyncedManager. I prefer introducing this class is used. for now, a no-op for if (writeFlags.contains(WriteFlag.DEFERRED_SYNC))</technical_language>

Target:
void sendAddSuccessCallbacks() { PendingAddOp pendingAddOp; while ((pendingAddOp = pendingAddOps.peek()) != null && blockAddCompletions.get() == 0) { if (!pendingAddOp.completed) { if (LOG.isDebugEnabled()) { LOG.debug("pending add not completed: {}", pendingAddOp); } return; } if (pendingAddOp.entryId != 0 && pendingAddOp.entryId != pendingAddsSequenceHead + 1) { if (LOG.isDebugEnabled()) { LOG.debug("Head of the queue entryId: is not the expected value: {}", pendingAddOp.entryId, pendingAddsSequenceHead + 1); } return; } pendingAddOps.remove(); explicitLacFlushPolicy.updatePiggyBackedLac(lastAddConfirmed); pendingAddsSequenceHead = pendingAddOp.entryId; if (!writeFlags.contains(WriteFlag.DEFERRED_SYNC)) { this.lastAddConfirmed = pendingAddsSequenceHead; } pendingAddOp.submitCallback(BKException.Code.OK); } }
Source:
<code>MonitoringHandler createHandler( String parserId, String eventId, String ruleContent ) { String appName = this.agentInterface.getApplicationName(); String rootInstanceName = this.agentInterface.getRootInstance().getName(); MonitoringHandler result = null; if( PARSER_FILE.equalsIgnoreCase( parserId )) result = new FileHandler( eventId, appName, rootInstanceName, ruleContent ); else if( PARSER_NAGIOS.equalsIgnoreCase( parserId )) result = new NagiosHandler( eventId, appName, rootInstanceName, ruleContent ); <START> <END> return result; }</code><technical_language>Missing call for REST (HTTP HTTPS) handlers</technical_language>

Target:
MonitoringHandler createHandler( String parserId, String eventId, String ruleContent ) { String appName = this.agentInterface.getApplicationName(); String rootInstanceName = this.agentInterface.getRootInstance().getName(); MonitoringHandler result = null; if( PARSER_FILE.equalsIgnoreCase( parserId )) result = new FileHandler( eventId, appName, rootInstanceName, ruleContent ); else if( PARSER_NAGIOS.equalsIgnoreCase( parserId )) result = new NagiosHandler( eventId, appName, rootInstanceName, ruleContent ); else if(PARSER_REST.equalsIgnoreCase( parserId )) result = new RestHandler( eventId, appName, rootInstanceName, ruleContent ); return result; }
Source:
<code>static ByteBuf encodeMetadataHeader( ByteBufAllocator allocator, String customMime, int metadataLength) { ByteBuf mimeBuffer = allocator.buffer(customMime.length()); <START> mimeBuffer.writeCharSequence(customMime, CharsetUtil.UTF_8); <END> if (!ByteBufUtil.isText(mimeBuffer, CharsetUtil.US_ASCII)) { throw new IllegalArgumentException("custom mime type must be US_ASCII characters only"); } int ml = mimeBuffer.readableBytes(); if (ml < 1 || ml > 128) { throw new IllegalArgumentException( "custom mime type must have a strictly positive length that fits on 7 unsigned bits, ie 1-128"); } ml--; ByteBuf mimeLength = allocator.buffer(1, 1); mimeLength.writeByte((byte) ml); ByteBuf metadataLengthBuffer = allocator.buffer(3, 3); NumberUtils.encodeUnsignedMedium(metadataLengthBuffer, metadataLength); return allocator .compositeBuffer() .addComponents(true, mimeLength, mimeBuffer, metadataLengthBuffer); }</code><technical_language>easier ByteBufUtil.writeAscii(allocator, customMime); create mimeBuffer</technical_language>

Target:
static ByteBuf encodeMetadataHeader( ByteBufAllocator allocator, String customMime, int metadataLength) { ByteBuf metadataHeader = allocator.buffer(4 + customMime.length()); int writerIndexInitial = metadataHeader.writerIndex(); metadataHeader.writerIndex(writerIndexInitial + 1); int customMimeLength = ByteBufUtil.writeUtf8(metadataHeader, customMime); if (!ByteBufUtil.isText(metadataHeader, CharsetUtil.US_ASCII)) { metadataHeader.release(); throw new IllegalArgumentException("custom mime type must be US_ASCII characters only"); } if (customMimeLength < 1 || customMimeLength > 128) { metadataHeader.release(); throw new IllegalArgumentException( "custom mime type must have a strictly positive length that fits on 7 unsigned bits, ie 1-128"); } metadataHeader.markWriterIndex(); metadataHeader.writerIndex(writerIndexInitial); metadataHeader.writeByte(customMimeLength - 1); metadataHeader.resetWriterIndex(); NumberUtils.encodeUnsignedMedium(metadataHeader, metadataLength); return metadataHeader; }
Source:
<code>public void testList() throws StripeException { Map<String, Object> listParams = new HashMap<String, Object>(); listParams.put("limit", 1); ApplicationFeeCollection resources = ApplicationFee.list(listParams); assertNotNull(resources); verifyRequest( APIResource.RequestMethod.GET, <START> String.format("/v1/application_fees") <END> ); }</code><technical_language>verify params passed</technical_language>

Target:
public void testList() throws StripeException { final Map<String, Object> params = new HashMap<String, Object>(); params.put("limit", 1); final ApplicationFeeCollection fees = ApplicationFee.list(params); assertNotNull(fees); verifyRequest( APIResource.RequestMethod.GET, String.format("/v1/application_fees"), params ); }
Source:
<code>public void setup() throws ResourceUnavailableException { <START> MockitoAnnotations.initMocks(this); <END> ipAddressVO = new IPAddressVO(new Ip("192.0.0.1"), 1L, 1L, 1L,false); ipAddressVO.setAllocatedToAccountId(1L); account = new AccountVO("admin", 1L, null, (short) 1, 1L, "c65a73d5-ebbd-11e7-8f45-107b44277808"); account.setId(1L); NetworkOfferingVO networkOfferingVO = Mockito.mock(NetworkOfferingVO.class); networkOfferingVO.setSharedSourceNat(false); Mockito.when(_networkOfferingDao.findById(Mockito.anyLong())).thenReturn(networkOfferingVO); }</code><technical_language>do need this one. annotate class a jUnit runner</technical_language>

Target:
public void setup() throws ResourceUnavailableException { ipAddressVO = new IPAddressVO(new Ip("192.0.0.1"), 1L, 1L, 1L,false); ipAddressVO.setAllocatedToAccountId(1L); account = new AccountVO("admin", 1L, null, (short) 1, 1L, "c65a73d5-ebbd-11e7-8f45-107b44277808"); account.setId(1L); NetworkOfferingVO networkOfferingVO = Mockito.mock(NetworkOfferingVO.class); networkOfferingVO.setSharedSourceNat(false); Mockito.when(networkOfferingDao.findById(Mockito.anyLong())).thenReturn(networkOfferingVO); }
Source:
<code><START> private TreeMap<EntityType, List<Entity>> getEntityList(String extensionName, String jobName, <END> List<FormDataBodyPart> feedForms, List<FormDataBodyPart> processForms, InputStream config) throws FalconException, IOException{ List<Entity> processes = getProcesses(processForms); List<Entity> feeds = getFeeds(feedForms); ExtensionType extensionType = getExtensionType(extensionName); List<Entity> entities; TreeMap<EntityType, List<Entity>> entityMap = new TreeMap<>(); if (ExtensionType.TRUSTED.equals(extensionType)) { entities = generateEntities(extensionName, config); List<Entity> trustedFeeds = new ArrayList<>(); List<Entity> trustedProcesses = new ArrayList<>(); for (Entity entity : entities) { if (EntityType.FEED.equals(entity.getEntityType())) { trustedFeeds.add(entity); } else { trustedProcesses.add(entity); } } entityMap.put(EntityType.PROCESS, trustedProcesses); entityMap.put(EntityType.FEED, trustedFeeds); return entityMap; } else { EntityUtil.applyTags(extensionName, jobName, processes); EntityUtil.applyTags(extensionName, jobName, feeds); entityMap.put(EntityType.PROCESS, processes); entityMap.put(EntityType.FEED, feeds); return entityMap; } }</code><technical_language>Declaration Map</technical_language>

Target:
private SortedMap<EntityType, List<Entity>> getEntityList(String extensionName, String jobName, List<FormDataBodyPart> feedForms, List<FormDataBodyPart> processForms, InputStream config) throws FalconException, IOException{ List<Entity> processes = getProcesses(processForms); List<Entity> feeds = getFeeds(feedForms); ExtensionType extensionType = getExtensionType(extensionName); List<Entity> entities; TreeMap<EntityType, List<Entity>> entityMap = new TreeMap<>(); if (ExtensionType.TRUSTED.equals(extensionType)) { entities = generateEntities(extensionName, config); List<Entity> trustedFeeds = new ArrayList<>(); List<Entity> trustedProcesses = new ArrayList<>(); for (Entity entity : entities) { if (EntityType.FEED.equals(entity.getEntityType())) { trustedFeeds.add(entity); } else { trustedProcesses.add(entity); } } entityMap.put(EntityType.PROCESS, trustedProcesses); entityMap.put(EntityType.FEED, trustedFeeds); return entityMap; } else { EntityUtil.applyTags(extensionName, jobName, processes); EntityUtil.applyTags(extensionName, jobName, feeds); entityMap.put(EntityType.PROCESS, processes); entityMap.put(EntityType.FEED, feeds); return entityMap; } }
Source:
<code>private NonBlockingSemaphoreLike getFreeConnectionsForHost(Object partitionKey) { <START> if (maxConnectionsPerHostEnabled) { <END> return freeChannelsPerHost.computeIfAbsent(partitionKey, pk -> new NonBlockingSemaphore(config.getMaxConnectionsPerHost())); } else { return NonBlockingSemaphoreInfinite.I; } }</code><technical_language>ternary operator</technical_language>

Target:
private NonBlockingSemaphoreLike getFreeConnectionsForHost(Object partitionKey) { return maxConnectionsPerHostEnabled ? freeChannelsPerHost.computeIfAbsent(partitionKey, pk -> new NonBlockingSemaphore(config.getMaxConnectionsPerHost())) : NonBlockingSemaphoreInfinite.INSTANCE; }
Source:
<code>public void swapSlotContents( final int slotA, final int slotB ) { final Slot a = this.getSlot( slotA ); final Slot b = this.getSlot( slotB ); if( a == null || b == null ) { return; } final ItemStack isA = a.getStack(); final ItemStack isB = b.getStack(); if( isA.isEmpty() && isB.isEmpty() ) { return; } if( !isA.isEmpty() && !a.canTakeStack( this.getInventoryPlayer().player ) ) { return; } if( !isB.isEmpty() && !b.canTakeStack( this.getInventoryPlayer().player ) ) { return; } if( !isB.isEmpty() && !a.isItemValid( isB ) ) { return; } if( !isA.isEmpty() && !b.isItemValid( isA ) ) { return; } ItemStack testA = isB.isEmpty() ? ItemStack.EMPTY : isB.copy(); ItemStack testB = isA.isEmpty() ? ItemStack.EMPTY : isA.copy(); if( !testA.isEmpty() && testA.getCount() > a.getSlotStackLimit() ) { if( !testB.isEmpty() ) { return; } final int totalA = testA.getCount(); testA.setCount( a.getSlotStackLimit() ); testB = testA.copy(); testB.setCount( totalA - testA.getCount() ); } if( !testB.isEmpty() && testB.getCount() > b.getSlotStackLimit() ) { if( !testA.isEmpty() ) { return; } final int totalB = testB.getCount(); testB.setCount( b.getSlotStackLimit() ); testA = testB.copy(); testA.setCount( totalB - testA.getCount() ); } a.putStack( testA ); b.putStack( testB ); <START> b.putStack( testB ); <END> }</code><technical_language>twice</technical_language>

Target:
public void swapSlotContents( final int slotA, final int slotB ) { final Slot a = this.getSlot( slotA ); final Slot b = this.getSlot( slotB ); if( a == null || b == null ) { return; } final ItemStack isA = a.getStack(); final ItemStack isB = b.getStack(); if( isA.isEmpty() && isB.isEmpty() ) { return; } if( !isA.isEmpty() && !a.canTakeStack( this.getInventoryPlayer().player ) ) { return; } if( !isB.isEmpty() && !b.canTakeStack( this.getInventoryPlayer().player ) ) { return; } if( !isB.isEmpty() && !a.isItemValid( isB ) ) { return; } if( !isA.isEmpty() && !b.isItemValid( isA ) ) { return; } ItemStack testA = isB.isEmpty() ? ItemStack.EMPTY : isB.copy(); ItemStack testB = isA.isEmpty() ? ItemStack.EMPTY : isA.copy(); if( !testA.isEmpty() && testA.getCount() > a.getSlotStackLimit() ) { if( !testB.isEmpty() ) { return; } final int totalA = testA.getCount(); testA.setCount( a.getSlotStackLimit() ); testB = testA.copy(); testB.setCount( totalA - testA.getCount() ); } if( !testB.isEmpty() && testB.getCount() > b.getSlotStackLimit() ) { if( !testA.isEmpty() ) { return; } final int totalB = testB.getCount(); testB.setCount( b.getSlotStackLimit() ); testA = testB.copy(); testA.setCount( totalB - testA.getCount() ); } a.putStack( testA ); b.putStack( testB ); }
Source:
<code>void stopContainer() { if (containerController.isStarted(COORDINATOR_CONTAINER)) { <START> LRALogger.logger.info("STOPPING CONTAINER%n"); <END> deployer.undeploy(COORDINATOR_DEPLOYMENT); containerController.stop(COORDINATOR_CONTAINER); containerController.kill(COORDINATOR_CONTAINER); } }</code><technical_language>infof</technical_language>

Target:
void stopContainer() { if (containerController.isStarted(COORDINATOR_CONTAINER)) { LRALogger.logger.debug("Stopping container"); deployer.undeploy(COORDINATOR_DEPLOYMENT); containerController.stop(COORDINATOR_CONTAINER); containerController.kill(COORDINATOR_CONTAINER); } }
Source:
<code>public void should_include_asset_matching_one_of_include_patterns() throws Exception { final Filter<ArchivePath> filter = createComposedFilter("org.arquillian.extension.jacoco.client.*, org.arquillian.extension.integration.*", null); <START> final boolean include = filter.include(ArchivePaths.create("org/arquillian/extension/jacoco/client/ManifestAsset.class")); <END> assertThat(include).isTrue(); }</code><technical_language>This class is in package now. making more refactoring friendly - relying strings reflect reality anymore in this case</technical_language>

Target:
public void should_include_asset_matching_one_of_include_patterns() throws Exception { final Filter<ArchivePath> filter = FilterTestUtils.createComposedFilter("org.jboss.arquillian.extension.jacoco.client.*, org.jboss.arquillian.extension.integration.*", null); final boolean include = filter.include(FilterTestUtils.convertFromClass(ManifestAsset.class)); assertThat(include).isTrue(); }
Source:
<code>public void should_serialize_and_deserialize_parameterized_class_mocked_with_deep_stubs() throws Exception { <START> assumeTrue(ClassFileVersion.ofThisVm().isLessThan(ClassFileVersion.JAVA_V9)); <END> ListContainer deep_stubbed = mock(ListContainer.class, withSettings().defaultAnswer(RETURNS_DEEP_STUBS).serializable()); when(deep_stubbed.iterator().next().add("yes")).thenReturn(true); ListContainer deserialized_deep_stub = serializeAndBack(deep_stubbed); assertThat(deserialized_deep_stub.iterator().next().add("not stubbed but mock already previously resolved")).isEqualTo(false); assertThat(deserialized_deep_stub.iterator().next().add("yes")).isEqualTo(true); }</code><technical_language>assumption fails emits exception is runner (effectively, part of this test method is executed)</technical_language>

Target:
public void should_serialize_and_deserialize_parameterized_class_mocked_with_deep_stubs() throws Exception { ListContainer deep_stubbed = mock(ListContainer.class, withSettings().defaultAnswer(RETURNS_DEEP_STUBS).serializable()); when(deep_stubbed.iterator().next().add("yes")).thenReturn(true); ListContainer deserialized_deep_stub = serializeAndBack(deep_stubbed); assertThat(deserialized_deep_stub.iterator().next().add("not stubbed but mock already previously resolved")).isEqualTo(false); assertThat(deserialized_deep_stub.iterator().next().add("yes")).isEqualTo(true); }
Source:
<code>private QueryStateInfo getQueryStateInfo(QueryInfo queryInfo) { Optional<ResourceGroupId> groupId = queryManager.getQueryResourceGroup(queryInfo.getQueryId()); <START> if (queryInfo.getState() == QUEUED) { <END> return createQueuedQueryStateInfo( queryInfo, groupId, groupId.map(resourceGroupManager::getPathToRoot)); } return createRunningQueryStateInfo(queryInfo, groupId); }</code><technical_language>roll previous behavior QUEUED queries resource group info</technical_language>

Target:
private QueryStateInfo getQueryStateInfo(QueryInfo queryInfo) { Optional<ResourceGroupId> groupId = queryManager.getQueryResourceGroup(queryInfo.getQueryId()); if (queryInfo.getState() == QUEUED) { return createQueuedQueryStateInfo( queryInfo, groupId, groupId.map(resourceGroupManager::getPathToRoot)); } return createQueryStateInfo(queryInfo, groupId); }
Source:
<code>private ObjectType getSuperType(FunctionType type) { ObjectType proto = type.getPrototype(); if (proto == null) return null; ObjectType implicitProto = proto.getImplicitPrototype(); if (implicitProto == null) return null; <START> return implicitProto.getDisplayName().equals("Object") ? null : implicitProto; <END> }</code><technical_language>Display name occasionally ends null. Call "Object".equals</technical_language>

Target:
private ObjectType getSuperType(FunctionType type) { ObjectType proto = type.getPrototype(); if (proto == null) return null; ObjectType implicitProto = proto.getImplicitPrototype(); if (implicitProto == null) return null; return "Object".equals(implicitProto.getDisplayName()) ? null : implicitProto; }