auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testSubOrganizationRename() { String organizationPath = NEW_PARENT_ORG_NAME + "/" + CHILD_ORG_NAME; String path = NEW_PARENT_ORG_NAME + "/" + NEW_CHILD_ORG_NAME; navigationBar.waitNavigationBar(); navigationBar.clickOnMenu(ORGANIZATIONS); organizationListPage.waitForOrganizationsToolbar(); organizationListPage.waitForOrganizationsList(); organizationListPage.clickOnOrganization(organizationPath); organizationPage.waitOrganizationTitle(organizationPath); organizationPage.setOrganizationName(NEW_CHILD_ORG_NAME); editMode.waitDisplayed(); assertTrue(editMode.isSaveEnabled()); editMode.clickSave(); editMode.waitHidden(); organizationPage.waitOrganizationTitle(path); assertEquals(organizationPage.getOrganizationName(), NEW_CHILD_ORG_NAME); organizationPage.clickBackButton(); organizationPage.waitOrganizationTitle(NEW_PARENT_ORG_NAME); organizationPage.clickSubOrganizationsTab(); organizationListPage.waitForOrganizationsList(); assertTrue(organizationListPage.getValues(NAME).contains(path)); organizationPage.clickBackButton(); organizationListPage.waitForOrganizationsList(); assertTrue(organizationListPage.getValues(NAME).contains(path)); assertTrue(organizationListPage.getValues(NAME).contains(NEW_PARENT_ORG_NAME)); }

Target:
public void testSubOrganizationRename() { String suborganizationName = NEW_PARENT_ORG_NAME + "/" + CHILD_ORG_NAME; String newSubOrganizationName = NEW_PARENT_ORG_NAME + "/" + NEW_CHILD_ORG_NAME; navigationBar.waitNavigationBar(); navigationBar.clickOnMenu(ORGANIZATIONS); organizationListPage.waitForOrganizationsToolbar(); organizationListPage.waitForOrganizationsList(); organizationListPage.clickOnOrganization(suborganizationName); organizationPage.waitOrganizationTitle(suborganizationName); organizationPage.setOrganizationName(NEW_CHILD_ORG_NAME); editMode.waitDisplayed(); assertTrue(editMode.isSaveEnabled()); editMode.clickSave(); editMode.waitHidden(); organizationPage.waitOrganizationTitle(newSubOrganizationName); assertEquals(organizationPage.getOrganizationName(), NEW_CHILD_ORG_NAME); organizationPage.clickBackButton(); organizationPage.waitOrganizationTitle(NEW_PARENT_ORG_NAME); organizationPage.clickSubOrganizationsTab(); organizationListPage.waitForOrganizationsList(); assertTrue(organizationListPage.getValues(NAME).contains(newSubOrganizationName)); organizationPage.clickBackButton(); organizationListPage.waitForOrganizationsList(); assertTrue(organizationListPage.getValues(NAME).contains(newSubOrganizationName)); assertTrue(organizationListPage.getValues(NAME).contains(NEW_PARENT_ORG_NAME)); }
Source:
public Promise<Collection<WorkItemDefinition>> call(final Metadata input) { return promises.create((success, failure) -> { resourceContentService.list("**/*.wid").then(paths -> { if (paths.length > 0) { String path = paths[0]; DomGlobal.console.log("Loading WIDs from " + path); resourceContentService.get(path).then(value -> { Collection<WorkItemDefinition> wids = parser.parse(value); wids.forEach(registry::register); success.onInvoke(wids); return null; }); } else { DomGlobal.console.log("No WIDs to load"); success.onInvoke(Collections.emptyList()); } return null; }); }); }

Target:
public Promise<Collection<WorkItemDefinition>> call(final Metadata input) { registry.clear(); return promises.create((success, failure) -> { resourceContentService.list("**/*.wid").then(paths -> { if (paths.length > 0) { String path = paths[0]; DomGlobal.console.log("Loading WIDs from " + path); resourceContentService.get(path).then(value -> { Collection<WorkItemDefinition> wids = parser.parse(value); wids.forEach(registry::register); success.onInvoke(wids); return null; }); } else { DomGlobal.console.log("No WIDs to load"); success.onInvoke(Collections.emptyList()); } return null; }); }); }
Source:
protected void skipToNextSyncPoint(boolean atFirstRecord) throws IOException { LOG.debug("LzoProtobufBlockRecordReader.skipToNextSyncPoint called with atFirstRecord = " + atFirstRecord); updatePosition = !atFirstRecord; LOG.debug("reset first record offset in skipToNextSyncPoint()"); }

Target:
protected void skipToNextSyncPoint(boolean atFirstRecord) throws IOException { LOG.debug("LzoProtobufBlockRecordReader.skipToNextSyncPoint called with atFirstRecord = " + atFirstRecord); updatePosition = !atFirstRecord; }
Source:
public static void setUp() throws IOException, TimeoutException, InterruptedException { operations.add(FORMATTER_ADDRESS, Values.empty().and("pattern", FORMATTER_PATTERN)); administration.reloadIfRequired(); operations.add(FORMATTER_ADDRESS_TO_BE_REMOVED, Values.empty().and("pattern", FORMATTER_PATTERN)); administration.reloadIfRequired(); }

Target:
public static void setUp() throws IOException, TimeoutException, InterruptedException { operations.add(FORMATTER_ADDRESS, Values.empty().and("pattern", FORMATTER_PATTERN)); operations.add(FORMATTER_ADDRESS_TO_BE_REMOVED, Values.empty().and("pattern", FORMATTER_PATTERN)); administration.reloadIfRequired(); }
Source:
public void run() { if (m_socket != null) { boolean success = false; AtomicReference<String> timeoutRef = new AtomicReference<String>(); try { final InputHandler handler = authenticate(m_socket, timeoutRef); if (handler != null) { m_socket.configureBlocking(false); m_socket.socket().setTcpNoDelay(true); m_socket.socket().setKeepAlive(true); m_network.registerChannel( m_socket, handler, 0, ReverseDNSPolicy.ASYNCHRONOUS); success = true; } } catch (Exception e) { try { m_socket.close(); } catch (IOException e1) { } if (m_running) { if (timeoutRef.get() != null) { hostLog.warn(timeoutRef.get()); } else { hostLog.warn("Exception authenticating and " + "registering user in ClientAcceptor", e); } } } finally { if (!success) { m_numConnections.decrementAndGet(); } } } }

Target:
public void run() { if (m_socket != null) { boolean success = false; AtomicReference<String> timeoutRef = new AtomicReference<String>(); try { final ClientInputHandler handler = authenticate(m_socket, timeoutRef); if (handler != null) { m_socket.configureBlocking(false); m_socket.socket().setTcpNoDelay(true); m_socket.socket().setKeepAlive(true); m_network.registerChannel( m_socket, handler, 0, ReverseDNSPolicy.ASYNCHRONOUS); success = true; } } catch (Exception e) { try { m_socket.close(); } catch (IOException e1) { } if (m_running) { if (timeoutRef.get() != null) { hostLog.warn(timeoutRef.get()); } else { hostLog.warn("Exception authenticating and " + "registering user in ClientAcceptor", e); } } } finally { if (!success) { m_numConnections.decrementAndGet(); } } } }
Source:
private boolean validateSourceStorageDomainsAvailability() { for (DiskImage image : new ArrayList<>(getImages())) { boolean storageDomainAvailable = false; for (Guid storageDomainId : image.getStorageIds()) { StorageDomain sd = storageDomainDao.getForStoragePool(storageDomainId, getStoragePool().getId()); ValidationResult result = new StorageDomainValidator(sd).isDomainExistAndActive(); if (result.isValid()) { storageDomainAvailable = true; } else { log.warn("Storage domain '{}' does not exist.", storageDomainId); } } if (!storageDomainAvailable) { if (getParameters().isAllowPartialImport()) { log.warn("No active storage domain that contains the image {}/{} exists. " + "Ignoring since the force flag in on.", image.getId(), image.getImageId()); getImages().remove(image); failedDisksToImportForAuditLog.putIfAbsent(image.getId(), image.getDiskAlias()); } else { return failValidation(EngineMessage.ACTION_TYPE_FAILED_CANNOT_FIND_DISK_IMAGE_IN_ACTIVE_DOMAINS, String.format("$diskImageId %1$s", image.getId()), String.format("$imageId %1$s", image.getImageId())); } } } return true; }

Target:
private boolean validateSourceStorageDomainsAvailability() { for (DiskImage image : new ArrayList<>(getImages())) { boolean storageDomainAvailable = false; Iterator<Guid> iterator = image.getStorageIds().iterator(); while (iterator.hasNext()) { Guid storageDomainId = iterator.next(); StorageDomain sd = storageDomainDao.getForStoragePool(storageDomainId, getStoragePool().getId()); ValidationResult result = new StorageDomainValidator(sd).isDomainExistAndActive(); if (result.isValid()) { storageDomainAvailable = true; } else { log.warn("Storage domain '{}' does not exist.", storageDomainId); iterator.remove(); } } if (!storageDomainAvailable) { if (getParameters().isAllowPartialImport()) { log.warn("No active storage domain that contains the image {}/{} exists. " + "Ignoring since the force flag in on.", image.getId(), image.getImageId()); getImages().remove(image); failedDisksToImportForAuditLog.putIfAbsent(image.getId(), image.getDiskAlias()); } else { return failValidation(EngineMessage.ACTION_TYPE_FAILED_CANNOT_FIND_DISK_IMAGE_IN_ACTIVE_DOMAINS, String.format("$diskImageId %1$s", image.getId()), String.format("$imageId %1$s", image.getImageId())); } } } return true; }
Source:
protected void getDataRightsOverride() { overrideClassification = DataRightsClassification.noOverride; for (DataRightsClassification classification : DataRightsClassification.values()) { if (classification.getDataRightsClassification().equals(publishingOptions.overrideDataRights)) { overrideClassification = classification; } } }

Target:
protected void getDataRightsOverride() { overrideClassification = DataRightsClassification.noOverride; for (DataRightsClassification classification : DataRightsClassification.values()) { if (classification.getDataRightsClassification().equals(publishingOptions.overrideDataRights)) { overrideClassification = classification; break; } } }
Source:
public Mono<Void> run(CancellationToken cancellationToken) { LeaseRenewerImpl self = this; logger.info(String.format("Partition %s: renewer task started.", self.lease.getLeaseToken())); long remainingWork = this.leaseRenewInterval.toMillis(); try { while (!cancellationToken.isCancellationRequested() && remainingWork > 0) { Thread.sleep(100); remainingWork -= 100; } } catch (InterruptedException ex) { logger.info(String.format("Partition %s: renewer task stopped.", self.lease.getLeaseToken())); return Mono.empty(); } return Mono.just(self) .flatMap(value -> self.renew(cancellationToken)) .repeat(() -> { if (cancellationToken.isCancellationRequested()) return false; long remainingWorkInLoop = this.leaseRenewInterval.toMillis(); try { while (!cancellationToken.isCancellationRequested() && remainingWorkInLoop > 0) { Thread.sleep(100); remainingWorkInLoop -= 100; } } catch (InterruptedException ex) { logger.info(String.format("Partition %s: renewer task stopped.", self.lease.getLeaseToken())); return false; } return !cancellationToken.isCancellationRequested(); }) .then() .onErrorResume(throwable -> { logger.error(String.format("Partition %s: renew lease loop failed.", self.lease.getLeaseToken()), throwable); return Mono.error(throwable); }); }

Target:
public Mono<Void> run(CancellationToken cancellationToken) { logger.info("Partition {}: renewer task started.", this.lease.getLeaseToken()); return Mono.just(this) .flatMap(value -> { if (cancellationToken.isCancellationRequested()) { return Mono.empty(); } ZonedDateTime stopTimer = ZonedDateTime.now().plus(this.leaseRenewInterval); return Mono.just(value) .delayElement(Duration.ofMillis(100)) .repeat( () -> { ZonedDateTime currentTime = ZonedDateTime.now(); return !cancellationToken.isCancellationRequested() && currentTime.isBefore(stopTimer); }).last(); }) .flatMap(value -> { if (cancellationToken.isCancellationRequested()) { return Mono.empty(); } return this.renew(cancellationToken); }) .repeat(() -> { if (cancellationToken.isCancellationRequested()) { logger.info("Partition {}: renewer task stopped.", this.lease.getLeaseToken()); } return !cancellationToken.isCancellationRequested(); }) .then() .onErrorResume(throwable -> { logger.error("Partition {}: renew lease loop failed.", this.lease.getLeaseToken(), throwable); return Mono.error(throwable); }); }
Source:
private void buildPage() { checkState(outputPage == null); checkState(probe != null); if (pageBuilder.isEmpty()) { return; } outputPage = pageBuilder.build(probe); pageBuilder.reset(); }

Target:
private void buildPage() { verify(outputPage == null); verify(probe != null); if (pageBuilder.isEmpty()) { return; } outputPage = pageBuilder.build(probe); pageBuilder.reset(); }
Source:
public void aggregate(ByteBuffer buf, int position) { int size = card.sizeof(); byte[] bytes = new byte[size]; for (int i = 0; i < size; i++) { bytes[i] = buf.get(position + i); } ICardinality cardinalityCounter = new AdaptiveCounting(bytes); ICardinality valueToAgg = selector.get(); try { cardinalityCounter = cardinalityCounter.merge(valueToAgg); bytes = cardinalityCounter.getBytes(); for (int i = 0; i < size; i++) { buf.put(position + i, bytes[i]); } } catch (CardinalityMergeException e) { throw new RuntimeException("Failed to aggregate: "+e); } catch (IOException e) { throw new RuntimeException("Failed to aggregate: "+e); } }

Target:
public void aggregate(ByteBuffer buf, int position) { int size = card.sizeof(); byte[] bytes = new byte[size]; ByteBuffer copy = buf.duplicate(); copy.position(position); copy.get(bytes, 0, size); ICardinality cardinalityCounter = new AdaptiveCounting(bytes); ICardinality valueToAgg = selector.get(); try { cardinalityCounter = cardinalityCounter.merge(valueToAgg); bytes = cardinalityCounter.getBytes(); copy.position(position); copy.put(bytes); } catch (CardinalityMergeException e) { throw new RuntimeException("Failed to aggregate: "+e); } catch (IOException e) { throw new RuntimeException("Failed to aggregate: "+e); } }
Source:
public void compute1(final Polygon input, final DoubleType output) { final List<? extends RealLocalizable> minBB = minimumBoundingBoxFunc.compute1(input).getVertices(); final RealLocalizable p1 = minBB.get(0); final RealLocalizable p2 = minBB.get(1); final RealLocalizable p3 = minBB.get(2); double width = Math.sqrt(Math.pow(p1.getDoublePosition(0) - p2.getDoublePosition(0), 2) + Math.pow(p1.getDoublePosition(1) - p2.getDoublePosition(1), 2)); double length = Math.sqrt(Math.pow(p2.getDoublePosition(0) - p3.getDoublePosition(0), 2) + Math.pow(p2.getDoublePosition(1) - p3.getDoublePosition(1), 2)); if (width > length) { double tmp = width; width = length; length = tmp; } output.set(1d - (width / length)); }

Target:
public void compute1(final Polygon input, final DoubleType output) { final List<? extends RealLocalizable> minBB = minimumBoundingBoxFunc.compute1(input).getVertices(); final RealLocalizable p1 = minBB.get(0); final RealLocalizable p2 = minBB.get(1); final RealLocalizable p3 = minBB.get(2); double width = Math.sqrt(Math.pow(p1.getDoublePosition(0) - p2.getDoublePosition(0), 2) + Math.pow(p1.getDoublePosition(1) - p2.getDoublePosition(1), 2)); double length = Math.sqrt(Math.pow(p2.getDoublePosition(0) - p3.getDoublePosition(0), 2) + Math.pow(p2.getDoublePosition(1) - p3.getDoublePosition(1), 2)); if (width > length) { final double tmp = width; width = length; length = tmp; } output.set(1d - (width / length)); }
Source:
private void initMigrationPolicies() { AsyncQuery aQuery = new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { migrationPolicies = (List<MigrationPolicy>) returnValue; } }); aQuery.converterCallback = new IAsyncConverter() { @Override public Object convert(Object returnValue, AsyncQuery asyncQuery) { if (returnValue == null) { return new ArrayList<MigrationPolicy>(); } Collections.sort((List<MigrationPolicy>) returnValue, new Comparator<MigrationPolicy>() { @Override public int compare(MigrationPolicy m1, MigrationPolicy m2) { if (m1.getId() == NoMigrationPolicy.ID) { return -1; } return m1.getName().compareTo(m2.getName()); } }); return returnValue; } }; Frontend.getInstance().runQuery(VdcQueryType.GetAllMigrationPolicies, new VdcQueryParametersBase(), aQuery); }

Target:
private void initMigrationPolicies() { AsyncQuery aQuery = new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { migrationPolicies = (List<MigrationPolicy>) returnValue; } }); aQuery.converterCallback = new IAsyncConverter() { @Override public Object convert(Object returnValue, AsyncQuery asyncQuery) { if (returnValue == null) { return new ArrayList<MigrationPolicy>(); } Collections.sort((List<MigrationPolicy>) returnValue, new Comparator<MigrationPolicy>() { @Override public int compare(MigrationPolicy m1, MigrationPolicy m2) { if (NoMigrationPolicy.ID.equals(m1.getId())) { return -1; } return m1.getName().compareTo(m2.getName()); } }); return returnValue; } }; Frontend.getInstance().runQuery(VdcQueryType.GetAllMigrationPolicies, new VdcQueryParametersBase(), aQuery); }
Source:
private TypeMapping fromParquetGroup(GroupType type, String name) { LogicalTypeAnnotation ot = type.getLogicalTypeAnnotation(); if (ot == null) { List<TypeMapping> typeMappings = fromParquet(type.getFields()); Field arrowField = new Field(name, type.isRepetition(OPTIONAL), new Struct(), fields(typeMappings)); return new StructTypeMapping(arrowField, type, typeMappings); } else { return ot.accept(new LogicalTypeAnnotation.LogicalTypeAnnotationVisitor<TypeMapping>() { @Override public Optional<TypeMapping> visit(LogicalTypeAnnotation.ListLogicalTypeAnnotation logicalTypeAnnotation) { List3Levels list3Levels = new List3Levels(type); TypeMapping child = fromParquet(list3Levels.getElement(), null, list3Levels.getElement().getRepetition()); Field arrowField = new Field(name, type.isRepetition(OPTIONAL), new ArrowType.List(), asList(child.getArrowField())); return of(new ListTypeMapping(arrowField, list3Levels, child)); } }).orElseThrow(() -> new UnsupportedOperationException("Unsupported type " + type)); } }

Target:
private TypeMapping fromParquetGroup(GroupType type, String name) { LogicalTypeAnnotation logicalType = type.getLogicalTypeAnnotation(); if (logicalType == null) { List<TypeMapping> typeMappings = fromParquet(type.getFields()); Field arrowField = new Field(name, type.isRepetition(OPTIONAL), new Struct(), fields(typeMappings)); return new StructTypeMapping(arrowField, type, typeMappings); } else { return logicalType.accept(new LogicalTypeAnnotation.LogicalTypeAnnotationVisitor<TypeMapping>() { @Override public Optional<TypeMapping> visit(LogicalTypeAnnotation.ListLogicalTypeAnnotation listLogicalType) { List3Levels list3Levels = new List3Levels(type); TypeMapping child = fromParquet(list3Levels.getElement(), null, list3Levels.getElement().getRepetition()); Field arrowField = new Field(name, type.isRepetition(OPTIONAL), new ArrowType.List(), asList(child.getArrowField())); return of(new ListTypeMapping(arrowField, list3Levels, child)); } }).orElseThrow(() -> new UnsupportedOperationException("Unsupported type " + type)); } }
Source:
public String getClientId() { String clientId = (String) get(ConsumerConfig.CLIENT_ID_CONFIG); if (clientId == null) { throw new SamzaException("client Id is not set for consumer for system=" + systemName); } return clientId; }

Target:
public String getClientId() { String clientId = (String) get(ConsumerConfig.CLIENT_ID_CONFIG); if (StringUtils.isBlank(clientId)) { throw new SamzaException("client Id is not set for consumer for system=" + systemName); } return clientId; }
Source:
protected KV<K, V> nextPair() throws IOException, InterruptedException { K key = currentReader.getCurrentKey(); V value = currentReader.getCurrentValue(); if (key instanceof Writable) { key = (K) WritableUtils.clone((Writable) key, conf); } if (value instanceof Writable) { value = (V) WritableUtils.clone((Writable) value, conf); } if (value instanceof BinaryComparable) { final int length = ((BinaryComparable) value).getLength(); final int maxRowSize = conf.getInt("maxRowSize", 10 * 1024 * 1024); if (length >= maxRowSize) { throw new FileParameterException("Row size exceeded maximum allowed size"); } } return KV.of(key, value); }

Target:
protected KV<K, V> nextPair() throws IOException, InterruptedException { K key = currentReader.getCurrentKey(); V value = currentReader.getCurrentValue(); if (key instanceof Writable) { key = (K) WritableUtils.clone((Writable) key, conf); } if (value instanceof Writable) { value = (V) WritableUtils.clone((Writable) value, conf); } if (value instanceof BinaryComparable) { final int length = ((BinaryComparable) value).getLength(); final int maxRowSize = conf.getInt("maxRowSize", 10 * 1024 * 1024); if (length >= maxRowSize) { throw new FileParameterException("Row size exceeded maximum allowed size (" + maxRowSize + ")"); } } return KV.of(key, value); }
Source:
protected void executeCommand() { VDSReturnValue vdsReturnValue = extendUnderlyingVolumeSize(getImage()); setSucceeded(vdsReturnValue.getSucceeded()); if (vdsReturnValue.getSucceeded()) { Guid taskId = createTask(getAsyncTaskId(), vdsReturnValue.getCreationInfo(), getParameters().getParentCommand()); getTaskIdList().add(taskId); if (getParameters().getParentNotifiesCallback()) { getReturnValue().getInternalVdsmTaskIdList().add(taskId); List<Guid> vdsmTaskIds = new ArrayList<>(); vdsmTaskIds.add(taskId); getParameters().setVdsmTaskIds(vdsmTaskIds); getReturnValue().getVdsmTaskIdList().add(taskId); persistCommand(getParameters().getParentCommand(), true); } else { getTaskIdList().add(taskId); } if (getParameters().getParentNotifiesCallback()) { getParameters().setVdsmTaskIds(new ArrayList<>(Collections.singletonList(taskId))); getReturnValue().getVdsmTaskIdList().add(taskId); persistCommand(getParameters().getParentCommand(), true); } } else { updateAuditLog(AuditLogType.USER_EXTEND_DISK_SIZE_FAILURE, getParameters().getNewSizeInGB()); } }

Target:
protected void executeCommand() { VDSReturnValue vdsReturnValue = extendUnderlyingVolumeSize(getImage()); setSucceeded(vdsReturnValue.getSucceeded()); if (vdsReturnValue.getSucceeded()) { Guid taskId = createTask(getAsyncTaskId(), vdsReturnValue.getCreationInfo(), getParameters().getParentCommand()); getTaskIdList().add(taskId); if (getParameters().getParentNotifiesCallback()) { getReturnValue().getInternalVdsmTaskIdList().add(taskId); List<Guid> vdsmTaskIds = new ArrayList<>(); vdsmTaskIds.add(taskId); getParameters().setVdsmTaskIds(vdsmTaskIds); getReturnValue().getVdsmTaskIdList().add(taskId); persistCommand(getParameters().getParentCommand(), true); getParameters().setVdsmTaskIds(new ArrayList<>(Collections.singletonList(taskId))); getReturnValue().getVdsmTaskIdList().add(taskId); persistCommand(getParameters().getParentCommand(), true); } } else { updateAuditLog(AuditLogType.USER_EXTEND_DISK_SIZE_FAILURE, getParameters().getNewSizeInGB()); } }
Source:
protected static boolean isBatchScan(JobContext context) { return InputConfigurator.isIsolated(CLASS, context.getConfiguration()); }

Target:
public static boolean isBatchScan(JobContext context) { return InputConfigurator.isBatchScan(CLASS, context.getConfiguration()); }
Source:
private boolean isAssertion(MethodInvocationTree mit) { for (MethodInvocationMatcher methodInvocationMatcher : ASSERTION_INVOCATION_MATCHERS) { if (methodInvocationMatcher.matches(mit) && !FEST_AS_METHOD.matches(mit) && !FEST_OVERRIDE_ERROR_METHOD.matches(mit) && !FEST_DESCRIBED_AS_METHOD.matches(mit)) { return true; } } return false; }

Target:
private boolean isAssertion(MethodInvocationTree mit) { if (ASSERTION_INVOCATION_MATCHERS.anyMatch(mit) && !FEST_AS_METHOD.matches(mit) && !FEST_OVERRIDE_ERROR_METHOD.matches(mit) && !FEST_DESCRIBED_AS_METHOD.matches(mit)) { return true; } return false; }
Source:
private Map<String, GlusterServiceStatus> updateStatusToUnknown(Collection<GlusterServerService> existingServices) { Map<String, GlusterServiceStatus> serviceStatusMap = new HashMap<String, GlusterServiceStatus>(); List<GlusterServerService> servicesToUpdate = new ArrayList<GlusterServerService>(); for (GlusterServerService existingService : existingServices) { existingService.setStatus(GlusterServiceStatus.UNKNOWN); servicesToUpdate.add(existingService); serviceStatusMap.put(existingService.getServiceName(), existingService.getStatus()); } getGlusterServerServiceDao().updateAll(servicesToUpdate); return serviceStatusMap; }

Target:
private Map<String, GlusterServiceStatus> updateStatusToUnknown(Collection<GlusterServerService> existingServices) { Map<String, GlusterServiceStatus> serviceStatusMap = new HashMap<String, GlusterServiceStatus>(); for (GlusterServerService existingService : existingServices) { existingService.setStatus(GlusterServiceStatus.UNKNOWN); serviceStatusMap.put(existingService.getServiceName(), existingService.getStatus()); } getGlusterServerServiceDao().updateAll(existingServices); return serviceStatusMap; }
Source:
public CustomRobotDriverElement() throws NoSuchFieldException, IllegalAccessException { try { CustomRobotDriverElement.s = getLibraryInstance(); } catch (javax.script.ScriptException e) { e.printStackTrace(); } Field bmField = SeleniumLibrary.class.getDeclaredField("bm"); bmField.setAccessible(true); b = (BrowserManagement) bmField.get(s); }

Target:
public CustomRobotDriverElement() throws NoSuchFieldException, IllegalAccessException { try { CustomRobotDriverElement.s = getLibraryInstance(); } catch (ScriptException e) { throw new SeleniumLibraryNonFatalException("Cannot create SeleniumLibrary instance.", e); } Field bmField = SeleniumLibrary.class.getDeclaredField("bm"); bmField.setAccessible(true); b = (BrowserManagement) bmField.get(s); bmField.setAccessible(false); }
Source:
public String getSigningKeystorePath() { return getGatewayKeystoreDir() + "/" + DEFAULT_GATEWAY_KEYSTORE_NAME; }

Target:
public String getSigningKeystorePath() { return getGatewayKeystorePath().resolve(DEFAULT_GATEWAY_KEYSTORE_NAME).toString(); }
Source:
public static ToolTipString fromString(String text) { Objects.requireNonNull(text, "fromString cannot take null"); return new ToolTipString(text, toHtmlString(text)); }

Target:
public static ToolTipString fromString(String text) { return new ToolTipString(text, toHtmlString(text)); }
Source:
protected JsonWebToken validateToken(String encodedToken, boolean ignoreAudience) { if (encodedToken == null) { throw new IdentityBrokerException("No token from server."); } JsonWebToken token; try { JWSInput jws = new JWSInput(encodedToken); if (!verify(jws)) { throw new IdentityBrokerException("token signature validation failed"); } token = jws.readJsonContent(JsonWebToken.class); } catch (JWSInputException e) { throw new IdentityBrokerException("Invalid token", e); } String iss = token.getIssuer(); if (!token.isActive(getConfig().getAllowedClockSkew())) { throw new IdentityBrokerException("Token is no longer valid"); } if (!ignoreAudience && !token.hasAudience(getConfig().getClientId())) { throw new IdentityBrokerException("Wrong audience from token."); } if (!ignoreAudience && !getConfig().getClientId().equals(token.getIssuedFor())) { throw new IdentityBrokerException("Token not issued for client [" + getConfig().getClientId() + "]"); } String trustedIssuers = getConfig().getIssuer(); if (trustedIssuers != null && trustedIssuers.length() > 0) { String[] issuers = trustedIssuers.split(","); for (String trustedIssuer : issuers) { if (iss != null && iss.equals(trustedIssuer.trim())) { return token; } } throw new IdentityBrokerException("Wrong issuer from token. Got: " + iss + " expected: " + getConfig().getIssuer()); } return token; }

Target:
protected JsonWebToken validateToken(String encodedToken, boolean ignoreAudience) { if (encodedToken == null) { throw new IdentityBrokerException("No token from server."); } JsonWebToken token; try { JWSInput jws = new JWSInput(encodedToken); if (!verify(jws)) { throw new IdentityBrokerException("token signature validation failed"); } token = jws.readJsonContent(JsonWebToken.class); } catch (JWSInputException e) { throw new IdentityBrokerException("Invalid token", e); } String iss = token.getIssuer(); if (!token.isActive(getConfig().getAllowedClockSkew())) { throw new IdentityBrokerException("Token is no longer valid"); } if (!ignoreAudience && !token.hasAudience(getConfig().getClientId())) { throw new IdentityBrokerException("Wrong audience from token."); } if (!ignoreAudience && (token.getIssuedFor() != null && !getConfig().getClientId().equals(token.getIssuedFor()))) { throw new IdentityBrokerException("Token issued for does not match client id"); } String trustedIssuers = getConfig().getIssuer(); if (trustedIssuers != null && trustedIssuers.length() > 0) { String[] issuers = trustedIssuers.split(","); for (String trustedIssuer : issuers) { if (iss != null && iss.equals(trustedIssuer.trim())) { return token; } } throw new IdentityBrokerException("Wrong issuer from token. Got: " + iss + " expected: " + getConfig().getIssuer()); } return token; }
Source:
public void checkCurrentPassword(String value, int expertId, List<String> validationFailures) { Expert expert = expertService.getExpertById(expertId); if (!passwordEncoder.matches(value, expert.getPassword())) { validationFailures.add(String.format(FAILURE_INCORRECT_VALUE, PASSWORD_FIELD_NAME)); } }

Target:
public void checkCurrentPassword(String value, int expertId, List<String> validationFailures) { Expert expert = expertService.getExpertById(expertId); if (!passwordEncoder.matches(value, expert.getPassword())) { validationFailures.add(String.format(FAILURE_INCORRECT_VALUE, CURRENT_PASSWORD_FIELD_NAME)); } }
Source:
public void add(final Interval interval) { ValidationUtils.validateArg(header.getSequence(interval.getContig()) != null, () -> String.format("Cannot add interval %s, contig not in header", interval.toString())); this.intervals.add(interval); }

Target:
public void add(final Interval interval) { ValidationUtils.nonNull(header.getSequence(interval.getContig()), () -> String.format("Cannot add interval %s, contig not in header", interval.toString())); this.intervals.add(interval); }
Source:
public CigarElement(final int length, final CigarOperator operator) { if (length < 0) throw new IllegalArgumentException("Cigar element being constructed with negative length: " + length); this.length = length; this.operator = operator; }

Target:
public CigarElement(final int length, final CigarOperator operator) { if (length < 0) throw new IllegalArgumentException(String.format("Cigar element being constructed with negative length: %d and operation: %s" , length, operator.name())); this.length = length; this.operator = operator; }
Source:
public AbstractSquareDecorator getDecorator(AbstractSquare square) { return null; }

Target:
public AbstractSquareDecorator getDecorator(AbstractSquare square) { return new LightTrailDecorator(square); }
Source:
private void testEditCommentsActionAfterAddingComments() throws IOException { ______TS("edit comments on responses and verify added comments action"); submitPage = loginToInstructorFeedbackSubmitPage("IFSubmitUiT.instr", "Open Session"); submitPage.waitForPageToLoad(); submitPage.verifyHtmlMainContent("/instructorFeedbackSubmitPageAddedCommentOnResponses.html"); submitPage.editFeedbackResponseComment("-0-1-6-1", "Edited MCQ Comment 1"); submitPage.editFeedbackResponseComment("-1-1-6-1", "Edited MCQ Comment 2"); submitPage.editFeedbackResponseComment("-2-1-6-1", "Edited MCQ Comment 3"); submitPage.editFeedbackResponseComment("-0-1-9-1", "Edited MCQ Comment 4"); submitPage.editFeedbackResponseComment("-0-1-11-1", "Edited MCQ Comment 5"); submitPage.editFeedbackResponseComment("-0-1-15-1", "Edited MCQ Comment 6"); submitPage.submitWithoutConfirmationEmail(); submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, Const.StatusMessages.FEEDBACK_UNANSWERED_QUESTIONS + "21, 24."); }

Target:
private void testEditCommentsActionAfterAddingComments() { ______TS("edit comments on responses and verify added comments action"); submitPage = loginToInstructorFeedbackSubmitPage("IFSubmitUiT.instr", "Open Session"); submitPage.waitForPageToLoad(); submitPage.editFeedbackParticipantComment("-6-0", "Edited MCQ Comment 1"); submitPage.editFeedbackParticipantComment("-6-1", "Edited MCQ Comment 2"); submitPage.editFeedbackParticipantComment("-9-0", "Edited MCQ Comment 3"); submitPage.submitWithoutConfirmationEmail(); submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, Const.StatusMessages.FEEDBACK_UNANSWERED_QUESTIONS + "1, 2, 3, 4, 5, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24."); submitPage = loginToInstructorFeedbackSubmitPage("IFSubmitUiT.instr", "Open Session"); submitPage.waitForPageToLoad(); submitPage.verifyCommentRowContent("-6-0", "Edited MCQ Comment 1"); submitPage.verifyCommentRowContent("-6-1", "Edited MCQ Comment 2"); submitPage.verifyCommentRowContent("-9-0", "Edited MCQ Comment 3"); }
Source:
public void sendNotification(@Identification final String organisationIdentification, final String deviceIdentification, final String result, final String correlationUid, final String message, final NotificationType notificationType) { LOGGER.info("sendNotification called with organisation: {}, correlationUid: {}, type: {}", organisationIdentification, correlationUid, notificationType); final Notification notification = new Notification(); notification.setMessage(message); notification.setResult(result); notification.setDeviceIdentification(deviceIdentification); notification.setCorrelationUid(correlationUid); notification.setNotificationType(notificationType); try { this.sendNotificationServiceClient.sendNotification(organisationIdentification, notification, this.notificationURL); } catch (final WebServiceSecurityException e){ e.printStackTrace(); } }

Target:
public void sendNotification(@Identification final String organisationIdentification, final String deviceIdentification, final String result, final String correlationUid, final String message, final NotificationType notificationType) { LOGGER.info("sendNotification called with organisation: {}, correlationUid: {}, type: {}", organisationIdentification, correlationUid, notificationType); final Notification notification = new Notification(); notification.setMessage(message); notification.setResult(result); notification.setDeviceIdentification(deviceIdentification); notification.setCorrelationUid(correlationUid); notification.setNotificationType(notificationType); try { this.sendNotificationServiceClient.sendNotification(organisationIdentification, notification, this.notificationURL); } catch (final WebServiceSecurityException e){ LOGGER.error(e.getMessage(), e); } }
Source:
public TileRenderRunnable( TileCanvasViewGroup viewGroup, Tile tile) { this.mTileCanvasViewGroup = new WeakReference<>( viewGroup ); this.mTile = new WeakReference<>( tile ); }

Target:
public TileRenderRunnable( TileCanvasViewGroup viewGroup, Tile tile) { mTileCanvasViewGroup = new WeakReference<>( viewGroup ); mTile = new WeakReference<>( tile ); }
Source:
private String sourceName(Token t) { CharStream input = t.getInputStream(); String srcName = null; if ( input!=null ) { srcName = input.getSourceName(); if ( srcName!=null ) srcName = Misc.getFileName(srcName); } return srcName; }

Target:
private String sourceName(Token t) { CharStream input = t.getInputStream(); if ( input==null ) { return null; } String srcName = input.getSourceName(); if ( srcName!=null ) { srcName = Misc.getFileName(srcName); } return srcName; }
Source:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final Bundle arguments = getArguments(); if (arguments != null) { @ScreenDef String screenName = arguments.getString(Router.EXTRA_SCREEN_NAME); if (!TextUtils.isEmpty(screenName)) { switch (screenName) { case Screen.SETTINGS: environment.getRouter().showSettings(getActivity()); break; } } } }

Target:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); handleIntentBundle(getArguments()); }
Source:
public void apply(final LoadingCache<EncodedKey<K>, Tagged<V>> kvCache) { try { Tagged<V> tagged; V loadedValue; while (true) { tagged = kvCache.get(encodedKey); final int staleness = workerClock.getGlobalMinimumClock() - tagged.getClock(); if (staleness < stalenessBound) { loadedValue = tagged.getValue(); break; } else { kvCache.invalidate(encodedKey); } } synchronized (this) { this.value = loadedValue; notify(); } } catch (final ExecutionException e) { throw new RuntimeException(e); } }

Target:
public void apply(final LoadingCache<EncodedKey<K>, Tagged<V>> kvCache) { try { final V loadedValue; while (true) { final Tagged<V> tagged = kvCache.get(encodedKey); final int staleness = workerClock.getGlobalMinimumClock() - tagged.getClock(); if (staleness <= stalenessBound) { loadedValue = tagged.getValue(); break; } else { kvCache.invalidate(encodedKey); } } synchronized (this) { this.value = loadedValue; notify(); } } catch (final ExecutionException e) { throw new RuntimeException(e); } }
Source:
private static ErlangModuleBuildOrderDescriptor getModuleBuildOrderInner(Module module) throws CyclicDependencyFoundException { ErlangModuleBuildOrderDescriptor buildOrder = new ErlangModuleBuildOrderDescriptor(); ErlangFacet erlangFacet = ErlangFacet.getFacet(module); List<String> globalParseTransforms = erlangFacet != null ? erlangFacet.getConfiguration().getParseTransforms() : ContainerUtil.<String>emptyList(); buildOrder.myModuleName = module.getName(); buildOrder.myOrderedErlangModulePaths = getTopologicallySortedErlangModulePaths(ErlangModulesUtil.getErlangModules(module, false), ErlangModulesUtil.getErlangHeaders(module, false), globalParseTransforms); buildOrder.myOrderedErlangTestModulePaths = getTopologicallySortedErlangModulePaths(ErlangModulesUtil.getErlangModules(module, true), ErlangModulesUtil.getErlangHeaders(module, true), ContainerUtil.<String>emptyList()); return buildOrder; }

Target:
private static ErlangModuleBuildOrderDescriptor getModuleBuildOrderInner(Module module) throws CyclicDependencyFoundException { ErlangModuleBuildOrderDescriptor buildOrder = new ErlangModuleBuildOrderDescriptor(); buildOrder.myModuleName = module.getName(); buildOrder.myOrderedErlangFilePaths = getTopologicallySortedErlangFilesPaths(module, false); buildOrder.myOrderedErlangTestFilePaths = getTopologicallySortedErlangFilesPaths(module, true); return buildOrder; }
Source:
public void add(@Nonnull final SexGenotypeData sexGenotypeData) { sexGenotypeDataList.add(sexGenotypeData); sampleNames.add(sexGenotypeData.getSampleName()); sampleNamesToSexGenotypeDataMap.put(sexGenotypeData.getSampleName(), sexGenotypeData); }

Target:
public void add(@Nonnull final SexGenotypeData sexGenotypeData) { Utils.validateArg(!sampleNames.contains(sexGenotypeData.getSampleName()), "Sex genotype data " + "for sample \"" + sexGenotypeData.getSampleName() + "\" is already in the collection"); sexGenotypeDataList.add(sexGenotypeData); sampleNames.add(sexGenotypeData.getSampleName()); sampleNamesToSexGenotypeDataMap.put(sexGenotypeData.getSampleName(), sexGenotypeData); }
Source:
public boolean equals(Object o) { return this == o || (o != null && getClass() == o.getClass() && id.equals(((AbstractIdentifier) o).id)); }

Target:
public final boolean equals(Object o) { return this == o || (o != null && getClass() == o.getClass() && id.equals(((AbstractIdentifier) o).id)); }
Source:
private static SqlManager getSqlManager(Log logger, SupportedDatabase db) { SqlManager instance = null; switch (db) { case oracle: instance = new OracleSqlManager(logger, new OracleSqlDataType()); break; case foxpro: instance = new SqlManagerImpl(logger, new FoxProDataType()); break; case mysql: instance = new MysqlSqlManager(logger, new MySqlDataType()); break; case postgresql: instance = new PostgreSqlManager(logger, new PostgresqlDataType()); break; case h2: instance = new H2SqlManager(logger, new H2DataType()); break; case hsql: instance = new HyperSqlManager(logger, new HyperSqlDataType()); break; default: break; } return instance; }

Target:
private static SqlManager getSqlManager(Log logger, SupportedDatabase db) throws OseeCoreException { SqlManager instance = null; switch (db) { case oracle: instance = new OracleSqlManager(logger, new OracleSqlDataType()); break; case foxpro: instance = new SqlManagerImpl(logger, new FoxProDataType()); break; case mysql: instance = new MysqlSqlManager(logger, new MySqlDataType()); break; case postgresql: instance = new PostgreSqlManager(logger, new PostgresqlDataType()); break; case h2: instance = new H2SqlManager(logger, new H2DataType()); break; case hsql: instance = new HyperSqlManager(logger, new HyperSqlDataType()); break; default: throw new OseeDataStoreException("Unsupported database type [%s] ", db); } return instance; }
Source:
public void accept(FluxSink<T> fluxSink) { FluxSinkRecorderDelegate<T> previousDelegate = this.delegate; synchronized (this) { delegate = new DirectDelegate<>(fluxSink); previousDelegate.accept(fluxSink); } }

Target:
public synchronized void accept(FluxSink<T> fluxSink) { FluxSinkRecorderDelegate<T> previousDelegate = this.delegate; delegate = new DirectDelegate<>(fluxSink); previousDelegate.accept(fluxSink); }
Source:
public void run() { while (!isInterrupted()) { try { InputStream in = getInput(); if (in != null) { String data = read(in); if (!data.isEmpty()) { buf.append(data); if (buf.length() > MAX_OUTPUT) { buf.delete(0, buf.length() - MAX_OUTPUT); } extractOutputs(); } } } catch (IOException e) { LOG.error(e.getMessage(), e); } try { sleep(100); } catch (InterruptedException e) { break; } } LOG.debug(getName() + " has been stopped"); }

Target:
public void run() { try { InputStream in = getInput(); if (in != null) { String outputData = read(in); if (!outputData.isEmpty()) { outputBuffer.append(outputData); if (outputBuffer.length() > MAX_OUTPUT) { outputBuffer.delete(0, outputBuffer.length() - MAX_OUTPUT); } extractOutputs(); } } } catch (IOException e) { LOG.error(e.getMessage(), e); } }
Source:
public Object postProcessAfterInitialization(final Object bean, final String beanName) { if (bean == null) { return null; } final Class<?> targetClass = getTargetClass(bean); final TaskChannel taskChannel = targetClass.getAnnotation(TaskChannel.class); if (taskChannel != null) { LOGGER.debug("The @TaskChannel annotation was found in {}", targetClass.getName()); doWithMethods(targetClass, new ReflectionUtils.MethodCallback() { @Override public void doWith(Method method) throws IllegalAccessException { Method targetMethod = findMethod( targetClass, method.getName(), method.getParameterTypes() ); if (targetMethod != null) { TaskAction taskAction = targetMethod.getAnnotation(TaskAction.class); if (taskAction != null) { String serviceInterface = getServiceInterface(targetClass); Channel channel = getChannel(taskChannel); addActionTaskEvent(channel, serviceInterface, targetMethod, taskAction); } } } }); } return bean; }

Target:
public Object postProcessAfterInitialization(final Object bean, final String beanName) { if (bean == null) { return null; } final Class<?> targetClass = getTargetClass(bean); final TaskChannel taskChannel = targetClass.getAnnotation(TaskChannel.class); if (taskChannel != null) { LOGGER.debug("The @TaskChannel annotation was found in {}", targetClass.getName()); doWithMethods(targetClass, new ReflectionUtils.MethodCallback() { @Override public void doWith(Method method) throws IllegalAccessException { Method targetMethod = findMethod( targetClass, method.getName(), method.getParameterTypes() ); if (targetMethod != null) { TaskAction taskAction = targetMethod.getAnnotation(TaskAction.class); if (taskAction != null) { LOGGER.debug("The @TaskAction annotation was found in method: {}", targetMethod.getName()); String serviceInterface = getServiceInterface(targetClass); Channel channel = getChannel(taskChannel); addActionTaskEvent(channel, serviceInterface, targetMethod, taskAction); } } } }); } return bean; }
Source:
public PaginableDocumentModelListImpl run() throws OperationException { OperationChain chain = new OperationChain("operation"); Map<String, Object> vars = new HashMap<>(); { StringList sl = new StringList(); sl.add(searchTerm + (searchTerm.endsWith("%") ? "" : "%")); sl.add(DocumentPageProviderOperation.CURRENT_USERID_PATTERN); vars.put("queryParams", sl); vars.put("providerName", CollectionConstants.COLLECTION_PAGE_PROVIDER); } OperationParameters oparams = new OperationParameters(DocumentPageProviderOperation.ID, vars); chain.add(oparams); return (PaginableDocumentModelListImpl) service.run(ctx, chain); }

Target:
public PaginableDocumentModelListImpl run() throws OperationException { StringList sl = new StringList(); sl.add(searchTerm + (searchTerm.endsWith("%") ? "" : "%")); sl.add(DocumentPageProviderOperation.CURRENT_USERID_PATTERN); OperationChain chain = new OperationChain("operation"); Map<String, Object> vars = new HashMap<>(); vars.put("queryParams", sl); vars.put("providerName", CollectionConstants.COLLECTION_PAGE_PROVIDER); OperationParameters oparams = new OperationParameters(DocumentPageProviderOperation.ID, vars); chain.add(oparams); return (PaginableDocumentModelListImpl) service.run(ctx, chain); }
Source:
private void addTableFromEntity(Entity entity, List<String> tableList) { Table tbl; switch (entity.getType()) { case TABLE: tbl = entity.getTable(); break; case PARTITION: case DUMMYPARTITION: tbl = entity.getPartition().getTable(); break; default: return; } String fullTableName = AcidUtils.getFullTableName(tbl.getDbName(), tbl.getTableName()); if (AcidUtils.isTransactionalTable(tbl) && !tableList.contains(fullTableName)) { tableList.add(fullTableName); } }

Target:
private void addTableFromEntity(Entity entity, List<String> tableList) { Table tbl; switch (entity.getType()) { case TABLE: { tbl = entity.getTable(); break; } case PARTITION: case DUMMYPARTITION: { tbl = entity.getPartition().getTable(); break; } default: { return; } } String fullTableName = AcidUtils.getFullTableName(tbl.getDbName(), tbl.getTableName()); if (AcidUtils.isTransactionalTable(tbl) && !tableList.contains(fullTableName)) { tableList.add(fullTableName); } }
Source:
protected String getText(Object element, int columnIndex) { switch(columnIndex) { case PACKAGE_ELEMENT_COLUMN_INDEX: return umlLabelProvider.getText(element); case PROFILE_APPLICATION_NAME_COLUMN_INDEX: if(element instanceof Profile) { return ((Profile)element).getQualifiedName(); } default: return ""; } }

Target:
protected String getText(Object element, int columnIndex) { switch(columnIndex) { case PACKAGE_ELEMENT_COLUMN_INDEX: return umlLabelProvider.getText(element); case PROFILE_APPLICATION_NAME_COLUMN_INDEX: if(element instanceof ProfileApplication) { return ((ProfileApplication)element).getAppliedProfile().getQualifiedName(); } default: return ""; } }