auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Color getBackground(Object element, int columnIndex) { String result = ((PMSymbolMatch) element).getResult(); switch (columnIndex) { case 3: try { float resFloat = Float.parseFloat(result); if (resFloat < 0) { return new Color(Display.getCurrent(), StringConverter.asRGB(COLOR_RED)); } else if (resFloat == 0) { return Display.getCurrent().getSystemColor(SWT.COLOR_WHITE); } else { return new Color(Display.getCurrent(), StringConverter.asRGB(COLOR_GREEN)); } <START> } catch (Exception ex) { <END> return Display.getCurrent().getSystemColor(SWT.COLOR_WHITE); } default: return Display.getCurrent().getSystemColor(SWT.COLOR_WHITE); } }</code><technical_language>catch Exception. Catch actual exception care for</technical_language>

Target:
public Color getBackground(Object element, int columnIndex) { PMSymbolMatch match = (PMSymbolMatch) element; String result = match.getResult(); switch (columnIndex) { case 3: if (result != null && result.equals(PMSymbolMatch.SYMBOL_MATCHED)) { float resFloat = match.getOverheadDifference(); if (resFloat < 0) { return new Color(Display.getCurrent(), StringConverter.asRGB(COLOR_RED)); } else if (resFloat > 0) { return new Color(Display.getCurrent(), StringConverter.asRGB(COLOR_GREEN)); } else { return Display.getCurrent().getSystemColor(SWT.COLOR_WHITE); } } else { return Display.getCurrent().getSystemColor(SWT.COLOR_WHITE); } default: return Display.getCurrent().getSystemColor(SWT.COLOR_WHITE); } }
Source:
<code>public String explain() { <START> return "Access on " + operation + " " + resource.getType() + ":" + resource.getName() + " denied" <END> + (StringUtils.isEmpty(reason) ? "" : "; Reason : " + reason); }</code><technical_language>improve message checking if null == operation show a message in case is. generic (like Unable complete operation "event-type-name" + reason. do think</technical_language>

Target:
public String explain() { return "Access on " + (null == operation ? "" : operation + " ") + resource.getType() + ":" + resource.getName() + " denied" + (StringUtils.isEmpty(reason) ? "" : "; Reason : " + reason); }
Source:
<code>private static boolean canPlugInterface(VmNic iface, Guid vdsGroupId) { <START> VDSGroup vdsGroup = DbFacade.getInstance().getVdsGroupDao().get(vdsGroupId); <END> Guid dataCenterId = vdsGroup == null ? null : vdsGroup.getStoragePoolId(); boolean canPlugInterface = canPlugInterfaceInDc(iface, dataCenterId); if (!canPlugInterface) { new VmInterfaceManager().auditLogMacInUseUnplug(iface); } return canPlugInterface; }</code><technical_language>Please - 'dbFacade' is injected in this file</technical_language>

Target:
private static boolean canPlugInterface(VmNic iface, Guid vdsGroupId) { VDSGroup vdsGroup = dbFacade.getVdsGroupDao().get(vdsGroupId); Guid dataCenterId = vdsGroup == null ? null : vdsGroup.getStoragePoolId(); boolean canPlugInterface = canPlugInterfaceInDc(iface, dataCenterId); if (!canPlugInterface) { new VmInterfaceManager().auditLogMacInUseUnplug(iface); } return canPlugInterface; }
Source:
<code>public boolean hasMoreCandidates() { <START> return true; <END> }</code><technical_language>some edge cases this true. Consider case 1 discrete parameter optimize, values {A,B,C}. In this case, 3 candidates - candidate generator terminate 3 generated</technical_language>

Target:
public boolean hasMoreCandidates() { return hasMoreCandidates; }
Source:
<code>public void reauthenticateSuccessNoMigration() throws Exception { String expQuery = "SELECT acct FROM HibernateAccount AS acct LEFT JOIN acct.accountSubstudies AS "+ "acctSubstudy WITH acct.id = acctSubstudy.accountId WHERE acct.studyId = :studyId AND "+ "acct.email=:email GROUP BY acct.id"; HibernateAccount hibernateAccount = makeValidHibernateAccount(false); when(mockHibernateHelper.queryGet(any(), any(), any(), any(), any())).thenReturn(ImmutableList.of(hibernateAccount)); AccountSecret secret = AccountSecret.create(); when(mockAccountSecretDao.verifySecret(AccountSecretType.REAUTH, hibernateAccount.getId(), REAUTH_TOKEN, HibernateAccountDao.ROTATIONS)).thenReturn(Optional.of(secret)); Account account = dao.reauthenticate(study, REAUTH_SIGNIN); assertEquals(ACCOUNT_ID, account.getId()); assertEquals(TestConstants.TEST_STUDY_IDENTIFIER, account.getStudyId()); assertEquals(EMAIL, account.getEmail()); assertEquals(1, account.getVersion()); verify(mockHibernateHelper).queryGet(expQuery, EMAIL_QUERY_PARAMS, null, null, HibernateAccount.class); verify(mockHibernateHelper, never()).update(any(), any()); assertNull(hibernateAccount.getReauthTokenHash()); assertNull(hibernateAccount.getReauthTokenAlgorithm()); <START> assertNull(hibernateAccount.getReauthTokenModifiedOn()); <END> }</code><technical_language>Similarly here, verify verifySecret() is called</technical_language>

Target:
public void reauthenticateSuccessNoMigration() throws Exception { String expQuery = "SELECT acct FROM HibernateAccount AS acct LEFT JOIN acct.accountSubstudies AS "+ "acctSubstudy WITH acct.id = acctSubstudy.accountId WHERE acct.studyId = :studyId AND "+ "acct.email=:email GROUP BY acct.id"; HibernateAccount hibernateAccount = makeValidHibernateAccount(false); when(mockHibernateHelper.queryGet(any(), any(), any(), any(), any())).thenReturn(ImmutableList.of(hibernateAccount)); AccountSecret secret = AccountSecret.create(); when(mockAccountSecretDao.verifySecret(AccountSecretType.REAUTH, hibernateAccount.getId(), REAUTH_TOKEN, HibernateAccountDao.ROTATIONS)).thenReturn(Optional.of(secret)); Account account = dao.reauthenticate(study, REAUTH_SIGNIN); assertEquals(ACCOUNT_ID, account.getId()); assertEquals(TestConstants.TEST_STUDY_IDENTIFIER, account.getStudyId()); assertEquals(EMAIL, account.getEmail()); assertEquals(1, account.getVersion()); verify(mockHibernateHelper).queryGet(expQuery, EMAIL_QUERY_PARAMS, null, null, HibernateAccount.class); verify(mockHibernateHelper, never()).create(any(), any()); verify(mockHibernateHelper, never()).update(any(), any()); assertNull(hibernateAccount.getReauthTokenHash()); assertNull(hibernateAccount.getReauthTokenAlgorithm()); assertNull(hibernateAccount.getReauthTokenModifiedOn()); verify(mockAccountSecretDao).verifySecret(AccountSecretType.REAUTH, ACCOUNT_ID, REAUTH_TOKEN, 3); }
Source:
<code>public Stream<InputSplit<URI>> createSplits(InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec) throws IOException { <START> if (cacheSplitUris == null) { <END> initalizeSplitUris(); } return cacheSplitUris.stream().map(InputSplit::new); }</code><technical_language>Yes, cached in memory</technical_language>

Target:
public Stream<InputSplit<CloudObjectLocation>> createSplits( InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec ) { if (objects != null) { return objects.stream().map(InputSplit::new); } if (uris != null) { return uris.stream().map(CloudObjectLocation::new).map(InputSplit::new); } return StreamSupport.stream(getIterableObjectsFromPrefixes().spliterator(), false) .map(S3Utils::summaryToCloudObjectLocation) .map(InputSplit::new); }
Source:
<code>public void doAddRole(StaplerRequest request, StaplerResponse response) throws IOException { Hudson.getInstance().checkPermission(Hudson.ADMINISTER); String type = request.getParameter("type"); String roleName = request.getParameter("roleName"); String permissions = request.getParameter("permissionIds"); String overwrite = request.getParameter("overwrite"); <START> if(type != null && roleName != null && permissions != null) { <END> boolean overwriteb = false; String pattern = ".*"; if(type != RoleBasedAuthorizationStrategy.GLOBAL && request.getParameter("pattern") != null) { pattern = request.getParameter("pattern"); } if(overwrite != null) { if(overwrite.equals("true")) { overwriteb = true; } } ArrayList<String> permissionList = new ArrayList<String>(); String[] split = permissions.split(","); for(int i=0; i<split.length; i++) { permissionList.add(split[i]); } Set<Permission> permissionSet = new HashSet<Permission>(); for(String p: permissionList) { permissionSet.add(Permission.fromId(p)); } Role role = new Role(roleName, pattern, permissionSet); if(overwriteb) { Role role2 = this.grantedRoles.get(type).getRole(roleName); if(role2!=null) { this.grantedRoles.get(type).removeRole(role2); } } addRole(type, role); Hudson.getInstance().save(); } }</code><technical_language>if (</technical_language>

Target:
public void doAddRole(StaplerRequest request, StaplerResponse response) throws IOException { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); String type = request.getParameter("type"); String roleName = request.getParameter("roleName"); String permissions = request.getParameter("permissionIds"); String overwrite = request.getParameter("overwrite"); if (type != null && roleName != null && permissions != null) { boolean overwriteb = false; String pattern = ".*"; if (type != RoleBasedAuthorizationStrategy.GLOBAL && request.getParameter("pattern") != null) { pattern = request.getParameter("pattern"); } if (overwrite != null) { if (overwrite.equals("true")) { overwriteb = true; } } ArrayList<String> permissionList = new ArrayList<String>(); String[] split = permissions.split(","); for (int i=0; i<split.length; i++) { permissionList.add(split[i]); } Set<Permission> permissionSet = new HashSet<Permission>(); for (String p: permissionList) { permissionSet.add(Permission.fromId(p)); } Role role = new Role(roleName, pattern, permissionSet); if (overwriteb) { Role role2 = this.grantedRoles.get(type).getRole(roleName); if (role2!=null) { this.grantedRoles.get(type).removeRole(role2); } } addRole(type, role); Hudson.getInstance().save(); } }
Source:
<code>public TcpConnectionSupport getConnection() throws Exception { TcpConnectionSupport connection = this.connections.get(); if (connection == null || !connection.isOpen()) { connection = this.connectionFactory.getConnection(); connection.disableClose(); this.connections.set(connection); } <START> return connection; <END> }</code><technical_language>instead of peculiar disable/enableClose return a wrapper empty close() impl invoke delegate.close() in releaseConnection() above? similar in Spring Kafka: <LINK_0></technical_language>

Target:
public TcpConnectionSupport getConnection() throws Exception { TcpThreadConnection connection = this.connections.get(); if (connection == null || !connection.isOpen()) { TcpConnectionSupport delegate = this.connectionFactory.getConnection(); connection = new TcpThreadConnection(delegate); this.connections.set(connection); } return connection; }
Source:
<code>private String generateStringSetter( final String className, final String fieldName, final String name, final String enumSetter) { return String.format( "%2$s" + " public %3$s %1$s(final CharSequence value)\n" + " {\n" + " toBytes(value, %1$s);\n" + " %1$sOffset = 0;\n" + " %1$sLength = value.length();\n" + " return this;\n" + " }\n\n" + " public %3$s %1$s(final AsciiSequenceView value)\n" + " {\n" + <START> " if (value.length() > 0)\n" + <END> " {\n" + " %1$s.wrap(value.buffer());\n" + " %1$sOffset = value.offset();\n" + " %1$sLength = value.length();\n" + " }\n" + " return this;\n" + " }\n\n" + " public %3$s %1$s(final char[] value)\n" + " {\n" + " return %1$s(value, 0, value.length);\n" + " }\n\n" + " public %3$s %1$s(final char[] value, final int length)\n" + " {\n" + " return %1$s(value, 0, length);\n" + " }\n\n" + " public %3$s %1$s(final char[] value, final int offset, final int length)\n" + " {\n" + " toBytes(value, %1$s, offset, length);\n" + " %1$sOffset = 0;\n" + " %1$sLength = length;\n" + " return this;\n" + " }\n\n" + "%4$s", fieldName, generateBytesSetter(className, fieldName, name), className, enumSetter); }</code><technical_language>misunderstood Tom - problem buffer null, length 0? - if fields pull out worth putting a local variable in generated code</technical_language>

Target:
private String generateStringSetter( final String className, final String fieldName, final String name, final String enumSetter) { return String.format( "%2$s" + " public %3$s %1$s(final CharSequence value)\n" + " {\n" + " toBytes(value, %1$s);\n" + " %1$sOffset = 0;\n" + " %1$sLength = value.length();\n" + " return this;\n" + " }\n\n" + " public %3$s %1$s(final AsciiSequenceView value)\n" + " {\n" + " final DirectBuffer buffer = value.buffer();\n" + " if (buffer != null)\n" + " {\n" + " %1$s.wrap(buffer);\n" + " %1$sOffset = value.offset();\n" + " %1$sLength = value.length();\n" + " }\n" + " return this;\n" + " }\n\n" + " public %3$s %1$s(final char[] value)\n" + " {\n" + " return %1$s(value, 0, value.length);\n" + " }\n\n" + " public %3$s %1$s(final char[] value, final int length)\n" + " {\n" + " return %1$s(value, 0, length);\n" + " }\n\n" + " public %3$s %1$s(final char[] value, final int offset, final int length)\n" + " {\n" + " toBytes(value, %1$s, offset, length);\n" + " %1$sOffset = 0;\n" + " %1$sLength = length;\n" + " return this;\n" + " }\n\n" + "%4$s", fieldName, generateBytesSetter(className, fieldName, name), className, enumSetter); }
Source:
<code>private AuthenticationResult acquireTokenSilentFlow(final AuthenticationRequest authenticationRequest) throws AuthenticationException { final AuthenticationResult authResult = tryAcquireTokenSilentLocally(authenticationRequest); if (isAccessTokenReturned(authResult)) { return authResult; } if (!canSwitchToBroker(authenticationRequest)) { return authResult; } Logger.d(TAG, "Cannot get AT from local cache, switch to Broker for auth, " <START> + "clear the local token cache for the user."); <END> removeTokensForUser(authenticationRequest); return tryAcquireTokenSilentWithBroker(authenticationRequest); }</code><technical_language>Please change "clear tokens local token cache for user"</technical_language>

Target:
private AuthenticationResult acquireTokenSilentFlow(final AuthenticationRequest authenticationRequest) throws AuthenticationException { final AuthenticationResult authResult = tryAcquireTokenSilentLocally(authenticationRequest); if (isAccessTokenReturned(authResult)) { return authResult; } if (!canSwitchToBroker(authenticationRequest)) { return authResult; } Logger.d(TAG, "Cannot get AT from local cache, switch to Broker for auth, " + "clear tokens from local cache for the user."); removeTokensForUser(authenticationRequest); return tryAcquireTokenSilentWithBroker(authenticationRequest); }
Source:
<code>private static boolean createSymlinkJava7(@Nonnull File baseDir, @Nonnull String targetPath, @Nonnull String symlinkPath) throws IOException { try { Path path = new File(baseDir, symlinkPath).toPath(); Path target = Paths.get(targetPath, new String[0]); Object noAttrs = Array.newInstance(Class.forName("java.nio.file.attribute.FileAttribute"), 0); final int maxNumberOfTries = 4; final int timeInMillis = 100; for (int tryNumber = 1; tryNumber <= maxNumberOfTries; tryNumber++) { Files.deleteIfExists(path); try { Files.createSymbolicLink(path, target); break; } catch (FileAlreadyExistsException fileAlreadyExistsException) { if (tryNumber < maxNumberOfTries) { TimeUnit.MILLISECONDS.sleep(timeInMillis); continue; } LOGGER.warning("symlink FileAlreadyExistsException thrown " + maxNumberOfTries + " times => cannot createSymbolicLink"); } } return true; } catch (UnsupportedOperationException e) { return true; } catch (FileSystemException e) { if (Functions.isWindows()) { warnWindowsSymlink(); return true; } return false; } catch (Exception x) { <START> throw (IOException) new IOException(x.toString()).initCause(x); <END> } }</code><technical_language>longer throwing exception - this a change in behaviour</technical_language>

Target:
private static boolean createSymlinkJava7(@Nonnull File baseDir, @Nonnull String targetPath, @Nonnull String symlinkPath) throws IOException { try { Path path = new File(baseDir, symlinkPath).toPath(); Path target = Paths.get(targetPath, new String[0]); final int maxNumberOfTries = 4; final int timeInMillis = 100; for (int tryNumber = 1; tryNumber <= maxNumberOfTries; tryNumber++) { Files.deleteIfExists(path); try { Files.createSymbolicLink(path, target); break; } catch (FileAlreadyExistsException fileAlreadyExistsException) { if (tryNumber < maxNumberOfTries) { TimeUnit.MILLISECONDS.sleep(timeInMillis); continue; } LOGGER.warning("symlink FileAlreadyExistsException thrown " + maxNumberOfTries + " times => cannot createSymbolicLink"); throw fileAlreadyExistsException; } } return true; } catch (UnsupportedOperationException e) { return true; } catch (FileSystemException e) { if (Functions.isWindows()) { warnWindowsSymlink(); return true; } return false; } catch (IOException x) { throw x; } catch (Exception x) { throw (IOException) new IOException(x.toString()).initCause(x); } }
Source:
<code><START> public StructArrayEncoder int32(String name, int value) { <END> int fieldIndex = fieldSearcher.findFieldIndex(name, Int32Field.class, null); currentData.add(new Int32DataHolder(value, fieldIndex)); return this; }</code><technical_language>Lots of duplicated code feels able eliminate</technical_language>

Target:
public StructArrayEncoder int32(String name, int value) { Int32Field field = fieldSearcher.findField(name, Int32Field.class, null); currentData.add(new Int32DataHolder(value, field.index())); return this; }
Source:
<code>public VM getVm() { VM vm = super.getVm(); if (vm != null) { return vm; } <START> vm = getVmDAO().get(getParameters().getVmId()); <END> if (vm != null) { setVm(vm); setVmId(vm.getId()); } return vm; }</code><technical_language>super.getVm() do dao call..</technical_language>

Target:
public VM getVm() { VM vm = super.getVm(); if (vm != null) { setVm(vm); } return vm; }
Source:
<code>public void ack(Object messageId) { if (!isAtLeastOnceProcessing()) { return; } final KafkaSpoutMessageId msgId = (KafkaSpoutMessageId) messageId; <START> if (!msgId.isNullTuple()) { <END> if (!emitted.contains(msgId)) { LOG.debug("Received ack for message [{}], associated with tuple emitted for a ConsumerRecord that " + "came from a topic-partition that this consumer group instance is no longer tracking " + "due to rebalance/partition reassignment. No action taken.", msgId); } else { Validate.isTrue(!retryService.isScheduled(msgId), "The message id " + msgId + " is queued for retry while being acked." + " This should never occur barring errors in the RetryService implementation or the spout code."); offsetManagers.get(msgId.getTopicPartition()).addToAckMsgs(msgId); emitted.remove(msgId); } } else { offsetManagers.get(msgId.getTopicPartition()).addToAckMsgs(msgId); LOG.debug("Received direct ack for message [{}], associated with null tuple", msgId); } tupleListener.onAck(msgId); }</code><technical_language>Nit: reduce nesting a bit switching this a guard clause, e.g. if (is null tuple) { ... return } if (emitted contains) { ... } else { ... } want change</technical_language>

Target:
public void ack(Object messageId) { if (!isAtLeastOnceProcessing()) { return; } final KafkaSpoutMessageId msgId = (KafkaSpoutMessageId) messageId; if (msgId.isNullTuple()) { offsetManagers.get(msgId.getTopicPartition()).addToAckMsgs(msgId); LOG.debug("Received direct ack for message [{}], associated with null tuple", msgId); tupleListener.onAck(msgId); return; } if (!emitted.contains(msgId)) { LOG.debug("Received ack for message [{}], associated with tuple emitted for a ConsumerRecord that " + "came from a topic-partition that this consumer group instance is no longer tracking " + "due to rebalance/partition reassignment. No action taken.", msgId); } else { Validate.isTrue(!retryService.isScheduled(msgId), "The message id " + msgId + " is queued for retry while being acked." + " This should never occur barring errors in the RetryService implementation or the spout code."); offsetManagers.get(msgId.getTopicPartition()).addToAckMsgs(msgId); emitted.remove(msgId); } tupleListener.onAck(msgId); }
Source:
<code>public Filter rewriteRequiredColumns(Map<String, String> columnRewrites) { if (columnRewrites.get(boundDimFilter.getDimension()) == null) { throw new IAE( "Received a non-applicable rewrite: %s, filter's dimension: %s", columnRewrites, boundDimFilter.getDimension() ); } BoundDimFilter newDimFilter = new BoundDimFilter( columnRewrites.get(boundDimFilter.getDimension()), boundDimFilter.getLower(), boundDimFilter.getUpper(), boundDimFilter.isLowerStrict(), boundDimFilter.isUpperStrict(), null, boundDimFilter.getExtractionFn(), boundDimFilter.getOrdering() ); <START> return new BoundFilter( <END> newDimFilter ); }</code><technical_language>note self: is overhead of creating a new object for filter</technical_language>

Target:
public Filter rewriteRequiredColumns(Map<String, String> columnRewrites) { String rewriteDimensionTo = columnRewrites.get(boundDimFilter.getDimension()); if (rewriteDimensionTo == null) { throw new IAE( "Received a non-applicable rewrite: %s, filter's dimension: %s", columnRewrites, boundDimFilter.getDimension() ); } BoundDimFilter newDimFilter = new BoundDimFilter( rewriteDimensionTo, boundDimFilter.getLower(), boundDimFilter.getUpper(), boundDimFilter.isLowerStrict(), boundDimFilter.isUpperStrict(), null, boundDimFilter.getExtractionFn(), boundDimFilter.getOrdering() ); return new BoundFilter( newDimFilter ); }
Source:
<code>static <T extends BaseProcessPayment> void serialize(JsonObject object, T value) { if (object == null) { throw new NullPointerException("object is null"); } if (value == null) { throw new NullPointerException("builder is null"); } object.addProperty(MEMBER_STATUS, value.status.code); <START> object.addProperty(MEMBER_ERROR, value.error.code); <END> object.addProperty(MEMBER_ACS_URI, value.acsUri); object.addProperty(MEMBER_INVOICE_ID, value.invoiceId); object.add(MEMBER_ACS_PARAMS, toJsonObject(value.acsParams)); object.addProperty(MEMBER_NEXT_RETRY, value.nextRetry); }</code><technical_language>NPE</technical_language>

Target:
static <T extends BaseProcessPayment> void serialize(JsonObject object, T value) { checkNotNull(object, "object"); checkNotNull(value, "value"); object.addProperty(MEMBER_STATUS, value.status.code); if (value.error != null) { object.addProperty(MEMBER_ERROR, value.error.code); } else { object.addProperty(MEMBER_ACS_URI, value.acsUri); object.addProperty(MEMBER_INVOICE_ID, value.invoiceId); object.add(MEMBER_ACS_PARAMS, toJsonObject(value.acsParams)); object.addProperty(MEMBER_NEXT_RETRY, value.nextRetry); } }
Source:
<code>public boolean isEnabled() { <START> return Boolean.FALSE.equals(isDisabled); <END> }</code><technical_language>!isDisabled()</technical_language>

Target:
public boolean isEnabled() { return !isDisabled(); }
Source:
<code>public SearchResults findPageForSearchQueryInAnyList(@NonNull String searchQuery) { SQLiteDatabase db = getReadableDatabase(); List<SearchResult> searchResults = new ArrayList<>(); String normalizedQuery = StringUtils.stripAccents(searchQuery).toLowerCase(Locale.getDefault()); String titleCol = ReadingListPageContract.Col.DISPLAY_TITLE.getName(); String selection = null; String[] selectionArgs = null; if (!TextUtils.isEmpty(normalizedQuery)) { normalizedQuery = normalizedQuery.replace("\\", "\\\\").replace("%", "\\%").replace("_", "\\_"); selection = "UPPER(" + titleCol + ") LIKE UPPER(?) ESCAPE '\\'"; selectionArgs = new String[]{"%" + normalizedQuery + "%"}; } try (Cursor cursor = db.query(ReadingListPageContract.TABLE, null, selection, selectionArgs, null, null, null)) { if (cursor.moveToFirst()) { ReadingListPage readingListPage = ReadingListPage.DATABASE_TABLE.fromCursor(cursor); <START> SearchResult searchResult = new SearchResult(new PageTitle(((ReadingListPage) readingListPage).title(), ((ReadingListPage) readingListPage).wiki(), ((ReadingListPage) readingListPage).thumbUrl())); <END> searchResult.setSearchResultTypeWithPriority(READING_LIST_SEARCH_RESULT); searchResults.add(searchResult); return new SearchResults(searchResults); } } return new SearchResults(); }</code><technical_language>Please remove redundant casting</technical_language>

Target:
public SearchResults findPageForSearchQueryInAnyList(@NonNull String searchQuery) { SQLiteDatabase db = getReadableDatabase(); List<SearchResult> searchResults = new ArrayList<>(); String normalizedQuery = StringUtils.stripAccents(searchQuery).toLowerCase(Locale.getDefault()); String titleCol = ReadingListPageContract.Col.DISPLAY_TITLE.getName(); String selection = null; String[] selectionArgs = null; if (!TextUtils.isEmpty(normalizedQuery)) { normalizedQuery = normalizedQuery.replace("\\", "\\\\").replace("%", "\\%").replace("_", "\\_"); selection = "UPPER(" + titleCol + ") LIKE UPPER(?) ESCAPE '\\'"; selectionArgs = new String[]{"%" + normalizedQuery + "%"}; } try (Cursor cursor = db.query(ReadingListPageContract.TABLE, null, selection, selectionArgs, null, null, null)) { if (cursor.moveToFirst()) { ReadingListPage readingListPage = ReadingListPage.DATABASE_TABLE.fromCursor(cursor); SearchResult searchResult = new SearchResult(READING_LIST_SEARCH_RESULT, new PageTitle(readingListPage.title(), readingListPage.wiki(), readingListPage.thumbUrl())); searchResults.add(searchResult); return new SearchResults(searchResults); } } return new SearchResults(); }
Source:
<code>public Object visit(ASTIfStatement node, Object data) { List<JavaNode> statementChildren = new ArrayList<>(); for (int i = 0; i < node.jjtGetNumChildren(); i++) { <START> if (node.jjtGetChild(i) instanceof ASTStatement) { <END> statementChildren.add((JavaNode) node.jjtGetChild(i)); } } int complexity = node.hasElse() ? 0 : 1; for (JavaNode element : statementChildren) { complexity += (Integer) element.jjtAccept(this, data); } int boolCompIf = CycloMetric.booleanExpressionComplexity(node.getFirstChildOfType(ASTExpression.class)); return boolCompIf + complexity; }</code><technical_language>work findChildrenOfType(ASTStatement.class) instead of checking type directly</technical_language>

Target:
public Object visit(ASTIfStatement node, Object data) { List<ASTStatement> statementChildren = node.findChildrenOfType(ASTStatement.class); int complexity = node.hasElse() ? 0 : 1; for (ASTStatement element : statementChildren) { complexity += (Integer) element.jjtAccept(this, data); } int boolCompIf = CycloMetric.booleanExpressionComplexity(node.getFirstChildOfType(ASTExpression.class)); return boolCompIf + complexity; }
Source:
<code>public void isCpuPinningValidWithoutPinnedHost() { VmManagementCommandBase<VmManagementParametersBase> test = spy(new VmManagementCommandBase<VmManagementParametersBase>(Guid.Empty)); VmStatic vmStatic = new VmStatic(); vmStatic.setNumOfSockets(6); vmStatic.setCpuPerSocket(2); vmStatic.setDedicatedVmForVds(null); Assert.assertFalse(test.isCpuPinningValid("0#0", vmStatic)); <START> Assert.assertFalse(test.getReturnValue().getCanDoActionMessages().isEmpty()); <END> Assert.assertFalse(test.getReturnValue() .getCanDoActionMessages() .contains(VdcBllMessages.ACTION_TYPE_FAILED_VM_CANNOT_BE_PINNED_TO_CPU_WITH_UNDEFINED_HOST)); }</code><technical_language>a bit redundunt check, consider checking for getSucceeded == false instead</technical_language>

Target:
public void isCpuPinningValidWithoutPinnedHost() { VmManagementCommandBase<VmManagementParametersBase> test = spy(new VmManagementCommandBase<VmManagementParametersBase>(Guid.Empty)); VmStatic vmStatic = new VmStatic(); vmStatic.setNumOfSockets(6); vmStatic.setCpuPerSocket(2); vmStatic.setDedicatedVmForVds(null); Assert.assertFalse(test.isCpuPinningValid("0#0", vmStatic)); Assert.assertFalse(test.getReturnValue() .getCanDoActionMessages() .contains(VdcBllMessages.ACTION_TYPE_FAILED_VM_CANNOT_BE_PINNED_TO_CPU_WITH_UNDEFINED_HOST)); }
Source:
<code>public int getResultSize() { <START> checkCacheAvailable(); <END> int accumulator; if (resultSize == null) { ClusteredQueryCommand command = ClusteredQueryCommand.getResultSize(queryDefinition, cache); ClusteredQueryInvoker invoker = new ClusteredQueryInvoker(cache, asyncExecutor); List<QueryResponse> responses = invoker.broadcast(command); accumulator = 0; for (QueryResponse response : responses) { accumulator += response.getResultSize(); } resultSize = accumulator; } else { accumulator = resultSize; } return accumulator; }</code><technical_language>I checkCacheAvailable() in superclass, in CacheQueryImpl.getResultSize()</technical_language>

Target:
public int getResultSize() { partitionHandlingSupport.checkCacheAvailable(); int accumulator; if (resultSize == null) { ClusteredQueryCommand command = ClusteredQueryCommand.getResultSize(queryDefinition, cache); ClusteredQueryInvoker invoker = new ClusteredQueryInvoker(cache, asyncExecutor); List<QueryResponse> responses = invoker.broadcast(command); accumulator = 0; for (QueryResponse response : responses) { accumulator += response.getResultSize(); } resultSize = accumulator; } else { accumulator = resultSize; } return accumulator; }
Source:
<code>public void metersExcluded() { <START> PrototypeMeasurementFilterSpecification.MeterFilterSpecification meterSpec <END> = new PrototypeMeasurementFilterSpecification.MeterFilterSpecification( Arrays.asList(valueSpecAyBx, valueSpecAzBy)); PrototypeMeasurementFilterSpecification spec = new PrototypeMeasurementFilterSpecification(); spec.getInclude().put( "counter.+", new PrototypeMeasurementFilterSpecification.MeterFilterSpecification()); spec.getExclude().put( "counterC", new PrototypeMeasurementFilterSpecification.MeterFilterSpecification()); PrototypeMeasurementFilter filter = new PrototypeMeasurementFilter(spec); Id idAYX = new TestId("counterA").withTag("tagA", "Y").withTag("tagB", "X"); Id idCYX = new TestId("counterC").withTag("tagA", "Y").withTag("tagB", "X"); Assert.assertTrue(filter.test(new Measurement(idAYX, 1, 1))); Assert.assertFalse(filter.test(new Measurement(idCYX, 2, 2))); }</code><technical_language>this is in spec below</technical_language>

Target:
public void metersExcluded() { PrototypeMeasurementFilterSpecification spec = new PrototypeMeasurementFilterSpecification(); spec.getInclude().put( "counter.+", new PrototypeMeasurementFilterSpecification.MeterFilterSpecification()); spec.getExclude().put( "counterC", new PrototypeMeasurementFilterSpecification.MeterFilterSpecification()); PrototypeMeasurementFilter filter = new PrototypeMeasurementFilter(spec); Id idAYX = new TestId("counterA").withTag("tagA", "Y").withTag("tagB", "X"); Id idCYX = new TestId("counterC").withTag("tagA", "Y").withTag("tagB", "X"); Assert.assertTrue(filter.test(new Measurement(idAYX, 1, 1))); Assert.assertFalse(filter.test(new Measurement(idCYX, 2, 2))); }
Source:
<code>boolean shouldUpdate(Player player) { if (!hasMoved) { hasMoved = true; return true; } Location currentLoc = player.getLocation(YAW_LOCATION); float currentYaw = currentLoc.getYaw(); <START> boolean hasRotated = Math.abs(currentYaw - this.initialYaw) < 90; <END> if (hasRotated && rotationCount < 2) { rotationCount++; return true; } double distance = currentLoc.distanceSquared(this.location); return distance > 50 * 50; }</code><technical_language>I Minecraft yaws need changed while loops put in right range. end bugs if this directly. Also, is this for small rotations? 90 is here. while(yaw < 180) yaw += 180; while(yaw > 180) yaw -= 180;</technical_language>

Target:
boolean shouldUpdate(Player player) { if (!hasMoved) { hasMoved = true; reset(player); return true; } Location currentLoc = player.getLocation(YAW_LOCATION); float currentYaw = currentLoc.getYaw(); if (rotationCount < 2) { float rotationDegrees = Setting.NPC_SKIN_ROTATION_UPDATE_DEGREES.asFloat(); boolean hasRotated = Math.abs(NMS.clampYaw(currentYaw - this.initialYaw)) < rotationDegrees; if (hasRotated) { rotationCount++; reset(player); return true; } } double distance = currentLoc.distanceSquared(this.location); if (distance > MOVEMENT_SKIN_UPDATE_DISTANCE) { reset(player); return true; } else { return false; } }
Source:
<code>public void getAllCodeSystems() { final String shortName = "newCodeSystemShortName"; final String oid = "newCodeSystemOid"; assertCodeSystemCreated(shortName, oid); <START> final CodeSystems codeSystems = CodeSystemRequests.prepareSearchCodeSystemsInAllRepositories() <END> .build() .execute(Services.context()); assertEquals(codeSystems.getTotal(), 2); }</code><technical_language>Rename prepareSearchCodeSystemsInAllRepositories() method prepareSearchAllCodeSystems()</technical_language>

Target:
public void getAllCodeSystems() { final String shortName = "newCodeSystemShortName"; final String oid = "newCodeSystemOid"; assertCodeSystemCreated(shortName, oid); final CodeSystems codeSystems = CodeSystemRequests.prepareSearchAllCodeSystems() .build() .execute(Services.context()); assertThat(codeSystems.getItems()).hasSizeGreaterThanOrEqualTo(2); }
Source:
<code>public void testGraphTypeHandling() throws Exception { Assert.assertNotNull(context); GraphService<FooModel> fooModelService = context.getService(FooModel.class); FooModel inMemoryModel = fooModelService.createInMemory(); inMemoryModel.setProp1("prop1"); inMemoryModel.setProp2("prop2"); inMemoryModel.setProp3("prop3"); Iterable<Vertex> vertices = context.getFramed().query() .has("type", Text.CONTAINS, FooModel.class.getAnnotation(TypeValue.class).value()) .vertices(); int numberFound = 0; for (Vertex v : vertices) { numberFound++; WindupVertexFrame framed = context.getFramed().frame(v, WindupVertexFrame.class); Assert.assertTrue(framed instanceof FooModel); } Assert.assertEquals(0, numberFound); <START> <END> InMemoryVertexFrame inMemoryFrame = (InMemoryVertexFrame) inMemoryModel; inMemoryFrame.attach(context.getFramed()); numberFound = 0; for (Vertex v : vertices) { numberFound++; FooModel framed = (FooModel) context.getFramed().frame(v, WindupVertexFrame.class); Assert.assertTrue(framed instanceof FooModel); Assert.assertEquals("prop1", framed.getProp1()); Assert.assertEquals("prop2", framed.getProp2()); Assert.assertEquals("prop3", framed.getProp3()); } Assert.assertEquals(1, numberFound); }</code><technical_language>0, is for cycle body? is a fail already. checking numberFound.size()</technical_language>

Target:
public void testGraphTypeHandling() throws Exception { Assert.assertNotNull(context); GraphService<FooModel> fooModelService = context.getService(FooModel.class); FooModel inMemoryModel = fooModelService.createInMemory(); inMemoryModel.setProp1("prop1"); inMemoryModel.setProp2("prop2"); inMemoryModel.setProp3("prop3"); Iterable<Vertex> vertices = context.getFramed().query() .has("type", Text.CONTAINS, FooModel.class.getAnnotation(TypeValue.class).value()) .vertices(); Assert.assertFalse(vertices.iterator().hasNext()); InMemoryVertexFrame inMemoryFrame = (InMemoryVertexFrame) inMemoryModel; inMemoryFrame.attach(context.getFramed()); int numberFound = 0; for (Vertex v : vertices) { numberFound++; FooModel framed = (FooModel) context.getFramed().frame(v, WindupVertexFrame.class); Assert.assertTrue(framed instanceof FooModel); Assert.assertEquals("prop1", framed.getProp1()); Assert.assertEquals("prop2", framed.getProp2()); Assert.assertEquals("prop3", framed.getProp3()); } Assert.assertEquals(1, numberFound); }
Source:
<code>private String selectIpv6Gateway(HostNetwork attachment) { boolean isIpv6DefaultRouteAttachment = attachment.isDefaultRoute() && attachment.getIpv6Gateway() != null; return isIpv6DefaultRouteAttachment ? attachment.getIpv6Gateway() : <START> IpAddressPredicate.UNSPECIFIED_IPV6; <END> }</code><technical_language>This is indication UNSPECIFIED_IPV6 in IpAddressPredicate , in NetworkUtils? I fight for this</technical_language>

Target:
private String selectIpv6Gateway(HostNetwork attachment) { boolean isIpv6DefaultRouteAttachment = attachment.isDefaultRoute() && attachment.getIpv6Gateway() != null; return isIpv6DefaultRouteAttachment ? attachment.getIpv6Gateway() : Ipv6UnspecifiedPredicate.UNSPECIFIED; }
Source:
<code>public static Text sanitizeForRichText(Text text) { if (text == null || text.getValue() == null) { return null; } <START> return new Text(Sanitizer.sanitizeForRichText(sanitizeTextField(text.getValue()))); <END> }</code><technical_language>I Sanitizer call is needed here</technical_language>

Target:
public static Text sanitizeForRichText(Text text) { if (text == null || text.getValue() == null) { return null; } return new Text(sanitizeForRichText(text.getValue())); }
Source:
<code>public void setVariable(String name, @Nullable Object value) { <START> if (name == null) <END> throw new IllegalArgumentException("name should not be null"); else super.setVariable(name, value); }</code><technical_language>Please add { follow Spring Security's code conventions</technical_language>

Target:
public void setVariable(String name, @Nullable Object value) { if ( name == null ) { throw new IllegalArgumentException("name should not be null"); } else { super.setVariable(name, value); } }
Source:
<code>public List<VDS> filter(List<VDS> hosts, VM vm, Map<String, String> parameters, PerHostMessages messages) { String requiredEmulatedMachine; List<VDS> hostsToRunOn = new ArrayList<VDS>(); if (StringUtils.isNotEmpty(vm.getEmulatedMachine())) { requiredEmulatedMachine = vm.getEmulatedMachine(); } else if (StringUtils.isNotEmpty(vm.getCustomEmulatedMachine())) { requiredEmulatedMachine = vm.getCustomEmulatedMachine(); } else { return hosts; } for (VDS host : hosts) { String supportedEmulatedMachines = host.getSupportedEmulatedMachines(); if(StringUtils.isNotEmpty(supportedEmulatedMachines)) { if (Arrays.asList(supportedEmulatedMachines.split(",")).contains(requiredEmulatedMachine)) { hostsToRunOn.add(host); log.debugFormat("Host {0} wasn't filtered out as it supports the VM required emulated machine ({1})", host.getName(), requiredEmulatedMachine); } else { <START> log.debugFormat("Host {0} was filtered out as it doesn't support the VM required emulated machine ({1})", <END> host.getName(), requiredEmulatedMachine); messages.addMessage(host.getId(), String.format("$vmEmulatedMachine %1$s", requiredEmulatedMachine)); messages.addMessage(host.getId(), VdcBllMessages.VAR__DETAIL__UNSUPPORTED_EMULATED_MACHINE.toString()); } } } return hostsToRunOn; }</code><technical_language>worth adding host values list</technical_language>

Target:
public List<VDS> filter(List<VDS> hosts, VM vm, Map<String, String> parameters, PerHostMessages messages) { String requiredEmulatedMachine; List<VDS> hostsToRunOn = new ArrayList<VDS>(); if (StringUtils.isNotEmpty(vm.getEmulatedMachine())) { requiredEmulatedMachine = vm.getEmulatedMachine(); } else if (StringUtils.isNotEmpty(vm.getCustomEmulatedMachine())) { requiredEmulatedMachine = vm.getCustomEmulatedMachine(); } else { return hosts; } for (VDS host : hosts) { String supportedEmulatedMachines = host.getSupportedEmulatedMachines(); if(StringUtils.isNotEmpty(supportedEmulatedMachines)) { if (Arrays.asList(supportedEmulatedMachines.split(",")).contains(requiredEmulatedMachine)) { hostsToRunOn.add(host); log.debugFormat("Host {0} wasn't filtered out as it supports the VM required emulated machine ({1})", host.getName(), requiredEmulatedMachine); } else { log.debugFormat("Host {0} was filtered out as it doesn't support the VM required emulated machine ({1}). Host supported emulated machines are: {2}.", host.getName(), requiredEmulatedMachine, supportedEmulatedMachines); messages.addMessage(host.getId(), String.format("$vmEmulatedMachine %1$s", requiredEmulatedMachine)); messages.addMessage(host.getId(), String.format("$hostEmulatedMachines %1$s", supportedEmulatedMachines)); messages.addMessage(host.getId(), VdcBllMessages.VAR__DETAIL__UNSUPPORTED_EMULATED_MACHINE.toString()); } } } return hostsToRunOn; }
Source:
<code>public void orTest() throws Exception { OrClauseInTrigger clause = new OrClauseInTrigger( new EqualsClauseInTrigger("alias", "f1", "a"), <START> new EqualsClauseInTrigger("alias", "f2", 1)); <END> Parcel parcel = Parcel.obtain(); clause.writeToParcel(parcel, 0); parcel.setDataPosition(0); OrClauseInTrigger deserializedClause = OrClauseInTrigger.CREATOR.createFromParcel(parcel); Assert.assertTrue(Arrays.equals( clause.getClauses().toArray(), deserializedClause.getClauses().toArray())); }</code><technical_language>Adding types of clauses is more fine:)</technical_language>

Target:
public void orTest() throws Exception { OrClauseInTrigger clause = new OrClauseInTrigger( new EqualsClauseInTrigger("alias", "f1", "a"), new NotEqualsClauseInTrigger( new EqualsClauseInTrigger("alias", "f2", 1)), RangeClauseInTrigger.greaterThan("alias", "f3", 23), RangeClauseInTrigger.lessThan("alias", "f3", 230), RangeClauseInTrigger.range("alias", "f4", 11, true, 23, false)); Parcel parcel = Parcel.obtain(); clause.writeToParcel(parcel, 0); parcel.setDataPosition(0); OrClauseInTrigger deserializedClause = OrClauseInTrigger.CREATOR.createFromParcel(parcel); Assert.assertTrue(Arrays.equals( clause.getClauses().toArray(), deserializedClause.getClauses().toArray())); }
Source:
<code>int readNoFilter(int[] positions, int positionCount) throws IOException { int streamPosition = 0; for (int i = 0; i < positionCount; i++) { int position = positions[i]; if (position > streamPosition) { skip(position - streamPosition); streamPosition = position; } if (presentStream != null && !presentStream.nextBit()) { if ((nonDeterministicFilter && filter.testNull()) || nullsAllowed) { if (outputRequired) { nulls[outputPositionCount] = true; } outputPositionCount++; } } else { Slice decimal = UnscaledDecimal128Arithmetic.unscaledDecimal(); Slice rescaledDecimal = UnscaledDecimal128Arithmetic.unscaledDecimal(); int scale = (int) scaleStream.next(); dataStream.nextLongDecimal(decimal); rescale(decimal, decimalType.getScale() - scale, rescaledDecimal); <START> if (outputRequired) { <END> values[2 * outputPositionCount] = rescaledDecimal.getLong(0); values[2 * outputPositionCount + 1] = rescaledDecimal.getLong(Long.BYTES); } if (nullsAllowed && presentStream != null) { nulls[outputPositionCount] = false; } outputPositionCount++; } outputPositions = positions; streamPosition++; } return streamPosition; }</code><technical_language>outputRequires is true (since is filter); remove this if</technical_language>

Target:
protected int readNoFilter(int[] positions, int positionCount) throws IOException { Slice decimal = UnscaledDecimal128Arithmetic.unscaledDecimal(); Slice rescaledDecimal = UnscaledDecimal128Arithmetic.unscaledDecimal(); int streamPosition = 0; for (int i = 0; i < positionCount; i++) { int position = positions[i]; if (position > streamPosition) { skip(position - streamPosition); streamPosition = position; } if (presentStream != null && !presentStream.nextBit()) { nulls[i] = true; } else { int scale = (int) scaleStream.next(); dataStream.nextLongDecimal(decimal); rescale(decimal, this.scale - scale, rescaledDecimal); values[2 * i] = UnsafeSlice.getLongUnchecked(rescaledDecimal, 0); values[2 * i + 1] = UnsafeSlice.getLongUnchecked(rescaledDecimal, Long.BYTES); if (presentStream != null) { nulls[i] = false; } } streamPosition++; } outputPositionCount = positionCount; return streamPosition; }
Source:
<code>private void createTrackers( final BundleContext context ) { <START> serviceTracker = new ServiceTracker( context, Provider.class, new ProviderServiceTracker( context, locator ) ); <END> serviceTracker.open( true ); bundleTracker = new BundleTracker( context, Bundle.ACTIVE, new ModuleBundleTracker(locator) ); bundleTracker.open(); }</code><technical_language>Provider.class is general, end returning providers of other types. Simplest solution (if want pull in injectors registered other sources) is track Injector.class - create interface extends Provider<Injector> other people use</technical_language>

Target:
private void createTrackers( final BundleContext context ) { serviceTracker = new ServiceTracker( context, Provider.class, new InjectorServiceTracker( context, locator ) ); serviceTracker.open( true ); bundleTracker = new BundleTracker( context, Bundle.ACTIVE, new ModuleBundleTracker( locator ) ); bundleTracker.open(); }
Source:
<code>protected ServiceBusClientBuilder getBuilder(boolean useCredentials) { final ServiceBusClientBuilder builder = new ServiceBusClientBuilder() .proxyOptions(ProxyOptions.SYSTEM_DEFAULTS) .retryOptions(RETRY_OPTIONS) .transportType(AmqpTransportType.AMQP) .scheduler(scheduler); logger.info("Getting Builder using credentials : ", useCredentials); if (useCredentials) { final String fullyQualifiedDomainName = getFullyQualifiedDomainName(); assumeTrue(fullyQualifiedDomainName != null && !fullyQualifiedDomainName.isEmpty(), "AZURE_SERVICEBUS_FULLY_QUALIFIED_DOMAIN_NAME variable needs to be set when using credentials."); String clientId = System.getenv("AZURE_CLIENT_ID"); <START> String domainName = System.getenv("AZURE_SERVICEBUS_FULLY_QUALIFIED_DOMAIN_NAME"); <END> String clientSecret = System.getenv("AZURE_CLIENT_SECRET"); String tenantId = System.getenv("AZURE_TENANT_ID"); if (domainName != null ) { logger.info("Getting Builder using credentials with domainName.length : ", domainName.length()); } else { logger.error("Getting Builder using credentials domainName is null."); } if (clientId != null ) { logger.info("Getting Builder using credentials with clientId.length : ", clientId.length()); } else { logger.error("Getting Builder using credentials clientId is null."); } if (clientSecret != null ) { logger.info("Getting Builder using credentials with clientSecret.length :[{}]", clientSecret.length()); } else { logger.error("Getting Builder using credentials clientSecret is null."); } if (tenantId != null ) { logger.info("Getting Builder using credentials with tenantId.length : [{}]", tenantId.length()); } else { logger.error("Getting Builder using credentials tenantId is null."); } final ClientSecretCredential clientSecretCredential = new ClientSecretCredentialBuilder() .clientId(System.getenv("AZURE_CLIENT_ID")) .clientSecret(System.getenv("AZURE_CLIENT_SECRET")) .tenantId(System.getenv("AZURE_TENANT_ID")) .build(); return builder.credential(fullyQualifiedDomainName, clientSecretCredential); } else { return builder.connectionString(getConnectionString()); } }</code><technical_language>This is fetched if line 233</technical_language>

Target:
protected ServiceBusClientBuilder getBuilder(boolean useCredentials) { final ServiceBusClientBuilder builder = new ServiceBusClientBuilder() .proxyOptions(ProxyOptions.SYSTEM_DEFAULTS) .retryOptions(RETRY_OPTIONS) .transportType(AmqpTransportType.AMQP) .scheduler(scheduler); logger.info("Getting Builder using credentials : ", useCredentials); if (useCredentials) { final String fullyQualifiedDomainName = getFullyQualifiedDomainName(); assumeTrue(fullyQualifiedDomainName != null && !fullyQualifiedDomainName.isEmpty(), "AZURE_SERVICEBUS_FULLY_QUALIFIED_DOMAIN_NAME variable needs to be set when using credentials."); final ClientSecretCredential clientSecretCredential = new ClientSecretCredentialBuilder() .clientId(System.getenv("AZURE_CLIENT_ID")) .clientSecret(System.getenv("AZURE_CLIENT_SECRET")) .tenantId(System.getenv("AZURE_TENANT_ID")) .build(); return builder.credential(fullyQualifiedDomainName, clientSecretCredential); } else { return builder.connectionString(getConnectionString()); } }
Source:
<code><START> private <T> void validateAndAssertResult(List<VdsNetworkInterface> listOfInterfaces, boolean isValid) { <END> NoRepetitiveStaticIpInListContainer container = new NoRepetitiveStaticIpInListContainer(listOfInterfaces); Set<ConstraintViolation<NoRepetitiveStaticIpInListContainer>> validate = validator.validate(container); Assert.assertEquals(isValid, validate.isEmpty()); }</code><technical_language><T> is needed</technical_language>

Target:
private void validateAndAssertResult(List<VdsNetworkInterface> listOfInterfaces, boolean isValid) { NoRepetitiveStaticIpInListContainer container = new NoRepetitiveStaticIpInListContainer(listOfInterfaces); Set<ConstraintViolation<NoRepetitiveStaticIpInListContainer>> validate = validator.validate(container); Assert.assertEquals(isValid, validate.isEmpty()); }