auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); String contributionsFragmentTag = ((ContributionsActivityPagerAdapter) viewPager.getAdapter()).makeFragmentName(R.id.pager, 0); String nearbyFragmentTag = ((ContributionsActivityPagerAdapter) viewPager.getAdapter()).makeFragmentName(R.id.pager, 1); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else if (getSupportFragmentManager().findFragmentByTag(contributionsFragmentTag) != null && isContributionsFragmentVisible) { ContributionsFragment contributionsFragment = (ContributionsFragment) getSupportFragmentManager().findFragmentByTag(contributionsFragmentTag); if (contributionsFragment.getChildFragmentManager().findFragmentByTag(ContributionsFragment.MEDIA_DETAIL_PAGER_FRAGMENT_TAG) != null) { contributionsFragment.getChildFragmentManager().popBackStack(); showTabs(); if (defaultKvStore.getBoolean("displayNearbyCardView", true)) { if (contributionsFragment.nearbyNotificationCardView.cardViewVisibilityState == NearbyNotificationCardView.CardViewVisibilityState.READY) { contributionsFragment.nearbyNotificationCardView.setVisibility(View.VISIBLE); } } else { contributionsFragment.nearbyNotificationCardView.setVisibility(View.GONE); } } else { finish(); } } else if (getSupportFragmentManager().findFragmentByTag(nearbyFragmentTag) != null && !isContributionsFragmentVisible) { NearbyParentFragment nearbyFragment = (NearbyParentFragment) contributionsActivityPagerAdapter.getItem(1); nearbyFragment.nearbyParentFragmentPresenter.backButtonClicked(); } else { super.onBackPressed(); } }

Target:
public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); String contributionsFragmentTag = ((ContributionsActivityPagerAdapter) viewPager.getAdapter()).makeFragmentName(R.id.pager, 0); String nearbyFragmentTag = ((ContributionsActivityPagerAdapter) viewPager.getAdapter()).makeFragmentName(R.id.pager, 1); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else if (getSupportFragmentManager().findFragmentByTag(contributionsFragmentTag) != null && isContributionsFragmentVisible) { ContributionsFragment contributionsFragment = (ContributionsFragment) getSupportFragmentManager().findFragmentByTag(contributionsFragmentTag); if (contributionsFragment.getChildFragmentManager().findFragmentByTag(ContributionsFragment.MEDIA_DETAIL_PAGER_FRAGMENT_TAG) != null) { contributionsFragment.getChildFragmentManager().popBackStack(); showTabs(); if (defaultKvStore.getBoolean("displayNearbyCardView", true)) { if (contributionsFragment.nearbyNotificationCardView.cardViewVisibilityState == NearbyNotificationCardView.CardViewVisibilityState.READY) { contributionsFragment.nearbyNotificationCardView.setVisibility(View.VISIBLE); } } else { contributionsFragment.nearbyNotificationCardView.setVisibility(View.GONE); } } else { finish(); } } else if (getSupportFragmentManager().findFragmentByTag(nearbyFragmentTag) != null && !isContributionsFragmentVisible) { NearbyParentFragmentPresenter.getInstance().backButtonClicked(); } else { super.onBackPressed(); } }
Source:
private Object eval(Bindings bindings, String expression) { try { return jsScriptEngine.eval(bindings, expression); } catch (javax.script.ScriptException t) { return new ScriptException(t.getCause()); } catch (Throwable t) { return new ScriptException(t); } }

Target:
private Object eval(Bindings bindings, String expression) { try { return jsScriptEngine.eval(bindings, expression); } catch (javax.script.ScriptException t) { return new ScriptException(t.getCause()); } catch (Exception t) { return new ScriptException(t); } }
Source:
public void configureChannels(OwSensorType sensorType) { temperatureParameter.set(THING_TYPE_OWSERVER, new OwserverDeviceParameter("/" + sensorType.name() + "/temperature")); humidityParameter.set(THING_TYPE_OWSERVER, new OwserverDeviceParameter("/" + sensorType.name() + "/humidity")); pressureParameter.set(THING_TYPE_OWSERVER, new OwserverDeviceParameter("/" + sensorType.name() + "/pressure")); lightParameter.set(THING_TYPE_OWSERVER, new OwserverDeviceParameter("/" + sensorType.name() + "/light")); isConfigured = true; }

Target:
public void configureChannels(OwSensorType sensorType) { String sensorTypeName = sensorType.name(); temperatureParameter.set(THING_TYPE_OWSERVER, new OwserverDeviceParameter("/" + sensorTypeName + "/temperature")); humidityParameter.set(THING_TYPE_OWSERVER, new OwserverDeviceParameter("/" + sensorTypeName + "/humidity")); pressureParameter.set(THING_TYPE_OWSERVER, new OwserverDeviceParameter("/" + sensorTypeName + "/pressure")); lightParameter.set(THING_TYPE_OWSERVER, new OwserverDeviceParameter("/" + sensorTypeName + "/light")); isConfigured = true; }
Source:
protected boolean canDoAction() { boolean result = true; AuditLog event = DbFacade.getInstance().getAuditLogDao().get(getParameters().getId()); if (event == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_NOT_FOUND); result = false; } if ((event.getOrigin() != null) && (event.getOrigin().equalsIgnoreCase(OVIRT))) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_ILLEGAL_ORIGIN); result = false; } if (!event.getseverity().equals(AuditLogSeverity.ALERT)) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_ILLRGAL_OPERATION); result = false; } if (!result) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__REMOVE); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__EXTERNAL_EVENT); } return result; }

Target:
protected boolean canDoAction() { boolean result = true; AuditLog event = DbFacade.getInstance().getAuditLogDao().get(getParameters().getId()); if (event == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_NOT_FOUND); result = false; } if (OVIRT.equalsIgnoreCase(event.getOrigin())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_ILLEGAL_ORIGIN); result = false; } if (!event.getseverity().equals(AuditLogSeverity.ALERT)) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_ILLRGAL_OPERATION); result = false; } if (!result) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__REMOVE); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__EXTERNAL_EVENT); } return result; }
Source:
protected Node[] createNodesForKey(Long artifactID) { if (skCase == null) { return new Node[0]; } try { BlackboardArtifact art = skCase.getBlackboardArtifact(artifactID); return new Node[]{new AccountArtifactNode(art)}; } catch (TskCoreException ex) { LOGGER.log(Level.WARNING, "Error creating BlackboardArtifactNode for artifact with ID " + artifactID, ex); return new Node[0]; } }

Target:
protected Node[] createNodesForKey(Long artifactID) { if (skCase == null) { return new Node[0]; } try { BlackboardArtifact art = skCase.getBlackboardArtifact(artifactID); return new Node[]{new AccountArtifactNode(art)}; } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, "Error creating BlackboardArtifactNode for artifact with ID " + artifactID, ex); return new Node[0]; } }
Source:
public void updateOwnerReferences ( String userId, String replacementUserId ) throws DotDataException { if(!UtilMethods.isSet(userId) || !UtilMethods.isSet(replacementUserId)) { return; } DotConnect dc = new DotConnect(); dc.setSQL(UPDATE_BUNDLE_OWNER_REFERENCES); dc.addParam(replacementUserId); dc.addParam(userId); dc.loadResult(); }

Target:
public void updateOwnerReferences ( String userId, String replacementUserId ) throws DotDataException { DotConnect dc = new DotConnect(); dc.setSQL(UPDATE_BUNDLE_OWNER_REFERENCES); dc.addParam(replacementUserId); dc.addParam(userId); dc.loadResult(); }
Source:
protected void checkTxCommandResponses(Map<Address, Response> responseMap, TransactionBoundaryCommand command, LocalTxInvocationContext context, Collection<Address> recipients) { boolean handledByPartitionHandling = false; boolean throwOutdatedTopologyException = false; for (Map.Entry<Address, Response> e : responseMap.entrySet()) { Address recipient = e.getKey(); Response response = e.getValue(); if (response == CacheNotFoundResponse.INSTANCE) { if (command.getTopologyId() == stateTransferManager.getCacheTopology().getTopologyId() && !rpcManager.getMembers().contains(recipient)) { if (trace) log.tracef("Ignoring response from node not targeted %s", recipient); } else { if (!handledByPartitionHandling && checkResponseInPartitionHandling(command, context, recipients)) { if (trace) log.tracef("Cache not running on node %s, or the node is missing. It will be handled by the PartitionHandlingManager", recipient); handledByPartitionHandling = true; } else { if (trace) log.tracef("Cache not running on node %s, or the node is missing", recipient); throwOutdatedTopologyException = true; } } } else if (response == UnsureResponse.INSTANCE) { if (trace) log.tracef("Node %s has a newer topology id", recipient); throwOutdatedTopologyException = true; } } if (!handledByPartitionHandling && throwOutdatedTopologyException) { throw new OutdatedTopologyException("Cache not running on some recipients."); } }

Target:
protected void checkTxCommandResponses(Map<Address, Response> responseMap, TransactionBoundaryCommand command, LocalTxInvocationContext context, Collection<Address> recipients) { OutdatedTopologyException outdatedTopologyException = null; for (Map.Entry<Address, Response> e : responseMap.entrySet()) { Address recipient = e.getKey(); Response response = e.getValue(); if (response == CacheNotFoundResponse.INSTANCE) { if (command.getTopologyId() == stateTransferManager.getCacheTopology().getTopologyId() && !rpcManager.getMembers().contains(recipient)) { if (trace) log.tracef("Ignoring response from node not targeted %s", recipient); } else { if (checkCacheNotFoundResponseInPartitionHandling(command, context, recipients)) { if (trace) log.tracef("Cache not running on node %s, or the node is missing. It will be handled by the PartitionHandlingManager", recipient); return; } else { if (trace) log.tracef("Cache not running on node %s, or the node is missing", recipient); outdatedTopologyException = new OutdatedTopologyException(format("Cache not running on node %s, or the node is missing", recipient)); } } } else if (response == UnsureResponse.INSTANCE) { if (trace) log.tracef("Node %s has a newer topology id", recipient); outdatedTopologyException = new OutdatedTopologyException(format("Node %s has a newer topology id", recipient)); } } if (outdatedTopologyException != null) { throw outdatedTopologyException; } }
Source:
protected void validate() { Preconditions.checkArgument(rateLimiter == null || tagCreditsMap.isEmpty(), "Only one of rateLimiter instance or read/write limits can be specified"); Preconditions.checkArgument(asyncCallbackPoolSize <= 20, "too many threads for async callback executor."); if (readFn != null && enableReadRateLimiter) { Preconditions.checkArgument(readCreditFn != null || tagCreditsMap.containsKey(RL_READ_TAG), "Read rate limiter is enabled, there is no read rate limiter configured."); } if (writeFn != null && enableWriteRateLimiter) { Preconditions.checkArgument(writeCreditFn != null || tagCreditsMap.containsKey(RL_WRITE_TAG), "Write rate limiter is enabled, there is no write rate limiter configured."); } }

Target:
protected void validate() { Preconditions.checkArgument(writeFn != null || readFn != null, "Must have one of TableReadFunction or TableWriteFunction"); Preconditions.checkArgument(rateLimiter == null || tagCreditsMap.isEmpty(), "Only one of rateLimiter instance or read/write limits can be specified"); Preconditions.checkArgument(asyncCallbackPoolSize <= 20, "too many threads for async callback executor."); if (readFn != null && enableReadRateLimiter) { Preconditions.checkArgument(readCreditFn != null || tagCreditsMap.containsKey(RL_READ_TAG), "Read rate limiter is enabled, there is no read rate limiter configured."); } if (writeFn != null && enableWriteRateLimiter) { Preconditions.checkArgument(writeCreditFn != null || tagCreditsMap.containsKey(RL_WRITE_TAG), "Write rate limiter is enabled, there is no write rate limiter configured."); } }
Source:
protected static void deleteTenantIDNData(int tenantId, Connection conn) throws SQLException { try { conn.setAutoCommit(false); executeDeleteQuery(conn, DELETE_CM_PURPOSE_CATEGORY, tenantId); executeDeleteQuery(conn, DELETE_IDN_CLAIM, tenantId); executeDeleteQuery(conn, DELETE_IDN_CLAIM_DIALECT, tenantId); executeDeleteQuery(conn, DELETE_IDN_CLAIM_MAPPED_ATTRIBUTE, tenantId); executeDeleteQuery(conn, DELETE_IDN_CLAIM_MAPPING, tenantId); executeDeleteQuery(conn, DELETE_IDN_CLAIM_PROPERTY, tenantId); executeDeleteQuery(conn, DELETE_IDN_OIDC_SCOPE, tenantId); executeDeleteQuery(conn, DELETE_IDP, tenantId); executeDeleteQuery(conn, DELETE_IDP_AUTHENTICATOR, tenantId); executeDeleteQuery(conn, DELETE_IDP_AUTHENTICATOR_PROPERTY, tenantId); executeDeleteQuery(conn, DELETE_IDP_METADATA, tenantId); executeDeleteQuery(conn, DELETE_IDP_PROVISIONING_CONFIG, tenantId); executeDeleteQuery(conn, DELETE_IDP_PROV_CONFIG_PROPERTY, tenantId); conn.commit(); } catch (Exception e) { conn.rollback(); String errorMsg = "An error occurred while deleting identity data for tenant: " + tenantId; log.error(errorMsg, e); throw new SQLException(errorMsg, e); } finally { conn.close(); } }

Target:
public static void deleteTenantIDNData(int tenantId, Connection conn) throws SQLException { try { conn.setAutoCommit(false); executeDeleteQuery(conn, DELETE_CM_PURPOSE_CATEGORY, tenantId); executeDeleteQuery(conn, DELETE_IDN_CLAIM, tenantId); executeDeleteQuery(conn, DELETE_IDN_CLAIM_DIALECT, tenantId); executeDeleteQuery(conn, DELETE_IDN_CLAIM_MAPPED_ATTRIBUTE, tenantId); executeDeleteQuery(conn, DELETE_IDN_CLAIM_MAPPING, tenantId); executeDeleteQuery(conn, DELETE_IDN_CLAIM_PROPERTY, tenantId); executeDeleteQuery(conn, DELETE_IDN_OIDC_SCOPE, tenantId); executeDeleteQuery(conn, DELETE_IDP, tenantId); executeDeleteQuery(conn, DELETE_IDP_AUTHENTICATOR, tenantId); executeDeleteQuery(conn, DELETE_IDP_AUTHENTICATOR_PROPERTY, tenantId); executeDeleteQuery(conn, DELETE_IDP_METADATA, tenantId); executeDeleteQuery(conn, DELETE_IDP_PROVISIONING_CONFIG, tenantId); executeDeleteQuery(conn, DELETE_IDP_PROV_CONFIG_PROPERTY, tenantId); conn.commit(); if (log.isDebugEnabled()) { log.debug("IDN table entries deleted for tenant :" + tenantId); } } catch (Exception e) { conn.rollback(); String errorMsg = "An error occurred while deleting identity data for tenant: " + tenantId; throw new SQLException(errorMsg, e); } finally { conn.close(); } }
Source:
private boolean isMoveFromRoot(Diff target) { Iterator<? extends Diff> requiredByTarget; Iterator<? extends Diff> requiresTarget; if (target instanceof ResourceAttachmentChange) { requiredByTarget = Iterables.filter(target.getRequires(), ReferenceChange.class).iterator(); requiresTarget = Iterables.filter(target.getRequiredBy(), ReferenceChange.class).iterator(); } else { requiredByTarget = Iterables.filter(target.getRequires(), ResourceAttachmentChange.class) .iterator(); requiresTarget = Iterables.filter(target.getRequiredBy(), ResourceAttachmentChange.class) .iterator(); } while (requiredByTarget.hasNext()) { Diff requiredReference = requiredByTarget.next(); Iterator<? extends Diff> requiredByReference; if (target instanceof ResourceAttachmentChange) { requiredByReference = Iterables.filter(requiredReference.getRequires(), ResourceAttachmentChange.class).iterator(); } else { requiredByReference = Iterables .filter(requiredReference.getRequires(), ReferenceChange.class).iterator(); } while (requiredByReference.hasNext()) { Diff requiredAttachment = requiredByReference.next(); if (requiredAttachment.equals(target) && Iterators.contains(requiresTarget, requiredReference)) { return true; } } } return false; }

Target:
private boolean isMoveFromRoot(Diff target) { Iterable<? extends Diff> requiredByTarget; Iterable<? extends Diff> requiresTarget; if (target instanceof ResourceAttachmentChange) { requiredByTarget = Iterables.filter(target.getRequires(), ReferenceChange.class); requiresTarget = Iterables.filter(target.getRequiredBy(), ReferenceChange.class); } else { requiredByTarget = Iterables.filter(target.getRequires(), ResourceAttachmentChange.class); requiresTarget = Iterables.filter(target.getRequiredBy(), ResourceAttachmentChange.class); } for (Diff requiredReference : requiredByTarget) { Iterable<? extends Diff> requiredByReference; if (target instanceof ResourceAttachmentChange) { requiredByReference = Iterables.filter(requiredReference.getRequires(), ResourceAttachmentChange.class); } else { requiredByReference = Iterables.filter(requiredReference.getRequires(), ReferenceChange.class); } for (Diff requiredAttachment : requiredByReference) { if (requiredAttachment.equals(target) && Iterables.contains(requiresTarget, requiredReference)) { return true; } } } return false; }
Source:
public void handle(Patient patient, User voidingUser, Date voidedDate, String voidReason) { EncounterService es = Context.getEncounterService(); List<Encounter> encounters = es.getEncountersByPatient(patient); if (CollectionUtils.isNotEmpty(encounters)) { for (Encounter encounter : encounters) { if (!encounter.isVoided()) { encounter.setDateVoided(patient.getDateVoided()); es.voidEncounter(encounter, voidReason); } } } if (patient.getVoided()) { CohortService cs = Context.getCohortService(); cs.patientVoided(patient); } }

Target:
public void handle(Patient patient, User voidingUser, Date voidedDate, String voidReason) { EncounterService es = Context.getEncounterService(); List<Encounter> encounters = es.getEncountersByPatient(patient); if (CollectionUtils.isNotEmpty(encounters)) { for (Encounter encounter : encounters) { if (!encounter.isVoided()) { encounter.setDateVoided(patient.getDateVoided()); es.voidEncounter(encounter, voidReason); } } } CohortService cs = Context.getCohortService(); cs.patientVoided(patient); }
Source:
public int getThreadPoolSize() { Optional<String> autoscalingContainerThreadPoolSize = Optional.ofNullable(get( JOB_AUTOSIZING_CONTAINER_THREAD_POOL_SIZE)); if (getAutosizingEnabled() && autoscalingContainerThreadPoolSize.isPresent()) { return Integer.parseInt(autoscalingContainerThreadPoolSize.get()); } else { return getInt(JOB_CONTAINER_THREAD_POOL_SIZE, 0); } }

Target:
public int getThreadPoolSize() { Optional<String> autosizingContainerThreadPoolSize = Optional.ofNullable(get( JOB_AUTOSIZING_CONTAINER_THREAD_POOL_SIZE)); if (getAutosizingEnabled() && autosizingContainerThreadPoolSize.isPresent()) { return Integer.parseInt(autosizingContainerThreadPoolSize.get()); } else { return getInt(JOB_CONTAINER_THREAD_POOL_SIZE, 0); } }
Source:
private boolean isRunningInVR() { final Context context = InstrumentationRegistry.getTargetContext(); if ((context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_TYPE_MASK) == Configuration.UI_MODE_TYPE_VR_HEADSET) { return true; } return false; }

Target:
private boolean isRunningInVR() { final Context context = InstrumentationRegistry.getTargetContext(); return (context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_TYPE_MASK) == Configuration.UI_MODE_TYPE_VR_HEADSET; }
Source:
private void updateBranchCoverageMaybe() { stepNum += 1; if (stepNum % branchCoverageInterval == 0) { methodSelections.clear(); CoverageTracker.instance.collect(); } }

Target:
private void updateBranchCoverageMaybe() { boolean shouldUpdateBranchCoverage; switch (GenInputsAbstract.bloodhound_update_mode) { case TIME: long currentTime = System.currentTimeMillis(); shouldUpdateBranchCoverage = currentTime - lastUpdateTime >= t; if (shouldUpdateBranchCoverage) { lastUpdateTime = currentTime; } break; case INVOCATIONS: shouldUpdateBranchCoverage = totalSuccessfulInvocations % branchCoverageInterval == 0; if (shouldUpdateBranchCoverage) { totalSuccessfulInvocations = 1; } break; default: throw new BugInRandoopException( "Unhandled value for bloodhound_update_mode: " + GenInputsAbstract.bloodhound_update_mode); } if (shouldUpdateBranchCoverage) { if (GenInputsAbstract.bloodhound_logging) { System.out.println("Updating branch coverage information."); } methodSelectionCounts.clear(); coverageTracker.updateBranchCoverageMap(); updateWeightsForAllOperations(); logMethodWeights(); } }
Source:
public void shouldReportViolationWithDetails() throws IOException { new ConfigurationSetup().setUp(ImmutableMap.of(GeneralOption.VOLATIONS_WITH_DETAILS.getKey(), "true")); renderer.getReviewResult().getViolations().clear(); Rule rule = createRule(ruleDescription, externalInfoUrl, priority); Report report = createReportWithVolation(createRuleViolation(rule, violationDescription)); renderer.renderFileReport(report); Violation violation = renderer.getReviewResult().getViolations().get(0); assertThat(violation.getMessage()).contains(violationDescription); assertThat(violation.getMessage()).contains(ruleDescription); assertThat(violation.getMessage()).contains(externalInfoUrl); assertThat(violation.getSeverity()).isEqualTo(renderer.convert(priority)); }

Target:
public void shouldReportViolationWithDetails() throws IOException { new ConfigurationSetup().setUp(ImmutableMap.of(GeneralOption.VOLATIONS_WITH_DETAILS.getKey(), "true")); renderer.getReviewResult().getViolations().clear(); Rule rule = createRule(ruleDescription, externalInfoUrl, RulePriority.HIGH); Report report = createReportWithVolation(createRuleViolation(rule, violationDescription)); renderer.renderFileReport(report); Violation violation = renderer.getReviewResult().getViolations().get(0); assertThat(violation.getMessage()).startsWith(violationDescription); assertThat(violation.getMessage()).contains(ruleDescription); assertThat(violation.getMessage()).contains(externalInfoUrl); assertThat(violation.getSeverity()).isEqualTo(Severity.ERROR); }
Source:
public void updateFromLocalAssignment( LocalVariableNode lhs, Node rhs, ClassTree classTree, MethodTree methodTree) { if (!isElementFromSourceCode(lhs)) { return; } String className = getEnclosingClassName(lhs); String jaifPath = storage.getJaifPath(className); AClass clazz = storage.getAClass( className, jaifPath, (ClassSymbol) TreeUtils.elementFromDeclaration(classTree)); ExecutableElement methodElt = TreeUtils.elementFromDeclaration(methodTree); AMethod method = clazz.methods.getVivify(JVMNames.getJVMMethodSignature(methodElt)); method.setFieldsFromMethodElement(methodElt); List<? extends VariableTree> params = methodTree.getParameters(); for (int i = 0; i < params.size(); i++) { VariableTree vt = params.get(i); if (vt.getName().contentEquals(lhs.getName())) { Tree rhsTree = rhs.getTree(); if (rhsTree == null) { continue; } AnnotatedTypeMirror paramATM = atypeFactory.getAnnotatedType(vt); AnnotatedTypeMirror argATM = atypeFactory.getAnnotatedType(rhsTree); VariableElement ve = TreeUtils.elementFromDeclaration(vt); AField param = method.vivifyAndAddTypeMirrorToParameter( i, argATM.getUnderlyingType(), ve.getSimpleName()); updateAnnotationSetInScene( param.type, TypeUseLocation.PARAMETER, argATM, paramATM, atypeFactory, jaifPath); break; } } }

Target:
public void updateFromLocalAssignment( LocalVariableNode lhs, Node rhs, ClassTree classTree, MethodTree methodTree) { if (!isElementFromSourceCode(lhs)) { return; } String className = getEnclosingClassName(lhs); String jaifPath = storage.getJaifPath(className); AClass clazz = storage.getAClass( className, jaifPath, (ClassSymbol) TreeUtils.elementFromDeclaration(classTree)); ExecutableElement methodElt = TreeUtils.elementFromDeclaration(methodTree); AMethod method = clazz.methods.getVivify(JVMNames.getJVMMethodSignature(methodElt)); method.setFieldsFromMethodElement(methodElt); List<? extends VariableTree> params = methodTree.getParameters(); for (int i = 0; i < params.size(); i++) { VariableTree vt = params.get(i); if (vt.getName().contentEquals(lhs.getName())) { Tree rhsTree = rhs.getTree(); if (rhsTree == null) { continue; } AnnotatedTypeMirror paramATM = atypeFactory.getAnnotatedType(vt); AnnotatedTypeMirror argATM = atypeFactory.getAnnotatedType(rhsTree); VariableElement ve = TreeUtils.elementFromDeclaration(vt); AField param = method.vivifyAndAddTypeMirrorToParameter( i, argATM.getUnderlyingType(), ve.getSimpleName()); updateAnnotationSetInScene( param.type, TypeUseLocation.PARAMETER, argATM, paramATM, jaifPath); break; } } }
Source:
public SubscriptionCursorWithoutToken getOffset(final EventTypePartition key) { try { final String offset = new String(getCurator().getData().forPath(getOffsetPath(key)), UTF_8); return new SubscriptionCursorWithoutToken(key.getEventType(), key.getPartition(), offset); } catch (final Exception e) { throw new NakadiRuntimeException(e); } }

Target:
public SubscriptionCursorWithoutToken getOffset(final EventTypePartition key) throws NakadiRuntimeException { try { final String offset = new String(getCurator().getData().forPath(getOffsetPath(key)), UTF_8); return new SubscriptionCursorWithoutToken(key.getEventType(), key.getPartition(), offset); } catch (final Exception e) { throw new NakadiRuntimeException(e); } }
Source:
private void init() { log.info("Start initializing {}", getClass().getSimpleName()); isoDomainRefreshRate = Config.<Integer> getValue(ConfigValues.AutoRepoDomainRefreshTime) * MIN_TO_MILLISECONDS; schedulerUtil.scheduleAFixedDelayJob(this, "fetchIsoDomains", new Class[] {}, new Object[] {}, 300000, isoDomainRefreshRate, TimeUnit.MILLISECONDS); invalidateCachePeriod = Config.<Integer> getValue(ConfigValues.RepoDomainInvalidateCacheTimeInMinutes) * MIN_TO_MILLISECONDS; domainsLastRefreshedTime = new ConcurrentHashMap<>(); log.info("Finished initializing {}", getClass().getSimpleName()); }

Target:
private void init() { invalidateCachePeriod = Config.<Integer> getValue(ConfigValues.RepoDomainInvalidateCacheTimeInMinutes) * 60 * 1000; domainsLastRefreshedTime = new ConcurrentHashMap<>(); }
Source:
public void invokesCallbackOnClose() { Runnable callback = mock(Runnable.class); snapshotTransactionManager.registerClosingCallback(callback); snapshotTransactionManager.close(); verify(callback, times(1)).run(); }

Target:
public void invokesCallbackOnClose() { Runnable callback = mock(Runnable.class); snapshotTransactionManager.registerClosingCallback(callback); verify(callback, never()).run(); snapshotTransactionManager.close(); verify(callback).run(); }
Source:
StructBatchStreamReader(Type type, StreamDescriptor streamDescriptor, DateTimeZone hiveStorageTimeZone) throws OrcCorruptionException { requireNonNull(type, "type is null"); verifyStreamType(streamDescriptor, type, RowType.class::isInstance); this.type = (RowType) type; this.streamDescriptor = requireNonNull(streamDescriptor, "stream is null"); Map<String, StreamDescriptor> nestedStreams = streamDescriptor.getNestedStreams().stream() .collect(toImmutableMap(stream -> stream.getFieldName().toLowerCase(Locale.ENGLISH), stream -> stream)); ImmutableList.Builder<String> fieldNames = ImmutableList.builder(); ImmutableMap.Builder<String, BatchStreamReader> structFields = ImmutableMap.builder(); for (Field field : this.type.getFields()) { String fieldName = field.getName() .orElseThrow(() -> new IllegalArgumentException("ROW type does not have field names declared: " + type)) .toLowerCase(Locale.ENGLISH); fieldNames.add(fieldName); StreamDescriptor fieldStream = nestedStreams.get(fieldName); if (fieldStream != null) { structFields.put(fieldName, createStreamReader(field.getType(), fieldStream, hiveStorageTimeZone)); } } this.fieldNames = fieldNames.build(); this.structFields = structFields.build(); }

Target:
StructBatchStreamReader(Type type, StreamDescriptor streamDescriptor, DateTimeZone hiveStorageTimeZone) throws OrcCorruptionException { requireNonNull(type, "type is null"); verifyStreamType(streamDescriptor, type, RowType.class::isInstance); this.type = (RowType) type; this.streamDescriptor = requireNonNull(streamDescriptor, "stream is null"); Map<String, StreamDescriptor> nestedStreams = Maps.uniqueIndex( streamDescriptor.getNestedStreams(), stream -> stream.getFieldName().toLowerCase(Locale.ENGLISH)); ImmutableList.Builder<String> fieldNames = ImmutableList.builder(); ImmutableMap.Builder<String, BatchStreamReader> structFields = ImmutableMap.builder(); for (Field field : this.type.getFields()) { String fieldName = field.getName() .orElseThrow(() -> new IllegalArgumentException("ROW type does not have field names declared: " + type)) .toLowerCase(Locale.ENGLISH); fieldNames.add(fieldName); StreamDescriptor fieldStream = nestedStreams.get(fieldName); if (fieldStream != null) { structFields.put(fieldName, createStreamReader(field.getType(), fieldStream, hiveStorageTimeZone)); } } this.fieldNames = fieldNames.build(); this.structFields = structFields.build(); }
Source:
public IndexBuilder fillIndexBuilder(final Path path) throws Exception { try (final InputStream inputStream = ioService.newInputStream(path, StandardOpenOption.READ)) { DecisionTableConfiguration configuration = KnowledgeBuilderFactory.newDecisionTableConfiguration(); configuration.setInputType( DecisionTableInputType.XLS ); final String drl = DecisionTableFactory.loadFromInputStream(inputStream, configuration); return fillDrlIndexBuilder(path, drl); } }

Target:
public IndexBuilder fillIndexBuilder(final Path path) throws Exception { try (final InputStream inputStream = ioService.newInputStream(path, StandardOpenOption.READ)) { DecisionTableConfiguration configuration = KnowledgeBuilderFactory.newDecisionTableConfiguration(); configuration.setInputType( DecisionTableInputType.XLSX ); final String drl = DecisionTableFactory.loadFromInputStream(inputStream, configuration); return fillDrlIndexBuilder(path, drl); } }
Source:
public void addSearchCountsQueries(final List<String> urls) { for (String urlStr : urls) { try { URL url = new URL(urlStr); Map<String, List<String>> params = Util.getQueryParams(url); List<String> projects = params.get("project"); for (String field : QueryBuilder.searchFields) { List<String> fieldQueryText = params.get(field); if (fieldQueryText == null || fieldQueryText.isEmpty()) { continue; } if (fieldQueryText.size() > 2) { logger.log(Level.WARNING, "Bad format, ignoring"); continue; } String value = fieldQueryText.get(0); Query q = null; try { q = getQuery(field, value); } catch (ParseException e) { logger.log(Level.FINE, "Bad request", e); } if (q != null) { suggester.onSearch(projects, q); } } } catch (MalformedURLException e) { logger.log(Level.WARNING, "Could not add search counts for " + urlStr, e); } } }

Target:
public void addSearchCountsQueries(final List<String> urls) { for (String urlStr : urls) { try { URL url = new URL(urlStr); Map<String, List<String>> params = Util.getQueryParams(url); List<String> projects = params.get("project"); for (String field : QueryBuilder.searchFields) { List<String> fieldQueryText = params.get(field); if (fieldQueryText == null || fieldQueryText.isEmpty()) { continue; } if (fieldQueryText.size() > 2) { logger.log(Level.WARNING, "Bad format, ignoring {0}", urlStr); continue; } String value = fieldQueryText.get(0); Query q = null; try { q = getQuery(field, value); } catch (ParseException e) { logger.log(Level.FINE, "Bad request", e); } if (q != null) { suggester.onSearch(projects, q); } } } catch (MalformedURLException e) { logger.log(Level.WARNING, "Could not add search counts for " + urlStr, e); } } }
Source:
public void openPath() throws IOException { final Path path = localBam.toPath(); final SamReader reader = SamReaderFactory.makeDefault().open(path); LOG.info(String.format("Reading from %s ...", path)); final List<SAMRecord> slurped = Iterables.slurp(reader); final SAMFileHeader fileHeader = reader.getFileHeader(); reader.hasIndex(); reader.indexing().hasBrowseableIndex(); reader.close(); observedHeaders.add(fileHeader); observedRecordOrdering.add(slurped); Assert.assertEquals(observedHeaders.size(), 1, "read different headers than other testcases"); Assert.assertEquals(observedRecordOrdering.size(), 1, "read different records than other testcases"); }

Target:
public void openPath() throws IOException { final Path path = localBam.toPath(); final List<SAMRecord> records; final SAMFileHeader fileHeader; try (final SamReader reader = SamReaderFactory.makeDefault().open(path)) { LOG.info(String.format("Reading from %s ...", path)); records = Iterables.slurp(reader); fileHeader = reader.getFileHeader(); reader.close(); } try (final SamReader fileReader = SamReaderFactory.makeDefault().open(localBam)) { final List<SAMRecord> expectedRecords = Iterables.slurp(fileReader); final SAMFileHeader expectedFileHeader = fileReader.getFileHeader(); Assert.assertEquals(records, expectedRecords); Assert.assertEquals(fileHeader, expectedFileHeader); } }
Source:
public Map<String, Object> getMovingAverages(final String id) { log.debug("GetMovingAverages task[%s]", id); try { final FullResponseHolder response = submitRequest( id, HttpMethod.GET, "rowStats", null, true ); return response.getContent() == null || response.getContent().isEmpty() ? null : jsonMapper.readValue(response.getContent(), new TypeReference<Map<String, Object>>() { }); } catch (NoTaskLocationException e) { return null; } catch (IOException e) { throw Throwables.propagate(e); } }

Target:
public Map<String, Object> getMovingAverages(final String id) { log.debug("GetMovingAverages task[%s]", id); try { final FullResponseHolder response = submitRequest( id, HttpMethod.GET, "rowStats", null, true ); return response.getContent() == null || response.getContent().isEmpty() ? Collections.emptyMap() : jsonMapper.readValue(response.getContent(), JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT); } catch (NoTaskLocationException e) { return Collections.emptyMap(); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
public TransportConfiguration[] getTransportConfigurations(final List<String> connectorNames) { TransportConfiguration[] tcConfigs = (TransportConfiguration[]) Array.newInstance(TransportConfiguration.class, connectorNames.size()); int count = 0; for (String connectorName : connectorNames) { TransportConfiguration connector = getConnectorConfigurations().get(connectorName); if (connector == null) { ActiveMQServerLogger.LOGGER.connectionConfigurationIsNull(); return null; } tcConfigs[count++] = connector; } return tcConfigs; }

Target:
public TransportConfiguration[] getTransportConfigurations(final List<String> connectorNames) { TransportConfiguration[] tcConfigs = (TransportConfiguration[]) Array.newInstance(TransportConfiguration.class, connectorNames.size()); int count = 0; for (String connectorName : connectorNames) { TransportConfiguration connector = getConnectorConfigurations().get(connectorName); if (connector == null) { ActiveMQServerLogger.LOGGER.connectionConfigurationIsNull(connectorName == null ? "null" : connectorName); return null; } tcConfigs[count++] = connector; } return tcConfigs; }
Source:
private static String getLogEntriesAsString(String startTimestamp) { String filter = "resource.type=\"cloud_function\""; filter += " AND severity=INFO"; filter += " AND resource.labels.function_name=" + FUNCTION_DEPLOYED_NAME; filter += String.format(" AND timestamp>=\"%s\"", startTimestamp); Page<LogEntry> logEntries = loggingClient.listLogEntries( Logging.EntryListOption.filter(filter), Logging.EntryListOption.sortOrder(Logging.SortingField.TIMESTAMP, Logging.SortingOrder.DESCENDING) ); String logsConcat = StreamSupport.stream(logEntries.getValues().spliterator(), false) .map((x) -> x.toString()) .collect(Collectors.joining("%n")); return logsConcat; }

Target:
private static String getLogEntriesAsString(String startTimestamp) { String filter = "resource.type=\"cloud_function\"" + " AND severity=INFO" + " AND resource.labels.function_name=" + FUNCTION_DEPLOYED_NAME + String.format(" AND timestamp>=\"%s\"", startTimestamp); Page<LogEntry> logEntries = loggingClient.listLogEntries( Logging.EntryListOption.filter(filter), Logging.EntryListOption.sortOrder( Logging.SortingField.TIMESTAMP, Logging.SortingOrder.DESCENDING) ); String logsConcat = StreamSupport.stream(logEntries.getValues().spliterator(), false) .map((x) -> x.toString()) .collect(Collectors.joining("%n")); return logsConcat; }
Source:
public void testNoViableAltException() throws IOException { try { DetailNodeTreeStringPrinter.printFileAst(new File(getPath( "InputNoViableAltException.javadoc"))); } catch (IllegalArgumentException ex) { Assert.assertTrue(ex.getMessage() .contains("ERROR:0] Javadoc comment at column 9 has parse error. " + "Details: no viable alternative at input ' <<' " + "while parsing JAVADOC_TAG")); } }

Target:
public void testNoViableAltException() throws Exception { try { DetailNodeTreeStringPrinter.printFileAst(new File(getPath( "InputNoViableAltException.javadoc"))); } catch (IllegalArgumentException ex) { final String expected = (String) GET_PARSE_ERROR_MESSAGE.invoke(null, new ParseErrorMessage(0, MSG_JAVADOC_PARSE_RULE_ERROR, 9, "no viable alternative at input ' <<'", "JAVADOC_TAG")); assertEquals("Generated and expected parse error messages don't match", expected, ex.getMessage()); } }
Source:
private long getPackedObjectSize(WindowCursor curs, AnyObjectId id) { PackList pList; do { pList = packList.get(); SEARCH: for (;;) { for (PackFile p : pList.packs) { try { long len = p.getObjectSize(curs, id); if (0 <= len) return len; } catch (PackMismatchException e) { PackList nList = scanPacks(pList); if (pList != nList) { pList = nList; continue SEARCH; } } catch (IOException e) { removePack(p); } } break SEARCH; } } while (searchPacksAgain(pList)); return -1; }

Target:
private long getPackedObjectSize(WindowCursor curs, AnyObjectId id) { PackList pList; do { SEARCH: for (;;) { pList = packList.get(); for (PackFile p : pList.packs) { try { long len = p.getObjectSize(curs, id); if (0 <= len) return len; } catch (PackMismatchException e) { if (searchPacksAgain(pList)) continue SEARCH; } catch (IOException e) { removePack(p); } } break SEARCH; } } while (searchPacksAgain(pList)); return -1; }
Source:
public Tenant getTenant(String tenantUniqueID) throws TenantMgtException { TenantManager tenantManager = TenantMgtServiceComponent.getTenantManager(); Tenant tenant; try { tenant = tenantManager.getTenant(tenantUniqueID); } catch (org.wso2.carbon.user.api.UserStoreException e) { throw new TenantManagementServerException("Error while getting the tenant.", e); } String userId = getClaimValue(tenant.getAdminName(), UserCoreClaimConstants.USER_ID_CLAIM_URI, tenant.getId()); tenant.setAdminUserId(userId); return tenant; }

Target:
public Tenant getTenant(String tenantUniqueID) throws TenantMgtException { TenantManager tenantManager = TenantMgtServiceComponent.getTenantManager(); Tenant tenant; try { tenant = tenantManager.getTenant(tenantUniqueID); } catch (org.wso2.carbon.user.api.UserStoreException e) { throw new TenantManagementServerException("Error while getting the tenant.", e); } return tenant; }
Source:
private Result executeCmd(String cmd) throws IOException, InterruptedException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); TeeOutputStream stdout = new TeeOutputStream(listener.getLogger(), baos); PrintStream stderr = listener.getLogger(); KeyMaterial key = null; try { key = registry.materialize(build); EnvVars env = new EnvVars(); env.putAll(build.getEnvironment(listener)); env.putAll(key.env()); boolean result = launcher.launch() .envs(env) .pwd(build.getWorkspace()) .stdout(stdout) .stderr(stderr) .cmdAsSingleString(cmd) .start().join() == 0; return new Result(result, baos.toString("UTF8")); } finally { if (key != null) { key.close(); } } }

Target:
private Result executeCmd(String cmd) throws IOException, InterruptedException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); TeeOutputStream stdout = new TeeOutputStream(listener.getLogger(), baos); PrintStream stderr = listener.getLogger(); boolean result = launcher.launch() .envs(build.getEnvironment(listener)) .pwd(build.getWorkspace()) .stdout(stdout) .stderr(stderr) .cmdAsSingleString(cmd) .start().join() == 0; String stdoutStr = null; try { Computer computer = Computer.currentComputer(); if (computer != null) { Charset charset = computer.getDefaultCharset(); if (charset != null) { baos.flush(); stdoutStr = baos.toString(charset.name()); } } } catch (UnsupportedEncodingException e) { logger.log(Level.FINE, "Unable to get stdout from launched command: {}", e); } finally { IOUtils.closeQuietly(baos); } return new Result(result, stdoutStr); }
Source:
private URI storePackage(String storageId, String repositoryId, InputStream is) throws Exception { String path; NuspecFile nuspecFile; byte[] byteArray = IOUtils.toByteArray(is); InputStream inputForNuspec = new ByteArrayInputStream(byteArray); InputStream inputForNupkg = new ByteArrayInputStream(byteArray); nuspecFile = extractNuspecFile(inputForNuspec); if (nuspecFile == null) { return null; } path = String.format("%s/%s/%s.%s.nupkg", nuspecFile.getId(), nuspecFile.getVersion(), nuspecFile.getId(), nuspecFile.getVersion()); nugetArtifactManagementService.validateAndStore(storageId, repositoryId, path, inputForNupkg); Path nuspecFileTmp = Files.createTempFile(nuspecFile.getId(), "nuspec"); try (OutputStream outputStream = Files.newOutputStream(nuspecFileTmp)) { nuspecFile.saveTo(outputStream); } path = String.format("%s/%s/%s.nuspec", nuspecFile.getId(), nuspecFile.getVersion(), nuspecFile.getId()); nugetArtifactManagementService.validateAndStore(storageId, repositoryId, path, Files.newInputStream(nuspecFileTmp)); return new URI(""); }

Target:
private URI storePackage(String storageId, String repositoryId, InputStream is) throws Exception { String path; NuspecFile nuspecFile; Path packageTmp = Files.createTempFile("package", "nupkg"); Files.copy(is, packageTmp, StandardCopyOption.REPLACE_EXISTING); Path nuspecTmp = Files.createTempFile("spec", "nuspec"); Files.copy(packageTmp, nuspecTmp, StandardCopyOption.REPLACE_EXISTING); nuspecFile = extractNuspecFile(new BufferedInputStream(Files.newInputStream(packageTmp))); if (nuspecFile == null) { return null; } path = String.format("%s/%s/%s.%s.nupkg", nuspecFile.getId(), nuspecFile.getVersion(), nuspecFile.getId(), nuspecFile.getVersion()); try (InputStream tmpIn = new BufferedInputStream(Files.newInputStream(packageTmp))) { nugetArtifactManagementService.validateAndStore(storageId, repositoryId, path, tmpIn); } try (OutputStream outputStream = Files.newOutputStream(nuspecTmp)) { nuspecFile.saveTo(outputStream); } path = String.format("%s/%s/%s.nuspec", nuspecFile.getId(), nuspecFile.getVersion(), nuspecFile.getId()); nugetArtifactManagementService.validateAndStore(storageId, repositoryId, path, Files.newInputStream(nuspecTmp)); return new URI(""); }
Source:
private void announceTask(Worker theWorker, TaskWrapper taskWrapper) { synchronized (statusLock) { final Task task = taskWrapper.getTask(); final TaskContext taskContext = taskWrapper.getTaskContext(); try { log.info("Coordinator asking Worker[%s] to add task[%s]", theWorker.getHost(), task.getId()); tasks.put(task.getId(), taskWrapper); cf.create() .creatingParentsIfNeeded() .withMode(CreateMode.EPHEMERAL) .forPath( JOINER.join( config.getTaskPath(), theWorker.getHost(), task.getId() ), jsonMapper.writeValueAsBytes(new TaskHolder(task, taskContext)) ); while (findWorkerRunningTask(taskWrapper) == null) { statusLock.wait(); } } catch (Exception e) { log.error(e, "Exception creating task[%s] for worker node[%s]", task.getId(), theWorker.getHost()); throw Throwables.propagate(e); } } }

Target:
private void announceTask(Worker theWorker, TaskWrapper taskWrapper) { synchronized (statusLock) { final Task task = taskWrapper.getTask(); final TaskContext taskContext = taskWrapper.getTaskContext(); try { log.info("Coordinator asking Worker[%s] to add task[%s]", theWorker.getHost(), task.getId()); tasks.put(task.getId(), taskWrapper); cf.create() .withMode(CreateMode.EPHEMERAL) .forPath( JOINER.join( config.getTaskPath(), theWorker.getHost(), task.getId() ), jsonMapper.writeValueAsBytes(new TaskHolder(task, taskContext)) ); while (findWorkerRunningTask(taskWrapper) == null) { statusLock.wait(config.getTaskAssignmentTimeoutDuration().getMillis()); } } catch (Exception e) { log.error(e, "Exception creating task[%s] for worker node[%s]", task.getId(), theWorker.getHost()); throw Throwables.propagate(e); } } }
Source:
private void loadWebEngineFileURL(String localFilePath) { if(localFilePath != null && webEngine != null) { PlatformImpl.runLater(() -> { webEngine.load("file://" + localFilePath); }); } }

Target:
private void loadWebEngineFileURL(String localFilePath) { if(localFilePath != null && webEngine != null) { Platform.runLater(() -> { webEngine.load("file://" + localFilePath); }); } }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { filter = getArguments().getParcelable(PARAM_FILTER); } muted_messages = new ArrayList<>(); messageIndex = new SparseArray<Message>(); messageList = new ArrayList<>(); adapter = new MessageAdapter(getActivity(), messageList); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { filter = getArguments().getParcelable(PARAM_FILTER); } mutedMessages = new ArrayList<>(); messageIndex = new SparseArray<Message>(); messageList = new ArrayList<>(); adapter = new MessageAdapter(getActivity(), messageList); }
Source:
private void handleRowEvent(Event event, long tableId) { LOG.trace("New event, current offset: {}, event: {}", currentOffset, event); currentTxEventSeqNo++; if (currentOffset instanceof GtidSourceOffset) { if (((GtidSourceOffset) currentOffset).incompleteTransactionsContain(currentTxGtid, currentTxEventSeqNo)) { LOG.info("Skipping event gtid {}, seqNo {}", currentTxGtid, currentTxEventSeqNo); return; } else { currentOffset = ((GtidSourceOffset) currentOffset) .withIncompleteTransaction(currentTxGtid, currentTxEventSeqNo) .withGtidSet(currentGtidSet); } } else { currentOffset = createOffset(event); } DatabaseAndTable tableName = tableMapping.get(tableId); Optional<? extends Table> tableOpt = schemaRepository.getTable(tableName); Table table = null; if (tableOpt.isPresent()) { table = tableOpt.get(); } else { LOG.error(Errors.MYSQL_002.getMessage(), tableName.getDatabase(), tableName.getTable()); table = new TableWithoutColumnsNames(tableName.getDatabase(), tableName.getTable()); } EnrichedEvent enrichedEvent = new EnrichedEvent(event, table, currentOffset); eventBuffer.put(enrichedEvent); }

Target:
private void handleRowEvent(Event event, long tableId) { LOG.trace("New event, current offset: {}, event: {}", currentOffset, event); currentTxEventSeqNo++; if (currentOffset instanceof GtidSourceOffset) { if (((GtidSourceOffset) currentOffset).incompleteTransactionsContain(currentTxGtid, currentTxEventSeqNo)) { LOG.info("Skipping event gtid {}, seqNo {}", currentTxGtid, currentTxEventSeqNo); return; } else { currentOffset = ((GtidSourceOffset) currentOffset) .withIncompleteTransaction(currentTxGtid, currentTxEventSeqNo) .withGtidSet(currentGtidSet); } } else { currentOffset = createOffset(event); } DatabaseAndTable tableName = tableMapping.get(tableId); Optional<? extends Table> tableOpt = schemaRepository.getTable(tableName); Table table = null; if (tableOpt.isPresent()) { table = tableOpt.get(); } else { LOG.error(Errors.MYSQL_002.getMessage(), tableName.getDatabase(), tableName.getTable()); table = new TableWithoutColumnsNames(tableName.getDatabase(), tableName.getTable()); } EnrichedEvent enrichedEvent = new EnrichedEvent(event, table, currentOffset); if (!eventBuffer.put(enrichedEvent)) { LOG.error("Error adding event to buffer. Closing event buffer, disconnecting client."); eventBuffer.close(); try { client.disconnect(); } catch (IOException e) { LOG.error("Error disconnecting client: {}", e.getMessage(), e); } } }
Source:
public String descriptorTypeToKind(String descriptorType, Registry registry, Meter meter) { return typeToKind.computeIfAbsent(descriptorType, k -> { if (meterIsTimer(registry, meter)) { return "CUMULATIVE"; } return meterToKind(registry, meter); }); }

Target:
public String descriptorTypeToKind(String descriptorType, Registry registry, Meter meter) { return typeToKind.computeIfAbsent(descriptorType, k -> { return meterToKind(registry, meter); }); }