auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean vetoes(K key, SoftLock<V> softLock) { if (isInDoubt(softLock)) { return true; } else { return wrappedVeto.vetoes(key, softLock.getOldValue()); } }

Target:
public boolean vetoes(K key, SoftLock<V> softLock) { return isInDoubt(softLock) || wrappedVeto.vetoes(key, softLock.getOldValue()); }
Source:
private void mutateRootGcCandidates(Consumer<RootGcCandidates> mutator) { String zpath = context.getZooKeeperRoot() + ZROOT_TABLET_GC_CANDIDATES; try { context.getZooReaderWriter().mutate(zpath, new byte[0], ZooUtil.PUBLIC, currVal -> { String currJson = new String(currVal, UTF_8); RootGcCandidates rgcc = RootGcCandidates.fromJson(currJson); log.debug("Root GC candidates before change : {}", currJson); mutator.accept(rgcc); String newJson = rgcc.toJson(); log.debug("Root GC candidates after change : {}", newJson); if (newJson.length() > 1 << 18) { log.warn( "Root tablet deletion candidates stored in ZK at are getting large ({} bytes), is" + " Accumulo GC process running? Large nodes may cause problems for Zookeeper!", zpath, newJson.length()); } return newJson.getBytes(UTF_8); }); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
private void mutateRootGcCandidates(Consumer<RootGcCandidates> mutator) { String zpath = context.getZooKeeperRoot() + ZROOT_TABLET_GC_CANDIDATES; try { context.getZooReaderWriter().mutate(zpath, new byte[0], ZooUtil.PUBLIC, currVal -> { String currJson = new String(currVal, UTF_8); RootGcCandidates rgcc = RootGcCandidates.fromJson(currJson); log.debug("Root GC candidates before change : {}", currJson); mutator.accept(rgcc); String newJson = rgcc.toJson(); log.debug("Root GC candidates after change : {}", newJson); if (newJson.length() > 262_144) { log.warn( "Root tablet deletion candidates stored in ZK at are getting large ({} bytes), is" + " Accumulo GC process running? Large nodes may cause problems for Zookeeper!", zpath, newJson.length()); } return newJson.getBytes(UTF_8); }); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public void testRemoveValue() throws Exception { List<String> values = new ArrayList<>(2); values.add("true"); values.add("false"); config.setStringList(TESTSECTION, null, TESTNAME, values); config.save(); getGitConfigurationPreferencePage(); preferencePage.bot().tree(1).getTreeItem(TESTSECTION).getNode( TESTNAME + "[0]").select(); preferencePage.bot() .button(UIText.ConfigurationEditorComponent_RemoveButton) .click(); preferencePage.bot().button(IDialogConstants.OK_LABEL).click(); config.load(); values = Arrays.asList(config .getStringList(TESTSECTION, null, TESTNAME)); assertEquals("Wrong number of values", 1, values.size()); assertTrue(values.contains("false")); }

Target:
public void testRemoveValue() throws Exception { List<String> values = new ArrayList<String>(2); values.add("true"); values.add("false"); config.setStringList(TESTSECTION, null, TESTNAME, values); config.save(); getGitConfigurationPreferencePage(); preferencePage.bot().tree(1).getTreeItem(TESTSECTION).getNode( TESTNAME + "[0]").select(); preferencePage.bot() .button(UIText.ConfigurationEditorComponent_RemoveButton) .click(); preferencePage.bot().button(IDialogConstants.OK_LABEL).click(); config.load(); values = Arrays.asList(config .getStringList(TESTSECTION, null, TESTNAME)); assertEquals("Wrong number of values", 1, values.size()); assertTrue(values.contains("false")); }
Source:
public Object bucket(HttpServletRequest request) { String query = requestExtract.apply(request); if (query == null) { return null; } for (Pattern p : patterns) { Matcher m = p.matcher(query); if (m.find()) { log.debug("Matched pattern on {}", p, query); return p; } } return null; }

Target:
public Object bucket(HttpServletRequest request) { String requestData = requestExtract.apply(request); if (requestData == null) { return null; } for (Pattern p : patterns) { Matcher m = p.matcher(requestData); if (m.find()) { log.debug("Matched pattern on {}", p, requestData); return p; } } return null; }
Source:
private boolean isDeclaredOwner() { if (declaredOwner == null) { final GroupMembership effectiveGroups = user.getEffectiveGroups(); declaredOwner = state.anyOwner(new Predicate<Set<AccountGroup.UUID>>() { @Override public boolean apply(Set<AccountGroup.UUID> owners) { return effectiveGroups.containsAnyOf(owners); } }); } return declaredOwner; }

Target:
private boolean isDeclaredOwner() { if (declaredOwner == null) { GroupMembership effectiveGroups = user.getEffectiveGroups(); declaredOwner = effectiveGroups.containsAnyOf(state.getAllOwners()); } return declaredOwner; }
Source:
public void tableAlreadyExists() { assertThatNoTableIsCreated(); SchemaTableName test1Table = new SchemaTableName("default", "test1"); SchemaTableName test2Table = new SchemaTableName("default", "test2"); metadata.createTable(SESSION, new ConnectorTableMetadata(test1Table, ImmutableList.of())); try { metadata.createTable(SESSION, new ConnectorTableMetadata(test1Table, ImmutableList.of())); fail("Should fail because table already exists"); } catch (PrestoException ex) { assertEquals(ex.getErrorCode(), ALREADY_EXISTS.toErrorCode()); } ConnectorTableHandle test1TableHandle = metadata.getTableHandle(SESSION, test1Table); metadata.createTable(SESSION, new ConnectorTableMetadata(test2Table, ImmutableList.of())); try { metadata.renameTable(SESSION, test1TableHandle, test2Table); fail("Should fail because table already exists"); } catch (PrestoException ex) { assertEquals(ex.getErrorCode(), ALREADY_EXISTS.toErrorCode()); } }

Target:
public void tableAlreadyExists() { assertNoTables(); SchemaTableName test1Table = new SchemaTableName("default", "test1"); SchemaTableName test2Table = new SchemaTableName("default", "test2"); metadata.createTable(SESSION, new ConnectorTableMetadata(test1Table, ImmutableList.of())); try { metadata.createTable(SESSION, new ConnectorTableMetadata(test1Table, ImmutableList.of())); fail("Should fail because table already exists"); } catch (PrestoException ex) { assertEquals(ex.getErrorCode(), ALREADY_EXISTS.toErrorCode()); assertEquals(ex.getMessage(), "Table [default.test1] already exists"); } ConnectorTableHandle test1TableHandle = metadata.getTableHandle(SESSION, test1Table); metadata.createTable(SESSION, new ConnectorTableMetadata(test2Table, ImmutableList.of())); try { metadata.renameTable(SESSION, test1TableHandle, test2Table); fail("Should fail because table already exists"); } catch (PrestoException ex) { assertEquals(ex.getErrorCode(), ALREADY_EXISTS.toErrorCode()); assertEquals(ex.getMessage(), "Table [default.test2] already exists"); } }
Source:
public Tags list() { if (isFiltered()) { GetTagsByUserIdParameters params = new GetTagsByUserIdParameters(getCurrent().get(VdcUser.class).getUserId().toString()); return mapCollection(getBackendCollection(VdcQueryType.GetTagsByUserId, params)); } else { List<tags> tags = getTags(); tags.add(getRootTag()); return mapCollection(tags); } }

Target:
public Tags list() { List<tags> tags = getTags(); tags.add(getRootTag()); return mapCollection(tags); }
Source:
public List<RuleKey> disableTemplateRulesAndCustomRules(DbSession dbSession) { List<RuleDefinitionDto> rules = dbClient.ruleDao().selectAllDefinitions(dbSession).stream() .filter(r -> r.isTemplate() || r.isCustomRule()) .collect(Collectors.toList()); rules.forEach(r -> { r.setStatus(RuleStatus.REMOVED); dbClient.ruleDao().update(dbSession, r); }); return rules.stream().map(RuleDefinitionDto::getKey).collect(Collectors.toList()); }

Target:
public List<RuleKey> disableTemplateRulesAndCustomRules(DbSession dbSession) { List<RuleDefinitionDto> rules = dbClient.ruleDao().selectAllDefinitions(dbSession).stream() .filter(r -> r.isTemplate() || r.isCustomRule()) .collect(toList()); rules.forEach(r -> { r.setStatus(RuleStatus.REMOVED); dbClient.ruleDao().update(dbSession, r); }); return rules.stream().map(RuleDefinitionDto::getKey).collect(toList()); }
Source:
void shouldUpdateChargeToExpire_IfEpdqStatusIs6WithRelevantChargeStatus() { final String payload = notificationPayloadForTransaction(payId, EPDQ_AUTHORISED_CANCELLED); charge = Charge.from(ChargeEntityFixture.aValidChargeEntity() .withStatus(EXPIRE_CANCEL_SUBMITTED) .build()); setUpGatewayAccountToReturnGatewayAccountEntity(Optional.of(gatewayAccountEntity)); setUpChargeServiceToReturnCharge(Optional.of(charge)); final boolean result = notificationService.handleNotificationFor(payload, FORWARDED_IP_ADDRESSES); assertTrue(result); verify(mockChargeNotificationProcessor).invoke(payId, charge, EXPIRE_FLOW.getSuccessTerminalState(), null); }

Target:
void shouldUpdateChargeToExpire_IfEpdqStatusIs6WithRelevantChargeStatus() { final String payload = notificationPayloadForTransaction(payId, EPDQ_AUTHORISED_CANCELLED); charge = Charge.from(ChargeEntityFixture.aValidChargeEntity() .withStatus(EXPIRE_CANCEL_SUBMITTED) .build()); setUpGatewayAccountToReturnGatewayAccountEntity(Optional.of(gatewayAccountEntity)); setUpChargeServiceToReturnCharge(Optional.of(charge)); assertTrue(notificationService.handleNotificationFor(payload, FORWARDED_IP_ADDRESSES)); verify(mockChargeNotificationProcessor).invoke(payId, charge, EXPIRE_FLOW.getSuccessTerminalState(), null); }
Source:
public XPathFuncExpr(XPathQName id, XPathExpression[] args) throws XPathSyntaxException { if ("if".equals(id.name) && args.length != 3) { throw new XPathSyntaxException("if() function requires 3 arguments but " + args.length + " are present."); } else if ("cond".equals(id.name)) { if (args.length < 3 || args.length % 2 != 1) { throw new XPathSyntaxException("cond() function requires an odd number of arguments. " + args.length + " are present."); } } this.id = id; this.args = args; }

Target:
public XPathFuncExpr(XPathQName id, XPathExpression[] args) throws XPathSyntaxException { if ("if".equals(id.name) && args.length != 3) { throw new XPathSyntaxException("if() function requires 3 arguments but " + args.length + " are present."); } else if ("cond".equals(id.name)) { if (args.length < 3) { throw new XPathSyntaxException("cond() function requires at least 3 arguments. " + args.length + " arguments provided."); } else if (args.length % 2 != 1) { throw new XPathSyntaxException("cond() function requires an odd number of arguments. " + args.length + " arguments provided."); } } this.id = id; this.args = args; }
Source:
static StoreDraft of(final String key, @Nullable final LocalizedString name) { return new StoreDraftDsl(key, Collections.emptyList(), name); }

Target:
static StoreDraft of(final String key, @Nullable final LocalizedString name) { return new StoreDraftDsl(key, new ArrayList<>(), name); }
Source:
private static Statement rhsAssignWithValue( VariableDeclarationExpr vdExpr, Type exprType, String value) { if (vdExpr.getVars().size() != 1) { return null; } VariableDeclarationExpr resultExpr = (VariableDeclarationExpr) vdExpr.clone(); VariableDeclarator vd = resultExpr.getVars().get(0); if (exprType instanceof PrimitiveType) { switch (((PrimitiveType) exprType).getType()) { case Boolean: if (value == null) { vd.setInit(new BooleanLiteralExpr(Boolean.parseBoolean("false"))); } else { vd.setInit(new BooleanLiteralExpr(Boolean.parseBoolean(value))); } break; case Char: case Byte: case Short: case Int: if (value == null) { vd.setInit(new IntegerLiteralExpr("0")); } else { vd.setInit(new IntegerLiteralExpr(value)); } break; case Float: if (value == null) { vd.setInit(new DoubleLiteralExpr("0f")); } else { vd.setInit(new DoubleLiteralExpr(value)); } break; case Double: if (value == null) { vd.setInit(new DoubleLiteralExpr("0.0")); } else { vd.setInit(new DoubleLiteralExpr(value)); } break; case Long: if (value == null) { vd.setInit(new LongLiteralExpr("0l")); } else { vd.setInit(new LongLiteralExpr(value)); } break; } } else { vd.setInit(new NullLiteralExpr()); } return new ExpressionStmt(resultExpr); }

Target:
private static Statement rhsAssignWithValue( VariableDeclarationExpr vdExpr, Type exprType, String value) { if (vdExpr.getVars().size() != 1) { return null; } VariableDeclarationExpr resultExpr = (VariableDeclarationExpr) vdExpr.clone(); VariableDeclarator vd = resultExpr.getVars().get(0); if (exprType instanceof PrimitiveType) { vd.setInit(getLiteralExpression(value, ((PrimitiveType) exprType).getType())); } else { vd.setInit(new NullLiteralExpr()); } return new ExpressionStmt(resultExpr); }
Source:
public static boolean IsWindowsXPOrGreater() { return IsWindowsVersionOrGreater(HIBYTE(WinNT.WIN32_WINNT_WINXP), LOBYTE(WinNT.WIN32_WINNT_WINXP), 0); }

Target:
public static boolean IsWindowsXPOrGreater() { return IsWindowsVersionOrGreater((byte) (Kernel32.WIN32_WINNT_WINXP >>> 8), (byte) Kernel32.WIN32_WINNT_WINXP, 0); }
Source:
public GridCacheContextInfo(DynamicCacheDescriptor cacheDesc) { config = new CacheConfiguration(cacheDesc.cacheConfiguration()); dynamicDeploymentId = cacheDesc.deploymentId(); groupId = cacheDesc.groupId(); cacheId = CU.cacheId(config.getName()); clientCache = true; }

Target:
public GridCacheContextInfo(DynamicCacheDescriptor cacheDesc) { config = cacheDesc.cacheConfiguration(); dynamicDeploymentId = cacheDesc.deploymentId(); groupId = cacheDesc.groupId(); cacheId = CU.cacheId(config.getName()); clientCache = true; }
Source:
public JSchConnection getProxyConnection() { String proxyConnectionName = getProxyConnectionName(); if (proxyConnectionName.equals(EMPTY_STRING)) { return null; } else { return (JSchConnection) fManager.getConnection(proxyConnectionName); } }

Target:
public JSchConnection getProxyConnection() { String proxyConnectionName = getProxyConnectionName(); if (proxyConnectionName.equals(EMPTY_STRING)) { return null; } return (JSchConnection) fManager.getConnection(proxyConnectionName); }
Source:
public void doAuthorise_shouldRespondAuthorisationSuccess() throws Exception { Auth3dsDetails auth3dsDetails = AuthUtils.buildAuth3dsDetails(); ArgumentCaptor<Auth3dsResponseGatewayRequest> argumentCaptor = ArgumentCaptor.forClass(Auth3dsResponseGatewayRequest.class); when(mockedChargeDao.findByExternalId(charge.getExternalId())) .thenReturn(Optional.of(charge)); setupMockExecutorServiceMock(); setupPaymentProviderMock(charge.getGatewayTransactionId(), AuthoriseStatus.AUTHORISED, null, argumentCaptor); when(mockedProviders.byName(charge.getPaymentGatewayName())).thenReturn(mockedPaymentProvider); PaymentRequestEntity paymentRequestEntity = PaymentRequestEntityFixture.aValidPaymentRequestEntity().build(); when(mockPaymentRequestDao.updateChargeTransactionStatus(charge.getExternalId(), AUTHORISATION_SUCCESS)) .thenReturn(Optional.of(paymentRequestEntity)); GatewayResponse response = card3dsResponseAuthService.doAuthorise(charge.getExternalId(), auth3dsDetails); assertThat(response.isSuccessful(), is(true)); assertThat(charge.getStatus(), is(AUTHORISATION_SUCCESS.getValue())); assertThat(charge.getGatewayTransactionId(), is(GENERATED_TRANSACTION_ID)); assertThat(paymentRequestEntity.getChargeTransaction().getGatewayTransactionId(), is(GENERATED_TRANSACTION_ID)); assertTrue(argumentCaptor.getValue().getTransactionId().isPresent()); assertThat(argumentCaptor.getValue().getTransactionId().get(), is(GENERATED_TRANSACTION_ID)); }

Target:
public void doAuthorise_shouldRespondAuthorisationSuccess() throws Exception { Auth3dsDetails auth3dsDetails = AuthUtils.buildAuth3dsDetails(); ArgumentCaptor<Auth3dsResponseGatewayRequest> argumentCaptor = ArgumentCaptor.forClass(Auth3dsResponseGatewayRequest.class); when(mockedChargeDao.findByExternalId(charge.getExternalId())) .thenReturn(Optional.of(charge)); setupMockExecutorServiceMock(); setupPaymentProviderMock(charge.getGatewayTransactionId(), AuthoriseStatus.AUTHORISED, null, argumentCaptor); when(mockedProviders.byName(charge.getPaymentGatewayName())).thenReturn(mockedPaymentProvider); when(mockPaymentRequestDao.findByExternalId(charge.getExternalId())) .thenReturn(Optional.of(aValidPaymentRequestEntity)); GatewayResponse response = card3dsResponseAuthService.doAuthorise(charge.getExternalId(), auth3dsDetails); assertThat(response.isSuccessful(), is(true)); assertThat(charge.getStatus(), is(AUTHORISATION_SUCCESS.getValue())); assertThat(charge.getGatewayTransactionId(), is(GENERATED_TRANSACTION_ID)); assertThat(aValidPaymentRequestEntity.getChargeTransaction().getGatewayTransactionId(), is(GENERATED_TRANSACTION_ID)); assertTrue(argumentCaptor.getValue().getTransactionId().isPresent()); assertThat(argumentCaptor.getValue().getTransactionId().get(), is(GENERATED_TRANSACTION_ID)); verify(mockStatusUpdater).updateChargeTransactionStatus(charge.getExternalId(), AUTHORISATION_SUCCESS); }
Source:
HelixNotifier(HelixPropertyStore<ZNRecord> helixStore) { if (helixStore == null) { throw new IllegalArgumentException("helixStore and metricRegistry cannot be null."); } this.helixStore = helixStore; }

Target:
HelixNotifier(HelixPropertyStore<ZNRecord> helixStore) { if (helixStore == null) { throw new IllegalArgumentException("helixStore cannot be null."); } this.helixStore = helixStore; }
Source:
private void appendSemanticElementsToDestroy(final DDiagramElement currentDiagramElement, Set<EObject> elementsToDestroy) { for (final EObject semantic : currentDiagramElement.getSemanticElements()) { if (semantic != null && !elementsToDestroy.contains(semantic)) { elementsToDestroy.add(semantic); elementsToDestroy.addAll(getAllChildren(semantic)); } } for (final EObject child : currentDiagramElement.eContents()) { if (child instanceof DDiagramElement) { appendSemanticElementsToDestroy((DDiagramElement) child, elementsToDestroy); } } }

Target:
private void appendSemanticElementsToDestroy(final DDiagramElement currentDiagramElement, Set<EObject> elementsToDestroy) { for (final EObject semantic : currentDiagramElement.getSemanticElements()) { if (semantic != null && !elementsToDestroy.contains(semantic)) { Iterables.addAll(elementsToDestroy, AllContents.of(semantic, true)); } } for (final EObject child : currentDiagramElement.eContents()) { if (child instanceof DDiagramElement) { appendSemanticElementsToDestroy((DDiagramElement) child, elementsToDestroy); } } }
Source:
public void onPartitionBecomeLeaderFromStandby(String partitionName) { logger.info("Partition state change notification from Standby to Leader received for partition {}", partitionName); ReplicaId localReplica = storeManager.getReplica(partitionName); List<? extends ReplicaId> leaderReplicas = localReplica.getPartitionId().getReplicaIdsByState(ReplicaState.LEADER, null); List<ReplicaId> peerLeaderReplicas = new ArrayList<>(); for (ReplicaId leaderReplica : leaderReplicas) { if (leaderReplica.getDataNodeId() != localReplica.getDataNodeId()) { peerLeaderReplicas.add(leaderReplica); logger.info("Partition on Node is leader in remote dc {}", partitionName, leaderReplica.getDataNodeId().toString(), leaderReplica.getDataNodeId().getDatacenterName()); } } peerLeaderReplicasByPartition.put(partitionName, peerLeaderReplicas); }

Target:
public void onPartitionBecomeLeaderFromStandby(String partitionName) { logger.info("Partition state change notification from Standby to Leader received for partition {}", partitionName); ReplicaId localReplica = storeManager.getReplica(partitionName); List<? extends ReplicaId> leaderReplicas = localReplica.getPartitionId().getReplicaIdsByState(ReplicaState.LEADER, null); List<ReplicaId> peerLeaderReplicas = new ArrayList<>(); for (ReplicaId leaderReplica : leaderReplicas) { if (leaderReplica.getDataNodeId() != localReplica.getDataNodeId()) { peerLeaderReplicas.add(leaderReplica); logger.info("Partition on node instance is leader in remote dc {}", partitionName, getInstanceName(leaderReplica.getDataNodeId().getHostname(), leaderReplica.getDataNodeId().getPort()), leaderReplica.getDataNodeId().getDatacenterName()); } } peerLeaderReplicasByPartition.put(partitionName, peerLeaderReplicas); }
Source:
public String downloadRecording(String callID, String legId, String recordingId, String basePath) throws NotFoundException, GeneralException, UnauthorizedException { if (callID == null) { throw new IllegalArgumentException("Voice call ID must be specified."); } if (legId == null) { throw new IllegalArgumentException("Leg ID must be specified."); } if (recordingId == null) { throw new IllegalArgumentException("Recording ID must be specified."); } String url = String.format( "%s%s/%s%s/%s%s/%s%s", VOICE_CALLS_BASE_URL, VOICECALLSPATH, callID, LEGSPATH, legId, RECORDINGPATH, recordingId, RECORDING_DOWNLOAD_FORMAT ); String fileName = String.format("%s%s",recordingId, RECORDING_DOWNLOAD_FORMAT); return messageBirdService.getBinaryData(url, basePath, fileName); }

Target:
public String downloadRecording(String callID, String legId, String recordingId, String basePath) throws NotFoundException, GeneralException, UnauthorizedException { if (callID == null) { throw new IllegalArgumentException("Voice call ID must be specified."); } if (legId == null) { throw new IllegalArgumentException("Leg ID must be specified."); } if (recordingId == null) { throw new IllegalArgumentException("Recording ID must be specified."); } if (basePath == null) { String homePath = System.getProperty("user.home"); if (homePath == null) { throw new IllegalArgumentException("BasePath must be specified."); } basePath = String.format("%s/%s",homePath,DOWNLOADS); } String url = String.format( "%s%s/%s%s/%s%s/%s%s", VOICE_CALLS_BASE_URL, VOICECALLSPATH, callID, LEGSPATH, legId, RECORDINGPATH, recordingId, RECORDING_DOWNLOAD_FORMAT ); String fileName = String.format("%s%s",recordingId, RECORDING_DOWNLOAD_FORMAT); return messageBirdService.getBinaryData(url, basePath, fileName); }
Source:
public Optional<PlanNode> apply(PlanNode node, Lookup lookup, PlanNodeIdAllocator idAllocator, SymbolAllocator symbolAllocator, Session session) { FilterNode filterNode = (FilterNode) node; Expression canonicalized = canonicalizeExpression(filterNode.getPredicate()); if (canonicalized.equals(TRUE_LITERAL)) { return Optional.of(filterNode.getSource()); } if (canonicalized.equals(filterNode.getPredicate())) { return Optional.empty(); } return Optional.of(new FilterNode(node.getId(), filterNode.getSource(), canonicalized)); }

Target:
public Optional<PlanNode> apply(PlanNode node, Lookup lookup, PlanNodeIdAllocator idAllocator, SymbolAllocator symbolAllocator, Session session) { FilterNode filterNode = (FilterNode) node; Expression canonicalized = canonicalizeExpression(filterNode.getPredicate()); if (canonicalized.equals(filterNode.getPredicate())) { return Optional.empty(); } return Optional.of(new FilterNode(node.getId(), filterNode.getSource(), canonicalized)); }
Source:
public Map<UserPrivilege.Keys, UserPrivilege> getPrivileges() { return this.privileges; }

Target:
public synchronized ConcurrentMap<UserPrivilege.Keys, UserPrivilege> getPrivileges() { return this.privileges; }
Source:
public void fetchesOpenTasks() throws Exception { final Repo repo = new MkRepo(); final long[] closed = new long[]{0L, 1L, 2L}; final long[] open = new long[]{3L, 4L}; final Region region = DyTasksTest.region(repo.name(), closed); final Table table = region.table(DyTask.TBL); for (final long tid : open) { table.put(task(repo.name(), tid, true)); } final Iterable<Task> tasks = new DyTasks(region, repo).open(); MatcherAssert.assertThat( tasks, Matchers.<Task>iterableWithSize(open.length) ); for (final Task task : tasks) { MatcherAssert.assertThat( task.number(), Matchers.isIn(Arrays.asList(ArrayUtils.toObject(open))) ); } }

Target:
public void fetchesOpenTasks() throws Exception { final Repo repo = new MkRepo(); final Region region = DyTasksTest.region(repo.name(), new long[]{0L, 1L, 2L}); final long[] open = new long[]{3L, 4L}; final Table table = region.table(DyTask.TBL); for (final long tid : open) { table.put(task(repo.name(), tid, true)); } final Iterable<Task> tasks = new DyTasks(region, repo).open(); MatcherAssert.assertThat( tasks, Matchers.<Task>iterableWithSize(open.length) ); for (final Task task : tasks) { MatcherAssert.assertThat( task.number(), Matchers.isIn(Arrays.asList(ArrayUtils.toObject(open))) ); } }
Source:
public void define(WebService.NewController context) { WebService.NewAction action = context.createAction("template_groups") .setSince("5.2") .setInternal(true) .setDescription("Lists the groups with their permission as individual groups rather than through user affiliation on the chosen template.<br />" + "This service defaults to all groups, but can be limited to groups with a specific permission by providing the desired permission.<br>" + "Requires the following permission: 'Administer System'.") .addPagingParams(DEFAULT_PAGE_SIZE, RESULTS_MAX_SIZE) .setResponseExample(getClass().getResource("template_groups-example.json")) .setHandler(this); action.createParam(TEXT_QUERY) .setMinimumLength(SEARCH_QUERY_MIN_LENGTH) .setDescription("Limit search to group names that contain the supplied string. <br/>" + "When this parameter is not set, only group having at least one permission are returned.") .setExampleValue("eri"); action.createParam(PARAM_PERMISSION) .setDescription(PROJECT_PERMISSION_PARAM_DESCRIPTION) .setPossibleValues(ProjectPermissions.ALL); createTemplateParameters(action); }

Target:
public void define(WebService.NewController context) { WebService.NewAction action = context.createAction("template_groups") .setSince("5.2") .setInternal(true) .setDescription("Lists the groups with their permission as individual groups rather than through user affiliation on the chosen template.<br />" + "This service defaults to all groups, but can be limited to groups with a specific permission by providing the desired permission.<br>" + "Requires the following permission: 'Administer System'.") .addPagingParams(DEFAULT_PAGE_SIZE, RESULTS_MAX_SIZE) .setResponseExample(getClass().getResource("template_groups-example.json")) .setHandler(this); action.createParam(TEXT_QUERY) .setMinimumLength(SEARCH_QUERY_MIN_LENGTH) .setDescription("Limit search to group names that contain the supplied string. <br/>" + "When this parameter is not set, only group having at least one permission are returned.") .setExampleValue("eri"); createProjectPermissionParameter(action, false); createTemplateParameters(action); }
Source:
public boolean isAPIPublishedInAnyGateway(String APIId) throws APIManagementException { int count = 0; try (Connection connection = GatewayArtifactsMgtDBUtil.getArtifactSynchronizerConnection(); PreparedStatement statement = connection.prepareStatement(SQLConstants.GET_PUBLISHED_GATEWAYS_FOR_API)) { statement.setString(1, APIId); statement.setString(2, APIConstants.GatewayArtifactSynchronizer.GATEWAY_INSTRUCTION_PUBLISH); ResultSet rs = statement.executeQuery(); while (rs.next()) { count = rs.getInt("COUNT"); } } catch (SQLException e) { handleException("Failed check whether API is published in any gateway " + APIId, e); } return count != 0; }

Target:
public boolean isAPIPublishedInAnyGateway(String APIId) throws APIManagementException { int count = 0; ResultSet rs = null; try (Connection connection = GatewayArtifactsMgtDBUtil.getArtifactSynchronizerConnection(); PreparedStatement statement = connection .prepareStatement(SQLConstants.GET_PUBLISHED_GATEWAYS_FOR_API)) { connection.setAutoCommit(false); connection.commit(); statement.setString(1, APIId); statement.setString(2, APIConstants.GatewayArtifactSynchronizer.GATEWAY_INSTRUCTION_PUBLISH); rs = statement.executeQuery(); while (rs.next()) { count = rs.getInt("COUNT"); } } catch (SQLException e) { handleException("Failed check whether API is published in any gateway " + APIId, e); } finally { GatewayArtifactsMgtDBUtil.closeResultSet(rs); } return count != 0; }
Source:
public void stream(String url, String sinkId) throws AudioException { AudioStream audioStream = new URLAudioStream(url); AudioSink sink = null; if (sinkId == null) { sink = getSink(); } else { sink = audioSinks.get(sinkId); } if (sink != null) { try { sink.process(audioStream); } catch (UnsupportedAudioFormatException e) { logger.error("Error playing '{}': {}", url, e.getMessage()); } } }

Target:
public void stream(String url, String sinkId) throws AudioException { AudioStream audioStream = new URLAudioStream(url); AudioSink sink = getSink(sinkId); if (sink != null) { try { sink.process(audioStream); } catch (UnsupportedAudioFormatException e) { logger.error("Error playing '{}': {}", url, e.getMessage()); } } }
Source:
public int getDataState() { try { ITelephony telephony = getITelephony(); if (telephony == null) return DATA_DISCONNECTED; return telephony.getDataState( getSubId(SubscriptionManager.getDefaultDataSubscriptionId())); } catch (RemoteException ex) { return DATA_DISCONNECTED; } catch (NullPointerException ex) { return DATA_DISCONNECTED; } }

Target:
public int getDataState() { try { ITelephony telephony = getITelephony(); if (telephony == null) return DATA_DISCONNECTED; return telephony.getDataState( getSubId(SubscriptionManager.getActiveDataSubscriptionId())); } catch (RemoteException ex) { return DATA_DISCONNECTED; } catch (NullPointerException ex) { return DATA_DISCONNECTED; } }
Source:
getDefaultOutputFormatters( TargetAccessor<ConfiguredTarget> accessor, ExtendedEventHandler eventHandler, OutputStream out, SkyframeExecutor skyframeExecutor, BuildConfiguration hostConfiguration, @Nullable TransitionFactory<Rule> trimmingTransitionFactory, PackageManager packageManager) { AspectResolver aspectResolver = cqueryOptions.aspectDeps.createResolver(packageManager, eventHandler); return ImmutableList.of( new LabelAndConfigurationOutputFormatterCallback( eventHandler, cqueryOptions, out, skyframeExecutor, accessor), new LabelKindAndConfigurationOutputFormatterCallback( eventHandler, cqueryOptions, out, skyframeExecutor, accessor, getAccessor()), new TransitionsOutputFormatterCallback( eventHandler, cqueryOptions, out, skyframeExecutor, accessor, hostConfiguration, trimmingTransitionFactory), new ProtoOutputFormatterCallback( eventHandler, cqueryOptions, out, skyframeExecutor, accessor, aspectResolver, OutputType.BINARY), new ProtoOutputFormatterCallback( eventHandler, cqueryOptions, out, skyframeExecutor, accessor, aspectResolver, OutputType.TEXT), new ProtoOutputFormatterCallback( eventHandler, cqueryOptions, out, skyframeExecutor, accessor, aspectResolver, OutputType.JSON), new BuildOutputFormatterCallback( eventHandler, cqueryOptions, out, skyframeExecutor, accessor)); }

Target:
getDefaultOutputFormatters( TargetAccessor<ConfiguredTarget> accessor, ExtendedEventHandler eventHandler, OutputStream out, SkyframeExecutor skyframeExecutor, BuildConfiguration hostConfiguration, @Nullable TransitionFactory<Rule> trimmingTransitionFactory, PackageManager packageManager) { AspectResolver aspectResolver = cqueryOptions.aspectDeps.createResolver(packageManager, eventHandler); return ImmutableList.of( new LabelAndConfigurationOutputFormatterCallback( eventHandler, cqueryOptions, out, skyframeExecutor, accessor, true), new LabelAndConfigurationOutputFormatterCallback( eventHandler, cqueryOptions, out, skyframeExecutor, accessor, false), new TransitionsOutputFormatterCallback( eventHandler, cqueryOptions, out, skyframeExecutor, accessor, hostConfiguration, trimmingTransitionFactory), new ProtoOutputFormatterCallback( eventHandler, cqueryOptions, out, skyframeExecutor, accessor, aspectResolver, OutputType.BINARY), new ProtoOutputFormatterCallback( eventHandler, cqueryOptions, out, skyframeExecutor, accessor, aspectResolver, OutputType.TEXT), new ProtoOutputFormatterCallback( eventHandler, cqueryOptions, out, skyframeExecutor, accessor, aspectResolver, OutputType.JSON), new BuildOutputFormatterCallback( eventHandler, cqueryOptions, out, skyframeExecutor, accessor)); }
Source:
public static void enableVault(SuiteContext suiteContext, EnableVault.PROVIDER_ID provider) throws IOException, CliException, TimeoutException, InterruptedException { if (suiteContext.getAuthServerInfo().isUndertow()) { System.setProperty("keycloak.vault." + provider.getName() + ".provider.enabled", "true"); } else { OnlineManagementClient client = AuthServerTestEnricher.getManagementClient(); client.execute("/subsystem=keycloak-server/spi=vault/:add"); client.execute("/subsystem=keycloak-server/spi=vault/provider=elytron-cs-keystore/:add(enabled=" + (provider == ELYTRON_CS_KEYSTORE) + ",properties={location => \"${jboss.home.dir}/standalone/configuration/vault/credential-store.p12\", " + "secret => \"MASK-3u2HNQaMogJJ8VP7J6gRIl;12345678;321\", keyStoreType => \"PKCS12\"})"); client.execute("/subsystem=keycloak-server/spi=vault/provider=files-plaintext/:add(enabled=" + (provider == PLAINTEXT) + ",properties={dir => \"${jboss.home.dir}/standalone/configuration/vault\"})"); client.close(); } }

Target:
public static void enableVault(SuiteContext suiteContext, EnableVault.PROVIDER_ID provider) throws IOException, CliException, TimeoutException, InterruptedException { if (suiteContext.getAuthServerInfo().isUndertow()) { System.setProperty("keycloak.vault." + provider.getName() + ".provider.enabled", "true"); } else { OnlineManagementClient client = AuthServerTestEnricher.getManagementClient(); client.execute("/subsystem=keycloak-server/spi=vault/:add(default-provider=" + provider.getName() + ")"); client.execute(provider.getCliInstallationCommand()); client.close(); } }
Source:
public void shouldAllowRequestToShare() { final String resourceName = "Resource 12"; myResourcesPage.clickPendingRequest(resourceName); waitForModalFadeIn(); myResourcesPage.acceptRequest(resourceName, 0); waitForModalFadeOut(); myResourcesPage.clickSignOut(); myResourcesPage.navigateTo(); loginPage.form().login(createUser("alice")); myResourcesPage.clickSharedWithMeTab(); assertTrue(myResourcesPage.containsResource(resourceName)); }

Target:
public void shouldAllowRequestToShare() { final String resourceName = "Resource 12"; assertEquals("1", myResourcesPage.getPendingRequestText(resourceName)); switchUserSharedWithMeTab(); assertFalse(myResourcesPage.containsResource(resourceName)); login("jdoe"); myResourcesPage.clickPendingRequest(resourceName); assertEquals("alice", myResourcesPage.getPendingRequestRequestor(0)); final String permissions = myResourcesPage.getPendingRequestPermissions(0); assertTrue(permissions.contains("Scope A")); assertTrue(permissions.contains("Scope B")); myResourcesPage.acceptRequest(resourceName, 0); assertNoPendingRequest(resourceName); switchUserSharedWithMeTab(); assertTrue(myResourcesPage.containsResource(resourceName)); }
Source:
public void setUp() { mAppStartupHelper = new AppStartupHelper(); HelperTestUtility.clearApp(String.format(KILL_TEST_APP_CMD_TEMPLATE, CALENDAR_PKG_NAME)); HelperTestUtility.clearApp(String.format(KILL_TEST_APP_CMD_TEMPLATE, SETTINGS_PKG_NAME)); HelperTestUtility.clearApp(String.format(KILL_TEST_APP_CMD_TEMPLATE, SETTINGS_PKG_NAME)); HelperTestUtility.wakeUpAndUnlock(); }

Target:
public void setUp() { mAppStartupHelper = new AppStartupHelper(); HelperTestUtility.clearApp(String.format(KILL_TEST_APP_CMD_TEMPLATE, CALENDAR_PKG_NAME)); HelperTestUtility.clearApp(String.format(KILL_TEST_APP_CMD_TEMPLATE, SETTINGS_PKG_NAME)); HelperTestUtility.wakeUpAndUnlock(); }
Source:
public void onForgotPasswordClicked() { startActivity(RecoverPasswordActivity.createIntent( this, getFlowParams(), mEmail)); }

Target:
private void onForgotPasswordClicked() { startActivity(RecoverPasswordActivity.createIntent( this, getFlowParams(), mEmail)); }
Source:
public void createQuestionValidationErrorsTest() throws Exception { Branch branch = new Branch("name", "description"); branch.setSection(new Section("namesection")); Topic createdQuestion = new Topic(); createdQuestion.setId(1); TopicDto topicDto = new TopicDto(new Topic()); topicDto.setBodyText("text"); Model model = new ExtendedModelMap(); when(result.hasErrors()).thenReturn(true); when(branchService.get(anyLong())).thenReturn(branch); List<Breadcrumb> breadcrumbs = new BreadcrumbBuilder().getNewTopicBreadcrumb(branch); when(breadcrumbBuilder.getNewTopicBreadcrumb(branch)).thenReturn(breadcrumbs); String actual = controller.createQuestion(topicDto, result , model, 1L, request); for (int i = 1; i < breadcrumbs.size(); i++) { if(i == 1) assertEquals(breadcrumbs.get(1).getValue(), branch.getSection().getName()); if(i == 2) assertEquals(breadcrumbs.get(2).getValue(), branch.getName()); } assertEquals(actual, QuestionsAndAnswersController.PLUGIN_VIEW_NAME); assertEquals(model.asMap().get(QuestionsAndAnswersController.CONTENT), content); }

Target:
public void createQuestionValidationErrorsTest() throws Exception { Branch branch = new Branch("name", "description"); branch.setSection(new Section("namesection")); Topic createdQuestion = new Topic(); createdQuestion.setId(1); TopicDto topicDto = new TopicDto(new Topic()); topicDto.setBodyText("text"); Model model = new ExtendedModelMap(); when(result.hasErrors()).thenReturn(true); when(branchService.get(anyLong())).thenReturn(branch); List<Breadcrumb> breadcrumbs = new BreadcrumbBuilder().getNewTopicBreadcrumb(branch); when(breadcrumbBuilder.getNewTopicBreadcrumb(branch)).thenReturn(breadcrumbs); String actual = controller.createQuestion(topicDto, result , model, 1L, request); assertEquals(breadcrumbs.get(2).getValue(), branch.getName()); assertEquals(breadcrumbs.get(1).getValue(), branch.getSection().getName()); assertEquals(actual, QuestionsAndAnswersController.PLUGIN_VIEW_NAME); assertEquals(model.asMap().get(QuestionsAndAnswersController.CONTENT), content); }
Source:
public final boolean test(IPerson person) { Object[] atts = person.getAttributeValues(getAttributeName()); if (atts != null && atts.length > 0) { return false; } return true; }

Target:
public final boolean test(IPerson person) { Object[] atts = person.getAttributeValues(getAttributeName()); return atts == null || atts.length < 1; }
Source:
public void testAddSecretVolumeToPodSpec() throws JSONException { IVolumeMount volumeMount = new IVolumeMount() { public String getName() { return "my-secret"; } public String getMountPath() { return "/path/to/my/secret/"; } public boolean isReadOnly() { return true; } public void setName(String name) public void setMountPath(String path) public void setReadOnly(boolean readonly) }; ((ReplicationController) rc).addSecretVolumeToPodSpec(volumeMount, "the-secret"); Set<IVolumeSource> podSpecVolumes = rc.getVolumes(); boolean found = false; for (IVolumeSource vol : podSpecVolumes) { if(vol.getName().equals(volumeMount.getName())) { found = true; break; } } assertTrue("Expected to find secret volume in pod spec", found); }

Target:
public void testAddSecretVolumeToPodSpec() throws JSONException { IVolumeMount volumeMount = new IVolumeMount() { public String getName() { return "my-secret"; } public String getMountPath() { return "/path/to/my/secret/"; } public boolean isReadOnly() { return true; } public void setName(String name) public void setMountPath(String path) public void setReadOnly(boolean readonly) }; ((ReplicationController) rc).addSecretVolumeToPodSpec(volumeMount, "the-secret"); Set<IVolumeSource> podSpecVolumes = rc.getVolumes(); Optional vol = podSpecVolumes.stream() .filter(v->v.getName().equals(volumeMount.getName())) .findFirst(); assertTrue("Expected to find secret volume in pod spec", vol.isPresent()); }
Source:
public int hashCode() { int result = userName == null ? 0 : userName.hashCode(); result = 31 * result + (groups == null ? 0 : groups.hashCode()); result = 31 * result + (roles == null ? 0 : roles.hashCode()); result = 31 * result + (firstName == null ? 0 : firstName.hashCode()); result = 31 * result + (lastName == null ? 0 : lastName.hashCode()); result = 31 * result + (company == null ? 0 : company.hashCode()); result = 31 * result + (password == null ? 0 : password.hashCode()); return result; }

Target:
public int hashCode() { return new HashCodeBuilder().append(userName) .append(groups) .append(roles) .append(firstName) .append(lastName) .append(company) .append(password) .toHashCode(); }
Source:
public IStatus validate(String path) { if (fTrace == null) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceTypeHelper_ValidateNoTrace); } return fTrace.validate(null, path); }

Target:
public IStatus validate(String path) { return fTrace.validate(null, path); }
Source:
public void purgeDefinition_shouldPurgeReportDesigns() throws Exception { executeDataSet("org/openmrs/module/reporting/include/ReportDefinitionServiceImplTest.xml"); ReportDefinition definition = reportDefinitionService.getDefinition(80); reportDefinitionService.purgeDefinition(definition); assertThat(reportService.getReportDesign(3), nullValue()); assertThat(reportService.getReportDesign(4), nullValue()); }

Target:
public void purgeDefinition_shouldPurgeReportDesigns() throws Exception { executeDataSet("org/openmrs/module/reporting/include/ReportDefinitionServiceImplTest.xml"); assertThat(reportService.getReportDesign(3), notNullValue()); assertThat(reportService.getReportDesign(4), notNullValue()); Context.clearSession(); ReportDefinition definition = reportDefinitionService.getDefinition(80); reportDefinitionService.purgeDefinition(definition); assertThat(reportService.getReportDesign(3), nullValue()); assertThat(reportService.getReportDesign(4), nullValue()); }
Source:
private static String decodeComponent(String s, int from, int toExcluded, Charset charset, boolean isPath) { int len = toExcluded - from; if (len <= 0) { return EMPTY_STRING; } int firstEscaped = -1; for (int i = from; i < toExcluded; i++) { char c = s.charAt(i); if (c == '%' || c == '+' && !isPath) { firstEscaped = i; break; } } if (firstEscaped == -1) { return s.substring(from, toExcluded); } CharsetDecoder decoder = CharsetUtil.decoder(charset); int decodedCapacity = (toExcluded - firstEscaped) / 3; byte[] buf = PlatformDependent.allocateUninitializedArray(decodedCapacity); int bufIdx; StringBuilder strBuf = new StringBuilder(len); strBuf.append(s, from, firstEscaped); for (int i = firstEscaped; i < toExcluded; i++) { char c = s.charAt(i); if (c != '%') { strBuf.append(c != '+' || isPath? c : SPACE); continue; } bufIdx = 0; do { if (i + 3 > toExcluded) { throw new IllegalArgumentException("unterminated escape sequence at index " + i + " of: " + s); } buf[bufIdx++] = decodeHexByte(s, i + 1); i += 3; } while (i < toExcluded && s.charAt(i) == '%'); i--; strBuf.append(new String(buf, 0, bufIdx, charset)); } return strBuf.toString(); }

Target:
private static String decodeComponent(String s, int from, int toExcluded, Charset charset, boolean isPath) { int len = toExcluded - from; if (len <= 0) { return EMPTY_STRING; } int firstEscaped = -1; for (int i = from; i < toExcluded; i++) { char c = s.charAt(i); if (c == '%' || c == '+' && !isPath) { firstEscaped = i; break; } } if (firstEscaped == -1) { return s.substring(from, toExcluded); } int decodedCapacity = (toExcluded - firstEscaped) / 3; byte[] buf = PlatformDependent.allocateUninitializedArray(decodedCapacity); int bufIdx; StringBuilder strBuf = new StringBuilder(len); strBuf.append(s, from, firstEscaped); for (int i = firstEscaped; i < toExcluded; i++) { char c = s.charAt(i); if (c != '%') { strBuf.append(c != '+' || isPath? c : SPACE); continue; } bufIdx = 0; do { if (i + 3 > toExcluded) { throw new IllegalArgumentException("unterminated escape sequence at index " + i + " of: " + s); } buf[bufIdx++] = decodeHexByte(s, i + 1); i += 3; } while (i < toExcluded && s.charAt(i) == '%'); i--; strBuf.append(new String(buf, 0, bufIdx, charset)); } return strBuf.toString(); }
Source:
public void signalProcessInstancesCmdExecutorTest() { SignalProcessInstancesCmd signalProcessInstancesCmd = new SignalProcessInstancesCmd("x"); assertThat(signalProcessInstancesCmdExecutor).isNotNull(); assertThat(signalProcessInstancesCmdExecutor.getHandledType()).isEqualTo(SignalProcessInstancesCmd.class); signalProcessInstancesCmdExecutor.execute(signalProcessInstancesCmd); verify(processEngine).signal(signalProcessInstancesCmd); verify(commandResults).send(ArgumentMatchers.<Message<SignalProcessInstancesResults>>any()); }

Target:
public void signalProcessInstancesCmdExecutorTest() { SignalProcessInstancesCmd signalProcessInstancesCmd = new SignalProcessInstancesCmd("x"); assertThat(signalProcessInstancesCmdExecutor.getHandledType()).isEqualTo(SignalProcessInstancesCmd.class); signalProcessInstancesCmdExecutor.execute(signalProcessInstancesCmd); verify(processEngine).signal(signalProcessInstancesCmd); verify(commandResults).send(ArgumentMatchers.<Message<SignalProcessInstancesResults>>any()); }
Source:
private static String getAddonDirectory(List<String> arguments) { int addDirectoryIndex = arguments.indexOf("--immutableAddonDir") + 1; return arguments.get(addDirectoryIndex); }

Target:
private static String getAddonDirectory(List<String> arguments) { int index = arguments.indexOf("--immutableAddonDir"); if (index == -1) { return ""; } return arguments.get(++index); }
Source:
public GetDiskAlignmentParameters(Guid diskId) { setEntityId(diskId); }

Target:
public GetDiskAlignmentParameters(Guid diskId) { setDiskId(diskId); }
Source:
public FtraceEvent(ITmfTrace trace, long rank, FtraceField field) { super(trace, rank, TmfTimestamp.fromNanos(field.getTs()), FtraceEventTypeFactory.get(field.getName()), field.getContent()); fField = field; fName = field.getName(); fLogLevel = Level.INFO; fCallsite = null; }

Target:
public FtraceEvent(ITmfTrace trace, long rank, FtraceField field) { super(trace, rank, TmfTimestamp.fromNanos(field.getTs()), FtraceEventTypeFactory.get(field.getName()), field.getContent()); fField = field; fName = field.getName(); fCallsite = null; }
Source:
public ValidationResult validateCinderDiskLimits() { return validate(new Callable<ValidationResult>() { @Override public ValidationResult call() { for (CinderDisk disk : cinderDisks) { OpenStackVolumeProviderProxy proxy = diskProxyMap.get(disk.getId()); Limits limits = proxy.getLimits(); if (limits.getAbsolute().getTotalVolumesUsed() >= limits.getAbsolute().getMaxTotalVolumes()) { return new ValidationResult(VdcBllMessages.CANNOT_ADD_CINDER_DISK_VOLUME_LIMIT_EXCEEDED, String.format("$maxTotalVolumes %d", limits.getAbsolute().getMaxTotalVolumes()), String.format("$diskAlias %s", disk.getDiskAlias())); } } return ValidationResult.VALID; } }); }

Target:
public ValidationResult validateCinderDiskLimits() { return validate(new Callable<ValidationResult>() { @Override public ValidationResult call() { int diskIndex = 0; for (CinderDisk disk : cinderDisks) { OpenStackVolumeProviderProxy proxy = diskProxyMap.get(disk.getId()); Limits limits = proxy.getLimits(); if (limits.getAbsolute().getTotalVolumesUsed() + diskIndex >= limits.getAbsolute().getMaxTotalVolumes()) { return new ValidationResult(VdcBllMessages.CANNOT_ADD_CINDER_DISK_VOLUME_LIMIT_EXCEEDED, String.format("$maxTotalVolumes %d", limits.getAbsolute().getMaxTotalVolumes()), String.format("$diskAlias %s", disk.getDiskAlias())); } diskIndex++; } return ValidationResult.VALID; } }); }
Source:
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { if (DEBUG) { Log.d(TAG, "onCreateOptionsMenu() called with: menu = [" + menu + "], inflater = [" + inflater + "]"); } super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.menu_local_playlist, menu); }

Target:
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { if (DEBUG) { Log.d(TAG, "onCreateOptionsMenu() called with: " + "menu = [" + menu + "], inflater = [" + inflater + "]"); } super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.menu_local_playlist, menu); }