auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean hasConflictingAccount(Collection<Account> accountsToSet, AccountInfoMap accountInfoMap) { boolean res = false; for (Account account : accountsToSet) { Account accountInMap = accountInfoMap.getAccountById(account.getId()); if (accountInMap != null && account.getSnapshotVersion() != accountInMap.getSnapshotVersion()) { logger.error( "Account to update (accountId={} accountName={}) has an unexpected snapshot version in zk (expected={}, encountered={})", account.getId(), account.getName(), account.getSnapshotVersion(), accountInMap.getSnapshotVersion()); res = true; } Account potentialConflict = accountInfoMap.getAccountByName(account.getName()); if (potentialConflict != null && potentialConflict.getId() != account.getId()) { logger.error( "Account to update (accountId={} accountName={}) conflicts with an existing record (accountId={} accountName={})", account.getId(), account.getName(), potentialConflict.getId(), potentialConflict.getName()); res = true; } } return res; }

Target:
private boolean hasConflictingAccount(Collection<Account> accountsToSet, AccountInfoMap accountInfoMap) { for (Account account : accountsToSet) { Account accountInMap = accountInfoMap.getAccountById(account.getId()); if (accountInMap != null && account.getSnapshotVersion() != accountInMap.getSnapshotVersion()) { logger.error( "Account to update (accountId={} accountName={}) has an unexpected snapshot version in zk (expected={}, encountered={})", account.getId(), account.getName(), account.getSnapshotVersion(), accountInMap.getSnapshotVersion()); return true; } Account potentialConflict = accountInfoMap.getAccountByName(account.getName()); if (potentialConflict != null && potentialConflict.getId() != account.getId()) { logger.error( "Account to update (accountId={} accountName={}) conflicts with an existing record (accountId={} accountName={})", account.getId(), account.getName(), potentialConflict.getId(), potentialConflict.getName()); return true; } } return false; }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_event_bus); final EventBus eventBus = ((SamplesApplication) getApplication()).getEventBus(); final TextView textView = (TextView) findViewById(android.R.id.text1); subscription = eventBus.subscribe(EventQueue.STRING_QUEUE, new Subscriber<String>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { } @Override public void onNext(String s) { textView.setText(s); } }); startService(new Intent(this, EventGeneratorService.class)); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_event_bus); final EventBus eventBus = ((SamplesApplication) getApplication()).getEventBus(); final TextView textView = (TextView) findViewById(android.R.id.text1); subscription = eventBus.subscribe(Events.STRING_QUEUE, new Subscriber<String>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { } @Override public void onNext(String s) { textView.setText(s); } }); startService(new Intent(this, EventGeneratorService.class)); }
Source:
@Override String readValue(Buffer buffer, int length) { length *= 2; if (length > 32) { throw new AssertionError("hex field greater than 32 chars long: " + length); } char[] result = THIRTY_TWO_CHARS.get(); for (int i = 0; i < length; i += 2) { byte b = buffer.readByte(); result[i + 0] = HEX_DIGITS[(b >> 4) & 0xf]; result[i + 1] = HEX_DIGITS[b & 0xf]; } return new String(result, 0, length); }

Target:
@Override String readValue(Buffer buffer, int length) { length *= 2; if (length > 32) { throw new IllegalArgumentException("hex field greater than 32 chars long: " + length); } char[] result = Platform.get().idBuffer(); for (int i = 0; i < length; i += 2) { byte b = buffer.readByte(); result[i + 0] = HEX_DIGITS[(b >> 4) & 0xf]; result[i + 1] = HEX_DIGITS[b & 0xf]; } return new String(result, 0, length); }
Source:
private String determineCustomerProfileSubUnitCode(PaymentGroup pdpPaymentGroup) { CustomerProfile customerProfile = null; String subUnitCode = KFSConstants.EMPTY_STRING; if (ObjectUtils.isNotNull(pdpPaymentGroup.getBatch())) { customerProfile = pdpPaymentGroup.getBatch().getCustomerProfile(); if (ObjectUtils.isNotNull(customerProfile)) { if (ObjectUtils.isNotNull(customerProfile.getSubUnitCode())) { subUnitCode = customerProfile.getSubUnitCode(); LOG.info("determineCustomerProfileSubUnitCode: subUnitCode = " + subUnitCode); } else { LOG.info("determineCustomerProfileSubUnitCode: No subUnitCode could be determined for customerProfile.customerShortName = " + customerProfile.getCustomerShortName()); } } else { LOG.info("determineCustomerProfileSubUnitCode: No customer profile exists for payee name = " + pdpPaymentGroup.getPayeeName()); } } else { LOG.info("determineCustomerProfileSubUnitCode: pdpPaymemtGroup.getBatch() detected as NULL."); } return subUnitCode; }

Target:
private String determineCustomerProfileSubUnitCode(PaymentGroup pdpPaymentGroup) { CustomerProfile customerProfile = null; String subUnitCode = KFSConstants.EMPTY_STRING; if (ObjectUtils.isNotNull(pdpPaymentGroup.getBatch())) { customerProfile = pdpPaymentGroup.getBatch().getCustomerProfile(); if (ObjectUtils.isNotNull(customerProfile)) { if (ObjectUtils.isNotNull(customerProfile.getSubUnitCode())) { subUnitCode = customerProfile.getSubUnitCode(); LOG.info("determineCustomerProfileSubUnitCode: subUnitCode = " + subUnitCode); } else { LOG.info("determineCustomerProfileSubUnitCode: No subUnitCode could be determined for customerProfile.customerShortName = " + customerProfile.getCustomerShortName()); } } else { LOG.info("determineCustomerProfileSubUnitCode: No customer profile exists for payee name = " + pdpPaymentGroup.getPayeeName()); } } else { LOG.info("determineCustomerProfileSubUnitCode: pdpPaymentGroup.getBatch() detected as NULL."); } return subUnitCode; }
Source:
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { Authentication result = null; for (final Authenticator authenticator : authenticatorsRegistry.get()) { final AuthenticationSupplier authenticationSupplier = authenticator.getAuthenticationSupplier(); logger.debug("Authentication supplier attempt using {}", authenticationSupplier.getClass() .getName()); final Authentication authentication = authenticationSupplier.supply(request); if (authentication == null) { logger.debug("Unable to get an authentication instance using {}", authenticationSupplier.getClass() .getName()); continue; } final AuthenticationProvider authenticationProvider = authenticator.getAuthenticationProvider(); logger.debug("Authentication provider attempt using {}", authenticationProvider.getClass() .getName()); try { result = authenticationProvider.authenticate(authentication); if (result != null) { SecurityContextHolder.getContext() .setAuthentication(result); logger.debug("Authentication success using {}", authenticationProvider.getClass() .getName()); break; } } catch (AuthenticationException e) { logger.debug("Authentication request failed", e); continue; } } filterChain.doFilter(request, response); }

Target:
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { Authentication result = null; for (final Authenticator authenticator : authenticatorsRegistry) { final AuthenticationSupplier authenticationSupplier = authenticator.getAuthenticationSupplier(); logger.debug("Authentication supplier attempt using {}", authenticationSupplier.getClass() .getName()); final Authentication authentication = authenticationSupplier.supply(request); if (authentication == null) { logger.debug("Unable to get an authentication instance using {}", authenticationSupplier.getClass() .getName()); continue; } final AuthenticationProvider authenticationProvider = authenticator.getAuthenticationProvider(); logger.debug("Authentication provider attempt using {}", authenticationProvider.getClass() .getName()); try { result = authenticationProvider.authenticate(authentication); if (result != null) { SecurityContextHolder.getContext() .setAuthentication(result); logger.debug("Authentication success using {}", authenticationProvider.getClass() .getName()); break; } } catch (AuthenticationException e) { logger.debug("Authentication request failed", e); continue; } } filterChain.doFilter(request, response); }
Source:
public Subscriber<? super T> call(Subscriber<? super T> child) { final SerialSubscription ssub = new SerialSubscription(); final SwitchIfEmptySubscriber parent = new SwitchIfEmptySubscriber(child, ssub); ssub.set(parent); child.add(ssub); child.setProducer(new Producer() { @Override public void request(long n) { parent.requestMore(n); }}); return parent; }

Target:
public Subscriber<? super T> call(Subscriber<? super T> child) { final SerialSubscription ssub = new SerialSubscription(); ProducerArbiter arbiter = new ProducerArbiter(); final ParentSubscriber<T> parent = new ParentSubscriber<T>(child, ssub, arbiter, alternate); ssub.set(parent); child.add(ssub); child.setProducer(arbiter); return parent; }
Source:
public void should_create_job_with_custom_workspace() { String jobName = "MyJob"; String customWorkspace = "/tmp/my-workspace"; String jobDslScript = String.format("job('%s') { customWorkspace('%s') }", jobName, customWorkspace); Job seed = createSeedJobWithJobDsl(jobDslScript); seed.startBuild().waitUntilFinished(); Job job = jenkins.jobs.get(Job.class, jobName); Build build = job.startBuild().waitUntilFinished(); assertTrue(build.getConsole().contains(customWorkspace)); }

Target:
public void should_create_job_with_custom_workspace() { String jobName = "MyJob"; String customWorkspace = "/tmp/my-workspace"; String jobDslScript = String.format("job('%s') { customWorkspace('%s') }", jobName, customWorkspace); Job seed = createSeedJobWithJobDsl(jobDslScript); seed.startBuild().waitUntilFinished(); Job job = jenkins.jobs.get(Job.class, jobName); Build build = job.startBuild().waitUntilFinished(); assertThat(build.getConsole(), containsString(customWorkspace)); }
Source:
public void stopTransport() { if (transport != null && transportStatus == ComponentStatus.RUNNING) transport.stop(); transportStatus = ComponentStatus.TERMINATED; try { unregisterServerMBeans(); } catch (Exception e) { throw new CacheException(e); } }

Target:
public void stopTransport() { if (transport != null && transportStatus == ComponentStatus.RUNNING) { transport.stop(); transportStatus = ComponentStatus.TERMINATED; try { unregisterServerMBeans(); } catch (Exception e) { throw new CacheException(e); } } }
Source:
protected Object doExecute() throws Exception { printInitCommand("Create Static Route"); try { IResource router = getResourceFromFriendlyName(resourceId); StaticRouteCapability staticRouteCapability=(StaticRouteCapability) router.getCapabilitiesByInterface(IStaticRouteCapability.class); staticRouteCapability.createStaticRoute(netIdIpAdress, maskIpAdress, nextHopIpAddress); } catch (ResourceException e) { printError(e); printEndCommand(); return -1; } catch (Exception e) { printError("Error creating Static route."); printError(e); printEndCommand(); return -1; } printEndCommand(); return null; }

Target:
protected Object doExecute() throws Exception { printInitCommand("Create Static Route"); try { IResource router = getResourceFromFriendlyName(resourceId); IStaticRouteCapability staticRouteCapability=(IStaticRouteCapability) router.getCapabilitiesByInterface(IStaticRouteCapability.class); staticRouteCapability.createStaticRoute(netIdIpAdress, maskIpAdress, nextHopIpAddress); } catch (ResourceException e) { printError(e); printEndCommand(); return -1; } catch (Exception e) { printError("Error creating Static route."); printError(e); printEndCommand(); return -1; } printEndCommand(); return null; }
Source:
public void verifyFromModuleHasImages() { List<WebElement> communityImagesList = driver.findElements(fromCommunityImageBy); for (int i = 0; i < communityImagesList.size(); i++) { PageObjectLogging.log("verifyFromModuleHasImages", "Checking image number "+(i+1), true); scrollToElement(communityImagesList.get(i)); waitForElementByElement(communityImagesList.get(i)); } PageObjectLogging.log("verifyFromModuleHasImages", "Verify that from the community module has images", true); }

Target:
public void verifyFromModuleHasImages() { for (WebElement element : fromCommunityImage) { scrollToElement(element); waitForElementByElement(element); } PageObjectLogging.log( "verifyFromModuleHasImages", "Verify that from the community module has images", true ); }
Source:
protected String getExpectedMailContent(DocumentModel documentModel, Event event) { URL url = TestEmailNotification.class.getResource("/templates/dummyExpectedMail.html"); String author = ((String[]) documentModel.getPropertyValue("dc:contributors"))[0]; try { String content = Files.readString(Paths.get(url.toURI())); var model = Map.of("TITLE", documentModel.getTitle(), "CREATION_DATE", EVENT_DATE_FORMAT.format(Date.from(Instant.ofEpochMilli(event.getTime()))), "AUTHOR", author, "LOCATION", documentModel.getPathAsString(), "VERSION", documentModel.getVersionLabel(), "STATE", documentModel.getCurrentLifeCycleState()); return StringUtils.expandVars(content, model).replaceAll("\\n", ""); } catch (URISyntaxException | IOException e) { throw new NuxeoException(e); } }

Target:
protected String getExpectedMailContent(DocumentModel documentModel, Event event) { try { URL url = TestEmailNotification.class.getResource("/templates/dummyExpectedMail.html"); String fileContent = Files.readString(Paths.get(url.toURI())); var model = Map.of("TITLE", documentModel.getTitle(), "CREATION_DATE", EVENT_DATE_FORMAT.format(Date.from(Instant.ofEpochMilli(event.getTime()))), "AUTHOR", ((String[]) documentModel.getPropertyValue("dc:contributors"))[0], "LOCATION", documentModel.getPathAsString(), "VERSION", documentModel.getVersionLabel(), "STATE", documentModel.getCurrentLifeCycleState()); String content = StringUtils.expandVars(fileContent, model); return content.replaceAll("\\n", ""); } catch (URISyntaxException | IOException e) { throw new NuxeoException(e); } }
Source:
public boolean shouldSortOptions() { return shouldSortOptions; }

Target:
boolean shouldSortOptions() { return shouldSortOptions; }
Source:
public void prepareDAG(LogicalPlan dag, StreamingApplication app, String name) { String connectAddress = conf.get(StreamingApplication.DT_PREFIX + Context.DAGContext.GATEWAY_CONNECT_ADDRESS.getName()); dag.setAttribute(Context.DAGContext.GATEWAY_CONNECT_ADDRESS, connectAddress == null ? conf.get(GATEWAY_LISTEN_ADDRESS) : connectAddress); if (app != null) { app.populateDAG(dag, conf); } String appAlias = getAppAlias(name); String appName = appAlias == null ? name : appAlias; List<AppConf> appConfs = stramConf.getMatchingChildConf(appName, StramElement.APPLICATION); setApplicationConfiguration(dag, appConfs, app); if (dag.getAttributes().get(Context.DAGContext.APPLICATION_NAME) == null) { dag.setAttribute(Context.DAGContext.APPLICATION_NAME, appName); } setModuleProperties(dag, appName); flattenDAG(dag, conf); setOperatorConfiguration(dag, appConfs, appName); setStreamConfiguration(dag, appConfs, appName); }

Target:
public void prepareDAG(LogicalPlan dag, StreamingApplication app, String name) { String connectAddress = conf.get(StreamingApplication.DT_PREFIX + Context.DAGContext.GATEWAY_CONNECT_ADDRESS.getName()); dag.setAttribute(Context.DAGContext.GATEWAY_CONNECT_ADDRESS, connectAddress == null ? conf.get(GATEWAY_LISTEN_ADDRESS) : connectAddress); DAGSetupPluginContext context = new DAGSetupPluginContext(dag, this.conf); if (app != null) { pluginManager.dispatch(SETUP, context); pluginManager.dispatch(PRE_POPULATE, context); app.populateDAG(dag, conf); pluginManager.dispatch(POST_POPULATE, context); } pluginManager.dispatch(PRE_CONFIGURE, context); String appAlias = getAppAlias(name); String appName = appAlias == null ? name : appAlias; List<AppConf> appConfs = stramConf.getMatchingChildConf(appName, StramElement.APPLICATION); setApplicationConfiguration(dag, appConfs, app); if (dag.getAttributes().get(Context.DAGContext.APPLICATION_NAME) == null) { dag.setAttribute(Context.DAGContext.APPLICATION_NAME, appName); } setModuleProperties(dag, appName); flattenDAG(dag, conf); setOperatorConfiguration(dag, appConfs, appName); setStreamConfiguration(dag, appConfs, appName); pluginManager.dispatch(POST_CONFIGURE, context); }
Source:
public void close() { logger.trace("Closing the SocketNetworkClient"); closed = true; }

Target:
public void close() { logger.trace("Closing the LocalNetworkClient"); closed = true; }
Source:
public List<Tree.Kind> nodesToVisit() { return ImmutableList.of(Tree.Kind.METHOD); }

Target:
public List<Tree.Kind> nodesToVisit() { return Collections.singletonList(Tree.Kind.METHOD); }
Source:
public ClassifierCompositeItemWriterBuilder classifier(Classifier<T, ItemWriter<? super T>> classifier) { Assert.notNull(classifier, "A classifier is required."); this.classifier = classifier; return this; }

Target:
public ClassifierCompositeItemWriterBuilder<T> classifier(Classifier<T, ItemWriter<? super T>> classifier) { this.classifier = classifier; return this; }
Source:
public Date getDcTermsDate() { return dcTermsDate; }

Target:
public Date getDcTermsDate() { if (dcTermsDate == null) { return dcTermsDate; } return new Date(dcTermsDate.getTime()); }
Source:
public void publishUpdate(String id, boolean isPresent) { for (AKM868BindingProvider provider : providers) { for (String itemName : provider.getItemNames()) { if (provider.getId(itemName).equals(id) && provider.getChannel(itemName).equals("0")) { logger.debug("Publishing state for: "+itemName+" -state: "+provider.getId(itemName)); eventPublisher.postUpdate(itemName, isPresent==true ? OnOffType.ON : OnOffType.OFF); } } } }

Target:
public void publishUpdate(String id, boolean isPresent) { for (AKM868BindingProvider provider : providers) { for (String itemName : provider.getItemNames()) { if (provider.getId(itemName).equals(id) && provider.getChannel(itemName).equals("0")) { logger.debug("Publishing state for - state: ",itemName,provider.getId(itemName)); eventPublisher.postUpdate(itemName, isPresent==true ? OnOffType.ON : OnOffType.OFF); } } } }
Source:
public void testStoreAndQueryAll() { Trace trace1 = new Trace(); trace1.setId("1"); trace1.setStartTime(TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis()) - 4000); List<Trace> traces = new ArrayList<>(); traces.add(trace1); try { tracePublisher.publish(null, traces); } catch (Exception e1) { fail("Failed to store: " + e1); } Wait.until(() -> traceService.searchFragments(null, new Criteria()).size() == 1); List<Trace> result = traceService.searchFragments(null, new Criteria()); assertEquals(1, result.size()); assertEquals("1", result.get(0).getId()); }

Target:
public void testStoreAndQueryAll() { Trace trace1 = new Trace(); trace1.setId("1"); trace1.setStartTime(TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis()) - FOUR_MS_IN_MICRO_SEC); List<Trace> traces = new ArrayList<>(); traces.add(trace1); try { tracePublisher.publish(null, traces); } catch (Exception e1) { fail("Failed to store: " + e1); } Wait.until(() -> traceService.searchFragments(null, new Criteria()).size() == 1); List<Trace> result = traceService.searchFragments(null, new Criteria()); assertEquals(1, result.size()); assertEquals("1", result.get(0).getId()); }
Source:
protected Collection<Event> analyzePosition(Position position) { Device device = Context.getIdentityManager().getDeviceById(position.getDeviceId()); if (device == null) { return null; } if (!Context.getIdentityManager().isLatestPosition(position) || !position.getValid()) { return null; } Collection<Event> result = null; boolean ignition = false; Object ignitionObject = position.getAttributes().get(Position.KEY_IGNITION); if (ignitionObject != null && Boolean.parseBoolean(ignitionObject.toString())) { ignition = true; } boolean oldIgnition = false; Object oldIgnitionObject = null; Position lastPosition = Context.getIdentityManager().getLastPosition(position.getDeviceId()); if (lastPosition != null) { oldIgnitionObject = lastPosition.getAttributes().get(Position.KEY_IGNITION); } if (oldIgnitionObject != null && Boolean.parseBoolean(oldIgnitionObject.toString())) { oldIgnition = true; } if (ignition && !oldIgnition) { result = new ArrayList<>(); result.add(new Event(Event.TYPE_IGNITION_ON, position.getDeviceId(), position.getId())); } else if (!ignition && oldIgnition) { result = new ArrayList<>(); result.add(new Event(Event.TYPE_IGNITION_OFF, position.getDeviceId(), position.getId())); } return result; }

Target:
protected Collection<Event> analyzePosition(Position position) { Device device = Context.getIdentityManager().getDeviceById(position.getDeviceId()); if (device == null) { return null; } if (!Context.getIdentityManager().isLatestPosition(position) || !position.getValid()) { return null; } Collection<Event> result = null; boolean ignition = false; Object ignitionObject = position.getAttributes().get(Position.KEY_IGNITION); if (ignitionObject != null && ignitionObject instanceof Boolean) { ignition = (Boolean) ignitionObject; } boolean oldIgnition = false; Object oldIgnitionObject = null; Position lastPosition = Context.getIdentityManager().getLastPosition(position.getDeviceId()); if (lastPosition != null) { oldIgnitionObject = lastPosition.getAttributes().get(Position.KEY_IGNITION); } if (oldIgnitionObject != null && oldIgnitionObject instanceof Boolean) { oldIgnition = (Boolean) oldIgnitionObject; } if (ignition && !oldIgnition) { result = new ArrayList<>(); result.add(new Event(Event.TYPE_IGNITION_ON, position.getDeviceId(), position.getId())); } else if (!ignition && oldIgnition) { result = new ArrayList<>(); result.add(new Event(Event.TYPE_IGNITION_OFF, position.getDeviceId(), position.getId())); } return result; }
Source:
protected void openGitTreeCompare(IResource[] resources, String leftRev, String rightRev, boolean includeLocal) { Display display = PlatformUI.getWorkbench().getDisplay(); display.asyncExec(new Runnable() { @Override public void run() { CompareTreeView view; try { view = (CompareTreeView) PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage() .showView(CompareTreeView.ID); if (includeLocal) view.setInput(resources, rightRev); else view.setInput(resources, leftRev, rightRev); } catch (PartInitException e) { Activator.handleError(e.getMessage(), e, true); } } }); }

Target:
protected void openGitTreeCompare(IResource[] resources, String leftRev, String rightRev, boolean includeLocal) { Display display = PlatformUI.getWorkbench().getDisplay(); display.asyncExec(new Runnable() { @Override public void run() { CompareTreeView view; try { view = (CompareTreeView) PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage() .showView(CompareTreeView.ID); if (includeLocal) { view.setInput(resources, rightRev); } else { view.setInput(resources, leftRev, rightRev); } } catch (PartInitException e) { Activator.handleError(e.getMessage(), e, true); } } }); }
Source:
protected Object doGetValue() { CapsulePartKindEnum kind = null; setUMLPropertiesValue(); if (capsulePartElement.getLower() == capsulePartElement.getUpper()) { kind = CapsulePartKindEnum.FIXED; } else if (capsulePartElement.getLower() == 0) { if (AggregationKind.COMPOSITE_LITERAL.equals(aggregation)) { kind = CapsulePartKindEnum.OPTIONAL; } else if (AggregationKind.SHARED_LITERAL.equals(aggregation)) { kind = CapsulePartKindEnum.PLUGIN; } } return kind; }

Target:
protected Object doGetValue() { CapsulePartKindEnum kind = null; setUMLPropertiesValue(); if (capsulePartElement.getLower() == capsulePartElement.getUpper()) { kind = CapsulePartKindEnum.FIXED; } else if (0 == capsulePartElement.getLower()) { if (AggregationKind.COMPOSITE_LITERAL.equals(aggregation)) { kind = CapsulePartKindEnum.OPTIONAL; } else if (AggregationKind.SHARED_LITERAL.equals(aggregation)) { kind = CapsulePartKindEnum.PLUGIN; } } return kind; }
Source:
private void initDataReader(Encoding dataEncoding, byte[] bytes, int offset, int valueCount) { ValuesReader previousReader = this.dataColumn; this.currentEncoding = dataEncoding; this.pageValueCount = valueCount; this.endOfPageValueCount = readValues + pageValueCount; if (dataEncoding.usesDictionary()) { if (dictionary == null) { throw new ParquetDecodingException( "could not read page in col " + path + " as the dictionary was missing for encoding " + dataEncoding); } this.dataColumn = dataEncoding.getDictionaryBasedValuesReader(path, VALUES, dictionary); } else { this.dataColumn = dataEncoding.getValuesReader(path, VALUES); } if (dataEncoding.usesDictionary() && converter.hasDictionarySupport()) { bindToDictionary(dictionary); } else { bind(path.getType()); } try { dataColumn.initFromPage(pageValueCount, bytes, offset); } catch (IOException e) { throw new ParquetDecodingException("could not read page in col " + path, e); } if (dataEncoding.requiresSequentialReads(writerVersion) && previousReader != null) { ((RequiresPreviousReader) dataColumn).setPreviousReader(previousReader); } }

Target:
private void initDataReader(Encoding dataEncoding, byte[] bytes, int offset, int valueCount) { ValuesReader previousReader = this.dataColumn; this.currentEncoding = dataEncoding; this.pageValueCount = valueCount; this.endOfPageValueCount = readValues + pageValueCount; if (dataEncoding.usesDictionary()) { if (dictionary == null) { throw new ParquetDecodingException( "could not read page in col " + path + " as the dictionary was missing for encoding " + dataEncoding); } this.dataColumn = dataEncoding.getDictionaryBasedValuesReader(path, VALUES, dictionary); } else { this.dataColumn = dataEncoding.getValuesReader(path, VALUES); } if (dataEncoding.usesDictionary() && converter.hasDictionarySupport()) { bindToDictionary(dictionary); } else { bind(path.getType()); } try { dataColumn.initFromPage(pageValueCount, bytes, offset); } catch (IOException e) { throw new ParquetDecodingException("could not read page in col " + path, e); } if (CorruptDeltaByteArrays.requiresSequentialReads(writerVersion, dataEncoding) && previousReader != null && previousReader instanceof RequiresPreviousReader) { ((RequiresPreviousReader) dataColumn).setPreviousReader(previousReader); } }
Source:
public IBinding getTemplateDefinition() { return getValue().getTemplateDefinition(); }

Target:
public IBinding getTemplateDefinition() { return parent.getTemplateDefinition(); }
Source:
public void createCheckout(final Product product, final Callback<Checkout> callback) { Cart cart = new Cart(); cart.addVariant(product.getVariants().get(0)); checkout = new Checkout(cart); Address address = new Address(); address.setFirstName("Dinosaur"); address.setLastName("Banana"); address.setAddress1("421 8th Ave"); address.setCity("New York"); address.setProvince("NY"); address.setZip("10001"); address.setCountryCode("US"); checkout.setShippingAddress(address); if (customer != null) { checkout.setEmail(customer.getEmail()); } else { checkout.setEmail("something@somehost.com"); } checkout.setWebReturnToUrl(getString(R.string.web_return_to_url)); checkout.setWebReturnToLabel(getString(R.string.web_return_to_label)); buyClient.createCheckout(checkout, wrapCheckoutCallback(callback)); }

Target:
public void createCheckout(final Product product, final Callback<Checkout> callback) { Cart cart = new Cart(); cart.addVariant(product.getVariants().get(0)); checkout = new Checkout(cart); if (customer != null) { checkout.setEmail(customer.getEmail()); } else { checkout.setEmail("something@somehost.com"); } if (customer != null && customer.getDefaultAddress() != null) { checkout.setShippingAddress(customer.getDefaultAddress()); } else { final Address address = new Address(); address.setFirstName("Dinosaur"); address.setLastName("Banana"); address.setAddress1("421 8th Ave"); address.setCity("New York"); address.setProvince("NY"); address.setZip("10001"); address.setCountryCode("US"); checkout.setShippingAddress(address); } checkout.setWebReturnToUrl(getString(R.string.web_return_to_url)); checkout.setWebReturnToLabel(getString(R.string.web_return_to_label)); buyClient.createCheckout(checkout, wrapCheckoutCallback(callback)); }
Source:
private void handleProcessShutdown(Signal lastSignal) { if (Thread.interrupted()) { Signal cleanup = Signal.of(CLEANUP, lastSignal.getTarget()); logger.info("Consumer process was interrupted. Its last processed signal is {}. Accepting {}", lastSignal, cleanup); accept(cleanup); } else { accept(lastSignal.childOf(CLEANUP)); } }

Target:
private void handleProcessShutdown(Signal lastSignal) { if (Thread.interrupted()) { Signal cleanup = Signal.of(CLEANUP, lastSignal.getTarget()); logger.info("Consumer process was interrupted. Its last processed signal is {}. Accepting {}", lastSignal, cleanup); accept(cleanup); } else { accept(lastSignal.createChild(CLEANUP)); } }
Source:
public Response undoSnapshot(Action action) { RestoreAllSnapshotsParameters restoreParams = new RestoreAllSnapshotsParameters(guid, SnapshotActionEnum.UNDO); Response response = doAction(VdcActionType.RestoreAllSnapshots, restoreParams, action); return response; }

Target:
public Response undoSnapshot(Action action) { RestoreAllSnapshotsParameters restoreParams = new RestoreAllSnapshotsParameters(guid, SnapshotActionEnum.UNDO); Response response = performAction(VdcActionType.RestoreAllSnapshots, restoreParams, action); return response; }
Source:
private void PostUpdatePriority() { ArrayList<EntityModel> items = new ArrayList<EntityModel>(); EntityModel tempVar = new EntityModel(); tempVar.setTitle(ConstantsManager.getInstance().getConstants().lowTitle()); tempVar.setEntity(1); items.add(tempVar); EntityModel tempVar2 = new EntityModel(); tempVar2.setTitle(ConstantsManager.getInstance().getConstants().mediumTitle()); tempVar2.setEntity(cachedMaxPriority / 2); items.add(tempVar2); EntityModel tempVar3 = new EntityModel(); tempVar3.setTitle(ConstantsManager.getInstance().getConstants().highTitle()); tempVar3.setEntity(cachedMaxPriority); items.add(tempVar3); EntityModel oldPriority = (EntityModel) getModel().getPriority().getSelectedItem(); getModel().getPriority().setItems(items); if (oldPriority != null) { for (EntityModel item : items) { int val1 = (Integer) item.getEntity(); int val2 = (Integer) oldPriority.getEntity(); if ((Integer.valueOf(val1)).equals(val2)) { getModel().getPriority().setSelectedItem(item); break; } } } else { getModel().getPriority().setSelectedItem(Linq.FirstOrDefault(items)); } }

Target:
private void PostUpdatePriority() { ArrayList<EntityModel> items = new ArrayList<EntityModel>(); EntityModel tempVar = new EntityModel(); tempVar.setTitle(ConstantsManager.getInstance().getConstants().lowTitle()); tempVar.setEntity(1); items.add(tempVar); EntityModel tempVar2 = new EntityModel(); tempVar2.setTitle(ConstantsManager.getInstance().getConstants().mediumTitle()); tempVar2.setEntity(cachedMaxPriority / 2); items.add(tempVar2); EntityModel tempVar3 = new EntityModel(); tempVar3.setTitle(ConstantsManager.getInstance().getConstants().highTitle()); tempVar3.setEntity(cachedMaxPriority); items.add(tempVar3); EntityModel oldPriority = (EntityModel) getModel().getPriority().getSelectedItem(); getModel().getPriority().setItems(items); if (oldPriority != null) { for (EntityModel item : items) { Integer val1 = (Integer)item.getEntity(); Integer val2 = (Integer)oldPriority.getEntity(); if (val1 != null && val1.equals(val2)) { getModel().getPriority().setSelectedItem(item); break; } } } else { getModel().getPriority().setSelectedItem(Linq.FirstOrDefault(items)); } }
Source:
public String removeCategory() { logger.debug("removeCategory"); getFileDescriptions(); fetchMetadataEdit(); return super.removeCategory(); }

Target:
public String removeCategory() { logger.debug("RemoveCategory in multiple resource action for id {}", this.getResourceId()); getFileDescriptions(); fetchMetadataEdit(); return super.removeCategory(); }
Source:
public void init() throws Throwable { LogPosition recoveryFromPosition = spi.getPositionToRecoverFrom(); if ( LogPosition.UNSPECIFIED.equals( recoveryFromPosition ) ) { return; } monitor.recoveryRequired( recoveryFromPosition ); spi.startRecovery(); long checkpointTxId = TransactionIdStore.BASE_TX_ID; try ( TransactionCursor transactionsToRecover = spi.getTransactionsInReverseOrder( recoveryFromPosition ); RecoveryApplier recoveryVisitor = spi.getRecoveryApplier( REVERSE_RECOVERY ); ) { while ( transactionsToRecover.next() ) { recoveryVisitor.visit( transactionsToRecover.get() ); checkpointTxId = transactionsToRecover.get().getCommitEntry().getTxId(); } } monitor.reverseStoreRecoveryCompleted( checkpointTxId ); LogPosition recoveryToPosition; CommittedTransactionRepresentation lastTransaction = null; try ( TransactionCursor transactionsToRecover = spi.getTransactions( recoveryFromPosition ); RecoveryApplier recoveryVisitor = spi.getRecoveryApplier( RECOVERY ); ) { while ( transactionsToRecover.next() ) { lastTransaction = transactionsToRecover.get(); long txId = lastTransaction.getCommitEntry().getTxId(); recoveryVisitor.visit( lastTransaction ); monitor.transactionRecovered( txId ); numberOfRecoveredTransactions++; } recoveryToPosition = transactionsToRecover.position(); } if ( recoveryToPosition.equals( LogPosition.UNSPECIFIED ) ) { recoveryToPosition = recoveryFromPosition; } spi.allTransactionsRecovered( lastTransaction, recoveryToPosition ); recoveredLog = true; }

Target:
public void init() throws Throwable { LogPosition recoveryFromPosition = spi.getPositionToRecoverFrom(); if ( LogPosition.UNSPECIFIED.equals( recoveryFromPosition ) ) { return; } monitor.recoveryRequired( recoveryFromPosition ); spi.startRecovery(); long lowestRecoveredTxId = TransactionIdStore.BASE_TX_ID; try ( TransactionCursor transactionsToRecover = spi.getTransactionsInReverseOrder( recoveryFromPosition ); RecoveryApplier recoveryVisitor = spi.getRecoveryApplier( REVERSE_RECOVERY ); ) { while ( transactionsToRecover.next() ) { recoveryVisitor.visit( transactionsToRecover.get() ); lowestRecoveredTxId = transactionsToRecover.get().getCommitEntry().getTxId(); } } monitor.reverseStoreRecoveryCompleted( lowestRecoveredTxId ); LogPosition recoveryToPosition; CommittedTransactionRepresentation lastTransaction = null; try ( TransactionCursor transactionsToRecover = spi.getTransactions( recoveryFromPosition ); RecoveryApplier recoveryVisitor = spi.getRecoveryApplier( RECOVERY ); ) { while ( transactionsToRecover.next() ) { lastTransaction = transactionsToRecover.get(); long txId = lastTransaction.getCommitEntry().getTxId(); recoveryVisitor.visit( lastTransaction ); monitor.transactionRecovered( txId ); numberOfRecoveredTransactions++; } recoveryToPosition = transactionsToRecover.position(); } if ( recoveryToPosition.equals( LogPosition.UNSPECIFIED ) ) { recoveryToPosition = recoveryFromPosition; } spi.allTransactionsRecovered( lastTransaction, recoveryToPosition ); recoveredLog = true; }
Source:
private double logTransitionProbability(final Integer currentState, final Integer nextState, final double distance) { final double pRemember = Math.exp(-distance / memoryLength); return Math.log((nextState == currentState ? pRemember : 0) + (1 - pRemember)*weights[nextState]); }

Target:
private double logTransitionProbability(final Integer currentState, final Integer nextState, final double distance) { final double pRemember = Math.exp(-distance / memoryLength); return Math.log((nextState.equals(currentState) ? pRemember : 0) + (1 - pRemember)*weights[nextState]); }
Source:
public boolean loadBlocks(Function<Path, DumpWalker> walkerFactory, Path... paths) { if (ArrayUtils.isEmpty(paths)) { throw new FatalEthereumException("There is nothing to import."); } initPipelines(); AtomicLong maxBlockNumber = new AtomicLong(); boolean allBlocksImported; try { for (Path dump : paths) { try (DumpWalker walker = walkerFactory.apply(dump)) { walker.forEach(rlp -> { Block block = new Block(rlp); if (maxBlockNumber.get() < block.getNumber()) { maxBlockNumber.set(block.getNumber()); } exec1.push(block); }); } } exec1.join(); dbFlushManager.flushSync(); allBlocksImported = maxBlockNumber.get() == blockchain.getBestBlock().getNumber(); } catch (Exception e) { e.printStackTrace(); allBlocksImported = false; } if (allBlocksImported) { System.out.printf("All of %s blocks was successfully loaded.\n", maxBlockNumber); } else { System.out.printf("Some blocks have been lost during the loading."); } return allBlocksImported; }

Target:
public boolean loadBlocks(Function<Path, DumpWalker> walkerFactory, Path... paths) { if (ArrayUtils.isEmpty(paths)) { logger.warn("There is nothing to import."); return false; } initPipelines(); AtomicLong maxBlockNumber = new AtomicLong(); boolean allBlocksImported; try { for (Path dump : paths) { try (DumpWalker walker = walkerFactory.apply(dump)) { walker.forEach(rlp -> { Block block = new Block(rlp); if (maxBlockNumber.get() < block.getNumber()) { maxBlockNumber.set(block.getNumber()); } exec1.push(block); }); } } exec1.join(); dbFlushManager.flushSync(); allBlocksImported = maxBlockNumber.get() == blockchain.getBestBlock().getNumber(); } catch (Exception e) { e.printStackTrace(); allBlocksImported = false; } if (allBlocksImported) { System.out.printf("All of %s blocks was successfully loaded.\n", maxBlockNumber); } else { System.out.printf("Some blocks have been lost during the loading."); } return allBlocksImported; }
Source:
public <NEW_TYPE> FluentIterable<NEW_TYPE> map(Function<? super TYPE, NEW_TYPE> function) { return new LazyFluentIterable<NEW_TYPE>() { @Override public Iterator<NEW_TYPE> iterator() { return new DecoratingIterator<NEW_TYPE>(null) { Iterator<TYPE> oldTypeIterator = iterable.iterator(); @Override public NEW_TYPE computeNext() { while(true) { if(oldTypeIterator.hasNext()) { TYPE candidate = oldTypeIterator.next(); return function.apply(candidate); } return null; } } }; } }; }

Target:
public <NEW_TYPE> FluentIterable<NEW_TYPE> map(Function<? super TYPE, NEW_TYPE> function) { return new LazyFluentIterable<NEW_TYPE>() { @Override public Iterator<NEW_TYPE> iterator() { return new DecoratingIterator<NEW_TYPE>(null) { Iterator<TYPE> oldTypeIterator = iterable.iterator(); @Override public NEW_TYPE computeNext() { while (oldTypeIterator.hasNext()) { TYPE candidate = oldTypeIterator.next(); return function.apply(candidate); } return null; } }; } }; }
Source:
public PayaraNotificationBuilder newBuilder() { return new PayaraNotificationBuilder(createEvent()); }

Target:
public PayaraNotificationBuilder newBuilder() { String hostName; try { hostName = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException ex) { LOGGER.log(Level.WARNING, "Unable to resolve local hostname", ex); hostName = "?.?.?.?"; } final String domainName = environment.getDomainName(); final String instanceName = environment.getInstanceName(); final Server server = habitat.getService(Server.class, environment.getInstanceName()); final String serverName = server.getName(); return new PayaraNotificationBuilder(hostName, domainName, instanceName, serverName); }
Source:
public HashHitInfo lookupMD5(Content content) throws TskCoreException { HashHitInfo result = null; assert content instanceof AbstractFile; if (content instanceof AbstractFile) { AbstractFile file = (AbstractFile) content; if (null != file.getMd5Hash()) { try{ if(EamDb.getInstance().isFileHashInReferenceSet(file.getMd5Hash(), this.referenceSetID)){ result = new HashHitInfo(file.getMd5Hash(), "", ""); } } catch (EamDbException ex){ Logger.getLogger(SleuthkitHashSet.class.getName()).log(Level.SEVERE, "Error performing central reposiotry hash lookup", ex); throw new TskCoreException("Error performing central reposiotry hash lookup", ex); } } } return result; }

Target:
public HashHitInfo lookupMD5(Content content) throws TskCoreException { HashHitInfo result = null; assert content instanceof AbstractFile; if (content instanceof AbstractFile) { AbstractFile file = (AbstractFile) content; if (null != file.getMd5Hash()) { try{ if(EamDb.getInstance().isFileHashInReferenceSet(file.getMd5Hash(), this.referenceSetID)){ result = new HashHitInfo(file.getMd5Hash(), "", ""); } } catch (EamDbException ex){ Logger.getLogger(SleuthkitHashSet.class.getName()).log(Level.SEVERE, "Error performing central reposiotry hash lookup for hash " + file.getMd5Hash() + " in reference set " + referenceSetID, ex); throw new TskCoreException("Error performing central reposiotry hash lookup", ex); } } } return result; }
Source:
@Test void testRelShuttleForLogicalCalc() { final String sql = "select ename from emp"; final RelNode rel = tester.convertSqlToRel(sql).rel; final HepProgramBuilder programBuilder = HepProgram.builder(); programBuilder.addRuleInstance(ProjectToCalcRule.INSTANCE); HepPlanner planner = new HepPlanner(programBuilder.build()); planner.setRoot(rel); final LogicalCalc calc = (LogicalCalc) planner.findBestExp(); final List<RelNode> rels = new ArrayList<>(); final RelShuttleImpl visitor = new RelShuttleImpl() { @Override public RelNode visit(LogicalCalc calc) { RelNode visitedRel = super.visit(calc); rels.add(visitedRel); return visitedRel; } }; visitor.visit(calc); assertThat(rels.size(), is(1)); assertThat(rels.get(0), isA(LogicalCalc.class)); }

Target:
@Test void testRelShuttleForLogicalCalc() { final String sql = "select ename from emp"; final RelNode rel = tester.convertSqlToRel(sql).rel; final HepProgramBuilder programBuilder = HepProgram.builder(); programBuilder.addRuleInstance(ProjectToCalcRule.INSTANCE); final HepPlanner planner = new HepPlanner(programBuilder.build()); planner.setRoot(rel); final LogicalCalc calc = (LogicalCalc) planner.findBestExp(); final List<RelNode> rels = new ArrayList<>(); final RelShuttleImpl visitor = new RelShuttleImpl() { @Override public RelNode visit(LogicalCalc calc) { RelNode visitedRel = super.visit(calc); rels.add(visitedRel); return visitedRel; } }; visitor.visit(calc); assertThat(rels.size(), is(1)); assertThat(rels.get(0), isA(LogicalCalc.class)); }
Source:
private String findAvailableInstructorGoogleIdForCourse(String courseId){ if(tempCourseIdToInstructorGoogleIdMap.get(courseId) != null){ return tempCourseIdToInstructorGoogleIdMap.get(courseId); } String googleId = ""; List<InstructorAttributes> instructorList = logic.getInstructorsForCourse(courseId); if(instructorList == null || instructorList.isEmpty()){ return googleId; } for (InstructorAttributes instructor : instructorList) { if (instructor.isRegistered() && instructor.isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_INSTRUCTOR)) { googleId = instructor.googleId; break; } } tempCourseIdToInstructorGoogleIdMap.put(courseId, googleId); return googleId; }

Target:
private String findAvailableInstructorGoogleIdForCourse(String courseId){ if(tempCourseIdToInstructorGoogleIdMap.get(courseId) != null){ return tempCourseIdToInstructorGoogleIdMap.get(courseId); } List<InstructorAttributes> instructorList = logic.getInstructorsForCourse(courseId); if(instructorList == null || instructorList.isEmpty()){ return ""; } for (InstructorAttributes instructor : instructorList) { if (instructor.isRegistered() && instructor.hasCoownerPrivileges()) { tempCourseIdToInstructorGoogleIdMap.put(courseId, instructor.googleId); return instructor.googleId; } } for (InstructorAttributes instructor : instructorList) { if (instructor.isRegistered() && instructor.isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_INSTRUCTOR)) { tempCourseIdToInstructorGoogleIdMap.put(courseId, instructor.googleId); return instructor.googleId; } } return ""; }
Source:
private boolean waitForChanges(int direction, long timeout, TimeUnit unit) throws InterruptedException { if (direction != DIRECTION_DOWNLOAD && direction != DIRECTION_UPLOAD) { throw new IllegalArgumentException("Unknown direction: " + direction); } boolean result = false; if (!isClosed) { String realmPath = configuration.getPath(); WaitForSessionWrapper wrapper = new WaitForSessionWrapper(); waitingForServerChanges.set(wrapper); int callbackId = waitCounter.incrementAndGet(); boolean listenerRegistered = (direction == DIRECTION_DOWNLOAD) ? nativeWaitForDownloadCompletion(callbackId, realmPath) : nativeWaitForUploadCompletion(callbackId, realmPath); if (!listenerRegistered) { waitingForServerChanges.set(null); String errorMsg; switch (direction) { case DIRECTION_DOWNLOAD: errorMsg = "It was not possible to download all remote changes."; break; case DIRECTION_UPLOAD: errorMsg = "It was not possible upload all local changes."; break; default: throw new IllegalArgumentException("Unknown direction: " + direction); } throw new ObjectServerError(ErrorCode.UNKNOWN, errorMsg + " Has the SyncClient been started?"); } try { result = wrapper.waitForServerChanges(timeout, unit); RealmLog.error("Success: " + result); } catch(InterruptedException e) { RealmLog.error("Download interrupted"); waitingForServerChanges.set(null); throw e; } try { if (!isClosed) { if (!wrapper.isSuccess()) { wrapper.throwExceptionIfNeeded(); } } } finally { waitingForServerChanges.set(null); } } return result; }

Target:
private boolean waitForChanges(int direction, long timeout, TimeUnit unit) throws InterruptedException { if (direction != DIRECTION_DOWNLOAD && direction != DIRECTION_UPLOAD) { throw new IllegalArgumentException("Unknown direction: " + direction); } boolean result = false; if (!isClosed) { String realmPath = configuration.getPath(); WaitForSessionWrapper wrapper = new WaitForSessionWrapper(); waitingForServerChanges.set(wrapper); int callbackId = waitCounter.incrementAndGet(); boolean listenerRegistered = (direction == DIRECTION_DOWNLOAD) ? nativeWaitForDownloadCompletion(callbackId, realmPath) : nativeWaitForUploadCompletion(callbackId, realmPath); if (!listenerRegistered) { waitingForServerChanges.set(null); String errorMsg; switch (direction) { case DIRECTION_DOWNLOAD: errorMsg = "It was not possible to download all remote changes."; break; case DIRECTION_UPLOAD: errorMsg = "It was not possible upload all local changes."; break; default: throw new IllegalArgumentException("Unknown direction: " + direction); } throw new ObjectServerError(ErrorCode.UNKNOWN, errorMsg + " Has the SyncClient been started?"); } try { result = wrapper.waitForServerChanges(timeout, unit); } catch(InterruptedException e) { waitingForServerChanges.set(null); throw e; } try { if (!isClosed) { if (!wrapper.isSuccess()) { wrapper.throwExceptionIfNeeded(); } } } finally { waitingForServerChanges.set(null); } } return result; }
Source:
public void write( SystemInputDef systemInput) { xmlWriter_.writeDeclaration(); xmlWriter_.writeTagStart( SYSTEM_TAG); xmlWriter_.writeAttribute( NAME_ATR, systemInput.getName()); xmlWriter_.writeTagEnd(); xmlWriter_.indent(); writeAnnotations( systemInput); toStream( systemInput.getFunctionInputDefs()).forEach( function -> writeFunction( function)); xmlWriter_.unindent(); xmlWriter_.writeElementEnd( SYSTEM_TAG); }

Target:
public void write( SystemInputDef systemInput) { xmlWriter_.writeDeclaration(); xmlWriter_ .element( SYSTEM_TAG) .attribute( NAME_ATR, systemInput.getName()) .content( () -> { writeAnnotations( systemInput); toStream( systemInput.getFunctionInputDefs()).forEach( function -> writeFunction( function)); }) .write(); }