auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>@VisibleForTesting Call<Wikitext> request(@NonNull Service service, @NonNull final PageTitle title, final int sectionID, @NonNull final Callback cb) { Call<Wikitext> call = service.wikitext(title.getPrefixedText(), sectionID); call.enqueue(new retrofit2.Callback<Wikitext>() { @Override public void onResponse(Call<Wikitext> call, Response<Wikitext> response) { if (response.isSuccessful()) { if (response.body() == null) { cb.failure(call, new JsonParseException("Response missing <START> required field(s)")); <END> return; } cb.success(call, response.body().wikitext()); } else { cb.failure(call, RetrofitException.httpError(response, cachedService.retrofit())); } } @Override public void onFailure(Call<Wikitext> call, Throwable t) { cb.failure(call, t); } }); return call; }</code><technical_language>This happen in current codebase I see. Wikitext recursively @Required fields. interpretation of trace is Wikitext.query marked @Required implications for a response if this field :[ AFAIK, this usage of @Required for MW API alarming</technical_language>

Target:
@VisibleForTesting Call<Wikitext> request(@NonNull Service service, @NonNull final PageTitle title, final int sectionID, @NonNull final Callback cb) { Call<Wikitext> call = service.wikitext(title.getPrefixedText(), sectionID); call.enqueue(new retrofit2.Callback<Wikitext>() { @Override public void onResponse(Call<Wikitext> call, Response<Wikitext> response) { if (response.isSuccessful()) { if (response.body() == null) { Throwable t = new JsonParseException("Response missing query field"); L.logRemoteErrorIfProd(t); cb.failure(call, t); return; } cb.success(call, response.body().wikitext()); } else { cb.failure(call, RetrofitException.httpError(response, cachedService.retrofit())); } } @Override public void onFailure(Call<Wikitext> call, Throwable t) { cb.failure(call, t); } }); return call; }
Source:
<code>public int hashCode() { int pcHashCode = 0; Collection<ProductContentDTO> productContent = this.getProductContent(); if (productContent != null) { for (ProductContentDTO dto : productContent) { pcHashCode = 31 * pcHashCode + (dto != null ? dto.hashCode() : 0); } } int ppHashCode = 0; Collection<ProductDTO> providedProducts = this.getProvidedProducts(); if (providedProducts != null) { for (ProductDTO dto : providedProducts) { ppHashCode = 31 * ppHashCode + (dto != null ? dto.hashCode() : 0); } } HashCodeBuilder builder = new HashCodeBuilder(37, 7) .append(super.hashCode()) .append(this.getUuid()) .append(this.getMultiplier()) .append(this.getId()) .append(this.getName()) .append(this.getAttributes()) .append(this.getDependentProductIds()) .append(this.getBranding()) .append(this.getProvidedProducts()) .append(pcHashCode) <START> .append(ppHashCode); <END> return builder.toHashCode(); }</code><technical_language>here, need calculate hashcode set here. This line is enough: .append(this.getProvidedProducts())</technical_language>

Target:
public int hashCode() { int pcHashCode = 0; Collection<ProductContentDTO> productContent = this.getProductContent(); if (productContent != null) { for (ProductContentDTO dto : productContent) { pcHashCode = 31 * pcHashCode + (dto != null ? dto.hashCode() : 0); } } HashCodeBuilder builder = new HashCodeBuilder(37, 7) .append(super.hashCode()) .append(this.getUuid()) .append(this.getMultiplier()) .append(this.getId()) .append(this.getName()) .append(this.getAttributes()) .append(this.getDependentProductIds()) .append(this.getBranding()) .append(this.getProvidedProducts()) .append(pcHashCode); return builder.toHashCode(); }
Source:
<code>private ArrayList<MediaOption> initOtherMediaImageOptions() { ArrayList<MediaOption> otherMediaOptions = new ArrayList<>(); FragmentActivity activity = getActivity(); Bundle arguments = getArguments(); GutenbergWebViewAuthorizationData gutenbergWebViewAuthorizationData = <START> arguments.getParcelable(ARG_GUTENBERG_WEB_VIEW_AUTH_DATA); <END> boolean supportStockPhotos = arguments != null && gutenbergWebViewAuthorizationData.isSiteUsingWPComRestAPI(); boolean supportGifs = arguments != null && arguments.getBoolean(ARG_TENOR_ENABLED); if (activity != null) { String packageName = activity.getApplication().getPackageName(); if (supportStockPhotos) { int stockMediaResourceId = getResources().getIdentifier("photo_picker_stock_media", "string", packageName); otherMediaOptions.add(new MediaOption(MEDIA_SOURCE_STOCK_MEDIA, getString(stockMediaResourceId))); } if (supportGifs) { int gifMediaResourceId = getResources().getIdentifier("photo_picker_gif", "string", packageName); otherMediaOptions.add(new MediaOption(GIF_MEDIA, getString(gifMediaResourceId))); } } else { AppLog.e(T.EDITOR, "Failed to initialize other media options because the activity is null"); } return otherMediaOptions; }</code><technical_language>check for arguments null here? next lines arguments do arguments != null && .... do a boolean, I achieve effect if inline this variable is line 409, is a boolean null check. a places null check getArguments() in this class. I feel strongly null-checking getArguments() null long set (which do), _but_ I do consistent--either check do. a mix _sometimes_ checking confusing. closer checking them, a bit safer, preference but, I said, I feel strongly (particularly if is reasonable handle a case getArguments() is null). WDYT</technical_language>

Target:
private ArrayList<MediaOption> initOtherMediaImageOptions() { ArrayList<MediaOption> otherMediaOptions = new ArrayList<>(); Bundle arguments = getArguments(); FragmentActivity activity = getActivity(); if (activity == null || arguments == null) { AppLog.e(T.EDITOR, "Failed to initialize other media options because the activity or getArguments() is null"); return otherMediaOptions; } GutenbergWebViewAuthorizationData gutenbergWebViewAuthorizationData = arguments.getParcelable(ARG_GUTENBERG_WEB_VIEW_AUTH_DATA); boolean supportStockPhotos = gutenbergWebViewAuthorizationData.isSiteUsingWPComRestAPI(); boolean supportGifs = arguments.getBoolean(ARG_TENOR_ENABLED, false); String packageName = activity.getApplication().getPackageName(); if (supportStockPhotos) { int stockMediaResourceId = getResources().getIdentifier("photo_picker_stock_media", "string", packageName); otherMediaOptions.add(new MediaOption(MEDIA_SOURCE_STOCK_MEDIA, getString(stockMediaResourceId))); } if (supportGifs) { int gifMediaResourceId = getResources().getIdentifier("photo_picker_gif", "string", packageName); otherMediaOptions.add(new MediaOption(GIF_MEDIA, getString(gifMediaResourceId))); } return otherMediaOptions; }
Source:
<code>private static MultiBucketContentRepoEndpoint parseCorpusStorage(MultibucketContentRepoEndpointInput corpus) { URI address = corpus.address; if (address == null) { throw new RuntimeException("contentRepo.corpus.address must be configured"); } String defaultBucket = corpus.bucket; if (defaultBucket == null) { throw new RuntimeException("contentRepo.corpus.bucket must be configured"); } ImmutableSet<String> allBuckets = ImmutableSet.<String>builder() .add(defaultBucket) .addAll(MoreObjects.firstNonNull(corpus.secondaryBuckets, ImmutableSet.of())) .build(); <START> ImmutableSet<String> secondaryBuckets = ImmutableSet.<String>builder() <END> .addAll(MoreObjects.firstNonNull(corpus.secondaryBuckets, ImmutableSet.of())) .build(); return new MultiBucketContentRepoEndpoint() { @Override public URI getAddress() { return address; } @Override public String getDefaultBucket() { return defaultBucket; } @Override public ImmutableSet<String> getAllBuckets() { return allBuckets; } @Override public ImmutableSet<String> getSecondaryBuckets() { return secondaryBuckets; } }; }</code><technical_language>If want simplify building set, try: ImmutableSet<String> secondaryBuckets = ImmutableSet.copyOf(MoreObjects.firstNonNull(corpus.secondaryBuckets, ImmutableSet.of()));</technical_language>

Target:
private static MultiBucketContentRepoEndpoint parseCorpusStorage(MultibucketContentRepoEndpointInput corpus) { URI address = corpus.address; if (address == null) { throw new RuntimeException("contentRepo.corpus.address must be configured"); } String defaultBucket = corpus.bucket; if (defaultBucket == null) { throw new RuntimeException("contentRepo.corpus.bucket must be configured"); } ImmutableSet<String> allBuckets = ImmutableSet.<String>builder() .add(defaultBucket) .addAll(MoreObjects.firstNonNull(corpus.secondaryBuckets, ImmutableSet.of())) .build(); ImmutableSet<String> secondaryBuckets = ImmutableSet.copyOf(MoreObjects.firstNonNull(corpus.secondaryBuckets, ImmutableSet.of())); return new MultiBucketContentRepoEndpoint() { @Override public URI getAddress() { return address; } @Override public String getDefaultBucket() { return defaultBucket; } @Override public ImmutableSet<String> getAllBuckets() { return allBuckets; } @Override public ImmutableSet<String> getSecondaryBuckets() { return secondaryBuckets; } }; }
Source:
<code>public IAtsVersion getTargetedVersionByTeamWf(IAtsTeamWorkflow team) throws OseeCoreException { <START> Collection<ArtifactId> versions = services.getRelationResolver().getRelated((team.getStoreObject()), <END> AtsRelationTypes.TeamWorkflowTargetedForVersion_Version); IAtsVersion version = null; if (!versions.isEmpty()) { if (versions.size() > 1) { OseeLog.log(Activator.class, Level.SEVERE, "Multiple targeted versions for artifact " + team.toStringWithId()); } else { version = services.getConfigItemFactory().getVersion(versions.iterator().next()); } } return version; }</code><technical_language>Consider adding null check</technical_language>

Target:
public IAtsVersion getTargetedVersionByTeamWf(IAtsTeamWorkflow team) throws OseeCoreException { if (team == null) { throw new OseeArgumentException("Team Workflow can not be null %s", team); } Collection<ArtifactId> versions = services.getRelationResolver().getRelated((team.getStoreObject()), AtsRelationTypes.TeamWorkflowTargetedForVersion_Version); IAtsVersion version = null; if (!versions.isEmpty()) { if (versions.size() > 1) { OseeLog.log(Activator.class, Level.SEVERE, "Multiple targeted versions for artifact " + team.toStringWithId()); } else { version = services.getConfigItemFactory().getVersion(versions.iterator().next()); } } return version; }
Source:
<code>public void afterRegionClearIsInvokedOnAccessorAndDataMembers() { CacheListener<String, Integer> listener = new ClearCountingCacheListener(); Region<String, Integer> region = createAccessorRegion(regionName, listener); for (int i = 0; i < getVMCount(); i++) { getVM(i).invoke(() -> { withData(createRegion(regionName, listener)); }); } region.clear(); <START> assertThat(sharedCountersRule.getTotal(CLEAR)).isEqualTo(expectedRegionDestroys()); <END> }</code><technical_language>This expectedClears(), expectedRegionDestroys() value</technical_language>

Target:
public void afterRegionClearIsInvokedOnAccessorAndDataMembers() { CacheListener<String, Integer> listener = new ClearCountingCacheListener(); Region<String, Integer> region = createAccessorRegion(regionName, listener); for (int i = 0; i < getVMCount(); i++) { getVM(i).invoke(() -> { withData(createRegion(regionName, listener)); }); } region.clear(); assertThat(sharedCountersRule.getTotal(CLEAR)).isEqualTo(expectedClears()); }
Source:
<code>public void onChatMessage(ChatMessageEvent event) { Platform.runLater(() -> { ChatMessage message = event.getMessage(); <START> if (message.getSource().equals(String.format("#%s'sParty", teamMatchmakingService.getParty().getOwner().getUsername()))) { <END> matchmakingChatController.onChatMessage(message); } }); }</code><technical_language>stated earlier, this outsourced a dedicated function</technical_language>

Target:
public void onChatMessage(ChatMessageEvent event) { ChatMessage message = event.getMessage(); if (message.getSource().equals(matchmakingChatController.getReceiver())) { Platform.runLater(() -> matchmakingChatController.onChatMessage(message)); } }
Source:
<code><START> static void setup() { <END> WebDriverManager.firefoxdriver().setup(); System.setProperty( SeleniumOptions.FIREFOX_DRIVER_SYSTEM_PROPERTY, System.getProperty("webdriver.gecko.driver")); }</code><technical_language>call equivalent for Chrome. check Chrome (and Firefox?) is (and return in testBrowsers)</technical_language>

Target:
static void setup() { WebDriverManager.firefoxdriver().setup(); WebDriverManager.chromedriver().setup(); }
Source:
<code>public void clickSourceButton(){ waitForElementByElement(sourceButton); sourceButton.click(); <START> driver.switchTo().defaultContent(); <END> }</code><technical_language>please add PageObjectLogging.log method</technical_language>

Target:
public void clickSourceButton(){ waitForElementByElement(sourceButton); sourceButton.click(); driver.switchTo().defaultContent(); PageObjectLogging.log("clickSourceButton", "Source button was clicked", true, driver); }
Source:
<code>private void normalizeIntensities() { normalizedXIntensities = new float[numberOfSnps]; normalizedYIntensities = new float[numberOfSnps]; int[] normIds = normalizationManifest.getNormIds(); for (int i = 0; i < rawXIntensities.length; i++) { int rawX = rawXIntensities[i]; int rawY = rawYIntensities[i]; int normId; int normIndex = -1; if ((normIds != null) && (normIds.length > i)) { normId = normIds[i]; normIndex = getAllNormIndex(normId); } if (normIndex != -1) { <START> InfiniumTransformation xform = normalizationTransformations[normIndex]; <END> float tempX = rawX - xform.getOffsetX(); float tempY = rawY - xform.getOffsetY(); float theta = xform.getTheta(); double tempX2 = Math.cos(theta) * tempX + Math.sin(theta) * tempY; double tempY2 = -Math.sin(theta) * tempX + Math.cos(theta) * tempY; double tempX3 = tempX2 - xform.getShear() * tempY2; if (tempX3 < 0) { tempX3 = 0; } if (tempY2 < 0) { tempY2 = 0; } normalizedXIntensities[i] = (float) (tempX3 / xform.getScaleX()); normalizedYIntensities[i] = (float) (tempY2 / xform.getScaleY()); } else { normalizedXIntensities[i] = rawXIntensities[i]; normalizedYIntensities[i] = rawYIntensities[i]; } } }</code><technical_language>finals</technical_language>

Target:
private void normalizeIntensities() { normalizedXIntensities = new float[numberOfSnps]; normalizedYIntensities = new float[numberOfSnps]; final int[] normIds = normalizationManifest.getNormIds(); for (int i = 0; i < rawXIntensities.length; i++) { final int rawX = rawXIntensities[i]; final int rawY = rawYIntensities[i]; final int normId; int normIndex = -1; if ((normIds != null) && (normIds.length > i)) { normId = normIds[i]; normIndex = getAllNormIndex(normId); } if (normIndex != -1) { final InfiniumTransformation xform = normalizationTransformations[normIndex]; final float tempX = rawX - xform.getOffsetX(); final float tempY = rawY - xform.getOffsetY(); final float theta = xform.getTheta(); double tempX2 = Math.cos(theta) * tempX + Math.sin(theta) * tempY; double tempY2 = -Math.sin(theta) * tempX + Math.cos(theta) * tempY; double tempX3 = tempX2 - xform.getShear() * tempY2; if (tempX3 < 0) { tempX3 = 0; } if (tempY2 < 0) { tempY2 = 0; } normalizedXIntensities[i] = (float) (tempX3 / xform.getScaleX()); normalizedYIntensities[i] = (float) (tempY2 / xform.getScaleY()); } else { normalizedXIntensities[i] = rawXIntensities[i]; normalizedYIntensities[i] = rawYIntensities[i]; } } }
Source:
<code>public void tearDown() throws Exception { <START> if (app != null) Entities.destroy(app); <END> }</code><technical_language>if (app != null) Entities.destroyAll(app.getManagementContext())</technical_language>

Target:
public void tearDown() throws Exception { if (app != null) Entities.destroyAll(app.getManagementContext()); }
Source:
<code>public HSBType(String value) { if (value != null) { <START> String[] constituents = value.split(","); <END> if (constituents.length == 3) { String constituent0 = constituents[0].trim(); String constituent1 = constituents[1].trim(); String constituent2 = constituents[2].trim(); this.hue = new BigDecimal(constituent0); this.saturation = new BigDecimal(constituent1); this.value = new BigDecimal(constituent2); } else { throw new IllegalArgumentException(value + " is not a valid HSBType syntax"); } } else { throw new IllegalArgumentException("Constructor argument must not be null"); } }</code><technical_language>part trimmed, this? Java List<String> constituents = Arrays.stream(value.split(",")).map(in -> in.trim()).collect(Collectors.toList());</technical_language>

Target:
public HSBType(String value) { if (value != null) { List<String> constituents = Arrays.stream(value.split(",")).map(in -> in.trim()) .collect(Collectors.toList()); if (constituents.size() == 3) { this.hue = new BigDecimal(constituents.get(0)); this.saturation = new BigDecimal(constituents.get(1)); this.value = new BigDecimal(constituents.get(2)); } else { throw new IllegalArgumentException(value + " is not a valid HSBType syntax"); } } else { throw new IllegalArgumentException("Constructor argument must not be null"); } }
Source:
<code>public void answerWhenMentioned() throws Exception { final Repo repo = new MkGithub().randomRepo(); final Issue issue = repo.issues().create("", ""); <START> issue.comments().post("hello @xx deploy"); <END> MatcherAssert.assertThat( new QnReferredTo("xx", new QnDeploy()).understand( new Comment.Smart(issue.comments().get(1)), new URI("#") ), Matchers.is(Req.DONE) ); MatcherAssert.assertThat( new Comment.Smart(issue.comments().get(2)).body(), Matchers.containsString( StringUtils.join( "I see you're talking about me, but I don't", " understand it. If you want to say something to me", " directly, start a message with @xx" ) ) ); }</code><technical_language>move xx a parameter in strings</technical_language>

Target:
public void answerWhenMentioned() throws Exception { final Repo repo = new MkGithub().randomRepo(); final Issue issue = repo.issues().create("", ""); final String login = "xx"; issue.comments().post(String.format("hello @%s deploy", login)); MatcherAssert.assertThat( new QnReferredTo(login, new QnDeploy()).understand( new Comment.Smart(issue.comments().get(1)), new URI("#") ), Matchers.is(Req.DONE) ); MatcherAssert.assertThat( new Comment.Smart(issue.comments().get(2)).body(), Matchers.containsString( StringUtils.join( "I see you're talking about me, but I don't", " understand it. If you want to say something to me", " directly, start a message with @", login ) ) ); }
Source:
<code>private boolean argumentInheritsFromBaseException(Argument argument) { if (!argument.is(Tree.Kind.REGULAR_ARGUMENT)) { return true; } Expression expression = ((RegularArgument) argument).expression(); <START> if (expression.is(Tree.Kind.NAME) || expression.is(Tree.Kind.QUALIFIED_EXPR)) { <END> return inheritsFromBaseException(((HasSymbol) expression).symbol()); } return true; }</code><technical_language>I check if expression is instance of HasSymbol</technical_language>

Target:
private boolean argumentInheritsFromBaseException(Argument argument) { if (!argument.is(Tree.Kind.REGULAR_ARGUMENT)) { return true; } Expression expression = ((RegularArgument) argument).expression(); if (expression instanceof HasSymbol) { return inheritsFromBaseException(((HasSymbol) expression).symbol()); } return true; }
Source:
<code>private synchronized boolean hasLockWatch(LockDescriptor lockDescriptor) { <START> return ranges.contains(lockDescriptor); <END> }</code><technical_language>This serialize lock/unlock requests right</technical_language>

Target:
private boolean hasLockWatch(LockDescriptor lockDescriptor) { return ranges.get().contains(lockDescriptor); }
Source:
<code>public org.eclipse.jface.util.IPropertyChangeListener getPreferenceChangeListener() { if <START> (listener == null) { <END> listener = new org.eclipse.jface.util.IPropertyChangeListener() { @Override public void propertyChange(final PropertyChangeEvent event) { if (event.getProperty().equals(PreferenceConstants.P_EVENT_CONNECTOR_COLOR) || event.getProperty().equals(PreferenceConstants.P_DATA_CONNECTOR_COLOR) || event.getProperty().equals(PreferenceConstants.P_ADAPTER_CONNECTOR_COLOR)) { getFigure().repaint(); } } }; } return listener; }</code><technical_language>constants preferably left hand side</technical_language>

Target:
public org.eclipse.jface.util.IPropertyChangeListener getPreferenceChangeListener() { if (null == listener) { listener = new org.eclipse.jface.util.IPropertyChangeListener() { @Override public void propertyChange(final PropertyChangeEvent event) { if (event.getProperty().equals(PreferenceConstants.P_EVENT_CONNECTOR_COLOR) || event.getProperty().equals(PreferenceConstants.P_DATA_CONNECTOR_COLOR) || event.getProperty().equals(PreferenceConstants.P_ADAPTER_CONNECTOR_COLOR)) { getFigure().repaint(); } } }; } return listener; }
Source:
<code>public GoogleProvider(Activity activity, IDPProviderParcel parcel, @Nullable String email) { mActivity = activity; String mClientId = parcel.getProviderExtra().getString(CLIENT_ID_KEY); GoogleSignInOptions googleSignInOptions; GoogleSignInOptions.Builder builder = new GoogleSignInOptions.Builder(GoogleSignInOptions .DEFAULT_SIGN_IN) .requestEmail() .requestIdToken(mClientId); <START> if (email != null) { <END> builder.setAccountName(email); } googleSignInOptions = builder.build(); mGoogleApiClient = new GoogleApiClient.Builder(activity) .addApi(Auth.GOOGLE_SIGN_IN_API, googleSignInOptions) .build(); mGoogleApiClient.connect(); }</code><technical_language>another issue email coming "". TextUtils.isEmpty here</technical_language>

Target:
public GoogleProvider(Activity activity, IDPProviderParcel parcel, @Nullable String email) { mActivity = activity; String mClientId = parcel.getProviderExtra().getString(CLIENT_ID_KEY); GoogleSignInOptions googleSignInOptions; GoogleSignInOptions.Builder builder = new GoogleSignInOptions.Builder(GoogleSignInOptions .DEFAULT_SIGN_IN) .requestEmail() .requestIdToken(mClientId); if (!TextUtils.isEmpty(email)) { builder.setAccountName(email); } googleSignInOptions = builder.build(); mGoogleApiClient = new GoogleApiClient.Builder(activity) .addApi(Auth.GOOGLE_SIGN_IN_API, googleSignInOptions) .build(); mGoogleApiClient.connect(); }
Source:
<code>public void countTest() throws Exception { sendManagementCallOnClientToCollectStats(); Cache<String, String> cache = cacheManager.getCache("dedicated-cache-1", String.class, String.class); cache.put("one", "val1"); cache.put("two", "val2"); cache.get("one"); cache.get("two"); cache.get("three"); cache.get("four"); long cacheHitCount = 0; long clusteredHitCount = 0; long cacheMissCount = 0; long clusteredMissCount = 0; do { List<ContextualStatistics> stats = waitForNextStats(); for (ContextualStatistics stat : stats) { <START> if (stat.getContext().contains("cacheName") && stat.getContext().get("cacheName").equals("dedicated-cache-1")) { <END> System.out.println("stats:"); Set<Map.Entry<String, Statistic<?>>> entries = stat.getStatistics().entrySet(); for (Map.Entry<String, Statistic<?>> entry : entries) { System.out.println(" - " + entry.getKey() + " : " + entry.getValue()); } cacheHitCount = stat.<Long>getLatestSampleValue("Cache:HitCount").get(); clusteredHitCount = stat.<Long>getLatestSampleValue("Clustered:HitCount").get(); clusteredMissCount = stat.<Long>getLatestSampleValue("Clustered:MissCount").get(); cacheMissCount = stat.<Long>getLatestSampleValue("Cache:MissCount").get(); } } } while(!Thread.currentThread().isInterrupted() && (cacheHitCount != CACHE_HIT_COUNT) && (clusteredHitCount != CLUSTERED_HIT_COUNT) && (cacheMissCount != CACHE_MISS_COUNT) && (clusteredMissCount != CLUSTERED_MISS_COUNT)); Assert.assertThat(cacheHitCount,is(CACHE_HIT_COUNT)); Assert.assertThat(clusteredHitCount,is(CLUSTERED_HIT_COUNT)); Assert.assertThat(cacheMissCount,is(CACHE_MISS_COUNT)); Assert.assertThat(clusteredMissCount,is(CLUSTERED_MISS_COUNT)); }</code><technical_language>I original form ugly... put other changes in file</technical_language>

Target:
public void countTest() throws Exception { sendManagementCallOnClientToCollectStats(); Cache<String, String> cache = cacheManager.getCache("dedicated-cache-1", String.class, String.class); cache.put("one", "val1"); cache.put("two", "val2"); cache.get("one"); cache.get("two"); cache.get("three"); cache.get("four"); long cacheHitCount = 0; long clusteredHitCount = 0; long cacheMissCount = 0; long clusteredMissCount = 0; do { List<ContextualStatistics> stats = waitForNextStats(); for (ContextualStatistics stat : stats) { if (stat.getContext().contains("cacheName") && stat.getContext().get("cacheName").equals("dedicated-cache-1")) { cacheHitCount = stat.<Long>getLatestSampleValue("Cache:HitCount").get(); clusteredHitCount = stat.<Long>getLatestSampleValue("Clustered:HitCount").get(); clusteredMissCount = stat.<Long>getLatestSampleValue("Clustered:MissCount").get(); cacheMissCount = stat.<Long>getLatestSampleValue("Cache:MissCount").get(); } } } while(!Thread.currentThread().isInterrupted() && (cacheHitCount != CACHE_HIT_COUNT) && (clusteredHitCount != CLUSTERED_HIT_COUNT) && (cacheMissCount != CACHE_MISS_COUNT) && (clusteredMissCount != CLUSTERED_MISS_COUNT)); Assert.assertThat(cacheHitCount,is(CACHE_HIT_COUNT)); Assert.assertThat(clusteredHitCount,is(CLUSTERED_HIT_COUNT)); Assert.assertThat(cacheMissCount,is(CACHE_MISS_COUNT)); Assert.assertThat(clusteredMissCount,is(CLUSTERED_MISS_COUNT)); }
Source:
<code>public static Object[][] storageFormats() { return new StorageFormat[][] { <START> {storageFormat("ORC")}, <END> {storageFormat("ORC", ImmutableMap.of("hive.orc_optimized_writer_enabled", "true", "hive.orc_optimized_writer_validate", "true"))}, {storageFormat("DWRF")}, {storageFormat("PARQUET")}, {storageFormat("PARQUET", ImmutableMap.of("hive.parquet_optimized_reader_enabled", "true"))}, {storageFormat("RCBINARY")}, {storageFormat("RCTEXT")}, {storageFormat("SEQUENCEFILE")}, {storageFormat("TEXTFILE")} }; }</code><technical_language>Thanks. Please similar for RC file ;-)</technical_language>

Target:
public static Object[][] storageFormats() { return new StorageFormat[][] { {storageFormat("ORC")}, {storageFormat("ORC", ImmutableMap.of("hive.orc_optimized_writer_enabled", "true", "hive.orc_optimized_writer_validate", "true"))}, {storageFormat("DWRF")}, {storageFormat("PARQUET")}, {storageFormat("PARQUET", ImmutableMap.of("hive.parquet_optimized_reader_enabled", "true"))}, {storageFormat("RCBINARY", ImmutableMap.of("hive.rcfile_optimized_writer_enabled", "false", "hive.rcfile_optimized_writer_validate", "false"))}, {storageFormat("RCBINARY", ImmutableMap.of("hive.rcfile_optimized_writer_enabled", "true", "hive.rcfile_optimized_writer_validate", "true"))}, {storageFormat("RCTEXT", ImmutableMap.of("hive.rcfile_optimized_writer_enabled", "false", "hive.rcfile_optimized_writer_validate", "false"))}, {storageFormat("RCTEXT", ImmutableMap.of("hive.rcfile_optimized_writer_enabled", "true", "hive.rcfile_optimized_writer_validate", "true"))}, {storageFormat("SEQUENCEFILE")}, {storageFormat("TEXTFILE")}, {storageFormat("AVRO")} }; }
Source:
<code>public void testOpenLedgerWithRecovery() throws Exception { long lId; byte[] data = "foo".getBytes(StandardCharsets.UTF_8); final byte[] password = "password".getBytes(StandardCharsets.UTF_8); Map<String, byte[]> customMetadata = new HashMap<>(); customMetadata.put("test", "test".getBytes(StandardCharsets.UTF_8)); <START> try (WriteHandle writer = result(newCreateLedgerOp() <END> .withAckQuorumSize(1) .withWriteQuorumSize(2) .withEnsembleSize(3) .withDigestType(DigestType.MAC) .withCustomMetadata(customMetadata) .withPassword(password) .execute());) { lId = writer.getId(); writer.append(ByteBuffer.wrap(data)).get(); writer.append(ByteBuffer.wrap(data)).get(); registerMockEntryForRead(lId, BookieProtocol.LAST_ADD_CONFIRMED, password, data, -1); registerMockEntryForRead(lId, 0, password, data, -1); registerMockEntryForRead(lId, 1, password, data, 0); try (ReadHandle reader = result(newOpenLedgerOp() .withDigestType(DigestType.MAC) .withPassword(password) .withRecovery(true) .withLedgerId(lId) .execute())) { } try { result(writer.append(ByteBuffer.wrap(data))); fail("should not be able to write"); } catch (BKLedgerFencedException ok) { } } try (ReadHandle reader = result(newOpenLedgerOp() .withDigestType(DigestType.MAC) .withPassword(password) .withRecovery(false) .withLedgerId(lId) .execute())) { assertEquals(1, reader.getLastAddConfirmed()); assertEquals(1, reader.readLastAddConfirmed().get().intValue()); checkEntries(reader.read(0, reader.getLastAddConfirmed()).get(), data); } }</code><technical_language>do need writehandle in this test case? registerMockEntryForRead provides entries for reading, no</technical_language>

Target:
public void testOpenLedgerWithRecovery() throws Exception { long lId; try (WriteHandle writer = result(newCreateLedgerOp() .withAckQuorumSize(1) .withWriteQuorumSize(2) .withEnsembleSize(3) .withPassword(password) .execute());) { lId = writer.getId(); result(writer.append(ByteBuffer.wrap(data))); result(writer.append(ByteBuffer.wrap(data))); registerMockEntryForRead(lId, BookieProtocol.LAST_ADD_CONFIRMED, password, data, -1); registerMockEntryForRead(lId, 0, password, data, -1); registerMockEntryForRead(lId, 1, password, data, 0); try (ReadHandle reader = result(newOpenLedgerOp() .withPassword(password) .withRecovery(true) .withLedgerId(lId) .execute())) { } result(writer.append(ByteBuffer.wrap(data))); } }
Source:
<code>protected TenantUserManager(ScopeInfo scope, Extension config) { super(scope, config); this.systemTenant = config.get("system-tenant").asString(); this.acceptApiTokens = config.get("accept-api-tokens").asBoolean(true); <START> this.availableLanguages = config.getStringList("availableLanguages").isEmpty() ? <END> Collections.singletonList(NLS.getDefaultLanguage()) : config.getStringList("availableLanguages"); }</code><technical_language>snake case other keys do</technical_language>

Target:
protected TenantUserManager(ScopeInfo scope, Extension config) { super(scope, config); this.systemTenant = config.get("system-tenant").asString(); this.acceptApiTokens = config.get("accept-api-tokens").asBoolean(true); this.availableLanguages = config.getStringList("available-languages").isEmpty() ? Collections.singletonList(NLS.getDefaultLanguage()) : config.getStringList("available-languages"); }
Source:
<code>public void testRemove() { assertEquals(dao.remove(existingAsyncTask.gettask_id()), 1); async_tasks result = dao.get(existingAsyncTask.gettask_id()); assertNull(result); <START> <END> assertEquals(dao.remove(existingAsyncTask.gettask_id()), 0); }</code><technical_language>consider testing get()!=null too, test completely dependent remove()</technical_language>

Target:
public void testRemove() { async_tasks result = dao.get(existingAsyncTask.gettask_id()); assertNotNull(result); assertEquals(dao.remove(existingAsyncTask.gettask_id()), 1); result = dao.get(existingAsyncTask.gettask_id()); assertNull(result); assertEquals(dao.remove(existingAsyncTask.gettask_id()), 0); }
Source:
<code>private PhylogeneticNode drawInternal(TreeNode root, List<TreeNode> children, double x, double y) { List<PhylogeneticNode> drawnChildren = new ArrayList<>(); for (int i = 0; i < children.size(); i++) { PhylogeneticNode node = draw(children.get(i), x + LEVELWIDTH, y + (i * LEAFHEIGHT)); drawnChildren.add(node); PhylogeneticEdge edge = new PhylogeneticEdge(node, x); <START> node.setOutgoingEdge(edge); <END> getChildren().addAll(node, edge); } PhylogeneticNode first = drawnChildren.get(0); PhylogeneticNode last = drawnChildren.get(drawnChildren.size() - 1); PhylogeneticNode self = new PhylogeneticNode(x, first.getCenterY() + (last.getCenterY() - first.getCenterY()) / 2, SQUARE); for (PhylogeneticNode child : drawnChildren) { child.getOutgoingEdge().bindTo(self); } return self; }</code><technical_language>consider renaming this incoming edge</technical_language>

Target:
private PhylogeneticNode drawInternal(TreeNode root, List<TreeNode> children, double x, double y) { List<PhylogeneticNode> drawnChildren = new ArrayList<>(); for (int i = 0; i < children.size(); i++) { PhylogeneticNode node = draw(children.get(i), x + LEVELWIDTH, y + (i * LEAFHEIGHT)); drawnChildren.add(node); PhylogeneticEdge edge = new PhylogeneticEdge(node, x); node.setIncomingEdge(edge); getChildren().addAll(node, edge); } PhylogeneticNode first = drawnChildren.get(0); PhylogeneticNode last = drawnChildren.get(drawnChildren.size() - 1); PhylogeneticNode self = new PhylogeneticNode(x, first.getCenterY() + (last.getCenterY() - first.getCenterY()) / 2, SQUARE); for (PhylogeneticNode child : drawnChildren) { child.getIncomingEdge().bindTo(self); } return self; }
Source:
<code>public void loadProperties( long entityId, EntityType type, MutableIntSet propertyIds, PropertyLoadSink sink ) { PrimitiveRecord entity; if ( type == EntityType.NODE ) { entity = nodeStore.getRecord( entityId, nodeStore.newRecord(), FORCE ); } else { entity = relationshipStore.getRecord( entityId, relationshipStore.newRecord(), FORCE ); } if ( !entity.inUse() ) { return; } long firstPropertyId = entity.getNextProp(); if ( firstPropertyId == Record.NO_NEXT_PROPERTY.intValue() ) { return; } for ( PropertyRecord propertyRecord : propertyStore.getPropertyRecordChain( firstPropertyId ) ) { for ( PropertyBlock block : propertyRecord ) { int currentPropertyId = block.getKeyIndexId(); if ( propertyIds.contains( currentPropertyId ) ) { Value currentValue = block.getType().value( block, propertyStore ); sink.onProperty( currentPropertyId, currentValue ); <START> propertyIds.remove( currentPropertyId ); <END> } } } }</code><technical_language>this change? propertyIds set sink anywhere, is it</technical_language>

Target:
public void loadProperties( long entityId, EntityType type, MutableIntSet propertyIds, PropertyLoadSink sink ) { PrimitiveRecord entity; if ( type == EntityType.NODE ) { entity = nodeStore.getRecord( entityId, nodeStore.newRecord(), FORCE ); } else { entity = relationshipStore.getRecord( entityId, relationshipStore.newRecord(), FORCE ); } if ( !entity.inUse() ) { return; } long firstPropertyId = entity.getNextProp(); if ( firstPropertyId == Record.NO_NEXT_PROPERTY.intValue() ) { return; } for ( PropertyRecord propertyRecord : propertyStore.getPropertyRecordChain( firstPropertyId ) ) { for ( PropertyBlock block : propertyRecord ) { int currentPropertyId = block.getKeyIndexId(); if ( propertyIds.remove( currentPropertyId ) ) { Value currentValue = block.getType().value( block, propertyStore ); sink.onProperty( currentPropertyId, currentValue ); } } } }
Source:
<code>public <START> synchronized Api <END> getConnection() throws UnsecuredConnectionAttemptError, ServerException, IOException { if (api == null) { String url = String.format("%s://%s:%s/ovirt-engine/api", protocol, server, port); log.debug(String.format("Logging to %s as %s", url, username)); api = new Api(url, username, password, true); } return api; }</code><technical_language>This is simple 2 issues I - 1st slow due sync, 2nd need handle timeouts. consider this approach avoid sync - KISS public OvirtClient() { ... try { api = new Api... } if (api == null) { // this instance service throw new RuntimeException... ; } next attempt @Inject Singleton try create instance if there. So, a connection timeout? session expired? need dispose reconnect. this handled. I guess dispose singleton instance context. thoughts</technical_language>

Target:
public synchronized Api getConnection() throws UnsecuredConnectionAttemptError, ServerException, IOException { if (api == null) { String url = String.format("%s://%s:%s/ovirt-engine/api", protocol, server, port); log.debug(String.format("Logging to %s as %s", url, username)); api = new Api(url, username, password, null, null, requestTimeout, true, true, null, false); } return api; }
Source:
<code>public Promise<Void> importProject(Path path, SourceStorageDto source) { String url = getBaseUrl() + IMPORT + encodePath(path); if (url.contains("?")) { url += "&clientId=" + appContext.getApplicationId().orElse(""); } else { <START> <END> url += "?clientId=" + appContext.getApplicationId().orElse(""); } return reqFactory.createPostRequest(url, source).header(CONTENT_TYPE, APPLICATION_JSON).send(); }</code><technical_language>parts of if same</technical_language>

Target:
public Promise<Void> importProject(Path path, SourceStorageDto source) { String url = getBaseUrl() + IMPORT + encodePath(path); url += url.contains("?") ? "&" : "?"; url += "clientId=" + appContext.getApplicationId().orElse(""); return reqFactory.createPostRequest(url, source).header(CONTENT_TYPE, APPLICATION_JSON).send(); }
Source:
<code>public void testProcessCJSWithClosureRequires() { args.add("--process_common_js_modules"); args.add("--entry_point=app"); args.add("--dependency_mode=STRICT"); setFilename(0, "base.js"); setFilename(1, "array.js"); setFilename(2, "Baz.js"); setFilename(3, "app.js"); test(new String[] { <START> Joiner.on('\n').join(" ", <END> " var goog = goog || {};", "var COMPILED = false;", "goog.provide = function (arg) {};", "goog.require = function (arg) {};"), "goog.provide('goog.array');", Joiner.on('\n').join("goog.require('goog.array');", "function Baz() {}", "Baz.prototype = {", " baz: function() {", " return goog.array.last(['asdf','asd','baz']);", " },", " bar: function () {", " return 4 + 4;", " }", "};", "module.exports = Baz;"), Joiner.on('\n').join("var Baz = require('./Baz');", "var baz = new Baz();", "console.log(baz.baz());", "console.log(baz.bar());") }, new String[] { "var goog=goog||{},COMPILED=!1;" + "goog.provide=function(a){};goog.require=function(a){};", "goog.array={};", "function Baz$$module$Baz(){}" + "Baz$$module$Baz.prototype={" + " baz:function(){return goog.array.last(['asdf','asd','baz'])}," + " bar:function(){return 8}" + "};" + "var module$Baz=Baz$$module$Baz;", "var module$app={}," + " Baz$$module$app=module$Baz," + " baz$$module$app=new Baz$$module$app;" + "console.log(baz$$module$app.baz());" + "console.log(baz$$module$app.bar())" }); }</code><technical_language>pull Joiner.on('\n').join(...) out a static method</technical_language>

Target:
public void testProcessCJSWithClosureRequires() { args.add("--process_common_js_modules"); args.add("--entry_point=app"); args.add("--dependency_mode=STRICT"); setFilename(0, "base.js"); setFilename(1, "array.js"); setFilename(2, "Baz.js"); setFilename(3, "app.js"); test(new String[] { " \n" + " var goog = goog || {};\n" + "var COMPILED = false;\n" + "goog.provide = function (arg) {};\n" + "goog.require = function (arg) {};", "goog.provide('goog.array');", "goog.require('goog.array');" + "function Baz() {}" + "Baz.prototype = {" + " baz: function() {" + " return goog.array.last(['asdf','asd','baz']);" + " }," + " bar: function () {" + " return 4 + 4;" + " }" + "};" + "module.exports = Baz;", "var Baz = require('./Baz');" + "var baz = new Baz();" + "console.log(baz.baz());" + "console.log(baz.bar());" }, new String[] { "var goog=goog||{},COMPILED=!1;" + "goog.provide=function(a){};goog.require=function(a){};", "goog.array={};", "function Baz$$module$Baz(){}" + "Baz$$module$Baz.prototype={" + " baz:function(){return goog.array.last(['asdf','asd','baz'])}," + " bar:function(){return 8}" + "};" + "var module$Baz=Baz$$module$Baz;", "var module$app={}," + " Baz$$module$app=Baz$$module$Baz," + " baz$$module$app=new Baz$$module$app;" + "console.log(baz$$module$app.baz());" + "console.log(baz$$module$app.bar())" }); }
Source:
<code>public ScenarioSimulationEditorPresenter(final Caller<ScenarioSimulationService> service, final ScenarioSimulationResourceType type, final ImportsWidgetPresenter importsWidget, final AsyncPackageDataModelOracleFactory oracleFactory) { super(); <START> this.baseView = newScenarioSimulationView(); END> this.service = service; this.type = type; this.importsWidget = importsWidget; this.oracleFactory = oracleFactory; }</code><technical_language>super(baseView) provide view for base set view for this class need cast for actual view</technical_language>

Target:
public ScenarioSimulationEditorPresenter(final Caller<ScenarioSimulationService> service, final ScenarioSimulationResourceType type, final ImportsWidgetPresenter importsWidget, final AsyncPackageDataModelOracleFactory oracleFactory) { super(); this.view = newScenarioSimulationView(); this.baseView = view; this.service = service; this.type = type; this.importsWidget = importsWidget; this.oracleFactory = oracleFactory; }
Source:
<code>public boolean isInsideStructure(World worldIn, String structureName, BlockPos pos) { <START> if (structureMap.containsKey(structureName)) <END> { return structureMap.get(structureName).isInsideStructure(pos); } return false; }</code><technical_language>avoid this containsKey</technical_language>

Target:
public boolean isInsideStructure(World worldIn, String structureName, BlockPos pos) { MapGenStructure structure = structureMap.get(structureName); return structure != null && structureMap.get(structureName).isInsideStructure(pos); }
Source:
<code>public void setup() { super.setup(); factModelTupleLocal = new FactModelTuple(visibleFactsLocal, hiddenFactsLocal); factModelTreeHolderlocal = new BusinessCentralDMNDataManagementStrategy.ResultHolder(); factModelTreeHolderlocal.setFactModelTuple(factModelTupleLocal); <START> try { when(dmnTypeServiceMock.retrieveFactModelTuple(any(), anyString())).thenReturn(factModelTupleLocal); } catch (Exception e) { e.printStackTrace(); } <END> modelLocal.getSettings().setDmnFilePath(DMN_FILE_PATH); abstractDMNDataManagementStrategySpy = spy(new AbstractDMNDataManagementStrategy(mock(EventBus.class)) { @Override protected void retrieveFactModelTuple(TestToolsView.Presenter testToolsPresenter, ScenarioSimulationContext context, String dmnFilePath) { } { this.currentPath = mock(Path.class); this.model = modelLocal; this.factModelTreeHolder = factModelTreeHolderlocal; } }); }</code><technical_language>please remove try catch block? I test continue of setup throws exception</technical_language>

Target:
public void setup() { super.setup(); factModelTupleLocal = new FactModelTuple(visibleFactsLocal, hiddenFactsLocal); factModelTreeHolderlocal = new BusinessCentralDMNDataManagementStrategy.ResultHolder(); factModelTreeHolderlocal.setFactModelTuple(factModelTupleLocal); when(dmnTypeServiceMock.retrieveFactModelTuple(any(), anyString())).thenReturn(factModelTupleLocal); modelLocal.getSettings().setDmnFilePath(DMN_FILE_PATH); abstractDMNDataManagementStrategySpy = spy(new AbstractDMNDataManagementStrategy(mock(EventBus.class)) { @Override protected void retrieveFactModelTuple(TestToolsView.Presenter testToolsPresenter, ScenarioSimulationContext context, String dmnFilePath) { } { this.currentPath = mock(Path.class); this.model = modelLocal; this.factModelTreeHolder = factModelTreeHolderlocal; } }); }
Source:
<code><START> protected int mergeFileModes(int modeB, int modeO, int modeT) { <END> if (modeO == modeT) return modeO; if (modeB == modeO) return (modeT == FileMode.MISSING.getBits()) ? modeO : modeT; if (modeB == modeT) return (modeO == FileMode.MISSING.getBits()) ? modeT : modeO; return FileMode.MISSING.getBits(); }</code><technical_language>need change this method signature. I leave this method private</technical_language>

Target:
private int mergeFileModes(int modeB, int modeO, int modeT) { if (modeO == modeT) return modeO; if (modeB == modeO) return (modeT == FileMode.MISSING.getBits()) ? modeO : modeT; if (modeB == modeT) return (modeO == FileMode.MISSING.getBits()) ? modeT : modeO; return FileMode.MISSING.getBits(); }
Source:
<code>Mono<Void> completeTransaction(AmqpTransaction transaction, boolean isCommit) { return Mono.fromCallable(() -> { final Message message = Proton.message(); Discharge discharge = new Discharge(); discharge.setFail(!isCommit); discharge.setTxnId(new Binary(transaction.getTransactionId().array())); message.setBody(new AmqpValue(discharge)); final int payloadSize = messageSerializer.getSize(message); final int allocationSize = payloadSize + MAX_AMQP_HEADER_SIZE_BYTES; final byte[] bytes = new byte[allocationSize]; int encodedSize = message.encode(bytes, 0, allocationSize); Tuple2<byte[], Integer> tuple = Tuples.of(bytes, encodedSize); return tuple; }) .flatMap(tuple2 -> sendLink.send(tuple2.getT1(), tuple2.getT2(), DeliveryImpl.DEFAULT_MESSAGE_FORMAT)) .handle((state, sink) -> { if (!(state instanceof Accepted)) { <START> logger.error("Transaction could not be completed, Service Bus status [{}].", <END> transaction, state.toString()); } sink.complete(); }); }</code><technical_language>sink return error (sink.error(...)) I meant move other logic ReactorSender (line452...) for processing DeliveryState here. ### ReactorSender java //@returns DeliveryState for send operation. Mono<DeliveryState> send(byte[] amqpMessage, int encodedMessageSize, int messageFormat, DeliveryState dispositionState); ### TransactionCoordinator java .handle((state, sink) -> { // process delivery state. });</technical_language>

Target:
Mono<Void> completeTransaction(AmqpTransaction transaction, boolean isCommit) { final Message message = Proton.message(); Discharge discharge = new Discharge(); discharge.setFail(!isCommit); discharge.setTxnId(new Binary(transaction.getTransactionId().array())); message.setBody(new AmqpValue(discharge)); final int payloadSize = messageSerializer.getSize(message); final int allocationSize = payloadSize + MAX_AMQP_HEADER_SIZE_BYTES; final byte[] bytes = new byte[allocationSize]; final int encodedSize = message.encode(bytes, 0, allocationSize); return sendLink.send(bytes, encodedSize, DeliveryImpl.DEFAULT_MESSAGE_FORMAT, null) .handle((outcome, sink) -> { final DeliveryState.DeliveryStateType stateType = outcome.getType(); switch (stateType) { case Accepted: sink.complete(); break; default: sink.error(new IllegalArgumentException("Expected a Accepted, received: " + outcome)); logger.warning("Unknown DeliveryState type: {}", stateType); } }); }
Source:
<code>protected Snapshots mapCollection(List<org.ovirt.engine.core.common.businessentities.Snapshot> entities) { Snapshots snapshots = new Snapshots(); for (org.ovirt.engine.core.common.businessentities.Snapshot entity : entities) { Snapshot snapshot = map(entity, null); <START> snapshot = addLinks(snapshot); <END> snapshot = addVmConfiguration(entity, snapshot); snapshot = populate(snapshot, entity); snapshots.getSnapshots().add(snapshot); } return snapshots; }</code><technical_language>add links in chain add resources need href created</technical_language>

Target:
protected Snapshots mapCollection(List<org.ovirt.engine.core.common.businessentities.Snapshot> entities) { Snapshots snapshots = new Snapshots(); for (org.ovirt.engine.core.common.businessentities.Snapshot entity : entities) { Snapshot snapshot = map(entity, null); snapshot = populate(snapshot, entity); snapshot = addLinks(snapshot); snapshot = addVmConfiguration(entity, snapshot); snapshots.getSnapshots().add(snapshot); } return snapshots; }
Source:
<code><START> private void addQueuedDeposits(String queueName, Map<String, Set<String>> depositMap) { <END> Jedis jedis = jedisPool.getResource(); Set<String> queue; try { queue = jedis.zrange(queueName, 0, -1); } catch (Exception e) { LOG.warn("Redis did not return a zset for {}, trying to retrieve as a list", queueName, e); queue = new HashSet<>(jedis.lrange(queueName, 0, -1)); } ObjectMapper mapper = new ObjectMapper(); for (String entry : queue) { try { JsonNode node = mapper.readTree(entry); String depositId = node.get("args").get(1).asText(); Set<String> jobs = depositMap.get(depositId); if (jobs == null) { jobs = new HashSet<>(); depositMap.put(depositId, jobs); } jobs.add(node.get("class").asText()); } catch (IOException e) { LOG.error("Failed to parse deposit job from resque", e); } } }</code><technical_language>Is a do this Jesque's API Redis directly</technical_language>

Target:
private void addQueuedDeposits(String queueName, Map<String, Set<String>> depositMap) { QueueInfo info = queueDAO.getQueueInfo(queueName, 0, 0); for (Job job : info.getJobs()) { String depositId = (String) job.getArgs()[1]; Set<String> jobs = depositMap.get(depositId); if (jobs == null) { jobs = new HashSet<>(); depositMap.put(depositId, jobs); } jobs.add(job.getClassName()); } }