auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Construct exec(Target t, Environment env, Construct... args) throws CancelCommandException, ConfigRuntimeException { if (!(args[0] instanceof CString)) { throw new CREFormatException(this.getName() + " expects a string as first argument, but type " + args[0].typeof() + " was found.", t); } Static.AssertNonCNull(t, args); String teststring = args[0].nval(); String keyword = args[1].nval(); boolean ret = teststring.endsWith(keyword); return CBoolean.get(ret); }

Target:
public Construct exec(Target t, Environment env, Construct... args) throws CancelCommandException, ConfigRuntimeException { Static.AssertNonCNull(t, args); String teststring = args[0].nval(); String keyword = args[1].nval(); boolean ret = teststring.endsWith(keyword); return CBoolean.get(ret); }
Source:
private static boolean canExecute(BusinessEntityWithStatus<?, ?> entity, Class type, ActionType action) { Set<ActionType> actions = _matrix.get(type).get(entity.getStatus()); if (actions != null && actions.contains(action)) { return false; } return true; }

Target:
private static boolean canExecute(BusinessEntityWithStatus<?, ?> entity, Class type, ActionType action) { Set<ActionType> disallowedActions = _matrix.get(type).get(entity.getStatus()); if (disallowedActions != null && disallowedActions.contains(action)) { return false; } return true; }
Source:
private void loadNextPage(final boolean shouldClear) { if (shouldClear && pager != null) { cts.cancel(); pager = null; } notifyOnLoadingListeners(); getPager().loadNextPage(new FindCallback<T>() { @Override public void done(List<T> results, ParseException e) { if (results == null && e == null) { return; } if ((!Parse.isLocalDatastoreEnabled() && query.getCachePolicy() == ParseQuery.CachePolicy.CACHE_ONLY) && (e != null) && e.getCode() == ParseException.CACHE_MISS) { return; } notifyDataSetChanged(); notifyOnLoadedListeners(results, e); } }, cts.getToken()); }

Target:
private void loadNextPage(final boolean shouldClear) { synchronized (lock) { if (shouldClear && pager != null) { cts.cancel(); pager = null; } } notifyOnLoadingListeners(); getPager().loadNextPage(new FindCallback<T>() { @Override public void done(List<T> results, ParseException e) { if (results == null && e == null) { return; } if ((!Parse.isLocalDatastoreEnabled() && query.getCachePolicy() == ParseQuery.CachePolicy.CACHE_ONLY) && (e != null) && e.getCode() == ParseException.CACHE_MISS) { return; } notifyDataSetChanged(); notifyOnLoadedListeners(results, e); } }, cts.getToken()); }
Source:
public List<CloudBlobMetadata> findEntriesSince(String partitionPath, CloudFindToken findToken, long maxTotalSizeOfEntries) throws CloudStorageException { SqlQuerySpec entriesSinceQuery = new SqlQuerySpec(ENTRIES_SINCE_QUERY_TEMPLATE, new SqlParameterCollection(new SqlParameter(LIMIT_PARAM, findSinceQueryLimit), new SqlParameter(TIME_SINCE_PARAM, findToken.getLastUpdateTime()))); try { List<CloudBlobMetadata> queryResults = cosmosDataAccessor.queryMetadata(partitionPath, entriesSinceQuery, azureMetrics.findSinceQueryTime); if (queryResults.isEmpty()) { return queryResults; } if (queryResults.get(0).getLastUpdateTime() == findToken.getLastUpdateTime()) { filterOutLastReadBlobs(queryResults, findToken.getLastUpdateTimeReadBlobIds(), findToken.getLastUpdateTime()); } List<CloudBlobMetadata> cappedResults = new ArrayList<>(); long totalSize = 0; for (CloudBlobMetadata metadata : queryResults) { if (totalSize + metadata.getSize() > maxTotalSizeOfEntries) { if (cappedResults.size() == 0) { cappedResults.add(metadata); } break; } cappedResults.add(metadata); totalSize += metadata.getSize(); } return cappedResults; } catch (DocumentClientException dex) { throw new CloudStorageException("Failed to query blobs for partition " + partitionPath, dex); } }

Target:
public List<CloudBlobMetadata> findEntriesSince(String partitionPath, CloudFindToken findToken, long maxTotalSizeOfEntries) throws CloudStorageException { SqlQuerySpec entriesSinceQuery = new SqlQuerySpec(ENTRIES_SINCE_QUERY_TEMPLATE, new SqlParameterCollection(new SqlParameter(LIMIT_PARAM, findSinceQueryLimit), new SqlParameter(TIME_SINCE_PARAM, findToken.getLastUpdateTime()))); try { List<CloudBlobMetadata> queryResults = cosmosDataAccessor.queryMetadata(partitionPath, entriesSinceQuery, azureMetrics.findSinceQueryTime); if (queryResults.isEmpty()) { return queryResults; } if (queryResults.get(0).getLastUpdateTime() == findToken.getLastUpdateTime()) { filterOutLastReadBlobs(queryResults, findToken.getLastUpdateTimeReadBlobIds(), findToken.getLastUpdateTime()); } return CloudBlobMetadata.capMetadataListBySize(queryResults, maxTotalSizeOfEntries); } catch (DocumentClientException dex) { throw new CloudStorageException("Failed to query blobs for partition " + partitionPath, dex); } }
Source:
public static void main(final String[] args) { final CommandLine application = new CommandLine(new MantaCLI()); application.registerConverter(Path.class, Paths::get); List<CommandLine> parsedCommands; try { parsedCommands = application.parse(args); } catch (CommandLine.ParameterException ex) { System.err.println(ex.getMessage()); CommandLine.usage(new MantaCLI(), System.err); return; } MantaCLI cli = parsedCommands.get(0).getCommand(); if (cli.isHelpRequested) { application.usage(System.out); return; } if (cli.isVersionRequested) { System.out.println("java-manta-client: " + MantaVersion.VERSION); return; } if (parsedCommands.size() == 1) { application.usage(System.err); return; } CommandLine deepest = parsedCommands.get(parsedCommands.size() - 1); MantaSubCommand subcommand = (MantaSubCommand) deepest.getCommand(); if (subcommand.isHelpRequested) { CommandLine.usage(deepest.getCommand(), System.err); return; } if (subcommand.logLevel != null) { Logger root = (Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); root.setLevel(Level.valueOf(subcommand.logLevel.toString())); } subcommand.run(); }

Target:
public static void main(final String[] args) { final CommandLine application = new CommandLine(new MantaCLI()); application.registerConverter(Path.class, Paths::get); List<CommandLine> parsedCommands; try { parsedCommands = application.parse(args); } catch (CommandLine.ParameterException ex) { System.err.println(ex.getMessage()); CommandLine.usage(new MantaCLI(), System.err); return; } MantaCLI cli = parsedCommands.get(0).getCommand(); if (cli.isHelpRequested) { application.usage(System.out); return; } if (cli.isVersionRequested) { System.out.println("java-manta-client: " + MantaVersion.VERSION); return; } if (parsedCommands.size() == 1) { application.usage(System.err); return; } CommandLine deepest = parsedCommands.get(parsedCommands.size() - 1); MantaSubCommand subcommand = deepest.getCommand(); if (subcommand.isHelpRequested) { CommandLine.usage(deepest.getCommand(), System.err); return; } if (subcommand.logLevel != null) { Logger root = (Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); root.setLevel(Level.valueOf(subcommand.logLevel.toString())); } subcommand.run(); }
Source:
public String toString() { StringBuilder buf = new StringBuilder(); buf.append("DiffEntry"); switch (changeType) { case ADD: buf.append(" (Add " + newName + ")"); break; case COPY: buf.append(" (Copy " + oldName + " to " + newName + ")"); break; case DELETE: buf.append(" (Delete " + oldName + ")"); break; case MODIFY: buf.append(" (Modify " + oldName + ")"); break; case RENAME: buf.append(" (Rename " + oldName + " to " + newName + ")"); break; } return buf.toString(); }

Target:
public String toString() { StringBuilder buf = new StringBuilder(); buf.append("DiffEntry["); buf.append(changeType); buf.append(" "); switch (changeType) { case ADD: buf.append(newName); break; case COPY: buf.append(oldName + "->" + newName); break; case DELETE: buf.append(oldName); break; case MODIFY: buf.append(oldName); break; case RENAME: buf.append(oldName + "->" + newName); break; } buf.append("]"); return buf.toString(); }
Source:
public LoadProfile() { this.batchSize = Integer.MIN_VALUE; }

Target:
public LoadProfile() { this.batchSize = MIN_BATCH_SIZE; this.numOperations = Long.MAX_VALUE; this.tenantIdFormat = DEFAULT_TENANT_ID_FMT; this.tenantIdLength = DEFAULT_TENANT_ID_LEN; this.groupIdLength = DEFAULT_GROUP_ID_LEN; }
Source:
public void RelatedVideo_002_Library() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userNameStaff, credentials.passwordStaff, wikiURL); VisualEditModePageObject rVmoduleMessageEdit = base.goToArticleEditPage(wikiURL, "MediaWiki:RelatedVideosGlobalList"); rVmoduleMessageEdit.deleteUnwantedVideoFromMessage(VideoContent.youtubeVideoURL2name); ArticlePageObject article = (ArticlePageObject) rVmoduleMessageEdit.submit(PageType.Article); article.openRandomArticle(wikiURL); article.verifyRVModulePresence(); VetAddVideoComponentObject vetAddingVideo = article.clickAddRelatedVideo(); vetAddingVideo.addVideoByQuery(VideoContent.wikiaVideoQuery, 1); article.verifyRelatedVideoAdded(vetAddingVideo.getVideoName()); }

Target:
public void RelatedVideo_002_Library() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userNameStaff, credentials.passwordStaff, wikiURL); VisualEditModePageObject rVmoduleMessageEdit = base.goToArticleEditPage(wikiURL, URLsContent.relatedVideosList); rVmoduleMessageEdit.deleteUnwantedVideoFromMessage(VideoContent.youtubeVideoURL2name); ArticlePageObject article = rVmoduleMessageEdit.submitArticle(); article.openRandomArticle(wikiURL); article.verifyRelatedVideosModule(); VetAddVideoComponentObject vetAddingVideo = article.clickAddRelatedVideo(); vetAddingVideo.addVideoByQuery(VideoContent.wikiaVideoQuery, 1); article.verifyRelatedVideoAdded(vetAddingVideo.getVideoName()); }
Source:
public void shutdownNow() { logger.warn("Shutting down FlowRunnerManager now..."); this.executorService.shutdownNow(); this.triggerManager.shutdown(); deleteExecutionDirectory(); }

Target:
public void shutdownNow() { logger.warn("Shutting down FlowRunnerManager now..."); this.executorService.shutdownNow(); this.triggerManager.shutdown(); }
Source:
public <Q, I, U> SubscriptionQueryResult<QueryResponseMessage<I>, SubscriptionQueryUpdateMessage<U>> subscriptionQuery( SubscriptionQueryMessage<Q, I, U> query, SubscriptionQueryBackpressure backPressure, int updateBufferSize ) { return subscriptionQuery(query, backPressure, updateBufferSize); }

Target:
public <Q, I, U> SubscriptionQueryResult<QueryResponseMessage<I>, SubscriptionQueryUpdateMessage<U>> subscriptionQuery( SubscriptionQueryMessage<Q, I, U> query, SubscriptionQueryBackpressure backPressure, int updateBufferSize ) { return subscriptionQuery(query, updateBufferSize); }
Source:
public RegexGroupFilter(final int groupIdx) { if (groupIdx < 1) throw new IllegalArgumentException(MessageFormat.format(HttpServerText.get().invalidIndex, groupIdx)); this.groupIdx = groupIdx - 1; }

Target:
public RegexGroupFilter(final int groupIdx) { if (groupIdx < 1) throw new IllegalArgumentException(MessageFormat.format( HttpServerText.get().invalidIndex, valueOf(groupIdx))); this.groupIdx = groupIdx - 1; }
Source:
private List<InstructorFeedbackResultsResponseRow> buildMissingResponseRowsBetweenRecipientAndPossibleGivers( FeedbackQuestionAttributes question, List<String> possibleGivers, String recipientIdentifier, String recipientName, String recipientTeam) { List<InstructorFeedbackResultsResponseRow> missingResponses = new ArrayList<InstructorFeedbackResultsResponseRow>(); FeedbackQuestionDetails questionDetails = question.getQuestionDetails(); for (String possibleGiver : possibleGivers) { String possibleGiverName = bundle.getFullNameFromRoster(possibleGiver); String possibleGiverTeam = bundle.getTeamNameFromRoster(possibleGiver); String textToDisplay = questionDetails.getNoResponseTextInHtml(recipientIdentifier, possibleGiver, bundle, question); if (questionDetails.shouldShowNoResponseText(possibleGiver, recipientIdentifier, question)) { InstructorFeedbackResultsModerationButton moderationButton = buildModerationButtonForGiver( question, possibleGiver, "btn btn-default btn-xs", "Moderate Response"); InstructorFeedbackResultsResponseRow missingResponse = new InstructorFeedbackResultsResponseRow(possibleGiverName, possibleGiverTeam, recipientName, recipientTeam, textToDisplay, moderationButton, true); missingResponse.setRowAttributes(new ElementTag("class", "pending_response_row")); configureResponseRow(question, possibleGiver, recipientIdentifier, missingResponse); missingResponses.add(missingResponse); } } return missingResponses; }

Target:
private List<InstructorFeedbackResultsResponseRow> buildMissingResponseRowsBetweenRecipientAndPossibleGivers( FeedbackQuestionAttributes question, List<String> possibleGivers, String recipientIdentifier, String recipientName, String recipientTeam) { List<InstructorFeedbackResultsResponseRow> missingResponses = new ArrayList<InstructorFeedbackResultsResponseRow>(); FeedbackQuestionDetails questionDetails = question.getQuestionDetails(); for (String possibleGiver : possibleGivers) { String possibleGiverName = bundle.getFullNameFromRoster(possibleGiver); String possibleGiverTeam = bundle.getTeamNameFromRoster(possibleGiver); String textToDisplay = questionDetails.getNoResponseTextInHtml(recipientIdentifier, possibleGiver, bundle, question); if (questionDetails.shouldShowNoResponseText(possibleGiver, recipientIdentifier, question)) { InstructorFeedbackResultsModerationButton moderationButton = buildModerationButtonForGiver( question, possibleGiver, "btn btn-default btn-xs", MODERATE_SINGLE_RESPONSE); InstructorFeedbackResultsResponseRow missingResponse = new InstructorFeedbackResultsResponseRow( possibleGiverName, possibleGiverTeam, recipientName, recipientTeam, textToDisplay, moderationButton, true); missingResponse.setRowAttributes(new ElementTag("class", "pending_response_row")); configureResponseRow(question, possibleGiver, recipientIdentifier, missingResponse); missingResponses.add(missingResponse); } } return missingResponses; }
Source:
public void applyConfig(Configuration config, boolean reindex, boolean interactive) { setConfiguration(config, interactive); LOGGER.log(Level.INFO, "Configuration updated"); if (reindex) { refreshSearcherManagerMap(); maybeRefreshIndexSearchers(); refreshDateForLastIndexRun(); } if (isAuthorizationWatchdog() && config.getPluginDirectory() != null) { watchDog.start(new File(config.getPluginDirectory())); } else { watchDog.stop(); } getAuthorizationFramework().setPluginDirectory(config.getPluginDirectory()); getAuthorizationFramework().setStack(config.getPluginStack()); getAuthorizationFramework().reload(); messagesContainer.setMessageLimit(config.getMessageLimit()); }

Target:
public void applyConfig(Configuration config, boolean reindex, boolean interactive) { setConfiguration(config, interactive); LOGGER.log(Level.INFO, "Configuration updated"); if (reindex) { refreshSearcherManagerMap(); maybeRefreshIndexSearchers(); refreshDateForLastIndexRun(); } if (isAuthorizationWatchdog() && getPluginDirectory() != null) { watchDog.start(new File(getPluginDirectory())); } else { watchDog.stop(); } getAuthorizationFramework().setPluginDirectory(getPluginDirectory()); getAuthorizationFramework().setStack(getPluginStack()); getAuthorizationFramework().reload(); messagesContainer.setMessageLimit(getMessageLimit()); }
Source:
PoolKey getPoolKey(Version.Main version) throws IOException { if (Objects.isNull(keys.get(version))) { newPoolKey(version); } return keys.get(version); }

Target:
PoolKey getPoolKey(Version.Main version) { return keys.computeIfAbsent(version, EmbedMongoFactory::newPoolKey); }
Source:
public void init(boolean beginTransaction) throws Exception { this.config = new CandlepinCommonTestConfig(); Module testingModule = new TestingModules.StandardTest(this.config); this.injector = parentInjector.createChildInjector( Modules.override(testingModule).with(getGuiceOverrideModule())); locatorMap = this.injector.getInstance(ResourceLocatorMap.class); locatorMap.init(); methodLocator = new MethodLocator(injector); methodLocator.init(); annotationLocator = new AnnotationLocator(methodLocator); securityInterceptor = this.injector.getInstance(TestingInterceptor.class); cpRequestScope = injector.getInstance(CandlepinRequestScope.class); cpRequestScope.exit(); cpRequestScope.enter(); this.injector.injectMembers(this); dateSource = (DateSourceForTesting) injector.getInstance(DateSource.class); dateSource.currentDate(TestDateUtil.date(2010, 1, 1)); HttpServletRequest req = parentInjector.getInstance(HttpServletRequest.class); when(req.getAttribute("username")).thenReturn("mock_user"); this.i18n = I18nFactory.getI18n(getClass(), Locale.US, I18nFactory.FALLBACK); if (beginTransaction) { this.beginTransaction(); } }

Target:
public void init(boolean beginTransaction) throws Exception { this.config = new CandlepinCommonTestConfig(); Module testingModule = new TestingModules.StandardTest(this.config); this.injector = parentInjector.createChildInjector( Modules.override(testingModule).with(getGuiceOverrideModule())); methodLocator = new MethodLocator(injector); methodLocator.init(); locatorMap = new ResourceLocatorMap(injector, methodLocator); locatorMap.init(); annotationLocator = new AnnotationLocator(methodLocator); securityInterceptor = this.injector.getInstance(TestingInterceptor.class); cpRequestScope = injector.getInstance(CandlepinRequestScope.class); cpRequestScope.exit(); cpRequestScope.enter(); this.injector.injectMembers(this); dateSource = (DateSourceForTesting) injector.getInstance(DateSource.class); dateSource.currentDate(TestDateUtil.date(2010, 1, 1)); HttpServletRequest req = parentInjector.getInstance(HttpServletRequest.class); when(req.getAttribute("username")).thenReturn("mock_user"); this.i18n = I18nFactory.getI18n(getClass(), Locale.US, I18nFactory.FALLBACK); if (beginTransaction) { this.beginTransaction(); } }
Source:
private void reportAll(CheckerContext context) { Map<Symbol.MethodSymbol, MethodBehavior> behaviors = new HashMap<>(); methodSymbols.pop().entrySet().forEach(entry -> { Symbol.MethodSymbol methodSymbol = entry.getValue(); behaviors.putIfAbsent(methodSymbol, ((CheckerDispatcher) context).peekMethodBehavior(methodSymbol)); MethodBehavior mb = behaviors.get(methodSymbol); if (mb != null && mb.isComplete()) { IdentifierTree methodName = entry.getKey(); Set<Flow> flow = flowFromYield(mb, methodName); reportIssue(methodName, String.format("Method '%s' has %d method yields.", methodName.name(), mb.yields().size()), flow); } }); }

Target:
private void reportAll(CheckerContext context) { CheckerDispatcher checkerDispatcher = (CheckerDispatcher) context; methodInvocations.pop().stream() .filter(mit -> mit.symbol().isMethodSymbol()) .forEach(mit -> reportYields(mit, checkerDispatcher)); }
Source:
public void runActivity(Body body) { Service service = new Service(body); while (body.isActive()) { try { Request request = service.blockingRemoveOldest(); if (request == null) { return; } if (request.getMethodName().startsWith("wait") && !testWaitFunction(service, request)) { waitUntilQueue.add(request); } else { service.serve(request); unblockWaitMethods(service); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }

Target:
public void runActivity(Body body) { Service service = new Service(body); while (body.isActive()) { try { NewRequestWithWaitTime requestWithWaitTime = waitForNewRequest(service); Request request = requestWithWaitTime.getNewRequest(); if (request != null && request.getMethodName().startsWith("wait") && !testWaitFunction(service, request)) { TimedOutRequest timedOutRequest = new TimedOutRequest(request, extractWaitRequestTimeoutParameter(request)); logger.trace("New pending wait request : " + timedOutRequest); waitUntilQueue.add(new TimedOutRequest(request, extractWaitRequestTimeoutParameter(request))); } else if (request != null) { service.serve(request); } unblockWaitMethods(service, requestWithWaitTime.getWaitTime()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }
Source:
public void testListZones() throws InterruptedException { server.enqueue(jsonResponse("/zones.json")); List<Zone> zones = api.regionAndZoneApi().describeZones(Regions.EU_CENTRAL_1.getName()); assertEquals(size(zones), 2); assertEquals(server.getRequestCount(), 1); assertSent(server, "GET", "DescribeZones"); }

Target:
public void testListZones() throws InterruptedException { server.enqueue(jsonResponse("/zones.json")); List<Zone> zones = api.regionAndZoneApi().describeZones(Regions.EU_CENTRAL_1.getName()); assertEquals(size(zones), 2); assertEquals(server.getRequestCount(), 1); assertSent(server, "GET", "DescribeZones", ImmutableMap.of("RegionId", Regions.EU_CENTRAL_1.getName())); }
Source:
private Set<Integer> getBinaryOids(Properties info) throws PSQLException { boolean binaryTransfer = PGProperty.BINARY_TRANSFER.getBoolean(info); Set<Integer> binaryOids = new HashSet<Integer>(); if (binaryTransfer) { binaryOids.add(Oid.BYTEA); binaryOids.add(Oid.INT2); binaryOids.add(Oid.INT4); binaryOids.add(Oid.INT8); binaryOids.add(Oid.FLOAT4); binaryOids.add(Oid.FLOAT8); binaryOids.add(Oid.TIME); binaryOids.add(Oid.DATE); binaryOids.add(Oid.TIMETZ); binaryOids.add(Oid.TIMESTAMP); binaryOids.add(Oid.TIMESTAMPTZ); binaryOids.add(Oid.INT2_ARRAY); binaryOids.add(Oid.INT4_ARRAY); binaryOids.add(Oid.INT8_ARRAY); binaryOids.add(Oid.FLOAT4_ARRAY); binaryOids.add(Oid.FLOAT8_ARRAY); binaryOids.add(Oid.VARCHAR_ARRAY); binaryOids.add(Oid.TEXT_ARRAY); binaryOids.add(Oid.POINT); binaryOids.add(Oid.BOX); binaryOids.add(Oid.UUID); } binaryOids.addAll(getOidSet(PGProperty.BINARY_TRANSFER_ENABLE.get(info))); binaryOids.removeAll(getOidSet(PGProperty.BINARY_TRANSFER_DISABLE.get(info))); return binaryOids; }

Target:
private static Set<Integer> getBinaryOids(Properties info) throws PSQLException { boolean binaryTransfer = PGProperty.BINARY_TRANSFER.getBoolean(info); Set<Integer> binaryOids = new HashSet<Integer>(32); if (binaryTransfer) { binaryOids.add(Oid.BYTEA); binaryOids.add(Oid.INT2); binaryOids.add(Oid.INT4); binaryOids.add(Oid.INT8); binaryOids.add(Oid.FLOAT4); binaryOids.add(Oid.FLOAT8); binaryOids.add(Oid.TIME); binaryOids.add(Oid.DATE); binaryOids.add(Oid.TIMETZ); binaryOids.add(Oid.TIMESTAMP); binaryOids.add(Oid.TIMESTAMPTZ); binaryOids.add(Oid.INT2_ARRAY); binaryOids.add(Oid.INT4_ARRAY); binaryOids.add(Oid.INT8_ARRAY); binaryOids.add(Oid.FLOAT4_ARRAY); binaryOids.add(Oid.FLOAT8_ARRAY); binaryOids.add(Oid.VARCHAR_ARRAY); binaryOids.add(Oid.TEXT_ARRAY); binaryOids.add(Oid.POINT); binaryOids.add(Oid.BOX); binaryOids.add(Oid.UUID); } binaryOids.addAll(getOidSet(PGProperty.BINARY_TRANSFER_ENABLE.get(info))); binaryOids.removeAll(getOidSet(PGProperty.BINARY_TRANSFER_DISABLE.get(info))); return binaryOids; }
Source:
public String createNewGroup(final String userId, final String courseId) throws AuthenticationException { String hash; try { final String unsecuredSalt = HashManager.generateUnSecureSalt(courseId); hash = HashManager.toHex(HashManager.createHash(userId, unsecuredSalt).getBytes(StandardCharsets.UTF_8)); } catch (NoSuchAlgorithmException e) { throw new AuthenticationException(e); } final BasicDBObject nonStudent = new BasicDBObject(); nonStudent.append(userId, hash); final BasicDBObject groupQuery = new BasicDBObject(DatabaseStringConstants.COURSE_ID, new ObjectId(courseId)) .append(DatabaseStringConstants.USER_LIST, new BasicDBObject()) .append(DatabaseStringConstants.NON_USER_LIST, nonStudent); final DBCollection collection = database.getCollection(DatabaseStringConstants.USER_GROUP_COLLECTION); collection.insert(groupQuery); return groupQuery.get(DatabaseStringConstants.SELF_ID).toString(); }

Target:
public String createNewGroup(final String userId, final String courseId) throws AuthenticationException { String hash; try { final String unsecuredSalt = HashManager.generateUnSecureSalt(courseId); hash = HashManager.toHex(HashManager.createHash(userId, unsecuredSalt).getBytes(StandardCharsets.UTF_8)); } catch (NoSuchAlgorithmException e) { throw new AuthenticationException("Invalid algorithm when creating a new group", e); } final BasicDBObject nonStudent = new BasicDBObject(); nonStudent.append(userId, hash); final BasicDBObject groupQuery = new BasicDBObject(DatabaseStringConstants.COURSE_ID, new ObjectId(courseId)) .append(DatabaseStringConstants.USER_LIST, new BasicDBObject()) .append(DatabaseStringConstants.NON_USER_LIST, nonStudent); final DBCollection collection = database.getCollection(DatabaseStringConstants.USER_GROUP_COLLECTION); collection.insert(groupQuery); return groupQuery.get(DatabaseStringConstants.SELF_ID).toString(); }
Source:
private static void testPatternSegmentData(TmfXmlPatternSegment segment) { TestData test = new TestData(); assertEquals("getStart", test.ts, segment.getStart()); assertEquals("getEnd", test.tf, segment.getEnd()); assertEquals("getScale", test.scale, segment.getScale()); assertEquals("getName", test.name, segment.getName()); assertNotNull("getContent", segment.getContent()); assertEquals("content size", test.content.size(), segment.getContent().size()); Iterator<Map.Entry<String, Object>> it1 = segment.getContent().entrySet().iterator(); Iterator<Map.Entry<String, Object>> it2 = test.content.entrySet().iterator(); for (int i = 0; i < test.content.size(); i++) { Map.Entry<String, Object> actual = it1.next(); Map.Entry<String, Object> expected = it2.next(); assertEquals("content name", expected.getKey(), actual.getKey()); assertEquals("content value", expected.getValue(), actual.getValue()); } }

Target:
private static void testPatternSegmentData(TmfXmlPatternSegment segment) { final Map<@NonNull String, @NonNull ITmfStateValue> testContent = new HashMap<>(); testContent.put("field1", TmfStateValue.newValueLong(5l)); testContent.put("field2", TmfStateValue.newValueString("test")); testContent.put("field3", TmfStateValue.newValueInt(1)); TmfXmlPatternSegment test = new TmfXmlPatternSegment(1l, 10l, ITmfTimestamp.NANOSECOND_SCALE, "seg_test2", testContent); assertEquals("getStart", test.getStart(), segment.getStart()); assertEquals("getEnd", test.getEnd(), segment.getEnd()); assertEquals("getScale", test.getScale(), segment.getScale()); assertEquals("getName", test.getName(), segment.getName()); assertNotNull("getContent", segment.getContent()); assertEquals("content size", test.getContent().size(), segment.getContent().size()); Iterator<Map.Entry<String, @NonNull ITmfStateValue>> it1 = segment.getContent().entrySet().iterator(); Iterator<Map.Entry<String, @NonNull ITmfStateValue>> it2 = test.getContent().entrySet().iterator(); for (int i = 0; i < test.getContent().size(); i++) { Map.Entry<String, @NonNull ITmfStateValue> actual = it1.next(); Map.Entry<String, @NonNull ITmfStateValue> expected = it2.next(); assertEquals("content name" + i, expected.getKey(), actual.getKey()); assertEquals("Content value comparison" + i, 0, expected.getValue().compareTo(actual.getValue())); } }
Source:
public long updateAndGetCurrentMessageBackoff(SubscriptionPolicy subscriptionPolicy) { currentMessageBackoff = currentMessageBackoff == -1 ? subscriptionPolicy.getMessageBackoff() : Math.min(subscriptionPolicy.getBackoffMaxIntervalMillis(), (long) (currentMessageBackoff * subscriptionPolicy.getBackoffMultiplier())); return currentMessageBackoff; }

Target:
public long updateAndGetCurrentMessageBackoff(SubscriptionPolicy subscriptionPolicy) { if (currentMessageBackoff == -1) { currentMessageBackoff = subscriptionPolicy.getMessageBackoff(); } else { currentMessageBackoff = Math.min(subscriptionPolicy.getBackoffMaxIntervalMillis(), (long) (currentMessageBackoff * subscriptionPolicy.getBackoffMultiplier())); } return currentMessageBackoff; }
Source:
private void executeTransferPartition(List<BlockTransferInfo> transferInfos, Consumer<Exception> exceptionHandler) { for (BlockTransferInfo transferInfo : transferInfos) { try { if (mLoadTracker.loadDetected(transferInfo.getSrcLocation(), transferInfo.getDstLocation())) { LOG.warn("Skipping transfer-order: due to user activity.", transferInfo); continue; } boolean useReservedSpace = transferInfo.isSwap(); synchronized (this) { mBlockStore.moveBlock(Sessions.createInternalSessionId(), transferInfo.getSrcBlockId(), AllocateOptions.forTierMove(transferInfo.getDstLocation()) .setUseReservedSpace(useReservedSpace)); if (transferInfo.isSwap()) { mBlockStore.moveBlock(Sessions.createInternalSessionId(), transferInfo.getDstBlockId(), AllocateOptions.forTierMove(transferInfo.getSrcLocation()) .setUseReservedSpace(useReservedSpace)); } } } catch (Exception e) { LOG.warn("Transfer-order: failed. {}. ", transferInfo, e); if (exceptionHandler != null) { exceptionHandler.accept(e); } } } }

Target:
private void executeTransferPartition(List<BlockTransferInfo> transferInfos, Consumer<Exception> exceptionHandler) { for (BlockTransferInfo transferInfo : transferInfos) { try { if (mLoadTracker.loadDetected(transferInfo.getSrcLocation(), transferInfo.getDstLocation())) { LOG.warn("Skipping transfer-order: due to user activity.", transferInfo); continue; } boolean useReservedSpace = transferInfo.isSwap(); mBlockStore.moveBlock(Sessions.createInternalSessionId(), transferInfo.getSrcBlockId(), AllocateOptions.forTierMove(transferInfo.getDstLocation()) .setUseReservedSpace(useReservedSpace)); if (transferInfo.isSwap()) { mBlockStore.moveBlock(Sessions.createInternalSessionId(), transferInfo.getDstBlockId(), AllocateOptions.forTierMove(transferInfo.getSrcLocation()) .setUseReservedSpace(useReservedSpace)); } } catch (Exception e) { LOG.warn("Transfer-order: failed. {}. ", transferInfo, e); if (exceptionHandler != null) { exceptionHandler.accept(e); } } } }
Source:
public ImmutableOptionalValue<UUID> createValue(@Nullable UUID owner) { if(owner == null) { return getEmptyValue(); } else { return createValue(Optional.of(owner)); } }

Target:
public static ImmutableOptionalValue<UUID> createValue(@Nullable UUID owner) { if(owner == null) { return getEmptyValue(); } else { return createValue(Optional.of(owner)); } }
Source:
protected Context doInBackground(Context... ctx) { listHistoryProducts = mHistoryProductDao.queryBuilder().orderDesc(HistoryProductDao.Properties.LastSeen).list(); final Bitmap defaultImgUrl = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.ic_no), 200, 200, true); for (HistoryProduct historyProduct : listHistoryProducts) { Bitmap imgUrl; HttpURLConnection connection = null; InputStream input = null; try { URL url = new URL(historyProduct.getUrl()); connection = (HttpURLConnection) url.openConnection(); connection.setDoInput(true); connection.connect(); input = connection.getInputStream(); imgUrl = Bitmap.createScaledBitmap(BitmapFactory.decodeStream(input), 200, 200, true); } catch (IOException e) { Log.i("HISTORY", "unable to get the history product image", e); imgUrl = defaultImgUrl; } finally { if (input != null) { try { input.close(); } catch (IOException e) { } } if (connection != null) { connection.disconnect(); } } productItems.add(new HistoryItem(historyProduct.getTitle(), historyProduct.getBrands(), imgUrl, historyProduct.getBarcode())); } return ctx[0]; }

Target:
protected Context doInBackground(Context... ctx) { listHistoryProducts = mHistoryProductDao.queryBuilder().orderDesc(HistoryProductDao.Properties.LastSeen).list(); for (HistoryProduct historyProduct : listHistoryProducts) { Bitmap imgUrl; HttpURLConnection connection = null; InputStream input = null; try { URL url = new URL(historyProduct.getUrl()); connection = (HttpURLConnection) url.openConnection(); connection.setDoInput(true); connection.connect(); input = connection.getInputStream(); imgUrl = Bitmap.createScaledBitmap(BitmapFactory.decodeStream(input), 200, 200, true); } catch (IOException e) { Log.i("HISTORY", "unable to get the history product image", e); Drawable drawable = getResources().getDrawable(R.drawable.ic_no_red_24dp); Canvas canvas = new Canvas(); Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); canvas.setBitmap(bitmap); drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); drawable.draw(canvas); imgUrl = bitmap; } finally { if (input != null) { try { input.close(); } catch (IOException e) { } } if (connection != null) { connection.disconnect(); } } productItems.add(new HistoryItem(historyProduct.getTitle(), historyProduct.getBrands(), imgUrl, historyProduct.getBarcode())); } return ctx[0]; }
Source:
public boolean next(Void info) { Span currentSpan = traceAccessor.getCurrentSpan(); if (currentSpan == null) { return false; } return new TraceIdToThresholdComparable(configuration.getPercentage()) .compareTo(currentSpan.getTraceId()) <= 0; }

Target:
public boolean next(Void info) { Span currentSpan = traceAccessor.getCurrentSpan(); long threshold = Math.abs(Long.MAX_VALUE * (int) (configuration.getPercentage() * 100)); if (currentSpan == null || threshold == 0L) { return false; } long traceId = currentSpan.getTraceId(); Long mod = Math.abs(traceId % 100); return mod.compareTo(threshold) <= 0; }
Source:
public void after() { if (instance != null) { instance.shutdown(); } System.setProperty(HAZELCAST_INTERNAL_OVERRIDE_ENTERPRISE, ""); }

Target:
public void after() { if (instance != null) { instance.shutdown(); } System.clearProperty(HAZELCAST_INTERNAL_OVERRIDE_ENTERPRISE); }
Source:
public ClientSecurityConfig(ClientSecurityConfig securityConfig) { if (securityConfig.identityConfig == null) { identityConfig = null; } else { Class<? extends IdentityConfig> identityType = securityConfig.identityConfig.getClass(); try { identityConfig = identityType.getConstructor(identityType).newInstance(securityConfig.identityConfig); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { identityConfig = securityConfig.identityConfig; } } }

Target:
public ClientSecurityConfig(ClientSecurityConfig securityConfig) { if (securityConfig.identityConfig == null) { identityConfig = null; } else { identityConfig = securityConfig.identityConfig.copy(); } }
Source:
public String expandTemplate(VariableMap variables) { StringBuilder builder = new StringBuilder(); for (NameFragment fragment : name) { if (fragment.isVariable()) { String value = variables.getValue(fragment.getVariable()); checkArgument(value != null, "unresolved variable '%s' in resource group '%s', available: %s", fragment.getVariable(), this, variables); builder.append(value); } else { builder.append(fragment.getLiteral()); } } return builder.toString(); }

Target:
public String expandTemplate(VariableMap variables) { StringBuilder builder = new StringBuilder(); for (NameFragment fragment : fragments) { if (fragment.isVariable()) { String value = variables.getValue(fragment.getVariable()); checkArgument(value != null, "unresolved variable '%s' in resource group '%s', available: %s", fragment.getVariable(), this, variables); builder.append(value); } else { builder.append(fragment.getLiteral()); } } return builder.toString(); }
Source:
public int asInt() { String result = value.replaceAll("_", ""); if (result.startsWith("0x")) { return Integer.parseUnsignedInt(result.substring(2), 16); } if (result.startsWith("0b")) { return Integer.parseUnsignedInt(result.substring(2), 2); } if (result.startsWith("0")) { return Integer.parseUnsignedInt(result.substring(1), 8); } return Integer.parseInt(result); }

Target:
public int asInt() { String result = value.replaceAll("_", ""); if (result.startsWith("0x") || result.startsWith("0X")) { return Integer.parseUnsignedInt(result.substring(2), 16); } if (result.startsWith("0b") || result.startsWith("0B")) { return Integer.parseUnsignedInt(result.substring(2), 2); } if (result.length() > 1 && result.startsWith("0")) { return Integer.parseUnsignedInt(result.substring(1), 8); } return Integer.parseInt(result); }
Source:
private static Object optimize(@Language("SQL") String expression) { assertRoundTrip(expression); Expression parsedExpression = FunctionAssertions.createExpression(expression, METADATA, SYMBOL_TYPES); Map<NodeRef<Expression>, Type> expressionTypes = getExpressionTypes(TEST_SESSION, METADATA, SQL_PARSER, SYMBOL_TYPES, parsedExpression, emptyList(), WarningCollector.NOOP); ExpressionInterpreter interpreter = expressionOptimizer(parsedExpression, METADATA, TEST_SESSION, expressionTypes); Object expressionResult = interpreter.optimize(symbol -> { Object value = symbolConstant(symbol); if (value == null) { return symbol.toSymbolReference(); } return value; }); return expressionResult; }

Target:
private static Object optimize(@Language("SQL") String expression) { assertRoundTrip(expression); Expression parsedExpression = FunctionAssertions.createExpression(expression, METADATA, SYMBOL_TYPES); Map<NodeRef<Expression>, Type> expressionTypes = getExpressionTypes(TEST_SESSION, METADATA, SQL_PARSER, SYMBOL_TYPES, parsedExpression, emptyList(), WarningCollector.NOOP); ExpressionInterpreter interpreter = expressionOptimizer(parsedExpression, METADATA, TEST_SESSION, expressionTypes); Object expressionResult = interpreter.optimize(symbol -> { Object value = symbolConstant(symbol); if (value == null) { return symbol.toSymbolReference(); } return value; }); RowExpression rowExpression = TRANSLATOR.translate(parsedExpression, SYMBOL_TYPES); Object rowExpressionResult = new RowExpressionInterpreter(rowExpression, METADATA, TEST_SESSION.toConnectorSession(), true).optimize(symbol -> { Object value = symbolConstant(symbol); if (value == null) { return new VariableReferenceExpression(symbol.getName(), SYMBOL_TYPES.get(symbol)); } return value; }); assertExpressionAndRowExpressionEquals(expressionResult, rowExpressionResult); return expressionResult; }
Source:
protected synchronized void executeRule(Rule rule, RuleEvaluationContext context) { scheduler.schedule(() -> { Script script = scriptEngine.newScriptFromXExpression(rule.getScript()); logger.debug("Executing rule '{}'", rule.getName()); context.setGlobalContext(RuleContextHelper.getContext(rule, injector)); try { script.execute(context); } catch (Exception e) { String msg = e.getMessage(); if (msg == null) { logger.error("Rule '{}'", rule.getName(), e.getCause()); } else { logger.error("Rule '{}': {}", rule.getName(), msg); } } }, 0, TimeUnit.SECONDS); }

Target:
protected synchronized void executeRule(Rule rule, RuleEvaluationContext context) { scheduler.execute(() -> { Script script = scriptEngine.newScriptFromXExpression(rule.getScript()); logger.debug("Executing rule '{}'", rule.getName()); context.setGlobalContext(RuleContextHelper.getContext(rule, injector)); try { script.execute(context); } catch (Exception e) { String msg = e.getMessage(); if (msg == null) { logger.error("Rule '{}'", rule.getName(), e.getCause()); } else { logger.error("Rule '{}': {}", rule.getName(), msg); } } }); }
Source:
public Properties getObject() { loadBaseProperties(); props.putAll(BASE_PROPERTIES); if (secureMode) { loadPropertyList(props,SECURITY_PROPERTY_FILE_NAME_KEY); } else { loadPropertyList(props,PROPERTY_FILE_NAMES_KEY); if (testMode) { loadPropertyList(props,PROPERTY_TEST_FILE_NAMES_KEY); } } if (StringUtils.isBlank(System.getProperty(HTTP_URL_PROPERTY_NAME))) { props.put(KSB_REMOTING_URL_PROPERTY_NAME, props.getProperty(KFSConstants.APPLICATION_URL_KEY) + REMOTING_URL_SUFFIX); } else { props.put(KSB_REMOTING_URL_PROPERTY_NAME, new StringBuilder("http://").append(System.getProperty(HTTP_URL_PROPERTY_NAME)).append("/kfs-").append(props.getProperty(KFSConstants.ENVIRONMENT_KEY)).append(REMOTING_URL_SUFFIX).toString()); } if (LOG.isDebugEnabled()) { for (Iterator itr = props.keySet().iterator(); itr.hasNext(); ) { String key = (String) itr.next(); String value = (String) props.get(key); System.out.println(key + ": " + value); LOG.debug(key + ": " + value); } } return props; }

Target:
public Properties getObject() { loadBaseProperties(); props.putAll(BASE_PROPERTIES); if (secureMode) { loadPropertyList(props,SECURITY_PROPERTY_FILE_NAME_KEY); } else { loadPropertyList(props,PROPERTY_FILE_NAMES_KEY); if (testMode) { loadPropertyList(props,PROPERTY_TEST_FILE_NAMES_KEY); } } if (StringUtils.isBlank(System.getProperty(HTTP_URL_PROPERTY_NAME))) { props.put(KSB_REMOTING_URL_PROPERTY_NAME, props.getProperty(KFSConstants.APPLICATION_URL_KEY) + REMOTING_URL_SUFFIX); } else { props.put(KSB_REMOTING_URL_PROPERTY_NAME, new StringBuilder("http://").append(System.getProperty(HTTP_URL_PROPERTY_NAME)).append("/kfs-").append(props.getProperty(KFSConstants.ENVIRONMENT_KEY)).append(REMOTING_URL_SUFFIX).toString()); } if (LOG.isDebugEnabled()) { for (Object key: props.keySet()) { String value = (String) props.get(key); System.out.println(key + ": " + value); LOG.debug(key + ": " + value); } } return props; }
Source:
public Object select(String id, Object defaultValue, ParamOption[] options) { if (defaultValue == null) { defaultValue = options[0].getValue(); } forms.put(id, new Select(id, defaultValue, options)); Object value = params.get(id); if (value == null) { value = defaultValue; params.put(id, value); } return value; }

Target:
public Object select(String id, Object defaultValue, ParamOption[] options) { if (defaultValue == null && options != null && options.length > 0) { defaultValue = options[0].getValue(); } forms.put(id, new Select(id, defaultValue, options)); Object value = params.get(id); if (value == null) { value = defaultValue; params.put(id, value); } return value; }
Source:
private void removeNode(long address) { boolean middleNode = true; if (address == lastAddress) { if (trace) { log.tracef("Removed LRU node at end 0x%016x", address); } long previousLRUNode = OffHeapLruNode.getPrevious(address); if (previousLRUNode != 0) { OffHeapLruNode.setNext(previousLRUNode, 0); } lastAddress = previousLRUNode; middleNode = false; } if (address == firstAddress) { if (trace) { log.tracef("Removing LRU node at beginning 0x%016x", address); } long nextLRUNode = OffHeapLruNode.getNext(address); if (nextLRUNode != 0) { OffHeapLruNode.setPrevious(nextLRUNode, 0); } firstAddress = nextLRUNode; middleNode = false; } if (middleNode) { if (trace) { log.tracef("Removing middle LRU node at 0x%016x", address); } long previousLRUNode = OffHeapLruNode.getPrevious(address); long nextLRUNode = OffHeapLruNode.getNext(address); assert previousLRUNode != 0; assert nextLRUNode != 0; OffHeapLruNode.setNext(previousLRUNode, nextLRUNode); OffHeapLruNode.setPrevious(nextLRUNode, previousLRUNode); } }

Target:
private void removeNode(long address) { boolean middleNode = true; if (address == lastAddress) { if (trace) { log.tracef("Removed entry 0x%016x from the end of the LRU list", address); } long previousLRUNode = OffHeapLruNode.getPrevious(address); if (previousLRUNode != 0) { OffHeapLruNode.setNext(previousLRUNode, 0); } lastAddress = previousLRUNode; middleNode = false; } if (address == firstAddress) { if (trace) { log.tracef("Removed entry 0x%016x from the beginning of the LRU list", address); } long nextLRUNode = OffHeapLruNode.getNext(address); if (nextLRUNode != 0) { OffHeapLruNode.setPrevious(nextLRUNode, 0); } firstAddress = nextLRUNode; middleNode = false; } if (middleNode) { if (trace) { log.tracef("Removed entry 0x%016x from the middle of the LRU list", address); } long previousLRUNode = OffHeapLruNode.getPrevious(address); long nextLRUNode = OffHeapLruNode.getNext(address); assert previousLRUNode != 0; assert nextLRUNode != 0; OffHeapLruNode.setNext(previousLRUNode, nextLRUNode); OffHeapLruNode.setPrevious(nextLRUNode, previousLRUNode); } }
Source:
public void markAsDeleted(StoreKey id, FileSpan fileSpan) throws StoreException { verifyFileEndOffset(fileSpan); IndexValue value = findKey(id); if (value == null) { throw new StoreException("id " + id + " not present in index " + dataDir, StoreErrorCodes.ID_Not_Found); } value.setFlag(IndexValue.Flags.Delete_Index); value.setNewOffset(fileSpan.getStartOffset()); value.setNewSize(fileSpan.getEndOffset() - fileSpan.getStartOffset()); indexes.lastEntry().getValue().addEntry(new IndexEntry(id, value), fileSpan.getEndOffset()); journal.addEntry(fileSpan.getStartOffset(), id); }

Target:
public void markAsDeleted(StoreKey id, FileSpan fileSpan) throws StoreException { verifyFileEndOffset(fileSpan); IndexValue value = findKey(id); if (value == null) { throw new StoreException("Id " + id + " not present in index " + dataDir, StoreErrorCodes.ID_Not_Found); } value.setFlag(IndexValue.Flags.Delete_Index); value.setNewOffset(fileSpan.getStartOffset()); value.setNewSize(fileSpan.getEndOffset() - fileSpan.getStartOffset()); indexes.lastEntry().getValue().addEntry(new IndexEntry(id, value), fileSpan.getEndOffset()); journal.addEntry(fileSpan.getStartOffset(), id); }
Source:
void populateEnvContextShouldSetMaterialEnvVars() { HgMaterial material = new HgMaterial("<LINK_3>", "folder"); EnvironmentVariableContext ctx = new EnvironmentVariableContext(); final ArrayList<Modification> modifications = new ArrayList<>(); modifications.add(new Modification("user2", "comment2", "email2", new Date(), "24")); modifications.add(new Modification("user1", "comment1", "email1", new Date(), "23")); MaterialRevision materialRevision = new MaterialRevision(material, modifications); assertThat(ctx.getProperty(ScmMaterial.GO_MATERIAL_URL)).isNull(); assertThat(ctx.getProperty(GitMaterial.GO_MATERIAL_BRANCH)).isNull(); material.populateEnvironmentContext(ctx, materialRevision, new File(".")); String propertySuffix = material.getMaterialNameForEnvironmentVariable(); assertThat(ctx.getProperty(format("%s_%s", ScmMaterial.GO_MATERIAL_URL, propertySuffix))).isEqualTo("<LINK_1>"); assertThat(ctx.getProperty(format("%s_%s", GitMaterial.GO_MATERIAL_BRANCH, propertySuffix))).isEqualTo("default"); }

Target:
void populateEnvContextShouldSetMaterialEnvVars() { HgMaterial material = new HgMaterial("<LINK_0>", "folder"); material.setBranch("branchName"); EnvironmentVariableContext ctx = new EnvironmentVariableContext(); final ArrayList<Modification> modifications = new ArrayList<>(); modifications.add(new Modification("user2", "comment2", "email2", new Date(), "24")); modifications.add(new Modification("user1", "comment1", "email1", new Date(), "23")); MaterialRevision materialRevision = new MaterialRevision(material, modifications); assertThat(ctx.getProperty(ScmMaterial.GO_MATERIAL_URL)).isNull(); assertThat(ctx.getProperty(GitMaterial.GO_MATERIAL_BRANCH)).isNull(); material.populateEnvironmentContext(ctx, materialRevision, new File(".")); String propertySuffix = material.getMaterialNameForEnvironmentVariable(); assertThat(ctx.getProperty(format("%s_%s", ScmMaterial.GO_MATERIAL_URL, propertySuffix))).isEqualTo("<LINK_2>"); assertThat(ctx.getProperty(format("%s_%s", GitMaterial.GO_MATERIAL_BRANCH, propertySuffix))).isEqualTo("branchName"); }
Source:
public TwitterBuilder() { super(TwitterAuthProvider.PROVIDER_ID); try { Class c = com.twitter.sdk.android.core.TwitterCore.class; } catch (NoClassDefFoundError e) { throw new RuntimeException( "Twitter provider cannot be configured " + "without dependency. Did you forget to add " + "'com.twitter.sdk.android:twitter-core:VERSION' dependency?"); } if (getApplicationContext().getString(R.string.twitter_consumer_key) .equals(UNCONFIGURED_CONFIG_VALUE) || getApplicationContext().getString(R.string.twitter_consumer_secret) .equals(UNCONFIGURED_CONFIG_VALUE)) { throw new RuntimeException("Twitter provider unconfigured. Make sure to add" + " your key and secret. See the docs for more info:" + " <LINK_0>"); } }

Target:
public TwitterBuilder() { super(TwitterAuthProvider.PROVIDER_ID); try { Class c = com.twitter.sdk.android.core.TwitterCore.class; } catch (NoClassDefFoundError e) { throw new RuntimeException( "Twitter provider cannot be configured " + "without dependency. Did you forget to add " + "'com.twitter.sdk.android:twitter-core:VERSION' dependency?"); } Preconditions.checkConfigured(getApplicationContext(), "Twitter provider unconfigured. Make sure to add your key and secret." + " See the docs for more info:" + " <LINK_0>", R.string.twitter_consumer_key, R.string.twitter_consumer_secret); }