auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onSuccess(long localTime, String id) { long next = localTime + getMinimumTimeBetweenUploads(); tracker.markIdAsUploaded(id); tracker.purgeObsoleteIds(oldIds); editor .setNextSubmission(next) .setLastUploadSucceeded(localTime) .setCurrentDayFailureCount(0) .setCurrentDayResetTime(-1) .commit(); if (Logger.LOG_PERSONAL_INFORMATION) { Logger.pii(LOG_TAG, "Successful upload with id " + id + " obsoleting " + oldIds.size() + " old records reported at " + localTime + "; next upload at " + next + "."); } else { Logger.info(LOG_TAG, "Successful upload obsoleting " + oldIds.size() + " old records reported at " + localTime + "; next upload at " + next + "."); } }

Target:
public void onSuccess(long localTime, String id) { long next = localTime + getMinimumTimeBetweenUploads(); tracker.markIdAsUploaded(id); tracker.purgeObsoleteIds(oldIds); editor .setNextSubmission(next) .setLastUploadSucceeded(localTime) .setCurrentDayFailureCount(0) .clearCurrentDayResetTime() .commit(); if (Logger.LOG_PERSONAL_INFORMATION) { Logger.pii(LOG_TAG, "Successful upload with id " + id + " obsoleting " + oldIds.size() + " old records reported at " + localTime + "; next upload at " + next + "."); } else { Logger.info(LOG_TAG, "Successful upload obsoleting " + oldIds.size() + " old records reported at " + localTime + "; next upload at " + next + "."); } }
Source:
private void setConsumerGuestCounts(Owner owner, OwnerInfo info) { Criteria cr = consumerCurator.createSecureCriteria() .createAlias("facts", "f") .add(Restrictions.eq("owner", owner)) .add(Restrictions.eq("f.indices", "virt.is_guest")) .add(Restrictions.eq("f.elements", "true")) .setProjection(Projections.count("id")); int guestCount = ((Long) cr.uniqueResult()).intValue(); Criteria totalConsumersCriteria = consumerCurator.createSecureCriteria() .add(Restrictions.eq("owner", owner)) .setProjection(Projections.count("id")); int totalConsumers = ((Long) totalConsumersCriteria.uniqueResult()).intValue(); int physicalCount = totalConsumers - guestCount; info.setGuestCount(guestCount); info.setPhysicalCount(physicalCount); }

Target:
private void setConsumerGuestCounts(Owner owner, OwnerInfo info) { Criteria cr = consumerCurator.createSecureCriteria() .createAlias("facts", "f") .add(Restrictions.eq("owner", owner)) .add(Restrictions.ilike("f.indices", "virt.is_guest")) .add(Restrictions.ilike("f.elements", "true")) .setProjection(Projections.count("id")); int guestCount = ((Long) cr.uniqueResult()).intValue(); Criteria totalConsumersCriteria = consumerCurator.createSecureCriteria() .add(Restrictions.eq("owner", owner)) .setProjection(Projections.count("id")); int totalConsumers = ((Long) totalConsumersCriteria.uniqueResult()).intValue(); int physicalCount = totalConsumers - guestCount; info.setGuestCount(guestCount); info.setPhysicalCount(physicalCount); }
Source:
public synchronized void dropSchema(ConnectorSession session, String schemaName) { if (!schemas.contains(schemaName)) { throw new PrestoException(NOT_FOUND, format("Schema [%s] does not exist", schemaName)); } tables.values().stream() .filter(table -> table.getSchemaName().equals(schemaName)) .forEach(table -> dropTable(session, table)); verify(schemas.remove(schemaName)); }

Target:
public synchronized void dropSchema(ConnectorSession session, String schemaName) { if (!schemas.contains(schemaName)) { throw new PrestoException(NOT_FOUND, format("Schema [%s] does not exist", schemaName)); } boolean tablesExist = tables.values().stream() .anyMatch(table -> table.getSchemaName().equals(schemaName)); if (tablesExist) { throw new PrestoException(SCHEMA_NOT_EMPTY, "Schema not empty: " + schemaName); } verify(schemas.remove(schemaName)); }
Source:
public void successfulCompletionWithErrors(ExportSucceededWithErrorsEvent event) { exportStatusList.append("\n").append("SUCCEEDED WITH ERRORS!"); lblExporting.setText("SUCCEEDED WITH SOME ERRORS SEE DETAILS!"); setActiveExportState(false); }

Target:
public void successfulCompletionWithErrors(ExportSucceededWithErrorsEvent event) { exportStatusList.append("\n").append("SUCCEEDED, BUT WITH ERRORS!"); lblExporting.setText("SUCCEEDED, BUT WITH ERRORS. SEE DETAILS!"); setActiveExportState(false); }
Source:
protected void loadMoreItems() { if (nextPage == null || ((nextPage.getUrl() == null || nextPage.getUrl().isEmpty()) && (nextPage.getIds() == null || nextPage.getIds().isEmpty()))) { return; } isLoading.set(true); showListFooter(true); if (searchDisposable != null) { searchDisposable.dispose(); } searchDisposable = ExtractorHelper.getMoreSearchItems( serviceId, searchString, asList(contentFilter), sortFilter, nextPage) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .doOnEvent((nextItemsResult, throwable) -> isLoading.set(false)) .subscribe(this::handleNextItems, this::onError); }

Target:
protected void loadMoreItems() { if (!Page.isValid(nextPage)) { return; } isLoading.set(true); showListFooter(true); if (searchDisposable != null) { searchDisposable.dispose(); } searchDisposable = ExtractorHelper.getMoreSearchItems( serviceId, searchString, asList(contentFilter), sortFilter, nextPage) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .doOnEvent((nextItemsResult, throwable) -> isLoading.set(false)) .subscribe(this::handleNextItems, this::onError); }
Source:
public void testChannelNamesTransformedToHyperlinks() { String output = instance.replaceChannelNamesWithHyperlinks("Go to #moderation and report a user"); assertThat(output, containsString("#moderation")); assertThat(output, containsString("<a")); }

Target:
public void testChannelNamesTransformedToHyperlinks() { String output = instance.replaceChannelNamesWithHyperlinks("Go to #moderation and report a user"); assertThat(output, is("Go to <a href=\"javascript:void(0);\" onClick=\"java.openChannel('#moderation')\">#moderation</a> and report a user")); }
Source:
private void showBuildException(@NotNull BuildException e, @NotNull String stdErr, @NotNull List<GradleMessage> buildMessages) { if (!stdErr.isEmpty()) { GradleMessage msg = new GradleMessage(GradleMessage.Kind.ERROR, stdErr); buildMessages.add(msg); addMessage(msg, null); } else { ByteArrayOutputStream out = new ByteArrayOutputStream(BUFFER_SIZE); try { e.printStackTrace(new PrintStream(out)); String message = "Internal error:" + SystemProperties.getLineSeparator() + out.toString(); GradleMessage msg = new GradleMessage(GradleMessage.Kind.ERROR, message); buildMessages.add(msg); addMessage(msg, null); } finally { Closeables.closeQuietly(out); } } }

Target:
private void showBuildException(@NotNull BuildException e, @NotNull String stdErr, @NotNull List<GradleMessage> buildMessages) { if (!stdErr.trim().isEmpty()) { GradleMessage msg = new GradleMessage(GradleMessage.Kind.ERROR, stdErr); buildMessages.add(msg); addMessage(msg, null); } else { ByteArrayOutputStream out = new ByteArrayOutputStream(BUFFER_SIZE); try { e.printStackTrace(new PrintStream(out)); String message = "Internal error:" + SystemProperties.getLineSeparator() + out.toString(); GradleMessage msg = new GradleMessage(GradleMessage.Kind.ERROR, message); buildMessages.add(msg); addMessage(msg, null); } finally { Closeables.closeQuietly(out); } } }
Source:
private void createVnicProfileMappingsModel() { updateExternalVnicProfilesPerTargetCluster(); vnicProfileMappingModel = new VnicProfileMappingModel( RegisterTemplateModel.this, externalVnicProfilesPerTargetCluster); vnicProfileMappingModel.initialize(); }

Target:
private void createVnicProfileMappingsModel() { updateExternalVnicProfilesPerTargetCluster(); vnicProfileMappingModel = new VnicProfileMappingModel( this, externalVnicProfilesPerTargetCluster); vnicProfileMappingModel.initialize(); }
Source:
public String[] getAddresses() { return addrFinder.get(); }

Target:
public String[] getAddresses() { if (addrs != null) return Arrays.copyOf(addrs, addrs.length); return null; }
Source:
private CppLinkActionBuilder newLinkActionBuilder( Artifact outputArtifact, LinkTargetType linkType) { CppLinkActionBuilder builder = new CppLinkActionBuilder( ruleErrorConsumer, actionConstructionContext, label, outputArtifact, configuration, ccToolchain, fdoContext, featureConfiguration, semantics) .setGrepIncludes(grepIncludes) .setIsStampingEnabled(isStampingEnabled) .setTestOrTestOnlyTarget(isTestOrTestOnlyTarget) .setLinkType(linkType) .setLinkerFiles( (cppConfiguration.useSpecificToolFiles() && linkType.linkerOrArchiver() == LinkerOrArchiver.ARCHIVER) ? ccToolchain.getArFiles() : ccToolchain.getLinkerFiles()) .setLinkArtifactFactory(linkArtifactFactory) .setUseTestOnlyFlags(useTestOnlyFlags); if (ruleContext != null) { builder.addExecutionInfo(TargetUtils.getExecutionInfo(ruleContext.getRule(), ruleContext.isAllowTagsPropagation())); } return builder; }

Target:
private CppLinkActionBuilder newLinkActionBuilder( Artifact outputArtifact, LinkTargetType linkType) { return new CppLinkActionBuilder( ruleErrorConsumer, actionConstructionContext, label, outputArtifact, configuration, ccToolchain, fdoContext, featureConfiguration, semantics) .setGrepIncludes(grepIncludes) .setIsStampingEnabled(isStampingEnabled) .setTestOrTestOnlyTarget(isTestOrTestOnlyTarget) .setLinkType(linkType) .setLinkerFiles( (cppConfiguration.useSpecificToolFiles() && linkType.linkerOrArchiver() == LinkerOrArchiver.ARCHIVER) ? ccToolchain.getArFiles() : ccToolchain.getLinkerFiles()) .setLinkArtifactFactory(linkArtifactFactory) .setUseTestOnlyFlags(useTestOnlyFlags) .addExecutionInfo(executionInfo); }
Source:
public void onPageRequest(final PageRequest request) { final Map<Integer, Integer> calendars = new HashMap<Integer, Integer>(); Integer calendarId = 1; calendars.put(calendarId++, getOrgUnit().getId()); calendars.put(calendarId, getOrgUnit().getCalendarId()); calendarId = calendarId + 3; java.util.Iterator<OrgUnitDTO> iter = getOrgUnit().getChildrenOrgUnits().iterator(); while (iter.hasNext()) { calendars.put(calendarId++, getOrgUnit().getChildrenOrgUnits().iterator().next().getId()); calendars.put(calendarId, getOrgUnit().getChildrenOrgUnits().iterator().next().getCalendarId()); iter.next(); calendarId = calendarId + 3; } calendarPresenter.reload(calendars); }

Target:
public void onPageRequest(final PageRequest request) { final Map<Integer, Integer> calendars = new HashMap<Integer, Integer>(); Integer calendarId = 1; calendars.put(calendarId++, getOrgUnit().getId()); calendars.put(calendarId, getOrgUnit().getCalendarId()); calendarId = calendarId + 3; for(final OrgUnitDTO child : getOrgUnit().getChildrenOrgUnits()) { calendars.put(calendarId++, child.getId()); calendars.put(calendarId, child.getCalendarId()); calendarId = calendarId + 3; } calendarPresenter.reload(calendars); }
Source:
private Page processColumnSource() { DriverYieldSignal yieldSignal = operatorContext.getDriverContext().getYieldSignal(); if (!finishing && !yieldSignal.isSet()) { CursorProcessorOutput output = cursorProcessor.process(operatorContext.getSession().toConnectorSession(), yieldSignal, cursor, pageBuilder); pageSourceMemoryContext.setBytes(cursor.getSystemMemoryUsage()); long bytesProcessed = cursor.getCompletedBytes() - completedBytes; long elapsedNanos = cursor.getReadTimeNanos() - readTimeNanos; operatorContext.recordGeneratedInput(bytesProcessed, output.getProcessedRows(), elapsedNanos); completedBytes = cursor.getCompletedBytes(); readTimeNanos = cursor.getReadTimeNanos(); if (output.isNoMoreRows()) { finishing = true; currentOutput.finish(); } } Page page = null; if (!pageBuilder.isEmpty() && (finishing || pageBuilder.isFull())) { page = pageBuilder.build(); pageBuilder.reset(); } pageBuilderMemoryContext.setBytes(pageBuilder.getRetainedSizeInBytes()); return page; }

Target:
private Page processColumnSource() { DriverYieldSignal yieldSignal = operatorContext.getDriverContext().getYieldSignal(); if (!finishing && !yieldSignal.isSet()) { CursorProcessorOutput output = cursorProcessor.process(operatorContext.getSession().toConnectorSession(), yieldSignal, cursor, pageBuilder); pageSourceMemoryContext.setBytes(cursor.getSystemMemoryUsage()); long bytesProcessed = cursor.getCompletedBytes() - completedBytes; long elapsedNanos = cursor.getReadTimeNanos() - readTimeNanos; operatorContext.recordGeneratedInput(bytesProcessed, output.getProcessedRows(), elapsedNanos); completedBytes = cursor.getCompletedBytes(); readTimeNanos = cursor.getReadTimeNanos(); if (output.isNoMoreRows()) { finishing = true; mergingOutput.finish(); } } Page page = null; if (!pageBuilder.isEmpty() && (finishing || pageBuilder.isFull())) { page = pageBuilder.build(); pageBuilder.reset(); } pageBuilderMemoryContext.setBytes(pageBuilder.getRetainedSizeInBytes()); return page; }
Source:
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Project project = request.getParameter("project") != null ? getProject(request) : null; PreferenceStore ps = ProjectManager.singleton.getPreferenceStore(); try { response.setCharacterEncoding("UTF-8"); response.setHeader("Content-Type", "application/json"); JSONWriter writer = new JSONWriter(response.getWriter()); writer.object(); for (String key : ps.getKeys()) { Object pref = ps.get(key); if (pref == null || pref instanceof String || pref instanceof Number || pref instanceof Boolean) { writer.key(key); writer.value(pref); } } writer.endObject(); } catch (JSONException e) { respondException(response, e); } }

Target:
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Project project = request.getParameter("project") != null ? getProject(request) : null; PreferenceStore ps = project != null ? project.getMetadata().getPreferenceStore() : ProjectManager.singleton.getPreferenceStore(); try { response.setCharacterEncoding("UTF-8"); response.setHeader("Content-Type", "application/json"); JSONWriter writer = new JSONWriter(response.getWriter()); writer.object(); for (String key : ps.getKeys()) { Object pref = ps.get(key); if (pref == null || pref instanceof String || pref instanceof Number || pref instanceof Boolean) { writer.key(key); writer.value(pref); } } writer.endObject(); } catch (JSONException e) { respondException(response, e); } }
Source:
public EmailProducerBuilder setCcRecipient(String recipient) { List<String> recipients = new ArrayList<String>(); recipients.add(recipient); return this.setCcRecipients(recipients); }

Target:
public EmailProducerBuilder setCcRecipient(String recipient) { return this.setCcRecipients(Arrays.asList(recipient)); }
Source:
protected final ResourceEventHandler<WorkerType> getResourceEventHandler() { return Preconditions.checkNotNull( this.resourceEventHandler, "Cannot get resource event handler. Resource manager driver is not initialized."); }

Target:
protected final ResourceEventHandler<WorkerType> getResourceEventHandler() { Preconditions.checkState(resourceEventHandler != null, "Cannot get resource event handler. Resource manager driver is not initialized."); return resourceEventHandler; }
Source:
public ReplicationState(ReplicationType type) { this(null, type); }

Target:
public ReplicationState(ReplicationType type) { this(type, null); }
Source:
public void createControl(Composite parent) { wizard = (SelectGraphWizard)getWizard(); Composite cmpGraphOpts = new Composite(parent, SWT.NONE); ColumnLayout colLayout = new ColumnLayout(); colLayout.maxNumColumns = 1; cmpGraphOpts.setLayout(colLayout); String[] graphIDs = GraphFactory.getAvailableGraphs(wizard.model.getDataSet()); btnGraphs = new Button[graphIDs.length]; for(int i=0; i<btnGraphs.length; i++) { btnGraphs[i] = new Button(cmpGraphOpts, SWT.TOGGLE); btnGraphs[i].setImage(GraphFactory.getGraphImage(graphIDs[i])); btnGraphs[i].addListener(SWT.Selection, this); btnGraphs[i].setData(graphIDs[i]); btnGraphs[i].setToolTipText(GraphFactory.getGraphName(btnGraphs[i].getData().toString()) + "\n\n" + GraphFactory.getGraphDescription(btnGraphs[i].getData().toString())); if (wizard.edit && graphIDs[i].equals(wizard.model.getGraphID())) { btnGraphs[i].setSelection(true); } } setControl(cmpGraphOpts); }

Target:
public void createControl(Composite parent) { wizard = (SelectGraphWizard)getWizard(); Composite cmpGraphOpts = new Composite(parent, SWT.NONE); ColumnLayout colLayout = new ColumnLayout(); colLayout.maxNumColumns = 1; cmpGraphOpts.setLayout(colLayout); String[] graphIDs = GraphFactory.getAvailableGraphs(wizard.model.getDataSet()); btnGraphs = new Button[graphIDs.length]; for(int i=0; i<btnGraphs.length; i++) { btnGraphs[i] = new Button(cmpGraphOpts, SWT.TOGGLE); btnGraphs[i].setImage(GraphFactory.getGraphImage(graphIDs[i])); btnGraphs[i].addListener(SWT.Selection, this); btnGraphs[i].setData(graphIDs[i]); btnGraphs[i].setToolTipText(GraphFactory.getGraphName(btnGraphs[i].getData().toString()) + "\n\n" + GraphFactory.getGraphDescription(btnGraphs[i].getData().toString())); if (wizard.isEditing() && graphIDs[i].equals(wizard.model.getGraphID())) { btnGraphs[i].setSelection(true); } } setControl(cmpGraphOpts); }
Source:
public void exportQuarterlyReport(@PathVariable("quarterlyReportId") final Long quarterlyReportId, final HttpServletResponse response) throws EntityRetrievalException, IOException { if (!ff4j.check(FeatureList.SURVEILLANCE_REPORTING)) { throw new NotImplementedException(); } Workbook reportXlsx = reportManager.exportQuarterlyReport(quarterlyReportId); QuarterlyReportDTO report = reportManager.getQuarterlyReport(quarterlyReportId); String filename = report.getQuarter().getName() + "-" + report.getAnnualReport().getYear() + "-" + report.getAnnualReport().getAcb().getName() + "-quarterly-report.xlsx"; File downloadFile = fileUtils.createDownloadFile(filename); OutputStream outputStream = null; try { outputStream = new FileOutputStream(downloadFile); reportXlsx.write(outputStream); } catch (final Exception ex) { LOGGER.error("Error writing excel document to file output stream.", ex); } finally { outputStream.flush(); outputStream.close(); } fileUtils.streamFileAsResponse(downloadFile, XLSX_MIME_TYPE, response); }

Target:
public void exportQuarterlyReport(@PathVariable("quarterlyReportId") final Long quarterlyReportId, final HttpServletResponse response) throws EntityRetrievalException, IOException { if (!ff4j.check(FeatureList.SURVEILLANCE_REPORTING)) { throw new NotImplementedException(); } Workbook reportXlsx = reportManager.exportQuarterlyReport(quarterlyReportId); QuarterlyReportDTO report = reportManager.getQuarterlyReport(quarterlyReportId); String filename = report.getQuarter().getName() + "-" + report.getAnnualReport().getYear() + "-" + report.getAnnualReport().getAcb().getName() + "-quarterly-report"; File tempFileToStream = File.createTempFile(filename, ".xlsx"); OutputStream outputStream = null; try { outputStream = new FileOutputStream(tempFileToStream); reportXlsx.write(outputStream); } catch (final Exception ex) { LOGGER.error("Error writing excel document to file output stream.", ex); } finally { outputStream.flush(); outputStream.close(); } fileUtils.streamFileAsResponse(tempFileToStream, XLSX_MIME_TYPE, response); }
Source:
public void testLongStatsToColumnStatistics() { LongColumnStatsData longColumnStatsData = new LongColumnStatsData(); longColumnStatsData.setLowValue(0); longColumnStatsData.setHighValue(100); longColumnStatsData.setNumNulls(0); longColumnStatsData.setNumDVs(20); ColumnStatisticsObj columnStatisticsObj = new ColumnStatisticsObj("my_col", BIGINT_TYPE_NAME, longStats(longColumnStatsData)); HiveColumnStatistics actual = fromMetastoreApiColumnStatistics(columnStatisticsObj); assertEquals(actual.getLowValue(), Optional.of(0L)); assertEquals(actual.getHighValue(), Optional.of(100L)); assertEquals(actual.getMaxColumnLength(), OptionalLong.empty()); assertEquals(actual.getAverageColumnLength(), OptionalDouble.empty()); assertEquals(actual.getTrueCount(), OptionalLong.empty()); assertEquals(actual.getFalseCount(), OptionalLong.empty()); assertEquals(actual.getNullsCount(), OptionalLong.of(0)); assertEquals(actual.getDistinctValuesCount(), OptionalLong.of(20)); LongColumnStatsData emptyLongColumnStatsData = new LongColumnStatsData(); columnStatisticsObj = new ColumnStatisticsObj("my_col", BIGINT_TYPE_NAME, longStats(emptyLongColumnStatsData)); actual = fromMetastoreApiColumnStatistics(columnStatisticsObj); assertEmptyColumnStats(actual); }

Target:
public void testLongStatsToColumnStatistics() { LongColumnStatsData longColumnStatsData = new LongColumnStatsData(); longColumnStatsData.setLowValue(0); longColumnStatsData.setHighValue(100); longColumnStatsData.setNumNulls(0); longColumnStatsData.setNumDVs(20); ColumnStatisticsObj columnStatisticsObj = new ColumnStatisticsObj("my_col", BIGINT_TYPE_NAME, longStats(longColumnStatsData)); HiveColumnStatistics actual = fromMetastoreApiColumnStatistics(columnStatisticsObj); assertEquals(actual.getLowValue(), Optional.of(0L)); assertEquals(actual.getHighValue(), Optional.of(100L)); assertEquals(actual.getMaxColumnLength(), OptionalLong.empty()); assertEquals(actual.getAverageColumnLength(), OptionalDouble.empty()); assertEquals(actual.getTrueCount(), OptionalLong.empty()); assertEquals(actual.getFalseCount(), OptionalLong.empty()); assertEquals(actual.getNullsCount(), OptionalLong.of(0)); assertEquals(actual.getDistinctValuesCount(), OptionalLong.of(20)); }
Source:
public void testAllocationDeallocationMemory() { fModule.schedule(); fModule.waitForCompletion(); ITmfStateSystem ss = fModule.getStateSystem(); assertNotNull(ss); assertEquals(1L, ss.getStartTime()); assertEquals(30L, ss.getCurrentEndTime()); long totalMemory = 0; threadEvent.put(1L, PAGE_SIZE); threadEvent.put(2L, -PAGE_SIZE); threadEvent.put(3L, -PAGE_SIZE); threadEvent.put(17L, PAGE_SIZE); threadEvent.put(22L, -PAGE_SIZE); threadEvent.put(28L, -PAGE_SIZE); threadEvent.put(29L, PAGE_SIZE); threadEvent.put(30L, PAGE_SIZE); for (Map.Entry<Long, Long> entry : threadEvent.entrySet()) { try { ITmfContext context = fTrace.seekEvent(entry.getKey()); ITmfEvent event = fTrace.getNext(context); if (event == null) { assertNull(event); }else{ Integer tidField = KernelTidAspect.INSTANCE.resolve(event); String tid; if (tidField == null) { assertNull(tidField); tid = "other"; } else { tid = tidField.toString(); } int tidQuark = ss.getQuarkAbsolute(tid); ITmfStateInterval kernelState = ss.querySingleState(entry.getKey(), tidQuark); long value = kernelState.getStateValue().unboxLong(); totalMemory += entry.getValue(); assertEquals(totalMemory, value); } } catch (StateSystemDisposedException | AttributeNotFoundException e) { fail(e.getMessage()); } } }

Target:
public void testAllocationDeallocationMemory() { fModule.schedule(); fModule.waitForCompletion(); ITmfStateSystem ss = fModule.getStateSystem(); assertNotNull(ss); assertEquals(1L, ss.getStartTime()); assertEquals(30L, ss.getCurrentEndTime()); long totalMemory = 0; threadEvent.put(1L, PAGE_SIZE); threadEvent.put(2L, -PAGE_SIZE); threadEvent.put(3L, -PAGE_SIZE); threadEvent.put(17L, PAGE_SIZE); threadEvent.put(22L, -PAGE_SIZE); threadEvent.put(28L, -PAGE_SIZE); threadEvent.put(29L, PAGE_SIZE); threadEvent.put(30L, PAGE_SIZE); for (Map.Entry<Long, Long> entry : threadEvent.entrySet()) { try { int tidQuark = ss.getQuarkAbsolute(KernelMemoryStateProvider.OTHER_TID); ITmfStateInterval kernelState = ss.querySingleState(entry.getKey(), tidQuark); long value = kernelState.getStateValue().unboxLong(); totalMemory += entry.getValue(); assertEquals(totalMemory, value); } catch (StateSystemDisposedException | AttributeNotFoundException e) { fail(e.getMessage()); } } }
Source:
private boolean anyAnnotationsModifyType(List<DispoAnnotationData> annotations) { for (DispoAnnotationData annotation : annotations) { if (annotation.getResolutionMethodType() != null) { if (annotation.getResolutionMethodType().startsWith("Modify_")) { return true; } } } return false; }

Target:
private boolean anyAnnotationsModifyType(List<DispoAnnotationData> annotations) { for (DispoAnnotationData annotation : annotations) { if (annotation.getResolutionMethodType() != null) { if (annotation.getResolutionMethodType().startsWith(DispoStrings.MODIFY)) { return true; } } } return false; }
Source:
private static Optional<CoordinationUtils> getCoordinationUtils(Config config) { if (new JobConfig(config).getConfigLoaderFactory().isPresent()) { config = ConfigUtil.loadConfig(config); } if (!isAppModeBatch(config)) { return Optional.empty(); } JobCoordinatorConfig jcConfig = new JobCoordinatorConfig(config); CoordinationUtils coordinationUtils = jcConfig.getCoordinationUtilsFactory() .getCoordinationUtils(CoordinationConstants.APPLICATION_RUNNER_PATH_SUFFIX, PROCESSOR_ID, config); return Optional.ofNullable(coordinationUtils); }

Target:
private static Optional<CoordinationUtils> getCoordinationUtils(Config config) { if (!isAppModeBatch(config)) { return Optional.empty(); } JobCoordinatorConfig jcConfig = new JobCoordinatorConfig(config); CoordinationUtils coordinationUtils = jcConfig.getCoordinationUtilsFactory() .getCoordinationUtils(CoordinationConstants.APPLICATION_RUNNER_PATH_SUFFIX, PROCESSOR_ID, config); return Optional.ofNullable(coordinationUtils); }
Source:
public void runBeforeEachTest() { executeDataSet(CREATE_PATIENT_PROGRAMS_XML); executeDataSet(PROGRAM_ATTRIBUTES_XML); if (pws == null) { pws = Context.getProgramWorkflowService(); adminService = Context.getAdministrationService(); encounterService = Context.getEncounterService(); cs = Context.getConceptService(); } if (dao == null) { dao = (ProgramWorkflowDAO) applicationContext.getBean("programWorkflowDAO"); } }

Target:
public void runBeforeEachTest() { executeDataSet(CREATE_PATIENT_PROGRAMS_XML); executeDataSet(PROGRAM_ATTRIBUTES_XML); executeDataSet(OTHER_PROGRAM_WORKFLOWS); if (pws == null) { pws = Context.getProgramWorkflowService(); adminService = Context.getAdministrationService(); encounterService = Context.getEncounterService(); cs = Context.getConceptService(); } }
Source:
private void reloadProductList() { if (pd != null) { pd.cancel(); } pd = new ProgressDialog(this.getActivity()); pd.setMessage("Fetching products"); pd.show(); updateProductList(); }

Target:
private void reloadProductList() { if (pd == null) { pd = new ProgressDialog(this.getActivity()); } pd.setMessage("Fetching products"); pd.show(); updateProductList(); }
Source:
public int hashCode() { int result = super.hashCode(); result = 31 * result + keySize; result = 31 * result + (hasKey ? 0 : 1); return result; }

Target:
public int hashCode() { int result = super.hashCode(); result = 31 * result + keySize; result = 31 * result + valueSize; return result; }
Source:
private static boolean typeMatchesValue(DataType type, Object value) { if (value == null) { return true; } if (type instanceof ArrayType) { DataType innerType = ((ArrayType) type).innerType(); while (innerType instanceof ArrayType && value.getClass().isArray()) { type = innerType; innerType = ((ArrayType) innerType).innerType(); value = ((Object[]) value)[0]; } return Arrays.equals((Object[]) value, ((ArrayType) type).value(value)); } if (type.id() == ObjectType.ID) { Map<String, Object> mapValue = (Map<String, Object>) value; ObjectType objectType = ((ObjectType) type); for (String key : mapValue.keySet()) { DataType innerType = objectType.innerType(key); if (typeMatchesValue(innerType, mapValue.get(key)) == false) { return false; } } Map<String, Object> safeValue = objectType.value(value); return safeValue.size() == mapValue.size(); } return Objects.equals(type.value(value), value); }

Target:
private static boolean typeMatchesValue(DataType type, Object value) { if (value == null) { return true; } if (type.id() == ObjectType.ID) { Map<String, Object> mapValue = (Map<String, Object>) value; ObjectType objectType = ((ObjectType) type); for (String key : mapValue.keySet()) { DataType innerType = objectType.innerType(key); if (typeMatchesValue(innerType, mapValue.get(key)) == false) { return false; } } Map<String, Object> safeValue = objectType.value(value); return safeValue.size() == mapValue.size(); } return Objects.equals(type.value(value), value); }
Source:
public Color getBackground() { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (alphaInfo_100.transparentPixel == -1) return null; int red = (alphaInfo_100.transparentPixel >> 16) & 0xFF; int green = (alphaInfo_100.transparentPixel >> 8) & 0xFF; int blue = (alphaInfo_100.transparentPixel >> 0) & 0xFF; return Color.cocoa_new(device, new double []{red / 255f, green / 255f, blue / 255f, 1}); }

Target:
public Color getBackground() { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); NSBitmapImageRep imageRep = getRepresentation(); AlphaInfo alphaInfo = _getAlphaInfoAtCurrentZoom(imageRep); if (alphaInfo.transparentPixel == -1) return null; int red = (alphaInfo.transparentPixel >> 16) & 0xFF; int green = (alphaInfo.transparentPixel >> 8) & 0xFF; int blue = (alphaInfo.transparentPixel >> 0) & 0xFF; return Color.cocoa_new(device, new double []{red / 255f, green / 255f, blue / 255f, 1}); }
Source:
public void save() { Boolean value; if(persistenceType == PropertyPersistenceType.Persistent && (value = randomAccessStore.getBoolean(key)) != null) { permanentStore.setBoolean(key, value.booleanValue()); } }

Target:
public void save() { if(persistenceType == PropertyPersistenceType.Persistent) { permanentStore.setBoolean(key, get()); } }
Source:
protected boolean canDoAction() { boolean retValue=true; job = DbFacade.getInstance().getJobDao().get(getParameters().getId()); if (job != null) { if (!job.isExternal()) { retValue = false; } } else { parentStep = DbFacade.getInstance().getStepDao().get(getParameters().getId()); } if (job == null && parentStep == null) { retValue=false; } return retValue; }

Target:
protected boolean canDoAction() { boolean retValue=true; job = getJobDao().get(getParameters().getId()); if (job != null) { if (!job.isExternal()) { retValue = false; } } else { parentStep = getStepDao().get(getParameters().getId()); } if (job == null && parentStep == null) { retValue=false; } return retValue; }
Source:
public Response delete(@PathParam("tenant") String tenant, @PathParam("subject") String subject) { LOGGER.debug("Removing all the policies for [" + tenant + "] and subject[" + subject + "]"); dao.deleteFromSubject(tenant, subject); return Response.status(204).build(); }

Target:
public Response delete(@PathParam("tenant") String tenant, @PathParam("subject") String subject) { LOGGER.debug("Removing all the policies for and subject[{}]", tenant, subject); dao.deleteFromSubject(tenant, subject); return Response.status(204).build(); }
Source:
public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } urlopen = login(); String response = null; try { response = urlopen.open("<LINK_0>"); try { JSONObject object = (JSONObject) new JSONTokener(response).nextValue(); JSONArray data = object.getJSONArray("data"); int length = data.length(); for (int index = 0; index < length; index++) { JSONObject account = data.getJSONObject(index); Document d = Jsoup.parse(account.getString("namnUrl")); Element e = d.getElementsByTag("a").first(); if (e != null && e.attr("href") != null) { mAccountUrlMappings.put(account.getString("kontonummer"), e.attr("href").replace("/info.html", "/info/kontoutdrag.html")); } accounts.add(new Account(String.format("%s (%s)", account.getString("namn"), account.getString("kontonummer")), Helpers.parseBalance(account.getString("disponibeltBelopp")).subtract(Helpers.parseBalance(account.getString("limit"))), account.getString("kontonummer"))); } } catch (JSONException e) { throw new BankException(e.getMessage(), e); } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } } finally { super.updateComplete(); } }

Target:
public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } urlopen = login(); String response = urlopen.open("<LINK_0>"); try { JSONObject object = (JSONObject) new JSONTokener(response).nextValue(); JSONArray data = object.getJSONArray("data"); int length = data.length(); for (int index = 0; index < length; index++) { JSONObject account = data.getJSONObject(index); Document d = Jsoup.parse(account.getString("namnUrl")); Element e = d.getElementsByTag("a").first(); if (e != null && e.attr("href") != null) { mAccountUrlMappings.put(account.getString("kontonummer"), e.attr("href").replace("/info.html", "/info/kontoutdrag.html")); } accounts.add(new Account(String.format("%s (%s)", account.getString("namn"), account.getString("kontonummer")), Helpers.parseBalance(account.getString("disponibeltBelopp")).subtract(Helpers.parseBalance(account.getString("limit"))), account.getString("kontonummer"))); } } catch (JSONException e) { throw new BankException(e.getMessage(), e); } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } super.updateComplete(); }
Source:
public EntityType(Type type, Set<Supertype> superTypes) { this(type, superTypes, new DefaultVariableNameFunction()); }

Target:
public EntityType(Type type, Set<Supertype> superTypes) { this(type, superTypes, DefaultVariableNameFunction.INSTANCE); }
Source:
public void testStringInputRowParserSerdeMultiCharset() throws Exception { Charset[] testCharsets = {Charsets.US_ASCII, Charsets.ISO_8859_1, Charsets.UTF_8, Charsets.UTF_16BE, Charsets.UTF_16LE, Charsets.UTF_16}; for (Charset testCharset : testCharsets) { InputRow parsed = testCharsetParseHelper(testCharset); Assert.assertEquals(ImmutableList.of("bar", "foo"), parsed.getDimensions()); Assert.assertEquals(ImmutableList.of("x"), parsed.getDimension("foo")); Assert.assertEquals(ImmutableList.of("y"), parsed.getDimension("bar")); Assert.assertEquals(new DateTime("3000").getMillis(), parsed.getTimestampFromEpoch()); } String badCharsetName = "BAD CHARSET NAME"; try { final StringInputRowParser badParser = new StringInputRowParser( new JSONParseSpec( new TimestampSpec("timestamp", "iso", null), new DimensionsSpec(ImmutableList.of("foo", "bar"), null, null) ), badCharsetName ); Assert.fail("StringInputRowParser should have failed with IllegalCharsetNameException"); } catch(IllegalCharsetNameException icne) { Assert.assertEquals(icne.getMessage(), badCharsetName); } return; }

Target:
public void testStringInputRowParserSerdeMultiCharset() throws Exception { Charset[] testCharsets = { Charsets.US_ASCII, Charsets.ISO_8859_1, Charsets.UTF_8, Charsets.UTF_16BE, Charsets.UTF_16LE, Charsets.UTF_16 }; for (Charset testCharset : testCharsets) { InputRow parsed = testCharsetParseHelper(testCharset); Assert.assertEquals(ImmutableList.of("bar", "foo"), parsed.getDimensions()); Assert.assertEquals(ImmutableList.of("x"), parsed.getDimension("foo")); Assert.assertEquals(ImmutableList.of("y"), parsed.getDimension("bar")); Assert.assertEquals(new DateTime("3000").getMillis(), parsed.getTimestampFromEpoch()); } }
Source:
protected int printList(String prefix, Collection<String> list) { if (list != null && !list.isEmpty()) { for (String filename : list) out.println("#\t" + prefix + filename); return list.size(); } else return 0; }

Target:
protected int printList(String prefix, Collection<String> list) { if (!list.isEmpty()) { List<String> sortedList = new ArrayList<String>(list); java.util.Collections.sort(sortedList); for (String filename : sortedList) out.println(CLIText.formatLine(String.format( statusFileListFormat, prefix, filename))); return list.size(); } else return 0; }
Source:
public PaginationResource getSessions( @PathParam("id") int projectId, @QueryParam("workflow") String workflowName, @QueryParam("last_id") Long lastId, @QueryParam("page_size") Integer pageSize, @QueryParam("page_number") Integer pageNumber) throws ResourceNotFoundException { int validPageSize = QueryParamValidator.validatePageSize(Optional.fromNullable(pageSize), MAX_SESSIONS_PAGE_SIZE, DEFAULT_SESSIONS_PAGE_SIZE); return tm.begin(() -> { ProjectStore ps = rm.getProjectStore(getSiteId()); SessionStore ss = ssm.getSessionStore(getSiteId()); StoredProject proj = ensureNotDeletedProject(ps.getProjectById(projectId)); List<StoredSessionWithLastAttempt> sessions; if (workflowName != null) { sessions = ss.getSessionsOfWorkflowByName(proj.getId(), workflowName, Optional.fromNullable(lastId)); } else { sessions = ss.getSessionsOfProject(proj.getId(), Optional.fromNullable(lastId)); } if (sessions.isEmpty()) return new PaginationResource(new ArrayList<>(), 1); int sessionsSize = sessions.size(); ArrayList<List<StoredSessionWithLastAttempt>> dividedSessions = new ArrayList<>(); for (int i =0; i < sessionsSize; i+= validPageSize) { dividedSessions.add(sessions.subList(i, Math.min(i + validPageSize, sessionsSize))); } Integer offset = Optional.fromNullable(pageNumber).or(1); List<StoredSessionWithLastAttempt> targetSessions = dividedSessions.get(offset - 1); List<RestSession> restSessions = RestModels.sessionCollection(ps, targetSessions).getSessions(); return new PaginationResource(restSessions, dividedSessions.size()); }, ResourceNotFoundException.class); }

Target:
public RestSessionCollection getSessions( @PathParam("id") int projectId, @QueryParam("workflow") String workflowName, @QueryParam("last_id") Long lastId, @QueryParam("page_size") Integer pageSize, @QueryParam("page_number") Integer pageNumber) throws ResourceNotFoundException { int validPageSize = QueryParamValidator.validatePageSize(Optional.fromNullable(pageSize), MAX_SESSIONS_PAGE_SIZE, DEFAULT_SESSIONS_PAGE_SIZE); int validPageNumber = QueryParamValidator.validatePageNumber(Optional.fromNullable(pageNumber), DEFAULT_PAGE_NUMBER); return tm.begin(() -> { ProjectStore ps = rm.getProjectStore(getSiteId()); SessionStore ss = ssm.getSessionStore(getSiteId()); StoredProject proj = ensureNotDeletedProject(ps.getProjectById(projectId)); Integer sessionRecordsNumber = ss.getSessionsCountOfProject(Optional.fromNullable(lastId), projectId); List<StoredSessionWithLastAttempt> sessions; if (workflowName != null) { sessions = ss.getSessionsOfWorkflowByName(proj.getId(), workflowName, validPageSize, validPageNumber, Optional.fromNullable(lastId)); } else { sessions = ss.getSessionsOfProject(proj.getId(), validPageSize, validPageNumber, Optional.fromNullable(lastId)); } return RestModels.sessionCollection(ps, sessions, sessionRecordsNumber); }, ResourceNotFoundException.class); }
Source:
public void addGame(@NotNull Game game) { GamePanel panel = new GamePanel(getGlassPane(), game); if(mTabbedPane.getTabCount() != 0) { mTabbedPane.addTab(game.getGameType() + mTabbedPane.getTabCount(), panel); } else{ mTabbedPane.addTab(game.getGameType(), panel); } mTabbedPane.setSelectedComponent(panel); mCardLayout.show(mCardPanel, KEY_TABS); }

Target:
public void addGame(@NotNull Game game) { GamePanel panel = new GamePanel(getGlassPane(), game); mTabbedPane.addTab(game.getGameType() + mTabbedPane.getTabCount(), panel); mTabbedPane.setSelectedComponent(panel); mCardLayout.show(mCardPanel, KEY_TABS); }
Source:
public PageReadStore readNextRowGroup() throws IOException { if (currentBlock == blocks.size()) { return null; } BlockMetaData block = blocks.get(currentBlock); if (block.getRowCount() == 0) { throw new RuntimeException("Illegal row group of 0 rows"); } this.currentRowGroup = new ColumnChunkPageReadStore(block.getRowCount()); List<ConsecutivePartList> allChunks = new ArrayList<ConsecutivePartList>(); ConsecutivePartList currentChunks = null; for (ColumnChunkMetaData mc : block.getColumns()) { ColumnPath pathKey = mc.getPath(); BenchmarkCounter.incrementTotalBytes(mc.getTotalSize()); ColumnDescriptor columnDescriptor = paths.get(pathKey); if (columnDescriptor != null) { long startingPos = mc.getStartingPos(); if (currentChunks == null || currentChunks.endPos() != startingPos) { currentChunks = new ConsecutivePartList(startingPos); allChunks.add(currentChunks); } currentChunks.addChunk(new ChunkDescriptor(columnDescriptor, mc, startingPos, (int)mc.getTotalSize())); } } ChunkListBuilder builder = new ChunkListBuilder(); for (ConsecutivePartList consecutiveChunks : allChunks) { consecutiveChunks.readAll(f, builder); } for (Chunk chunk : builder.build()) { currentRowGroup.addColumn(chunk.descriptor.col, chunk.readAllPages()); } if (nextDictionaryReader != null) { nextDictionaryReader.setRowGroup(currentRowGroup); } advanceToNextBlock(); return currentRowGroup; }

Target:
public PageReadStore readNextRowGroup() throws IOException { if (currentBlock == blocks.size()) { return null; } BlockMetaData block = blocks.get(currentBlock); if (block.getRowCount() == 0) { throw new RuntimeException("Illegal row group of 0 rows"); } this.currentRowGroup = new ColumnChunkPageReadStore(block.getRowCount()); List<ConsecutivePartList> allParts = new ArrayList<ConsecutivePartList>(); ConsecutivePartList currentParts = null; for (ColumnChunkMetaData mc : block.getColumns()) { ColumnPath pathKey = mc.getPath(); BenchmarkCounter.incrementTotalBytes(mc.getTotalSize()); ColumnDescriptor columnDescriptor = paths.get(pathKey); if (columnDescriptor != null) { long startingPos = mc.getStartingPos(); if (currentParts == null || currentParts.endPos() != startingPos) { currentParts = new ConsecutivePartList(startingPos); allParts.add(currentParts); } currentParts.addChunk(new ChunkDescriptor(columnDescriptor, mc, startingPos, (int)mc.getTotalSize())); } } ChunkListBuilder builder = new ChunkListBuilder(); for (ConsecutivePartList consecutiveChunks : allParts) { consecutiveChunks.readAll(f, builder); } for (Chunk chunk : builder.build()) { currentRowGroup.addColumn(chunk.descriptor.col, chunk.readAllPages()); } if (nextDictionaryReader != null) { nextDictionaryReader.setRowGroup(currentRowGroup); } advanceToNextBlock(); return currentRowGroup; }
Source:
private void waitOnAllRegionsToClose(final boolean abort) { int lastCount = -1; long previousLogTime = 0; Set<String> closedRegions = new HashSet<>(); boolean interrupted = false; try { while (!onlineRegions.isEmpty()) { int count = getNumberOfOnlineRegions(); if (count != lastCount) { if (System.currentTimeMillis() > (previousLogTime + 1000)) { previousLogTime = System.currentTimeMillis(); lastCount = count; LOG.info("Waiting on " + count + " regions to close"); if (count < 10 && LOG.isDebugEnabled()) { LOG.debug("Online Regions=" + this.onlineRegions); } } } for (Map.Entry<String, HRegion> e : this.onlineRegions.entrySet()) { RegionInfo hri = e.getValue().getRegionInfo(); if (!this.regionsInTransitionInRS.containsKey(hri.getEncodedNameAsBytes()) && !closedRegions.contains(hri.getEncodedName())) { closedRegions.add(hri.getEncodedName()); closeRegionIgnoreErrors(hri, abort); } } if (this.regionsInTransitionInRS.isEmpty()) { if (!onlineRegions.isEmpty()) { LOG.info("We were exiting though online regions are not empty," + " because some regions failed closing"); } break; } else { LOG.trace("Waiting on {}", this.regionsInTransitionInRS.entrySet().stream(). map(e -> Bytes.toString(e.getKey())).collect(Collectors.joining(", "))); } if (sleep(200)) { interrupted = true; } } } finally { if (interrupted) { Thread.currentThread().interrupt(); } } }

Target:
private void waitOnAllRegionsToClose(final boolean abort) { int lastCount = -1; long previousLogTime = 0; Set<String> closedRegions = new HashSet<>(); boolean interrupted = false; try { while (!onlineRegions.isEmpty()) { int count = getNumberOfOnlineRegions(); if (count != lastCount) { if (System.currentTimeMillis() > (previousLogTime + 1000)) { previousLogTime = System.currentTimeMillis(); lastCount = count; LOG.info("Waiting on " + count + " regions to close"); if (count < 10 && LOG.isDebugEnabled()) { LOG.debug("Online Regions=" + this.onlineRegions); } } } for (Map.Entry<String, HRegion> e : this.onlineRegions.entrySet()) { RegionInfo hri = e.getValue().getRegionInfo(); if (!this.regionsInTransitionInRS.containsKey(hri.getEncodedNameAsBytes()) && !closedRegions.contains(hri.getEncodedName())) { closedRegions.add(hri.getEncodedName()); closeRegionIgnoreErrors(hri, abort); } } if (this.regionsInTransitionInRS.isEmpty()) { if (!onlineRegions.isEmpty()) { LOG.info("We were exiting though online regions are not empty," + " because some regions failed closing"); } break; } if (sleep(200)) { interrupted = true; } } } finally { if (interrupted) { Thread.currentThread().interrupt(); } } }
Source:
public void report(String status, Class<?> execClass, MetricRegistry registry) { String sn = execClass.getSimpleName(); String prefix = FluoConfiguration.FLUO_PREFIX + ".tx."; if (getLockWaitTime() > 0) registry.timer(prefix + "lockWait." + sn).update(getLockWaitTime(), TimeUnit.MILLISECONDS); registry.timer(prefix + "time." + sn).update(getTime(), TimeUnit.MILLISECONDS); if (getCollisions() > 0) registry.histogram(prefix + "collisions." + sn).update(getCollisions()); registry.histogram(prefix + "set." + sn).update(getEntriesSet()); registry.histogram(prefix + "read." + sn).update(getEntriesReturned()); if (getTimedOutLocks() > 0) registry.histogram(prefix + "locks.timedout." + sn).update(getTimedOutLocks()); if (getDeadLocks() > 0) registry.histogram(prefix + "locks.dead." + sn).update(getDeadLocks()); registry.counter(prefix + "status." + status.toLowerCase() + "." + sn).inc(); }

Target:
public void report(String status, Class<?> execClass, MetricRegistry registry) { String sn = execClass.getSimpleName(); if (getLockWaitTime() > 0) registry.timer(MetricNames.TX_LOCKWAIT + sn).update(getLockWaitTime(), TimeUnit.MILLISECONDS); registry.timer(MetricNames.TX_TIME + sn).update(getTime(), TimeUnit.MILLISECONDS); if (getCollisions() > 0) registry.histogram(MetricNames.TX_COLLISIONS + sn).update(getCollisions()); registry.histogram(MetricNames.TX_SET + sn).update(getEntriesSet()); registry.histogram(MetricNames.TX_READ + sn).update(getEntriesReturned()); if (getTimedOutLocks() > 0) registry.histogram(MetricNames.TX_LOCKS_TIMEDOUT + sn).update(getTimedOutLocks()); if (getDeadLocks() > 0) registry.histogram(MetricNames.TX_LOCKS_DEAD + sn).update(getDeadLocks()); registry.counter(MetricNames.TX_STATUS + status.toLowerCase() + "." + sn).inc(); }
Source:
CosmosStoredProcedureResponse mapStoredProcedureResponseAndBlock( Mono<CosmosAsyncStoredProcedureResponse> storedProcedureResponseMono) throws CosmosClientException { try { return storedProcedureResponseMono .map(this::convertResponse) .block(); } catch (Exception ex) { final Throwable throwable = Exceptions.unwrap(ex); if (throwable instanceof CosmosClientException) { throw (CosmosClientException) throwable; } else { throw (RuntimeException) ex; } } }

Target:
CosmosStoredProcedureResponse mapStoredProcedureResponseAndBlock( Mono<CosmosAsyncStoredProcedureResponse> storedProcedureResponseMono) throws CosmosClientException { try { return storedProcedureResponseMono .map(this::convertResponse) .block(); } catch (Exception ex) { final Throwable throwable = Exceptions.unwrap(ex); if (throwable instanceof CosmosClientException) { throw (CosmosClientException) throwable; } else { throw ex; } } }
Source:
public void initialize() { minMaxFunc = ops().function(MinMax.class, Pair.class, Iterable.class); }

Target:
public void initialize() { minMaxFunc = (FunctionOp) ops().function(MinMax.class, Pair.class, in() != null ? in() : Iterable.class); }
Source:
public void addCluster(String clusterName, boolean overwritePrevious) { _admin.addCluster(clusterName, overwritePrevious); for (BuiltInStateModelDefinitions def : BuiltInStateModelDefinitions.values()) { addStateModelDef(clusterName, def.getStateModelDefinition().getId(), def.getStateModelDefinition(), overwritePrevious); } }

Target:
public void addCluster(String clusterName, boolean overwritePrevious) { addCluster(clusterName, overwritePrevious, null); }