auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public CheckpointResult checkpointGroupStates(final Tuple<String, Group> tuple) { final String groupId = tuple.getKey(); final Group group = tuple.getValue(); final GroupCheckpoint checkpoint = group.checkpoint(); try { final File storedFile = getGroupCheckpointFile(groupId); if (storedFile.exists()) { storedFile.delete(); LOG.log(Level.INFO, "Checkpoint deleted for groupId: {0}", groupId); } storedFile.getParentFile().mkdirs(); final DataFileWriter<GroupCheckpoint> dataFileWriter = new DataFileWriter<>(groupCheckpointDatumWriter); dataFileWriter.create(checkpoint.getSchema(), storedFile); dataFileWriter.append(checkpoint); dataFileWriter.close(); LOG.log(Level.INFO, "Checkpoint completed for groupId: {0}", groupId); } catch (final Exception e) { e.printStackTrace(); return CheckpointResult.newBuilder() .setIsSuccess(false) .setMsg("Unsuccessful in checkpointing group " + tuple.getKey()) .setPathToCheckpoint("") .build(); } for (final ExecutionDag ed : group.getExecutionDags().values()) { for (final ExecutionVertex ev : ed.getDag().getVertices()) { if (ev.getType() == ExecutionVertex.Type.OPERATOR) { final Operator op = ((DefaultPhysicalOperatorImpl) ev).getOperator(); if (op instanceof StateHandler) { final StateHandler stateHandler = (StateHandler) op; stateHandler.removeOldStates(checkpoint.getCheckpointTimestamp()); } } } } return CheckpointResult.newBuilder() .setIsSuccess(true) .setMsg("Successfully checkpointed group " + tuple.getKey()) .setPathToCheckpoint(getGroupCheckpointFile(groupId).toString()) .build(); }

Target:
public CheckpointResult checkpointGroupStates(final Tuple<String, Group> tuple) { final String groupId = tuple.getKey(); final Group group = tuple.getValue(); final GroupCheckpoint checkpoint = group.checkpoint(); try { final File storedFile = getGroupCheckpointFile(groupId); if (storedFile.exists()) { storedFile.delete(); LOG.log(Level.INFO, "Checkpoint deleted for groupId: {0}", groupId); } final DataFileWriter<GroupCheckpoint> dataFileWriter = new DataFileWriter<>(groupCheckpointDatumWriter); dataFileWriter.create(checkpoint.getSchema(), storedFile); dataFileWriter.append(checkpoint); dataFileWriter.close(); LOG.log(Level.INFO, "Checkpoint completed for groupId: {0}", groupId); } catch (final Exception e) { e.printStackTrace(); return CheckpointResult.newBuilder() .setIsSuccess(false) .setMsg("Unsuccessful in checkpointing group " + tuple.getKey()) .setPathToCheckpoint("") .build(); } for (final ExecutionDag ed : group.getExecutionDags().values()) { for (final ExecutionVertex ev : ed.getDag().getVertices()) { if (ev.getType() == ExecutionVertex.Type.OPERATOR) { final Operator op = ((DefaultPhysicalOperatorImpl) ev).getOperator(); if (op instanceof StateHandler) { final StateHandler stateHandler = (StateHandler) op; stateHandler.removeOldStates(checkpoint.getCheckpointTimestamp()); } } } } return CheckpointResult.newBuilder() .setIsSuccess(true) .setMsg("Successfully checkpointed group " + tuple.getKey()) .setPathToCheckpoint(getGroupCheckpointFile(groupId).toString()) .build(); }
Source:
public AuthnRequest build(final SAML2MessageContext context) { final SingleSignOnService ssoService = context.getIDPSingleSignOnService(this.bindingType); final String idx = this.assertionConsumerServiceIndex > 0 ? String.valueOf(assertionConsumerServiceIndex) : null; final AssertionConsumerService assertionConsumerService = context.getSPAssertionConsumerService(idx); assertionConsumerService.setLocation(this.urlResolver.compute(assertionConsumerService.getLocation(), context.getWebContext())); return buildAuthnRequest(context, assertionConsumerService, ssoService); }

Target:
public AuthnRequest build(final SAML2MessageContext context) { final SingleSignOnService ssoService = context.getIDPSingleSignOnService(this.bindingType); final String idx = this.assertionConsumerServiceIndex > 0 ? String.valueOf(assertionConsumerServiceIndex) : null; final AssertionConsumerService assertionConsumerService = context.getSPAssertionConsumerService(idx); return buildAuthnRequest(context, assertionConsumerService, ssoService); }
Source:
public ReleaseWebHookStatus(final String payloadUrl, final int status) { this.payloadUrl = payloadUrl; this.status = status; this.timeStamp = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").format(new Date()); }

Target:
public ReleaseWebHookStatus(final String payloadUrl, final int status) { this.payloadUrl = payloadUrl; this.statusCode = status; this.timeStamp = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").format(new Date()); }
Source:
public JavaImplementationCodeMining(IType element, JavaEditor editor, IDocument document, ICodeMiningProvider provider, boolean showImplementationsAtLeastOne) throws JavaModelException, BadLocationException { super(element, document, provider, e -> new FindImplementorsAction(editor).run(element)); this.showImplementationsAtLeastOne= showImplementationsAtLeastOne; }

Target:
public JavaImplementationCodeMining(IType element, JavaEditor editor, IDocument document, ICodeMiningProvider provider, boolean showImplementationsAtLeastOne) throws JavaModelException, BadLocationException { super(element, document, provider, null); this.editor= editor; this.showImplementationsAtLeastOne= showImplementationsAtLeastOne; }
Source:
public void start() throws Exception { JsonObject config = new JsonObject().put("url", "jdbc:hsqldb:mem:test?shutdown=true") .put("driver_class", "org.hsqldb.jdbcDriver"); String sql = "CREATE TABLE colors (" + "id INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY, " + "name VARCHAR(255), " + "datetime TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL)"; JDBCClient client = JDBCClient.createShared(vertx, config); client .rxGetConnection() .flatMap(conn -> conn .rxSetAutoCommit(false) .flatMap(autoCommit -> conn.rxExecute(sql)) .flatMap(executed -> conn.rxUpdateWithParams("INSERT INTO colors (name) VALUES (?)", new JsonArray().add("BLACK"))) .flatMap(updateResult -> conn.rxUpdateWithParams("INSERT INTO colors (name) VALUES (?)", new JsonArray().add("WHITE"))) .flatMap(updateResult -> conn.rxUpdateWithParams("INSERT INTO colors (name) VALUES (?)", new JsonArray().add("PURPLE"))) .flatMap(updateResult -> conn.rxQuery("SELECT * FROM colors")) .doOnSuccess(resultSet -> conn.rxCommit().subscribe()) .doOnError(throwable -> conn.rxRollback().subscribe()) .doAfterTerminate(conn::close) ).subscribe(resultSet -> { System.out.println("Results : " + resultSet.getRows()); }, Throwable::printStackTrace); }

Target:
public void start() throws Exception { JsonObject config = new JsonObject().put("url", "jdbc:hsqldb:mem:test?shutdown=true") .put("driver_class", "org.hsqldb.jdbcDriver"); String sql = "CREATE TABLE colors (" + "id INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY, " + "name VARCHAR(255), " + "datetime TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL)"; JDBCClient client = JDBCClient.createShared(vertx, config); client .rxGetConnection() .flatMap(conn -> conn .rxSetAutoCommit(false) .flatMap(autoCommit -> conn.rxExecute(sql)) .flatMap(executed -> conn.rxUpdateWithParams("INSERT INTO colors (name) VALUES (?)", new JsonArray().add("BLACK"))) .flatMap(updateResult -> conn.rxUpdateWithParams("INSERT INTO colors (name) VALUES (?)", new JsonArray().add("WHITE"))) .flatMap(updateResult -> conn.rxUpdateWithParams("INSERT INTO colors (name) VALUES (?)", new JsonArray().add("PURPLE"))) .flatMap(updateResult -> conn.rxCommit().map(commit -> updateResult)) .onErrorResumeNext(ex -> conn.rxRollback() .onErrorResumeNext(ex2 -> Single.error(new CompositeException(ex, ex2))) .flatMap(ignore -> Single.error(ex)) ) .flatMap(updateResult -> conn.rxQuery("SELECT * FROM colors")) .doAfterTerminate(conn::close) ).subscribe(resultSet -> { System.out.println("Results : " + resultSet.getRows()); }, Throwable::printStackTrace); }
Source:
private synchronized static SslContext createSslContext() throws SSLException { if (sslBuilder == null) { sslBuilder = GrpcSslContexts.forClient().ciphers(null); if (OpenSsl.isAvailable()) { LOG.info("gRPC is using the OpenSSL provider (tcnactive jar)"); } else { LOG.info("gRPC is using the JDK provder (alpn-boot jar)"); } } return sslBuilder.build(); }

Target:
private synchronized static SslContext createSslContext() throws SSLException { if (sslBuilder == null) { sslBuilder = GrpcSslContexts.forClient().ciphers(null); if (OpenSsl.isAvailable()) { LOG.info("gRPC is using the OpenSSL provider (tcnactive jar)"); } else { LOG.info("gRPC is using the JDK provider (alpn-boot jar)"); } } return sslBuilder.build(); }
Source:
protected LocalSearchForager buildForager(HeuristicConfigPolicy configPolicy) { LocalSearchForagerConfig foragerConfig_; if (foragerConfig != null) { if (localSearchType != null) { throw new IllegalArgumentException("The localSearchType (" + localSearchType + ") must not be configured if the foragerConfig (" + foragerConfig + ") is explicitly configured."); } foragerConfig_ = foragerConfig; } else { LocalSearchType localSearchType_ = defaultIfNull(localSearchType, LocalSearchType.LATE_ACCEPTANCE); foragerConfig_ = new LocalSearchForagerConfig(); switch (localSearchType_) { case HILL_CLIMBING: foragerConfig_.setAcceptedCountLimit(1); break; case TABU_SEARCH: foragerConfig_.setAcceptedCountLimit(1000); break; case SIMULATED_ANNEALING: case LATE_ACCEPTANCE: foragerConfig_.setAcceptedCountLimit(1); break; case GREAT_DELUGE: foragerConfig_.setAcceptedCountLimit(4); case VARIABLE_NEIGHBORHOOD_DESCENT: foragerConfig_.setPickEarlyType(LocalSearchPickEarlyType.FIRST_LAST_STEP_SCORE_IMPROVING); break; default: throw new IllegalStateException("The localSearchType (" + localSearchType_ + ") is not implemented."); } } return foragerConfig_.buildForager(configPolicy); }

Target:
protected LocalSearchForager buildForager(HeuristicConfigPolicy configPolicy) { LocalSearchForagerConfig foragerConfig_; if (foragerConfig != null) { if (localSearchType != null) { throw new IllegalArgumentException("The localSearchType (" + localSearchType + ") must not be configured if the foragerConfig (" + foragerConfig + ") is explicitly configured."); } foragerConfig_ = foragerConfig; } else { LocalSearchType localSearchType_ = defaultIfNull(localSearchType, LocalSearchType.LATE_ACCEPTANCE); foragerConfig_ = new LocalSearchForagerConfig(); switch (localSearchType_) { case HILL_CLIMBING: foragerConfig_.setAcceptedCountLimit(1); break; case TABU_SEARCH: foragerConfig_.setAcceptedCountLimit(1000); break; case SIMULATED_ANNEALING: case LATE_ACCEPTANCE: foragerConfig_.setAcceptedCountLimit(1); break; case GREAT_DELUGE: foragerConfig_.setAcceptedCountLimit(1); break; case VARIABLE_NEIGHBORHOOD_DESCENT: foragerConfig_.setPickEarlyType(LocalSearchPickEarlyType.FIRST_LAST_STEP_SCORE_IMPROVING); break; default: throw new IllegalStateException("The localSearchType (" + localSearchType_ + ") is not implemented."); } } return foragerConfig_.buildForager(configPolicy); }
Source:
public void fromAction() { Completable.fromAction(new Action() { @Override public void run() throws Exception { } }) .test() .assertResult(); }

Target:
public void fromAction() { final AtomicInteger atomicInteger = new AtomicInteger(); Completable.fromAction(new Action() { @Override public void run() throws Exception { atomicInteger.incrementAndGet(); } }) .test() .assertResult(); assertEquals(1, atomicInteger.get()); }
Source:
public void revokeToken(final String token) { validateToken(token); removeRevokedExpiredToken(token); log.revokedToken(getTokenDisplayText(token)); }

Target:
public void revokeToken(final String token) { removeToken(token); log.revokedToken(getTokenDisplayText(token)); }
Source:
private void syncContents(OwnCloudClient client) { startDirectDownloads(); startContentSynchronizations(mFilesToSyncContentsWithoutUpload, client); startContentSynchronizations(mFavouriteFilesToSyncContents, client); walkSubfolders(mFoldersToWalkDown, client); }

Target:
private void syncContents(OwnCloudClient client) { startDirectDownloads(); startContentSynchronizations(mFilesToSyncContentsWithoutUpload, client); startContentSynchronizations(mFavouriteFilesToSyncContents, client); walkSubfolders(client); }
Source:
private VmInfoBuilderBase createBuilder() { if (VmDeviceCommonUtils.isOldClusterVersion(vm.getvds_group_compatibility_version())) return new VmOldInfoBuilder(vm, createInfo); else return new VmInfoBuilder(vm, createInfo); }

Target:
private VmInfoBuilderBase createBuilder() { if (VmDeviceCommonUtils.isOldClusterVersion(vm.getvds_group_compatibility_version())) { return new VmOldInfoBuilder(vm, createInfo); } else { return new VmInfoBuilder(vm, createInfo); } }
Source:
private void iterateGroupNodes(long groupdId, NodeReader nodeReader) { int currentPointer = (int) headPointers.get(groupdId); if (currentPointer == NULL) { nodeReader.read(NULL); } else { while (currentPointer != NULL) { checkState(currentPointer < nextNodePointer, "error, corrupt pointer; max valid %s, found %s", nextNodePointer, currentPointer); nodeReader.read(currentPointer); currentPointer = nextPointers.get(currentPointer); } } }

Target:
private void iterateGroupNodes(long groupdId, NodeReader nodeReader) { int currentPointer = (int) headPointers.get(groupdId); checkArgument(currentPointer != NULL, "valid group must have non-null head pointer"); while (currentPointer != NULL) { checkState(currentPointer < nextNodePointer, "error, corrupt pointer; max valid %s, found %s", nextNodePointer, currentPointer); nodeReader.read(currentPointer); currentPointer = nextPointers.get(currentPointer); } }
Source:
public void postConstruct(){ jobStorage = (IJobStorage) context.getAttribute(Constants.JOBS_STORAGE); responser = (ResponseBuilder) context.getAttribute(Constants.RESPONSER); initializationTimestamp = DateTime.now(); }

Target:
public void postConstruct(){ jobStorage = (IJobStorage) context.getAttribute(Constants.JOBS_STORAGE); responser = (ResponseBuilder) context.getAttribute(Constants.RESPONSER); initializationTimestamp = (DateTime) context.getAttribute(Constants.DEPLOY_TIME); }
Source:
public void perform_bulk_read_with_field_mask_operation() { final int count = 10; final List<I> ids = new LinkedList<>(); final String projectDescriptor = Project.getDescriptor() .getFullName(); final FieldMask fieldMask = FieldMask.newBuilder() .addPaths(projectDescriptor + ".id") .addPaths(projectDescriptor + ".status") .build(); for (int i = 0; i < count; i++) { final I id = newId(); final ProjectId projectId = ProjectId.newBuilder() .setId(id.toString()) .build(); final Project state = Project.newBuilder() .setId(projectId) .setName(String.format("project-number-%s", i)) .setStatus(Project.Status.CREATED) .addTask(Task.getDefaultInstance()) .build(); final Any packedState = AnyPacker.pack(state); final EntityStorageRecord record = EntityStorageRecord.newBuilder() .setState(packedState) .setWhenModified(Timestamps.getCurrentTime()) .setVersion(1) .build(); storage.write(id, record); if (i % 2 == 0) { ids.add(id); } } final Iterable<EntityStorageRecord> read = storage.readBulk(ids, fieldMask); assertSize(ids.size(), read); for (EntityStorageRecord record : read) { final Any packedState = record.getState(); final Project state = AnyPacker.unpack(packedState); final ProjectId id = state.getId(); final String stringIdRepr = id.getId(); boolean isIdPresent = false; for (I genericId : ids) { isIdPresent = genericId.toString() .equals(stringIdRepr); if (isIdPresent) { break; } } assertTrue(isIdPresent); assertMatchesMask(state, fieldMask); } }

Target:
public void perform_bulk_read_with_field_mask_operation() { final List<I> ids = fillStorage(10).subList(0, 5); final String projectDescriptor = Project.getDescriptor() .getFullName(); final FieldMask fieldMask = maskForPaths(projectDescriptor + ".id", projectDescriptor + ".status"); final Iterable<EntityStorageRecord> read = storage.readBulk(ids, fieldMask); assertSize(ids.size(), read); for (EntityStorageRecord record : read) { final Project state = checkProjectIdIsInList(record, ids); assertMatchesMask(state, fieldMask); } }
Source:
public String ToInternalString() { String value = ""; String delimiter = ""; for (Map.Entry<String, String> pair : fencingAgentInstanceOptions.entrySet()) { if (pair.getValue().trim().length() > 0) { value = value + delimiter + pair.getKey() + EQUAL + TranslateBoolValue(pair.getValue()); } else if (!fencingSpecialParams.contains(pair.getKey())) { value = value + delimiter + pair.getKey(); } delimiter = (new Character(NEWLINE)).toString(); } return value; }

Target:
public String ToInternalString() { StringBuilder value = new StringBuilder(); String delimiter = ""; for (Map.Entry<String, String> pair : fencingAgentInstanceOptions.entrySet()) { if (pair.getValue().trim().length() > 0) { value.append(delimiter).append(pair.getKey()).append(EQUAL).append(TranslateBoolValue(pair.getValue())); } else if (!fencingSpecialParams.contains(pair.getKey())) { value.append(delimiter).append(pair.getKey()); } delimiter = NEWLINE; } return value.toString(); }
Source:
public String placeLimitOrder(LimitOrder limitOrder) { LgoPlaceOrder lgoOrder = LgoAdapters.adaptLimitOrder(limitOrder); return placeOrder(lgoOrder); }

Target:
public String placeLimitOrder(LimitOrder limitOrder) throws IOException { LgoPlaceOrder lgoOrder = LgoAdapters.adaptLimitOrder(limitOrder); return placeOrder(lgoOrder); }
Source:
public ASTNode visit(Cell cell, Void _) throws ParseFailedException { String sort = context.cellSorts.get(cell.getLabel()); if (cell.getLabel().equals("k") && cell.getEllipses() != Ellipses.NONE) sort = KSorts.K; if (sort == null) { if (cell.getLabel().equals("k")) sort = "K"; else if (cell.getLabel().equals("T")) sort = "Bag"; else if (cell.getLabel().equals("generatedTop")) sort = "Bag"; else if (cell.getLabel().equals("freshCounter")) sort = "K"; else if (cell.getLabel().equals(MetaK.Constants.pathCondition)) sort = "K"; } if (sort != null) { cell.setContents((Term) new CellTypesFilter2(context, sort, cell.getLabel()).visitNode(cell.getContents())); } else { String msg = "Cell '" + cell.getLabel() + "' was not declared in a configuration."; throw new ParseFailedException(new KException(ExceptionType.ERROR, KExceptionGroup.COMPILER, msg, getName(), cell.getFilename(), cell.getLocation())); } return super.visit(cell, _); }

Target:
public ASTNode visit(Cell cell, Void _) throws ParseFailedException { Sort sort = context.getCellSort(cell); if (sort != null) { cell.setContents((Term) new CellTypesFilter2(context, sort, cell.getLabel()).visitNode(cell.getContents())); } else { String msg = "Cell '" + cell.getLabel() + "' was not declared in a configuration."; throw new ParseFailedException(new KException(ExceptionType.ERROR, KExceptionGroup.COMPILER, msg, getName(), cell.getFilename(), cell.getLocation())); } return super.visit(cell, _); }
Source:
public Response listServices(@PathParam("clusterId") Long clusterId, @Context UriInfo uriInfo) { List<QueryParam> queryParams = buildClusterIdAwareQueryParams(clusterId, uriInfo); try { Collection<Service> services; services = catalogService.listServices(queryParams); if (services != null) { return WSUtils.respond(OK, SUCCESS, services); } } catch (Exception ex) { return WSUtils.respond(INTERNAL_SERVER_ERROR, EXCEPTION, ex.getMessage()); } return WSUtils.respond(NOT_FOUND, ENTITY_NOT_FOUND_FOR_FILTER, queryParams.toString()); }

Target:
public Response listServices(@PathParam("clusterId") Long clusterId, @Context UriInfo uriInfo) { List<QueryParam> queryParams = buildClusterIdAwareQueryParams(clusterId, uriInfo); try { Collection<Service> services; services = catalogService.listServices(queryParams); if (services != null) { return WSUtils.respond(services, OK, SUCCESS); } } catch (Exception ex) { return WSUtils.respond(INTERNAL_SERVER_ERROR, EXCEPTION, ex.getMessage()); } return WSUtils.respond(NOT_FOUND, ENTITY_NOT_FOUND_FOR_FILTER, queryParams.toString()); }
Source:
public List<Category> removeAllChildren(final Category parentCategory, final User user, final boolean respectFrontendRoles) throws DotDataException, DotSecurityException { List<Category> unableToDelete = new ArrayList<>(); List<Category> categoriesToDelete = getChildren(parentCategory, user, false); categoriesToDelete.forEach((category)-> { try { delete(category, user, false); } catch (DotDataException | DotSecurityException e) { Logger.error(this, "Category has dependencies. Category name: " + category.getCategoryName()); unableToDelete.add(category); } }); return unableToDelete; }

Target:
public List<Category> removeAllChildren(final Category parentCategory, final User user, final boolean respectFrontendRoles) throws DotDataException, DotSecurityException { List<Category> unableToDelete = Collections.unmodifiableList(new ArrayList<>()); List<Category> categoriesToDelete = getChildren(parentCategory, user, false); categoriesToDelete.forEach((category)-> { try { delete(category, user, false); } catch (DotDataException | DotSecurityException e) { Logger.error(this, "Category has dependencies. Category name: " + category.getCategoryName()); unableToDelete.add(category); } }); return unableToDelete; }
Source:
public void testJoinWithRangePredicatesinJoinClause() { assertQuery("SELECT COUNT(*)\n" + "FROM (SELECT * FROM lineitem WHERE orderkey % 16 = 0 AND partkey % 2 = 0) lineitem\n" + "JOIN (SELECT * FROM orders WHERE orderkey % 16 = 0 AND custkey % 2 = 0) orders\n" + "ON lineitem.orderkey % 8 = orders.orderkey % 8 AND lineitem.linenumber % 2 = 0\n" + "AND orders.custkey % 8 < 7 AND lineitem.suppkey % 10 < orders.custkey % 7 AND lineitem.suppkey % 7 > orders.custkey % 7"); assertQuery("SELECT COUNT(*)\n" + "FROM (SELECT * FROM lineitem WHERE orderkey % 16 = 0 AND partkey % 2 = 0) lineitem\n" + "JOIN (SELECT * FROM orders WHERE orderkey % 16 = 0 AND custkey % 2 = 0) orders\n" + "ON lineitem.orderkey % 8 = orders.orderkey % 8 AND lineitem.linenumber % 2 = 0\n" + "AND orders.custkey % 8 < lineitem.linenumber % 2 AND lineitem.suppkey % 10 < orders.custkey % 7 AND lineitem.suppkey % 7 > orders.custkey % 7"); }

Target:
public void testJoinWithRangePredicatesinJoinClause() { assertQuery("SELECT COUNT(*) " + "FROM (SELECT * FROM lineitem WHERE orderkey % 16 = 0 AND partkey % 2 = 0) lineitem " + "JOIN (SELECT * FROM orders WHERE orderkey % 16 = 0 AND custkey % 2 = 0) orders " + "ON lineitem.orderkey % 8 = orders.orderkey % 8 AND lineitem.linenumber % 2 = 0 " + "AND orders.custkey % 8 < 7 AND lineitem.suppkey % 10 < orders.custkey % 7 AND lineitem.suppkey % 7 > orders.custkey % 7"); assertQuery("SELECT COUNT(*) " + "FROM (SELECT * FROM lineitem WHERE orderkey % 16 = 0 AND partkey % 2 = 0) lineitem " + "JOIN (SELECT * FROM orders WHERE orderkey % 16 = 0 AND custkey % 2 = 0) orders " + "ON lineitem.orderkey % 8 = orders.orderkey % 8 AND lineitem.linenumber % 2 = 0 " + "AND orders.custkey % 8 < lineitem.linenumber % 2 AND lineitem.suppkey % 10 < orders.custkey % 7 AND lineitem.suppkey % 7 > orders.custkey % 7"); }
Source:
private Collection<Ref> getAllRefs() throws IOException { Collection<Ref> refs = refdb.getRefs(RefDatabase.ALL).values(); List<Ref> addl = refdb.getAdditionalRefs(); if (!addl.isEmpty()) { List<Ref> all = new ArrayList<>(refs.size() + addl.size()); all.addAll(refs); for (Ref r : addl) { if (r.getName().startsWith(Constants.R_REFS)) all.add(r); } return all; } return refs; }

Target:
private Collection<Ref> getAllRefs() throws IOException { Collection<Ref> refs = refdb.getRefs(RefDatabase.ALL).values(); List<Ref> addl = refdb.getAdditionalRefs(); if (!addl.isEmpty()) { List<Ref> all = new ArrayList<>(refs.size() + addl.size()); all.addAll(refs); for (Ref r : addl) { if (r.getName().startsWith(Constants.R_REFS)) { all.add(r); } } return all; } return refs; }
Source:
protected void init() { if (!initalized) { initalized = true; validateLibraries = project.getModules().isEmpty(); FilePredicates predicates = fs.predicates(); hasJavaSources = fs.hasFiles(predicates.and(predicates.hasLanguage("java"), predicates.hasType(InputFile.Type.MAIN))); binaries = getFilesFromProperty(JavaClasspathProperties.SONAR_JAVA_BINARIES); List<File> libraries = getFilesFromProperty(JavaClasspathProperties.SONAR_JAVA_LIBRARIES); boolean useDeprecatedProperties = binaries.isEmpty() && libraries.isEmpty(); if (useDeprecatedProperties) { binaries = getFilesFromProperty("sonar.binaries"); libraries = getFilesFromProperty("sonar.libraries"); } if (pom != null && libraries.isEmpty()) { elements = getLibrariesFromMaven(pom); } else { elements = Lists.newArrayList(binaries); elements.addAll(libraries); if (useDeprecatedProperties && !elements.isEmpty()) { LOG.warn("sonar.binaries and sonar.libraries are deprecated since version 2.5 of sonar-java-plugin, please use sonar.java.binaries and sonar.java.libraries instead"); } } } }

Target:
protected void init() { if (!initialized) { initialized = true; validateLibraries = project.getModules().isEmpty(); binaries = getFilesFromProperty(JavaClasspathProperties.SONAR_JAVA_BINARIES); List<File> libraries = getFilesFromProperty(JavaClasspathProperties.SONAR_JAVA_LIBRARIES); boolean useDeprecatedProperties = binaries.isEmpty() && libraries.isEmpty(); if (useDeprecatedProperties) { binaries = getFilesFromProperty("sonar.binaries"); libraries = getFilesFromProperty("sonar.libraries"); } if (pom != null && libraries.isEmpty()) { elements = getLibrariesFromMaven(pom); } else { elements = Lists.newArrayList(binaries); elements.addAll(libraries); if (useDeprecatedProperties && !elements.isEmpty()) { LOG.warn("sonar.binaries and sonar.libraries are deprecated since version 2.5 of sonar-java-plugin, please use sonar.java.binaries and sonar.java.libraries instead"); } } } }
Source:
public Appenderator createRealtimeAppenderatorForTask( String taskId, DataSchema schema, AppenderatorConfig config, FireDepartmentMetrics metrics, DataSegmentPusher dataSegmentPusher, ObjectMapper objectMapper, IndexIO indexIO, IndexMerger indexMerger, QueryRunnerFactoryConglomerate conglomerate, DataSegmentAnnouncer segmentAnnouncer, ServiceEmitter emitter, ExecutorService queryExecutorService, JoinableFactory joinableFactory, Cache cache, CacheConfig cacheConfig, CachePopulatorStats cachePopulatorStats ) { realtimeAppenderator = Appenderators.createRealtime( taskId, schema, config, metrics, dataSegmentPusher, objectMapper, indexIO, indexMerger, conglomerate, segmentAnnouncer, emitter, queryExecutorService, NoopJoinableFactory.INSTANCE, cache, cacheConfig, cachePopulatorStats ); return realtimeAppenderator; }

Target:
public Appenderator createRealtimeAppenderatorForTask( String taskId, DataSchema schema, AppenderatorConfig config, FireDepartmentMetrics metrics, DataSegmentPusher dataSegmentPusher, ObjectMapper objectMapper, IndexIO indexIO, IndexMerger indexMerger, QueryRunnerFactoryConglomerate conglomerate, DataSegmentAnnouncer segmentAnnouncer, ServiceEmitter emitter, ExecutorService queryExecutorService, JoinableFactory joinableFactory, Cache cache, CacheConfig cacheConfig, CachePopulatorStats cachePopulatorStats ) { realtimeAppenderator = Appenderators.createRealtime( taskId, schema, config, metrics, dataSegmentPusher, objectMapper, indexIO, indexMerger, conglomerate, segmentAnnouncer, emitter, queryExecutorService, joinableFactory, cache, cacheConfig, cachePopulatorStats ); return realtimeAppenderator; }
Source:
public void deleteOneMemberFromMultipleMembersOfDescription() { final Description description = createDescription(Concepts.FULLY_SPECIFIED_NAME, "Example FSN"); final String referringRefSetId = generateConceptId(); final SnomedRefSetMember member1 = createSimpleMember(description.getId(), referringRefSetId); final SnomedRefSetMember member2 = createSimpleMember(description.getId(), referringRefSetId); registerExistingObject(description); registerExistingObject(member1); registerExistingObject(member2); indexRevision(RevisionBranch.MAIN_PATH, CDOIDUtil.getLong(description.cdoID()), SnomedDescriptionIndexEntry.builder(description).build()); indexRevision(RevisionBranch.MAIN_PATH, CDOIDUtil.getLong(member1.cdoID()), SnomedRefSetMemberIndexEntry.builder(member1).build()); indexRevision(RevisionBranch.MAIN_PATH, CDOIDUtil.getLong(member2.cdoID()), SnomedRefSetMemberIndexEntry.builder(member2).build()); registerDetached(member1.cdoID(), SnomedRefSetPackage.Literals.SNOMED_REF_SET_MEMBER); final SnomedDescriptionIndexEntry expectedDoc = SnomedDescriptionIndexEntry .builder(description) .referringRefSets(Collections.singleton(referringRefSetId)) .build(); final Revision currentDoc = Iterables.getOnlyElement(processor.getChangedMappings().values()); assertDocEquals(expectedDoc, currentDoc); assertEquals(0, processor.getNewMappings().size()); assertEquals(0, processor.getDeletions().size()); }

Target:
public void deleteOneMemberFromMultipleMembersOfDescription() { final Description description = createDescription(Concepts.FULLY_SPECIFIED_NAME, "Example FSN"); final String referringRefSetId = generateConceptId(); final SnomedRefSetMember member1 = createSimpleMember(description.getId(), referringRefSetId); final SnomedRefSetMember member2 = createSimpleMember(description.getId(), referringRefSetId); registerExistingObject(description); registerExistingObject(member1); registerExistingObject(member2); indexRevision(MAIN, CDOIDUtil.getLong(description.cdoID()), SnomedDescriptionIndexEntry.builder(description) .referringRefSets(ImmutableList.of(referringRefSetId, referringRefSetId)) .build()); indexRevision(MAIN, CDOIDUtil.getLong(member1.cdoID()), SnomedRefSetMemberIndexEntry.builder(member1).build()); indexRevision(MAIN, CDOIDUtil.getLong(member2.cdoID()), SnomedRefSetMemberIndexEntry.builder(member2).build()); registerDetached(member1.cdoID(), member1.eClass()); process(processor); final SnomedDescriptionIndexEntry expectedDoc = SnomedDescriptionIndexEntry .builder(description) .referringRefSets(Collections.singleton(referringRefSetId)) .build(); final Revision currentDoc = Iterables.getOnlyElement(processor.getChangedMappings().values()); assertDocEquals(expectedDoc, currentDoc); assertEquals(0, processor.getNewMappings().size()); assertEquals(0, processor.getDeletions().size()); }
Source:
public void createRelativeDateEvents() { TodorooCursor<ABTestEvent> allEvents = query(Query.select(ABTestEvent.TEST_NAME, ABTestEvent.DATE_RECORDED) .where(ABTestEvent.TIME_INTERVAL.eq(ABTestEvent.TIME_INTERVAL_0))); try { long now = DateUtilities.now(); for (allEvents.moveToFirst(); !allEvents.isAfterLast(); allEvents.moveToNext()) { ABTestEvent event = new ABTestEvent(allEvents); long baseTime = event.getValue(ABTestEvent.DATE_RECORDED); long timeSinceBase = now - baseTime; String testName = event.getValue(ABTestEvent.TEST_NAME); int timeInterval = -1; if (timeSinceBase > 3 * DateUtilities.ONE_WEEK) timeInterval = ABTestEvent.TIME_INTERVAL_21; else if (timeSinceBase > 2 * DateUtilities.ONE_WEEK) timeInterval = ABTestEvent.TIME_INTERVAL_14; else if (timeSinceBase > DateUtilities.ONE_WEEK) timeInterval = ABTestEvent.TIME_INTERVAL_7; else if (timeSinceBase > 3 * DateUtilities.ONE_DAY) timeInterval = ABTestEvent.TIME_INTERVAL_3; if (timeInterval > 0) createTestEventWithTimeInterval(testName, timeInterval); } } finally { allEvents.close(); } }

Target:
public void createRelativeDateEvents() { TodorooCursor<ABTestEvent> allEvents = query(Query.select(ABTestEvent.TEST_NAME, ABTestEvent.DATE_RECORDED) .where(ABTestEvent.TIME_INTERVAL.eq(0))); try { long now = DateUtilities.now(); ABTestEvent event = new ABTestEvent(); for (allEvents.moveToFirst(); !allEvents.isAfterLast(); allEvents.moveToNext()) { event.readFromCursor(allEvents); long baseTime = event.getValue(ABTestEvent.DATE_RECORDED); long timeSinceBase = now - baseTime; String testName = event.getValue(ABTestEvent.TEST_NAME); int timeInterval = -1; long days = timeSinceBase / DateUtilities.ONE_DAY; for(int i = 0; i < ABTestEvent.TIME_INTERVALS.length; i++) if(days >= ABTestEvent.TIME_INTERVALS[i]) timeInterval = ABTestEvent.TIME_INTERVALS[i]; if (timeInterval > 0) createTestEventWithTimeInterval(testName, timeInterval); } } finally { allEvents.close(); } }
Source:
private static String skipFirstProperty(String text) { String newText = text.substring(text.indexOf(POM_PROPERTY_PREFIX)); return newText.substring(newText.indexOf(POM_PROPERTY_SUFFIX)); }

Target:
private static String skipFirstProperty(String text) { return text.substring(text.indexOf(POM_PROPERTY_SUFFIX, text.indexOf(POM_PROPERTY_PREFIX))); }
Source:
public boolean execute(CommandContext ctx) throws Exception { log.info("Update is done @ {}, my state {}", ctx.getSource(), lifecycleService.getCurrentState()); if(manager != null) { try { manager.logEvent(ctx.getMessage().getProtocolParameters().get("BranchName"), ctx.getMessage().getProtocolParameters().get("CurrentRevision"), "SYNC".equals(ctx.getMessage().getProtocolParameters().get("comment")) ? "AUTO" : ctx.getMessage().getProtocolParameters().get("openId"), configProperties.getProperty("com.meltmedia.cadmium.lastUpdated"), ctx.getMessage().getProtocolParameters().get("uuid"), ctx.getMessage().getProtocolParameters().get("comment"), !new Boolean(ctx.getMessage().getProtocolParameters().get("nonRevertible")), false); } catch(Exception e){ log.warn("Failed to update log", e); } } lifecycleService.sendStateUpdate(null, ctx.getMessage().getProtocolParameters().get("uuid")); return true; }

Target:
public boolean execute(CommandContext ctx) throws Exception { log.info("Update is done @ {}, my state {}", ctx.getSource(), lifecycleService.getCurrentState()); if(manager != null) { try { Map<String, String> props = ctx.getMessage().getProtocolParameters(); String branch = props.get("BranchName"); String rev = props.get("CurrentRevision"); String openId = props.get("openId"); String lastUpdated = configProperties.getProperty("com.meltmedia.cadmium.lastUpdated"); String uuid = props.get("uuid"); String comment = props.get("comment"); boolean revertible = !new Boolean(props.get("nonRevertible")); manager.logEvent(branch, rev, openId, lastUpdated, uuid, comment, revertible, false); } catch(Exception e){ log.warn("Failed to update log", e); } } lifecycleService.sendStateUpdate(null, ctx.getMessage().getProtocolParameters().get("uuid")); return true; }
Source:
Publisher<CoreEvent> getDownstreamPublisher() { return downstreamFlux .compose(downstreamPublisher -> Mono.subscriberContext() .flatMapMany(downstreamContext -> downstreamPublisher.doOnSubscribe(s -> { innerFlux.subscriberContext(downstreamContext).subscribe(); upstreamFlux.subscriberContext(downstreamContext).subscribe(); }))); }

Target:
Publisher<CoreEvent> getDownstreamPublisher() { return downstreamFlux .compose(downstreamPublisher -> subscriberContext() .flatMapMany(downstreamContext -> downstreamPublisher.doOnSubscribe(s -> { innerFlux.subscriberContext(downstreamContext).subscribe(); upstreamFlux.subscriberContext(downstreamContext).subscribe(); }))); }
Source:
public void convertDouble() { }

Target:
public void convertDouble() { assertThat(converting(ATTR_NAME_NUMBER, numberAsDoubleMapper)).isEqualTo("5.0"); }
Source:
static Drivers getDriverFor(String scheme) { for (Drivers driver : values()) { for (String supportedScheme : driver.schemes) { if (supportedScheme.equalsIgnoreCase(scheme)) { return driver; } } } throw new RuntimeException("A URI Scheme must be one of http/https, bolt or file."); }

Target:
static Drivers getDriverFor(String scheme) { for (Drivers driver : Drivers.values()) { for (String supportedScheme : driver.schemes) { if (supportedScheme.equalsIgnoreCase(scheme)) { return driver; } } } throw new RuntimeException(UNSUPPORTED_SCHEME_MESSAGE); }
Source:
public OpenALManager(AudioConfig config) throws Exception { logger.info("Initializing OpenAL audio manager"); config.subscribe(configListener); AL.create(); AL10.alGetError(); logger.info("OpenAL initialized!", AL10.alGetString(AL10.AL_VERSION)); ALCcontext context = ALC10.alcGetCurrentContext(); ALCdevice device = ALC10.alcGetContextsDevice(context); logger.info("Using OpenAL: by {}", AL10.alGetString(AL10.AL_RENDERER), AL10.alGetString(AL10.AL_VENDOR)); logger.info("Using device: {}", ALC10.alcGetString(device, ALC10.ALC_DEVICE_SPECIFIER)); logger.info("Available AL extensions: {}", AL10.alGetString(AL10.AL_EXTENSIONS)); logger.info("Available ALC extensions: {}", ALC10.alcGetString(device, ALC10.ALC_EXTENSIONS)); IntBuffer buffer = BufferUtils.createIntBuffer(1); ALC10.alcGetInteger(device, ALC11.ALC_MONO_SOURCES, buffer); logger.info("Max mono sources: {}", buffer.get(0)); buffer.rewind(); ALC10.alcGetInteger(device, ALC11.ALC_STEREO_SOURCES, buffer); logger.info("Max stereo sources: {}", buffer.get(0)); buffer.rewind(); ALC10.alcGetInteger(device, ALC10.ALC_FREQUENCY, buffer); logger.info("Mixer frequency: {}", buffer.get(0)); buffer.rewind(); AL10.alDistanceModel(AL10.AL_INVERSE_DISTANCE_CLAMPED); pools.put("sfx", new OpenALSoundPool(30)); pools.put("music", new OpenALStreamingSoundPool(2)); pools.get("sfx").setVolume(config.getSoundVolume()); pools.get("music").setVolume(config.getMusicVolume()); }

Target:
public OpenALManager(AudioConfig config) throws OpenALException, LWJGLException { logger.info("Initializing OpenAL audio manager"); config.subscribe(configListener); AL.create(); AL10.alGetError(); logger.info("OpenAL initialized!", AL10.alGetString(AL10.AL_VERSION)); ALCcontext context = ALC10.alcGetCurrentContext(); ALCdevice device = ALC10.alcGetContextsDevice(context); logger.info("Using OpenAL: by {}", AL10.alGetString(AL10.AL_RENDERER), AL10.alGetString(AL10.AL_VENDOR)); logger.info("Using device: {}", ALC10.alcGetString(device, ALC10.ALC_DEVICE_SPECIFIER)); logger.info("Available AL extensions: {}", AL10.alGetString(AL10.AL_EXTENSIONS)); logger.info("Available ALC extensions: {}", ALC10.alcGetString(device, ALC10.ALC_EXTENSIONS)); IntBuffer buffer = BufferUtils.createIntBuffer(1); ALC10.alcGetInteger(device, ALC11.ALC_MONO_SOURCES, buffer); logger.info("Max mono sources: {}", buffer.get(0)); buffer.rewind(); ALC10.alcGetInteger(device, ALC11.ALC_STEREO_SOURCES, buffer); logger.info("Max stereo sources: {}", buffer.get(0)); buffer.rewind(); ALC10.alcGetInteger(device, ALC10.ALC_FREQUENCY, buffer); logger.info("Mixer frequency: {}", buffer.get(0)); buffer.rewind(); AL10.alDistanceModel(AL10.AL_INVERSE_DISTANCE_CLAMPED); pools.put("sfx", new OpenALSoundPool(30)); pools.put("music", new OpenALStreamingSoundPool(2)); pools.get("sfx").setVolume(config.getSoundVolume()); pools.get("music").setVolume(config.getMusicVolume()); }
Source:
private void addBuiltInTypes() { final OptGroup group = GWT.create(OptGroup.class); group.setLabel(translationService.format(DMNEditorConstants.DataTypeSelectView_DefaultTitle)); Stream.of(BuiltInType.values()) .sorted(BUILT_IN_TYPE_COMPARATOR) .map(this::makeTypeSelector) .filter(Optional::isPresent) .forEach(o -> group.add(o.get())); typeSelector.add(group); }

Target:
void addBuiltInTypes() { final OptGroup group = GWT.create(OptGroup.class); group.setLabel(translationService.getTranslation(DMNEditorConstants.DataTypeSelectView_DefaultTitle)); Stream.of(BuiltInType.values()) .sorted(BUILT_IN_TYPE_COMPARATOR) .map(this::makeTypeSelector) .filter(Optional::isPresent) .forEach(o -> group.add(o.get())); typeSelector.add(group); }
Source:
public ChangeApi id(String id) throws RestApiException { return new ChangeApiRestClient(gerritRestClient, this, changesParser, commentsParser, fileInfoParser, diffInfoParser, suggestedReviewerInfoParser, null, id); }

Target:
public ChangeApi id(String id) throws RestApiException { return new ChangeApiRestClient(gerritRestClient, this, changesParser, commentsParser, fileInfoParser, diffInfoParser, suggestedReviewerInfoParser, id); }
Source:
public void testGetParameter() { Url url = new Url("<LINK_0>"); assertEquals("value1", url.get("key1")); assertEquals("value2", url.get("key2")); assertEquals("value3", url.get("key3")); assertEquals(null, url.get("key4")); }

Target:
public void testGetParameter() { Url url = new Url("<LINK_1>"); assertEquals("value1", url.get("key1")); assertEquals("value2", url.get("key2")); assertEquals(null, url.get("y1")); assertEquals(null, url.get("key4")); }
Source:
public List<ContainerRendered> getContainers(final Template template) throws DotSecurityException, DotDataException { final User systemUser = this.userAPI.getSystemUser(); final List<Container> templateContainers = this.templateAPI.getContainersInTemplate(template, systemUser, false); final List<ContainerRendered> containers = new LinkedList<>(); for (final Container container : templateContainers) { final List<ContainerStructure> containerStructures = this.containerAPI.getContainerStructures(container); containers.add(new ContainerRendered(container, containerStructures)); } return containers; }

Target:
public List<ContainerRendered> getContainers(final Template template) throws DotSecurityException, DotDataException { final User systemUser = this.userAPI.getSystemUser(); final List<Container> templateContainers = this.templateAPI.getContainersInTemplate(template, systemUser, false); final List<ContainerRendered> containers = new ArrayList<>(); for (final Container container : templateContainers) { final List<ContainerStructure> containerStructures = this.containerAPI.getContainerStructures(container); containers.add(new ContainerRendered(container, containerStructures)); } return containers; }
Source:
public boolean configure(StaplerRequest req, JSONObject json) throws FormException { for (AdministrativeMonitor am : AdministrativeMonitor.all()) { try { boolean disable = json.containsKey("administrativeMonitor") && !json.getJSONArray("administrativeMonitor").contains(am.id); am.disable(disable); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to process form submission for " + am.id, e); } } return true; }

Target:
public boolean configure(StaplerRequest req, JSONObject json) throws FormException { JSONArray monitors = json.optJSONArray("administrativeMonitor"); for (AdministrativeMonitor am : AdministrativeMonitor.all()) { try { boolean disable; if(monitors != null) { disable = !monitors.contains(am.id); }else { disable = !am.id.equals(json.optString("administrativeMonitor")); } am.disable(disable); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to process form submission for " + am.id, e); } } return true; }
Source:
public void should_measure_size_of_simple_statement() { String queryString = "SELECT release_version FROM system.local WHERE key = ?"; SimpleStatement statement = new SimpleStatement(queryString); int expectedSize = 9 + (4 + queryString.getBytes(Charsets.UTF_8).length) + 2 + 4; assertThat(v5SizeOf(statement)).isEqualTo(expectedSize); SimpleStatement statementWithAnonymousValue = new SimpleStatement(statement.getQueryString(), "local"); assertThat(v5SizeOf(statementWithAnonymousValue)) .isEqualTo(expectedSize + 2 + (4 + "local".getBytes(Charsets.UTF_8).length) ); SimpleStatement statementWithNamedValue = new SimpleStatement(statement.getQueryString(), ImmutableMap.<String, Object>of("key", "local")); assertThat(v5SizeOf(statementWithNamedValue)) .isEqualTo(expectedSize + 2 + (2 + "key".getBytes(Charsets.UTF_8).length) + (4 + "local".getBytes(Charsets.UTF_8).length) ); statement.setFetchSize(10); expectedSize += 4; assertThat(v5SizeOf(statement)).isEqualTo(expectedSize); statement.setPagingStateUnsafe(MOCK_PAGING_STATE); expectedSize += 4 + MOCK_PAGING_STATE.length; assertThat(v5SizeOf(statement)).isEqualTo(expectedSize); statement.setSerialConsistencyLevel(ConsistencyLevel.LOCAL_SERIAL); expectedSize += 2; assertThat(v5SizeOf(statement)).isEqualTo(expectedSize); statement.setDefaultTimestamp(10000); expectedSize += 8; assertThat(v5SizeOf(statement)).isEqualTo(expectedSize); statement.setOutgoingPayload(MOCK_PAYLOAD); expectedSize += 2 + (2 + "key1".getBytes(Charsets.UTF_8).length) + (4 + MOCK_PAYLOAD_VALUE1.remaining()) + (2 + "key2".getBytes(Charsets.UTF_8).length) + (4 + MOCK_PAYLOAD_VALUE2.remaining()); assertThat(v5SizeOf(statement)).isEqualTo(expectedSize); }

Target:
public void should_measure_size_of_simple_statement() { String queryString = "SELECT release_version FROM system.local WHERE key = ?"; SimpleStatement statement = new SimpleStatement(queryString); int expectedSize = 9 + (4 + queryString.getBytes(Charsets.UTF_8).length) + 2 + 2 + 4 + 8 + 4; assertThat(v5SizeOf(statement)).isEqualTo(expectedSize); SimpleStatement statementWithAnonymousValue = new SimpleStatement(statement.getQueryString(), "local"); assertThat(v5SizeOf(statementWithAnonymousValue)) .isEqualTo(expectedSize + 2 + (4 + "local".getBytes(Charsets.UTF_8).length) ); SimpleStatement statementWithNamedValue = new SimpleStatement(statement.getQueryString(), ImmutableMap.<String, Object>of("key", "local")); assertThat(v5SizeOf(statementWithNamedValue)) .isEqualTo(expectedSize + 2 + (2 + "key".getBytes(Charsets.UTF_8).length) + (4 + "local".getBytes(Charsets.UTF_8).length) ); statement.setPagingStateUnsafe(MOCK_PAGING_STATE); expectedSize += 4 + MOCK_PAGING_STATE.length; assertThat(v5SizeOf(statement)).isEqualTo(expectedSize); statement.setOutgoingPayload(MOCK_PAYLOAD); expectedSize += 2 + (2 + "key1".getBytes(Charsets.UTF_8).length) + (4 + MOCK_PAYLOAD_VALUE1.remaining()) + (2 + "key2".getBytes(Charsets.UTF_8).length) + (4 + MOCK_PAYLOAD_VALUE2.remaining()); assertThat(v5SizeOf(statement)).isEqualTo(expectedSize); }
Source:
public ChangeInfo get() throws RestApiException { EnumSet<ListChangesOption> opts = EnumSet.allOf(ListChangesOption.class); opts.remove(ListChangesOption.CHECK); return get(opts); }

Target:
public ChangeInfo get() throws RestApiException { return get(EnumSet.complementOf(EnumSet.of(ListChangesOption.CHECK))); }
Source:
static void checkForStalealertdefs () { Configuration conf = injector.getInstance(Configuration.class); LOG.info("Checking to ensure there is no stale alert definitions"); ensureConnection(); String STALE_ALERT_DEFINITIONS = "select definition_name, service_name from alert_definition where service_name not in (select service_name from clusterservices) and service_name not in ('AMBARI')"; ResultSet rs = null; Statement statement; try { statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); rs = statement.executeQuery(STALE_ALERT_DEFINITIONS); if (rs != null) { Map<String, String> alertInfo = new HashMap<>(); while (rs.next()) { alertInfo.put(rs.getString("definition_name"),rs.getString("service_name")); } if (!alertInfo.isEmpty()){ String alertInfoStr = ""; for (Map.Entry<String, String> entry : alertInfo.entrySet()) { alertInfoStr = entry.getKey() + "(" + entry.getValue() + ")" ; } warning("You have Alerts that are not mapped with any services : {}", alertInfoStr); } } } catch (SQLException e) { warning("Exception occurred during checking for stale alert definitions: ", e); } finally { if (rs != null) { try { rs.close(); } catch (SQLException e) { LOG.error("Exception occurred during checking for stale alert definitions: ", e); } } } }

Target:
static Map<String, String> checkForStalealertdefs () { Configuration conf = injector.getInstance(Configuration.class); Map<String, String> alertInfo = new HashMap<>(); LOG.info("Checking to ensure there is no stale alert definitions"); ensureConnection(); String STALE_ALERT_DEFINITIONS = "select definition_name, service_name from alert_definition where service_name not in " + "(select service_name from clusterservices) and service_name not in ('AMBARI')"; ResultSet rs = null; Statement statement; try { statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); rs = statement.executeQuery(STALE_ALERT_DEFINITIONS); if (rs != null) { while (rs.next()) { alertInfo.put(rs.getString("definition_name"),rs.getString("service_name")); } if (!alertInfo.isEmpty()){ String alertInfoStr = ""; for (Map.Entry<String, String> entry : alertInfo.entrySet()) { alertInfoStr = entry.getKey() + "(" + entry.getValue() + ")" ; } warning("You have Alerts that are not mapped with any services : {}.Run --auto-fix-database to fix " + "this automatically. Please backup Ambari Server database before running --auto-fix-database.", alertInfoStr); } } } catch (SQLException e) { warning("Exception occurred during checking for stale alert definitions: ", e); } finally { if (rs != null) { try { rs.close(); } catch (SQLException e) { LOG.error("Exception occurred during checking for stale alert definitions: ", e); } } } return alertInfo; }