auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void shouldProvisionEnvironmentVariablesSorted() throws InfrastructureException { List<EnvVar> preExistingEnvironment = new ArrayList<>(); preExistingEnvironment.add(new EnvVar(PRE_EXISTING_VAR, PRE_EXISTING_VAR_VALUE, null)); testContainer.setEnv(preExistingEnvironment); machine.getEnv().put(PRE_EXISTING_VAR, PRE_EXISTING_VAR_NEW_VALUE); machine.getEnv().put(A_VAR, A_VAL); machine.getEnv().put(B_VAR, B_VAL); machine.getEnv().put(C_VAR, C_VAL); EnvVarsConverter converter = new EnvVarsConverter(); converter.provision(environment, identity); EnvVar expectedA = new EnvVar(A_VAR, A_VAL, null); EnvVar expectedB = new EnvVar(B_VAR, B_VAL, null); EnvVar expectedC = new EnvVar(C_VAR, C_VAL, null); EnvVar expectedPreExisting = new EnvVar(PRE_EXISTING_VAR, PRE_EXISTING_VAR_NEW_VALUE, null); assertEquals(4, testContainer.getEnv().size()); assertEquals(expectedB, testContainer.getEnv().get(0)); assertEquals(expectedC, testContainer.getEnv().get(1)); assertEquals(expectedA, testContainer.getEnv().get(2)); assertEquals(expectedPreExisting, testContainer.getEnv().get(3)); }

Target:
public void shouldProvisionEnvironmentVariablesSorted() throws InfrastructureException { List<EnvVar> preExistingEnvironment = new ArrayList<>(); preExistingEnvironment.add(new EnvVar(PRE_EXISTING_VAR, PRE_EXISTING_VAR_VALUE, null)); testContainer.setEnv(preExistingEnvironment); machine.getEnv().put(PRE_EXISTING_VAR, PRE_EXISTING_VAR_NEW_VALUE); machine.getEnv().put(A_VAR, A_VAL); machine.getEnv().put(B_VAR, B_VAL); machine.getEnv().put(C_VAR, C_VAL); EnvVarsConverter converter = new EnvVarsConverter(); converter.provision(environment, identity); EnvVar expectedA = new EnvVar(A_VAR, A_VAL, null); EnvVar expectedB = new EnvVar(B_VAR, B_VAL, null); EnvVar expectedC = new EnvVar(C_VAR, C_VAL, null); EnvVar expectedPreExisting = new EnvVar(PRE_EXISTING_VAR, PRE_EXISTING_VAR_NEW_VALUE, null); List<EnvVar> expectedOrder = asList(expectedB, expectedC, expectedA, expectedPreExisting); assertEquals(4, testContainer.getEnv().size()); assertEquals(expectedOrder, testContainer.getEnv()); }
Source:
public void runCommand(String[] args) throws Exception { if (args.length == 0) { this.showDocumentation(); return; } Object[] ss = new String[args.length - 1]; System.arraycopy(args, 1, ss, 0, args.length - 1); boolean foundMethod = false; boolean incorrectParams = false; Method[] mList = type.getMethods(); for (Method m : mList) { if (Modifier.isStatic(m.getModifiers())) { if (m.getName().equals(args[0])) { foundMethod = true; if (ss.length != m.getParameterTypes().length) { incorrectParams = true; } else { incorrectParams = false; Object o = m.invoke(null, ss); if (o != null) { logger.info(o.toString()); } } } if (foundMethod && !incorrectParams) break; } } if (!foundMethod) { logger.info("Unable to find " + args[0]); this.showDocumentation(); String nearest = getNearestCommand(mList, args[0]); logger.info("Did you mean: " + nearest); } else if (incorrectParams) { logger.info("Invalid usage of " + args[0]); int i = 1; for (Method elem : type.getMethods()) { if (Modifier.isStatic(elem.getModifiers())) { if (elem.isAnnotationPresent(CommandIgnore.class)) continue; if (elem.getName().equals(args[0])) { printMethodSignature(i, elem); i++; } } } } }

Target:
public void runCommand(String[] args) throws Exception { if (args.length == 0) { this.showDocumentation(); return; } Object[] ss = new String[args.length - 1]; System.arraycopy(args, 1, ss, 0, args.length - 1); boolean foundMethod = false; boolean incorrectParams = false; Method[] mList = type.getMethods(); for (Method m : mList) { if (Modifier.isStatic(m.getModifiers())) { if (m.getName().equals(args[0])) { foundMethod = true; if (ss.length != m.getParameterTypes().length) { incorrectParams = true; } else { incorrectParams = false; Object o = m.invoke(null, ss); if (o != null) { System.out.println(o.toString()); } } } if (foundMethod && !incorrectParams) break; } } if (!foundMethod) { System.out.println("Unable to find " + args[0]); this.showDocumentation(); String nearest = getNearestCommand(mList, args[0]); System.out.println("Did you mean: " + nearest); } else if (incorrectParams) { System.out.println("Invalid usage of " + args[0]); int i = 1; for (Method elem : type.getMethods()) { if (Modifier.isStatic(elem.getModifiers())) { if (elem.isAnnotationPresent(CommandIgnore.class)) continue; if (elem.getName().equals(args[0])) { printMethodSignature(i, elem); i++; } } } } }
Source:
public QueryRunner<Result<SearchResultValue>> preMergeQueryDecoration(final QueryRunner<Result<SearchResultValue>> runner) { return new SearchThresholdAdjustingQueryRunner( intervalChunkingQueryRunnerDecorator.decorate( new QueryRunner<Result<SearchResultValue>>() { @Override public Sequence<Result<SearchResultValue>> run( Query<Result<SearchResultValue>> query, Map<String, Object> responseContext ) { if (!(query instanceof SearchQuery)) { return runner.run(query, responseContext); } else { SearchQuery searchQuery = (SearchQuery) query; if (searchQuery.getDimensionsFilter() != null) { searchQuery = searchQuery.withDimFilter(searchQuery.getDimensionsFilter().optimize()); } return runner.run(searchQuery, responseContext); } } } , this), config ); }

Target:
public QueryRunner<Result<SearchResultValue>> preMergeQueryDecoration(final QueryRunner<Result<SearchResultValue>> runner) { return new SearchThresholdAdjustingQueryRunner( intervalChunkingQueryRunnerDecorator.decorate( new QueryRunner<Result<SearchResultValue>>() { @Override public Sequence<Result<SearchResultValue>> run( Query<Result<SearchResultValue>> query, Map<String, Object> responseContext ) { SearchQuery searchQuery = (SearchQuery) query; if (searchQuery.getDimensionsFilter() != null) { searchQuery = searchQuery.withDimFilter(searchQuery.getDimensionsFilter().optimize()); } return runner.run(searchQuery, responseContext); } } , this), config ); }
Source:
public static Set<Mapping> fromMappingsPrism(MappingsPrism mappingsAnnotation, ExecutableElement method, FormattingMessager messager, Types typeUtils) { Set<Mapping> mappings = new LinkedHashSet<>(); for ( MappingPrism mappingPrism : mappingsAnnotation.value() ) { Mapping mapping = fromMappingPrism( mappingPrism, method, messager, typeUtils ); if ( mapping != null ) { if ( !mappings.add( mapping ) ) { messager.printMessage( method, Message.PROPERTYMAPPING_DUPLICATE_TARGETS, mappingPrism.target() ); } } } return mappings; }

Target:
public static Set<Mapping> fromMappingsPrism(MappingsPrism mappingsAnnotation, ExecutableElement method, FormattingMessager messager, Types typeUtils) { Set<Mapping> mappings = new LinkedHashSet<>(); for ( MappingPrism mappingPrism : mappingsAnnotation.value() ) { Mapping mapping = fromMappingPrism( mappingPrism, method, messager, typeUtils ); if ( mapping != null ) { if ( mappings.contains( mapping ) ) { messager.printMessage( method, Message.PROPERTYMAPPING_DUPLICATE_TARGETS, mappingPrism.target() ); } else { mappings.add( mapping ); } } } return mappings; }
Source:
private int minimizeCrossingsWithCounter(final GraphInfoHolder gData) { boolean isForwardSweep = random.nextBoolean(); if (!gData.lGraph().hasProperty(InternalProperties.FIRST_TRY_WITH_INITIAL_ORDER) || gData.lGraph().getProperty(LayeredOptions.PRESERVE_ORDER) == OrderingStrategy.NONE) { gData.crossMinimizer().setFirstLayerOrder(gData.currentNodeOrder(), isForwardSweep); } else { isForwardSweep = true; gData.lGraph().setProperty(InternalProperties.FIRST_TRY_WITH_INITIAL_ORDER, null); } sweepReducingCrossings(gData, isForwardSweep, true); int crossingsInGraph = countCurrentNumberOfCrossings(gData); int oldNumberOfCrossings; do { setCurrentlyBestNodeOrders(); if (crossingsInGraph == 0) { return 0; } isForwardSweep = !isForwardSweep; oldNumberOfCrossings = crossingsInGraph; sweepReducingCrossings(gData, isForwardSweep, false); crossingsInGraph = countCurrentNumberOfCrossings(gData); } while (oldNumberOfCrossings > crossingsInGraph); return oldNumberOfCrossings; }

Target:
private int minimizeCrossingsWithCounter(final GraphInfoHolder gData) { boolean isForwardSweep = random.nextBoolean(); if (!gData.lGraph().getProperty(InternalProperties.FIRST_TRY_WITH_INITIAL_ORDER) || gData.lGraph().getProperty(LayeredOptions.CONSIDER_MODEL_ORDER) == OrderingStrategy.NONE) { gData.crossMinimizer().setFirstLayerOrder(gData.currentNodeOrder(), isForwardSweep); } else { isForwardSweep = true; } sweepReducingCrossings(gData, isForwardSweep, true); gData.lGraph().setProperty(InternalProperties.FIRST_TRY_WITH_INITIAL_ORDER, false); int crossingsInGraph = countCurrentNumberOfCrossings(gData); int oldNumberOfCrossings; do { setCurrentlyBestNodeOrders(); if (crossingsInGraph == 0) { return 0; } isForwardSweep = !isForwardSweep; oldNumberOfCrossings = crossingsInGraph; sweepReducingCrossings(gData, isForwardSweep, false); crossingsInGraph = countCurrentNumberOfCrossings(gData); } while (oldNumberOfCrossings > crossingsInGraph); return oldNumberOfCrossings; }
Source:
public boolean isTypeSupported(Class<T> clazz) { if (String.class.isAssignableFrom(clazz) || Integer.class.isAssignableFrom(clazz) || Boolean.class.isAssignableFrom(clazz)) { return true; } return false; }

Target:
protected boolean isTypeSupported(Class<T> clazz) { if (String.class.isAssignableFrom(clazz) || Integer.class.isAssignableFrom(clazz) || Boolean.class.isAssignableFrom(clazz)) { return true; } return false; }
Source:
public int visit(Object element, Object parent, int depth) { int minDepth = depth; if (isVisited(element)) { if(getVisitedDepth(element) > 0 ) { isCyclic = true; } return getVisitedDepth(element); } setVisited(element, depth); beginVisit(element, parent, depth ); Iterator itr = getElementLinks(element); if (itr != null) { while (itr.hasNext()) { int childDepth = visit(itr.next(), element, depth + 1); minDepth = ((childDepth < minDepth) && (childDepth > -1)) ? childDepth : minDepth; linkCount++; } } setVisited(element, -1); endVisit(element, parent, depth, minDepth); return (minDepth < depth) ? minDepth : depth; }

Target:
private int visit(Object element, Object parent, int depth) { int minDepth = depth; if (isVisited(element)) { if(getVisitedDepth(element) > 0 ) { isCyclic = true; } return getVisitedDepth(element); } setVisited(element, depth); beginVisit(element, parent, depth ); Iterator itr = getElementLinks(element); if (itr != null) { while (itr.hasNext()) { int childDepth = visit(itr.next(), element, depth + 1); minDepth = ((childDepth < minDepth) && (childDepth > -1)) ? childDepth : minDepth; linkCount++; } } setVisited(element, -1); endVisit(element, parent, depth, minDepth); return (minDepth < depth) ? minDepth : depth; }
Source:
public void realmObject_emittedOnSubscribe() { realm.beginTransaction(); final AllJavaTypes obj = realm.createObject(AllJavaTypes.class, 42); realm.commitTransaction(); subscription = obj.<AllJavaTypes>asFlowable().subscribe(rxObject -> { assertTrue(rxObject.isFrozen()); assertNotEquals(rxObject, obj); assertEquals(rxObject.getFieldId(), obj.getFieldId()); looperThread.testComplete(); }); }

Target:
public void realmObject_emittedOnSubscribe() { realm.beginTransaction(); final AllJavaTypes obj = realm.createObject(AllJavaTypes.class, 42); realm.commitTransaction(); subscription = obj.<AllJavaTypes>asFlowable().subscribe(rxObject -> { assertTrue(rxObject.isFrozen()); assertNotEquals(rxObject, obj); assertEquals(rxObject.getFieldId(), obj.getFieldId()); disposeSuccessfulTest(realm); }); }
Source:
protected void markSectionAsSpecial(Map<String, Boolean> isSectionSpecialMappings, Map<String, List<String>> specialSectionsInSectionGroups, int sectionGroupIndex, String sectionToMark) { String sectionGroupParamName = Const.ParamsNames.INSTRUCTOR_SECTION_GROUP + sectionGroupIndex; specialSectionsInSectionGroups.putIfAbsent(sectionGroupParamName, new ArrayList<String>()); specialSectionsInSectionGroups.get(sectionGroupParamName).add(sectionToMark); isSectionSpecialMappings.put(sectionToMark, true); }

Target:
protected void markSectionAsSpecial(Map<String, Boolean> isSectionSpecialMappings, Map<String, List<String>> specialSectionsInSectionGroups, int sectionGroupIndex, String sectionToMark) { String sectionGroupParamName = Const.ParamsNames.INSTRUCTOR_SECTION_GROUP + sectionGroupIndex; specialSectionsInSectionGroups.computeIfAbsent(sectionGroupParamName, string -> new ArrayList<>()) .add(sectionToMark); isSectionSpecialMappings.put(sectionToMark, true); }
Source:
private boolean isAttributeValueMatching(Attribute entityAttribute, String value) throws InternalErrorException { boolean shouldBeAccepted = true; if(entityAttribute.getValue() == null) { if(value!=null && !value.isEmpty()) { shouldBeAccepted = false; } } else { if (entityAttribute.getValue() instanceof String) { String attrValue = (String) entityAttribute.getValue(); if (!attrValue.equals(value)) { shouldBeAccepted = false; } } else if (entityAttribute.getValue() instanceof Integer) { Integer attrValue = (Integer) entityAttribute.getValue(); Integer valueInInteger = Integer.valueOf(value); if (attrValue.intValue() != valueInInteger.intValue()) { shouldBeAccepted = false; } } else { throw new InternalErrorException("Core attribute: " + entityAttribute + " is not type of String or Integer!"); } } return shouldBeAccepted; }

Target:
private boolean isAttributeValueMatching(Attribute entityAttribute, String value) throws InternalErrorException { boolean shouldBeAccepted = true; if(entityAttribute.getValue() == null) { if(value!=null && !value.isEmpty()) { shouldBeAccepted = false; } } else { if (entityAttribute.getValue() instanceof String) { String attrValue = entityAttribute.valueAsString(); if (!attrValue.equals(value)) { shouldBeAccepted = false; } } else if (entityAttribute.getValue() instanceof Integer) { Integer attrValue = entityAttribute.valueAsInteger(); Integer valueInInteger = Integer.valueOf(value); if (attrValue.intValue() != valueInInteger.intValue()) { shouldBeAccepted = false; } } else { throw new InternalErrorException("Core attribute: " + entityAttribute + " is not type of String or Integer!"); } } return shouldBeAccepted; }
Source:
public <V> BlockState with(final Property<V> property, final V value) { BlockState result = states.get(property, value); return result == null ? this : result; }

Target:
public <V> BlockState with(final Property<V> property, final V value) { return states.row(property).getOrDefault(value, this); }
Source:
private static void writeParam(JsonWriter writer, WebService.Param param) { writer.beginObject(); writer.prop("key", param.key()); writer.prop("description", param.description()); writer.prop("since", param.since()); writer.prop("required", param.isRequired()); writer.prop("internal", param.isInternal()); writer.prop("defaultValue", param.defaultValue()); writer.prop("exampleValue", param.exampleValue()); writer.prop("deprecatedSince", param.deprecatedSince()); writer.prop("deprecatedKey", param.deprecatedKey()); writer.prop("deprecatedKeySince", param.deprecatedKeySince()); writer.prop("maxValuesAllowed", param.maxValuesAllowed()); Set<String> possibleValues = param.possibleValues(); if (possibleValues != null) { writer.name("possibleValues").beginArray().values(possibleValues).endArray(); } Integer maximumLength = param.maximumLength(); if (maximumLength != null) { writer.prop("maximumLength", maximumLength); } writer.endObject(); }

Target:
private static void writeParam(JsonWriter writer, WebService.Param param) { writer.beginObject(); writer.prop("key", param.key()); writer.prop("description", param.description()); writer.prop("since", param.since()); writer.prop("required", param.isRequired()); writer.prop("internal", param.isInternal()); writer.prop("defaultValue", param.defaultValue()); writer.prop("exampleValue", param.exampleValue()); writer.prop("deprecatedSince", param.deprecatedSince()); writer.prop("deprecatedKey", param.deprecatedKey()); writer.prop("deprecatedKeySince", param.deprecatedKeySince()); writer.prop("maxValuesAllowed", param.maxValuesAllowed()); ofNullable(param.possibleValues()).ifPresent(possibleValues -> writer.name("possibleValues").beginArray().values(possibleValues).endArray()); ofNullable(param.maximumLength()).ifPresent(maximumLength -> writer.prop("maximumLength", maximumLength)); ofNullable(param.maximumValue()).ifPresent(maximumValue -> writer.prop("maximumValue", maximumValue)); writer.endObject(); }
Source:
public void testAccountBuilder() throws JSONException { AccountBuilder accountBuilder = new AccountBuilder(refAccountId, refAccountName, refAccountStatus, null); Account accountByBuilder = accountBuilder.build(); assertAccountAgainstReference(accountByBuilder, false, false, LATEST_CONTAINER_JSON_VERSION); List<Container> containers = new ArrayList<>(); for (int i = 0; i < CONTAINER_COUNT; i++) { Container container = Container.fromJson(v2ContainerJsonList.get(i), refAccountId); containers.add(container); accountBuilder.addOrUpdateContainer(container); } accountByBuilder = accountBuilder.build(); assertAccountAgainstReference(accountByBuilder, true, true, LATEST_CONTAINER_JSON_VERSION); accountBuilder = new AccountBuilder(accountByBuilder); Account account2ByBuilder = accountBuilder.build(); assertAccountAgainstReference(account2ByBuilder, true, true, LATEST_CONTAINER_JSON_VERSION); }

Target:
public void testAccountBuilder() throws JSONException { AccountBuilder accountBuilder = new AccountBuilder(refAccountId, refAccountName, refAccountStatus, null); Account accountByBuilder = accountBuilder.build(); assertAccountAgainstReference(accountByBuilder, false, false); List<Container> containers = new ArrayList<>(); for (int i = 0; i < CONTAINER_COUNT; i++) { Container container = Container.fromJson(containerJsonList.get(i), refAccountId); containers.add(container); accountBuilder.addOrUpdateContainer(container); } accountByBuilder = accountBuilder.build(); assertAccountAgainstReference(accountByBuilder, true, true); accountBuilder = new AccountBuilder(accountByBuilder); Account account2ByBuilder = accountBuilder.build(); assertAccountAgainstReference(account2ByBuilder, true, true); }
Source:
public int getFreeThreadCount() { return executor.getMaxThreads() + executor.getIdleThreads() - executor.getThreads(); }

Target:
public int getFreeThreadCount() { return (executor.getMaxThreads() - executor.getThreads()) + executor.getIdleThreads() ; }
Source:
public void testHorizontalAlignment() { m_label.setHorizontalAlignmentFromScout(-1); String text = ((JTextPane) m_label.getSwingField()).getText(); assertTrue(text.contains("align=\"left\"")); m_label.setHorizontalAlignmentFromScout(0); text = ((JTextPane) m_label.getSwingField()).getText(); assertTrue(text.contains("align=\"center\"")); m_label.setHorizontalAlignmentFromScout(1); text = ((JTextPane) m_label.getSwingField()).getText(); assertTrue(text.contains("align=\"right\"")); }

Target:
public void testHorizontalAlignment() { m_label.setHorizontalAlignmentFromScout(LABEL_HORIZONTAL_ALIGNMENT_LEFT); String text = ((JTextPane) m_label.getSwingField()).getText(); assertTrue(text.contains("align=\"left\"")); m_label.setHorizontalAlignmentFromScout(LABEL_HORIZONTAL_ALIGNMENT_CENTER); text = ((JTextPane) m_label.getSwingField()).getText(); assertTrue(text.contains("align=\"center\"")); m_label.setHorizontalAlignmentFromScout(LABEL_HORIZONTAL_ALIGNMENT_RIGHT); text = ((JTextPane) m_label.getSwingField()).getText(); assertTrue(text.contains("align=\"right\"")); }
Source:
public long countEvents(AuditEvent eventTemplate, Calendar fromTime, Calendar toTime) { try { Session session = this.sessionFactory.getSessionFactory().openSession(); Criteria c = session.createCriteria(AuditEvent.class); if (eventTemplate != null) { c.add(Example.create(eventTemplate)); } setTimeInterval(c, fromTime, toTime); c.setProjection(Projections.rowCount()); @SuppressWarnings("rawtypes") List foundEntries = c.list(); if (foundEntries != null && !foundEntries.isEmpty()) { long rowCount = (long) foundEntries.get(0); return rowCount; } return 0; } catch (HibernateException ex) { this.logger.error("Failed to count audit event documents: {}", ex.getMessage(), ex); return -1; } }

Target:
public long countEvents(AuditEvent eventTemplate, Calendar fromTime, Calendar toTime) { try { Session session = this.sessionFactory.getSessionFactory().openSession(); Criteria c = session.createCriteria(AuditEvent.class); if (eventTemplate != null) { c.add(Example.create(eventTemplate)); } setTimeInterval(c, fromTime, toTime); c.setProjection(Projections.rowCount()); @SuppressWarnings("rawtypes") List foundEntries = c.list(); if (foundEntries != null && !foundEntries.isEmpty()) { return (long) foundEntries.get(0); } return 0; } catch (HibernateException ex) { this.logger.error("Failed to count audit event documents: {}", ex.getMessage(), ex); return -1; } }
Source:
private <T extends Item> List<T> executeQuery(final KeySetQuery query, final Class<T> itemClass) { final ItemConfiguration itemConfiguration = getItemConfiguration(itemClass); final String tableName = databaseSchemaHolder.schemaName() + "." + itemConfiguration.tableName(); final List<List<ItemId>> split_ids = split(new ArrayList<ItemId>(query.itemIds()), 100); final List<T> fetchedItems = new ArrayList<T>(); for (final List<ItemId> ids : split_ids) { final TableKeysAndAttributes keys = new TableKeysAndAttributes(tableName); for (final ItemId id : ids) { keys.addPrimaryKey(getPrimaryKey(id, itemConfiguration)); } BatchGetItemOutcome outcome = dynamoDBClient.batchGetItem(keys); do { final List<com.amazonaws.services.dynamodbv2.document.Item> items = outcome.getTableItems().get( tableName); for (final com.amazonaws.services.dynamodbv2.document.Item item : items) { fetchedItems.add(stringToItem(item.toJSON(), itemClass)); } final Map<String, KeysAndAttributes> unprocessedKeys = outcome.getUnprocessedKeys(); if (outcome.getUnprocessedKeys().size() == 0) { logger.debug("No unprocessed keys found"); } else { logger.debug("Retrieving the unprocessed keys"); outcome = dynamoDBClient.batchGetItemUnprocessed(unprocessedKeys); } } while (outcome.getUnprocessedKeys().size() > 0); } return fetchedItems; }

Target:
private <T extends Item> List<T> executeQuery(final KeySetQuery query, final Class<T> itemClass) { final ItemConfiguration itemConfiguration = getItemConfiguration(itemClass); final String tableName = databaseSchemaHolder.schemaName() + "." + itemConfiguration.tableName(); final List<List<ItemId>> split_ids = split(new ArrayList<ItemId>(query.itemIds()), 100); final List<T> fetchedItems = new ArrayList<T>(); for (final List<ItemId> ids : split_ids) { final TableKeysAndAttributes keys = new TableKeysAndAttributes(tableName); for (final ItemId id : ids) { keys.addPrimaryKey(getPrimaryKey(id, itemConfiguration)); } processBatchRead(dynamoDBClient.batchGetItem(keys), fetchedItems, tableName, itemClass); } return fetchedItems; }
Source:
public HttpRequest filter(HttpRequest request) throws HttpException { Credentials currentCreds = checkNotNull(creds.get(), "credential supplier returned null"); if (currentCreds.identity == null || currentCreds.identity.contains(":")) { throw new AuthorizationException(String.format("Credential %s does not match format of integers and characters only", currentCreds.identity)); } return request.toBuilder().addHeader("X-Service-Key", currentCreds.identity).build(); }

Target:
public HttpRequest filter(HttpRequest request) throws HttpException { Credentials currentCreds = checkNotNull(creds.get(), "credential supplier returned null"); if (currentCreds.identity == null) { throw new AuthorizationException("Credentials identity can not be null"); } return request.toBuilder().addHeader("X-Service-Key", currentCreds.identity).build(); }
Source:
private void trimNonResidentQueue() { Entry<V> e; int maxQueue2Size = nonResidentQueueSize * (mapSize - queue2Size); if (maxQueue2Size >= 0) { while (queue2Size > maxQueue2Size) { e = queue2.queuePrev; WeakReference<V> reference = e.reference; if (reference != null && reference.get() != null) { break; } int hash = getHash(e.key); remove(e.key, hash); } } }

Target:
void trimNonResidentQueue() { int residentCount = mapSize - queue2Size; int maxQueue2SizeHigh = nonResidentQueueSizeHigh * residentCount; int maxQueue2Size = nonResidentQueueSize * residentCount; while (queue2Size > maxQueue2Size) { Entry<V> e = queue2.queuePrev; if (queue2Size <= maxQueue2SizeHigh) { WeakReference<V> reference = e.reference; if (reference != null && reference.get() != null) { break; } } int hash = getHash(e.key); remove(e.key, hash); } }
Source:
public void testEntryAddedEventListener(DBMSType dbmsType, DBMSConnection dbmsConnection, DBMSProcessor dbmsProcessor) throws Exception { System.out.println("dbmstype" + dbmsType); setUp(dbmsConnection); BibEntry expectedEntry = getBibEntryExample(1); BibEntry furtherEntry = getBibEntryExample(1); bibDatabase.insertEntry(expectedEntry); bibDatabase.insertEntry(furtherEntry, EntryEventSource.SHARED); List<BibEntry> actualEntries = dbmsProcessor.getSharedEntries(); assertEquals(1, actualEntries.size()); assertEquals(expectedEntry, actualEntries.get(0)); clear(dbmsConnection); }

Target:
public void testEntryAddedEventListener(DBMSType dbmsType, DBMSConnection dbmsConnection, DBMSProcessor dbmsProcessor) throws Exception { setUp(dbmsConnection); BibEntry expectedEntry = getBibEntryExample(1); BibEntry furtherEntry = getBibEntryExample(1); bibDatabase.insertEntry(expectedEntry); bibDatabase.insertEntry(furtherEntry, EntriesEventSource.SHARED); List<BibEntry> actualEntries = dbmsProcessor.getSharedEntries(); assertEquals(1, actualEntries.size()); assertEquals(expectedEntry, actualEntries.get(0)); clear(dbmsConnection); }
Source:
public MultipartContent() { this("__END_OF_PART__" + java.util.UUID.randomUUID().toString() + "__"); }

Target:
public MultipartContent() { this("__END_OF_PART__" + UUID.randomUUID().toString() + "__"); }
Source:
public void testNewView() { IViewPart firstView = TmfViewFactory.newView(checkNotNull(TmfViewStub.TMF_VIEW_STUB_ID), false); IViewPart sameAsFirstView = TmfViewFactory.newView(checkNotNull(TmfViewStub.TMF_VIEW_STUB_ID), false); IViewPart secondView = TmfViewFactory.newView(checkNotNull(TmfViewStub.TMF_VIEW_STUB_ID), true); IViewPart failView1 = TmfViewFactory.newView("this.is.a.failing.view.id", false); IViewPart failView2 = TmfViewFactory.newView("this.is.a.failing.view.id", true); assertNotNull("Failed to spawn first view", firstView); assertEquals("Same id returned different instance", sameAsFirstView, firstView); assertNotNull("Failed to open second view with suffix", secondView); assertNull("Expected to fail on dummy view id", failView1); assertNull("Expected to fail on dummy view id with suffix", failView2); IWorkbench wb = PlatformUI.getWorkbench(); IWorkbenchWindow win = wb.getActiveWorkbenchWindow(); IWorkbenchPage page = win.getActivePage(); IViewReference[] viewRefs = page.getViewReferences(); String fullId = null; for (IViewReference view : viewRefs) { if (view.getSecondaryId() != null && view.getId().equals(TmfViewStub.TMF_VIEW_STUB_ID)) { assertTrue("Instanceof a TMfViewStub", view.getView(false) instanceof TmfViewStub); fullId = ((TmfViewStub) view.getView(false)).getViewId(); break; } } assertNotNull(fullId); IViewPart thirdView = TmfViewFactory.newView(fullId, true); assertNotNull("Creation from a view id with suffix failed", fullId); assertFalse("New view from view id with suffix was not created", Arrays.asList(viewRefs).contains(thirdView)); }

Target:
public void testNewView() { IViewPart firstView = TmfViewFactory.newView(checkNotNull(TmfViewStub.TMF_VIEW_STUB_ID), false); IViewPart sameAsFirstView = TmfViewFactory.newView(checkNotNull(TmfViewStub.TMF_VIEW_STUB_ID), false); IViewPart secondView = TmfViewFactory.newView(checkNotNull(TmfViewStub.TMF_VIEW_STUB_ID), true); IViewPart failView1 = TmfViewFactory.newView("this.is.a.failing.view.id", false); IViewPart failView2 = TmfViewFactory.newView("this.is.a.failing.view.id", true); assertNotNull("Failed to spawn first view", firstView); assertEquals("Same id returned different instance", sameAsFirstView, firstView); assertNotNull("Failed to open second view with suffix", secondView); assertNull("Expected to fail on dummy view id", failView1); assertNull("Expected to fail on dummy view id with suffix", failView2); IWorkbench wb = PlatformUI.getWorkbench(); IWorkbenchWindow win = wb.getActiveWorkbenchWindow(); IWorkbenchPage page = win.getActivePage(); IViewReference[] viewRefs = page.getViewReferences(); String fullId = null; for (IViewReference view : viewRefs) { if (view.getSecondaryId() != null && view.getId().equals(TmfViewStub.TMF_VIEW_STUB_ID)) { assertTrue("Instanceof a TmfViewStub", view.getView(false) instanceof TmfViewStub); fullId = ((TmfViewStub) view.getView(false)).getViewId(); break; } } assertNotNull(fullId); IViewPart thirdView = TmfViewFactory.newView(fullId, true); assertNotNull("Creation from a view id with suffix failed", fullId); assertFalse("New view from view id with suffix was not created", Arrays.asList(viewRefs).contains(thirdView)); }
Source:
public Ban.Builder from(Ban ban) { reset(); this.banType = ban.getType(); if (this.banType.equals(BanTypes.PROFILE)) { this.profile = ((Ban.Profile) ban).getProfile(); } else { this.address = ((Ban.Ip) ban).getAddress(); } this.reason = ban.getReason().orElseGet(null); this.start = ban.getCreationDate(); this.end = ban.getExpirationDate().orElse(null); this.source = ban.getBanSource().orElse(null); return this; }

Target:
public Ban.Builder from(Ban ban) { reset(); this.banType = ban.getType(); if (this.banType.equals(BanTypes.PROFILE)) { this.profile = ((Ban.Profile) ban).getProfile(); } else { this.address = ((Ban.Ip) ban).getAddress(); } this.reason = ban.getReason().orElse(null); this.start = ban.getCreationDate(); this.end = ban.getExpirationDate().orElse(null); this.source = ban.getBanSource().orElse(null); return this; }
Source:
public static TypeStrategy nullable(TypeStrategy initialStrategy) { return callContext -> { Optional<DataType> initialType = initialStrategy.inferType(callContext); return initialType.map(type -> { boolean isNullableArgument = callContext.getArgumentDataTypes() .stream() .anyMatch(dataType -> dataType.getLogicalType().isNullable()); if (isNullableArgument) { return type.nullable(); } else { return type.notNull(); } } ); }; }

Target:
public static TypeStrategy nullable(TypeStrategy initialStrategy) { return callContext -> { Optional<DataType> initialDataType = initialStrategy.inferType(callContext); return initialDataType.map(inferredDataType -> { boolean isNullableArgument = callContext.getArgumentDataTypes() .stream() .anyMatch(dataType -> dataType.getLogicalType().isNullable()); if (isNullableArgument) { return inferredDataType.nullable(); } else { return inferredDataType.notNull(); } } ); }; }
Source:
public MappingModelExpressable getExpressionType() { SqlSelection first = selectClause.getSqlSelections().get(0); return ( (SqlSelectionImpl) first ).getWrappedSqlExpression().getExpressionType(); }

Target:
public MappingModelExpressable getExpressionType() { SqlSelection first = selectClause.getSqlSelections().get(0); return first.getExpressionType(); }
Source:
public void testDownsampleTransformMetricIsAllNull() { Transform downsampleTransform = new DownsampleTransform(); Map<Long, String> datapoints_1 = new HashMap<Long, String>(); Metric metric_1 = new Metric(TEST_SCOPE + "1", TEST_METRIC); metric_1.setDatapoints(datapoints_1); List<Metric> metrics = new ArrayList<Metric>(); metrics.add(metric_1); List<String> constants = new ArrayList<String>(); constants.add("3s-count"); Map<Long, String> expected_1 = new HashMap<Long, String>(); List<Metric> result = downsampleTransform.transform(metrics, constants); assertEquals(result.size(), 1); assertEquals(expected_1, result.get(0).getDatapoints()); }

Target:
public void testDownsampleTransformMetricIsAllNull() { Transform downsampleTransform = new DownsampleTransform(); Map<Long, String> datapoints = new HashMap<Long, String>(); Metric metric = new Metric(TEST_SCOPE + "1", TEST_METRIC); metric.setDatapoints(datapoints); List<Metric> metrics = new ArrayList<Metric>(); metrics.add(metric); List<String> constants = new ArrayList<String>(); constants.add("3s-count"); Map<Long, String> expected = new HashMap<Long, String>(); List<Metric> result = downsampleTransform.transform(metrics, constants); assertEquals(result.size(), 1); assertEquals(expected, result.get(0).getDatapoints()); }
Source:
private void setServersInPoolTo(Set<InetSocketAddress> desiredServers) { Set<InetSocketAddress> serversToRemove = Sets.newHashSet(); Set<InetSocketAddress> serversToAdd = Sets.newHashSet(); Set<InetSocketAddress> cachedServers = getCachedServers(); serversToAdd.addAll(Sets.difference(desiredServers, cachedServers)); serversToRemove.addAll(Sets.difference(cachedServers, desiredServers)); serversToAdd.forEach(cassandra::addPool); serversToRemove.forEach(cassandra::removePool); if (!(serversToAdd.isEmpty() && serversToRemove.isEmpty())) { sanityCheckRingConsistency(); cassandra.refreshTokenRangesAndGetServers(); } log.info("Cassandra pool refresh added hosts {}, removed hosts {}.", SafeArg.of("serversToAdd", CassandraLogHelper.collectionOfHosts(serversToAdd)), SafeArg.of("serversToRemove", CassandraLogHelper.collectionOfHosts(serversToRemove))); }

Target:
private void setServersInPoolTo(Set<InetSocketAddress> desiredServers) { Set<InetSocketAddress> serversToRemove = Sets.newHashSet(); Set<InetSocketAddress> serversToAdd = Sets.newHashSet(); Set<InetSocketAddress> cachedServers = getCachedServers(); serversToAdd.addAll(Sets.difference(desiredServers, cachedServers)); serversToRemove.addAll(Sets.difference(cachedServers, desiredServers)); serversToAdd.forEach(cassandra::addPool); serversToRemove.forEach(cassandra::removePool); if (!(serversToAdd.isEmpty() && serversToRemove.isEmpty())) { sanityCheckRingConsistency(); cassandra.refreshTokenRangesAndGetServers(); } logRefreshedHosts(serversToAdd, serversToRemove); }
Source:
public boolean connect(AccessPoint accessPoint, String password) throws TimeoutException, XBeeException { if (accessPoint == null) throw new NullPointerException("Access point cannot be null."); setParameter("ID", accessPoint.getSSID().getBytes()); setParameter("EE", new byte[]{(byte)accessPoint.getEncryptionType().getID()}); if (password != null) setParameter("PK", password.getBytes()); long deadLine = System.currentTimeMillis() + wifiReceiveTimeout; while (System.currentTimeMillis() < deadLine) { sleep(100); byte[] status = getParameter("AI"); if (status == null || status.length < 1) continue; if (status[0] == 0) return true; } return false; }

Target:
public boolean connect(AccessPoint accessPoint, String password) throws TimeoutException, XBeeException { if (accessPoint == null) throw new NullPointerException("Access point cannot be null."); setParameter("ID", accessPoint.getSSID().getBytes()); setParameter("EE", new byte[]{(byte)accessPoint.getEncryptionType().getID()}); if (password != null && accessPoint.getEncryptionType() != WiFiEncryptionType.NONE) setParameter("PK", password.getBytes()); long deadLine = System.currentTimeMillis() + wifiReceiveTimeout; while (System.currentTimeMillis() < deadLine) { sleep(100); byte[] status = getParameter("AI"); if (status == null || status.length < 1) continue; if (status[0] == 0) return true; } return false; }
Source:
public Iterable<ConnectorIssue> analyze(MavenProject mavenProject) { final List<ConnectorIssue> issues = Lists.newArrayList(); final List<String> packagesCopy = Lists.newArrayList(defaultPackages); final File dir = fileSystem.baseDir(); Collection<File> directories = FileUtils.listFilesAndDirs(dir, new NotFileFilter(TrueFileFilter.INSTANCE), DirectoryFileFilter.DIRECTORY); Iterable<File> suites = Iterables.filter(directories, HAS_VALID_TEST_PACKAGE); for (File suite : suites) { String suiteName = StringUtils.substringAfterLast(suite.getPath(), "/"); if (defaultPackages.contains(suiteName)) { packagesCopy.remove(suiteName); } } if (packagesCopy.size() > 0) { for (String noSuite : packagesCopy) { issues.add(new ConnectorIssue(KEY, String.format("%s test suite directory doesn't exist.", WordUtils.capitalize(noSuite)))); } } return issues; }

Target:
public Iterable<ConnectorIssue> analyze(MavenProject mavenProject) { final List<ConnectorIssue> issues = Lists.newArrayList(); final File dir = fileSystem.baseDir(); Collection<File> directories = FileUtils.listFilesAndDirs(dir, new NotFileFilter(TrueFileFilter.INSTANCE), DirectoryFileFilter.DIRECTORY); Iterable<File> suites = Iterables.filter(directories, HAS_VALID_TEST_PACKAGE); for (final String suite : packages) { if (!Iterables.any(suites, getPredicateForSuite(suite))) { issues.add(new ConnectorIssue(KEY, String.format("%s test suite directory doesn't exist.", WordUtils.capitalize(suite)))); } } return issues; }
Source:
public Menu(Executor ex) { running = false; exec = ex; JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); panel.setBackground(Color.black); gbc.gridx = 0; gbc.gridy = 0; gbc.insets = new Insets(0, 0, 50, 0); BufferedImage biTitle = SpriteSheet.getInstance().grabImage(172, 8, 231, 157); JLabel title = new JLabel(new ImageIcon(biTitle)); panel.add(title, gbc); btnNewGame = new JButton("New Game"); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridy = 1; gbc.insets = new Insets(0, 50, 5, 50); panel.add(btnNewGame, gbc); btnStatistics = new JButton("Highscores"); gbc.gridy = 2; panel.add(btnStatistics, gbc); btnQuit = new JButton("Quit Game"); gbc.gridy = 3; panel.add(btnQuit, gbc); CardWindow.getInstance().addCard(panel, "MENUCARD"); }

Target:
public Menu(Executor ex) { running = false; exec = ex; JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); panel.setBackground(Color.black); constraints.gridx = 0; constraints.gridy = 0; constraints.insets = new Insets(0, 0, 50, 0); BufferedImage biTitle = SpriteSheet.getInstance().grabImage(172, 8, 231, 157); JLabel title = new JLabel(new ImageIcon(biTitle)); panel.add(title, constraints); btnNewGame = new JButton("New Game"); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridy = 1; constraints.insets = new Insets(0, 50, 5, 50); panel.add(btnNewGame, constraints); btnStatistics = new JButton("Highscores"); constraints.gridy = 2; panel.add(btnStatistics, constraints); btnQuit = new JButton("Quit Game"); constraints.gridy = 3; panel.add(btnQuit, constraints); CardWindow.getInstance().addCard(panel, "MENUCARD"); }
Source:
protected AuditMessageType getParticipantObjectIdentificationForRequest( ProvideAndRegisterDocumentSetRequestType request, AssertionType assertion, AuditMessageType auditMsg) { auditMsg = getPatientParticipantObjectIdentification(request, auditMsg); auditMsg = getSubmissionSetParticipantObjectIdentification(request, auditMsg); return auditMsg; }

Target:
protected AuditMessageType getParticipantObjectIdentificationForRequest( ProvideAndRegisterDocumentSetRequestType request, AssertionType assertion, AuditMessageType auditMsg) { getPatientParticipantObjectIdentification(request, auditMsg); getSubmissionSetParticipantObjectIdentification(request, auditMsg); return auditMsg; }
Source:
public static void subqueryRestriction(RelNode relNode) { if(relNode instanceof HiveAggregate) { HiveAggregate aggregate = (HiveAggregate)relNode; if(!aggregate.getAggCallList().isEmpty() && aggregate.getGroupSet().isEmpty()) { throw new CalciteSubqueryRuntimeException("Subquery rewrite: Aggregate without group by is not allowed"); } } else if(relNode instanceof HiveProject || relNode instanceof HiveFilter) { subqueryRestriction(relNode.getInput(0)); } else { return; } }

Target:
public static void subqueryRestriction(RelNode relNode) { if (relNode instanceof HiveAggregate) { HiveAggregate aggregate = (HiveAggregate) relNode; if (!aggregate.getAggCallList().isEmpty() && aggregate.getGroupSet().isEmpty()) { throw new CalciteSubqueryRuntimeException( "Subquery rewrite: Aggregate without group by is not allowed"); } } else if (relNode instanceof HiveProject || relNode instanceof HiveFilter) { subqueryRestriction(relNode.getInput(0)); } }
Source:
protected void parsePayload(ParsableByteArray data, long timeUs) { int packetType = data.readUnsignedByte(); if (audioFormat != AUDIO_FORMAT_AAC || packetType == AAC_PACKET_TYPE_AAC_RAW) { int bytes = data.bytesLeft(); output.sampleData(data, bytes); output.sampleMetadata(timeUs, C.BUFFER_FLAG_KEY_FRAME, bytes, 0, null); } else if (packetType == AAC_PACKET_TYPE_SEQUENCE_HEADER && !hasOutputFormat) { byte[] audioSpecifiConfig = new byte[data.bytesLeft()]; data.readBytes(audioSpecifiConfig, 0, audioSpecifiConfig.length); Pair<Integer, Integer> audioParams = CodecSpecificDataUtil.parseAacAudioSpecificConfig( audioSpecifiConfig); Format format = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_AAC, null, Format.NO_VALUE, Format.NO_VALUE, audioParams.second, audioParams.first, Collections.singletonList(audioSpecifiConfig), null, 0, null); output.format(format); hasOutputFormat = true; } }

Target:
protected void parsePayload(ParsableByteArray data, long timeUs) { int packetType = data.readUnsignedByte(); if (packetType == AAC_PACKET_TYPE_SEQUENCE_HEADER && !hasOutputFormat) { byte[] audioSpecifiConfig = new byte[data.bytesLeft()]; data.readBytes(audioSpecifiConfig, 0, audioSpecifiConfig.length); Pair<Integer, Integer> audioParams = CodecSpecificDataUtil.parseAacAudioSpecificConfig( audioSpecifiConfig); Format format = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_AAC, null, Format.NO_VALUE, Format.NO_VALUE, audioParams.second, audioParams.first, Collections.singletonList(audioSpecifiConfig), null, 0, null); output.format(format); hasOutputFormat = true; } else if (audioFormat != AUDIO_FORMAT_AAC || packetType == AAC_PACKET_TYPE_AAC_RAW) { int bytes = data.bytesLeft(); output.sampleData(data, bytes); output.sampleMetadata(timeUs, C.BUFFER_FLAG_KEY_FRAME, bytes, 0, null); } }
Source:
public TriggerResult onProcessingTime(long timestamp, W window, TriggerContext ctx) throws Exception { this.nestedTrigger.onProcessingTime(timestamp, window, ctx); if (shouldClearAtTimeout) { this.clear(window, ctx); } return TriggerResult.FIRE; }

Target:
public TriggerResult onProcessingTime(long timestamp, W window, TriggerContext ctx) throws Exception { TriggerResult triggerResult = this.nestedTrigger.onProcessingTime(timestamp, window, ctx); if (shouldClearOnTimeout) { this.clear(window, ctx); } return triggerResult.isPurge() ? TriggerResult.FIRE_AND_PURGE : TriggerResult.FIRE; }
Source:
public void run() { while (sleepWhileRunning(getDelayWithJitter())) { int today = getDateOfToday(); if (today > lastDate) { lastId = Optional.of(ActiveUserCache.INITIAL_ID); } if (lastId.isPresent()) { try { doPeriodicWork(today); } catch (Throwable t) { logger.warn("error in active user count: ", t); } } else { logger.debug("run: no work available"); } } synchronized (this) { finished = true; notifyAll(); } }

Target:
public void run() { int lastDate = INITIAL_DATE; boolean doMoreWork = true; while (sleepWhileRunning(getDelayWithJitter())) { int today = getDateOfToday(); if (today > lastDate) { lastDate = today; doMoreWork = true; } if (doMoreWork) { try { doMoreWork = doPeriodicWork(today); } catch (Throwable t) { logger.warn("error in active user count: ", t); } } else { logger.debug("run: no work available"); } } synchronized (this) { finished = true; notifyAll(); } }
Source:
protected void launch(ImmutableList.Builder<String> argsBuilder) { String args = Joiner.on(" ").join(argsBuilder.build()); List<String> commands = new LinkedList<String>(); commands.add(String.format("%s/bin/mongod %s > out.log 2> err.log < /dev/null", getExpandedInstallDir(), args)); newScript(LAUNCHING) .setFlag(SshTool.PROP_CONNECT_TIMEOUT, Duration.TEN_SECONDS.toMilliseconds()) .updateTaskAndFailOnNonZeroResultCode() .body.append(commands).execute(); }

Target:
protected void launch(ImmutableList.Builder<String> argsBuilder) { String args = Joiner.on(" ").join(argsBuilder.build()); String command = String.format("%s/bin/mongod %s >> out.log 2>> err.log < /dev/null", getExpandedInstallDir(), args); newScript(LAUNCHING) .setFlag(SshTool.PROP_CONNECT_TIMEOUT, Duration.TEN_SECONDS.toMilliseconds()) .updateTaskAndFailOnNonZeroResultCode() .body.append(command).execute(); }
Source:
public void setupCaching(boolean cachingEnabled) throws IOException { if (cachingEnabled) { setResourceDownloadProperty("cacheEnabled", "True"); } else { setResourceDownloadProperty("cacheEnabled", "False"); } }

Target:
public void setupCaching(boolean cachingEnabled) throws IOException { setResourceDownloadProperty("cacheEnabled", Boolean.toString(cachingEnabled)); }
Source:
private List getSubjectNotifications(Subject subject) { String userid = subjectIdentity.getUniqueIdentifier(subject); try { String filter = String.format("user = '%s'", userid); List<Map<String, Object>> notificationsList = persistentStore.get(PersistenceType.NOTIFICATION_TYPE.toString(), filter, 0, 999); return notificationsList.stream().map(this::mapAttributes).collect(Collectors.toList()); } catch (PersistenceException e) { LOGGER.info( "PersistenceException while trying to retrieve persisted notifications for user {}", userid, e); } return Collections.emptyList(); }

Target:
private List<Map<String, Object>> getSubjectNotifications(Subject subject) { String userid = subjectIdentity.getUniqueIdentifier(subject); try { String filter = String.format("user = '%s'", userid); List<Map<String, Object>> notificationsList = persistentStore.get( PersistenceType.NOTIFICATION_TYPE.toString(), filter, 0, MAX_PAGE_SIZE); return notificationsList.stream().map(this::mapAttributes).collect(Collectors.toList()); } catch (PersistenceException e) { LOGGER.debug( "PersistenceException while trying to retrieve persisted notifications for user {}", userid, e); } return Collections.emptyList(); }
Source:
private TypeDTO(Builder builder) { if (builder.id != null) { if (builder.id.matches("^[a-zA-Z0-9]+$")) { this.id = builder.id; } else { LOGGER.warn( String.format("Category ID (%s) contains invalid characters, will remove them.", builder.id)); this.id = builder.id.replaceAll("[^a-zA-Z0-9]", ""); } } else { this.id = null; } this.name = builder.name == null ? builder.id : builder.name; this.categories = Collections.unmodifiableList(builder.categories); this.icon = builder.icon; }

Target:
private TypeDTO(Builder builder) { if (builder.id != null) { if (builder.id.matches("^[a-zA-Z0-9]+$")) { this.id = builder.id; } else { LOGGER.warn( String.format("Type ID (%s) contains invalid characters, will remove them.", builder.id)); this.id = builder.id.replaceAll("[^a-zA-Z0-9]", ""); } } else { this.id = null; } this.name = builder.name == null ? builder.id : builder.name; this.categories = Collections.unmodifiableList(builder.categories); this.icon = builder.icon; }
Source:
public void setupRoutes() { path(controllerBasePath(), () -> { before(Routes.PipelineConfig.NAME + "/edit", authenticationHelper::checkAdminUserAnd403); get(Routes.PipelineConfig.NAME + "/edit", this::index, engine); }); }

Target:
public void setupRoutes() { path(controllerBasePath(), () -> { before(Routes.PipelineConfig.NAME + "/edit", authenticationHelper::checkPipelineGroupAdminOfPipelineOrGroupInURLUserAnd403); get(Routes.PipelineConfig.NAME + "/edit", this::index, engine); }); }
Source:
protected void checkWithWaitStrategy(CoreEvent event) throws FlowBackPressureException { boolean accepted = false; while (!accepted) { try { abstractPipeline.getProcessingStrategy().checkBackpressureAccepting(event); accepted = true; } catch (RejectedExecutionException ree) { try { Thread.sleep(EVENT_LOOP_SCHEDULER_BUSY_RETRY_INTERVAL_MS); } catch (InterruptedException e) { FlowBackPressureException exception = new FlowBackPressureException(abstractPipeline.getName(), ree); throw exception; } } } }

Target:
protected void checkWithWaitStrategy(CoreEvent event) throws FlowBackPressureException { boolean accepted = false; while (!accepted) { try { abstractPipeline.getProcessingStrategy().checkBackpressureAccepting(event); accepted = true; } catch (RejectedExecutionException ree) { try { sleep(EVENT_LOOP_SCHEDULER_BUSY_RETRY_INTERVAL_MS); } catch (InterruptedException e) { currentThread().interrupt(); throw new FlowBackPressureException(abstractPipeline.getName(), ree); } } } }
Source:
public List<Symbol> outputs() { return List.copyOf(outputs); }

Target:
public List<Symbol> outputs() { return outputs; }