auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected DimensionHandler[] makeDimensionHandlers(final List<String> mergedDimensions, final List<ColumnCapabilitiesImpl> dimCapabilities) { final DimensionHandler[] handlers = new DimensionHandler[mergedDimensions.size()]; for (int i = 0; i < mergedDimensions.size(); i++) { ColumnCapabilities capabilities = dimCapabilities.get(i); String dimName = mergedDimensions.get(i); if (capabilities.getType() == ValueType.STRING && capabilities.isDictionaryEncoded()) { handlers[i] = new StringDimensionHandler(dimName); } if (capabilities.getType() == ValueType.LONG && !capabilities.isDictionaryEncoded()) { handlers[i] = new LongDimensionHandler(dimName); } if (capabilities.getType() == ValueType.FLOAT && !capabilities.isDictionaryEncoded()) { handlers[i] = new FloatDimensionHandler(dimName); } } return handlers; }

Target:
protected DimensionHandler[] makeDimensionHandlers(final List<String> mergedDimensions, final List<ColumnCapabilitiesImpl> dimCapabilities) { final DimensionHandler[] handlers = new DimensionHandler[mergedDimensions.size()]; for (int i = 0; i < mergedDimensions.size(); i++) { ColumnCapabilities capabilities = dimCapabilities.get(i); String dimName = mergedDimensions.get(i); handlers[i] = DimensionHandlerUtil.getHandlerFromCapabilities(dimName, capabilities); } return handlers; }
Source:
private boolean defer(ReplicaPushRequest req) { if (waitingForRetry()) { return true; } for (ReceiveCommand n : req.getCommands()) { ReceiveCommand o = waiting.get(n.getRefName()); if (o == null) { o = running.get(n.getRefName()); } if (o != null) { return true; } } return false; }

Target:
private boolean defer(ReplicaPushRequest req) { if (waitingForRetry()) { return true; } for (ReceiveCommand nextCmd : req.getCommands()) { ReceiveCommand priorCmd = waiting.get(nextCmd.getRefName()); if (priorCmd == null) { priorCmd = running.get(nextCmd.getRefName()); } if (priorCmd != null) { return true; } } return false; }
Source:
public void unlocksImmutableTimestampLockIfGettingMinLockedInVersionThrows() throws InterruptedException { Exception illegalStateException = new IllegalStateException(); when(timestampService.getFreshTimestamp()).thenReturn(5L); when(lockService.lock(eq(LOCK_CLIENT.getClientId()), any())).thenReturn(LOCK_REFRESH_TOKEN); when(lockService.getMinLockedInVersionId(any(LockClient.class))).thenThrow(illegalStateException); try { timelock.lockImmutableTimestamp(); fail(); } catch (Exception e) { assertEquals(e, illegalStateException); } verify(lockService).unlock(LOCK_REFRESH_TOKEN); }

Target:
public void unlocksImmutableTimestampLockIfGettingMinLockedInVersionThrows() throws InterruptedException { Exception illegalStateException = new IllegalStateException(); when(timestampService.getFreshTimestamp()).thenReturn(5L); when(lockService.lock(eq(LOCK_CLIENT.getClientId()), any())).thenReturn(LOCK_REFRESH_TOKEN); when(lockService.getMinLockedInVersionId(any(String.class))).thenThrow(illegalStateException); assertThatThrownBy(timelock::lockImmutableTimestamp).hasCause(illegalStateException); verify(lockService).unlock(LOCK_REFRESH_TOKEN); }
Source:
public void showProgressDialog(Context context) { if (!mShowDialog) { return; } if (mProgressDialog == null) { if (TextUtils.isEmpty(mDialogMsg)) { mDialogMsg = "Loading. Please wait..."; } mProgressDialog = ProgressDialog.show(context, "", mDialogMsg, true); return; } if (mProgressDialog.isShowing()) { return; } mProgressDialog.show(); }

Target:
public void showProgressDialog(Context context) { if (!mShowDialog) { return; } if (mProgressDialog != null && mProgressDialog.isShowing()) { return; } if (TextUtils.isEmpty(mDialogMsg)) { mDialogMsg = "Loading. Please wait..."; } mProgressDialog = ProgressDialog.show(context, "", mDialogMsg, true); }
Source:
public static boolean openMoveWizard( IStructuredSelection structuredSelection) { return runCommand(LTK_MOVE_ID, structuredSelection, new HashMap<>()); }

Target:
public static boolean openMoveWizard( IStructuredSelection structuredSelection) { return runCommand(LTK_MOVE_ID, structuredSelection, Collections.emptyMap()); }
Source:
public Client(URL url, String username, String password, SSLConnectionSocketFactory sslConnectionSocketFactory, SSLContext sslContext) throws MalformedURLException, URISyntaxException { this.rootUri = url.toURI(); this.rt = new RestTemplate(getRequestFactory(url, username, password, sslConnectionSocketFactory, sslContext)); this.rt.setMessageConverters(getMessageConverters()); }

Target:
private Client(URL url, String username, String password, SSLConnectionSocketFactory sslConnectionSocketFactory, SSLContext sslContext) throws MalformedURLException, URISyntaxException { this.rootUri = url.toURI(); this.rt = new RestTemplate(getRequestFactory(url, username, password, sslConnectionSocketFactory, sslContext)); this.rt.setMessageConverters(getMessageConverters()); }
Source:
private Image getStereotypeIcon(final Stereotype stereotype) { org.eclipse.uml2.uml.Image expectedImageUML = stereotype.getIcons().get(0); assertNotNull("The Stereotype must contains an icon.", expectedImageUML); String expectedImageId = ImageUtil.getImageId(expectedImageUML); assertFalse(expectedImageId.isEmpty()); return imageRegistry.get(expectedImageId); }

Target:
private Image getStereotypeIcon(final Stereotype stereotype) { org.eclipse.uml2.uml.Image expectedImageUML = stereotype.getIcons().get(0); assertNotNull("The Stereotype must contains an icon.", expectedImageUML); String expectedImageId = ImageUtil.getImageId(expectedImageUML); assertFalse("The String ID of the expected image must not be empty.", expectedImageId.isEmpty()); return imageRegistry.get(expectedImageId); }
Source:
private AWSS3V4Signer buildSigV4Signer(final String region) { boolean isChunkedEncoding = true; AWSS3V4Signer v4Signer = new AWSS3V4Signer(isChunkedEncoding); v4Signer.setRegionName(region); v4Signer.setServiceName(AmazonS3Client.S3_SERVICE_NAME); return v4Signer; }

Target:
private AWSS3V4Signer buildSigV4Signer(final String region) { AWSS3V4Signer v4Signer = new AWSS3V4Signer(isChunkedEncodingDisabled); v4Signer.setRegionName(region); v4Signer.setServiceName(AmazonS3Client.S3_SERVICE_NAME); return v4Signer; }
Source:
public void clickingButtonForLong_callsLongClickListener() { UrlWidget widget = createWidget(promptWithAnswer(new StringData("blah"))); Button urlButton = widget.findViewById(R.id.url_button); urlButton.performLongClick(); assertThat(listener.onLongClick(urlButton), equalTo(true)); }

Target:
public void clickingButtonForLong_callsLongClickListener() { UrlWidget widget = createWidget(promptWithAnswer(null)); widget.setOnLongClickListener(listener); widget.getBinding().urlButton.performLongClick(); verify(listener).onLongClick(widget.getBinding().urlButton); }
Source:
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) { if (extensionPoint.equals(SCHEMA_XP)) { AvroSchemaDescriptor descriptor = (AvroSchemaDescriptor) contribution; try { URL url = contributor.getRuntimeContext().getResource(descriptor.file); InputStream stream = url == null ? null : url.openStream(); if (stream == null) { log.error(String.format("Could not load stream for file %s.", descriptor.file)); return; } schemaStoreService.addSchema(new Schema.Parser().parse(stream)); } catch (IOException e) { log.error(String.format("Could not load stream for file %s. Error message: %s", descriptor.file, e.getMessage())); } } else if (extensionPoint.equals(FACTORY_XP)) { try { AvroFactoryDescriptor descriptor = (AvroFactoryDescriptor) contribution; Class<Object> typeClass = (Class<Object>) Class.forName(descriptor.type); Class<AvroFactory<?>> factoryClass = (Class<AvroFactory<?>>) Class.forName(descriptor.clazz); Constructor<AvroFactory<?>> factoryConstructor = factoryClass.getConstructor(AvroFactoryContext.class); factoryConstructor.newInstance((AvroFactoryContext) null); factoryService.register(typeClass, factoryClass); } catch (Exception e) { log.error(e); } } else if (extensionPoint.equals(REPLACEMENT_XP)) { factoryService.register((AvroReplacementDescriptor) contribution); } else { throw new RuntimeServiceException("Unknown extension point: " + extensionPoint); } }

Target:
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) { if (SCHEMA_XP.equals(extensionPoint)) { schemaDescriptors.addContribution((AvroSchemaDescriptor) contribution); } else if (FACTORY_XP.equals(extensionPoint)) { schemaFactoryDescriptors.addContribution((AvroSchemaFactoryDescriptor) contribution); } else if (REPLACEMENT_XP.equals(extensionPoint)) { replacementDescriptors.addContribution((AvroReplacementDescriptor) contribution); } else { throw new RuntimeServiceException("Unknown extension point: " + extensionPoint); } }
Source:
public void invoke(IN value, SinkFunction.Context context) throws Exception { buckets.onElement( value, context.currentProcessingTime(), context.timestamp(), context.currentWatermark()); }

Target:
public void invoke(IN value, SinkFunction.Context context) throws Exception { this.helper.onElement( value, context.currentProcessingTime(), context.timestamp(), context.currentWatermark()); }
Source:
private void onRemove() { ConfirmationModel model = (ConfirmationModel) getWindow(); if (model.getProgress() != null) { return; } model.startProgress(); AsyncDataProvider.getInstance().getDataCentersByStorageDomain(new AsyncQuery<>(storagePools -> { if (storagePools != null && !storagePools.isEmpty()) { StoragePool storagePool = storagePools.get(0); List<ActionParametersBase> vmTemplateImportExportParams = getSelectedItems() .stream() .map(item -> new VmTemplateImportExportParameters(item.getId(), getEntity().getId(), storagePool.getId())) .collect(Collectors.toList()); Frontend.getInstance().runMultipleAction( ActionType.RemoveUnregisteredVmTemplate, vmTemplateImportExportParams, result -> { ConfirmationModel localModel = (ConfirmationModel) result.getState(); localModel.stopProgress(); cancel(); }, model); } }), getEntity().getId()); }

Target:
private void onRemove() { ConfirmationModel model = (ConfirmationModel) getWindow(); if (model.getProgress() != null) { return; } model.startProgress(); List<ActionParametersBase> vmTemplateImportExportParams = getSelectedItems() .stream() .map(item -> new VmTemplateImportExportParameters(item.getId(), getEntity().getId(), getEntity().getStoragePoolId())) .collect(Collectors.toList()); Frontend.getInstance().runMultipleAction( ActionType.RemoveUnregisteredVmTemplate, vmTemplateImportExportParams, result -> { ConfirmationModel localModel = (ConfirmationModel) result.getState(); localModel.stopProgress(); cancel(); }, model); }
Source:
private void showSignature(View dialogView) { byte[] cert = null; String newLine = System.getProperty("line.separator"); try { cert = mCertificate.getEncoded(); } catch (CertificateEncodingException e) { e.printStackTrace(); } TextView certFingerprintView = ((TextView)dialogView.findViewById(R.id.value_certificate_fingerprint)); TextView algorithmView = ((TextView)dialogView.findViewById(R.id.value_signature_algorithm)); certFingerprintView.setText("SHA-256:" + newLine + getDigestHexBytesWithColon(getDigest("SHA-256", cert)) + newLine + newLine + "SHA-1:" + newLine + getDigestHexBytesWithColon(getDigest("SHA-1", cert)) + newLine + newLine + "MD5:" + newLine + getDigestHexBytesWithColon(getDigest("MD5", cert))); algorithmView.setText(mCertificate.getSigAlgName()); }

Target:
private void showSignature(View dialogView) { byte[] cert = null; TextView certFingerprintView = ((TextView) dialogView.findViewById(R.id.value_certificate_fingerprint)); TextView algorithmView = ((TextView) dialogView.findViewById(R.id.value_signature_algorithm)); try { cert = mCertificate.getEncoded(); if (cert == null) { certFingerprintView.setText(R.string.certificate_load_problem); algorithmView.setText(R.string.certificate_load_problem); } else { certFingerprintView.setText( getDigestHexBytesWithColonsAndNewLines(dialogView, "SHA-256", cert) + getDigestHexBytesWithColonsAndNewLines(dialogView, "SHA-1", cert) + getDigestHexBytesWithColonsAndNewLines(dialogView, "MD5", cert)); algorithmView.setText(mCertificate.getSigAlgName()); } } catch (CertificateEncodingException e) { Log.e(TAG, "Problem while trying to decode the certificate."); } }
Source:
private void updateText(Text text) { if (text == null || text.isDisposed()) return; text.setMessage(NLS.bind(QuickAccessMessages.QuickAccess_EnterSearch, getQuickAccessTriggerSequenceFormat())); GC gc = new GC(text); if (Util.isWin32() || Util.isGtk()) { FontMetrics fm = gc.getFontMetrics(); int wHint = QuickAccessMessages.QuickAccess_EnterSearch.length() * fm.getAverageCharWidth(); int hHint = fm.getHeight(); gc.dispose(); text.setSize(text.computeSize(wHint, hHint)); } else { Point p = gc.textExtent(QuickAccessMessages.QuickAccess_EnterSearch); Rectangle r = text.computeTrim(0, 0, p.x, p.y); gc.dispose(); GridDataFactory.fillDefaults().hint(r.width - r.x, SWT.DEFAULT).applyTo(text); } }

Target:
private void updateText(Text text) { if (text == null || text.isDisposed()) { return; } text.setMessage(NLS.bind(QuickAccessMessages.QuickAccess_EnterSearch, getQuickAccessTriggerSequenceFormat())); GC gc = new GC(text); if (Util.isWin32() || Util.isGtk()) { FontMetrics fm = gc.getFontMetrics(); int wHint = QuickAccessMessages.QuickAccess_EnterSearch.length() * fm.getAverageCharWidth(); int hHint = fm.getHeight(); gc.dispose(); text.setSize(text.computeSize(wHint, hHint)); } else { Point p = gc.textExtent(QuickAccessMessages.QuickAccess_EnterSearch); Rectangle r = text.computeTrim(0, 0, p.x, p.y); gc.dispose(); GridDataFactory.fillDefaults().hint(r.width - r.x, SWT.DEFAULT).applyTo(text); } }
Source:
public JSONObject getTopology(Map<Integer, String> hostGroups, Multimap<Integer, Long> partitionReplicas, Map<Integer, Long> partitionMasters) throws JSONException { int hostCount = getHostCount(); int partitionCount = getPartitionCount(); int sitesPerHost = getSitesPerHost(); if (hostCount != hostGroups.size() && partitionReplicas.isEmpty() && partitionMasters.isEmpty()) { throw new RuntimeException("Provided " + hostGroups.size() + " host ids when host count is " + hostCount); } JSONObject topo; if (Boolean.valueOf(System.getenv("VOLT_REPLICA_FALLBACK"))) { topo = fallbackPlacementStrategy(Lists.newArrayList(hostGroups.keySet()), hostCount, partitionCount, sitesPerHost); } else { try { topo = groupAwarePlacementStrategy(hostGroups, partitionReplicas, partitionMasters, partitionCount, sitesPerHost); } catch (Exception e) { e.printStackTrace(); hostLog.error("Unable to use optimal replica placement strategy. " + "Falling back to a less optimal strategy that may result in worse performance. " + "Original error was " + e.getMessage()); topo = fallbackPlacementStrategy(Lists.newArrayList(hostGroups.keySet()), hostCount, partitionCount, sitesPerHost); } } if (hostLog.isDebugEnabled()) { hostLog.debug("TOPO: " + topo.toString(2)); } return topo; }

Target:
public JSONObject getTopology(Map<Integer, String> hostGroups, Multimap<Integer, Long> partitionReplicas, Map<Integer, Long> partitionMasters) throws JSONException { int hostCount = getHostCount(); int partitionCount = partitionMasters.isEmpty() ? getPartitionCount() : partitionMasters.size(); int sitesPerHost = getSitesPerHost(); if (hostCount != hostGroups.size() && partitionReplicas.isEmpty() && partitionMasters.isEmpty()) { throw new RuntimeException("Provided " + hostGroups.size() + " host ids when host count is " + hostCount); } JSONObject topo; if (Boolean.valueOf(System.getenv("VOLT_REPLICA_FALLBACK"))) { topo = fallbackPlacementStrategy(Lists.newArrayList(hostGroups.keySet()), hostCount, partitionCount, sitesPerHost); } else { try { topo = groupAwarePlacementStrategy(hostGroups, partitionReplicas, partitionMasters, partitionCount, sitesPerHost); } catch (Exception e) { e.printStackTrace(); hostLog.error("Unable to use optimal replica placement strategy. " + "Falling back to a less optimal strategy that may result in worse performance. " + "Original error was " + e.getMessage()); topo = fallbackPlacementStrategy(Lists.newArrayList(hostGroups.keySet()), hostCount, partitionCount, sitesPerHost); } } if (hostLog.isDebugEnabled()) { hostLog.debug("TOPO: " + topo.toString(2)); } return topo; }
Source:
public void writeLine(String line) { if (textSizeLimit < 0) { lines.add(line); return; } if (consumedTextSize >= textSizeLimit) { return; } if (line != null && (line.length() + consumedTextSize > textSizeLimit)) { long lineSizeLimit = textSizeLimit - consumedTextSize; lines.add(line.substring(0, (int) lineSizeLimit)); consumedTextSize += lineSizeLimit; return; } lines.add(line); consumedTextSize += line == null ? 0 : line.length(); }

Target:
public void writeLine(String line) { lines.add(line); }
Source:
private static <T> T convertZonedDateTime(ZonedDateTime zdt, Class<T> returnType) { if (returnType == ZonedDateTime.class) { return (T) zdt; } else if (returnType == Instant.class) { return (T) zdt.toInstant(); } else if (returnType.isAssignableFrom(java.util.Date.class)) { return (T) java.util.Date.from(zdt.toInstant()); } else if (returnType.isAssignableFrom(java.sql.Time.class)) { return (T) new java.sql.Time(zdt.toInstant().truncatedTo(ChronoUnit.SECONDS).toEpochMilli()); } else if (returnType.isAssignableFrom(Timestamp.class)) { return (T) Timestamp.from(zdt.toInstant()); } else if (returnType.isAssignableFrom(Long.class)) { return (T) Long.valueOf(zdt.toInstant().toEpochMilli()); } else if (returnType.isAssignableFrom(Calendar.class)) { return (T) GregorianCalendar.from(zdt); } else { throw new ClassCastException("unsupported return type " + returnType.getSimpleName()); } }

Target:
private static <T> T convertZonedDateTime(ZonedDateTime zdt, Class<T> returnType) { if (returnType == ZonedDateTime.class) { return (T) zdt; } else if (returnType == Instant.class) { return (T) zdt.toInstant(); } else if (returnType.isAssignableFrom(Timestamp.class)) { return (T) Timestamp.from(zdt.toInstant()); } else if (returnType.isAssignableFrom(java.util.Date.class)) { return (T) java.util.Date.from(zdt.toInstant()); } else if (returnType.isAssignableFrom(java.sql.Time.class)) { return (T) new java.sql.Time(zdt.toInstant().truncatedTo(ChronoUnit.SECONDS).toEpochMilli()); } else if (returnType.isAssignableFrom(java.sql.Date.class)) { return (T) new java.sql.Date(zdt.toInstant().truncatedTo(ChronoUnit.SECONDS).toEpochMilli()); } else if (returnType.isAssignableFrom(Long.class)) { return (T) Long.valueOf(zdt.toInstant().toEpochMilli()); } else if (returnType.isAssignableFrom(Calendar.class)) { return (T) GregorianCalendar.from(zdt); } else { throw new ClassCastException("unsupported return type " + returnType.getSimpleName()); } }
Source:
private void removeAccount(ClientManager clientMgr, final boolean showLoginPage, String refreshToken, String loginServer, Account account, Activity frontActivity) { cleanUp(frontActivity, account, showLoginPage); if (account == null) { final AccountManager accMgr = AccountManager.get(context); if (accMgr != null) { final Account[] accounts = accMgr.getAccountsByType(getAccountType()); if (accounts.length > 0) { for (int i = 0; i < accounts.length - 1; i++) { clientMgr.removeAccounts(accounts); } clientMgr.removeAccount(accounts[accounts.length - 1]); notifyLogoutComplete(showLoginPage); } else { notifyLogoutComplete(showLoginPage); } } else { notifyLogoutComplete(showLoginPage); } } else { clientMgr.removeAccount(account); notifyLogoutComplete(showLoginPage); } isLoggingOut = false; if (shouldLogoutWhenTokenRevoked() && refreshToken != null) { new RevokeTokenTask(refreshToken, loginServer).execute(); } }

Target:
private void removeAccount(ClientManager clientMgr, final boolean showLoginPage, String refreshToken, String loginServer, Account account, Activity frontActivity) { cleanUp(frontActivity, account, showLoginPage); if (account == null) { final AccountManager accMgr = AccountManager.get(context); if (accMgr != null) { final Account[] accounts = accMgr.getAccountsByType(getAccountType()); if (accounts.length > 0) { for (int i = 0; i < accounts.length - 1; i++) { clientMgr.removeAccounts(accounts); } clientMgr.removeAccount(accounts[accounts.length - 1]); } } } else { clientMgr.removeAccount(account); } notifyLogoutComplete(showLoginPage); isLoggingOut = false; if (shouldLogoutWhenTokenRevoked() && refreshToken != null) { new RevokeTokenTask(refreshToken, loginServer).execute(); } }
Source:
private void humanInterventionRequired(final int status, final String msg) { String err = Errors.getErrorMessage(status); this.logger.error("Human Intervention Required: " + status + (err == null ? " " : err)); if (msg != null) { this.logger.error(msg); } }

Target:
private void humanInterventionRequired(final int status, final String msg) { String err = Errors.getErrorMessage(status); this.logger.warn("Human Intervention Required: {}", status, (err == null ? " " : err), (msg == null ? " " : msg) ); }
Source:
public RestApiManager(Context context, OkHttpClient oauthBasedClient) { this.context = context; this.oauthBasedClient = new OkHttpClient(); RestAdapter restAdapter = new RestAdapter.Builder() .setClient(new OkClient(oauthBasedClient)) .setEndpoint(getBaseUrl()) .setRequestInterceptor(new OfflineRequestInterceptor(context)) .build(); oauthRestApi = restAdapter.create(OauthRestApi.class); client = new OkHttpClient(); client.interceptors().add(new LoggingInterceptor()); restAdapter = new RestAdapter.Builder() .setClient(new OkClient(client)) .setEndpoint(getBaseUrl()) .build(); restApi = restAdapter.create(PublicRestApi.class); }

Target:
public RestApiManager(Context context, OkHttpClient oauthBasedClient) { this.context = context; this.oauthBasedClient = oauthBasedClient; RestAdapter restAdapter = new RestAdapter.Builder() .setClient(new OkClient(oauthBasedClient)) .setEndpoint(getBaseUrl()) .setRequestInterceptor(new OfflineRequestInterceptor(context)) .build(); oauthRestApi = restAdapter.create(OauthRestApi.class); client = new OkHttpClient(); client.interceptors().add(new LoggingInterceptor()); restAdapter = new RestAdapter.Builder() .setClient(new OkClient(client)) .setEndpoint(getBaseUrl()) .build(); restApi = restAdapter.create(PublicRestApi.class); }
Source:
public static synchronized void createNewView(LamiAnalysisReport report) throws PartInitException { currentReport = report; int mode = IWorkbenchPage.VIEW_ACTIVATE; final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); page.showView(LamiReportView.VIEW_ID, String.valueOf(secondaryViewId++), mode); currentReport = null; }

Target:
public static synchronized void createNewView(LamiAnalysisReport report) throws PartInitException { currentReport = report; final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); page.showView(LamiReportView.VIEW_ID, String.valueOf(secondaryViewId), IWorkbenchPage.VIEW_VISIBLE); page.activate(page.findView(LamiReportView.VIEW_ID)); secondaryViewId++; currentReport = null; }
Source:
public ListPanel(UI ui, GUIController guiController, PanelControl parentPanelControl, int panelIndex) { super(ui, guiController, parentPanelControl, panelIndex); this.ui = ui; this.guiController = guiController; totalLabel = new Label("Total : - "); listView = new IssueListView(); setupListView(); getChildren().add(listView); getChildren().add(createPanelFooter()); }

Target:
public ListPanel(UI ui, GUIController guiController, PanelControl parentPanelControl, int panelIndex) { super(ui, guiController, parentPanelControl, panelIndex); this.ui = ui; this.guiController = guiController; listView = new IssueListView(); setupListView(); getChildren().add(listView); getChildren().add(createPanelFooter()); }
Source:
void create(List<CodeReviewCommit> commits, PersonIdent author) throws MergeException { try { this.commits = commits; this.author = author; setBase(); setOurs(); int remainingLockFailureCalls = MAX_LOCK_FAILURE_CALLS; RefUpdate refUpdate = createRefUpdate(oursCommit, baseCommit); for (;;) { Result result = refUpdate.update(); if (result == Result.LOCK_FAILURE) { if (--remainingLockFailureCalls > 0) { Thread.sleep(SLEEP_ON_LOCK_FAILURE_MS); } else { throw new MergeException( "Couldn't create code review notes. Failed to lock the ref: " + REFS_NOTES_SUBMITTED); } } else if (result == Result.REJECTED) { RevCommit theirsCommit = revWalk.parseCommit(refUpdate.getOldObjectId()); NoteMap theirs = NoteMap.read(revWalk.getObjectReader(), theirsCommit); NoteMapMerger merger = new NoteMapMerger(db); NoteMap merged = merger.merge(base, ours, theirs); RevCommit mergeCommit = createCommit(merged, gerritIdent, "Merged note commits\n", theirsCommit, oursCommit); refUpdate = createRefUpdate(mergeCommit, theirsCommit); remainingLockFailureCalls = MAX_LOCK_FAILURE_CALLS; } else if (result == Result.IO_FAILURE) { throw new MergeException( "Couldn't create code review notes because of IO_FAILURE"); } else { break; } } } catch (IOException e) { throw new MergeException("Couldn't create code review notes", e); } catch (InterruptedException e) { throw new MergeException("Couldn't create code review notes", e); } }

Target:
public void create(List<CodeReviewCommit> commits, PersonIdent author) throws CodeReviewNoteCreationException { try { this.commits = commits; this.author = author; setBase(); setOurs(); int remainingLockFailureCalls = MAX_LOCK_FAILURE_CALLS; RefUpdate refUpdate = createRefUpdate(oursCommit, baseCommit); for (;;) { Result result = refUpdate.update(); if (result == Result.LOCK_FAILURE) { if (--remainingLockFailureCalls > 0) { Thread.sleep(SLEEP_ON_LOCK_FAILURE_MS); } else { throw new CodeReviewNoteCreationException( "Failed to lock the ref: " + REFS_NOTES_SUBMITTED); } } else if (result == Result.REJECTED) { RevCommit theirsCommit = revWalk.parseCommit(refUpdate.getOldObjectId()); NoteMap theirs = NoteMap.read(revWalk.getObjectReader(), theirsCommit); NoteMapMerger merger = new NoteMapMerger(db); NoteMap merged = merger.merge(base, ours, theirs); RevCommit mergeCommit = createCommit(merged, gerritIdent, "Merged note commits\n", theirsCommit, oursCommit); refUpdate = createRefUpdate(mergeCommit, theirsCommit); remainingLockFailureCalls = MAX_LOCK_FAILURE_CALLS; } else if (result == Result.IO_FAILURE) { throw new CodeReviewNoteCreationException( "Couldn't create code review notes because of IO_FAILURE"); } else { break; } } } catch (IOException e) { throw new CodeReviewNoteCreationException(e); } catch (InterruptedException e) { throw new CodeReviewNoteCreationException(e); } finally { reader.release(); inserter.release(); revWalk.release(); } }
Source:
public NetworkSubTabPanelView(OvirtBreadCrumbsPresenterWidget<NetworkView, NetworkListModel> breadCrumbs, NetworkActionPanelPresenterWidget actionPanel, DetailTabLayout detailTabLayout) { tabPanel = new SimpleTabPanel(breadCrumbs, actionPanel, detailTabLayout); initWidget(getTabPanel()); actionPanel.hideButton(actionPanel.getNewButtonDefinition()); actionPanel.hideButton(actionPanel.getImportButtonDefinition()); }

Target:
public NetworkSubTabPanelView(OvirtBreadCrumbsPresenterWidget<NetworkView, NetworkListModel> breadCrumbs, NetworkActionPanelPresenterWidget actionPanel, DetailTabLayout detailTabLayout) { tabPanel = new SimpleTabPanel(breadCrumbs, actionPanel, detailTabLayout); initWidget(getTabPanel()); actionPanel.removeButton(actionPanel.getNewButtonDefinition()); actionPanel.removeButton(actionPanel.getImportButtonDefinition()); }
Source:
private void checkInstanceInfo(String instanceName, String hostName, int port, String[] tags, String[] pools, int[] poolValues) { checkInstanceInfo(instanceName, hostName, port, tags, pools, poolValues, NOT_SET_GRPC_PORT_VALUE); }

Target:
private void checkInstanceInfo(String instanceName, String hostName, int port, String[] tags, String[] pools, int[] poolValues) { checkInstanceInfo(instanceName, hostName, port, tags, pools, poolValues, Instance.NOT_SET_GRPC_PORT_VALUE); }
Source:
public void setUp() throws Exception { tenant = getRandomTenantId(); findGuageMetricsUrl = "http://" + BASE_URI + "/" + tenant + "/metrics?type=guage"; assumeCollectdIsPresent(); configureCollectd(); assertCollectdConfIsValid(); configurePTrans(); }

Target:
public void setUp() throws Exception { tenant = getRandomTenantId(); findGuageMetricsUrl = "http://" + BASE_URI + "/" + tenant + "/metrics?type=gauge"; assumeCollectdIsPresent(); configureCollectd(); assertCollectdConfIsValid(); configurePTrans(); }
Source:
private ProteinSequence readGenbankProteinResource(final String resource) throws Exception { ProteinSequence sequence = null; InputStream inputStream = null; try { inputStream = getClass().getResourceAsStream(resource); GenbankReader<ProteinSequence, AminoAcidCompound> genbankProtein = new GenbankReader<>( inputStream, new GenericGenbankHeaderParser<>(), new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet()) ); LinkedHashMap<String, ProteinSequence> proteinSequences = genbankProtein.process(); sequence = proteinSequences.values().iterator().next(); } finally { try { inputStream.close(); } catch (Exception e) { } } return sequence; }

Target:
private ProteinSequence readGenbankProteinResource(final String resource) throws IOException, CompoundNotFoundException { InputStream inputStream = getClass().getResourceAsStream(resource); GenbankReader<ProteinSequence, AminoAcidCompound> genbankProtein = new GenbankReader<>( inputStream, new GenericGenbankHeaderParser<>(), new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet()) ); LinkedHashMap<String, ProteinSequence> proteinSequences = genbankProtein.process(); return proteinSequences.values().iterator().next(); }
Source:
public void demonstrateRecovery() throws Exception { System.out.println("Entries at the start: " + entriesService.getAll()); recoveryManagerService.addXAResourceRecovery(new DummyXAResourceRecovery()); Thread.sleep(5000); System.out.println("Entries at the end: " + entriesService.getAll()); }

Target:
public void demonstrateRecovery() throws Exception { List<Entry> entriesBefore = entriesService.getAll(); System.out.println("Entries at the start: " + entriesBefore); recoveryManagerService.addXAResourceRecovery(new DummyXAResourceRecovery()); waitForRecovery(entriesBefore); System.out.println("Entries at the end: " + entriesService.getAll()); }
Source:
private ForeignHost getPrimary(ImmutableCollection<ForeignHost> fhosts, int hostId) { ForeignHost fhost = null; for (ForeignHost f : fhosts) { if (f.isPrimary()) { fhost = f; break; } } if (fhost == null) { m_networkLog.warn("Attempted to deliver a message to foreign host with id" + hostId + " but there is no primary connection to the host."); return null; } return fhost; }

Target:
private ForeignHost getPrimary(ImmutableCollection<ForeignHost> fhosts, int hostId) { ForeignHost fhost = null; for (ForeignHost f : fhosts) { if (f.isPrimary()) { fhost = f; break; } } if (fhost == null) { m_networkLog.warn("Attempted to deliver a message to host " + hostId + " but there is no primary connection to the host."); } return fhost; }
Source:
public void storeSavePoints(OseeConnection connection, int importIdIndex) throws OseeCoreException { List<Object[]> data = new ArrayList<Object[]>(); for (SavePoint savePoint : savePoints.values()) { int status = 1; String comment = ""; if (savePoint.hasErrors()) { status = -1; StringBuilder builder = new StringBuilder(); for (Throwable ex : savePoint.getErrors()) { builder.append(Lib.exceptionToString(ex).replaceAll("\n", " ")); } if (builder.length() < IOseeDatabaseService.MAX_VARCHAR_LENGTH) { comment = builder.toString(); } else { comment = builder.substring(0, 3999); } } data.add(new Object[] {importIdIndex, savePoint.getName(), status, comment}); } getDatabaseService().runBatchUpdate(connection, INSERT_INTO_IMPORT_SAVE_POINT, data); }

Target:
public void storeSavePoints(OseeConnection connection, int importIdIndex) throws OseeCoreException { List<Object[]> data = new ArrayList<Object[]>(); for (SavePoint savePoint : savePoints.values()) { int status = 1; String comment = ""; if (savePoint.hasErrors()) { status = -1; StringBuilder builder = new StringBuilder(); for (Throwable ex : savePoint.getErrors()) { builder.append(Lib.exceptionToString(ex).replaceAll("\n", " ")); } if (builder.length() < MAX_VARCHAR_LENGTH) { comment = builder.toString(); } else { comment = builder.substring(0, MAX_VARCHAR_LENGTH); } } data.add(new Object[] {importIdIndex, savePoint.getName(), status, comment}); } getDatabaseService().runBatchUpdate(connection, INSERT_INTO_IMPORT_SAVE_POINT, data); }
Source:
private void validate() { assertThat(serializer, Objects::nonNull, () -> new AxonConfigurationException( "The Serializer is a hard requirement and should be provided")); assertThat(routingKeyResolver, Objects::nonNull, () -> new AxonConfigurationException( "The RoutingKeyResolver is a hard requirement and should be provided")); }

Target:
protected void validate() { assertNonNull(serializer, "The Serializer is a hard requirement and should be provided"); assertNonNull(routingKeyResolver, "The RoutingKeyResolver is a hard requirement and should be provided"); }
Source:
public PaymentStateContext buildPaymentStateContext(final boolean isApiPayment, final TransactionType transactionType, final Account account, @Nullable final UUID attemptId, @Nullable final UUID paymentMethodId, @Nullable final UUID paymentId, @Nullable final UUID transactionId, @Nullable final String paymentExternalKey, final String paymentTransactionExternalKey, @Nullable final BigDecimal amount, @Nullable final Currency currency, final boolean shouldLockAccount, final OperationResult overridePluginOperationResult, final Iterable<PluginProperty> properties, final CallContext callContext, final InternalCallContext internalCallContext) throws PaymentApiException { final UUID effectivePaymentId = paymentId != null ? paymentId : retrievePaymentId(paymentExternalKey, paymentTransactionExternalKey, internalCallContext); verifyPaymentMethodExistsForRefund(effectivePaymentId, transactionType, internalCallContext); return new PaymentStateContext(isApiPayment, effectivePaymentId, transactionId, attemptId, paymentExternalKey, paymentTransactionExternalKey, transactionType, account, paymentMethodId, amount, currency, shouldLockAccount, overridePluginOperationResult, properties, internalCallContext, callContext); }

Target:
public PaymentStateContext buildPaymentStateContext(final boolean isApiPayment, final TransactionType transactionType, final Account account, @Nullable final UUID attemptId, @Nullable final UUID paymentMethodId, @Nullable final UUID paymentId, @Nullable final UUID transactionId, @Nullable final String paymentExternalKey, final String paymentTransactionExternalKey, @Nullable final BigDecimal amount, @Nullable final Currency currency, final boolean shouldLockAccount, final OperationResult overridePluginOperationResult, final Iterable<PluginProperty> properties, final CallContext callContext, final InternalCallContext internalCallContext) throws PaymentApiException { final UUID effectivePaymentId = paymentId != null ? paymentId : retrievePaymentId(paymentExternalKey, paymentTransactionExternalKey, internalCallContext); return new PaymentStateContext(isApiPayment, effectivePaymentId, transactionId, attemptId, paymentExternalKey, paymentTransactionExternalKey, transactionType, account, paymentMethodId, amount, currency, shouldLockAccount, overridePluginOperationResult, properties, internalCallContext, callContext); }
Source:
default Publisher<MarshalledEntry<K, V>> publishEntries(IntSet segments, Predicate<? super K> filter, boolean fetchValue, boolean fetchMetadata) { return null; }

Target:
default Publisher<MarshalledEntry<K, V>> publishEntries(IntSet segments, Predicate<? super K> filter, boolean fetchValue, boolean fetchMetadata) { return publishEntries(filter, fetchValue, fetchMetadata); }
Source:
public Map<String, Object> getProperties() { return properties; }

Target:
public Map<String, Object> getProperties() { return Collections.unmodifiableMap(properties); }
Source:
public void testEmptyConfig() throws Exception { final AmazonEC2Cloud ec2Cloud = (AmazonEC2Cloud) Jenkins.get().getCloud("ec2-"); assertNotNull(ec2Cloud); assertEquals(ec2Cloud.getTemplates().size(), 0); }

Target:
public void testEmptyConfig() throws Exception { final AmazonEC2Cloud ec2Cloud = (AmazonEC2Cloud) Jenkins.get().getCloud("ec2-"); assertNotNull(ec2Cloud); assertEquals(0, ec2Cloud.getTemplates().size()); }
Source:
protected void createAndDispatchThreadSwitchedEvent(String tid) { IContainerDMContext parentContainer = fProcesses.createContainerContextFromThreadId(fCommandControl.getContext(), tid); IProcessDMContext processDmc = DMContexts.getAncestorOfType(parentContainer, IProcessDMContext.class); IThreadDMContext threadDmc = fProcesses.createThreadContext(processDmc, tid); IExecutionDMContext execDmc = fProcesses.createExecutionContext(parentContainer, threadDmc, tid); AbstractDMEvent<IExecutionDMContext> event = null; event = new ThreadSwitchedEvent(execDmc); fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties()); }

Target:
protected void createAndDispatchThreadSwitchedEvent(String tid) { IContainerDMContext parentContainer = fProcesses.createContainerContextFromThreadId(fCommandControl.getContext(), tid); IProcessDMContext processDmc = DMContexts.getAncestorOfType(parentContainer, IProcessDMContext.class); IThreadDMContext threadDmc = fProcesses.createThreadContext(processDmc, tid); IExecutionDMContext execDmc = fProcesses.createExecutionContext(parentContainer, threadDmc, tid); fCommandControl.getSession().dispatchEvent(new ThreadSwitchedEvent(execDmc), fCommandControl.getProperties()); }
Source:
private static byte[] compress(String data) { byte[] compressed = null; try (ByteArrayOutputStream bos = new ByteArrayOutputStream(); GZIPOutputStream gzip = new GZIPOutputStream(bos);) { gzip.write(data.getBytes(StandardCharsets.ISO_8859_1)); gzip.close(); compressed = bos.toByteArray(); } catch (Exception ex) { System.out.println(ex.getLocalizedMessage()); } return compressed; }

Target:
private static byte[] compress(String data) { byte[] compressed = null; try (ByteArrayOutputStream bos = new ByteArrayOutputStream(); GZIPOutputStream gzip = new GZIPOutputStream(bos);) { gzip.write(data.getBytes(StandardCharsets.UTF_8)); gzip.close(); compressed = bos.toByteArray(); } catch (Exception ex) { System.out.println(ex.getLocalizedMessage()); } return compressed; }
Source:
public void start() throws IOException, KeeperException { if (!running.compareAndSet(false, true)) { return; } LOG.trace("Starting assignment manager"); startAssignmentThread(); try (RegionScanner scanner = masterRegion.getScanner(new Scan().addFamily(HConstants.CATALOG_FAMILY))) { List<Cell> cells = new ArrayList<>(); boolean moreRows; do { moreRows = scanner.next(cells); if (cells.isEmpty()) { continue; } Result result = Result.create(cells); cells.clear(); RegionStateStore .visitMetaEntry((r, regionInfo, state, regionLocation, lastHost, openSeqNum) -> { RegionStateNode regionNode = regionStates.getOrCreateRegionStateNode(regionInfo); regionNode.lock(); try { regionNode.setState(state); regionNode.setLastHost(lastHost); regionNode.setRegionLocation(regionLocation); regionNode.setOpenSeqNum(openSeqNum); if (regionNode.getProcedure() != null) { regionNode.getProcedure().stateLoaded(this, regionNode); } if (RegionReplicaUtil.isDefaultReplica(regionInfo)) { setMetaAssigned(regionInfo, state == State.OPEN); } } finally { regionNode.unlock(); } if (regionInfo.isFirst()) { try { regionStateStore.mirrorMetaLocation(regionInfo, regionLocation, state); } catch (IOException e) { LOG.warn("Failed to mirror region location for to zk", regionNode.toShortString()); } } }, result); } while (moreRows); if (!regionStates.hasTableRegionStates(TableName.META_TABLE_NAME)) { regionStates.createRegionStateNode(RegionInfoBuilder.FIRST_META_REGIONINFO); } } }

Target:
public void start() throws IOException, KeeperException { if (!running.compareAndSet(false, true)) { return; } LOG.trace("Starting assignment manager"); startAssignmentThread(); try (RegionScanner scanner = masterRegion.getScanner(new Scan().addFamily(HConstants.CATALOG_FAMILY))) { List<Cell> cells = new ArrayList<>(); boolean moreRows; do { moreRows = scanner.next(cells); if (cells.isEmpty()) { continue; } Result result = Result.create(cells); cells.clear(); RegionStateStore .visitMetaEntry((r, regionInfo, state, regionLocation, lastHost, openSeqNum) -> { RegionStateNode regionNode = regionStates.getOrCreateRegionStateNode(regionInfo); regionNode.setState(state); regionNode.setLastHost(lastHost); regionNode.setRegionLocation(regionLocation); regionNode.setOpenSeqNum(openSeqNum); if (regionNode.getProcedure() != null) { regionNode.getProcedure().stateLoaded(this, regionNode); } if (regionLocation != null) { regionStates.addRegionToServer(regionNode); } if (RegionReplicaUtil.isDefaultReplica(regionInfo)) { setMetaAssigned(regionInfo, state == State.OPEN); } if (regionInfo.isFirst()) { try { regionStateStore.mirrorMetaLocation(regionInfo, regionLocation, state); } catch (IOException e) { LOG.warn("Failed to mirror region location for to zk", regionNode.toShortString()); } } }, result); } while (moreRows); if (!regionStates.hasTableRegionStates(TableName.META_TABLE_NAME)) { regionStates.createRegionStateNode(RegionInfoBuilder.FIRST_META_REGIONINFO); } } }
Source:
private boolean updatePostObject() { boolean isFirstTimePublish = PostStatus.fromPost(mPost) == PostStatus.PUBLISHED && (mPost.isLocalDraft() || PostStatus.fromPost(mOriginalPost) == PostStatus.DRAFT); try { updatePostObject(false); } catch (IllegalEditorStateException e) { AppLog.e(T.EDITOR, "Impossible to save and publish the post, we weren't able to update it."); } return isFirstTimePublish; }

Target:
private boolean updatePostObject() { try { updatePostObject(false); } catch (IllegalEditorStateException e) { AppLog.e(T.EDITOR, "Impossible to save and publish the post, we weren't able to update it."); return false; } return true; }
Source:
protected void eventHandle(@NonNull ITmfEvent event) { ITmfStateSystemBuilder ss = getStateSystemBuilder(); long t = event.getTimestamp().toNanos(); String phase = event.getContent().getFieldValue(String.class, ITraceEventConstants.PHASE); if (ss == null || !ACCEPTED.contains(phase)) { return; } String nameField = event.getContent().getFieldValue(String.class, ITraceEventConstants.NAME); String idField = event.getContent().getFieldValue(String.class, ITraceEventConstants.ID); String catField = event.getContent().getFieldValue(String.class, ITraceEventConstants.CATEGORY); if (Objects.equals(phase, TraceEventPhases.CONTEXT_START)) { int quark = ss.getQuarkAbsoluteAndAdd(catField, nameField, idField); ss.modifyAttribute(t, 1, quark); } if (Objects.equals(phase, TraceEventPhases.CONTEXT_END)) { int quark = ss.getQuarkAbsoluteAndAdd(catField, nameField, idField); ss.modifyAttribute(t, (Object) null, quark); } }

Target:
protected void eventHandle(@NonNull ITmfEvent event) { ITmfStateSystemBuilder ss = getStateSystemBuilder(); long t = event.getTimestamp().toNanos(); String phase = event.getContent().getFieldValue(String.class, ITraceEventConstants.PHASE); if (ss == null || !ACCEPTED.contains(phase)) { return; } String catField = event.getContent().getFieldValue(String.class, ITraceEventConstants.CATEGORY); String nameField = event.getContent().getFieldValue(String.class, ITraceEventConstants.NAME); String idField = event.getContent().getFieldValue(String.class, ITraceEventConstants.ID); int quark = ss.getQuarkAbsoluteAndAdd(catField, nameField, idField); if (Objects.equals(phase, TraceEventPhases.CONTEXT_START)) { ss.modifyAttribute(t, 1, quark); } if (Objects.equals(phase, TraceEventPhases.CONTEXT_END)) { ss.modifyAttribute(t, (Object) null, quark); } }
Source:
public List<ByteArrayInputStream> getAllGatewayPublishedAPIArtifacts(String label) throws APIManagementException { List<ByteArrayInputStream> baip = new ArrayList<>(); try (Connection connection = APIMgtDBUtil.getConnection(); PreparedStatement statement = connection.prepareStatement(SQLConstants.GET_ALL_API_ARTIFACT)) { statement.setString(1, label); statement.setString(2, APIConstants.GatewayArtifactSynchronizer.GATEWAY_INSTRUCTION_PUBLISH); ResultSet rs = statement.executeQuery(); while (rs.next()) { byte[] st = (byte[]) rs.getObject(1); ByteArrayInputStream byteArrayInputStream= new ByteArrayInputStream(st); baip.add(byteArrayInputStream); log.info("Retrieved an api from DB"); } return baip; } catch (SQLException e) { handleException("Failed to get artifacts " , e); } return baip; }

Target:
public List<ByteArrayInputStream> getAllGatewayPublishedAPIArtifacts(String label) throws APIManagementException { List<ByteArrayInputStream> baip = new ArrayList<>(); try (Connection connection = APIMgtDBUtil.getConnection(); PreparedStatement statement = connection.prepareStatement(SQLConstants.GET_ALL_API_ARTIFACT)) { statement.setString(1, label); statement.setString(2, APIConstants.GatewayArtifactSynchronizer.GATEWAY_INSTRUCTION_PUBLISH); ResultSet rs = statement.executeQuery(); while (rs.next()) { byte[] st = (byte[]) rs.getObject(1); ByteArrayInputStream byteArrayInputStream= new ByteArrayInputStream(st); baip.add(byteArrayInputStream); } return baip; } catch (SQLException e) { handleException("Failed to get artifacts " , e); } return baip; }
Source:
public void testPushForMasterWithApprovals() throws GitAPIException, IOException, RestApiException { PushOneCommit.Result r = pushTo("refs/for/master/%l=Code-Review"); r.assertOkStatus(); ChangeInfo ci = get(r.getChangeId()); LabelInfo cr = ci.labels.get("Code-Review"); assertEquals(1, cr.all.size()); assertEquals("Administrator", cr.all.get(0).name); assertEquals(1, cr.all.get(0).value.intValue()); PushOneCommit push = pushFactory.create(db, admin.getIdent(), PushOneCommit.SUBJECT, "b.txt", "anotherContent", r.getChangeId()); r = pushTo("refs/for/master/%l=Code-Review+2"); ci = get(r.getChangeId()); cr = ci.labels.get("Code-Review"); assertEquals(1, cr.all.size()); assertEquals("Administrator", cr.all.get(0).name); assertEquals(2, cr.all.get(0).value.intValue()); }

Target:
public void testPushForMasterWithApprovals() throws GitAPIException, IOException, RestApiException { PushOneCommit.Result r = pushTo("refs/for/master/%l=Code-Review"); r.assertOkStatus(); ChangeInfo ci = get(r.getChangeId()); LabelInfo cr = ci.labels.get("Code-Review"); assertEquals(1, cr.all.size()); assertEquals("Administrator", cr.all.get(0).name); assertEquals(1, cr.all.get(0).value.intValue()); r = pushTo("refs/for/master/%l=Code-Review+2"); ci = get(r.getChangeId()); cr = ci.labels.get("Code-Review"); assertEquals(1, cr.all.size()); assertEquals("Administrator", cr.all.get(0).name); assertEquals(2, cr.all.get(0).value.intValue()); }