auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Future<Void> report(SinkRecord record, Throwable error) { Function<SinkRecord, ConsumerRecord<byte[], byte[]>> function; if (record instanceof InternalSinkRecord) { function = sinkRecord -> ((InternalSinkRecord) sinkRecord).originalRecord(); } else { function = sinkRecord -> { String topic = record.topic(); byte[] key = keyConverter.fromConnectData(topic, record.keySchema(), record.key()); byte[] value = valueConverter.fromConnectData(topic, record.valueSchema(), record.value()); RecordHeaders headers = new RecordHeaders(); if (record.headers() != null) { for (Header header : record.headers()) { String headerKey = header.key(); byte[] rawHeader = headerConverter.fromConnectHeader(topic, headerKey, header.schema(), header.value()); headers.add(headerKey, rawHeader); } } return new ConsumerRecord<>(record.topic(), record.kafkaPartition(), record.kafkaOffset(), record.timestamp(), record.timestampType(), -1L, -1, -1, key, value, headers); }; } Future<Void> future = retryWithToleranceOperator.executeFailed(function, Stage.TASK_PUT, SinkTask.class, record, error, callback); futures.add(future); return future; }

Target:
public Future<Void> report(SinkRecord record, Throwable error) { ConsumerRecord<byte[], byte[]> consumerRecord; if (record instanceof InternalSinkRecord) { consumerRecord = ((InternalSinkRecord) record).originalRecord(); } else { String topic = record.topic(); byte[] key = keyConverter.fromConnectData(topic, record.keySchema(), record.key()); byte[] value = valueConverter.fromConnectData(topic, record.valueSchema(), record.value()); RecordHeaders headers = new RecordHeaders(); if (record.headers() != null) { for (Header header : record.headers()) { String headerKey = header.key(); byte[] rawHeader = headerConverter.fromConnectHeader(topic, headerKey, header.schema(), header.value()); headers.add(headerKey, rawHeader); } } int keyLength = key != null ? key.length : -1; int valLength = value != null ? value.length : -1; consumerRecord = new ConsumerRecord<>(record.topic(), record.kafkaPartition(), record.kafkaOffset(), record.timestamp(), record.timestampType(), -1L, keyLength, valLength, key, value, headers); } Future<Void> future = retryWithToleranceOperator.executeFailed(Stage.TASK_PUT, SinkTask.class, consumerRecord, error); if (!future.isDone()) { futures.add(future); } return future; }
Source:
private Function<RowExpression, Optional<RowExpression>> translateGroupIdVariables(GroupIdNode node) { return variable -> { checkArgument(variable instanceof VariableReferenceExpression, "Expect VariableReferenceExpression"); if (node.getAggregationArguments().contains(variable)) { return Optional.of(variable); } if (node.getCommonGroupingColumns().contains(variable)) { return Optional.of((node.getGroupingColumns().get(variable))); } return Optional.empty(); }; }

Target:
private Function<VariableReferenceExpression, Optional<VariableReferenceExpression>> translateGroupIdVariables(GroupIdNode node) { return variable -> { if (node.getAggregationArguments().contains(variable)) { return Optional.of(variable); } if (node.getCommonGroupingColumns().contains(variable)) { return Optional.of((node.getGroupingColumns().get(variable))); } return Optional.empty(); }; }
Source:
protected void executeVDSCommand() { P parameters = getParameters(); Guid vdsId = parameters.getVdsId(); if (ResourceManager .getInstance() .runVdsCommand(VDSCommandType.SpmStop, new SpmStopVDSCommandParameters(vdsId, parameters.getStoragePoolId())).getSucceeded() || parameters.getIgnoreStopFailed()) { if (getParameters().getPreferredSPMId() != null) { getCurrentIrsProxyData().setPreferredHostId(getParameters().getPreferredSPMId()); } getCurrentIrsProxyData().resetIrs(); StoragePool pool = DbFacade.getInstance().getStoragePoolDao().get(parameters.getStoragePoolId()); if (pool != null && (pool.getStatus() == StoragePoolStatus.NotOperational)) { ResourceManager .getInstance() .getEventListener() .storagePoolStatusChange(parameters.getStoragePoolId(), StoragePoolStatus.NonResponsive, AuditLogType.SYSTEM_CHANGE_STORAGE_POOL_STATUS_RESET_IRS, VdcBllErrors.ENGINE); } } else { getVDSReturnValue().setSucceeded(false); } if (!getVDSReturnValue().getSucceeded()) { AuditLogableBase base = new AuditLogableBase(vdsId); AuditLogDirector.log(base, AuditLogType.FAILED_TO_STOP_SPM_ON_HOST); } }

Target:
protected void executeVDSCommand() { P parameters = getParameters(); Guid vdsId = parameters.getVdsId(); if (ResourceManager .getInstance() .runVdsCommand(VDSCommandType.SpmStop, new SpmStopVDSCommandParameters(vdsId, parameters.getStoragePoolId())).getSucceeded() || parameters.getIgnoreStopFailed()) { if (getParameters().getPreferredSPMId() != null) { getCurrentIrsProxyData().setPreferredHostId(getParameters().getPreferredSPMId()); } getCurrentIrsProxyData().resetIrs(); StoragePool pool = DbFacade.getInstance().getStoragePoolDao().get(parameters.getStoragePoolId()); if (pool != null && (pool.getStatus() == StoragePoolStatus.NotOperational)) { ResourceManager .getInstance() .getEventListener() .storagePoolStatusChange(parameters.getStoragePoolId(), StoragePoolStatus.NonResponsive, AuditLogType.SYSTEM_CHANGE_STORAGE_POOL_STATUS_RESET_IRS, VdcBllErrors.ENGINE); } } else { getVDSReturnValue().setSucceeded(false); } }
Source:
private int getValidPercentile(String fraction) { try { double p = Double.parseDouble(fraction); if (p < 0 || p > 1) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Percentile must be between 0 and 1"); } double percent = p * 100.0; if (percent == Math.floor(percent)) { return (int) percent; } } catch (NumberFormatException ne) { } return -1; }

Target:
private int getValidPercentile(String fraction) { try { double percent = Double.parseDouble(fraction); if (percent < 0 || percent > 1) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Percentile must be between 0 and 1"); } percent = percent * 100.0; if (percent == Math.floor(percent)) { return (int) percent; } } catch (NumberFormatException ne) { } return -1; }
Source:
protected RFuture<Boolean> replaceOperationAsync(K key, V oldValue, V newValue) { return commandExecutor.evalWriteAsync(getName(key), codec, RedisCommands.EVAL_BOOLEAN, "local v = redis.call('hget', KEYS[1], ARGV[2]); " + "if v == false then " + "return 0;" + "end;" + "local expireDate = 92233720368547758; " + "local expireDateScore = redis.call('zscore', KEYS[2], ARGV[2]); " + "if expireDateScore ~= false then " + "expireDate = tonumber(expireDateScore) " + "end; " + "local t, val = struct.unpack('dLc0', v); " + "if t ~= 0 then " + "local expireIdle = redis.call('zscore', KEYS[3], ARGV[2]); " + "if expireIdle ~= false then " + "expireDate = math.min(expireDate, tonumber(expireIdle)) " + "end; " + "end; " + "if expireDate > tonumber(ARGV[1]) and val == ARGV[3] then " + "local msg = struct.pack('Lc0Lc0Lc0', string.len(ARGV[2]), ARGV[2], string.len(ARGV[4]), ARGV[4], string.len(ARGV[3]), ARGV[3]); " + "redis.call('publish', KEYS[4], msg); " + "local value = struct.pack('dLc0', t, string.len(ARGV[4]), ARGV[4]); " + "redis.call('hset', KEYS[1], ARGV[2], value); " + "return 1; " + "end; " + "return 0; ", Arrays.<Object>asList(getName(key), getTimeoutSetNameByKey(key), getIdleSetNameByKey(key), getUpdatedChannelNameByKey(key)), System.currentTimeMillis(), encodeMapKey(key), encodeMapValue(oldValue), encodeMapValue(newValue)); }

Target:
protected RFuture<Boolean> replaceOperationAsync(K key, V oldValue, V newValue) { return commandExecutor.evalWriteAsync(getName(key), codec, RedisCommands.EVAL_BOOLEAN, "local v = redis.call('hget', KEYS[1], ARGV[2]);" + "if v == false then" + " return 0;" + "end;" + "local expireDate = 92233720368547758;" + "local expireDateScore = redis.call('zscore', KEYS[2], ARGV[2]);" + "if expireDateScore ~= false then" + " expireDate = tonumber(expireDateScore)" + "end;" + "" + "local t, val = struct.unpack('dLc0', v);" + "if t ~= 0 then" + " local expireIdle = redis.call('zscore', KEYS[3], ARGV[2]);" + " if expireIdle ~= false then" + " expireDate = math.min(expireDate, tonumber(expireIdle))" + " end;" + "end;" + "if expireDate > tonumber(ARGV[1]) and val == ARGV[3] then" + " local msg = struct.pack('Lc0Lc0Lc0', string.len(ARGV[2]), ARGV[2], string.len(ARGV[4]), ARGV[4], string.len(ARGV[3]), ARGV[3]);" + " redis.call('publish', KEYS[4], msg);" + "" + " local value = struct.pack('dLc0', t, string.len(ARGV[4]), ARGV[4]);" + " redis.call('hset', KEYS[1], ARGV[2], value);" + " return 1;" + "end;" + "return 0;", Arrays.<Object>asList(getName(key), getTimeoutSetNameByKey(key), getIdleSetNameByKey(key), getUpdatedChannelNameByKey(key)), System.currentTimeMillis(), encodeMapKey(key), encodeMapValue(oldValue), encodeMapValue(newValue)); }
Source:
public void limit() { populateTestRealm(realm, TEST_DATA_SIZE); RealmResults<AllTypes> results = realm.where(AllTypes.class).limit(5).findAll(); assertEquals(5, results.size()); for (int i = 0; i < 5; i++) { assertEquals(i, results.get(i).getColumnLong()); } }

Target:
public void limit() { populateTestRealm(realm, TEST_DATA_SIZE); RealmResults<AllTypes> results = realm.where(AllTypes.class).sort(AllTypes.FIELD_LONG).limit(5).findAll(); assertEquals(5, results.size()); for (int i = 0; i < 5; i++) { assertEquals(i, results.get(i).getColumnLong()); } }
Source:
public void testTaskExecutionWithAuthorization(String principal, Subject subject) throws Exception { System.out.println("Run with " + principal); Security.doAs(subject, new PrivilegedAction<Void>() { @Override public Void run() { CompletableFuture<Object> slowTask = taskManager.runTask(DummyTaskEngine.DummyTaskTypes.SLOW_TASK.name(), new TaskContext()); Collection<TaskExecution> currentTasks = taskManager.getCurrentTasks(); assertEquals(1, currentTasks.size()); TaskExecution currentTask = currentTasks.iterator().next(); assertEquals(DummyTaskEngine.DummyTaskTypes.SLOW_TASK.name(), currentTask.getName()); assertEquals(principal, currentTask.getWho().get()); taskEngine.getSlowTask().complete("slow"); assertEquals(0, taskManager.getCurrentTasks().size()); try { assertEquals("slow", slowTask.get()); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } taskEngine.setSlowTask(new CompletableFuture<>()); return null; } }); }

Target:
public void testTaskExecutionWithAuthorization(String principal, Subject subject) throws Exception { System.out.println("Run with " + principal); Security.doAs(subject, new PrivilegedAction<Void>() { @Override public Void run() { CompletableFuture<Object> slowTask = taskManager.runTask(DummyTaskEngine.DummyTaskTypes.SLOW_TASK.name(), new TaskContext()); Collection<TaskExecution> currentTasks = taskManager.getCurrentTasks(); assertEquals(1, currentTasks.size()); TaskExecution currentTask = currentTasks.iterator().next(); assertEquals(DummyTaskEngine.DummyTaskTypes.SLOW_TASK.name(), currentTask.getName()); assertEquals(principal, currentTask.getWho().get()); taskEngine.getSlowTask().complete("slow"); assertEquals(0, taskManager.getCurrentTasks().size()); try { assertEquals("slow", slowTask.get()); } catch (InterruptedException | ExecutionException e) { fail("Exception thrown while getting the slowTask. "); } taskEngine.setSlowTask(new CompletableFuture<>()); return null; } }); }
Source:
private void determineAtomicFileCreationSupport() { Boolean ret = getAtomicFileCreationSupportOption( SystemReader.getInstance().openUserConfig(null, this)); if (ret == null && StringUtils.isEmptyOrNull(SystemReader.getInstance() .getenv(Constants.GIT_CONFIG_NOSYSTEM_KEY))) { ret = getAtomicFileCreationSupportOption( SystemReader.getInstance().openSystemConfig(null, this)); } supportsAtomicCreateNewFile = (ret != null && !ret.booleanValue()) ? Boolean.FALSE : Boolean.TRUE; }

Target:
private void determineAtomicFileCreationSupport() { Boolean ret = getAtomicFileCreationSupportOption( SystemReader.getInstance().openUserConfig(null, this)); if (ret == null && StringUtils.isEmptyOrNull(SystemReader.getInstance() .getenv(Constants.GIT_CONFIG_NOSYSTEM_KEY))) { ret = getAtomicFileCreationSupportOption( SystemReader.getInstance().openSystemConfig(null, this)); } supportsAtomicCreateNewFile = (ret == null || ret.booleanValue()) ? Boolean.TRUE : Boolean.FALSE; }
Source:
public PathBreadcrumbWidget(FileSystemContext context) { RStudioGinjector.INSTANCE.injectMembers(this); context_ = context; pathPanel_ = new HorizontalPanel(); pathPanel_.setStylePrimaryName(RES.styles().path()); panel_ = new HorizontalPanel(); panel_.setSize("100%", "100%"); panel_.add(pathPanel_); outer_ = new FocusPanel(panel_); outer_.setStylePrimaryName(RES.styles().breadcrumb()); Roles.getGroupRole().setAriaLabelProperty(outer_.getElement(), "Selected path breadcrumb"); Image fade = new Image(RES.fade()); fade.setStylePrimaryName(STYLES.fade()); fade_ = fade.getElement(); fadeWrapper_ = new HTMLPanel(""); fadeWrapper_.setStylePrimaryName(STYLES.fadeWrapper()); fadeWrapper_.getElement().appendChild(fade_); outer_.getElement().appendChild(fadeWrapper_.getElement()); frame_ = new DockLayoutPanel(Unit.PX); eastFrame_ = new FlowPanel(); Button browse = new Button("..."); browse.setStyleName(STYLES.browse()); browse.addStyleName(ThemeResources.INSTANCE.themeStyles().handCursor()); browse.addClickHandler(event -> browse()); String buttonTitle = "Go to directory"; browse.setTitle(buttonTitle); Roles.getButtonRole().setAriaLabelProperty(browse.getElement(), buttonTitle); eastFrame_.add(browse); frame_.addEast(eastFrame_, 22); frame_.add(outer_); frame_.setStyleName(STYLES.breadcrumbFrame()); initWidget(frame_); }

Target:
public PathBreadcrumbWidget(FileSystemContext context) { RStudioGinjector.INSTANCE.injectMembers(this); context_ = context; pathPanel_ = new HorizontalPanel(); pathPanel_.setStylePrimaryName(RES.styles().path()); panel_ = new HorizontalPanel(); panel_.setSize("100%", "100%"); panel_.add(pathPanel_); outer_ = new SimplePanel(); outer_.setWidget(panel_); outer_.setStylePrimaryName(RES.styles().breadcrumb()); Roles.getGroupRole().setAriaLabelProperty(outer_.getElement(), "Selected path breadcrumb"); Image fade = new Image(RES.fade()); fade.setStylePrimaryName(STYLES.fade()); fade_ = fade.getElement(); fadeWrapper_ = new HTMLPanel(""); fadeWrapper_.setStylePrimaryName(STYLES.fadeWrapper()); fadeWrapper_.getElement().appendChild(fade_); outer_.getElement().appendChild(fadeWrapper_.getElement()); frame_ = new DockLayoutPanel(Unit.PX); eastFrame_ = new FlowPanel(); Button browse = new Button("..."); browse.setStyleName(STYLES.browse()); browse.addStyleName(ThemeResources.INSTANCE.themeStyles().handCursor()); browse.addClickHandler(event -> browse()); String buttonTitle = "Go to directory"; browse.setTitle(buttonTitle); Roles.getButtonRole().setAriaLabelProperty(browse.getElement(), buttonTitle); eastFrame_.add(browse); frame_.addEast(eastFrame_, 22); frame_.add(outer_); frame_.setStyleName(STYLES.breadcrumbFrame()); initWidget(frame_); }
Source:
public ConstantValueExpression visitLiteral(RexLiteral literal) { ConstantValueExpression cve = new ConstantValueExpression(); String value = null; if (literal.getValue() instanceof NlsString) { NlsString nlsString = (NlsString) literal.getValue(); value = nlsString.getValue(); } else if (literal.getValue() instanceof BigDecimal) { BigDecimal bd = (BigDecimal) literal.getValue(); if (literal.getType() instanceof IntervalSqlType) { BigDecimal thousand = BigDecimal.valueOf(1000); bd = bd.multiply(thousand); } value = bd.toPlainString(); } else if (literal.getValue() instanceof GregorianCalendar) { long time = ((GregorianCalendar) literal.getValue()).getTimeInMillis() * 1000; value = Long.toString(time); } else { value = literal.getValue().toString(); } Preconditions.checkNotNull(value); cve.setValue(value); TypeConverter.setType(cve, literal.getType()); return cve; }

Target:
public ConstantValueExpression visitLiteral(RexLiteral literal) { ConstantValueExpression cve = new ConstantValueExpression(); final String value; if (literal.getValue() instanceof NlsString) { NlsString nlsString = (NlsString) literal.getValue(); value = nlsString.getValue(); } else if (literal.getValue() instanceof BigDecimal) { BigDecimal bd = (BigDecimal) literal.getValue(); if (literal.getType() instanceof IntervalSqlType) { BigDecimal thousand = BigDecimal.valueOf(1000); bd = bd.multiply(thousand); } value = bd.toPlainString(); } else if (literal.getValue() instanceof GregorianCalendar) { long time = ((GregorianCalendar) literal.getValue()).getTimeInMillis() * 1000; value = Long.toString(time); } else { value = literal.getValue().toString(); } cve.setValue(value); RexConverter.setType(cve, literal.getType()); return cve; }
Source:
protected List<String> getCommand() { if(!serverng) { return super.getCommand(); } ArrayList<String> command = new ArrayList<String>(); command.add(FileSystems.getDefault().getPath(getHome(), "bin", getStartScriptPrefix() + (getWindows() ? "bat" : "sh")).toString()); command.add("-c "+getFile()); command.addAll(args); return command; }

Target:
protected List<String> getCommand() { if(isEapServer()) { return super.getCommand(); } Path sererConfiguration = createSererConfiguration(); ArrayList<String> command = new ArrayList<String>(); command.add(FileSystems.getDefault().getPath(getRadargunInstalationFolder(), "bin", getStartScriptPrefix() + (getWindows() ? "bat" : "sh")).toString()); command.add("-c"); command.add(sererConfiguration.toString()); command.add("-b"); command.add("0.0.0.0"); command.addAll(args); return command; }
Source:
private <RequestT extends StorageRequest<?>> void setEncryptionHeaders(RequestT request) { HttpHeaders headers = request.getRequestHeaders(); if (storageOptions.getEncryptionAlgorithm() != null && storageOptions.getEncryptionKey() != null && storageOptions.getEncryptionKeyHash() != null) { headers.set("x-goog-encryption-algorithm", storageOptions.getEncryptionAlgorithm()); headers.set("x-goog-encryption-key", storageOptions.getEncryptionKey()); headers.set("x-goog-encryption-key-sha256", storageOptions.getEncryptionKeyHash()); } else { return; } request.setRequestHeaders(headers); }

Target:
private <RequestT extends StorageRequest<?>> void setEncryptionHeaders(RequestT request) { if (storageOptions.getEncryptionKey() == null) { return; } request .getRequestHeaders() .set( "x-goog-encryption-algorithm", checkNotNull( storageOptions.getEncryptionAlgorithm(), "encryption algorithm must not be null")) .set( "x-goog-encryption-key", checkNotNull(storageOptions.getEncryptionKey(), "encryption key must not be null")) .set( "x-goog-encryption-key-sha256", checkNotNull( storageOptions.getEncryptionKeyHash(), "encryption key hash must not be null")); }
Source:
createCredentialsCallback(final Builder<HeaderInterceptor> headerInterceptorBuilder) { return new Callable<Void>() { @Override public Void call() throws IOException { try { HeaderInterceptor headerInterceptor = getCredentialsInterceptor(); if (headerInterceptor != null) { headerInterceptorBuilder.add(headerInterceptor); } return null; } catch (GeneralSecurityException e) { throw new IOException("Could not load auth credentials", e); } } protected HeaderInterceptor getCredentialsInterceptor() throws IOException, GeneralSecurityException { CredentialOptions credentialOptions = BigtableSession.this.options.getCredentialOptions(); boolean isDefaultCredentials = credentialOptions.getCredentialType() == CredentialType.DefaultCredentials; synchronized (CREDENTIALS_REFRESH_EXECUTOR_SERVICE) { if (isDefaultCredentials && defaultCredentialOauth != null) { return defaultCredentialOauth; } Credentials credentials = CredentialFactory.getCredentials(credentialOptions); if (credentials == null) { return null; } Preconditions.checkState(credentials instanceof OAuth2Credentials, String.format("Credentials must be an instance of OAuth2Credentials, but got %s.", credentials.getClass().getName())); RefreshingOAuth2CredentialsInterceptor oauth2Interceptor = new RefreshingOAuth2CredentialsInterceptor(CREDENTIALS_REFRESH_EXECUTOR_SERVICE, (OAuth2Credentials) credentials, BigtableSession.this.options.getRetryOptions()); oauth2Interceptor.asyncRefresh(); if (isDefaultCredentials) { defaultCredentialOauth = oauth2Interceptor; } return oauth2Interceptor; } } }; }

Target:
createCredentialsCallback(final Builder<HeaderInterceptor> headerInterceptorBuilder) { return new Callable<Void>() { @Override public Void call() throws IOException { try { CredentialInterceptorCache credentialsCache = CredentialInterceptorCache.getInstance(); RetryOptions retryOptions = options.getRetryOptions(); CredentialOptions credentialOptions = options.getCredentialOptions(); HeaderInterceptor headerInterceptor = credentialsCache.getCredentialsInterceptor(credentialOptions, retryOptions); if (headerInterceptor != null) { headerInterceptorBuilder.add(headerInterceptor); } return null; } catch (GeneralSecurityException e) { throw new IOException("Could not load auth credentials", e); } } }; }
Source:
protected IkeSessionConfiguration buildIkeSessionConfiguration(IkeMessage ikeMessage) { IkeConfigPayload configPayload = ikeMessage.getPayloadForType(IkePayload.PAYLOAD_TYPE_CP, IkeConfigPayload.class); if (configPayload == null) { logd("No config payload in ikeMessage."); return new IkeSessionConfiguration(null); } if (configPayload.configType != CONFIG_TYPE_REPLY) { logw("Unexpected config payload. Config Type: " + configPayload.configType); return null; } return new IkeSessionConfiguration(configPayload); }

Target:
protected IkeSessionConfiguration buildIkeSessionConfiguration(IkeMessage ikeMessage) { IkeConfigPayload configPayload = ikeMessage.getPayloadForType(IkePayload.PAYLOAD_TYPE_CP, IkeConfigPayload.class); if (configPayload == null) { logd("No config payload in ikeMessage."); return new IkeSessionConfiguration(null ); } if (configPayload.configType != CONFIG_TYPE_REPLY) { logw("Unexpected config payload. Config Type: " + configPayload.configType); return new IkeSessionConfiguration(null ); } return new IkeSessionConfiguration(configPayload); }
Source:
private void buildConditionalPermissionInfo( ConditionalPermissionAdmin conditionalPermissionAdmin, List<ParsedPolicyEntry> entries, List<ConditionalPermissionInfo> infos, String type) { for (ParsedPolicyEntry parsedPolicyEntry : entries) { List<ParsedPermission> permissions = parsedPolicyEntry.getPermissions(); PermissionInfo[] permissionInfos = new PermissionInfo[permissions.size()]; int index = 0; for (ParsedPermission parsedPermission : permissions) { permissionInfos[index++] = new PermissionInfo( parsedPermission.getPermissionType(), replaceSystemProperties(parsedPermission.getPermissionName()), parsedPermission.getActions()); } List<ConditionInfo> conditionInfos = new ArrayList<>(); addCodebase(parsedPolicyEntry, conditionInfos); addSignedBy(parsedPolicyEntry, conditionInfos); addPrincipals(parsedPolicyEntry, conditionInfos); infos.add( conditionalPermissionAdmin.newConditionalPermissionInfo( null, (conditionInfos.isEmpty()) ? null : conditionInfos.toArray(new ConditionInfo[0]), permissionInfos, type)); } }

Target:
private void buildConditionalPermissionInfo( ConditionalPermissionAdmin conditionalPermissionAdmin, List<ParsedPolicyEntry> entries, List<ConditionalPermissionInfo> infos, String type) { for (ParsedPolicyEntry parsedPolicyEntry : entries) { List<ParsedPermission> permissions = parsedPolicyEntry.getPermissions(); PermissionInfo[] permissionInfos = new PermissionInfo[permissions.size()]; int index = 0; for (ParsedPermission parsedPermission : permissions) { permissionInfos[index++] = new PermissionInfo( parsedPermission.getPermissionType(), replaceSystemProperties(parsedPermission.getPermissionName()), parsedPermission.getActions()); } List<ConditionInfo> conditionInfos = new ArrayList<>(); addCodebase(parsedPolicyEntry, conditionInfos); addSignedBy(parsedPolicyEntry, conditionInfos); addPrincipals(parsedPolicyEntry, conditionInfos); infos.add( conditionalPermissionAdmin.newConditionalPermissionInfo( null, (conditionInfos.isEmpty()) ? null : conditionInfos.toArray(new ConditionInfo[conditionInfos.size()]), permissionInfos, type)); } }
Source:
public void testHexNoHashSign() { assertThat(faker.color().hex(true), matchesRegularExpression("^[0-9A-F]{6}$")); }

Target:
public void testHexNoHashSign() { assertThat(faker.color().hex(false), matchesRegularExpression("^[0-9A-F]{6}$")); }
Source:
public SslConfig getSslConfig(AllocateDatabaseServerV4Request source, DBStack dbStack) { SslConfig sslConfig = new SslConfig(); if (sslEnabled && source.getSslConfiguration() != null && SslMode.isEnabled(source.getSslConfiguration().getMode())) { sslConfig.setSslCertificates(databaseServerSSlCertificateConfig.getCertsByPlatform(dbStack.getCloudPlatform())); sslConfig.setType(SslCertificateType.CLOUD_PROVIDER_OWNED); } return sslConfig; }

Target:
public SslConfig getSslConfig(AllocateDatabaseServerV4Request source, DBStack dbStack) { SslConfig sslConfig = new SslConfig(); if (sslEnabled && source.getSslConfig() != null && SslMode.isEnabled(source.getSslConfig().getSslMode())) { sslConfig.setSslCertificates(databaseServerSSlCertificateConfig.getCertsByPlatform(dbStack.getCloudPlatform())); sslConfig.setSslCertificateType(SslCertificateType.CLOUD_PROVIDER_OWNED); } return sslConfig; }
Source:
public void visitJavadocToken(DetailNode ast) { String firstSentence = getFirstSentence(ast); final int endOfSentence = firstSentence.lastIndexOf(period); if (endOfSentence == -1) { if (!firstSentence.trim().startsWith(INHERIT_DOC_LITERAL) && !FIRST_CHARACTER_ASTERIC_PATTERN.matcher(firstSentence.trim()) .replaceFirst("").trim().startsWith(INHERIT_DOC_LITERAL)) { log(ast.getLineNumber(), MSG_SUMMARY_FIRST_SENTENCE); } } else { firstSentence = firstSentence.substring(0, endOfSentence); if (containsForbiddenFragment(firstSentence)) { log(ast.getLineNumber(), MSG_SUMMARY_JAVADOC); } } }

Target:
public void visitJavadocToken(DetailNode ast) { String firstSentence = getFirstSentence(ast); final int endOfSentence = firstSentence.lastIndexOf(period); if (endOfSentence == -1) { if (!isOnlyInheritDoc(ast)) { log(ast.getLineNumber(), MSG_SUMMARY_FIRST_SENTENCE); } } else { firstSentence = firstSentence.substring(0, endOfSentence); if (containsForbiddenFragment(firstSentence)) { log(ast.getLineNumber(), MSG_SUMMARY_JAVADOC); } } }
Source:
public Collection<DetailedLink> getLinks() throws ClassNotFoundException, IOException { List<DetailedLink> results = new ArrayList<DetailedLink>(); List<Class<?>> classes = ReflectionHelper.getClasses(RESOURCES_PACKAGE); List<String> paths = applicationMode == ApplicationMode.GlusterOnly ? ApiUtils.getGlusterRels(uriInfo) : ApiUtils.getAllRels(uriInfo); for (String path : paths) { Class<?> resource = findResource(path, classes); String entryPointPath = uriInfo.getBaseUri().getPath(); String prefix = entryPointPath.endsWith("/") ? entryPointPath + path : entryPointPath + "/" + path; results.addAll(describe(resource, prefix, new HashMap<String, Type>())); } return results; }

Target:
public Collection<DetailedLink> getLinks() throws ClassNotFoundException, IOException { List<DetailedLink> results = new ArrayList<DetailedLink>(); List<Class<?>> classes = ReflectionHelper.getClasses(RESOURCES_PACKAGE); String entryPointPath = uriInfo.getBaseUri().getPath(); for (String path : rels) { Class<?> resource = findResource(path, classes); String prefix = entryPointPath.endsWith("/") ? entryPointPath + path : entryPointPath + "/" + path; results.addAll(describe(resource, prefix, new HashMap<String, Type>())); } return results; }
Source:
private boolean newValueAlreadyExpired(K key, V oldValue, V newValue) { if (newValue == null) { return false; } final Duration duration; if (oldValue == null) { try { duration = runtimeConfiguration.getExpiry().getExpiryForCreation(key, newValue); } catch (RuntimeException re) { logger.error("Expiry caused an exception ", re); return true; } } else { try { duration = runtimeConfiguration.getExpiry().getExpiryForUpdate(key, oldValue, newValue); } catch (RuntimeException re) { logger.error("Expiry caused an exception ", re); return true; } } return Duration.ZERO.equals(duration); }

Target:
private boolean newValueAlreadyExpired(K key, V oldValue, V newValue) { if (newValue == null) { return false; } final Duration duration; if (oldValue == null) { try { duration = runtimeConfiguration.getExpiry().getExpiryForCreation(key, newValue); } catch (RuntimeException re) { logger.error("Expiry computation caused an exception - Expiry duration will be 0 ", re); return true; } } else { try { duration = runtimeConfiguration.getExpiry().getExpiryForUpdate(key, oldValue, newValue); } catch (RuntimeException re) { logger.error("Expiry computation caused an exception - Expiry duration will be 0 ", re); return true; } } return Duration.ZERO.equals(duration); }
Source:
public void attemptAuthenticationWhenOAuth2AuthorizationRequestIsNullDoesNotCreateOAuth2AuthorizationResponse() throws IOException, ServletException { MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter(OAuth2ParameterNames.CODE, "code"); request.addParameter(OAuth2ParameterNames.STATE, "state"); MockHttpServletResponse response = new MockHttpServletResponse(); try { this.filter.attemptAuthentication(request, response); fail(); } catch (OAuth2AuthenticationException ex) { verify(this.filter, never()).convert(any(HttpServletRequest.class)); } }

Target:
public void attemptAuthenticationWhenOAuth2AuthorizationRequestIsNullDoesNotCreateOAuth2AuthorizationResponse() throws Exception { OAuth2LoginAuthenticationFilter filter = PowerMockito.spy(new OAuth2LoginAuthenticationFilter( this.clientRegistrationRepository, this.authorizedClientService)); MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter(OAuth2ParameterNames.CODE, "code"); request.addParameter(OAuth2ParameterNames.STATE, "state"); MockHttpServletResponse response = new MockHttpServletResponse(); try { filter.attemptAuthentication(request, response); fail(); } catch (OAuth2AuthenticationException ex) { verifyPrivate(filter, never()).invoke("convert", any(HttpServletRequest.class)); } }
Source:
private int writeHeader(ChunkCompressorFactory.CompressionType compressionType, int totalDocs, int numDocsPerChunk, int sizeOfEntry, int version) { int numChunks = (totalDocs + numDocsPerChunk - 1) / numDocsPerChunk; int headerSize = (7 * Integer.BYTES) + (numChunks * VarByteChunkSingleValueWriter.FILE_HEADER_ENTRY_CHUNK_OFFSET_SIZE); _header = ByteBuffer.allocateDirect(headerSize); int offset = 0; _header.putInt(version); offset += Integer.BYTES; _header.putInt(numChunks); offset += Integer.BYTES; _header.putInt(numDocsPerChunk); offset += Integer.BYTES; _header.putInt(sizeOfEntry); offset += Integer.BYTES; if (version > 1) { _header.putInt(totalDocs); offset += Integer.BYTES; _header.putInt(compressionType.getValue()); offset += Integer.BYTES; int dataHeaderStart = offset + Integer.BYTES; _header.putInt(dataHeaderStart); } return headerSize; }

Target:
private int writeHeader(ChunkCompressorFactory.CompressionType compressionType, int totalDocs, int numDocsPerChunk, int sizeOfEntry, int version) { int numChunks = (totalDocs + numDocsPerChunk - 1) / numDocsPerChunk; int headerSize = (7 * Integer.BYTES) + (numChunks * _headerEntryChunkOffsetSize); _header = ByteBuffer.allocateDirect(headerSize); int offset = 0; _header.putInt(version); offset += Integer.BYTES; _header.putInt(numChunks); offset += Integer.BYTES; _header.putInt(numDocsPerChunk); offset += Integer.BYTES; _header.putInt(sizeOfEntry); offset += Integer.BYTES; if (version > 1) { _header.putInt(totalDocs); offset += Integer.BYTES; _header.putInt(compressionType.getValue()); offset += Integer.BYTES; int dataHeaderStart = offset + Integer.BYTES; _header.putInt(dataHeaderStart); } return headerSize; }
Source:
private static ExpressionTree getComparedWithNullExpression(ExpressionTree expression, Tree.Kind kind) { ExpressionTree comparedExpression = getExpressionEqualNullWithAnd(expression, kind); if (comparedExpression == null) { comparedExpression = getExpressionNotEqualNullWithOr(expression, kind); if (comparedExpression == null) { comparedExpression = getExpressionComparedWithFunction(expression, kind); if (comparedExpression == null) { return null; } } } return comparedExpression; }

Target:
private static ExpressionTree getComparedWithNullExpression(ExpressionTree expression, Tree.Kind kind) { ExpressionTree comparedExpression = getExpressionEqualNullWithAnd(expression, kind); if (comparedExpression == null) { comparedExpression = getExpressionNotEqualNullWithOr(expression, kind); if (comparedExpression == null) { comparedExpression = getExpressionComparedWithFunction(expression, kind); } } return comparedExpression; }
Source:
private boolean hasSuspendedVms() { List<VM> vmList = vmDao.getAllForStoragePool(getOldStoragePool().getId()); String suspendedVms = vmList.stream() .filter(vm -> vm.getStatus().isSuspended() && getStoragePool().getCompatibilityVersion().greater(vm.getCustomCompatibilityVersion())) .map(VM::getName) .collect(Collectors.joining("\n")); if (!suspendedVms.isEmpty()) { addValidationMessage(EngineMessage.ERROR_CANNOT_UPDATE_STORAGE_POOL_SUSPENDED_VM_COMPATIBILITY_VERSION_NOT_SUPPORTED); addValidationMessageVariable("VmsList", suspendedVms); return true; } return false; }

Target:
private boolean hasSuspendedVms() { List<VM> vmList = vmDao.getAllForStoragePool(getStoragePool().getId()); String suspendedVms = vmList.stream() .filter(vm -> vm.getStatus().isSuspended() && vm.getCustomCompatibilityVersion() != null) .filter(vm -> getStoragePool().getCompatibilityVersion().greater(vm.getCustomCompatibilityVersion())) .map(VM::getName) .collect(Collectors.joining("\n")); if (!suspendedVms.isEmpty()) { addValidationMessage(EngineMessage.ERROR_CANNOT_UPDATE_STORAGE_POOL_SUSPENDED_VM_COMPATIBILITY_VERSION_NOT_SUPPORTED); addValidationMessageVariable("VmsList", suspendedVms); return true; } return false; }
Source:
public void setWidth(int desiredPrecision, int desiredScale, boolean errorOnTrunc) throws StandardException { if (isNull()) return; if (desiredPrecision != IGNORE_PRECISION && ((desiredPrecision - desiredScale) < SQLDecimal.getWholeDigits(getBigDecimal()))) { throw StandardException.newException(SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE, ("DECIMAL/NUMERIC("+desiredPrecision+","+desiredScale+")")); } rawData = null; setValue(value.setScale(desiredScale, BigDecimal.ROUND_HALF_UP)); if (value.signum() == 0) setPrecision(value.scale() + 1); }

Target:
public void setWidth(int desiredPrecision, int desiredScale, boolean errorOnTrunc) throws StandardException { if (isNull()) return; if (desiredPrecision != IGNORE_PRECISION && ((desiredPrecision - desiredScale) < SQLDecimal.getWholeDigits(getBigDecimal()))) { throw StandardException.newException(SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE, ("DECIMAL/NUMERIC("+desiredPrecision+","+desiredScale+")")); } rawData = null; setValue(value.setScale(desiredScale, BigDecimal.ROUND_HALF_UP)); }
Source:
private boolean isSeriesUnique() { if("".equals(txtTitle.getText().trim())) return false; if(null != txtKey && txtKey.isEnabled() && txtKey.getText().length() <= 0) return false; if (cboXItem.getText().contentEquals(Localization.getString("SelectGraphAndSeriesWizardPage.Deleted"))) { return false; } for(int j,i=0; i<cboYItems.length; i++) { if (cboYItems[i].getText().contentEquals(Localization.getString("SelectGraphAndSeriesWizardPage.Deleted"))) { return false; } if(cboYItems[i].isVisible()) { for(j=i+1; j<cboYItems.length; j++) { if(cboYItems[j].isVisible()) { if(0 > cboYItems[i].getSelectionIndex()) return false; else if(0 > cboYItems[j].getSelectionIndex()) return false; else if(cboYItems[i].getItem(cboYItems[i].getSelectionIndex()).equals(cboYItems[j].getItem(cboYItems[j].getSelectionIndex()))) { return false; } } } if(0 > cboYItems[i].getSelectionIndex()) return false; else if(0 > cboXItem.getSelectionIndex()) return false; else if(cboYItems[i].getItem(cboYItems[i].getSelectionIndex()).equals(cboXItem.getItem(cboXItem.getSelectionIndex()))) { return false; } } } return true; }

Target:
private boolean isSeriesUnique() { if("".equals(txtTitle.getText().trim())) { return false; } if(null != txtKey && txtKey.isEnabled() && txtKey.getText().length() <= 0) { return false; } if (cboXItem.getText().contentEquals(Localization.getString("SelectGraphAndSeriesWizardPage.Deleted"))) { return false; } for(int j,i=0; i<cboYItems.length; i++) { if (cboYItems[i].getText().contentEquals(Localization.getString("SelectGraphAndSeriesWizardPage.Deleted"))) { return false; } if(cboYItems[i].isVisible()) { for(j=i+1; j<cboYItems.length; j++) { if(cboYItems[j].isVisible()) { if(0 > cboYItems[i].getSelectionIndex()) return false; else if(0 > cboYItems[j].getSelectionIndex()) return false; else if(cboYItems[i].getItem(cboYItems[i].getSelectionIndex()).equals(cboYItems[j].getItem(cboYItems[j].getSelectionIndex()))) { return false; } } } if(0 > cboYItems[i].getSelectionIndex()) return false; else if(0 > cboXItem.getSelectionIndex()) return false; else if(cboYItems[i].getItem(cboYItems[i].getSelectionIndex()).equals(cboXItem.getItem(cboXItem.getSelectionIndex()))) { return false; } } } return true; }
Source:
public void test_attach_to_activated_cluster() throws Exception { startNode(1, 1); waitUntil(out.getLog(1, 1), containsLog("Started the server in diagnostic mode")); activateCluster(); assertThat(getUpcomingCluster("localhost", getNodePort(1, 1)).getNodeCount(), is(equalTo(1))); startNode(1, 2); waitUntil(out.getLog(1, 2), containsLog("Started the server in diagnostic mode")); assertThat(getUpcomingCluster("localhost", getNodePort(1, 2)).getNodeCount(), is(equalTo(1))); assertThat(configToolInvocation("attach", "-d", "localhost:" + getNodePort(1, 1), "-s", "localhost:" + getNodePort(1, 2)), is(successful())); waitUntil(out.getLog(1, 2), containsLog("Moved to State[ PASSIVE-STANDBY ]")); assertThat(getUpcomingCluster("localhost", getNodePort(1, 1)).getNodeCount(), is(equalTo(2))); assertThat(getRuntimeCluster("localhost", getNodePort(1, 1)).getNodeCount(), is(equalTo(2))); assertThat(getUpcomingCluster("localhost", getNodePort(1, 2)).getNodeCount(), is(equalTo(2))); assertThat(getRuntimeCluster("localhost", getNodePort(1, 2)).getNodeCount(), is(equalTo(2))); out.clearLog(1, 2); stopNode(1, 1); waitUntil(out.getLog(1, 2), containsLog("Not enough registered voters. Require override intervention or 1 members of the stripe to be connected for action MOVE_TO_ACTIVE")); }

Target:
public void test_attach_to_activated_cluster() throws Exception { startNode(1, 1); waitUntil(out.getLog(1, 1), containsLog("Started the server in diagnostic mode")); activateCluster(); assertThat(getUpcomingCluster("localhost", getNodePort(1, 1)).getNodeCount(), is(equalTo(1))); startNode(1, 2); waitUntil(out.getLog(1, 2), containsLog("Started the server in diagnostic mode")); assertThat(getUpcomingCluster("localhost", getNodePort(1, 2)).getNodeCount(), is(equalTo(1))); assertThat(configToolInvocation("attach", "-d", "localhost:" + getNodePort(1, 1), "-s", "localhost:" + getNodePort(1, 2)), is(successful())); waitUntil(out.getLog(1, 2), containsLog("Moved to State[ PASSIVE-STANDBY ]")); assertThat(getUpcomingCluster("localhost", getNodePort(1, 1)).getNodeCount(), is(equalTo(2))); assertThat(getRuntimeCluster("localhost", getNodePort(1, 1)).getNodeCount(), is(equalTo(2))); assertThat(getUpcomingCluster("localhost", getNodePort(1, 2)).getNodeCount(), is(equalTo(2))); assertThat(getRuntimeCluster("localhost", getNodePort(1, 2)).getNodeCount(), is(equalTo(2))); withTopologyService(1, 1, topologyService -> assertTrue(topologyService.isActivated())); withTopologyService(1, 2, topologyService -> assertTrue(topologyService.isActivated())); out.clearLog(1, 2); stopNode(1, 1); waitUntil(out.getLog(1, 2), containsLog("Not enough registered voters. Require override intervention or 1 members of the stripe to be connected for action MOVE_TO_ACTIVE")); }
Source:
public String toString() { return String.format("%1$d.%2$d.%3$d_%4$d-b%5$d", discard, major, minor, update, build); }

Target:
public String toString() { return String.format("%d.%d.%d_%d-b%d", discard, major, minor, update, build); }
Source:
public Promise<List<SearchResult>> search(QueryExpression expression) { final String url = encodeAllowEscapes(getBaseUrl() + SEARCH + (isNullOrEmpty(expression.getPath()) ? Path.ROOT : path(expression.getPath()))); StringBuilder queryParameters = new StringBuilder(); if (expression.getName() != null && !expression.getName().isEmpty()) { queryParameters.append("&name=").append(expression.getName()); } if (expression.getText() != null && !expression.getText().isEmpty()) { queryParameters.append("&text=").append(expression.getText()); } if (expression.getMaxItems() != 0) { queryParameters.append("&maxItems=").append(expression.getMaxItems()); } if (expression.getSkipCount() != 0) { queryParameters.append("&skipCount=").append(expression.getSkipCount()); } return reqFactory.createGetRequest(url + queryParameters.toString().replaceFirst("&", "?")) .header(ACCEPT, MimeType.APPLICATION_JSON) .loader(loaderFactory.newLoader("Searching...")) .send(unmarshaller.newListUnmarshaller(SearchResultDto.class)).then( (Function<List<SearchResultDto>, List<SearchResult>>)arg -> { if (arg.isEmpty()) { return Collections.emptyList(); } List<SearchResult> results = new ArrayList<>(arg.size()); for (SearchResultDto dto : arg) { results.add(new SearchResult(dto)); } return results; }); }

Target:
public Promise<List<SearchResult>> search(QueryExpression expression) { final String url = encodeAllowEscapes(getBaseUrl() + SEARCH + (isNullOrEmpty(expression.getPath()) ? Path.ROOT : path(expression.getPath()))); StringBuilder queryParameters = new StringBuilder(); if (expression.getName() != null && !expression.getName().isEmpty()) { queryParameters.append("&name=").append(expression.getName()); } if (expression.getText() != null && !expression.getText().isEmpty()) { queryParameters.append("&text=").append(expression.getText()); } if (expression.getMaxItems() != 0) { queryParameters.append("&maxItems=").append(expression.getMaxItems()); } if (expression.getSkipCount() != 0) { queryParameters.append("&skipCount=").append(expression.getSkipCount()); } return reqFactory.createGetRequest(url + queryParameters.toString().replaceFirst("&", "?")) .header(ACCEPT, MimeType.APPLICATION_JSON) .loader(loaderFactory.newLoader("Searching...")) .send(unmarshaller.newListUnmarshaller(SearchResultDto.class)).then( (Function<List<SearchResultDto>, List<SearchResult>>)arg -> { if (arg.isEmpty()) { return Collections.emptyList(); } return arg.stream().map(SearchResult::new).collect(Collectors.toList()); }); }
Source:
private static void validate(CloudBigtableConfiguration configuration, String tableId) { checkNotNullOrEmpty(configuration.getProjectId(), "projectId"); checkNotNullOrEmpty(configuration.getZoneId(), "zoneId"); checkNotNullOrEmpty(configuration.getClusterId(), "clusterId"); if (tableId != null) { checkNotNullOrEmpty(tableId, "tableid"); } if (BigtableSession.isAlpnConfigured()) { try (BigtableConnection conn = new BigtableConnection(configuration.toHBaseConfig()); Admin admin = conn.getAdmin()) { if (tableId != null) { Preconditions.checkState(admin.tableExists(TableName.valueOf(tableId))); } else { admin.listTableNames(); } } catch (IOException | IllegalArgumentException | ExceptionInInitializerError e) { LoggerFactory.getLogger(CloudBigtableIO.class).error( String.format("Could not validate that the table exists: %s (%s)", e.getClass().getName(), e.getMessage()), e); } } }

Target:
private static void validate(CloudBigtableConfiguration configuration, String tableId) { checkNotNullOrEmpty(configuration.getProjectId(), "projectId"); checkNotNullOrEmpty(configuration.getZoneId(), "zoneId"); checkNotNullOrEmpty(configuration.getClusterId(), "clusterId"); if (tableId != null) { checkNotNullOrEmpty(tableId, "tableid"); if (BigtableSession.isAlpnConfigured()) { try (BigtableConnection conn = new BigtableConnection(configuration.toHBaseConfig()); Admin admin = conn.getAdmin()) { Preconditions.checkState(admin.tableExists(TableName.valueOf(tableId))); } catch (IOException | IllegalArgumentException | ExceptionInInitializerError e) { LOG.error(String.format("Could not validate that the table exists: %s (%s)", e.getClass() .getName(), e.getMessage()), e); } } else { LOG.info("ALPN is not configured. Skipping table existence check."); } } }
Source:
private Merovingian2(long msId) { super(MerovingianMBean.class, false); _msId = msId; try (Connection conn = TransactionLegacy.getStandaloneConnectionWithException();) { conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); conn.setAutoCommit(true); _concierge = new ConnectionConcierge("LockMaster", conn, true); } catch (SQLException e) { s_logger.error("Unable to get a new db connection", e); throw new CloudRuntimeException("Unable to initialize a connection to the database for locking purposes: ", e); } }

Target:
private Merovingian2(long msId) { super(MerovingianMBean.class, false); _msId = msId; Connection conn = null; try { conn = TransactionLegacy.getStandaloneConnectionWithException(); conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); conn.setAutoCommit(true); _concierge = new ConnectionConcierge("LockMaster", conn, true); } catch (SQLException e) { s_logger.error("Unable to get a new db connection", e); throw new CloudRuntimeException("Unable to initialize a connection to the database for locking purposes", e); } finally { if (_concierge == null && conn != null) { try { conn.close(); } catch (SQLException e) { s_logger.debug("closing connection failed after everything else.", e); } } } }
Source:
private TopicName createTrackedTopic(String group, String name) { TopicName topic = new TopicName(group, name); operations.createGroup(topic.getGroupName()); operations.createTopic(topic.getGroupName(), topic.getName()); operations.updateTopic(topic, Topic.Builder.topic() .withName(topic) .withTrackingEnabled(true).build()); return topic; }

Target:
private TopicName createTrackedTopic(String group, String name) { TopicName topic = new TopicName(group, name); operations.createGroup(topic.getGroupName()); operations.createTopic(topic().withName(topic).withTrackingEnabled(true).build()); return topic; }
Source:
private Result visitAggregate(Aggregate e, List<Integer> groupKeyList) { final Result x = visitChild(0, e.getInput()); final Builder builder; if ((e.getInput() instanceof Project) && (groupKeyList.isEmpty() || !x.withGroupBy())) { builder = x.builder(e); builder.clauses.add(Clause.GROUP_BY); } else { builder = x.builder(e, Clause.GROUP_BY); } final List<SqlNode> selectList = new ArrayList<>(); final List<SqlNode> groupByList = generateGroupList(builder, selectList, e, groupKeyList); return buildAggregate(e, builder, selectList, groupByList); }

Target:
private Result visitAggregate(Aggregate e, List<Integer> groupKeyList) { final Result x = visitChild(0, e.getInput()); final Builder builder; if (e.getInput() instanceof Project) { builder = x.builder(e); builder.clauses.add(Clause.GROUP_BY); } else { builder = x.builder(e, Clause.GROUP_BY); } final List<SqlNode> selectList = new ArrayList<>(); final List<SqlNode> groupByList = generateGroupList(builder, selectList, e, groupKeyList); return buildAggregate(e, builder, selectList, groupByList); }