auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Guid selectBestHost(VDSGroup cluster, VM vm, Guid destHostId, List<VDS> vdsList, ClusterPolicy policy, Map<String, String> parameters) { if (destHostId != null) { for (VDS vds : vdsList) { if (destHostId.equals(vds.getId())) { return destHostId; } } } if (policy.getFunctions() == null || policy.getFunctions().isEmpty()) { return vdsList.get(0).getId(); } if (shouldWeighClusterHosts(cluster, vdsList)) { <START> return runFunctions(policy.getFunctions(), vdsList, vm, parameters); <END> } if (!vdsList.isEmpty()) { return vdsList.get(0).getId(); } return null; }</code><technical_language>functionality changed a bit... if runFunctions returns null return..</technical_language>

Target:
private Guid selectBestHost(VDSGroup cluster, VM vm, Guid destHostId, List<VDS> vdsList, ClusterPolicy policy, Map<String, String> parameters) { if (destHostId != null) { for (VDS vds : vdsList) { if (destHostId.equals(vds.getId())) { return destHostId; } } } List<Pair<Guid, Integer>> functions = policy.getFunctions(); if (functions != null && !functions.isEmpty() && shouldWeighClusterHosts(cluster, vdsList)) { Guid bestHostByFunctions = runFunctions(functions, vdsList, vm, parameters); if (bestHostByFunctions != null) { return bestHostByFunctions; } } return vdsList.get(0).getId(); }
Source:
<code>public void shouldSupportSortOnStandardFieldWithCriteria() { final List<String> sortedIds = repository.findAllByNameOrderByText("Salt").stream() .map(it -> it.id).collect(Collectors.toList()); <START> assertThat(sortedIds).containsExactly("4", "5"); <END> }</code><technical_language>Nit: need for final keyword in local variables</technical_language>

Target:
public void shouldSupportSortOnStandardFieldWithCriteria() { List<String> sortedIds = repository.findAllByNameOrderByText("Salt").stream() .map(it -> it.id).collect(Collectors.toList()); assertThat(sortedIds).containsExactly("4", "5"); }
Source:
<code>public void setConnectTimeout(int timeout) { connectTimeout = timeout; if (timeout >= 0) { OkHttpClient.Builder builder = getBuilder(); builder.connectTimeout(timeout, TimeUnit.MILLISECONDS); <START> client = builder.build(); <END> } }</code><technical_language>afraid is a code logic problem here. If call setReadTimeout setConnectTimeout read timeout is override a new client is built connect timeout set</technical_language>

Target:
public void setConnectTimeout(int timeout) { connectTimeout = timeout; client = null; }
Source:
<code>private void showFeed() { Log.d(TAG, "Language is " + feed.getLanguage()); Log.d(TAG, "Author is " + feed.getAuthor()); Log.d(TAG, "URL is " + feed.getDownload_url()); Glide.with(getContext()) .load(feed.getImageLocation()) .apply(new RequestOptions() .placeholder(R.color.light_gray) .error(R.color.light_gray) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .fitCenter() .dontAnimate()) .into(imgvCover); Glide.with(getContext()) .load(feed.getImageLocation()) .apply(new RequestOptions() .placeholder(R.color.image_readability_tint) .error(R.color.image_readability_tint) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .transform(new FastBlurTransformation()) .dontAnimate()) .into(imgvBackground); txtvTitle.setText(feed.getTitle()); String description = feed.getDescription(); if (description != null) { if (Feed.TYPE_ATOM1.equals(feed.getType())) { <START> description = getPlainText(new SpannedString(description)).toString(); <END> } } else { description = ""; } txtvDescription.setText(description); if (!TextUtils.isEmpty(feed.getAuthor())) { txtvAuthor.setText(feed.getAuthor()); txtvAuthorHeader.setText(feed.getAuthor()); } else { lblAuthor.setVisibility(View.GONE); txtvAuthor.setVisibility(View.GONE); } if (!TextUtils.isEmpty(feed.getLanguage())) { txtvLanguage.setText(LangUtils.getLanguageString(feed.getLanguage())); } else { lblLanguage.setVisibility(View.GONE); txtvLanguage.setVisibility(View.GONE); } txtvUrl.setText(feed.getDownload_url() + " {fa-paperclip}"); Iconify.addIcons(txtvUrl); getActivity().invalidateOptionsMenu(); }</code><technical_language>getPlainText needs called if feed is atom1. Otherwise, PR fix original issue (that's atom1 feed)</technical_language>

Target:
private void showFeed() { Log.d(TAG, "Language is " + feed.getLanguage()); Log.d(TAG, "Author is " + feed.getAuthor()); Log.d(TAG, "URL is " + feed.getDownload_url()); Glide.with(getContext()) .load(feed.getImageLocation()) .apply(new RequestOptions() .placeholder(R.color.light_gray) .error(R.color.light_gray) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .fitCenter() .dontAnimate()) .into(imgvCover); Glide.with(getContext()) .load(feed.getImageLocation()) .apply(new RequestOptions() .placeholder(R.color.image_readability_tint) .error(R.color.image_readability_tint) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .transform(new FastBlurTransformation()) .dontAnimate()) .into(imgvBackground); txtvTitle.setText(feed.getTitle()); String description = HtmlToPlainText.getPlainText(feed.getDescription()); txtvDescription.setText(description); if (!TextUtils.isEmpty(feed.getAuthor())) { txtvAuthor.setText(feed.getAuthor()); txtvAuthorHeader.setText(feed.getAuthor()); } else { lblAuthor.setVisibility(View.GONE); txtvAuthor.setVisibility(View.GONE); } if (!TextUtils.isEmpty(feed.getLanguage())) { txtvLanguage.setText(LangUtils.getLanguageString(feed.getLanguage())); } else { lblLanguage.setVisibility(View.GONE); txtvLanguage.setVisibility(View.GONE); } txtvUrl.setText(feed.getDownload_url() + " {fa-paperclip}"); Iconify.addIcons(txtvUrl); getActivity().invalidateOptionsMenu(); }
Source:
<code><START> @After public void tearDown() throws IOException { <END> FileUtil.fullyDelete(TEST_DIR); }</code><technical_language>Line Break</technical_language>

Target:
public void tearDown() throws IOException { FileUtil.fullyDelete(TEST_DIR); }
Source:
<code>private void initWsWorkUnitsSoapProxy(String baseURL, String user, String pass) { wsWorkunitsServiceSoapProxy = new WsWorkunitsServiceSoapProxy(baseURL); if (wsWorkunitsServiceSoapProxy != null) { WsWorkunitsServiceSoap wsWorkunitsServiceSoap = wsWorkunitsServiceSoapProxy.getWsWorkunitsServiceSoap(); if (user != null && pass != null) Connection.initStub((Stub) wsWorkunitsServiceSoap, user, pass); } <START> version5WorkunitsServiceSoapProxy = new org.hpccsystems.ws.client.gen.wsworkunits.v1_56.WsWorkunitsServiceSoapProxy( <END> baseURL); if (version5WorkunitsServiceSoapProxy != null) { org.hpccsystems.ws.client.gen.wsworkunits.v1_56.WsWorkunitsServiceSoap version5WorkunitsServiceSoap = version5WorkunitsServiceSoapProxy .getWsWorkunitsServiceSoap(); if (user != null && pass != null) Connection.initStub((Stub) version5WorkunitsServiceSoap, user, pass); } version6WorkunitsServiceSoapProxy = new org.hpccsystems.ws.client.gen.wsworkunits.v1_69.WsWorkunitsServiceSoapProxy( baseURL); if (version6WorkunitsServiceSoapProxy != null) { org.hpccsystems.ws.client.gen.wsworkunits.v1_69.WsWorkunitsServiceSoap version6WorkunitsServiceSoap = version6WorkunitsServiceSoapProxy .getWsWorkunitsServiceSoap(); if (user != null && pass != null) Connection.initStub((Stub) version6WorkunitsServiceSoap, user, pass); } }</code><technical_language>attempt instantiate of based target version</technical_language>

Target:
private void initWsWorkUnitsSoapProxy(String baseURL, String user, String pass) { soapWrapper=new WsWorkunitsClientSoapProxyWrapper(baseURL, user,pass,targetVersion); wsWorkunitsServiceSoapProxy = soapWrapper.getLatestRaw(); }
Source:
<code>private Callback kafkaSendCallback(final BatchItem item, final CountDownLatch done) { return (metadata, exception) -> { if (exception == null) { item.updateStatusAndDetail(EventPublishingStatus.SUBMITTED, ""); } else { <START> LOG.error("Failed to publish event " + item.getEvent().toString(), exception); <END> item.updateStatusAndDetail(EventPublishingStatus.FAILED, "internal error"); } done.countDown(); }; }</code><technical_language>I log event here, of security resons important is content of message here. I a failure publishing kafka depend message content, kafka care is a message</technical_language>

Target:
private Callback kafkaSendCallback(final BatchItem item, final CountDownLatch done) { return (metadata, exception) -> { if (exception == null) { item.updateStatusAndDetail(EventPublishingStatus.SUBMITTED, ""); } else { LOG.error("Failed to publish event", exception); item.updateStatusAndDetail(EventPublishingStatus.FAILED, "internal error"); } done.countDown(); }; }
Source:
<code>public void showStatus(GlusterVolumeTaskStatusEntity rebalanceStatusEntity) { List<GlusterVolumeTaskStatusForHost> rebalanceSessionsList = rebalanceStatusEntity.getHostwiseStatusDetails(); List<EntityModel> sessionList = new ArrayList<EntityModel>(); for (GlusterVolumeTaskStatusForHost hostDetail : rebalanceSessionsList) { EntityModel sessionModel = new EntityModel(hostDetail); sessionList.add(sessionModel); } getStartedTime().setEntity(rebalanceStatusEntity.getStartTime()); getStatusTime().setEntity(rebalanceStatusEntity.getStatusTime()); getRebalanceSessions().setItems(sessionList); if(rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.FINISHED) { setStatusAvailable(true); refresh.cancel(); }else { setStatusAvailable(false); if ((rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.ABORTED || rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.FAILED)) { refresh.cancel(); } } if (GlusterTaskType.REBALANCE.equals(getEntity().getAsyncTask().getType())) { getStopReblanceFromStatus().setIsExecutionAllowed(rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.STARTED); <START> } <END> }</code><technical_language>change == instead of equals</technical_language>

Target:
public void showStatus(GlusterVolumeTaskStatusEntity rebalanceStatusEntity) { List<GlusterVolumeTaskStatusForHost> rebalanceSessionsList = rebalanceStatusEntity.getHostwiseStatusDetails(); List<EntityModel> sessionList = new ArrayList<EntityModel>(); for (GlusterVolumeTaskStatusForHost hostDetail : rebalanceSessionsList) { EntityModel sessionModel = new EntityModel(hostDetail); sessionList.add(sessionModel); } getStartedTime().setEntity(rebalanceStatusEntity.getStartTime()); getStatusTime().setEntity(rebalanceStatusEntity.getStatusTime()); getRebalanceSessions().setItems(sessionList); if(rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.FINISHED) { setStatusAvailable(true); refresh.cancel(); }else { setStatusAvailable(false); if ((rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.ABORTED || rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.FAILED)) { refresh.cancel(); } } if (GlusterTaskType.REBALANCE == getEntity().getAsyncTask().getType()) { getStopReblanceFromStatus().setIsExecutionAllowed(rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.STARTED); } }
Source:
<code>private boolean isMine() { <START> return reviewitem.getReview().getRepository().getAccount().toString().compareTo(currentAuthor) == 0; <END> }</code><technical_language>This returns false toString returns org.eclipse.mylyn.reviews.internal.core.model.User@1b21a0a (id: 1000001, email: tests@mylyn.eclipse.org, displayName: tests)</technical_language>

Target:
private boolean isMine() { return (reviewitem != null) && (reviewitem.getReview() != null) && (reviewitem.getReview().getRepository() != null) && (reviewitem.getReview().getRepository().getAccount() != null) && (reviewitem.getReview().getRepository().getAccount().getDisplayName().compareTo(currentAuthor) == 0); }
Source:
<code>public void stop(@Nonnull Throwable cause) throws Exception { if (body!=null) <START> body.cancel(cause); <END> }</code><technical_language>enclose this in { } ;</technical_language>

Target:
public void stop(@Nonnull Throwable cause) throws Exception { if (body!=null) { body.cancel(cause); } }
Source:
<code>public void postMessage(final Direction direction, final Tuple update, final DifferentialTimestamp timestamp) { final TreeMap<DifferentialTimestamp, Map<Tuple, Integer>> activeQueue = getActiveQueue(); Map<Tuple, Integer> tupleMap = activeQueue.get(timestamp); final boolean wasEmpty = tupleMap == null; boolean significantChange = false; if (tupleMap == null) { tupleMap = CollectionsFactory.createMap(); activeQueue.put(timestamp, tupleMap); significantChange = true; } Integer count = tupleMap.get(update); if (count == null) { count = 0; significantChange = true; } if (direction == Direction.REVOKE) { count--; } else { count++; } if (count == 0) { tupleMap.remove(update); if (tupleMap.isEmpty()) { activeQueue.remove(timestamp); } significantChange = true; } else { tupleMap.put(update, count); } if (significantChange) { final CommunicationGroup targetGroup = this.getAdapter() != null ? this.getAdapter().getCurrentGroup() : this.getCurrentGroup(); <START> final Mailbox targetMailbox = this.getAdapter() != null ? this.getAdapter() : this; <END> if (wasEmpty) { targetGroup.notifyHasMessage(targetMailbox, timestamp); } else if (tupleMap.isEmpty()) { targetGroup.notifyLostAllMessages(targetMailbox, timestamp); } } }</code><technical_language>lines cleaner slightly faster if, in absence of a separate Adapter node, field adapter simply default this (declared protected Mailbox adapter = this)</technical_language>

Target:
public void postMessage(final Direction direction, final Tuple update, final DifferentialTimestamp timestamp) { final TreeMap<DifferentialTimestamp, IDeltaBag<Tuple>> activeQueue = getActiveQueue(); IDeltaBag<Tuple> tupleMap = activeQueue.get(timestamp); final boolean wasEmpty = tupleMap == null; boolean significantChange = false; if (tupleMap == null) { tupleMap = CollectionsFactory.createDeltaBag(); activeQueue.put(timestamp, tupleMap); significantChange = true; } int count = tupleMap.getCount(update); if (count == 0) { significantChange = true; } if (direction == Direction.REVOKE) { count--; } else { count++; } if (count == 0) { tupleMap.clearAllOf(update); if (tupleMap.isEmpty()) { activeQueue.remove(timestamp); } significantChange = true; } else { tupleMap.addSigned(update, count); } if (significantChange) { final Mailbox targetMailbox = this.adapter; final CommunicationGroup targetGroup = this.adapter.getCurrentGroup(); if (wasEmpty) { targetGroup.notifyHasMessage(targetMailbox, timestamp); } else if (tupleMap.isEmpty()) { targetGroup.notifyLostAllMessages(targetMailbox, timestamp); } } }
Source:
<code>public void validate(Object obj, Errors errors) { if (obj == null || !(obj instanceof CohortMembership)) { throw new IllegalArgumentException("The parameter obj should not be null and must be of type" + CohortMembership.class); } CohortMembership cohortMembership = (CohortMembership) obj; Patient p = cohortMembership.getPatient(); <START> if (p.getVoided() != cohortMembership.getVoided()) { <END> errors.rejectValue("voided", "Cohort.patientAndMembershipShouldBeVoided"); } ValidateUtil.validateFieldLengths(errors, obj.getClass(), "voided"); }</code><technical_language>I this fail if a voided membership unvoided patient allowed</technical_language>

Target:
public void validate(Object obj, Errors errors) { if (obj == null || !(obj instanceof Cohort)) { throw new IllegalArgumentException("The parameter obj should not be null and must be of type" + Cohort.class); } Cohort cohort = (Cohort) obj; Collection<CohortMembership> members = cohort.getMembers(); if (!CollectionUtils.isEmpty(members)) { for (CohortMembership member : members) { Patient p = member.getPatient(); if (p.getVoided() && !member.getVoided()) { String eMessage = "Patient " + p.getPatientId() + " is voided, cannot add voided members to a cohort"; errors.rejectValue("members", "Cohort.patientAndMemberShouldBeVoided", eMessage); } } } }
Source:
<code>public void tearDown() throws Exception { ThreadTracker.longRunningThreadCreated( ApplicationManager.getApplication(), "BaseDataReader", "ProcessWaitFor", "Timer" ); try { if (myCompilerTester != null) { myCompilerTester.tearDown(); } killNailgun(); cleanProjectRoot(); Messages.setTestDialog(TestDialog.DEFAULT); final Stream<Sdk> leakedJdks = Arrays.stream(ProjectJdkTable.getInstance().getAllJdks()) .filter(jdk -> { final String name = jdk.getName(); <START> return name.contains("pants") || name.startsWith("python"); <END> }); leakedJdks.forEach(jdk -> { ApplicationManager.getApplication().runWriteAction(() -> { ProjectJdkTable.getInstance().removeJdk(jdk); }); }); super.tearDown(); } catch (Throwable throwable) { if (!throwable.getMessage().contains("Already disposed")) { throw throwable; } } }</code><technical_language>checking for JDK python interpreter</technical_language>

Target:
public void tearDown() throws Exception { ThreadTracker.longRunningThreadCreated( ApplicationManager.getApplication(), "BaseDataReader", "ProcessWaitFor", "Timer" ); try { if (myCompilerTester != null) { myCompilerTester.tearDown(); } killNailgun(); cleanProjectRoot(); Messages.setTestDialog(TestDialog.DEFAULT); removeJdks(jdk -> jdk.getName().contains("pants")); super.tearDown(); } catch (Throwable throwable) { if (!throwable.getMessage().contains("Already disposed")) { throw throwable; } } }
Source:
<code>public static LocationSummary newInstance(ManagementContext mgmt, String id, LocationSpec locationSpec, LocationDetailLevel level) { Map<String, ?> config = locationSpec.getConfig(); if (level==LocationDetailLevel.FULL_EXCLUDING_SECRET || level==LocationDetailLevel.FULL_INCLUDING_SECRET) { LocationDefinition ld = new BasicLocationDefinition(id, locationSpec.getName(), locationSpec.getSpec(), locationSpec.getConfig()); Location ll = mgmt.getLocationRegistry().lookup(ld); if (ll!=null) config = ll.getAllConfig(true); } else if (level==LocationDetailLevel.LOCAL_EXCLUDING_SECRET) { if (!config.containsKey(LocationConfigKeys.DISPLAY_NAME.getName()) && mgmt!=null) { LocationDefinition ld = new BasicLocationDefinition(id, locationSpec.getName(), locationSpec.getSpec(), locationSpec.getConfig()); Location ll = mgmt.getLocationRegistry().lookup(ld); if (ll!=null) { <START> Map<String, Object> configExtra = ll.getAllConfig(true); <END> if (configExtra.containsKey(LocationConfigKeys.DISPLAY_NAME.getName())) { ConfigBag configNew = ConfigBag.newInstance(configExtra); configNew.configure(LocationConfigKeys.DISPLAY_NAME, (String)configExtra.get(LocationConfigKeys.DISPLAY_NAME.getName())); config = configNew.getAllConfig(); } } } } return new LocationSummary( id, locationSpec.getName(), locationSpec.getSpec(), null, copyConfig(config, level), ImmutableMap.of("self", URI.create("/v1/locations/" + id))); }</code><technical_language>this ll.getAllConfig(true) for LOCAL_EXCLUDING_SECRET? include inherited well</technical_language>

Target:
public static LocationSummary newInstance(ManagementContext mgmt, String id, LocationSpec locationSpec, LocationDetailLevel level) { Map<String, ?> config = locationSpec.getConfig(); if (level==LocationDetailLevel.FULL_EXCLUDING_SECRET || level==LocationDetailLevel.FULL_INCLUDING_SECRET) { LocationDefinition ld = new BasicLocationDefinition(id, locationSpec.getName(), locationSpec.getSpec(), locationSpec.getConfig()); Location ll = mgmt.getLocationRegistry().resolveForPeeking(ld); if (ll!=null) config = ll.getAllConfig(true); } else if (level==LocationDetailLevel.LOCAL_EXCLUDING_SECRET) { if (!config.containsKey(LocationConfigKeys.DISPLAY_NAME.getName()) && mgmt!=null) { LocationDefinition ld = new BasicLocationDefinition(id, locationSpec.getName(), locationSpec.getSpec(), locationSpec.getConfig()); Location ll = mgmt.getLocationRegistry().resolveForPeeking(ld); if (ll!=null) { Map<String, Object> configExtra = ll.getAllConfig(true); if (configExtra.containsKey(LocationConfigKeys.DISPLAY_NAME.getName())) { ConfigBag configNew = ConfigBag.newInstance(config); configNew.configure(LocationConfigKeys.DISPLAY_NAME, (String)configExtra.get(LocationConfigKeys.DISPLAY_NAME.getName())); config = configNew.getAllConfig(); } } } } return new LocationSummary( id, locationSpec.getName(), locationSpec.getSpec(), null, copyConfig(config, level), ImmutableMap.of("self", URI.create("/v1/locations/" + id))); }
Source:
<code>public MamResultExtension parse(XmlPullParser parser, int initialDepth) throws Exception { String queryId = null; String id = null; Forwarded forwarded = null; <START> if (parser.getName().equals(MamResultExtension.ELEMENT)) { <END> queryId = parser.getAttributeValue("", "queryid"); id = parser.getAttributeValue("", "id"); boolean done = false; while (!done) { int eventType = parser.next(); if (eventType == XmlPullParser.START_TAG) { if (parser.getName().equals(Forwarded.ELEMENT)) { forwarded = new ForwardedProvider().parse(parser); } } else if (eventType == XmlPullParser.END_TAG) { if (parser.getName().equals(MamResultExtension.ELEMENT)) { done = true; } } } } return new MamResultExtension(queryId, id, forwarded); }</code><technical_language>is unusual check</technical_language>

Target:
public MamResultExtension parse(XmlPullParser parser, int initialDepth) throws Exception { Forwarded forwarded = null; String queryId = parser.getAttributeValue("", "queryid"); String id = parser.getAttributeValue("", "id"); outerloop: while (true) { int eventType = parser.next(); if (eventType == XmlPullParser.START_TAG) { if (parser.getName().equals(Forwarded.ELEMENT)) { forwarded = new ForwardedProvider().parse(parser); } } else if (eventType == XmlPullParser.END_TAG) { if (parser.getDepth() == initialDepth) { break outerloop; } } } return new MamResultExtension(queryId, id, forwarded); }
Source:
<code>private DocumentStore(File location, KeyProvider keyProvider) throws DatastoreException, IOException, SQLException { this.location = location; this.databaseName = location.getName(); this.database = new DatabaseImpl(location, keyProvider); <START> this.database.getEventBus().register(this); <END> this.query = new IndexManagerImpl(database); }</code><technical_language>I @subscribe annotations is this done</technical_language>

Target:
private DocumentStore(File location, KeyProvider keyProvider) throws DatastoreException, IOException, SQLException { this.location = location; this.databaseName = location.getName(); this.database = new DatabaseImpl(location, keyProvider); this.query = new IndexManagerImpl(database); }
Source:
<code>protected boolean areEqual(Object obj1, Object obj2) { if (obj1 == null) { return (obj2 == null); } if (obj2 == null) { return false; } <START> if (JHelper.objectSameReference(obj1, obj2)) { <END> return true; } if (obj1 instanceof BigDecimal) { if (obj2 instanceof BigDecimal) { Comparable com1 = (Comparable) obj1; return (com1.compareTo(obj2) == 0); } else { return false; } } if (obj1 instanceof URL) { return obj1.toString().equals(obj2.toString()); } return obj1.equals(obj2); }</code><technical_language>a common patteen in equals method. == (.equals) is</technical_language>

Target:
protected boolean areEqual(Object obj1, Object obj2) { if (obj1 == null) { return (obj2 == null); } if (obj2 == null) { return false; } if (obj1 == obj2) { return true; } if (obj1 instanceof BigDecimal) { if (obj2 instanceof BigDecimal) { Comparable com1 = (Comparable) obj1; return (com1.compareTo(obj2) == 0); } else { return false; } } if (obj1 instanceof URL) { return obj1.toString().equals(obj2.toString()); } return obj1.equals(obj2); }
Source:
<code>public CdnDTO create( @ApiParam(name = "cdn", required = true) CdnDTO cdnDTOInput, @Context Principal principal) { Cdn existing = curator.lookupByLabel(cdnDTOInput.getLabel()); if (existing != null) { throw new BadRequestException(i18n.tr( "A CDN with the label {0} already exists", cdnDTOInput.getLabel())); } Cdn cndToCreate = new Cdn(); <START> this.populateEntity(cndToCreate, cdnDTOInput); <END> return this.translator.translate(cdnManager.createCdn(cndToCreate), CdnDTO.class); }</code><technical_language>longer persisting entity created here. Need call CdnCurator Manager create instance. is preferred here</technical_language>

Target:
public CdnDTO create( @ApiParam(name = "cdn", required = true) CdnDTO cdnDTOInput, @Context Principal principal) { Cdn existing = curator.lookupByLabel(cdnDTOInput.getLabel()); if (existing != null) { throw new BadRequestException(i18n.tr( "A CDN with the label {0} already exists", cdnDTOInput.getLabel())); } Cdn cndToCreate = new Cdn(); this.populateEntity(cndToCreate, cdnDTOInput); if (cdnDTOInput.getLabel() != null) { cndToCreate.setLabel(cdnDTOInput.getLabel()); } return this.translator.translate(cdnManager.createCdn(cndToCreate), CdnDTO.class); }
Source:
<code>private void check(CryptoMode cryptoMode) { <START> if (cryptoProvider == null && (cryptoMode == CryptoMode.AuthenticatedEncryption <END> || cryptoMode == CryptoMode.StrictAuthenticatedEncryption)) { if (!CryptoRuntime.isBouncyCastleAvailable()) { CryptoRuntime.enableBouncyCastle(); if (!CryptoRuntime.isBouncyCastleAvailable()) { throw new UnsupportedOperationException( "The Bouncy castle library jar is required on the classpath to enable authenticated encryption"); } } if (!CryptoRuntime.isAesGcmAvailable()) throw new UnsupportedOperationException( "More recent version of the Bouncy castle library is required to enable authenticated encryption"); } }</code><technical_language>Do need check alwaysUseCryptoProvider here? I.E. if set a custom crypto provider alwaysUseCryptoProvider is false try BC for AE</technical_language>

Target:
private void check(CryptoMode cryptoMode) { boolean preferBC = (cryptoMode == CryptoMode.AuthenticatedEncryption) || (cryptoMode == CryptoMode.StrictAuthenticatedEncryption); boolean haveOverride = (cryptoProvider != null && alwaysUseCryptoProvider); if (preferBC && !haveOverride) { if (!CryptoRuntime.isBouncyCastleAvailable()) { CryptoRuntime.enableBouncyCastle(); if (!CryptoRuntime.isBouncyCastleAvailable()) { throw new UnsupportedOperationException( "The Bouncy castle library jar is required on the classpath to enable authenticated encryption"); } } if (!CryptoRuntime.isAesGcmAvailable()) throw new UnsupportedOperationException( "More recent version of the Bouncy castle library is required to enable authenticated encryption"); } }
Source:
<code>private void addDevice(XmlRpcStruct struct, VmDevice vmDevice, String path) { Map<String, Object> specParams = <START> (vmDevice.getSpecParams() == null) ? new HashMap<String, Object>() : vmDevice.getSpecParams(); <END> struct.add(VdsProperties.Path, path); struct.add(VdsProperties.SpecParams, specParams); struct.add(VdsProperties.DeviceId, String.valueOf(vmDevice.getId().getDeviceId())); addBootOrder(vmDevice, struct); devices.add(struct); addToManagedDevices(vmDevice); }</code><technical_language>Collections.emptyMap() instead of new HashMap()</technical_language>

Target:
private void addDevice(XmlRpcStruct struct, VmDevice vmDevice, String path) { Map<String, Object> specParams = (vmDevice.getSpecParams() == null) ? Collections.<String, Object> emptyMap() : vmDevice.getSpecParams(); struct.add(VdsProperties.Path, path); struct.add(VdsProperties.SpecParams, specParams); struct.add(VdsProperties.DeviceId, String.valueOf(vmDevice.getId().getDeviceId())); addBootOrder(vmDevice, struct); devices.add(struct); addToManagedDevices(vmDevice); }
Source:
<code>public boolean add(Setting setting) { SimpleUri id = setting.getId(); if (id == null) { LOGGER.warn("The id of a setting cannot be null."); return false; } else if (contains(id)) { LOGGER.warn("A Setting with the id \"{}\" already exists.", id); return false; } if (unusedSettings != null) { <START> if (unusedSettings.containsKey(id)) { <END> setting.setValueFromString(unusedSettings.remove(id)); } } settingMap.put(id, setting); return true; }</code><technical_language>This unexpected sideeffect a caller of fc.add(setting) expect add call of setting same</technical_language>

Target:
public boolean add(Setting setting) { SimpleUri id = setting.getId(); if (id == null) { LOGGER.warn("The id of a setting cannot be null."); return false; } else if (contains(id)) { LOGGER.warn("A Setting with the id \"{}\" already exists.", id); return false; } if (temporarilyParkedSettings.containsKey(id)) { setting.setValueFromString(temporarilyParkedSettings.remove(id)); } settings.put(id, setting); return true; }
Source:
<code><START> public EditText initProgramServer(){ <END> return null; }</code><technical_language>return null in caller is return value, refactor this method void</technical_language>

Target:
public void initProgramServer(){ }
Source:
<code>private QueryHandle executeAsyncInternal(GrillSessionHandle sessionHandle, QueryContext ctx) throws GrillException { LOG.info("execute configuration: "); for(Map.Entry<String,String> entry: ctx.getConf()) { LOG.info(entry.getKey()+":"+entry.getValue()); <START> } <END> ctx.setGrillSessionIdentifier(sessionHandle.getPublicId().toString()); QueryStatus before = ctx.getStatus(); ctx.setStatus(new QueryStatus(0.0, QueryStatus.Status.QUEUED, "Query is queued", false, null, null)); acceptedQueries.add(ctx); allQueries.put(ctx.getQueryHandle(), ctx); fireStatusChangeEvent(ctx, ctx.getStatus(), before); LOG.info("Returning handle " + ctx.getQueryHandle().getHandleId()); return ctx.getQueryHandle(); }</code><technical_language>debug logging removed</technical_language>

Target:
private QueryHandle executeAsyncInternal(GrillSessionHandle sessionHandle, QueryContext ctx) throws GrillException { ctx.setGrillSessionIdentifier(sessionHandle.getPublicId().toString()); QueryStatus before = ctx.getStatus(); ctx.setStatus(new QueryStatus(0.0, QueryStatus.Status.QUEUED, "Query is queued", false, null, null)); acceptedQueries.add(ctx); allQueries.put(ctx.getQueryHandle(), ctx); fireStatusChangeEvent(ctx, ctx.getStatus(), before); LOG.info("Returning handle " + ctx.getQueryHandle().getHandleId()); return ctx.getQueryHandle(); }
Source:
<code>public static AdvancedInsightResponse fromJson(String json) { try { ObjectMapper mapper = new ObjectMapper(); return mapper.readValue(json, AdvancedInsightResponse.class); } catch (IOException jpe) { <START> throw new NexmoUnexpectedException("Failed to produce BasicInsightResponse from json.", jpe); <END> } }</code><technical_language>Failed produce *AdvancedInsightResponse* json</technical_language>

Target:
public static AdvancedInsightResponse fromJson(String json) { try { ObjectMapper mapper = new ObjectMapper(); return mapper.readValue(json, AdvancedInsightResponse.class); } catch (IOException jpe) { throw new NexmoUnexpectedException("Failed to produce AdvancedInsightResponse from json.", jpe); } }
Source:
<code>public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("Permission {"); sb.append("resource: "); sb.append(resource); sb.append("\tOperation: "); sb.append(operation.toString()); sb.append("\tAuthorization attribute: "); sb.append(authorizationAttribute.toString()); <START> sb.append("}."); <END> return sb.toString(); }</code><technical_language>chain calls here? .append(...).append(...).append(...)</technical_language>

Target:
public String toString() { final StringBuilder sb = new StringBuilder(); return sb.append("Permission {resource: ") .append(resource) .append("\tOperation: ") .append(operation.toString()) .append("\tAuthorization attribute: ") .append(authorizationAttribute.toString()) .append("}.") .toString(); }
Source:
<code>private void handleGroupAlreadyExistException(String groupName, List<String> userIDList, List<org.wso2.carbon.user.core.Permission> permissions) throws UserStoreException { <START> String errorCode = ErrorMessages.ERROR_CODE_ROLE_ALREADY_EXISTS.getCode(); <END> String errorMessage = String.format(ErrorMessages.ERROR_CODE_ROLE_ALREADY_EXISTS.getMessage(), groupName); handleAddGroupFailure(errorCode, errorMessage, groupName, userIDList, permissions); throw new UserStoreException(errorCode + " - " + errorMessage); }</code><technical_language>suggestion String errorCode = ERROR_CODE_ROLE_ALREADY_EXISTS.getCode();</technical_language>

Target:
private void handleGroupAlreadyExistException(String groupName, List<String> userIDList, List<org.wso2.carbon.user.core.Permission> permissions) throws UserStoreException { String errorCode = ERROR_CODE_ROLE_ALREADY_EXISTS.getCode(); String errorMessage = String.format(ERROR_CODE_ROLE_ALREADY_EXISTS.getMessage(), groupName); handleAddGroupFailure(errorCode, errorMessage, groupName, userIDList, permissions); throw new UserStoreException(errorCode + " - " + errorMessage); }
Source:
<code>private boolean isUsageOverrideListHasOnlyNull(List<UsagePriceOverride> usagePriceOverrides) { for (UsagePriceOverride override : usagePriceOverrides) <START> if (override != null) return false; <END> return true; }</code><technical_language>Nit: Add brackets: if (override != null) { return false; }</technical_language>

Target:
private boolean isUsageOverrideListHasOnlyNull(List<UsagePriceOverride> usagePriceOverrides) { for (UsagePriceOverride override : usagePriceOverrides) { if (override != null) { return false; } } return true; }
Source:
<code>public String browseNetworks(@PathVariable("ProjectUnixName") String unixName, Model model, Principal principal, @InjectProject(unixNameParameter = "ProjectUnixName") IProject project) throws QuadrigaStorageException { String projectid = project.getProjectId(); List<INetwork> networks = networkmanager.getNetworksInProject(projectid, INetworkStatus.APPROVED); for(INetwork nw: networks) <START> model.addAttribute("networks", networks); <END> model.addAttribute("project", project); return "sites/browseNetworks"; }</code><technical_language>formatting missing brackets</technical_language>

Target:
public String browseNetworks(@PathVariable("ProjectUnixName") String unixName, Model model, Principal principal, @InjectProject(unixNameParameter = "ProjectUnixName") IProject project) throws QuadrigaStorageException { String projectid = project.getProjectId(); List<INetwork> networks = networkmanager.getNetworksInProject(projectid, INetworkStatus.APPROVED); model.addAttribute("networks", networks); model.addAttribute("project", project); return "sites/browseNetworks"; }
Source:
<code>public void deleteAllGroups(PerunSession sess, Vo vo) throws InternalErrorException, GroupAlreadyRemovedException, GroupAlreadyRemovedFromResourceException { for(Group group: getGroupsManagerImpl().getGroups(sess, vo)) { if (group.getName().equals(VosManager.MEMBERS_GROUP)) { continue; } List<Resource> assignedResources = getPerunBl().getResourcesManagerBl().getAssignedResources(sess, group); try { for (Resource resource : assignedResources) { getPerunBl().getResourcesManagerBl().removeGroupFromResource(sess, group, resource); getPerunBl().getAttributesManagerBl().removeAllAttributes(sess, resource, group); } getPerunBl().getAttributesManagerBl().removeAllAttributes(sess, group); } catch (GroupNotDefinedOnResourceException ex) { throw new ConsistencyErrorException(ex); } catch (AttributeValueException ex) { throw new ConsistencyErrorException("All resources were removed from this group. So all attributes values can be removed.", ex); } catch (WrongAttributeAssignmentException ex) { throw new InternalErrorException(ex); } try { this.deleteGroup(sess, group, true); <START> } catch (RelationExistsException | WrongReferenceAttributeValueException | AlreadyMemberException | <END> NotGroupMemberException | GroupNotExistsException | WrongAttributeValueException e) { throw new ConsistencyErrorException(e); } } getPerunBl().getAuditer().log(sess, "All group in deleted.", vo); }</code><technical_language>GroupOperationException</technical_language>

Target:
public void deleteAllGroups(PerunSession sess, Vo vo) throws InternalErrorException, GroupAlreadyRemovedException, GroupAlreadyRemovedFromResourceException, GroupOperationsException { for(Group group: getGroupsManagerImpl().getGroups(sess, vo)) { if (group.getName().equals(VosManager.MEMBERS_GROUP)) { continue; } List<Resource> assignedResources = getPerunBl().getResourcesManagerBl().getAssignedResources(sess, group); try { for (Resource resource : assignedResources) { getPerunBl().getResourcesManagerBl().removeGroupFromResource(sess, group, resource); getPerunBl().getAttributesManagerBl().removeAllAttributes(sess, resource, group); } getPerunBl().getAttributesManagerBl().removeAllAttributes(sess, group); } catch (GroupNotDefinedOnResourceException ex) { throw new ConsistencyErrorException(ex); } catch (AttributeValueException ex) { throw new ConsistencyErrorException("All resources were removed from this group. So all attributes values can be removed.", ex); } catch (WrongAttributeAssignmentException ex) { throw new InternalErrorException(ex); } try { this.deleteGroup(sess, group, true); } catch (RelationExistsException | GroupNotExistsException e) { throw new ConsistencyErrorException(e); } } getPerunBl().getAuditer().log(sess, "All group in deleted.", vo); }
Source:
<code>public int compareTo( DurationValue other ) { return Comparator.comparingLong(DurationValue::averageLengthInNanos) .thenComparingLong( DurationValue::getMonths ) .thenComparingLong( DurationValue::getDays ) .thenComparingLong( DurationValue::getSeconds ) <START> .thenComparingInt( DurationValue::getNanos ).compare( this, other ); <END> }</code><technical_language>Tiny implementation note: Comparator statically defined, is unnecessary recreate a new Comparator time compare DurationValue objects</technical_language>

Target:
public int compareTo( DurationValue other ) { return COMPARATOR.compare( this, other ); }
Source:
<code>public void testUsedByBatch() throws Exception { final List<UseManyEntries> entryList = new ArrayList<>(); final Entry entry1 = new Entry(null, TITLE, null, null, null, null, false, null, null, null, null, false, false); final Entry entry2 = new Entry(null, TITLE2, null, null, null, null, false, null, null, null, null, false, false); entryList.add(new UseManyEntries(OBJ_URI, asList(entry1))); entryList.add(new UseManyEntries(OBJ_URI2, asList(entry1, entry2))); final UseMany useMany = new UseMany(entryList); onRequest() .havingMethodEqualTo("POST") .havingPathEqualTo(USEDBY_URI) .respond() .withStatus(200) .withBody(MAPPER.writeValueAsString(useMany)); final Collection<Usage> result = gd.getMetadataService().usedBy(project, new HashSet<>(asList(OBJ_URI, OBJ_URI2)), false, ReportDefinition.class); assertThat(result, is(notNullValue())); <START> assertThat(result.size(), is(2)); <END> final Iterator<Usage> usages = result.iterator(); final Usage usage1 = usages.next(); assertThat(usage1.getUri(), is(OBJ_URI)); assertThat(usage1.getUsedBy().iterator().next().getTitle(), is(TITLE)); final Usage usage2 = usages.next(); assertThat(usage2.getUri(), is(OBJ_URI2)); final Iterator<Entry> obj2Entries = usage2.getUsedBy().iterator(); assertThat(obj2Entries.next().getTitle(), is(TITLE)); assertThat(obj2Entries.next().getTitle(), is(TITLE2)); }</code><technical_language>hasSize()</technical_language>

Target:
public void testUsedByBatch() throws Exception { final List<UseManyEntries> entryList = new ArrayList<>(); final Entry entry1 = new Entry(null, TITLE, null, null, null, null, false, null, null, null, null, false, false); final Entry entry2 = new Entry(null, TITLE2, null, null, null, null, false, null, null, null, null, false, false); entryList.add(new UseManyEntries(OBJ_URI, asList(entry1))); entryList.add(new UseManyEntries(OBJ_URI2, asList(entry1, entry2))); final UseMany useMany = new UseMany(entryList); onRequest() .havingMethodEqualTo("POST") .havingPathEqualTo(USEDBY_URI) .respond() .withStatus(200) .withBody(MAPPER.writeValueAsString(useMany)); final Collection<Usage> result = gd.getMetadataService().usedBy(project, new HashSet<>(asList(OBJ_URI, OBJ_URI2)), false, ReportDefinition.class); assertThat(result, hasSize(2)); final Iterator<Usage> usages = result.iterator(); final Usage usage1 = usages.next(); assertThat(usage1.getUri(), is(OBJ_URI)); assertThat(usage1.getUsedBy().iterator().next().getTitle(), is(TITLE)); final Usage usage2 = usages.next(); assertThat(usage2.getUri(), is(OBJ_URI2)); final Iterator<Entry> obj2Entries = usage2.getUsedBy().iterator(); assertThat(obj2Entries.next().getTitle(), is(TITLE)); assertThat(obj2Entries.next().getTitle(), is(TITLE2)); }
Source:
<code>Table<String, String, String> getPerStageSelectedFields() { ImmutableTable.Builder<String, String, String> tableBuilder = new ImmutableTable.Builder<>(); if (Strings.isNullOrEmpty(selectedFields)) { throw new IllegalArgumentException("selectedFields can not be empty. Please provide at least 1 selectedFields"); } for (String selectedField : Splitter.on(',').trimResults().omitEmptyStrings().split(selectedFields)) { Iterable<String> stageOldNameAliasPair = Splitter.on(" as ").trimResults().omitEmptyStrings() .split(selectedField); <START> if (Iterables.size(stageOldNameAliasPair) != 2) { <END> throw new IllegalArgumentException(String.format("Invalid syntax. Selected Fields must be of syntax " + "<stageName>.<oldFieldName> as <alias>, but found %s", selectedField)); } Iterable<String> stageOldNamePair = Splitter.on('.').trimResults().omitEmptyStrings(). split(Iterables.get(stageOldNameAliasPair, 0)); if (Iterables.size(stageOldNameAliasPair) != 2) { throw new IllegalArgumentException(String.format("Invalid syntax. Selected Fields must be of syntax " + "<stageName>.<oldFieldName> as <alias>, but found %s", selectedField)); } String alias = Iterables.get(stageOldNameAliasPair, 1); tableBuilder.put(Iterables.get(stageOldNamePair, 0), Iterables.get(stageOldNamePair, 1), alias); } return tableBuilder.build(); }</code><technical_language>require people ' '. Instead, if ' ' is used, alias field name</technical_language>

Target:
Table<String, String, String> getPerStageSelectedFields() { ImmutableTable.Builder<String, String, String> tableBuilder = new ImmutableTable.Builder<>(); if (Strings.isNullOrEmpty(selectedFields)) { throw new IllegalArgumentException("selectedFields can not be empty. Please provide at least 1 selectedFields"); } for (String selectedField : Splitter.on(',').trimResults().omitEmptyStrings().split(selectedFields)) { Iterable<String> stageOldNameAliasPair = Splitter.on(" as ").trimResults().omitEmptyStrings() .split(selectedField); Iterable<String> stageOldNamePair = Splitter.on('.').trimResults().omitEmptyStrings(). split(Iterables.get(stageOldNameAliasPair, 0)); if (Iterables.size(stageOldNameAliasPair) != 2) { throw new IllegalArgumentException(String.format("Invalid syntax. Selected Fields must be of syntax " + "<stageName>.<oldFieldName> as <alias>, but found %s", selectedField)); } String alias = (Iterables.size(stageOldNameAliasPair) == 1) ? Iterables.get(stageOldNameAliasPair, 0) : Iterables.get(stageOldNameAliasPair, 1); tableBuilder.put(Iterables.get(stageOldNamePair, 0), Iterables.get(stageOldNamePair, 1), alias); } return tableBuilder.build(); }
Source:
<code>public void testGetAllForStoragePoolWithPermissionsPrivilegedUser() { <START> Guid storagePoolId = Guid.createGuidFromString("6d849ebf-755f-4552-ad09-9a090cda105d"); <END> List<StorageDomain> result = dao.getAllForStoragePool(storagePoolId, PRIVILEGED_USER_ID, true); assertGetAllForStoragePoolResult(result, storagePoolId); }</code><technical_language>new Guid(String) - this literal null</technical_language>

Target:
public void testGetAllForStoragePoolWithPermissionsPrivilegedUser() { Guid storagePoolId = new Guid("6d849ebf-755f-4552-ad09-9a090cda105d"); List<StorageDomain> result = dao.getAllForStoragePool(storagePoolId, PRIVILEGED_USER_ID, true); assertGetAllForStoragePoolResult(result, storagePoolId); }
Source:
<code>protected void configure() { bind(Props.class).toInstance(this.config.getProps()); bind(Storage.class).to(resolveStorageClassType()); bind(DatabaseOperator.class).to(DatabaseOperatorImpl.class); bind(TriggerLoader.class).to(JdbcTriggerImpl.class); bind(ProjectLoader.class).to(JdbcProjectImpl.class); bind(DataSource.class).to(AzkabanDataSource.class); bind(ExecutorLoader.class).to(JdbcExecutorLoader.class); bind(MetricRegistry.class).in(Scopes.SINGLETON); <START> bind(ExecutorApiClient.class).in(Scopes.SINGLETON); <END> }</code><technical_language>Please Singleton annotation remove this explicit binding. plan remove existing usage pattern</technical_language>

Target:
protected void configure() { bind(Props.class).toInstance(this.config.getProps()); bind(Storage.class).to(resolveStorageClassType()); bind(DatabaseOperator.class).to(DatabaseOperatorImpl.class); bind(TriggerLoader.class).to(JdbcTriggerImpl.class); bind(ProjectLoader.class).to(JdbcProjectImpl.class); bind(DataSource.class).to(AzkabanDataSource.class); bind(ExecutorLoader.class).to(JdbcExecutorLoader.class); bind(MetricRegistry.class).in(Scopes.SINGLETON); }
Source:
<code>public TaskRepository getTaskRepository() { if(this.taskRepository == null) { if(this.taskExecutionDaoFactoryBean == null) { <START> this.taskExecutionDaoFactoryBean = new TaskExecutionDaoFactoryBean(this.context); <END> } this.taskRepository = new SimpleTaskRepository(this.taskExecutionDaoFactoryBean); } return this.taskRepository; }</code><technical_language>create taskExecutionDAoFactoryBean in ctor</technical_language>

Target:
public TaskRepository getTaskRepository() { return this.taskRepository; }
Source:
<code>private Project.NameKey getProjectName(final File gitDir) { String relativeGitPath; try { relativeGitPath = getBasePath().getCanonicalFile().toURI().relativize(gitDir.getCanonicalFile().toURI()).getPath(); } catch (IOException e) { throw new RuntimeException(e); <START> } <END> if (!relativeGitPath.endsWith("/")) { relativeGitPath = relativeGitPath + "/"; } final String prefix = relativeGitPath.substring(0, relativeGitPath.length() - 1 - gitDir.getName().length()); return getProjectName(prefix, gitDir.getName()); }</code><technical_language>This change unrelated. accidentally included</technical_language>

Target:
private Project.NameKey getProjectName(final File gitDir) { String relativeGitPath = getBasePath().toURI().relativize(gitDir.toURI()).getPath(); if (!relativeGitPath.endsWith("/")) { relativeGitPath = relativeGitPath + "/"; } final String prefix = relativeGitPath.substring(0, relativeGitPath.length() - 1 - gitDir.getName().length()); return getProjectName(prefix, gitDir.getName()); }
Source:
<code>public void testNegativeWeight() { String error = ""; <START> try { <END> assertAggregation( precisionRecallFunction, 0.0, createLongsBlock(Long.valueOf(200)), createBooleansBlock(Boolean.valueOf(true)), createDoublesBlock(Double.valueOf(0.2)), createDoublesBlock(Double.valueOf(-0.2))); } catch (PrestoException e) { error = e.getMessage(); } assertTrue(error.toLowerCase(Locale.ENGLISH).contains("weight")); assertTrue(error.toLowerCase(Locale.ENGLISH).contains("negative")); }</code><technical_language>I omit check specific text of exception wrap assertAggregation assertThrows(PrestoException.class, () -> assertAggregation(...))</technical_language>

Target:
public void testNegativeWeight() { try { assertAggregation( precisionRecallFunction, 0.0, createLongsBlock(Long.valueOf(200)), createBooleansBlock(Boolean.valueOf(true)), createDoublesBlock(Double.valueOf(0.2)), createDoublesBlock(Double.valueOf(-0.2))); fail("Expected PrestoException"); } catch (PrestoException e) { assertTrue(e.getMessage().toLowerCase(Locale.ENGLISH).contains("weight")); assertTrue(e.getMessage().toLowerCase(Locale.ENGLISH).contains("negative")); } }
Source:
<code>public static void getAllGroups(final CanvasCallback<Group[]> callback){ if(APIHelpers.paramIsNull(callback)) return; CanvasCallback<Group[]> bridge = new ExhaustiveBridgeCallback<>(callback, new ExhaustiveBridgeCallback.ExhaustiveBridgeEvents() { @Override public void performApiCallWithExhaustiveCallback(CanvasCallback callback, String nextURL) { getNextPageGroups(nextURL, callback); } @Override public Class classType() { return Group.class; } }); <START> bridge.readFromCache(getAllGroupsCacheFilename()); <END> getFirstPageGroups(callback); }</code><technical_language>callback.readFromCache getFirstPageGroups(bridge)</technical_language>

Target:
public static void getAllGroups(final CanvasCallback<Group[]> callback){ if(APIHelpers.paramIsNull(callback)) return; CanvasCallback<Group[]> bridge = new ExhaustiveBridgeCallback<>(callback, new ExhaustiveBridgeCallback.ExhaustiveBridgeEvents() { @Override public void performApiCallWithExhaustiveCallback(CanvasCallback callback, String nextURL) { getNextPageGroups(nextURL, callback); } @Override public Class classType() { return Group.class; } }); callback.readFromCache(getAllGroupsCacheFilename()); getFirstPageGroups(bridge); }