auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void onRemove() { ConfirmationModel model = (ConfirmationModel) getWindow(); if (model.getProgress() != null) { return; } model.startProgress(); List<ActionParametersBase> prms = getSelectedItems() .stream() .map(item -> { RemoveDiskParameters params = new RemoveDiskParameters(item.getId(), getEntity().getId()); params.setUnregisteredDisk(true); return params; }) .collect(Collectors.toList()); Frontend.getInstance().runMultipleAction(ActionType.RemoveDisk, prms, result -> { ConfirmationModel localModel = (ConfirmationModel) result.getState(); localModel.stopProgress(); cancel(); }, model); }

Target:
private void onRemove() { if (getWindow() != null) { return; } ConfirmationModel model = (ConfirmationModel) getWindow(); if (model.getProgress() != null) { return; } model.startProgress(); List<ActionParametersBase> removeDiskParameters = getSelectedItems() .stream() .map(item -> { RemoveDiskParameters params = new RemoveDiskParameters(item.getId(), getEntity().getId()); params.setUnregisteredDisk(true); return params; }) .collect(Collectors.toList()); Frontend.getInstance().runMultipleAction( ActionType.RemoveDisk, removeDiskParameters, result -> { ConfirmationModel localModel = (ConfirmationModel) result.getState(); localModel.stopProgress(); cancel(); }, model); }
Source:
private boolean isInfinispanConsolePath(String uri) { return uri.equals(rootUri) || (uri.contains(rootUri) && !uri.contains(".")); }

Target:
private boolean isInfinispanConsolePath(String uri) { return uri.startsWith(rootUri) && !uri.contains("."); }
Source:
public void testNumberOfUnplacedHeavyAtoms_IAtomContainer(){ IAtomContainer ac = AtomPlacer3DTest.makeAlphaPinene(); int count=new AtomPlacer3D().numberOfUnplacedHeavyAtoms(ac); Assert.assertEquals(10,count); }

Target:
public void testNumberOfUnplacedHeavyAtoms_IAtomContainer(){ IAtomContainer ac = makeAlphaPinene(); int count=new AtomPlacer3D().numberOfUnplacedHeavyAtoms(ac); Assert.assertEquals(10,count); }
Source:
public static String getSpanName(String attributeName) { return attributeName.substring(0, attributeName.lastIndexOf("/")); }

Target:
public static @NonNull String getSpanName(String attributeName) { return attributeName.substring(0, attributeName.lastIndexOf('/')); }
Source:
public void start() { try (DbSession dbSession = dbClient.openSession(false)) { QualityGateDto builtin = qualityGateDao.selectByName(dbSession, BUILTIN_QUALITY_GATE_NAME); if (builtin == null) { LOGGER.info("Built-in quality gate has been created", BUILTIN_QUALITY_GATE_NAME); builtin = createQualityGate(dbSession, BUILTIN_QUALITY_GATE_NAME); if (qualityGates.getDefault() == null) { qualityGates.setDefault(dbSession, builtin.getId()); } } updateQualityConditionsIfRequired(dbSession, builtin); qualityGateDao.ensureOneBuiltInQualityGate(dbSession, BUILTIN_QUALITY_GATE_NAME); dbSession.commit(); } }

Target:
public void start() { try (DbSession dbSession = dbClient.openSession(false)) { QualityGateDto builtin = qualityGateDao.selectByName(dbSession, BUILTIN_QUALITY_GATE_NAME); if (builtin == null) { LOGGER.info("Built-in quality gate has been created", BUILTIN_QUALITY_GATE_NAME); builtin = createQualityGate(dbSession, BUILTIN_QUALITY_GATE_NAME); } if (!qualityGateFinder.getDefault(dbSession).isPresent()) { LOGGER.info("Built-in quality gate has been set as default", BUILTIN_QUALITY_GATE_NAME); qualityGateUpdater.setDefault(dbSession, builtin); } if (!builtin.isBuiltIn()) { builtin.setBuiltIn(true); dbClient.qualityGateDao().update(builtin, dbSession); LOGGER.info("Quality gate has been set as built-in", BUILTIN_QUALITY_GATE_NAME); } updateQualityConditionsIfRequired(dbSession, builtin); qualityGateDao.ensureOneBuiltInQualityGate(dbSession, BUILTIN_QUALITY_GATE_NAME); dbSession.commit(); } }
Source:
public List<DecorationDescriptor> createDecorationDescriptors(IDiagramElementEditPart editPart, Session session) { Image decorationImage = getDecorationImage(editPart); if (decorationImage != null) { DecorationDescriptor decoDesc = new DecorationDescriptor(); decoDesc.setName(NAME); decoDesc.setPosition(Position.SOUTH_WEST_LITERAL); decoDesc.setDistributionDirection(DecorationDistributionDirection.HORIZONTAL); decoDesc.setDisplayPriority(DisplayPriority.HIGH_PRIORITY.getValue()); decoDesc.setDecorationAsImage(decorationImage); boolean disableLockDecoPrint = Boolean.getBoolean(DISABLE_PRINT_FOR_PERMISSION_AUTHORITY_DECORATION); if (disableLockDecoPrint) { decoDesc.setPrintable(isImagePrintable(decorationImage)); } decoDesc.setTooltipAsString(getToolTip(editPart)); return Arrays.asList(decoDesc); } return new ArrayList<>(); }

Target:
public List<DecorationDescriptor> createDecorationDescriptors(IDiagramElementEditPart editPart, Session session) { DecorationDescriptor decoDesc = new DecorationDescriptor(); addDecorationImage(editPart, decoDesc); if (decoDesc.getDecorationAsImage() != null) { decoDesc.setName(NAME); decoDesc.setPosition(Position.SOUTH_WEST_LITERAL); decoDesc.setDistributionDirection(DecorationDistributionDirection.HORIZONTAL); decoDesc.setDisplayPriority(DisplayPriority.HIGH_PRIORITY.getValue()); decoDesc.setTooltipAsString(getToolTip(editPart)); return Arrays.asList(decoDesc); } return new ArrayList<>(); }
Source:
public void createControl(Composite parent) { ILaunchConfigurationTab[] tabs = getLaunchConfigurationDialog() .getTabs(); model = ((RunImageVolumesTab) tabs[1]).getModel(); final Composite container = new Composite(parent, SWT.NONE); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).span(1, 1) .grab(true, false).applyTo(container); GridLayoutFactory.fillDefaults().numColumns(COLUMNS).margins(6, 6) .applyTo(container); createEnvironmentVariablesContainer(container); setControl(container); }

Target:
public void createControl(Composite parent) { final Composite container = new Composite(parent, SWT.NONE); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).span(1, 1) .grab(true, false).applyTo(container); GridLayoutFactory.fillDefaults().numColumns(COLUMNS).margins(6, 6) .applyTo(container); if (model == null) { setErrorMessage(LaunchMessages.getString("NoConnectionError.msg")); } else { setErrorMessage(null); createEnvironmentVariablesContainer(container); } setControl(container); }
Source:
private DirContextOperations setAmbariAdminAttr(DirContextOperations user, LdapServerProperties ldapServerProperties) { String baseDn = ldapServerProperties.getBaseDN().toLowerCase(); String groupBase = ldapServerProperties.getGroupBase().toLowerCase(); final String groupNamingAttribute = ldapServerProperties.getGroupNamingAttr(); final String adminGroupMappingMemberAttr = ldapServerProperties.getAdminGroupMappingMemberAttr(); int indexOfBaseDn = groupBase.indexOf(baseDn); groupBase = indexOfBaseDn <= 0 ? "" : groupBase.substring(0, indexOfBaseDn - 1); String memberValue = StringUtils.isNotEmpty(adminGroupMappingMemberAttr) ? user.getStringAttribute(adminGroupMappingMemberAttr) : user.getNameInNamespace(); LOG.debug("LDAP login - set '{}' as member attribute for adminGroupMappingRules", memberValue); String setAmbariAdminAttrFilter = resolveAmbariAdminAttrFilter(ldapServerProperties, memberValue); LOG.debug("LDAP login - set admin attr filter: {}", setAmbariAdminAttrFilter); AttributesMapper attributesMapper = new AttributesMapper() { @Override public Object mapFromAttributes(Attributes attrs) throws NamingException { return attrs.get(groupNamingAttribute).get(); } }; LdapTemplate ldapTemplate = new LdapTemplate((getContextSource())); ldapTemplate.setIgnorePartialResultException(true); ldapTemplate.setIgnoreNameNotFoundException(true); @SuppressWarnings("unchecked") List<String> ambariAdminGroups = ldapTemplate.search(groupBase, setAmbariAdminAttrFilter, attributesMapper); if (ambariAdminGroups.size() > 0) { user.setAttributeValue(AMBARI_ADMIN_LDAP_ATTRIBUTE_KEY, true); } return user; }

Target:
private DirContextOperations setAmbariAdminAttr(DirContextOperations user, LdapServerProperties ldapServerProperties) { String baseDn = ldapServerProperties.getBaseDN().toLowerCase(); String groupBase = ldapServerProperties.getGroupBase().toLowerCase(); final String groupNamingAttribute = ldapServerProperties.getGroupNamingAttr(); final String adminGroupMappingMemberAttr = ldapServerProperties.getAdminGroupMappingMemberAttr(); int indexOfBaseDn = groupBase.indexOf(baseDn); groupBase = indexOfBaseDn <= 0 ? "" : groupBase.substring(0, indexOfBaseDn - 1); String memberValue = StringUtils.isNotEmpty(adminGroupMappingMemberAttr) ? user.getStringAttribute(adminGroupMappingMemberAttr) : user.getNameInNamespace(); LOG.debug("LDAP login - set '{}' as member attribute for adminGroupMappingRules", memberValue); String setAmbariAdminAttrFilter = resolveAmbariAdminAttrFilter(ldapServerProperties, memberValue); LOG.debug("LDAP login - set admin attr filter: {}", setAmbariAdminAttrFilter); AttributesMapper attributesMapper = attrs -> attrs.get(groupNamingAttribute).get(); LdapTemplate ldapTemplate = new LdapTemplate((getContextSource())); ldapTemplate.setIgnorePartialResultException(true); ldapTemplate.setIgnoreNameNotFoundException(true); @SuppressWarnings("unchecked") List<String> ambariAdminGroups = ldapTemplate.search(groupBase, setAmbariAdminAttrFilter, attributesMapper); if (ambariAdminGroups.size() > 0) { user.setAttributeValue(AMBARI_ADMIN_LDAP_ATTRIBUTE_KEY, true); } return user; }
Source:
public void flush() { final boolean notifyDataAvailable; synchronized (buffers) { if (buffers.isEmpty()) { return; } notifyDataAvailable = mayNotifyDataAvailable() && buffers.peekFirst().isDataAvailable(); flushRequested = flushRequested || buffers.size() > 1 || notifyDataAvailable; dataAvailableNotified = dataAvailableNotified || notifyDataAvailable; } if (notifyDataAvailable) { notifyDataAvailable(); } }

Target:
public void flush() { final boolean notifyDataAvailable; synchronized (buffers) { if (buffers.isEmpty() || flushRequested) { return; } notifyDataAvailable = shouldNotifyDataAvailable() && buffers.peekFirst().isDataAvailable(); flushRequested = buffers.size() > 1 || notifyDataAvailable; dataAvailableNotified = dataAvailableNotified || notifyDataAvailable; } if (notifyDataAvailable) { readView.notifyDataAvailable(); } }
Source:
public ConnectionId(final String host, final int port, final String connectionId) { Objects.requireNonNull(host); if (port <= 0) { throw new IllegalArgumentException(String.format("Port must be greater than 0")); } this.host = host; this.port = port; this.connectionId = connectionId; }

Target:
public ConnectionId(final String host, final int port, final String connectionId) { Objects.requireNonNull(host); if (port <= 0) { throw new IllegalArgumentException("Port must be greater than 0"); } this.host = host; this.port = port; this.connectionId = connectionId; }
Source:
public static void printC() { calendar.set(year, month, 1); for (int i = 0; i < 7; ++i) { if (LenghtNameDay < dayNames[i].length()) { LenghtNameDay = dayNames[i].length(); } } if (weeksNeeded) { System.out.print(" "); } System.out.println(" " + DateFormatSymbols.getInstance().getMonths()[month] + ' ' + year); if (weeksNeeded) { System.out.print(" "); } for (int dayIndex : dayIndexes) { System.out.print(dayNames[dayIndex]); for (int j = 0; j < LenghtNameDay - dayNames[dayIndex].length() + 1; ++j) { System.out.print(' '); } } if (LenghtNameDay < 2) { LenghtNameDay = 2; } System.out.println(); int current_day = 1; int current_week = calendar.get(Calendar.WEEK_OF_YEAR); while (month == calendar.get(Calendar.MONTH)) { if (weeksNeeded) { if (current_week < 10) { System.out.print(" " + current_week + " "); } else { System.out.print(current_week + " "); } current_week++; } for (int indx : dayIndexes) { if (indx != calendar.get(Calendar.DAY_OF_WEEK) || month != calendar.get(Calendar.MONTH)) { for (int i = 0; i < LenghtNameDay + 1; ++i) { System.out.print(' '); } } else { for (int i = 0; i < LenghtNameDay - 2; ++i) { System.out.print(' '); } if (current_day < 10) { System.out.print(' '); } System.out.print(current_day + " "); current_day++; calendar.set(Calendar.DAY_OF_MONTH, current_day); } } System.out.println(); } }

Target:
public static void printC() { calendar.setFirstDayOfWeek(Calendar.MONDAY); calendar.set(year, month, 1); for (int i = 0; i < 7; ++i) { if (lenghtNameDay < dayNames[i].length()) { lenghtNameDay = dayNames[i].length(); } } if (lenghtNameDay < 2) { lenghtNameDay = 2; } if (weeksNeeded) { System.out.print(" "); } System.out.println(" " + DateFormatSymbols.getInstance().getMonths()[month] + ' ' + year); if (weeksNeeded) { System.out.print(" "); } for (int dayIndex : dayIndexes) { System.out.print(dayNames[dayIndex]); for (int j = 0; j < lenghtNameDay - dayNames[dayIndex].length() + 1; ++j) { System.out.print(' '); } } System.out.println(); int currentDay = 1; int currentWeek = calendar.get(Calendar.WEEK_OF_YEAR); while (month == calendar.get(Calendar.MONTH)) { if (weeksNeeded) { if (currentWeek < 10) { System.out.print(" " + currentWeek + " "); } else { System.out.print(currentWeek + " "); } currentWeek++; } for (int indx : dayIndexes) { if (indx != calendar.get(Calendar.DAY_OF_WEEK) || month != calendar.get(Calendar.MONTH)) { for (int i = 0; i < lenghtNameDay + 1; ++i) { System.out.print(' '); } } else { for (int i = 0; i < lenghtNameDay - 2; ++i) { System.out.print(' '); } if (currentDay < 10) { System.out.print(' '); } System.out.print(currentDay + " "); currentDay++; calendar.set(Calendar.DAY_OF_MONTH, currentDay); } } System.out.println(); } }
Source:
protected void runAutonomous() throws InterruptedException, AutonomousModeOverException { float startAngle = HeadingSensor.absoluteYaw.get(); setClampOpen(true); waitUntilNot(Clamp.waitingForAutoCalibration); startSetClampHeight(0.4f); collectTote(false, 5000); setClampHeight(0.0f); singleSideTurn((long) (containerTurnTime.get() * 1000), true); pickupContainer(nudge.get()); float nextAngle = HeadingSensor.absoluteYaw.get(); turnAbsolute(startAngle, -autoZoneAngle.get(), true); waitForTime(500); float curAngle = HeadingSensor.absoluteYaw.get(); Logger.info("Actual angle: " + (curAngle - startAngle) + " based on " + startAngle + "/" + nextAngle + "/" + curAngle); float now = Utils.getCurrentTimeSeconds(); Logger.info("Setting to mechanum: " + DriveCode.leftEncoder.get() + " and " + autoZoneDistance.get()); DriveCode.octocanumShifting.set(true); drive(autoZoneDistance.get(), autoZoneSpeed.get()); driveForTime((long) (autoZoneTime.get() * 1000), autoZoneSpeed.get()); Logger.info("Setting to traction: " + (Utils.getCurrentTimeSeconds() - now) + ": " + DriveCode.leftEncoder.get()); DriveCode.octocanumShifting.set(false); }

Target:
protected void runAutonomous() throws InterruptedException, AutonomousModeOverException { float startAngle = HeadingSensor.absoluteYaw.get(); setClampOpen(true); waitUntilNot(Clamp.waitingForAutoCalibration); startSetClampHeight(0.4f); collectTote(shake.get(), 5000); setClampHeight(0.0f); singleSideTurn((long) (containerTurnTime.get() * 1000), true); pickupContainer(nudge.get()); float nextAngle = HeadingSensor.absoluteYaw.get(); turnAbsolute(startAngle, -autoZoneAngle.get(), true); waitForTime(500); float curAngle = HeadingSensor.absoluteYaw.get(); Logger.info("Actual angle: " + (curAngle - startAngle) + " based on " + startAngle + "/" + nextAngle + "/" + curAngle); float now = Utils.getCurrentTimeSeconds(); Logger.info("Setting to mechanum: " + DriveCode.leftEncoder.get() + " and " + autoZoneDistance.get()); DriveCode.octocanumShifting.set(true); drive(autoZoneDistance.get(), autoZoneSpeed.get()); driveForTime((long) (autoZoneTime.get() * 1000), autoZoneSpeed.get()); Logger.info("Setting to traction: " + (Utils.getCurrentTimeSeconds() - now) + ": " + DriveCode.leftEncoder.get()); DriveCode.octocanumShifting.set(false); }
Source:
protected Boolean doInBackground(MeasurementDetails... params) { MeasurementDetails measurementDetails = params[0]; GmaApiClient apiClient = GmaApiClient.getInstance(MeasurementDetailsActivity.this); try { List<MeasurementDetails> data = new ArrayList<>(); data.add(measurementDetails); Log.i(TAG, "Saving new measurements to the database"); MeasurementsService.saveMeasurementDetailsToDatabase(MeasurementDetailsActivity.this, measurementDetails); Log.i(TAG, "Sending new measurements to the server"); return apiClient.updateMeasurementDetails(data, preferences.getString(PREF_CURRENT_ASSIGNMENT, null)); } catch(ApiException ae) { Log.e(TAG, "Error saving measurement details", ae); } catch(JSONException je) { Log.e(TAG, "Error parsing measurement details into JSON", je); } return false; }

Target:
protected Boolean doInBackground(MeasurementDetails... params) { MeasurementDetails measurementDetails = params[0]; GmaApiClient apiClient = GmaApiClient.getInstance(MeasurementDetailsActivity.this); try { List<MeasurementDetails> data = new ArrayList<>(); data.add(measurementDetails); Log.i(TAG, "Saving new measurements to the database"); MeasurementsService.saveMeasurementDetailsToDatabase(MeasurementDetailsActivity.this, measurementDetails); Log.i(TAG, "Sending new measurements to the server"); return apiClient.updateMeasurementDetails(data, currentAssignment.getId()); } catch(ApiException ae) { Log.e(TAG, "Error saving measurement details", ae); } catch(JSONException je) { Log.e(TAG, "Error parsing measurement details into JSON", je); } return false; }
Source:
public @Nullable IStatus validate(final @Nullable IProject project, final @Nullable String path) { IStatus status = super.validate(project, path); if (status instanceof CtfTraceValidationStatus) { Map<String, String> environment = Objects.requireNonNull(((CtfTraceValidationStatus) status).getEnvironment()); String domain = environment.get("tracer_name"); if (domain == null || !PERF_DOMAIN.equals(domain)) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "This trace is not a perf trace"); } return new TraceValidationStatus(CONFIDENCE, Activator.PLUGIN_ID); } return status; }

Target:
public @Nullable IStatus validate(final @Nullable IProject project, final @Nullable String path) { IStatus status = super.validate(project, path); if (status instanceof CtfTraceValidationStatus) { Map<String, String> environment = Objects.requireNonNull(((CtfTraceValidationStatus) status).getEnvironment()); String domain = environment.get("tracer_name"); if (!PERF_DOMAIN.equals(domain)) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "This trace is not a perf trace"); } return new TraceValidationStatus(CONFIDENCE, Activator.PLUGIN_ID); } return status; }
Source:
public static String readResource(String resource) throws IOException { return Resources.toString(requireNonNull(BenchmarkGeometrySerde.class.getClassLoader().getResource(resource), "resource not found: " + resource), UTF_8); }

Target:
public static String readResource(String resource) { try { return Resources.toString(getResource(resource), UTF_8); } catch (IOException e) { throw new UncheckedIOException(e); } }
Source:
public Builder toBuilder() { Builder builder = new Builder(type, name); builder.javadoc.add(javadoc); builder.annotations.addAll(annotations); builder.modifiers.addAll(modifiers); builder.initializer = initializer; return builder; }

Target:
public Builder toBuilder() { Builder builder = new Builder(type, name); builder.javadoc.add(javadoc); builder.annotations.addAll(annotations); builder.modifiers.addAll(modifiers); builder.initializer = initializer.isEmpty() ? null : initializer; return builder; }
Source:
public ListenableFuture<?> execute(CreateView statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters) { Session session = stateMachine.getSession(); QualifiedObjectName name = createQualifiedObjectName(session, statement, statement.getName()); accessControl.checkCanCreateView(session.getRequiredTransactionId(), session.getIdentity(), name); String sql = getFormattedSql(statement.getQuery(), sqlParser, Optional.of(parameters)); Analysis analysis = analyzeStatement(statement, session, metadata, accessControl, parameters, stateMachine.getWarningCollector()); List<ViewColumn> columns = analysis.getOutputDescriptor(statement.getQuery()) .getVisibleFields().stream() .map(field -> new ViewColumn(field.getName().get(), field.getType())) .collect(toImmutableList()); List<ColumnMetadata> columnMetaData = columns.stream() .map(column -> new ColumnMetadata(column.getName(), column.getType())) .collect(toImmutableList()); String data = codec.toJson(new ViewDefinition(sql, session.getCatalog(), session.getSchema(), columns, Optional.of(session.getUser()))); ConnectorTableMetadata viewMetadata = new ConnectorTableMetadata(name.asSchemaTableName(), columnMetaData); metadata.createView(session, viewMetadata, data, statement.isReplace()); return immediateFuture(null); }

Target:
public ListenableFuture<?> execute(CreateView statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters) { Session session = stateMachine.getSession(); QualifiedObjectName name = createQualifiedObjectName(session, statement, statement.getName()); accessControl.checkCanCreateView(session.getRequiredTransactionId(), session.getIdentity(), name); String sql = getFormattedSql(statement.getQuery(), sqlParser, Optional.of(parameters)); Analysis analysis = analyzeStatement(statement, session, metadata, accessControl, parameters, stateMachine.getWarningCollector()); List<ViewColumn> columns = analysis.getOutputDescriptor(statement.getQuery()) .getVisibleFields().stream() .map(field -> new ViewColumn(field.getName().get(), field.getType())) .collect(toImmutableList()); List<ColumnMetadata> columnMetadata = columns.stream() .map(column -> new ColumnMetadata(column.getName(), column.getType())) .collect(toImmutableList()); ConnectorTableMetadata viewMetadata = new ConnectorTableMetadata(name.asSchemaTableName(), columnMetadata); String data = codec.toJson(new ViewDefinition(sql, session.getCatalog(), session.getSchema(), columns, Optional.of(session.getUser()))); metadata.createView(session, name.getCatalogName(), viewMetadata, data, statement.isReplace()); return immediateFuture(null); }
Source:
private double weightedRate( PricingEnvironment env, IborIndex iborIndex, IborAveragedFixing fixing) { double rate = (fixing.getFixedRate().isPresent() ? fixing.getFixedRate().getAsDouble() : env.iborIndexRate(iborIndex, fixing.getFixingDate())); return rate * fixing.getWeight(); }

Target:
private double weightedRate( PricingEnvironment env, IborIndex iborIndex, IborAveragedFixing fixing) { double rate = fixing.getFixedRate().orElse(env.iborIndexRate(iborIndex, fixing.getFixingDate())); return rate * fixing.getWeight(); }
Source:
private void updateSealedStateOfReplicas(List<InstanceConfig> instanceConfigs) { for (InstanceConfig instanceConfig : instanceConfigs) { AmbryDataNode node = instanceNameToAmbryDataNode.get(instanceConfig.getInstanceName()); List<String> sealedReplicas = getSealedReplicas(instanceConfig); for (AmbryReplica replica : ambryDataNodeToAmbryReplicas.get(node)) { replica.setSealedState(sealedReplicas.contains(replica.getPartitionId().toPathString())); } } sealedStateChangeCounter.incrementAndGet(); }

Target:
private void updateSealedStateOfReplicas(List<InstanceConfig> instanceConfigs) { for (InstanceConfig instanceConfig : instanceConfigs) { AmbryDataNode node = instanceNameToAmbryDataNode.get(instanceConfig.getInstanceName()); HashSet<String> sealedReplicas = new HashSet<>(getSealedReplicas(instanceConfig)); for (AmbryReplica replica : ambryDataNodeToAmbryReplicas.get(node)) { replica.setSealedState(sealedReplicas.contains(replica.getPartitionId().toPathString())); } } }
Source:
public void enableTable(TableName tableName) throws IOException { disabledTables.remove(tableName); LOG.warn("Table " + tableName + " was enabled in memory only."); }

Target:
public void enableTable(TableName tableName) throws IOException { TableName.isLegalFullyQualifiedTableName(tableName.getName()); if (!this.tableExists(tableName)) { throw new TableNotFoundException(tableName); } disabledTables.remove(tableName); LOG.warn("Table " + tableName + " was enabled in memory only."); }
Source:
public void sendRequest(final Exchange exchange, Request request) { if (request.getMID() == Message.NONE) { request.setMID(currendMID.getAndIncrement() & 0x0000FFFF); } KeyMID idByMID = new KeyMID(request.getMID(), null, 0); KeyToken idByToken; if (request.getToken() == null) { byte[] token; do { token = createNewToken(); idByToken = new KeyToken(token); } while (exchangesByToken.get(idByToken) != null); request.setToken(token); } else { idByToken = new KeyToken(request.getToken()); if (!(exchange.getFailedTransmissionCount()>0 || request.getOptions().hasBlock1() || request.getOptions().hasBlock2() || request.getOptions().hasObserve()) && exchangesByToken.get(idByToken) != null) { LOGGER.warning("Manual token overrides existing open request: "+idByToken); } } exchange.setObserver(exchangeObserver); if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("Stored open request by "+idByMID+", "+idByToken); exchangesByMID.put(idByMID, exchange); exchangesByToken.put(idByToken, exchange); if(request.isMulticast()) { executor.schedule(new Runnable() { @Override public void run() { exchange.getCurrentRequest().setTimedOut(true); exchange.setTimedOut(); } }, multicastMaxLifetime, TimeUnit.MILLISECONDS); } }

Target:
public void sendRequest(final Exchange exchange, Request request) { if (request.getMID() == Message.NONE) { request.setMID(currendMID.getAndIncrement() & 0x0000FFFF); } KeyMID idByMID = new KeyMID(request.getMID(), null, 0); KeyToken idByToken; if (request.getToken() == null) { byte[] token; do { token = createNewToken(); idByToken = new KeyToken(token); } while (exchangesByToken.get(idByToken) != null); request.setToken(token); } else { idByToken = new KeyToken(request.getToken()); if (!(exchange.getFailedTransmissionCount()>0 || request.getOptions().hasBlock1() || request.getOptions().hasBlock2() || request.getOptions().hasObserve()) && exchangesByToken.get(idByToken) != null) { LOGGER.warning("Manual token overrides existing open request: "+idByToken); } } exchange.setObserver(exchangeObserver); if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("Stored open request by "+idByMID+", "+idByToken); exchangesByMID.put(idByMID, exchange); exchangesByToken.put(idByToken, exchange); if(request.isMulticast()) { executor.schedule(new Runnable() { @Override public void run() { if(exchange.getResponse() == null) { exchange.getCurrentRequest().setCanceled(true); } exchange.setComplete(); } }, multicastMaxLifetime, TimeUnit.MILLISECONDS); } }
Source:
public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case CAMERA_REQUEST: case REQUEST_CHOOSER: if (resultCode == Activity.RESULT_OK) { File dataFile = null; if (data == null) { Utils.d("Oops... Result was OK, but intent was null. That's just great."); dataFile = mTempImageFile; } else { dataFile = FileUtils.getFile(getActivity(), data.getData()); } if (dataFile == null || !dataFile.exists()) { Utils.d("Empty result was found!"); return; } IndexedFolder dir = mContentManager.getCurrentFolder(); mContentManager.addFile(dir, dataFile, new IOnResult<IndexedFile>() { @Override public void onResult(IndexedFile result) { if (result != null) { ArrayList<IndexedItem> itemList = new ArrayList<IndexedItem>(); itemList.add(result); mActionManager.actionLock(itemList, null); Utils.toast(R.string.content_success_add); } else { Utils.toast(R.string.content_fail_add); } } }); } break; case REQUEST_DIRECTORY: if(resultCode == DirectoryChooserActivity.RESULT_CODE_DIR_SELECTED){ File exportDir = new File(data.getStringExtra(DirectoryChooserActivity.RESULT_SELECTED_DIR)); mActionManager.actionRestore(getSelectedItems(), null, exportDir); } break; } }

Target:
public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case CONTENT_REQUEST: case REQUEST_CHOOSER: if (resultCode == Activity.RESULT_OK) { File dataFile = null; if (data == null) { Utils.d("Oops... Result was OK, but intent was null. That's just great."); dataFile = mTempResultFile; } else { Uri uri = data.getData(); dataFile = FileUtils.getFile(getActivity(), uri); } if (dataFile == null) { Utils.d("Empty result was found!"); return; } if (!dataFile.exists()) { Utils.d("File with result does not exist...!"); return; } IndexedFolder dir = mContentManager.getCurrentFolder(); mContentManager.addFile(dir, dataFile, new IOnResult<IndexedFile>() { @Override public void onResult(IndexedFile result) { if (result != null) { ArrayList<IndexedItem> itemList = new ArrayList<IndexedItem>(); itemList.add(result); mActionManager.actionLock(itemList, null); result.getOriginalFile().delete(); Utils.toast(R.string.content_success_add); } else { Utils.toast(R.string.content_fail_add); } } }); } break; case REQUEST_DIRECTORY: if (resultCode == DirectoryChooserActivity.RESULT_CODE_DIR_SELECTED) { File exportDir = new File(data.getStringExtra(DirectoryChooserActivity.RESULT_SELECTED_DIR)); mActionManager.actionRestore(getSelectedItems(), null, exportDir); } break; } }
Source:
public BigtableHBaseVeneerSettings(Configuration configuration) throws IOException { super(configuration); this.configuration = configuration; this.dataSettings = buildBigtableDataSettings().build(); this.tableAdminSettings = buildBigtableTableAdminSettings().build(); }

Target:
public BigtableHBaseVeneerSettings(Configuration configuration) throws IOException { super(configuration); this.configuration = configuration; this.dataSettings = buildBigtableDataSettings(); this.tableAdminSettings = buildBigtableTableAdminSettings(); if (!isNullOrEmpty(configuration.get(BIGTABLE_EMULATOR_HOST_KEY))) { this.instanceAdminSettings = null; } else { this.instanceAdminSettings = buildBigtableInstanceAdminSettings(); } String dataEndpoint = dataSettings.getStubSettings().getEndpoint(); this.dataHost = dataEndpoint.substring(0, dataEndpoint.lastIndexOf(":")); String adminEndpoint = tableAdminSettings.getStubSettings().getEndpoint(); this.adminHost = adminEndpoint.substring(0, adminEndpoint.lastIndexOf(":")); this.port = Integer.parseInt(dataEndpoint.substring(dataEndpoint.lastIndexOf(":") + 1)); this.bulkMaxRowKeyCount = dataSettings .getStubSettings() .bulkMutateRowsSettings() .getBatchingSettings() .getElementCountThreshold() .intValue(); this.batchingMaxMemory = dataSettings .getStubSettings() .bulkMutateRowsSettings() .getBatchingSettings() .getFlowControlSettings() .getMaxOutstandingRequestBytes(); if (Boolean.parseBoolean(configuration.get(BIGTABLE_USE_CACHED_DATA_CHANNEL_POOL)) || Boolean.parseBoolean(configuration.get(BIGTABLE_USE_BATCH))) { this.isChannelPoolCachingEnabled = true; } else { this.isChannelPoolCachingEnabled = false; } }
Source:
public void close() { final List<RuntimeException> suppressed = new ArrayList<>(); captureException(this::flush, suppressed); captureException(() -> cache.close(cacheName), suppressed); captureException(super::close, suppressed); if (!suppressed.isEmpty()) { final RuntimeException toThrow = new RuntimeException("Caught an exception while closing caching key value store for store " + name()); for (final RuntimeException e : suppressed) { toThrow.addSuppressed(e); } throw toThrow; } }

Target:
public void close() { lock.writeLock().lock(); try { final LinkedList<RuntimeException> suppressed = executeAll( () -> cache.flush(cacheName), () -> cache.close(cacheName), wrapped()::close ); if (!suppressed.isEmpty()) { throwSuppressed("Caught an exception while closing caching key value store for store " + name(), suppressed); } } finally { lock.writeLock().unlock(); } }
Source:
public boolean test(HermesResponse response) { return (response != null) && (isClientTimeoutOrServerError(response) || isFailedExceptionally(response)); }

Target:
public boolean test(HermesResponse response) { return response == null || (isClientTimeoutOrServerError(response) || isFailedExceptionally(response)); }
Source:
public VSpan(AnnotationLayer aLayer, AnnotationFS aFS, String aType, VRange aOffsets, Map<String, String> aFeatures, Map<String, String> aHoverFeatures) { this(aLayer, new VID(getAddr(aFS)), aType, asList(aOffsets), aFeatures, aHoverFeatures, null, null); }

Target:
public VSpan(AnnotationLayer aLayer, AnnotationFS aFS, String aType, VRange aOffsets, Map<String, String> aFeatures, Map<String, String> aHoverFeatures) { this(aLayer, new VID(getAddr(aFS)), aType, asList(aOffsets), aFeatures, aHoverFeatures, null); }
Source:
public void testNoBucketProbing() throws Exception { Configuration configuration = this.getConfiguration(); configuration.setInt(S3A_BUCKET_PROBE, 0); try { fs = FileSystem.get(uri, configuration); } catch (IOException ex) { LOG.error("Exception : ", ex); fail("Exception shouldn't have occurred"); } assertNotNull("FileSystem should have been initialized", fs); Path path = new Path(uri); intercept(FileNotFoundException.class, () -> fs.getFileStatus(path)); Path src = new Path(fs.getUri() + "/testfile"); byte[] data = dataset(1024, 'a', 'z'); intercept(FileNotFoundException.class, () -> writeDataset(fs, src, data, data.length, 1024 * 1024, true)); }

Target:
public void testNoBucketProbing() throws Exception { describe("Disable init-time probes and expect FS operations to fail"); Configuration conf = createConfigurationWithProbe(0); conf.set(S3_METADATA_STORE_IMPL, S3GUARD_METASTORE_NULL); fs = FileSystem.get(uri, conf); Path root = new Path(uri); expectUnknownStore( () -> fs.getFileStatus(root)); expectUnknownStore( () -> fs.listStatus(root)); Path src = new Path(root, "testfile"); Path dest = new Path(root, "dst"); expectUnknownStore( () -> fs.getFileStatus(src)); expectUnknownStore(() -> fs.exists(src)); expectUnknownStore(() -> fs.isFile(src)); expectUnknownStore(() -> fs.isDirectory(src)); expectUnknownStore(() -> fs.mkdirs(src)); expectUnknownStore(() -> fs.delete(src)); expectUnknownStore(() -> fs.rename(src, dest)); byte[] data = dataset(1024, 'a', 'z'); expectUnknownStore( () -> writeDataset(fs, src, data, data.length, 1024 * 1024, true)); }
Source:
public void testValidContainerIdWhenContainerIdIsValidInTheSecondAttempt() { final ServerTemplate template = mock(ServerTemplate.class); final ContainerSpec containerSpec = mock(ContainerSpec.class); when(template.getContainerSpec("org.jbpm:Evaluation:1.0")).thenReturn(containerSpec); when(template.getContainerSpec("org.jbpm:Evaluation:1.0-2")).thenReturn(null); doReturn(template).when(specManagementService).getServerTemplate(TEMPLATE_ID); final String containerId = specManagementServiceCDI.validContainerId(TEMPLATE_ID, "org.jbpm:Evaluation:1.0"); assertEquals(containerId, "org.jbpm:Evaluation:1.0-2"); }

Target:
public void testValidContainerIdWhenContainerIdIsValidInTheSecondAttempt() { final ServerTemplate template = mock(ServerTemplate.class); final ContainerSpec containerSpec = mock(ContainerSpec.class); when(template.getContainerSpec(EVALUATION_GAV_1_0)).thenReturn(containerSpec); when(template.getContainerSpec(EVALUATION_GAV_1_0_2)).thenReturn(null); doReturn(template).when(specManagementService).getServerTemplate(TEMPLATE_ID); final String containerId = specManagementServiceCDI.validContainerId(TEMPLATE_ID, EVALUATION_GAV_1_0); assertEquals(containerId, EVALUATION_GAV_1_0_2); }
Source:
public void referenceChange(Match match, EReference reference, EObject value, DifferenceKind kind, DifferenceSource source) { if (!alreadyChanged.contains(reference)) { switch (kind) { case MOVE: distance += weightProviderRegistry.getHighestRankingWeightProvider(reference) .getWeight(reference) * orderChangeCoef; break; case ADD: case DELETE: case CHANGE: distance += weightProviderRegistry.getHighestRankingWeightProvider(reference) .getWeight(reference); break; default: break; } alreadyChanged.add(reference); } else { distance += 1; } }

Target:
public void referenceChange(Match match, EReference reference, EObject value, DifferenceKind kind, DifferenceSource source) { if (!alreadyChanged.contains(reference)) { switch (kind) { case MOVE: distance += weightProviderRegistry.getHighestRankingWeightProvider( reference.eClass().getEPackage()).getWeight(reference) * orderChangeCoef; break; case ADD: case DELETE: case CHANGE: distance += weightProviderRegistry.getHighestRankingWeightProvider( reference.eClass().getEPackage()).getWeight(reference); break; default: break; } alreadyChanged.add(reference); } else { distance += 1; } }
Source:
public Resource decorate(final Resource resource) { try { if (!this.accepts(resource)) { return resource; } } catch (Exception e) { if (LOG.isDebugEnabled()) { LOG.debug("Failed binary sync check for remote asset: - {}", resource.getPath(), e.getMessage()); } return resource; } Resource ret = resource; try { remoteResourcesSyncing.add(resource.getPath()); LOG.info("Sync'ing remote asset binaries: {}", resource.getPath()); ret = this.assetSync.syncAsset(resource); } catch (Exception e) { LOG.error("Failed to sync binaries for remote asset: - {}", resource.getPath(), e.getMessage()); } finally { remoteResourcesSyncing.remove(resource.getPath()); } return ret; }

Target:
public Resource decorate(final Resource resource) { try { if (!this.accepts(resource)) { return resource; } } catch (Exception e) { LOG.debug("Failed binary sync check for remote asset: - {}", resource.getPath()); return resource; } boolean syncSuccessful = false; if (remoteResourcesSyncing.contains(resource.getPath())) { syncSuccessful = waitForSyncInProgress(resource); } else { syncSuccessful = syncAssetBinaries(resource); } if (syncSuccessful) { LOG.debug("Refreshing resource after binary sync of {}"); resource.getResourceResolver().refresh(); return resource.getResourceResolver().getResource(resource.getPath()); } else { return resource; } }
Source:
public BlockManagementTaskResult run() { LOG.debug("Running align task."); final int alignRange = ServerConfiguration.getInt(PropertyKey.WORKER_MANAGEMENT_TIER_ALIGN_RANGE); BlockManagementTaskResult result = new BlockManagementTaskResult(); for (Pair<BlockStoreLocation, BlockStoreLocation> intersection : mMetadataManager .getStorageTierAssoc().intersectionList()) { BlockStoreLocation tierUpLoc = intersection.getFirst(); BlockStoreLocation tierDownLoc = intersection.getSecond(); Pair<List<Long>, List<Long>> swapLists = mMetadataManager.getBlockIterator().getSwaps( tierUpLoc, BlockOrder.Natural, tierDownLoc, BlockOrder.Reverse, alignRange, BlockOrder.Reverse, (blockId) -> !mEvictorView.isBlockEvictable(blockId)); Preconditions.checkArgument(swapLists.getFirst().size() == swapLists.getSecond().size()); LOG.debug("Acquired block pairs to align tiers - {}", swapLists.getFirst().size(), tierUpLoc.tierAlias(), tierDownLoc.tierAlias()); Consumer<Exception> excHandler = (e) -> { if (e instanceof WorkerOutOfSpaceException) { LOG.warn("No sufficient space for worker swap space, swap restore task called."); TierManagementTaskProvider.setSwapRestoreRequired(true); } }; BlockOperationResult tierResult = mTransferExecutor.executeTransferList(generateSwapTransferInfos(swapLists), excHandler); result.addOpResults(BlockOperationType.ALIGN_SWAP, tierResult); } return result; }

Target:
public BlockManagementTaskResult run() { LOG.debug("Running align task."); final int alignRange = ServerConfiguration.getInt(PropertyKey.WORKER_MANAGEMENT_TIER_ALIGN_RANGE); BlockManagementTaskResult result = new BlockManagementTaskResult(); for (Pair<BlockStoreLocation, BlockStoreLocation> intersection : mMetadataManager .getStorageTierAssoc().intersectionList()) { BlockStoreLocation tierUpLoc = intersection.getFirst(); BlockStoreLocation tierDownLoc = intersection.getSecond(); Pair<List<Long>, List<Long>> swapLists = mMetadataManager.getBlockIterator().getSwaps( tierUpLoc, BlockOrder.Natural, tierDownLoc, BlockOrder.Reverse, alignRange, BlockOrder.Reverse, (blockId) -> !mEvictorView.isBlockEvictable(blockId)); Preconditions.checkArgument(swapLists.getFirst().size() == swapLists.getSecond().size()); LOG.debug("Acquired block pairs to align tiers - {}", swapLists.getFirst().size(), tierUpLoc.tierAlias(), tierDownLoc.tierAlias()); Consumer<Exception> excHandler = (e) -> { if (e instanceof WorkerOutOfSpaceException) { LOG.warn("Insufficient space for worker swap space, swap restore task called."); TierManagementTaskProvider.setSwapRestoreRequired(true); } }; BlockOperationResult tierResult = mTransferExecutor.executeTransferList(generateSwapTransferInfos(swapLists), excHandler); result.addOpResults(BlockOperationType.ALIGN_SWAP, tierResult); } return result; }
Source:
public void Type(int type) { this.type = type; boolean chartViewExists = (chartView != null); if (chartViewExists) { view.removeView(chartView.getView()); } chartView = createChartViewFromType(type); view.addView(chartView.getView(), 0); if (chartViewExists) { reinitializeChart(); } }

Target:
public void Type(int type) { if (type >= 0 && type < ComponentConstants.CHART_TYPES) { this.type = type; boolean chartViewExists = (chartView != null); if (chartViewExists) { view.removeView(chartView.getView()); } chartView = createChartViewFromType(type); view.addView(chartView.getView(), 0); if (chartViewExists) { reinitializeChart(); } } }
Source:
public void init() { loadProperties(); httpClient = HttpUtils.createDefaultExecutor(); threadPool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 8); }

Target:
public void init() { loadProperties(); httpClient = HttpUtils.createDefaultExecutor(); threadPool = Executors.newFixedThreadPool(THREAD_POOL_SIZE); }
Source:
public boolean isContainer(){ return descendants != null; }

Target:
public boolean isContainer(){ return type != null ? type.isContainer() : (descendants != null && descendants.size() > 0); }
Source:
public void linkNewChild(HTNode childNode) { rwl.writeLock().lock(); try { assert(nbChildren < getConfig().getMaxChildren()); children[nbChildren] = childNode.getSequenceNumber(); childStart[nbChildren] = childNode.getNodeStart(); nbChildren++; } finally { rwl.writeLock().unlock(); } }

Target:
public void linkNewChild(HTNode childNode) { rwl.writeLock().lock(); try { if(nbChildren >= getConfig().getMaxChildren()){ throw new IllegalStateException("Asked to link another child but parent already has maximum number of children"); } children[nbChildren] = childNode.getSequenceNumber(); childStart[nbChildren] = childNode.getNodeStart(); nbChildren++; } finally { rwl.writeLock().unlock(); } }
Source:
private void reorderClustersBasedOnImplicitTags(List<Long> clusterList, int requiredCpu, long requiredRam) { final HashMap<Long, Long> UniqueTagsInClusterMap = new HashMap<Long, Long>(); Long uniqueTags; for (Long clusterId : clusterList) { uniqueTags = 0L; List<Long> hostList = capacityDao.listHostsWithEnoughCapacity(requiredCpu, requiredRam, clusterId, Host.Type.Routing.toString()); if (!hostList.isEmpty() && implicitHostTags.length > 0) { uniqueTags = new Long(hostTagsDao.getDistinctImplicitHostTags(hostList, implicitHostTags).size()); } UniqueTagsInClusterMap.put(clusterId, uniqueTags); } Collections.sort(clusterList, new Comparator<Long>() { @Override public int compare(Long o1, Long o2) { Long t1 = UniqueTagsInClusterMap.get(o1); Long t2 = UniqueTagsInClusterMap.get(o2); return t1.compareTo(t2); } }); }

Target:
public void reorderClustersBasedOnImplicitTags(List<Long> clusterList, int requiredCpu, long requiredRam) { Map<Long, Long> UniqueTagsInClusterMap = new HashMap<>(); for (Long clusterId : clusterList) { long uniqueTags = 0l; List<Long> hostList = capacityDao.listHostsWithEnoughCapacity(requiredCpu, requiredRam, clusterId, Host.Type.Routing.toString()); if (!hostList.isEmpty() && implicitHostTags.length > 0) { uniqueTags = hostTagsDao.getDistinctImplicitHostTags(hostList, implicitHostTags).size(); } UniqueTagsInClusterMap.put(clusterId, uniqueTags); } Collections.sort(clusterList, new Comparator<Long>() { @Override public int compare(Long o1, Long o2) { Long t1 = UniqueTagsInClusterMap.get(o1); Long t2 = UniqueTagsInClusterMap.get(o2); return t1.compareTo(t2); } }); }
Source:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException { FailureCollector collector = pipelineConfigurer.getStageConfigurer().getFailureCollector(); Schema inputSchema = pipelineConfigurer.getStageConfigurer().getInputSchema(); if (inputSchema != null) { if (config.messageField != null && inputSchema.getField(config.messageField) != null) { collector.addFailure( String.format("Input schema already contains message field '%s'.", config.messageField), "Please set message field to a different value.") .withConfigProperty(MESSAGE_FIELD).withInputSchemaField(config.messageField); } if (config.codeField != null && inputSchema.getField(config.codeField) != null) { collector.addFailure( String.format("Input schema already contains code field '%s'.", config.codeField), "Please set code field to a different value.") .withConfigProperty(CODE_FIELD).withInputSchemaField(config.codeField); } if (config.stageField != null && inputSchema.getField(config.stageField) != null) { collector.addFailure( String.format("Input schema already contains stage field '%s'.", config.stageField), "Please set stage field to a different value.") .withConfigProperty(STAGE_FIELD).withInputSchemaField(config.stageField); } Schema outputSchema = getOutputSchema(config, inputSchema); pipelineConfigurer.getStageConfigurer().setOutputSchema(outputSchema); } }

Target:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) { FailureCollector collector = pipelineConfigurer.getStageConfigurer().getFailureCollector(); Schema inputSchema = pipelineConfigurer.getStageConfigurer().getInputSchema(); if (inputSchema != null) { if (config.messageField != null && inputSchema.getField(config.messageField) != null) { collector.addFailure( String.format("Input schema already contains field '%s'.", config.messageField), "Set message field to a different value.") .withConfigProperty(Config.MESSAGE_FIELD).withInputSchemaField(config.messageField); } if (config.codeField != null && inputSchema.getField(config.codeField) != null) { collector.addFailure( String.format("Input schema already contains field '%s'.", config.codeField), "Set code field to a different value.") .withConfigProperty(Config.CODE_FIELD).withInputSchemaField(config.codeField); } if (config.stageField != null && inputSchema.getField(config.stageField) != null) { collector.addFailure( String.format("Input schema already contains field '%s'.", config.stageField), "Set stage field to a different value.") .withConfigProperty(Config.STAGE_FIELD).withInputSchemaField(config.stageField); } Schema outputSchema = getOutputSchema(config, inputSchema); pipelineConfigurer.getStageConfigurer().setOutputSchema(outputSchema); } }
Source:
public void assertIsCloseToPercentage(AssertionInfo info, Long actual, Long other, Percentage<Long> percentage) { assertNotNull(info, actual); checkPercentageIsNotNull(percentage); checkNumberIsNotNull(other); if (org.assertj.core.util.Objects.areEqual(actual, other)) return; Offset<Double> calculatedOffset = offset(percentage.value * other / 100d); Long absDiff = abs(other - actual); if (absDiff > calculatedOffset.value) throw failures.failure(info, ShouldBeEqualWithinPercentage .shouldBeEqualWithinPercentage(actual, other, percentage, absDiff)); }

Target:
public void assertIsCloseToPercentage(AssertionInfo info, Long actual, Long other, Percentage<Long> percentage) { assertNotNull(info, actual); checkPercentageIsNotNull(percentage); checkNumberIsNotNull(other); Offset<Double> calculatedOffset = offset(percentage.value * other / 100d); Long absDiff = abs(other - actual); if (absDiff > calculatedOffset.value) throw failures.failure(info, shouldBeEqualWithinPercentage(actual, other, percentage, absDiff)); }