auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void tarDirectory(Path outputFile, Path inputDirectory, List<String> pathPrefixesToExclude) throws IOException { System.out.println("Creating archive at: " + outputFile); boolean fullTarArchive = Boolean.valueOf(System.getenv(FULL_TAR_ARCHIVE)); if (fullTarArchive) System.out.println("Required full archive creation"); Collection<String> collectionPathPrefixesToExclude = CollectionUtils.emptyIfNull(pathPrefixesToExclude); FileOutputStream dest = new FileOutputStream(outputFile.toFile()); final Path outputFileAbsolute = outputFile.normalize().toAbsolutePath(); final Path inputDirectoryAbsolute = inputDirectory.normalize().toAbsolutePath(); final int inputPathLength = inputDirectoryAbsolute.toString().length(); try (TarOutputStream out = new TarOutputStream(new BufferedOutputStream(dest))) { Files.walk(inputDirectoryAbsolute).forEach(entry -> { if (Files.isDirectory(entry)) return; if (entry.equals(outputFileAbsolute)) return; try { String relativeName = entry.toString().substring(inputPathLength + 1); if (!fullTarArchive && collectionPathPrefixesToExclude.stream().anyMatch(pathPrefixToExclude -> relativeName.startsWith(pathPrefixToExclude))) return; out.putNextEntry(new TarEntry(entry.toFile(), relativeName)); BufferedInputStream origin = new BufferedInputStream(new FileInputStream(entry.toFile())); int count; byte data[] = new byte[2048]; while ((count = origin.read(data)) != -1) { out.write(data, 0, count); } out.flush(); origin.close(); } catch (IOException e) { System.err.println("Failed to add tar entry due to: " + e.getMessage()); e.printStackTrace(); } }); } }

Target:
public static void tarDirectory(Path outputFile, Path inputDirectory, List<String> pathPrefixesToExclude) throws IOException { LOG.info("Creating archive at: " + outputFile); Collection<String> collectionPathPrefixesToExclude = CollectionUtils.emptyIfNull(pathPrefixesToExclude); FileOutputStream dest = new FileOutputStream(outputFile.toFile()); final Path outputFileAbsolute = outputFile.normalize().toAbsolutePath(); final Path inputDirectoryAbsolute = inputDirectory.normalize().toAbsolutePath(); final int inputPathLength = inputDirectoryAbsolute.toString().length(); try (TarOutputStream out = new TarOutputStream(new BufferedOutputStream(dest))) { Files.walk(inputDirectoryAbsolute).forEach(entry -> { if (Files.isDirectory(entry)) return; if (entry.equals(outputFileAbsolute)) return; try { String relativeName = entry.toString().substring(inputPathLength + 1); if (collectionPathPrefixesToExclude.stream().anyMatch(pathPrefixToExclude -> relativeName.startsWith(pathPrefixToExclude))) return; out.putNextEntry(new TarEntry(entry.toFile(), relativeName)); BufferedInputStream origin = new BufferedInputStream(new FileInputStream(entry.toFile())); int count; byte data[] = new byte[2048]; while ((count = origin.read(data)) != -1) { out.write(data, 0, count); } out.flush(); origin.close(); } catch (IOException e) { LOG.severe("Failed to add tar entry due to: " + e.getMessage()); e.printStackTrace(); } }); } }
Source:
public String digestParams(RestInvocation restInvocation) { String queryString = ""; Iterator it; if (restInvocation.getParamsMap().get(QueryParam.class) != null && !restInvocation.getParamsMap().get(QueryParam.class).isEmpty()) { queryString = String.valueOf(restInvocation.getParamsMap().get(QueryParam.class)); } else if (restInvocation.getRequestBody() != null && !restInvocation.getRequestBody().isEmpty()) { ObjectMapper mapper = new ObjectMapper(); try { Map<String, String> map = mapper.readValue(restInvocation.getRequestBody(), Map.class); it = map.keySet().iterator(); while (it.hasNext()) { String key = (String) it.next(); String value = map.get(key); queryString += "&" + key + "=" + value; } queryString = queryString.substring(1); } catch (IOException e) { e.printStackTrace(); } } Algorithm algorithm = null; String jwtToken = null; algorithm = Algorithm.HMAC256(secretKey); JWTCreator.Builder builder = JWT.create(); if (queryString.length() > 0) { builder .withClaim("access_key", accessKey) .withClaim("nonce", String.valueOf(new Date().getTime())) .withClaim("query", queryString); } else { builder .withClaim("access_key", accessKey) .withClaim("nonce", String.valueOf(new Date().getTime())); } jwtToken = builder.sign(algorithm); return "Bearer " + jwtToken; }

Target:
public String digestParams(RestInvocation restInvocation) { String queryString = ""; if (restInvocation.getParamsMap().get(QueryParam.class) != null && !restInvocation.getParamsMap().get(QueryParam.class).isEmpty()) { queryString = String.valueOf(restInvocation.getParamsMap().get(QueryParam.class)); } else if (restInvocation.getRequestBody() != null && !restInvocation.getRequestBody().isEmpty()) { try { ObjectMapper mapper = new ObjectMapper(); Map<String, String> map = mapper.readValue(restInvocation.getRequestBody(), Map.class); Iterator it = map.keySet().iterator(); while (it.hasNext()) { String key = (String) it.next(); String value = map.get(key); queryString += "&" + key + "=" + value; } queryString = queryString.substring(1); } catch (IOException e) { throw new IllegalStateException(e); } } Algorithm algorithm = Algorithm.HMAC256(secretKey); JWTCreator.Builder builder = JWT.create(); builder.withClaim("access_key", accessKey).withClaim("nonce", String.valueOf(new Date().getTime())); if (queryString.length() > 0) builder.withClaim("query", queryString); String jwtToken = builder.sign(algorithm); return "Bearer " + jwtToken; }
Source:
private static void checkAllProperty(SubscriptionContext ctx, AssignmentStatement assignmentStatement) { Expression assignedValue = assignmentStatement.assignedValue(); if (!assignedValue.is(Tree.Kind.LIST_LITERAL) && !assignedValue.is(Tree.Kind.TUPLE)) { return; } List<Tree> stringExpressions = getStringExpressions(assignedValue); FileInput fileInput = (FileInput) TreeUtils.firstAncestorOfKind(assignedValue, Tree.Kind.FILE_INPUT); if (fileInput == null) { return; } UnresolvedWildcardImportVisitor unresolvedWildcardImportVisitor = new UnresolvedWildcardImportVisitor(); fileInput.accept(unresolvedWildcardImportVisitor); if (unresolvedWildcardImportVisitor.hasUnresolvedWildcardImport) { return; } Map<String, Symbol> symbolsByName = fileInput.globalVariables().stream().collect(Collectors.toMap(Symbol::name, Function.identity())); for (Tree stringExpression : stringExpressions) { StringLiteral stringLiteral = retrieveStringLiteral(stringExpression); if (isUnknownSymbol(ctx.pythonFile(), symbolsByName, stringLiteral)) { PreciseIssue issue = ctx.addIssue(stringExpression, String.format("Change or remove this string; \"%s\" is not defined.", stringLiteral.trimmedQuotesValue())); if (stringExpression != stringLiteral) { issue.secondary(stringLiteral, null); } } } }

Target:
private static void checkAllProperty(SubscriptionContext ctx, AssignmentStatement assignmentStatement) { Expression assignedValue = assignmentStatement.assignedValue(); if (!assignedValue.is(Tree.Kind.LIST_LITERAL, Tree.Kind.TUPLE)) { return; } List<Tree> stringExpressions = getStringExpressions(assignedValue); FileInput fileInput = (FileInput) TreeUtils.firstAncestorOfKind(assignedValue, Tree.Kind.FILE_INPUT); if (fileInput == null) { return; } UnresolvedWildcardImportVisitor unresolvedWildcardImportVisitor = new UnresolvedWildcardImportVisitor(); fileInput.accept(unresolvedWildcardImportVisitor); if (unresolvedWildcardImportVisitor.hasUnresolvedWildcardImport) { return; } Map<String, Symbol> symbolsByName = fileInput.globalVariables().stream().collect(Collectors.toMap(Symbol::name, Function.identity())); for (Tree stringExpression : stringExpressions) { StringLiteral stringLiteral = retrieveStringLiteral(stringExpression); if (isUnknownSymbol(ctx.pythonFile(), symbolsByName, stringLiteral)) { PreciseIssue issue = ctx.addIssue(stringExpression, String.format("Change or remove this string; \"%s\" is not defined.", stringLiteral.trimmedQuotesValue())); if (stringExpression != stringLiteral) { issue.secondary(stringLiteral, null); } } } }
Source:
public ElasticsearchContainer(String dockerImageName) { super(dockerImageName); logger().info("Starting an elasticsearch container using [{}]", dockerImageName); withNetwork(Network.SHARED); withNetworkAliases("elasticsearch-" + Base58.randomString(6)); withEnv("discovery.type", "single-node"); addExposedPorts(ELASTICSEARCH_DEFAULT_PORT, ELASTICSEARCH_DEFAULT_TCP_PORT); setWaitStrategy(new HttpWaitStrategy() .forPort(ELASTICSEARCH_DEFAULT_PORT) .forStatusCodeMatching(response -> response == HTTP_OK || response == HTTP_UNAUTHORIZED) .withStartupTimeout(Duration.ofMinutes(2))); }

Target:
public ElasticsearchContainer(String dockerImageName) { super(dockerImageName); logger().info("Starting an elasticsearch container using [{}]", dockerImageName); withNetworkAliases("elasticsearch-" + Base58.randomString(6)); withEnv("discovery.type", "single-node"); addExposedPorts(ELASTICSEARCH_DEFAULT_PORT, ELASTICSEARCH_DEFAULT_TCP_PORT); setWaitStrategy(new HttpWaitStrategy() .forPort(ELASTICSEARCH_DEFAULT_PORT) .forStatusCodeMatching(response -> response == HTTP_OK || response == HTTP_UNAUTHORIZED) .withStartupTimeout(Duration.ofMinutes(2))); }
Source:
public void setUp() { try { ObjectMapper mapper = (new NakadiConfig()).jacksonObjectMapper(); datasource = new DriverManagerDataSource(postgresqlUrl, username, password); template = new JdbcTemplate(datasource); repository = new EventTypeDbRepository(template, mapper); connection = datasource.getConnection(); template.execute("DELETE FROM zsr_data.event_type"); } catch (SQLException e) { e.printStackTrace(); } }

Target:
public void setUp() { try { ObjectMapper mapper = (new NakadiConfig()).jacksonObjectMapper(); datasource = new DriverManagerDataSource(postgresqlUrl, username, password); template = new JdbcTemplate(datasource); repository = new EventTypeDbRepository(template, mapper); connection = datasource.getConnection(); template.execute("DELETE FROM zn_data.event_type"); } catch (SQLException e) { e.printStackTrace(); } }
Source:
public void init() throws ServletException { String capsParam = getServletContext().getInitParameter(CAPABILITIES_PARAMETER); if (capsParam != null) { for (String nego : capsParam.trim().split(" *\\| *")) { try { caps |= Authn.Capabilities.class.getField(nego).getLong(null); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException ex) { log.error("Error calculating authn capabilities while accessing constant {}", nego); } } } final AuthenticationProfileRepository repo = (AuthenticationProfileRepository) getServletContext().getAttribute(SSOUtils.AUTH_PROFILE_REPOSITORY); repo.addObserver( new Observer() { @Override public void update(Observable o, Object arg) { cacheNegotiatingProfiles(repo); } } ); cacheNegotiatingProfiles(repo); }

Target:
public void init() throws ServletException { try { caps |= Authn.Capabilities.class.getField(AUTHENTICATE_NEGOTIATE_INTERACTIVE).getLong(null); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException ex) { log.error("Error calculating authn capabilities while accessing constant {}", AUTHENTICATE_NEGOTIATE_INTERACTIVE); } final AuthenticationProfileRepository repo = (AuthenticationProfileRepository) getServletContext().getAttribute(SSOUtils.AUTH_PROFILE_REPOSITORY); repo.addObserver( new Observer() { @Override public void update(Observable o, Object arg) { cacheNegotiatingProfiles(repo); } } ); cacheNegotiatingProfiles(repo); }
Source:
void generatePassword() { newPasswordPlainText = uuidGenerator.generateUuid(); newPasswordEncrypted = encryptionService.encrypt(newPasswordPlainText); newPasswordWrappedEncrypted = String.format(ENC_TEMPLATE, newPasswordEncrypted); }

Target:
void generatePassword() { newPasswordPlainText = uuidGenerator.generateUuid(); newPasswordWrappedEncrypted = encryptionService.encryptValue(newPasswordPlainText); }
Source:
private void addInitialMembers() { List<ChatRoomMember> chatRoomMembers = getCurrentChatRoomMembers(); List<ConferenceMember> confMembers = getCurrentConferenceMembers(); if(chatRoomMembers == null || confMembers == null) { logger.warn("Cannot add initial members to transcription" ); return; } for(ChatRoomMember chatRoomMember : chatRoomMembers) { ChatRoomMemberJabberImpl chatRoomMemberJabber; if(chatRoomMember instanceof ChatRoomMemberJabberImpl) { chatRoomMemberJabber = (ChatRoomMemberJabberImpl) chatRoomMember; } else { logger.warn("Could not cast a ChatRoomMember to " + "ChatRoomMemberJabberImpl"); continue; } String identifier = getParticipantIdentifier(chatRoomMemberJabber); if("focus".equals(identifier)) { continue; } if(chatRoomMemberJabber.getJabberID().getResourceOrNull() == null) { continue; } this.transcriber.maybeAddParticipant(identifier); this.transcriber.updateParticipant(identifier, chatRoomMember); this.transcriber.participantJoined(identifier); } for(ConferenceMember confMember : confMembers) { if("jvb".equals(confMember.getAddress())) { continue; } String identifier = getParticipantIdentifier(confMember); this.transcriber.maybeAddParticipant(identifier); this.transcriber.updateParticipant(identifier, confMember); } }

Target:
private void addInitialMembers() { List<ConferenceMember> confMembers = getCurrentConferenceMembers(); if(confMembers == null) { logger.warn("Cannot add initial ConferenceMembers to " + "transcription"); } else { for(ConferenceMember confMember : confMembers) { if("jvb".equals(confMember.getAddress())) { continue; } String identifier = getParticipantIdentifier(confMember); this.transcriber.updateParticipant(identifier, confMember); } } List<ChatRoomMember> chatRoomMembers = getCurrentChatRoomMembers(); if(chatRoomMembers == null) { logger.warn("Cannot add initial ChatRoomMembers to transcription"); return; } for (ChatRoomMember chatRoomMember : chatRoomMembers) { ChatRoomMemberJabberImpl chatRoomMemberJabber; if (chatRoomMember instanceof ChatRoomMemberJabberImpl) { chatRoomMemberJabber = (ChatRoomMemberJabberImpl) chatRoomMember; } else { logger.warn("Could not cast a ChatRoomMember to " + "ChatRoomMemberJabberImpl"); continue; } String identifier = getParticipantIdentifier(chatRoomMemberJabber); if ("focus".equals(identifier)) { continue; } if (chatRoomMemberJabber.getJabberID().getResourceOrNull() == null) { continue; } this.transcriber.updateParticipant(identifier, chatRoomMember); this.transcriber.participantJoined(identifier); } }
Source:
public static boolean isDBFalse(final String value) { String x = getDBType(); if (MYSQL.equals(x)) { return value.trim().equals("0") || value.trim().equals("false"); } else if (POSTGRESQL.equals(x) || H2.equals(x)) { return value.trim().equals("f") || value.trim().equals("false"); } else if (MSSQL.equals(x)) { return value.trim().equals("0"); } else if (ORACLE.equals(x)) { return value.trim().equals("0"); } return false; }

Target:
public static boolean isDBFalse(final String value) { String x = getDBType(); if (MYSQL.equals(x)) { return "0".equals(value.trim()) || "false".equals(value.trim()); } else if (POSTGRESQL.equals(x) || H2.equals(x)) { return "f".equals(value.trim()) || "false".equals(value.trim()); } else if (MSSQL.equals(x)) { return "0".equals(value.trim()); } else if (ORACLE.equals(x)) { return "0".equals(value.trim()); } return false; }
Source:
private BlobServiceClient buildBlobServiceClient(String accountName, Map<String,?> config) { String scheme = !config.containsKey(AZURE_STORAGE_USE_HTTPS) || (Boolean) config.get(AZURE_STORAGE_USE_HTTPS) ? "https" : "http"; BlobServiceClientBuilder builder = new BlobServiceClientBuilder() .endpoint(String.format(AZURE_STORAGE_ENDPOINT_TEMPLATE, scheme, accountName)); if (config.containsKey(AZURE_STORAGE_ACCOUNT_KEY)) { builder.credential(new StorageSharedKeyCredential(accountName, (String)config.get(AZURE_STORAGE_ACCOUNT_KEY))); } else if (config.containsKey(AZURE_STORAGE_SAS_TOKEN)) { builder.sasToken((String) config.get(AZURE_STORAGE_SAS_TOKEN)); } else { throw new IllegalArgumentException(String.format("No credentials were provided. Please specify one of the" + " following when constructing an AzureFileSystem: %s, %s.", AZURE_STORAGE_ACCOUNT_KEY, AZURE_STORAGE_SAS_TOKEN)); } builder.httpLogOptions(new HttpLogOptions() .setLogLevel((HttpLogDetailLevel)config.get(AZURE_STORAGE_HTTP_LOG_DETAIL_LEVEL))); RequestRetryOptions retryOptions = new RequestRetryOptions( (RetryPolicyType)config.get(AZURE_STORAGE_RETRY_POLICY_TYPE), (Integer)config.get(AZURE_STORAGE_MAX_TRIES), (Integer)config.get(AZURE_STORAGE_TRY_TIMEOUT), (Long)config.get(AZURE_STORAGE_RETRY_DELAY_IN_MS), (Long)config.get(AZURE_STORAGE_MAX_RETRY_DELAY_IN_MS), (String)config.get(AZURE_STORAGE_SECONDARY_HOST)); builder.retryOptions(retryOptions); builder.httpClient((HttpClient)config.get(AZURE_STORAGE_HTTP_CLIENT)); return builder.buildClient(); }

Target:
private BlobServiceClient buildBlobServiceClient(String accountName, Map<String,?> config) { String scheme = !config.containsKey(AZURE_STORAGE_USE_HTTPS) || (Boolean) config.get(AZURE_STORAGE_USE_HTTPS) ? "https" : "http"; BlobServiceClientBuilder builder = new BlobServiceClientBuilder() .endpoint(String.format(AZURE_STORAGE_BLOB_ENDPOINT_TEMPLATE, scheme, accountName)); if (config.containsKey(AZURE_STORAGE_ACCOUNT_KEY)) { builder.credential(new StorageSharedKeyCredential(accountName, (String)config.get(AZURE_STORAGE_ACCOUNT_KEY))); } else if (config.containsKey(AZURE_STORAGE_SAS_TOKEN)) { builder.sasToken((String) config.get(AZURE_STORAGE_SAS_TOKEN)); } else { throw Utility.logError(logger, new IllegalArgumentException(String.format("No credentials were provided. " + "Please specify one of the following when constructing an AzureFileSystem: %s, %s.", AZURE_STORAGE_ACCOUNT_KEY, AZURE_STORAGE_SAS_TOKEN))); } builder.httpLogOptions(BlobServiceClientBuilder.getDefaultHttpLogOptions() .setLogLevel((HttpLogDetailLevel)config.get(AZURE_STORAGE_HTTP_LOG_DETAIL_LEVEL))); RequestRetryOptions retryOptions = new RequestRetryOptions( (RetryPolicyType)config.get(AZURE_STORAGE_RETRY_POLICY_TYPE), (Integer)config.get(AZURE_STORAGE_MAX_TRIES), (Integer)config.get(AZURE_STORAGE_TRY_TIMEOUT), (Long)config.get(AZURE_STORAGE_RETRY_DELAY_IN_MS), (Long)config.get(AZURE_STORAGE_MAX_RETRY_DELAY_IN_MS), (String)config.get(AZURE_STORAGE_SECONDARY_HOST)); builder.retryOptions(retryOptions); builder.httpClient((HttpClient)config.get(AZURE_STORAGE_HTTP_CLIENT)); return builder.buildClient(); }
Source:
public void testParseXmlGetCapabilitiesNoRootLayerTrue() throws Exception { CapabilitiesXmlReader reader = new CapabilitiesXmlReader(EntityResolverProvider.RESOLVE_DISABLED_PROVIDER); String plainRequest = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<ogc:GetCapabilities xmlns:ogc=\"<LINK_1>\" " + " xmlns:gml=\"<LINK_0>\" " + " version=\"1.2.0\" updateSequence=\"1\" " + " noRootLayer=\"true\" " + " service=\"WMS\"> " + "</ogc:GetCapabilities>"; Reader input = new StringReader(plainRequest); Object read = reader.read(null, input, null); assertTrue(read instanceof GetCapabilitiesRequest); GetCapabilitiesRequest request = (GetCapabilitiesRequest) read; assertEquals("GetCapabilities", request.getRequest()); assertEquals("1.2.0", request.getVersion()); assertEquals("1", request.getUpdateSequence()); assertTrue(request.isNoRootLayer()); }

Target:
public void testParseXmlGetCapabilitiesNoRootLayerTrue() throws Exception { CapabilitiesXmlReader reader = new CapabilitiesXmlReader(EntityResolverProvider.RESOLVE_DISABLED_PROVIDER); String plainRequest = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<ogc:GetCapabilities xmlns:ogc=\"<LINK_1>\" " + " xmlns:gml=\"<LINK_0>\" " + " version=\"1.2.0\" updateSequence=\"1\" " + " rootLayer=\"true\" " + " service=\"WMS\"> " + "</ogc:GetCapabilities>"; Reader input = new StringReader(plainRequest); Object read = reader.read(null, input, null); assertTrue(read instanceof GetCapabilitiesRequest); GetCapabilitiesRequest request = (GetCapabilitiesRequest) read; assertEquals("GetCapabilities", request.getRequest()); assertEquals("1.2.0", request.getVersion()); assertEquals("1", request.getUpdateSequence()); assertTrue(request.isRootLayerEnabled()); }
Source:
private boolean breakUpChapter(CharSequence text, String currentChapterStr) { boolean successOverall = true; boolean success = true; String cleanedString = text.toString().replaceAll("\r\n","\n"); if (!isMissing(currentChapterStr)) { try { String chapter = getChapterFolderName(currentChapterStr); if (null == chapter) { addError(R.string.could_not_find_chapter, currentChapterStr); return false; } List<String> versebreaks = getVerseBreaks(chapter); int currentChapter = Integer.valueOf(chapter); updateStatus(R.string.processing_chapter, new Integer(mChaperCount - currentChapter + 1).toString()); String lastFirst = null; for (int i = 0; (i < versebreaks.size()) && success; i++) { String first = versebreaks.get(i); success = extractVerses(chapter, cleanedString, lastFirst, first); successOverall = successOverall && success; lastFirst = first; } if (successOverall) { success = extractVerses(chapter, cleanedString, lastFirst, END_MARKER +""); successOverall = successOverall && success; } } catch (Exception e) { Logger.e(TAG, "error parsing chapter " + currentChapterStr, e); addError(R.string.could_not_parse_chapter, currentChapterStr); return false; } } else { String strippedUsfmFrontTags = removeKnownUsfmTags(cleanedString); if(strippedUsfmFrontTags.length() > 0) { String chapter0 = "00"; success = saveSection("front", "intro", strippedUsfmFrontTags); successOverall = successOverall && success; success = saveSection(chapter0, "title", mBookName); successOverall = successOverall && success; } } return successOverall; }

Target:
private boolean breakUpChapter(CharSequence text, String currentChapterStr) { boolean successOverall = true; boolean success = true; String cleanedString = text.toString().replaceAll("\r\n","\n"); if (!isMissing(currentChapterStr)) { try { String chapter = getChapterFolderName(currentChapterStr); if (null == chapter) { addError(R.string.could_not_find_chapter, currentChapterStr); return false; } List<String> versebreaks = getVerseBreaks(chapter); int currentChapter = Integer.valueOf(chapter); updateStatus(R.string.processing_chapter, new Integer(mChaperCount - currentChapter + 1).toString()); String lastFirst = null; for (int i = 0; (i < versebreaks.size()) && success; i++) { String first = versebreaks.get(i); success = extractVerses(chapter, cleanedString, lastFirst, first); successOverall = successOverall && success; lastFirst = first; } if (successOverall) { success = extractVerses(chapter, cleanedString, lastFirst, END_MARKER +""); successOverall = successOverall && success; } } catch (Exception e) { Logger.e(TAG, "error parsing chapter " + currentChapterStr, e); addError(R.string.could_not_parse_chapter, currentChapterStr); return false; } } else { String strippedUsfmFrontTags = removeKnownUsfmTags(cleanedString); if(strippedUsfmFrontTags.length() > 0) { success = saveSection("front", "intro", strippedUsfmFrontTags); successOverall = successOverall && success; } String chapter0 = "00"; success = saveSection(chapter0, "title", mBookName); successOverall = successOverall && success; } return successOverall; }
Source:
public void checkAttributeSyntax(PerunSessionImpl sess, User user, Attribute attribute) throws InternalErrorException, WrongAttributeValueException { Utils.notNull(attribute, "attribute"); if (unpermittedLogins.contains(attribute.valueAsString())) throw new WrongAttributeValueException(attribute, user, "Login '" + attribute.getValue() + "' is not permitted."); super.checkAttributeSyntax(sess, user, attribute); }

Target:
public void checkAttributeSyntax(PerunSessionImpl sess, User user, Attribute attribute) throws InternalErrorException, WrongAttributeValueException { if (unpermittedLogins.contains(attribute.valueAsString())) throw new WrongAttributeValueException(attribute, user, "Login '" + attribute.getValue() + "' is not permitted."); super.checkAttributeSyntax(sess, user, attribute); }
Source:
public String getColumnText(Object element, int columnIndex) { if (element instanceof ECAction) { switch (columnIndex) { case 0: if (null != ((ECAction) element).getAlgorithm()) { return ((ECAction) element).getAlgorithm().getName(); } break; case 1: if (null != ((ECAction) element).getOutput()) { return ((ECAction) element).getOutput().getName(); } break; case 2: if (null != ((ECAction) element).getAlgorithm().getComment()) { return ((ECAction) element).getAlgorithm().getComment(); } break; default: break; } } return ECCContentAndLabelProvider.EMPTY_FIELD; }

Target:
public String getColumnText(Object element, int columnIndex) { if (element instanceof ECAction) { switch (columnIndex) { case ACTION_COLUMN_ALGORITHM: if (null != ((ECAction) element).getAlgorithm()) { return ((ECAction) element).getAlgorithm().getName(); } break; case ACTION_COLUMN_EVENT: if (null != ((ECAction) element).getOutput()) { return ((ECAction) element).getOutput().getName(); } break; case ACTION_COLUMN_COMMENT: if (null != ((ECAction) element).getAlgorithm().getComment()) { return ((ECAction) element).getAlgorithm().getComment(); } break; default: break; } } return ECCContentAndLabelProvider.EMPTY_FIELD; }
Source:
public void test() { final Context context = new Context(); assertTrue(KastParser.parse("output.txt", ".Bag", context).getBody().equals(Bag.EMPTY)); assertTrue(KastParser.parse("output.txt", "0", context).getBody() .equals(KastParser.parse("output.txt", "`0::Int`", context).getBody())); assertTrue(KastParser.parse("output.txt", "0", context).getBody() .equals(KastParser.parse("output.txt", "`0`", context).getBody())); assertTrue(KastParser.parse("output.txt", "`\"0\"`", context).getBody() .equals(KastParser.parse("output.txt", "\"0\"", context).getBody())); assertTrue(KastParser.parse("output.txt", "true", context).getBody() .equals(KastParser.parse("output.txt", "`true::Bool`", context).getBody())); assertTrue(KastParser.parse("output.txt", "false", context).getBody() .equals(KastParser.parse("output.txt", "`false::Bool`", context).getBody())); Cell testCell = new Cell("abc",Bag.EMPTY); assertTrue(KastParser.parse("output.txt", "<abc> .Bag </abc>", context) .getBody().equals(testCell)); List<Term> testKList = new ArrayList<Term>(); testKList.add(IntBuiltin.of(0)); testKList.add(IntBuiltin.of(0)); assertTrue(KastParser.parse("output.txt", "`abc`(0,0)", context) .getBody().equals(new KApp(KLabelConstant.of("abc"), (Term)(new KList(testKList))))); }

Target:
public void test() { final Context context = new Context(); assertEquals(KastParser.parse("output.txt", ".Bag", context).getBody(),Bag.EMPTY); assertEquals(KastParser.parse("output.txt", "0", context).getBody(),IntBuiltin.of(0)); assertEquals(KastParser.parse("output.txt", "0", context).getBody(), KastParser.parse("output.txt", "`0::Int`", context).getBody()); assertEquals(KastParser.parse("output.txt", "0", context).getBody(), KastParser.parse("output.txt", "`0`", context).getBody()); assertEquals(KastParser.parse("output.txt", "`\"0\"`", context).getBody(), StringBuiltin.of("0")); assertEquals(KastParser.parse("output.txt", "`\"0\"`", context).getBody(), KastParser.parse("output.txt", "\"0\"", context).getBody()); assertFalse(KastParser.parse("output.txt", "`\"\"0\"\"`", context).getBody() .equals(KastParser.parse("output.txt", "\"0\"", context).getBody())); assertEquals(KastParser.parse("output.txt", "true", context).getBody(), BoolBuiltin.of("true")); assertEquals(KastParser.parse("output.txt", "true", context).getBody(), KastParser.parse("output.txt", "`true::Bool`", context).getBody()); assertEquals(KastParser.parse("output.txt", "false", context).getBody(), BoolBuiltin.of("false")); assertEquals(KastParser.parse("output.txt", "false", context).getBody(), KastParser.parse("output.txt", "`false::Bool`", context).getBody()); Cell testCell = new Cell("abc",Bag.EMPTY); assertEquals(KastParser.parse("output.txt", "<abc> .Bag </abc>", context), testCell); assertEquals(KastParser.parse("output.txt", "`abc`(0,0)", context).getBody(), KApp.of("abc", IntBuiltin.of(0), IntBuiltin.of(0))); }
Source:
private void setHeaderProfileInfo(boolean force) { if (force || loginStatus != Preferences.readBoolean(this, Preferences.User.LOG_IN_STATUS) || (loginStatus && TextUtils.isEmpty(tvProfileUsername.getText())) || (!loginStatus && !TextUtils.isEmpty(tvProfileUsername.getText()))) { final ParseUser currentUser = ParseUser.getCurrentUser(); if (currentUser != null) { try { ParseFile parseFile = currentUser.getParseFile("profileThumb"); byte[] data = parseFile.getData(); Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length); ivProfile.setImageBitmap(bitmap); } catch (Exception e) { e.printStackTrace(); } tvProfileUsername.setText(currentUser.getUsername()); tvProfileEmail.setText(currentUser.getEmail()); } else { ivProfile.setImageResource(R.drawable.background_profile); tvProfileUsername.setText(""); tvProfileEmail.setText(""); } } }

Target:
private void setHeaderProfileInfo(boolean force) { if (force || mLoginStatus != Preferences.readBoolean(this, Preferences.User.LOG_IN_STATUS) || (mLoginStatus && TextUtils.isEmpty(tvProfileUsername.getText())) || (!mLoginStatus && !TextUtils.isEmpty(tvProfileUsername.getText()))) { final ParseUser currentUser = ParseUser.getCurrentUser(); if (currentUser != null) { try { ParseFile parseFile = currentUser.getParseFile("profileThumb"); byte[] data = parseFile.getData(); Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length); ivProfile.setImageBitmap(bitmap); } catch (Exception e) { e.printStackTrace(); } tvProfileUsername.setText(currentUser.getUsername()); tvProfileEmail.setText(currentUser.getEmail()); } else { ivProfile.setImageResource(R.drawable.profile_placeholder); tvProfileUsername.setText(""); tvProfileEmail.setText(""); } } }
Source:
public byte[] get(final String deviceId) { final Map<String, AttributeValue> attributes = new HashMap<String, AttributeValue>(); attributes.put("public_key", new AttributeValue().withS("")); final HashMap<String, AttributeValue> key = new HashMap<String, AttributeValue>(); key.put("device_id", new AttributeValue().withS(deviceId)); final GetItemRequest getItemRequest = new GetItemRequest() .withTableName(keyStoreTableName) .withKey(key); final GetItemResult getItemResult = dynamoDBClient.getItem(getItemRequest); final String base64EncodedPublicKey = getItemResult.getItem().get("public_key").getS(); return base64EncodedPublicKey.getBytes(); }

Target:
public Optional<byte[]> get(final String deviceId) { final HashMap<String, AttributeValue> key = new HashMap<String, AttributeValue>(); key.put(DEVICE_ID_ATTRIBUTE_NAME, new AttributeValue().withS(deviceId)); final GetItemRequest getItemRequest = new GetItemRequest() .withTableName(keyStoreTableName) .withKey(key); final GetItemResult getItemResult = dynamoDBClient.getItem(getItemRequest); final String base64EncodedPublicKey = getItemResult.getItem().get(PUBLIC_KEY_ATTRIBUTE_NAME).getS(); return Optional.of(base64EncodedPublicKey.getBytes()); }
Source:
public void activate() { sqlTypes.put("COLORITEM", "VARCHAR(70)"); sqlTypes.put("CONTACTITEM", "VARCHAR(6)"); sqlTypes.put("DATETIMEITEM", "DATETIME"); sqlTypes.put("DIMMERITEM", "TINYINT"); sqlTypes.put("GROUPITEM", "VARCHAR(200)"); sqlTypes.put("NUMBERITEM", "DOUBLE"); sqlTypes.put("ROLERSHUTTERITEM", "TINYINT"); sqlTypes.put("STRINGITEM", "VARCHAR(20000)"); sqlTypes.put("SWITCHITEM", "CHAR(3)"); }

Target:
public void activate() { sqlTypes.put("COLORITEM", "VARCHAR(70)"); sqlTypes.put("CONTACTITEM", "VARCHAR(6)"); sqlTypes.put("DATETIMEITEM", "DATETIME"); sqlTypes.put("DIMMERITEM", "TINYINT"); sqlTypes.put("GROUPITEM", "DOUBLE"); sqlTypes.put("NUMBERITEM", "DOUBLE"); sqlTypes.put("ROLERSHUTTERITEM", "TINYINT"); sqlTypes.put("STRINGITEM", "VARCHAR(20000)"); sqlTypes.put("SWITCHITEM", "CHAR(3)"); }
Source:
void throwIfNoHandlerPresent() { @SuppressWarnings("unchecked") ProjectionRepository<String, ?, ?> repository = (ProjectionRepository<String, ?, ?>) DefaultRepository.of(SavingProjection.class); BoundedContext context = BoundedContextBuilder .assumingTests() .build(); final BoundedContext.InternalAccess contextAccess = context.internalAccess(); contextAccess.register(repository); DiagnosticMonitor monitor = new DiagnosticMonitor(); contextAccess.registerEventDispatcher(monitor); Event event = GivenEvent.arbitrary(); EventEnvelope envelope = EventEnvelope.of(event); ProjectionEndpoint<String, ?> endpoint = ProjectionEndpoint.of(repository, envelope); endpoint.dispatchTo(projection.id()); List<HandlerFailedUnexpectedly> systemEvents = monitor.handlerFailureEvents(); assertThat(systemEvents).hasSize(1); HandlerFailedUnexpectedly systemEvent = systemEvents.get(0); assertThat(systemEvent.getHandledSignal() .asEventId()) .isEqualTo(event.id()); assertThat(systemEvent.getEntity() .getId()) .isEqualTo(Identifier.pack(projection.id())); assertThat(systemEvent.getError().getType()) .isEqualTo(IllegalStateException.class.getCanonicalName()); }

Target:
void throwIfNoHandlerPresent() { @SuppressWarnings({"unchecked", "RedundantSuppression"}) ProjectionRepository<String, SavingProjection, SavedString> repository = (ProjectionRepository<String, SavingProjection, SavedString>) DefaultRepository.of(SavingProjection.class); BoundedContext context = BoundedContextBuilder .assumingTests() .build(); final BoundedContext.InternalAccess contextAccess = context.internalAccess(); contextAccess.register(repository); DiagnosticMonitor monitor = new DiagnosticMonitor(); contextAccess.registerEventDispatcher(monitor); Event event = GivenEvent.arbitrary(); EventEnvelope envelope = EventEnvelope.of(event); ProjectionEndpoint<String, SavingProjection, SavedString> endpoint = ProjectionEndpoint.of(repository, envelope); endpoint.dispatchTo(projection.id()); List<HandlerFailedUnexpectedly> systemEvents = monitor.handlerFailureEvents(); assertThat(systemEvents).hasSize(1); HandlerFailedUnexpectedly systemEvent = systemEvents.get(0); assertThat(systemEvent.getHandledSignal() .asEventId()) .isEqualTo(event.id()); assertThat(systemEvent.getEntity() .getId()) .isEqualTo(Identifier.pack(projection.id())); assertThat(systemEvent.getError().getType()) .isEqualTo(IllegalStateException.class.getCanonicalName()); }
Source:
public boolean contains(Comment comment) { if(!comment.getRange().isPresent()){ return false; } Range commentRange = comment.getRange().get(); if (commentRange == null) { return false; } for (Comment c : getComments()) { if(!c.getRange().isPresent()){ return false; } Range cRange = c.getRange().get(); if(cRange!=null) { if (cRange.begin.line == commentRange.begin.line && cRange.begin.column == commentRange.begin.column && cRange.end.line == commentRange.end.line && Math.abs(cRange.end.column - commentRange.end.column) < 2) { return true; } } } return false; }

Target:
public boolean contains(Comment comment) { if (!comment.getRange().isPresent()) { return false; } Range commentRange = comment.getRange().get(); if (commentRange == null) { return false; } for (Comment c : getComments()) { if (!c.getRange().isPresent()) { return false; } Range cRange = c.getRange().get(); if (cRange != null) { if (cRange.begin.equals(commentRange.begin) && cRange.end.line == commentRange.end.line && Math.abs(cRange.end.column - commentRange.end.column) < 2) { return true; } } } return false; }
Source:
public ScriptManager(RuleTriggerManager triggerManager, ItemRegistry itemRegistry) { this.triggerManager = triggerManager; instance = this; logger.info("Available engines:"); { for (ScriptEngineFactory f : new ScriptEngineManager().getEngineFactories()) { logger.info(f.getEngineName()); } } this.setItemRegistry(itemRegistry); File folder = getFolder("jsr_scripts"); if (folder.exists() && folder.isDirectory()) { loadScripts(folder); scriptUpdateWatcher = new Thread(new ScriptUpdateWatcher(this, folder)); scriptUpdateWatcher.start(); } else { logger.warn("Script directory: jsr_scripts missing, no scripts will be added!"); } }

Target:
public ScriptManager(RuleTriggerManager triggerManager, ItemRegistry itemRegistry) { this.triggerManager = triggerManager; instance = this; logger.info("Available engines:"); for (ScriptEngineFactory f : new ScriptEngineManager().getEngineFactories()) { logger.info(f.getEngineName()); } this.setItemRegistry(itemRegistry); File folder = getFolder("scripts"); if (folder.exists() && folder.isDirectory()) { loadScripts(folder); scriptUpdateWatcher = new Thread(new ScriptUpdateWatcher(this, folder)); scriptUpdateWatcher.start(); } else { logger.warn("Script directory: jsr_scripts missing, no scripts will be added!"); } }
Source:
private static File explode() throws Exception { File d = new File(".").getAbsoluteFile(); for( ; d!=null; d=d.getParentFile()) { if(new File(d,".jenkins").exists()) { File dir = new File(d,"war/target/jenkins"); if(dir.exists()) { System.out.println("Using jenkins.war resources from "+dir); return dir; } } } URL winstone = WarExploder.class.getResource("/winstone.jar"); if(winstone==null) throw new AssertionError("jenkins.war is not in the classpath. If you are running this from the core workspace, run 'mvn install' to create the war image in war/target/jenkins"); File war = Which.jarFile(Class.forName("executable.Executable")); File explodeDir = new File("./target/jenkins-for-test").getAbsoluteFile(); while (new File(explodeDir + ".exploding").isFile()) { explodeDir = new File(explodeDir + "x"); } File timestamp = new File(explodeDir,".timestamp"); if(!timestamp.exists() || (timestamp.lastModified()!=war.lastModified())) { System.out.println("Exploding " + war + " into " + explodeDir); if (new File(explodeDir + ".exploding").exists()){ new FilePath(explodeDir).deleteRecursive(); } if (!explodeDir.exists()) { explodeDir.mkdirs(); } new FilePath(war).unzip(new FilePath(explodeDir)); if(!explodeDir.exists()) throw new IOException("Failed to explode "+war); new FileOutputStream(timestamp).close(); timestamp.setLastModified(war.lastModified()); new File(explodeDir + ".exploding").delete(); } else { System.out.println("Picking up existing exploded jenkins.war at "+explodeDir.getAbsolutePath()); } return explodeDir; }

Target:
private static File explode() throws Exception { File d = new File(".").getAbsoluteFile(); for( ; d!=null; d=d.getParentFile()) { if(new File(d,".jenkins").exists()) { File dir = new File(d,"war/target/jenkins"); if(dir.exists()) { System.out.println("Using jenkins.war resources from "+dir); return dir; } } } URL winstone = WarExploder.class.getResource("/winstone.jar"); if(winstone==null) throw new AssertionError("jenkins.war is not in the classpath. If you are running this from the core workspace, run 'mvn install' to create the war image in war/target/jenkins"); File war = Which.jarFile(Class.forName("executable.Executable")); File explodeDir = new File("./target/jenkins-for-test").getAbsoluteFile(); explodeDir.getParentFile().mkdirs(); while (new File(explodeDir + ".exploding").isFile()) { explodeDir = new File(explodeDir + "x"); } File timestamp = new File(explodeDir,".timestamp"); if(!timestamp.exists() || (timestamp.lastModified()!=war.lastModified())) { System.out.println("Exploding " + war + " into " + explodeDir); new FileOutputStream(explodeDir + ".exploding").close(); new FilePath(explodeDir).deleteRecursive(); new FilePath(war).unzip(new FilePath(explodeDir)); if(!explodeDir.exists()) throw new IOException("Failed to explode "+war); new FileOutputStream(timestamp).close(); timestamp.setLastModified(war.lastModified()); new File(explodeDir + ".exploding").delete(); } else { System.out.println("Picking up existing exploded jenkins.war at "+explodeDir.getAbsolutePath()); } return explodeDir; }
Source:
public String md5() { if(isEmpty()) return ""; try { MessageDigest md5 = MessageDigest.getInstance("MD5"); md5.reset(); for(SAMSequenceRecord ssr : mSequences) { if(ssr.getSequenceIndex()>0) md5.update((byte)' '); md5.update(ssr.getSequenceName().getBytes()); md5.update(String.valueOf(ssr.getSequenceLength()).getBytes()); } String hash = new BigInteger(1, md5.digest()).toString(16); if (hash.length() != 32) { final String zeros = "00000000000000000000000000000000"; hash = zeros.substring(0, 32 - hash.length()) + hash; } return hash; } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public String md5() { if (isEmpty()) return ""; try { final MessageDigest md5 = MessageDigest.getInstance("MD5"); md5.reset(); for (final SAMSequenceRecord samSequenceRecord : mSequences) { if (samSequenceRecord.getSequenceIndex() > 0) md5.update((byte) ' '); final String md5_tag = samSequenceRecord.getAttribute(SAMSequenceRecord.MD5_TAG); if (md5_tag != null) { md5.update(md5_tag.getBytes()); } else { md5.update(samSequenceRecord.getSequenceName().getBytes()); md5.update(String.valueOf(samSequenceRecord.getSequenceLength()).getBytes()); } } String hash = new BigInteger(1, md5.digest()).toString(16); if (hash.length() != 32) { final String zeros = "00000000000000000000000000000000"; hash = zeros.substring(0, 32 - hash.length()) + hash; } return hash; } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public Git call() throws JGitInternalException { try { RepositoryBuilder builder = new RepositoryBuilder(); if (bare) builder.setBare(); builder.readEnvironment(); if (directory != null) { File d = new File(directory); if (!bare) d = new File(d, Constants.DOT_GIT); builder.setGitDir(d); } else if (builder.getGitDir() == null) { File d = new File("."); if (!bare) d = new File(d, Constants.DOT_GIT); builder.setGitDir(d); } builder.findGitDir(); Repository repository = builder.build(); repository.create(bare); return new Git(repository); } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } }

Target:
public Git call() throws JGitInternalException { try { RepositoryBuilder builder = new RepositoryBuilder(); if (bare) builder.setBare(); builder.readEnvironment(); if (directory != null) { File d = directory; if (!bare) d = new File(d, Constants.DOT_GIT); builder.setGitDir(d); } else if (builder.getGitDir() == null) { File d = new File("."); if (!bare) d = new File(d, Constants.DOT_GIT); builder.setGitDir(d); } Repository repository = builder.build(); repository.create(bare); return new Git(repository); } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } }
Source:
private void evaluateMaintenanceHostCommandProgress(List<Guid> childCmdIds, CommandBase<?> rootCommand) { UpgradeHostParameters parameters = (UpgradeHostParameters) rootCommand.getParameters(); VdsDynamic host = DbFacade.getInstance().getVdsDynamicDao().get(parameters.getVdsId()); switch (host.getStatus()) { case PreparingForMaintenance: break; case Maintenance: log.error("Host '{}' is on maintenance mode. Proceeding with Upgrade process.", getHostName(parameters.getVdsId())); invokeHostUpgrade(rootCommand, parameters); break; default: if (isMaintenanceCommandExecuted(childCmdIds)) { log.error("Host '{}' failed to move to maintenance mode. Upgrade process is terminated.", getHostName(parameters.getVdsId())); rootCommand.setCommandStatus(CommandStatus.FAILED); } break; } }

Target:
private void evaluateMaintenanceHostCommandProgress(List<Guid> childCmdIds, CommandBase<?> rootCommand) { UpgradeHostParameters parameters = (UpgradeHostParameters) rootCommand.getParameters(); VdsDynamic host = DbFacade.getInstance().getVdsDynamicDao().get(parameters.getVdsId()); switch (host.getStatus()) { case PreparingForMaintenance: break; case Maintenance: log.info("Host '{}' is on maintenance mode. Proceeding with Upgrade process.", getHostName(parameters.getVdsId())); invokeHostUpgrade(rootCommand, parameters); break; default: if (isMaintenanceCommandExecuted(childCmdIds)) { log.error("Host '{}' failed to move to maintenance mode. Upgrade process is terminated.", getHostName(parameters.getVdsId())); rootCommand.setCommandStatus(CommandStatus.FAILED); } break; } }
Source:
public String getGitSshUrl() { if (sshdListenAddressString == null) { return ""; } if (downloadSchemes.length != 0) { if (!Arrays.asList(downloadSchemes).contains("ssh")) { return ""; } } String[] urlParts = sshdListenAddressString.split(":"); if (urlParts.length < 2) { log.error("Invalid SSHD listenUrl: " + sshdListenAddressString); return ""; } try { String hostname = getHost(urlParts[0]); int port = getPort(urlParts[1]); return "ssh://" + GITBLIT_USER + "@" + hostname + (port == SSH_DEF_PORT ? "" : ":" + port) + "/" + GITBLIT_REPO + ""; } catch (UnknownHostException e) { log.error("Cannot detect localhostname"); return ""; } }

Target:
public String getGitSshUrl() { if (sshdListenAddressString == null) { return ""; } if (!downloadSchemes.isEmpty() && !downloadSchemes.contains("ssh")) { return ""; } String[] urlParts = sshdListenAddressString.split(":"); if (urlParts.length < 2) { log.error("Invalid SSHD listenUrl: " + sshdListenAddressString); return ""; } try { String hostname = getHost(urlParts[0]); int port = getPort(urlParts[1]); return "ssh://" + GITBLIT_USER + "@" + hostname + (port == SSH_DEF_PORT ? "" : ":" + port) + "/" + GITBLIT_REPO + ""; } catch (UnknownHostException e) { log.error("Cannot detect localhostname"); return ""; } }
Source:
public static <T> Vector<T> ofAll(Iterable<? extends T> iterable) { Objects.requireNonNull(iterable, "iterable is null"); if (iterable instanceof Vector) { return (Vector<T>) iterable; } else if (iterable instanceof Collection<?>) { final Object[] array = ((Collection<? extends T>) iterable).toArray(); return ofAll(BitMappedTrie.ofAll(array)); } else { final Seq<? extends T> result = (iterable instanceof Seq) ? (Seq<T>) iterable : List.ofAll(iterable); final Object[] array = asArray(result.iterator(), result.size()); return ofAll(BitMappedTrie.ofAll(array)); } }

Target:
public static <T> Vector<T> ofAll(Iterable<? extends T> iterable) { Objects.requireNonNull(iterable, "iterable is null"); if (iterable instanceof Vector) { return (Vector<T>) iterable; } else { final BitMappedTrie<T> trie = BitMappedTrie.ofAll(asArray(iterable)); return ofAll(trie); } }