auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void commit() { TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(input); ICommand cmd = null; Expression ex = languageEditor.getValue(); String commandLabel = "Save " + getTitle() + " Code"; UMLRTNamedElement facade = getFacade(); if (UML2Util.isEmpty(ex.getBody()) && facade != null && !facade.isInherited()) { final Element elementToDelete = facade.toUML(); IElementEditService provider = ElementEditServiceUtils.getCommandProvider(input); DestroyElementRequest request = new DestroyElementRequest(domain, elementToDelete, false); cmd = provider.getEditCommand(request); } else if (UML2Util.isEmpty(ex.getBody()) && facade != null && facade instanceof UMLRTOpaqueBehavior) { if (facade.isInherited() && !facade.isExcluded()) { cmd = ExclusionCommand.getExclusionCommand(facade.toUML(), true); } } else { CompositeCommand compositeCmd = new CompositeCommand(commandLabel); if (facade != null && facade.isExcluded()) { compositeCmd.compose(ExclusionCommand.getExclusionCommand(facade.toUML(), false)); } ICommand saveCmd = new AbstractTransactionalCommand(domain, commandLabel, Collections.EMPTY_LIST) { @Override protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { commit(ex); return CommandResult.newOKCommandResult(); } }; compositeCmd.compose(saveCmd); cmd = compositeCmd.reduce(); } if (cmd != null && cmd.canExecute()) { ignoreChanges = true; domain.getCommandStack().execute(new GMFtoEMFCommandWrapper(cmd)); ignoreChanges = false; setInput(input); } }

Target:
protected void commit() { TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(input); ICommand cmd = null; Expression expr = languageEditor.getValue(); String commandLabel = "Save " + getTitle() + " Code"; UMLRTNamedElement facade = getFacade(); if (UML2Util.isEmpty(expr.getBody()) && facade != null && !facade.isInherited()) { final Element elementToDelete = facade.toUML(); IElementEditService provider = ElementEditServiceUtils.getCommandProvider(input); DestroyElementRequest request = new DestroyElementRequest(domain, elementToDelete, false); cmd = provider.getEditCommand(request); } else if (UML2Util.isEmpty(expr.getBody()) && facade != null && facade instanceof UMLRTOpaqueBehavior) { if (facade.isInherited() && !facade.isExcluded()) { cmd = ExclusionCommand.getExclusionCommand(facade.toUML(), true); } } else { CompositeCommand compositeCmd = new CompositeCommand(commandLabel); if (facade != null && facade.isExcluded()) { compositeCmd.compose(ExclusionCommand.getExclusionCommand(facade.toUML(), false)); } ICommand saveCmd = new AbstractTransactionalCommand(domain, commandLabel, Collections.EMPTY_LIST) { @Override protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { commit(expr); return CommandResult.newOKCommandResult(); } }; compositeCmd.compose(saveCmd); cmd = compositeCmd.reduce(); } if (cmd != null && cmd.canExecute()) { ignoreChanges = true; domain.getCommandStack().execute(new GMFtoEMFCommandWrapper(cmd)); ignoreChanges = false; setInput(input); } }
Source:
public TopologyDescriptor(TopologyConfigurationMsg topologyMessage) { this.topologyConfigId = topologyMessage.getTopologyConfigID(); this.certs = topologyMessage.getCerts(); standbyClusters = new HashMap<>(); for (ClusterConfigurationMsg clusterConfig : topologyMessage.getClustersList()) { ClusterDescriptor siteInfo = new ClusterDescriptor(clusterConfig); if (clusterConfig.getRole() == ClusterRole.ACTIVE) { activeCluster = siteInfo; } else if (clusterConfig.getRole() == ClusterRole.STANDBY) { addStandbySite(siteInfo); } } }

Target:
public TopologyDescriptor(TopologyConfigurationMsg topologyMessage) { this.topologyConfigId = topologyMessage.getTopologyConfigID(); this.standbyClusters = new HashMap<>(); for (ClusterConfigurationMsg clusterConfig : topologyMessage.getClustersList()) { ClusterDescriptor cluster = new ClusterDescriptor(clusterConfig); if (clusterConfig.getRole() == ClusterRole.ACTIVE) { activeCluster = cluster; } else if (clusterConfig.getRole() == ClusterRole.STANDBY) { addStandbySite(cluster); } } }
Source:
public void onRollback(@Nonnull NodeProvisioner.PlannedNode plannedNode, @Nonnull Node node, @Nonnull Throwable t) { ; }

Target:
public void onRollback(@Nonnull NodeProvisioner.PlannedNode plannedNode, @Nonnull Node node, @Nonnull Throwable t) { }
Source:
public boolean isValid(Duration value, ConstraintValidatorContext context) { if ( value == null ) { return true; } return duration.compareTo( value ) > -1; }

Target:
public boolean isValid(Duration value, ConstraintValidatorContext context) { if ( value == null ) { return true; } int comparisonResult = maxDuration.compareTo( value ); return inclusive ? comparisonResult >= 0 : comparisonResult > 0; }
Source:
public Matrix rotate(Factory factory) { double[][] rotatedMatrix = new double[this.columns()][this.rows()]; for (int i = 0; i < this.rows(); i++) { for (int j = 0; j < this.columns(); j++) { rotatedMatrix[j][this.rows()-1-i] = this.get(i, j); } } return factory.createMatrix(rotatedMatrix); }

Target:
public Matrix rotate(Factory factory) { return self.rotate(factory); }
Source:
public void setMaxRow(final int maxRow) { this.maxRow = maxRow; Preconditions.checkArgument(maxRow > 0); Preconditions.checkState(minRow < maxRow, "minRow >= maxRow. (minRow=%s, ,maxRow=%s)", minRow, maxRow); }

Target:
public void setMaxRow(final int maxRow) { this.maxRow = maxRow; Preconditions.checkArgument(maxRow > 0, "maxRow: %s", maxRow); Preconditions.checkState(minRow < maxRow, "minRow >= maxRow. (minRow=%s, ,maxRow=%s)", minRow, maxRow); }
Source:
public static int decrementAndGetInt(long ptr) { while (true) { int old = getInt(ptr); int updated = old - 1; if (compareAndSwapInt(null, ptr, old, updated)) return updated; } }

Target:
public static int decrementAndGetInt(long ptr) { return UNSAFE.getAndAddInt(null, ptr, -1) - 1; }
Source:
public Stream<BooleanResult> nodeManualIndexAdd( @Name( "indexName" ) String legacyIndexName, @Name( "node" ) Node node, @Name( "key" ) String key, @Name( "value" ) Object value ) { graphDatabaseAPI.index().forNodes( legacyIndexName ).add( node, key, value ); List<BooleanResult> results = new ArrayList<>( 1 ); results.add( new BooleanResult( true ) ); return results.stream(); }

Target:
public Stream<BooleanResult> nodeManualIndexAdd( @Name( "indexName" ) String legacyIndexName, @Name( "node" ) Node node, @Name( "key" ) String key, @Name( "value" ) Object value ) { graphDatabaseAPI.index().forNodes( legacyIndexName ).add( node, key, value ); return Stream.of( new BooleanResult( true ) ); }
Source:
public int compareTo(DataAccessRule other) { int compareWs = compareCatalogItems(root, other.root); if (compareWs != 0) return compareWs; int compareLayer = compareCatalogItems(layer, other.layer); if (compareLayer != 0) return compareLayer; if (accessMode.equals(other.accessMode)) return 0; else return accessMode.equals(AccessMode.READ) ? -1 : 1; }

Target:
public int compareTo(DataAccessRule other) { int compareRoot = compareCatalogItems(root, other.root); if (compareRoot != 0) return compareRoot; int compareLayer = compareCatalogItems(layer, other.layer); if (compareLayer != 0) return compareLayer; if (accessMode.equals(other.accessMode)) return 0; else return accessMode.equals(AccessMode.READ) ? -1 : 1; }
Source:
public String remove(String key) { Assert.notNull(key, "'key' must not be null."); Query query = new Query(Criteria.where("key").is(key)); Datastore result = template.findAndRemove(query, Datastore.class,collectionName); return result==null?null:result.value; }

Target:
public String remove(String key) { Assert.notNull(key, "'key' must not be null."); Query query = new Query(Criteria.where(ID_FIELD).is(key)); query.fields().exclude(ID_FIELD); @SuppressWarnings("unchecked") Map<String, String> result = template.findAndRemove(query, Map.class, collectionName); return result == null ? null : result.get(VALUE); }
Source:
private static void write(String filename, String content) throws IOException { BufferedWriter writer = new BufferedWriter(new FileWriter(filename)); writer.write(content); writer.close(); }

Target:
private static void write(String filename, String content) throws IOException { try(BufferedWriter writer = new BufferedWriter(new FileWriter(filename))) { writer.write(content); } }
Source:
public boolean isValidInput() { mErrorView.setVisibility(View.GONE); if (mField.isRequired() && !hasValue()) { String errorMessage = mField.getErrorMessage().getRequired(); if(errorMessage==null || errorMessage.isEmpty()){ errorMessage = getView().getResources().getString(R.string.error_enter_field, mField.getLabel()); } if(errorMessage!=null){ handleError(errorMessage); } return false; } int inputLength = getCurrentValue().getAsString().length(); if (inputLength < mField.getRestriction().getMinLength()) { String errorMessage = mField.getErrorMessage().getMinLength(); if(errorMessage==null || errorMessage.isEmpty()){ errorMessage = getView().getResources().getString(R.string.error_min_length, mField.getLabel(), mField.getRestriction().getMinLength()); } if(errorMessage!=null){ handleError(errorMessage); } return false; } if (mField.getRestriction().getMaxLength() > 0 && inputLength > mField.getRestriction().getMaxLength()) { String errorMessage = mField.getErrorMessage().getMaxLength(); if(errorMessage==null || errorMessage.isEmpty()){ errorMessage = getView().getResources().getString(R.string.error_max_length, mField.getLabel(), mField.getRestriction().getMaxLength()); } if(errorMessage!=null){ handleError(errorMessage); } handleError(mField.getErrorMessage().getMaxLength()); return false; } return true; }

Target:
public boolean isValidInput() { mErrorView.setVisibility(View.GONE); if (mField.isRequired() && !hasValue()) { String errorMessage = mField.getErrorMessage().getRequired(); if(errorMessage==null || errorMessage.isEmpty()){ errorMessage = getView().getResources().getString(R.string.error_enter_field, mField.getLabel()); } handleError(errorMessage); return false; } int inputLength = getCurrentValue().getAsString().length(); if (inputLength < mField.getRestriction().getMinLength()) { String errorMessage = mField.getErrorMessage().getMinLength(); if(errorMessage==null || errorMessage.isEmpty()){ errorMessage = getView().getResources().getString(R.string.error_min_length, mField.getLabel(), mField.getRestriction().getMinLength()); } handleError(errorMessage); return false; } if (mField.getRestriction().getMaxLength() > 0 && inputLength > mField.getRestriction().getMaxLength()) { String errorMessage = mField.getErrorMessage().getMaxLength(); if(errorMessage==null || errorMessage.isEmpty()){ errorMessage = getView().getResources().getString(R.string.error_max_length, mField.getLabel(), mField.getRestriction().getMaxLength()); } handleError(errorMessage); return false; } return true; }
Source:
private synchronized void monitorCommits(ReplicationModule.IndexCommitNotice commitNotice) { long peerId = commitNotice.replicatorInstance.getId(); long index = commitNotice.committedIndex; long prevCommitIndex = lastCommit.getOrDefault(peerId, 0L); assert index >= prevCommitIndex; lastCommit.put(peerId, index); simStatusChanges.publish(0L); }

Target:
private void monitorCommits(ReplicationModule.IndexCommitNotice commitNotice) { long peerId = commitNotice.replicatorInstance.getId(); long index = commitNotice.committedIndex; long prevCommitIndex = lastCommit.getOrDefault(peerId, 0L); assert index >= prevCommitIndex; lastCommit.put(peerId, index); simStatusChanges.publish(0L); }
Source:
public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); if (savedInstanceState != null) mainContent = getSupportFragmentManager().getFragment(savedInstanceState, "mainContent"); if (mainContent == null) mainContent = new PlaylistFragment(); setContentView(R.layout.content_frame); getSupportFragmentManager() .beginTransaction() .replace(R.id.content_frame, mainContent) .commit(); setBehindContentView(R.layout.menu_frame); MenuFragment mFragment = new MenuFragment(); getSupportFragmentManager() .beginTransaction() .replace(R.id.menu_frame, mFragment) .commit(); getSlidingMenu().setBehindOffset(60); setSlidingActionBarEnabled(false); getSupportActionBar().setDisplayHomeAsUpEnabled(true); setTitle("Music"); }

Target:
public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); if (savedInstanceState != null){ mainContent = getSupportFragmentManager().getFragment(savedInstanceState, "mainContent"); } if (mainContent == null){ mainContent = new PlaylistFragment(); } setContentView(R.layout.content_frame); switchContent(mainContent); setBehindContentView(R.layout.menu_frame); MenuFragment menuFragment = new MenuFragment(); switchFragment(menuFragment, false); getSlidingMenu().setBehindOffset(60); setSlidingActionBarEnabled(false); getSupportActionBar().setDisplayHomeAsUpEnabled(true); }
Source:
public double getFractionTransferred() { if (transferableBytes == 0) { return (transferredBytes == 0) ? 1.0D : 0.0D; } else { double percentage = (double) transferredBytes / (double) transferableBytes; return percentage > 1.0D ? 1.0D : percentage; } }

Target:
public double getFractionTransferred() { if (transferableBytes == 0) { return 1.0D; } else { double percentage = (double) transferredBytes / (double) transferableBytes; return percentage > 1.0D ? 1.0D : percentage; } }
Source:
private ConsumerRecords<K, V> poll(final Timer timer, final boolean includeMetadataInTimeout) { acquireAndEnsureOpen(); try { this.kafkaConsumerMetrics.recordPollStart(timer.currentTimeMs()); if (this.subscriptions.hasNoSubscriptionOrUserAssignment()) { throw new IllegalStateException("Consumer is not subscribed to any topics or assigned any partitions"); } do { client.maybeTriggerWakeup(); if (includeMetadataInTimeout) { if (!updateAssignmentMetadataIfNeeded(timer)) { return ConsumerRecords.empty(); } } else { while (!updateAssignmentMetadataIfNeeded(time.timer(Long.MAX_VALUE))) { log.warn("Still waiting for metadata"); } } final Map<TopicPartition, List<ConsumerRecord<K, V>>> records = pollForFetches(timer); if (!records.isEmpty()) { if (fetcher.sendFetches() > 0 || client.hasPendingRequests()) { client.pollNoThrow(); } return this.interceptors.onConsume(new ConsumerRecords<>(records)); } } while (timer.notExpired()); return ConsumerRecords.empty(); } finally { release(); this.kafkaConsumerMetrics.recordPollEnd(timer.currentTimeMs()); } }

Target:
private ConsumerRecords<K, V> poll(final Timer timer, final boolean includeMetadataInTimeout) { acquireAndEnsureOpen(); try { this.kafkaConsumerMetrics.recordPollStart(timer.currentTimeMs()); if (this.subscriptions.hasNoSubscriptionOrUserAssignment()) { throw new IllegalStateException("Consumer is not subscribed to any topics or assigned any partitions"); } do { client.maybeTriggerWakeup(); if (includeMetadataInTimeout) { if (!updateAssignmentMetadataIfNeeded(timer)) { return ConsumerRecords.empty(); } } else { while (!updateAssignmentMetadataIfNeeded(time.timer(Long.MAX_VALUE))) { log.warn("Still waiting for metadata"); } } final Map<TopicPartition, List<ConsumerRecord<K, V>>> records = pollForFetches(timer); if (!records.isEmpty()) { if (fetcher.sendFetches() > 0 || client.hasPendingRequests()) { client.transmitSends(); } return this.interceptors.onConsume(new ConsumerRecords<>(records)); } } while (timer.notExpired()); return ConsumerRecords.empty(); } finally { release(); this.kafkaConsumerMetrics.recordPollEnd(timer.currentTimeMs()); } }
Source:
public static void makeUserRequest(GraphRequest.Callback callback) { final Bundle params = new Bundle(); params.putString("fields", "picture,name,id,email,permissions"); final GraphRequest request = new GraphRequest( AccessToken.getCurrentAccessToken(), ME_ENDPOINT, params, HttpMethod.GET, callback ); request.executeAsync(); }

Target:
public static void makeUserRequest(GraphRequest.Callback callback) { final Bundle params = new Bundle(); params.putString("fields", "name,id,email"); final GraphRequest request = new GraphRequest( AccessToken.getCurrentAccessToken(), ME_ENDPOINT, params, HttpMethod.GET, callback ); request.executeAsync(); }
Source:
public static ProxyData[] getProxyData(String provider) { ProxyManager manager = (ProxyManager) ProxyManager.getProxyManager(); switch (provider) { case DIRECT_PROVIDER: return new ProxyData[0]; case ECLIPSE_PROVIDER: return castArray(manager.getProxyData()); case NATIVE_PROVIDER: return castArray(manager.getNativeProxyData()); default: break; } throw new IllegalArgumentException("Provider not supported"); }

Target:
public static ProxyData[] getProxyData(String provider) { ProxyManager manager = (ProxyManager) ProxyManager.getProxyManager(); switch (provider) { case DIRECT_PROVIDER: return new ProxyData[0]; case ECLIPSE_PROVIDER: return castArray(manager.getProxyData()); case NATIVE_PROVIDER: return castArray(manager.getNativeProxyData()); default: throw new IllegalArgumentException("Provider not supported"); } }
Source:
private AccountAttributes createAccountAttributesToSanitize() { AccountAttributes unsanitizedAttributes = AccountAttributes.builder().build(); unsanitizedAttributes.googleId = " google'Id@gmail.com\t"; unsanitizedAttributes.name = "'name'\n\n"; unsanitizedAttributes.institute = "\\\t\n/"; unsanitizedAttributes.email = "&<email>&\n"; unsanitizedAttributes.isInstructor = true; return unsanitizedAttributes; }

Target:
private AccountAttributes createAccountAttributesToSanitize() { AccountAttributes unsanitizedAttributes = AccountAttributes.builder().build(); unsanitizedAttributes.googleId = " google'Id@gmail.com\t"; unsanitizedAttributes.name = "'n \t\t a me'\n\n"; unsanitizedAttributes.institute = "Some\t \\ institute \n/"; unsanitizedAttributes.email = " <my&email>@gmail.com\n"; unsanitizedAttributes.isInstructor = true; return unsanitizedAttributes; }
Source:
public ResponseEntity<Resources<Resource>> getReleasesForUser(@RequestParam(value = "sha1", required = false) String sha1, OAuth2Authentication oAuth2Authentication) { User sw360User = restControllerHelper.getSw360UserFromAuthentication(oAuth2Authentication); List<Release> releases = new ArrayList<>(); if ((sha1 != null) && (!sha1.isEmpty())) { releases.add(searchReleaseBySha1(sha1, sw360User)); } else { releases.addAll(releaseService.getReleasesForUser(sw360User)); } List<Resource> releaseResources = new ArrayList<>(); for (Release release : releases) { release.setComponentId(null); release.setType(null); release.setAttachments(null); release.setReleaseDate(null); release.setVendor(null); release.setMainLicenseIds(null); Resource<Release> releaseResource = new Resource<>(release); releaseResources.add(releaseResource); } Resources<Resource> resources = new Resources<>(releaseResources); return new ResponseEntity<>(resources, HttpStatus.OK); }

Target:
public ResponseEntity<Resources<Resource>> getReleasesForUser(@RequestParam(value = "sha1", required = false) String sha1, OAuth2Authentication oAuth2Authentication) { User sw360User = restControllerHelper.getSw360UserFromAuthentication(oAuth2Authentication); List<Release> releases = new ArrayList<>(); if (sha1 != null && !sha1.isEmpty()) { releases.add(searchReleaseBySha1(sha1, sw360User)); } else { releases.addAll(releaseService.getReleasesForUser(sw360User)); } List<Resource> releaseResources = new ArrayList<>(); for (Release release : releases) { release.setComponentId(null); release.setType(null); release.setAttachments(null); release.setReleaseDate(null); release.setVendor(null); release.setMainLicenseIds(null); Resource<Release> releaseResource = new Resource<>(release); releaseResources.add(releaseResource); } Resources<Resource> resources = new Resources<>(releaseResources); return new ResponseEntity<>(resources, HttpStatus.OK); }
Source:
public static BlobProperties getBlobPropertiesFromStream(DataInputStream stream) throws IOException { long version = stream.readShort(); BlobProperties toReturn; if (version == Version1 || version == Version2) { long ttl = stream.readLong(); boolean isPrivate = stream.readByte() == 1 ? true : false; long creationTime = stream.readLong(); long blobSize = stream.readLong(); String contentType = Utils.readIntString(stream); String ownerId = Utils.readIntString(stream); String serviceId = Utils.readIntString(stream); if (version == Version1) { toReturn = new SystemMetadata(blobSize, serviceId, ownerId, contentType, isPrivate, ttl, creationTime); } else { short accountId = stream.readShort(); short containerId = stream.readShort(); short issuerAccountId = stream.readShort(); toReturn = new SystemMetadata(blobSize, serviceId, ownerId, contentType, isPrivate, ttl, creationTime, accountId, containerId, issuerAccountId); } } else { throw new IllegalArgumentException("stream has unknown blob property version " + version); } return toReturn; }

Target:
public static BlobProperties getBlobPropertiesFromStream(DataInputStream stream) throws IOException { short version = stream.readShort(); BlobProperties toReturn; long ttl = stream.readLong(); boolean isPrivate = stream.readByte() == 1; long creationTime = stream.readLong(); long blobSize = stream.readLong(); String contentType = Utils.readIntString(stream); String ownerId = Utils.readIntString(stream); String serviceId = Utils.readIntString(stream); switch (version) { case Version1: toReturn = new BlobProperties(blobSize, serviceId, ownerId, contentType, isPrivate, ttl, creationTime); break; case Version2: short accountId = stream.readShort(); short containerId = stream.readShort(); short issuerAccountId = stream.readShort(); toReturn = new BlobProperties(blobSize, serviceId, ownerId, contentType, isPrivate, ttl, creationTime, accountId, containerId, issuerAccountId); break; default: throw new IllegalArgumentException("stream has unknown blob property version " + version); } return toReturn; }
Source:
public Optional<Profession> getProfession() { return profession; }

Target:
private Optional<Profession> getProfession() { return this.profession; }
Source:
private boolean handleIntent(Intent intent) { Uri data = intent.getData(); if (data != null && data.getScheme().equals(CALLBACK_URI.getScheme()) && data.getHost().equals(CALLBACK_URI.getHost())) { Uri uri = Uri.parse(TOKEN_URL) .buildUpon() .appendQueryParameter(PARAM_CLIENT_ID, BuildConfig.CLIENT_ID) .appendQueryParameter(PARAM_CLIENT_SECRET, BuildConfig.CLIENT_SECRET) .appendQueryParameter(PARAM_CODE, data.getQueryParameter(PARAM_CODE)) .build(); new FetchTokenTask(uri).schedule(); return true; } super.onNewIntent(intent); return false; }

Target:
private boolean handleIntent(Intent intent) { Uri data = intent.getData(); if (data != null && data.getScheme().equals(CALLBACK_URI.getScheme()) && data.getHost().equals(CALLBACK_URI.getHost())) { Uri uri = Uri.parse(TOKEN_URL) .buildUpon() .appendQueryParameter(PARAM_CLIENT_ID, BuildConfig.CLIENT_ID) .appendQueryParameter(PARAM_CLIENT_SECRET, BuildConfig.CLIENT_SECRET) .appendQueryParameter(PARAM_CODE, data.getQueryParameter(PARAM_CODE)) .build(); new FetchTokenTask(uri).schedule(); return true; } return false; }
Source:
public EntitlementDTOTest() { super(EntitlementDTO.class); this.values = new HashMap<String, Object>(); OwnerDTO owner = new OwnerDTO(); owner.setId("owner_id"); owner.setKey("owner_key"); owner.setDisplayName("owner_name"); owner.setContentPrefix("content_prefix"); owner.setDefaultServiceLevel("service_level"); owner.setLogLevel("log_level"); owner.setAutobindDisabled(true); owner.setContentAccessMode("content_access_mode"); owner.setContentAccessModeList("content_access_mode_list"); PoolDTO pool = new PoolDTO(); pool.setId("pool_id"); pool.setProductId("pool_product_id"); pool.setProductName("pool_product_name"); ConsumerDTO consumer = new ConsumerDTO(); consumer.setId("consumer_id"); consumer.setName("consumer_name"); consumer.setUsername("consumer_username"); consumer.setType(new ConsumerTypeDTO()); Set<CertificateDTO> certs = new HashSet<CertificateDTO>(); CertificateDTO certificate = new CertificateDTO(); certificate.setId("cert-id"); certificate.setKey("cert-key"); certificate.setCert("cert"); certificate.setSerial(new CertificateSerialDTO()); certs.add(certificate); this.values.put("Id", "test-id"); this.values.put("Owner", owner); this.values.put("Pool", pool); this.values.put("Consumer", consumer); this.values.put("Quantity", 1); this.values.put("DeletedFromPool", false); this.values.put("Certificates", certs); this.values.put("StartDate", new Date()); this.values.put("EndDate", new Date()); this.values.put("Created", new Date()); this.values.put("Updated", new Date()); }

Target:
public EntitlementDTOTest() { super(EntitlementDTO.class); this.values = new HashMap<String, Object>(); OwnerDTO owner = new OwnerDTO(); owner.setId("owner_id"); owner.setKey("owner_key"); owner.setDisplayName("owner_name"); owner.setContentPrefix("content_prefix"); owner.setDefaultServiceLevel("service_level"); owner.setLogLevel("log_level"); owner.setAutobindDisabled(true); owner.setContentAccessMode("content_access_mode"); owner.setContentAccessModeList("content_access_mode_list"); PoolDTO pool = new PoolDTO(); pool.setId("pool_id"); pool.setProductId("pool_product_id"); pool.setProductName("pool_product_name"); ConsumerDTO consumer = new ConsumerDTO(); consumer.setId("consumer_id"); consumer.setUuid("consumer_uuid"); consumer.setName("consumer_name"); consumer.setUsername("consumer_username"); consumer.setType(new ConsumerTypeDTO()); Set<CertificateDTO> certs = new HashSet<CertificateDTO>(); CertificateDTO certificate = new CertificateDTO(); certificate.setId("cert-id"); certificate.setKey("cert-key"); certificate.setCert("cert"); certificate.setSerial(new CertificateSerialDTO()); certs.add(certificate); this.values.put("Id", "test-id"); this.values.put("Owner", owner); this.values.put("Pool", pool); this.values.put("Consumer", consumer); this.values.put("Quantity", 1); this.values.put("DeletedFromPool", false); this.values.put("Certificates", certs); this.values.put("StartDate", new Date()); this.values.put("EndDate", new Date()); this.values.put("Created", new Date()); this.values.put("Updated", new Date()); }
Source:
public synchronized void start() { if (state != ACTIVATED) { return; } state = STARTING; manager.sendEvent(new ComponentEvent(ComponentEvent.STARTING_COMPONENT, this)); try { if (component != null) { Object ci = component.getInstance(); if (ci instanceof Component) { ((Component) ci).start(component); } } log.trace("Component started: {}", name); state = STARTED; manager.sendEvent(new ComponentEvent(ComponentEvent.COMPONENT_STARTED, this)); } catch (RuntimeException e) { log.error(String.format("Component %s notification of application started failed: %s", component.getName(), e.getMessage()), e); state = START_FAILURE; } }

Target:
public synchronized void start() { if (state != ACTIVATED) { return; } state = STARTING; manager.sendEvent(new ComponentEvent(ComponentEvent.STARTING_COMPONENT, this)); try { if (component != null) { Object ci = component.getInstance(); if (ci instanceof Component) { ((Component) ci).start(component); } } log.debug("Component started: {}", name); state = STARTED; manager.sendEvent(new ComponentEvent(ComponentEvent.COMPONENT_STARTED, this)); } catch (RuntimeException e) { log.error(String.format("Component %s notification of application started failed: %s", component.getName(), e.getMessage()), e); state = START_FAILURE; } }
Source:
public void handleDataDeleted(String dataPath) throws Exception { throw new SamzaException("version update path has been deleted!."); }

Target:
public void handleDataDeleted(String dataPath) throws Exception { throw new SamzaException("version update path has been deleted!"); }
Source:
public CoAPConnectedLightingDiscovery() throws IllegalArgumentException { super(SUPPORTED_THING_TYPES_UIDS, 10); }

Target:
public CoAPConnectedLightingDiscovery() { super(SUPPORTED_THING_TYPES_UIDS, 10); }
Source:
protected Object visitBindExpression(BindExpression node, Object context) { List<Object> values = node.getValues().stream() .map(value -> process(value, context)) .collect(toImmutableList()); Object function = process(node.getFunction(), context); if (hasUnresolvedValue(values) || hasUnresolvedValue(function)) { ImmutableList.Builder builder = ImmutableList.builder(); for (int i = 0; i < values.size(); i++) { builder.add(toExpression(values.get(i), expressionTypes.get(node.getValues().get(i)))); } return new BindExpression( builder.build(), toExpression(function, expressionTypes.get(node.getFunction()))); } return MethodHandles.insertArguments((MethodHandle) function, 0, values.toArray()); }

Target:
protected Object visitBindExpression(BindExpression node, Object context) { List<Object> values = node.getValues().stream() .map(value -> process(value, context)) .collect(toImmutableList()); Object function = process(node.getFunction(), context); if (hasUnresolvedValue(values) || hasUnresolvedValue(function)) { ImmutableList.Builder<Expression> builder = ImmutableList.builder(); for (int i = 0; i < values.size(); i++) { builder.add(toExpression(values.get(i), type(node.getValues().get(i)))); } return new BindExpression( builder.build(), toExpression(function, type(node.getFunction()))); } return MethodHandles.insertArguments((MethodHandle) function, 0, values.toArray()); }
Source:
public QueueQueryImpl(final boolean durable, final boolean temporary, final int consumerCount, final long messageCount, final SimpleString filterString, final SimpleString address, final SimpleString name, final boolean exists, final boolean autoCreateQueues) { this(durable, temporary, consumerCount, messageCount, filterString, address, name, exists, autoCreateQueues, -1, false, false, RoutingType.MULTICAST, null, null, null, null, null, null, null, null, null, null, null, null, null, null); }

Target:
public QueueQueryImpl(final boolean durable, final boolean temporary, final int consumerCount, final long messageCount, final SimpleString filterString, final SimpleString address, final SimpleString name, final boolean exists, final boolean autoCreateQueues) { this(durable, temporary, consumerCount, messageCount, filterString, address, name, exists, autoCreateQueues, -1, false, false, RoutingType.MULTICAST); }
Source:
protected void updateStatsRow(Object rowKey, Object[] rowValues) { long leader; List<Long> sites = new ArrayList<Long>(); if (rowKey.equals(MpInitiator.MP_INIT_PID)) { leader = getHSIdForMultiPartitionInitiator(); sites.add(leader); } else { if (!m_iv2Masters.pointInTimeCache().containsKey(rowKey)) { return; } leader = m_iv2Masters.pointInTimeCache().get(rowKey); sites.addAll(getReplicasForPartition((Integer)rowKey)); } rowValues[columnNameToIndex.get("Partition")] = rowKey; rowValues[columnNameToIndex.get("Sites")] = CoreUtils.hsIdCollectionToString(sites); rowValues[columnNameToIndex.get("Leader")] = CoreUtils.hsIdToString(leader); }

Target:
protected void updateStatsRow(Object rowKey, Object[] rowValues) { long leader; List<Long> sites = new ArrayList<Long>(); if (rowKey.equals(MpInitiator.MP_INIT_PID)) { leader = getHSIdForMultiPartitionInitiator(); sites.add(leader); } else { Long leaderInCache = m_iv2Masters.pointInTimeCache().get(rowKey); if (leaderInCache == null) { return; } leader = leaderInCache; sites.addAll(getReplicasForPartition((Integer)rowKey)); } rowValues[columnNameToIndex.get("Partition")] = rowKey; rowValues[columnNameToIndex.get("Sites")] = CoreUtils.hsIdCollectionToString(sites); rowValues[columnNameToIndex.get("Leader")] = CoreUtils.hsIdToString(leader); }
Source:
public TaskCounts getTaskCounts(String jobId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { JobGetTaskCountsOptions options = new JobGetTaskCountsOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.applyRequestBehaviors(options); return this.parentBatchClient.protocolLayer().jobs().getTaskCounts(jobId, options).taskCounts(); }

Target:
public TaskCounts getTaskCounts(String jobId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { return getTaskCountsResult(jobId, additionalBehaviors).taskCounts(); }
Source:
public void throwsCatchedException() { new Runnable() { @Override @Parallel(threads = ParallelizerTest.COUNT) public void run() { throw new IllegalArgumentException(); } } .run(); }

Target:
public void throwsCatchedException() { new Runnable() { @Override @Parallel(threads = Tv.TEN) public void run() { throw new IllegalArgumentException(); } } .run(); }
Source:
public StreamlineEvent entity(Result result) { Map<String, Object> fieldsAndValues = new HashMap<>(); for(Map.Entry<byte[], byte[]> entry: result.getFamilyMap(CF_FIELDS).entrySet()) { fieldsAndValues.put(Bytes.toString(entry.getKey()), Bytes.toString(entry.getValue())); } String dataSourceId = Bytes.toString(result.getFamilyMap(CF_DATASOURCE_ID).firstEntry().getKey()); return StreamlineEventImpl.builder().fieldsAndValues(fieldsAndValues).dataSourceId(dataSourceId).build(); }

Target:
public StreamlineEvent entity(Result result) { String id = Bytes.toString(result.getRow()); Map<String, Object> fieldsAndValues = new HashMap<>(); for(Map.Entry<byte[], byte[]> entry: result.getFamilyMap(CF_FIELDS).entrySet()) { fieldsAndValues.put(Bytes.toString(entry.getKey()), Bytes.toString(entry.getValue())); } String dataSourceId = Bytes.toString(result.getFamilyMap(CF_DATASOURCE_ID).firstEntry().getKey()); StreamlineEventImpl event = StreamlineEventImpl.builder().fieldsAndValues(fieldsAndValues).dataSourceId(dataSourceId).build(); return new StreamlineEventWithID(event, id); }
Source:
private void resolveParents(ClassDef classDef) { Symbol symbol = classDef.name().symbol(); if (symbol == null || !Symbol.Kind.CLASS.equals(symbol.kind())) { return; } ClassSymbolImpl classSymbol = (ClassSymbolImpl) symbol; if (hasMultipleBindingUsages(classSymbol)) { classSymbol.setKind(Symbol.Kind.OTHER); return; } ArgList argList = classDef.args(); classSymbol.hasUnresolvedParents = false; if (argList == null) { return; } for (Argument argument : argList.arguments()) { if (!argument.is(Kind.REGULAR_ARGUMENT) || !(((RegularArgument) argument).expression() instanceof HasSymbol)) { classSymbol.hasUnresolvedParents = true; return; } Symbol parentSymbol = ((HasSymbol) ((RegularArgument) argument).expression()).symbol(); if (parentSymbol == null) { classSymbol.hasUnresolvedParents = true; return; } if (hasMultipleBindingUsages(parentSymbol)) { classSymbol.hasUnresolvedParents = true; return; } if (parentSymbol.fullyQualifiedName() != null && BuiltinSymbols.all().contains(parentSymbol.fullyQualifiedName())) { if (!classSymbol.parents().contains(parentSymbol)) { classSymbol.addParent(parentSymbol); } continue; } if (!Symbol.Kind.CLASS.equals(parentSymbol.kind())) { classSymbol.hasUnresolvedParents = true; return; } classSymbol.addParent(parentSymbol); } }

Target:
private void resolveParents(ClassDef classDef) { Symbol symbol = classDef.name().symbol(); if (symbol == null || !Symbol.Kind.CLASS.equals(symbol.kind())) { return; } ClassSymbolImpl classSymbol = (ClassSymbolImpl) symbol; ArgList argList = classDef.args(); classSymbol.setHasUnresolvedParents(false); if (argList == null) { return; } for (Argument argument : argList.arguments()) { if (!argument.is(Kind.REGULAR_ARGUMENT) || !(((RegularArgument) argument).expression() instanceof HasSymbol)) { classSymbol.setHasUnresolvedParents(true); return; } Symbol parentSymbol = ((HasSymbol) ((RegularArgument) argument).expression()).symbol(); if (parentSymbol == null) { classSymbol.setHasUnresolvedParents(true); return; } if (BuiltinSymbols.all().contains(parentSymbol.fullyQualifiedName())) { classSymbol.addParent(parentSymbol); continue; } if (!Symbol.Kind.CLASS.equals(parentSymbol.kind())) { classSymbol.setHasUnresolvedParents(true); return; } classSymbol.addParent(parentSymbol); } }
Source:
private Future<Void> initializeCredentials(Future<Credentials> credentialsFuture) throws IOException { final Credentials credentials = get(credentialsFuture, "Cloud not initialize credentials"); Future<Void> clientAuthInterceptorFuture = null; if (credentials != null) { if (credentials instanceof OAuth2Credentials) { final RefreshingOAuth2CredentialsInterceptor oauth2Interceptor = new RefreshingOAuth2CredentialsInterceptor(batchPool, (OAuth2Credentials) credentials); clientAuthInterceptorFuture = batchPool.submit(new Callable<Void>() { @Override public Void call() throws Exception { oauth2Interceptor.syncRefresh(); return null; } }); this.clientAuthInterceptor = oauth2Interceptor; } else { this.clientAuthInterceptor = new ClientAuthInterceptor(credentials, batchPool); clientAuthInterceptorFuture = batchPool.submit(new Callable<Void>() { @Override public Void call() throws Exception { credentials.refresh(); return null; } }); } } else { this.clientAuthInterceptor = null; } return clientAuthInterceptorFuture; }

Target:
private Future<Void> initializeCredentials(Future<Credentials> credentialsFuture) throws IOException { final Credentials credentials = get(credentialsFuture, "Cloud not initialize credentials"); Future<Void> credentialRefreshFuture = null; if (credentials != null) { if (credentials instanceof OAuth2Credentials) { final RefreshingOAuth2CredentialsInterceptor oauth2Interceptor = new RefreshingOAuth2CredentialsInterceptor(batchPool, (OAuth2Credentials) credentials); credentialRefreshFuture = batchPool.submit(new Callable<Void>() { @Override public Void call() throws Exception { oauth2Interceptor.syncRefresh(); return null; } }); this.clientAuthInterceptor = oauth2Interceptor; } else { this.clientAuthInterceptor = new ClientAuthInterceptor(credentials, batchPool); credentialRefreshFuture = batchPool.submit(new Callable<Void>() { @Override public Void call() throws Exception { credentials.refresh(); return null; } }); } } else { this.clientAuthInterceptor = null; } return credentialRefreshFuture; }
Source:
private @Nullable Index checkIndexPresence(Index curIdx) throws IgniteCheckedException { IndexColumn[] curColumns = curIdx.getIndexColumns(); Index registredIdx = null; for (Index idx : idxs) { if (!(idx instanceof H2TreeIndex)) continue; if (F.eq(curIdx.getName(), idx.getName())) throw new IgniteCheckedException("Index already exists: " + idx.getName()); IndexColumn[] idxColumns = idx.getIndexColumns(); if (idxColumns.length == curColumns.length) { boolean copy = true; for (IndexColumn idxCol : idxColumns) { registredIdx = null; for (IndexColumn curCol : curColumns) { if (F.eq(aliasNameTransformer(idxCol), aliasNameTransformer(curCol)) && idxCol.sortType == curCol.sortType) registredIdx = idx; } if (registredIdx == null) { copy = false; break; } } if (copy) return registredIdx; } } return null; }

Target:
private @Nullable Index checkIndexPresence(Index curIdx) throws IgniteCheckedException { IndexColumn[] curColumns = curIdx.getIndexColumns(); Index registredIdx = null; for (Index idx : idxs) { if (!(idx instanceof H2TreeIndex)) continue; if (F.eq(curIdx.getName(), idx.getName())) throw new IgniteCheckedException("Index already exists: " + idx.getName()); IndexColumn[] idxColumns = idx.getIndexColumns(); for (int i = 0; i < Math.min(idxColumns.length, curColumns.length); ++i) { IndexColumn idxCol = idxColumns[i]; IndexColumn curCol = curColumns[i]; if (curCol.column.getColumnId() == 0 && registredIdx != null) continue; if (H2Utils.equals(idxCol, curCol) && idxCol.sortType == curCol.sortType) registredIdx = idx; else { registredIdx = null; break; } } if (registredIdx != null) return registredIdx; } return null; }
Source:
private List<SignedCertificateTimestamp> getSCTsFromSCTList(byte[] data, SignedCertificateTimestamp.Origin origin) { if (data == null) { return Collections.EMPTY_LIST; } byte[][] sctList; try { sctList = Serialization.readList(data, 2, 2); } catch (SerializationException e) { return Collections.EMPTY_LIST; } List<SignedCertificateTimestamp> scts = new ArrayList(); for (byte[] encodedSCT: sctList) { try { SignedCertificateTimestamp sct = SignedCertificateTimestamp.decode(encodedSCT, origin); scts.add(sct); } catch (SerializationException e) { } } return scts; }

Target:
private List<SignedCertificateTimestamp> getSCTsFromSCTList(byte[] data, SignedCertificateTimestamp.Origin origin) { if (data == null) { return Collections.EMPTY_LIST; } byte[][] sctList; try { sctList = Serialization.readList(data, CTConstants.SCT_LIST_LENGTH_BYTES, CTConstants.SERIALIZED_SCT_LENGTH_BYTES); } catch (SerializationException e) { return Collections.EMPTY_LIST; } List<SignedCertificateTimestamp> scts = new ArrayList(); for (byte[] encodedSCT: sctList) { try { SignedCertificateTimestamp sct = SignedCertificateTimestamp.decode(encodedSCT, origin); scts.add(sct); } catch (SerializationException e) { } } return scts; }
Source:
public CoreClusterMember leaderTx( BiConsumer<CoreGraphDatabase,Transaction> op, int timeout, TimeUnit timeUnit ) throws Exception { ThrowingSupplier<CoreClusterMember,Exception> supplier = () -> { CoreClusterMember member = awaitLeader( timeout, timeUnit ); CoreGraphDatabase db = member.database(); if ( db == null ) { throw new DatabaseShutdownException(); } try ( Transaction tx = db.beginTx() ) { op.accept( db, tx ); return member; } catch ( Throwable e ) { if ( isTransientFailure( e ) ) { System.err.println( "Transient failure in leader transaction, trying again." ); e.printStackTrace(); return null; } else { throw e; } } }; return awaitEx( supplier, notNull()::test, timeout, timeUnit ); }

Target:
private CoreClusterMember leaderTx( BiConsumer<CoreGraphDatabase,Transaction> op, int timeout, TimeUnit timeUnit ) throws Exception { ThrowingSupplier<CoreClusterMember,Exception> supplier = () -> { CoreClusterMember member = awaitLeader( timeout, timeUnit ); CoreGraphDatabase db = member.database(); if ( db == null ) { throw new DatabaseShutdownException(); } try ( Transaction tx = db.beginTx() ) { op.accept( db, tx ); return member; } catch ( Throwable e ) { if ( isTransientFailure( e ) ) { System.err.println( "Transient failure in leader transaction, trying again." ); e.printStackTrace(); return null; } else { throw e; } } }; return awaitEx( supplier, notNull()::test, timeout, timeUnit ); }
Source:
public Map<VariableReferenceExpression, VariableReferenceExpression> visitProject(ProjectNode node, Set<VariableReferenceExpression> lookupVariables) { Map<VariableReferenceExpression, VariableReferenceExpression> directVariableTranslationOutputMap = Maps.transformEntries( Maps.filterValues( node.getAssignments().getMap(), IndexKeyTracer::isVariable), this::extractVariable); Map<VariableReferenceExpression, VariableReferenceExpression> outputToSourceMap = lookupVariables.stream() .filter(directVariableTranslationOutputMap.keySet()::contains) .collect(toImmutableMap(identity(), variable -> directVariableTranslationOutputMap.get(variable))); checkState(!outputToSourceMap.isEmpty(), "No lookup variables were able to pass through the projection"); Map<VariableReferenceExpression, VariableReferenceExpression> sourceToIndexMap = node.getSource().accept(this, ImmutableSet.copyOf(outputToSourceMap.values())); Map<VariableReferenceExpression, VariableReferenceExpression> outputToIndexMap = Maps.transformValues(Maps.filterValues(outputToSourceMap, in(sourceToIndexMap.keySet())), Functions.forMap(sourceToIndexMap)); return ImmutableMap.copyOf(outputToIndexMap); }

Target:
public Map<VariableReferenceExpression, VariableReferenceExpression> visitProject(ProjectNode node, Set<VariableReferenceExpression> lookupVariables) { Map<VariableReferenceExpression, VariableReferenceExpression> directVariableTranslationOutputMap = Maps.transformEntries( Maps.filterValues(node.getAssignments().getMap(), IndexKeyTracer::isVariable), IndexKeyTracer::extractVariable); Map<VariableReferenceExpression, VariableReferenceExpression> outputToSourceMap = lookupVariables.stream() .filter(directVariableTranslationOutputMap.keySet()::contains) .collect(toImmutableMap(identity(), variable -> directVariableTranslationOutputMap.get(variable))); checkState(!outputToSourceMap.isEmpty(), "No lookup variables were able to pass through the projection"); Map<VariableReferenceExpression, VariableReferenceExpression> sourceToIndexMap = node.getSource().accept(this, ImmutableSet.copyOf(outputToSourceMap.values())); Map<VariableReferenceExpression, VariableReferenceExpression> outputToIndexMap = Maps.transformValues(Maps.filterValues(outputToSourceMap, in(sourceToIndexMap.keySet())), Functions.forMap(sourceToIndexMap)); return ImmutableMap.copyOf(outputToIndexMap); }
Source:
public void run(IAction action) { System.out.println("**** BEGIN DUMP JOB MANAGER INFORMATION ****"); IJobManager jobManager = Job.getJobManager(); Job[] jobs = jobManager.find(null); for (int i = 0; i < jobs.length; i++) { System.out.println("" + jobs[i].getClass().getName() + " state: " + JobManager.printState(jobs[i].getState())); } System.out.println("**** END DUMP JOB MANAGER INFORMATION ****"); }

Target:
public void run(IAction action) { System.out.println("**** BEGIN DUMP JOB MANAGER INFORMATION ****"); Job[] jobs = Job.getJobManager().find(null); for (int i = 0; i < jobs.length; i++) { System.out.println("" + jobs[i].getClass().getName() + " state: " + JobManager.printState(jobs[i].getState())); } System.out.println("**** END DUMP JOB MANAGER INFORMATION ****"); }
Source:
public int[] getAdnRecordsSize(int efid) { if (DBG) logd("getAdnRecordsSize: efid=" + efid); synchronized(mLock) { checkThread(); recordSize = new int[3]; Message response = mBaseHandler.obtainMessage(EVENT_GET_SIZE_DONE); ((RuimFileHandler)phone.getIccFileHandler()).getEFLinearRecordSize(efid, response); try { mLock.wait(); } catch (InterruptedException e) { logd("interrupted while trying to load from the RUIM"); } } return recordSize; }

Target:
public int[] getAdnRecordsSize(int efid) { if (DBG) logd("getAdnRecordsSize: efid=" + efid); synchronized(mLock) { checkThread(); recordSize = new int[3]; Message response = mBaseHandler.obtainMessage(EVENT_GET_SIZE_DONE); phone.getIccFileHandler().getEFLinearRecordSize(efid, response); try { mLock.wait(); } catch (InterruptedException e) { logd("interrupted while trying to load from the RUIM"); } } return recordSize; }