id
int64 1
49k
| buggy
stringlengths 34
37.5k
| fixed
stringlengths 2
37k
|
---|---|---|
701 | this.upnpService = upnpService;
}
public UpnpService getUpnpService() {
return upnpService;
}
<BUG>public ReceivingAsync createReceivingAsync(IncomingDatagramMessage message) throws ProtocolCreationException {
log.fine("Creating protocol for incoming asynchronous: " + message);
if (message.getOperation() instanceof UpnpRequest) {</BUG>
IncomingDatagramMessage<UpnpRequest> incomingRequest = message;
switch (incomingRequest.getOperation().getMethod()) {
| if (log.isLoggable(Level.FINE)) {
if (message.getOperation() instanceof UpnpRequest) {
|
702 | }
public UpnpHeaders(Map<String, List<String>> headers) {
super(headers);
}
public UpnpHeaders(ByteArrayInputStream inputStream) {
<BUG>super(inputStream);
}</BUG>
protected void parseHeaders() {
parsedHeaders = new LinkedHashMap();
if (log.isLoggable(Level.FINE))
| public UpnpHeaders(boolean normalizeHeaders) {
super(normalizeHeaders);
|
703 | List<URL> callbackURLs = new ArrayList();
for (NetworkAddress activeStreamServer : activeStreamServers) {
callbackURLs.add(
new Location(
activeStreamServer,
<BUG>namespace.getEventCallbackPath(getService())
</BUG>
).getURL());
}
return callbackURLs;
| namespace.getEventCallbackPathString(getService())
|
704 | package com.cronutils.model.time.generator;
import java.util.Collections;
<BUG>import java.util.List;
import org.apache.commons.lang3.Validate;</BUG>
import com.cronutils.model.field.CronField;
import com.cronutils.model.field.expression.FieldExpression;
public abstract class FieldValueGenerator {
| import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.Validate;
|
705 | import java.util.ResourceBundle;
import java.util.function.Function;</BUG>
class DescriptionStrategyFactory {
private DescriptionStrategyFactory() {}
public static DescriptionStrategy daysOfWeekInstance(final ResourceBundle bundle, final FieldExpression expression) {
<BUG>final Function<Integer, String> nominal = integer -> new DateTime().withDayOfWeek(integer).dayOfWeek().getAsText(bundle.getLocale());
</BUG>
NominalDescriptionStrategy dow = new NominalDescriptionStrategy(bundle, nominal, expression);
dow.addDescription(fieldExpression -> {
if (fieldExpression instanceof On) {
| import java.util.function.Function;
import com.cronutils.model.field.expression.FieldExpression;
import com.cronutils.model.field.expression.On;
final Function<Integer, String> nominal = integer -> DayOfWeek.of(integer).getDisplayName(TextStyle.FULL, bundle.getLocale());
|
706 | return dom;
}
public static DescriptionStrategy monthsInstance(final ResourceBundle bundle, final FieldExpression expression) {
return new NominalDescriptionStrategy(
bundle,
<BUG>integer -> new DateTime().withMonthOfYear(integer).monthOfYear().getAsText(bundle.getLocale()),
expression</BUG>
);
}
public static DescriptionStrategy plainInstance(ResourceBundle bundle, final FieldExpression expression) {
| integer -> Month.of(integer).getDisplayName(TextStyle.FULL, bundle.getLocale()),
expression
|
707 | <BUG>package com.cronutils.model.time.generator;
import com.cronutils.mapper.WeekDay;</BUG>
import com.cronutils.model.field.CronField;
import com.cronutils.model.field.CronFieldName;
import com.cronutils.model.field.constraint.FieldConstraintsBuilder;
| import java.time.LocalDate;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import org.apache.commons.lang3.Validate;
import com.cronutils.mapper.WeekDay;
|
708 | import com.cronutils.model.field.expression.Between;
import com.cronutils.model.field.expression.FieldExpression;
import com.cronutils.parser.CronParserField;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
<BUG>import org.apache.commons.lang3.Validate;
import org.joda.time.DateTime;
import java.util.Collections;
import java.util.List;
import java.util.Set;</BUG>
class BetweenDayOfWeekValueGenerator extends FieldValueGenerator {
| [DELETED] |
709 | <BUG>package com.cronutils.model.time.generator;
import com.cronutils.model.field.CronField;</BUG>
import com.cronutils.model.field.CronFieldName;
import com.cronutils.model.field.expression.FieldExpression;
import com.cronutils.model.field.expression.On;
| import java.time.DayOfWeek;
import java.time.LocalDate;
import java.util.List;
import org.apache.commons.lang3.Validate;
import com.cronutils.model.field.CronField;
|
710 | import com.cronutils.model.field.CronField;</BUG>
import com.cronutils.model.field.CronFieldName;
import com.cronutils.model.field.expression.FieldExpression;
import com.cronutils.model.field.expression.On;
import com.google.common.collect.Lists;
<BUG>import org.apache.commons.lang3.Validate;
import org.joda.time.DateTime;
import java.util.List;</BUG>
class OnDayOfMonthValueGenerator extends FieldValueGenerator {
private int year;
| package com.cronutils.model.time.generator;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.util.List;
import com.cronutils.model.field.CronField;
|
711 | class OnDayOfMonthValueGenerator extends FieldValueGenerator {
private int year;
private int month;
public OnDayOfMonthValueGenerator(CronField cronField, int year, int month) {
super(cronField);
<BUG>Validate.isTrue(CronFieldName.DAY_OF_MONTH.equals(cronField.getField()), "CronField does not belong to day of month");
this.year = year;</BUG>
this.month = month;
}
| Validate.isTrue(CronFieldName.DAY_OF_MONTH.equals(cronField.getField()), "CronField does not belong to day of" +
" month");
this.year = year;
|
712 | package com.cronutils.mapper;
public class ConstantsMapper {
private ConstantsMapper() {}
public static final WeekDay QUARTZ_WEEK_DAY = new WeekDay(2, false);
<BUG>public static final WeekDay JODATIME_WEEK_DAY = new WeekDay(1, false);
</BUG>
public static final WeekDay CRONTAB_WEEK_DAY = new WeekDay(1, true);
public static int weekDayMapping(WeekDay source, WeekDay target, int weekday){
return source.mapTo(weekday, target);
| public static final WeekDay JAVA8 = new WeekDay(1, false);
|
713 | return nextMatch;
} catch (NoSuchValueException e) {
throw new IllegalArgumentException(e);
}
}
<BUG>DateTime nextClosestMatch(DateTime date) throws NoSuchValueException {
</BUG>
List<Integer> year = yearsValueGenerator.generateCandidates(date.getYear(), date.getYear());
TimeNode days = null;
int lowestMonth = months.getValues().get(0);
| ZonedDateTime nextClosestMatch(ZonedDateTime date) throws NoSuchValueException {
|
714 | boolean questionMarkSupported =
cronDefinition.getFieldDefinition(DAY_OF_WEEK).getConstraints().getSpecialChars().contains(QUESTION_MARK);
if(questionMarkSupported){
return new TimeNode(
generateDayCandidatesQuestionMarkSupported(
<BUG>date.getYear(), date.getMonthOfYear(),
</BUG>
((DayOfWeekFieldDefinition)
cronDefinition.getFieldDefinition(DAY_OF_WEEK)
).getMondayDoWValue()
| date.getYear(), date.getMonthValue(),
|
715 | )
);
}else{
return new TimeNode(
generateDayCandidatesQuestionMarkNotSupported(
<BUG>date.getYear(), date.getMonthOfYear(),
</BUG>
((DayOfWeekFieldDefinition)
cronDefinition.getFieldDefinition(DAY_OF_WEEK)
).getMondayDoWValue()
| date.getYear(), date.getMonthValue(),
|
716 | }
public DateTime lastExecution(DateTime date){
</BUG>
Validate.notNull(date);
try {
<BUG>DateTime previousMatch = previousClosestMatch(date);
</BUG>
if(previousMatch.equals(date)){
previousMatch = previousClosestMatch(date.minusSeconds(1));
}
| public java.time.Duration timeToNextExecution(ZonedDateTime date){
return java.time.Duration.between(date, nextExecution(date));
public ZonedDateTime lastExecution(ZonedDateTime date){
ZonedDateTime previousMatch = previousClosestMatch(date);
|
717 | return previousMatch;
} catch (NoSuchValueException e) {
throw new IllegalArgumentException(e);
}
}
<BUG>public Duration timeFromLastExecution(DateTime date){
return new Interval(lastExecution(date), date).toDuration();
}
public boolean isMatch(DateTime date){
</BUG>
return nextExecution(lastExecution(date)).equals(date);
| [DELETED] |
718 | <BUG>package com.cronutils.model.time.generator;
import com.cronutils.model.field.CronField;</BUG>
import com.cronutils.model.field.expression.Every;
import com.cronutils.model.field.expression.FieldExpression;
import com.google.common.annotations.VisibleForTesting;
| import java.time.ZonedDateTime;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.cronutils.model.field.CronField;
|
719 | import com.cronutils.model.field.CronField;</BUG>
import com.cronutils.model.field.expression.Every;
import com.cronutils.model.field.expression.FieldExpression;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
<BUG>import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;</BUG>
class EveryFieldValueGenerator extends FieldValueGenerator {
| package com.cronutils.model.time.generator;
import java.time.ZonedDateTime;
import java.util.List;
import com.cronutils.model.field.CronField;
|
720 | private static final Logger log = LoggerFactory.getLogger(EveryFieldValueGenerator.class);
public EveryFieldValueGenerator(CronField cronField) {
super(cronField);
log.trace(String.format(
"processing \"%s\" at %s",
<BUG>cronField.getExpression().asString(), DateTime.now()
</BUG>
));
}
@Override
| cronField.getExpression().asString(), ZonedDateTime.now()
|
721 | import java.util.ResourceBundle;
import java.util.function.Function;</BUG>
class DescriptionStrategyFactory {
private DescriptionStrategyFactory() {}
public static DescriptionStrategy daysOfWeekInstance(final ResourceBundle bundle, final FieldExpression expression) {
<BUG>final Function<Integer, String> nominal = integer -> new DateTime().withDayOfWeek(integer).dayOfWeek().getAsText(bundle.getLocale());
</BUG>
NominalDescriptionStrategy dow = new NominalDescriptionStrategy(bundle, nominal, expression);
dow.addDescription(fieldExpression -> {
if (fieldExpression instanceof On) {
| import java.util.function.Function;
import com.cronutils.model.field.expression.FieldExpression;
import com.cronutils.model.field.expression.On;
final Function<Integer, String> nominal = integer -> DayOfWeek.of(integer).getDisplayName(TextStyle.FULL, bundle.getLocale());
|
722 | return dom;
}
public static DescriptionStrategy monthsInstance(final ResourceBundle bundle, final FieldExpression expression) {
return new NominalDescriptionStrategy(
bundle,
<BUG>integer -> new DateTime().withMonthOfYear(integer).monthOfYear().getAsText(bundle.getLocale()),
expression</BUG>
);
}
public static DescriptionStrategy plainInstance(ResourceBundle bundle, final FieldExpression expression) {
| integer -> Month.of(integer).getDisplayName(TextStyle.FULL, bundle.getLocale()),
expression
|
723 | <BUG>package com.cronutils.model.time.generator;
import com.cronutils.mapper.WeekDay;</BUG>
import com.cronutils.model.field.CronField;
import com.cronutils.model.field.CronFieldName;
import com.cronutils.model.field.constraint.FieldConstraintsBuilder;
| import java.time.LocalDate;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import org.apache.commons.lang3.Validate;
import com.cronutils.mapper.WeekDay;
|
724 | import com.cronutils.model.field.expression.Between;
import com.cronutils.model.field.expression.FieldExpression;
import com.cronutils.parser.CronParserField;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
<BUG>import org.apache.commons.lang3.Validate;
import org.joda.time.DateTime;
import java.util.Collections;
import java.util.List;
import java.util.Set;</BUG>
class BetweenDayOfWeekValueGenerator extends FieldValueGenerator {
| [DELETED] |
725 | package com.cronutils.mapper;
public class ConstantsMapper {
private ConstantsMapper() {}
public static final WeekDay QUARTZ_WEEK_DAY = new WeekDay(2, false);
<BUG>public static final WeekDay JODATIME_WEEK_DAY = new WeekDay(1, false);
</BUG>
public static final WeekDay CRONTAB_WEEK_DAY = new WeekDay(1, true);
public static int weekDayMapping(WeekDay source, WeekDay target, int weekday){
return source.mapTo(weekday, target);
| public static final WeekDay JAVA8 = new WeekDay(1, false);
|
726 | return nextMatch;
} catch (NoSuchValueException e) {
throw new IllegalArgumentException(e);
}
}
<BUG>DateTime nextClosestMatch(DateTime date) throws NoSuchValueException {
</BUG>
List<Integer> year = yearsValueGenerator.generateCandidates(date.getYear(), date.getYear());
TimeNode days = null;
int lowestMonth = months.getValues().get(0);
| ZonedDateTime nextClosestMatch(ZonedDateTime date) throws NoSuchValueException {
|
727 | boolean questionMarkSupported =
cronDefinition.getFieldDefinition(DAY_OF_WEEK).getConstraints().getSpecialChars().contains(QUESTION_MARK);
if(questionMarkSupported){
return new TimeNode(
generateDayCandidatesQuestionMarkSupported(
<BUG>date.getYear(), date.getMonthOfYear(),
</BUG>
((DayOfWeekFieldDefinition)
cronDefinition.getFieldDefinition(DAY_OF_WEEK)
).getMondayDoWValue()
| date.getYear(), date.getMonthValue(),
|
728 | )
);
}else{
return new TimeNode(
generateDayCandidatesQuestionMarkNotSupported(
<BUG>date.getYear(), date.getMonthOfYear(),
</BUG>
((DayOfWeekFieldDefinition)
cronDefinition.getFieldDefinition(DAY_OF_WEEK)
).getMondayDoWValue()
| date.getYear(), date.getMonthValue(),
|
729 | }
public DateTime lastExecution(DateTime date){
</BUG>
Validate.notNull(date);
try {
<BUG>DateTime previousMatch = previousClosestMatch(date);
</BUG>
if(previousMatch.equals(date)){
previousMatch = previousClosestMatch(date.minusSeconds(1));
}
| public java.time.Duration timeToNextExecution(ZonedDateTime date){
return java.time.Duration.between(date, nextExecution(date));
public ZonedDateTime lastExecution(ZonedDateTime date){
ZonedDateTime previousMatch = previousClosestMatch(date);
|
730 | return previousMatch;
} catch (NoSuchValueException e) {
throw new IllegalArgumentException(e);
}
}
<BUG>public Duration timeFromLastExecution(DateTime date){
return new Interval(lastExecution(date), date).toDuration();
}
public boolean isMatch(DateTime date){
</BUG>
return nextExecution(lastExecution(date)).equals(date);
| [DELETED] |
731 | <BUG>package com.cronutils.model.time.generator;
import com.cronutils.model.field.CronField;</BUG>
import com.cronutils.model.field.expression.Every;
import com.cronutils.model.field.expression.FieldExpression;
import com.google.common.annotations.VisibleForTesting;
| import java.time.ZonedDateTime;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.cronutils.model.field.CronField;
|
732 | import com.cronutils.model.field.CronField;</BUG>
import com.cronutils.model.field.expression.Every;
import com.cronutils.model.field.expression.FieldExpression;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
<BUG>import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;</BUG>
class EveryFieldValueGenerator extends FieldValueGenerator {
| package com.cronutils.model.time.generator;
import java.time.ZonedDateTime;
import java.util.List;
import com.cronutils.model.field.CronField;
|
733 | private static final Logger log = LoggerFactory.getLogger(EveryFieldValueGenerator.class);
public EveryFieldValueGenerator(CronField cronField) {
super(cronField);
log.trace(String.format(
"processing \"%s\" at %s",
<BUG>cronField.getExpression().asString(), DateTime.now()
</BUG>
));
}
@Override
| cronField.getExpression().asString(), ZonedDateTime.now()
|
734 | private LocalBroadcastManager mLocalBroadcastManager;
private String mActiveDownloadUrlString;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
<BUG>setContentView(R.layout.activity_app_details2);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);</BUG>
toolbar.setTitle(""); // Nice and clean toolbar
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
| setContentView(R.layout.app_details2);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
735 | .inflate(R.layout.app_details2_screenshots, parent, false);
return new ScreenShotsViewHolder(view);
} else if (viewType == VIEWTYPE_WHATS_NEW) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.app_details2_whatsnew, parent, false);
<BUG>return new WhatsNewViewHolder(view);
} else if (viewType == VIEWTYPE_LINKS) {</BUG>
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.app_details2_links, parent, false);
return new ExpandableLinearLayoutViewHolder(view);
| } else if (viewType == VIEWTYPE_DONATE) {
.inflate(R.layout.app_details2_donate, parent, false);
return new DonateViewHolder(view);
} else if (viewType == VIEWTYPE_LINKS) {
|
736 | setCurrentBean(new XWikiDocument(new DocumentReference(wiki, "XWiki", "Page")));
getDocument().setSyntax(Syntax.XWIKI_1_0);
this.skippedElements.add("version");
this.skippedElements.add("minorEdit");
this.skippedElements.add("comment");
<BUG>this.skippedElements.add("creator");
this.skippedElements.add("author");
this.skippedElements.add("contentAuthor");</BUG>
this.skippedElements.add("creationDate");
this.skippedElements.add("date");
| [DELETED] |
737 | import org.drools.verifier.report.components.Cause;
public abstract class Restriction extends PatternComponent
implements
Cause {
public static class RestrictionType {
<BUG>public static final RestrictionType LITERAL = new RestrictionType( "LITERAL" );
public static final RestrictionType VARIABLE = new RestrictionType( "VARIABLE" );
public static final RestrictionType QUALIFIED_IDENTIFIER = new RestrictionType( "QUALIFIED_IDENTIFIER" );
public static final RestrictionType RETURN_VALUE_RESTRICTION = new RestrictionType( "RETURN_VALUE_RESTRICTION" );
public static final RestrictionType ENUM = new RestrictionType( "ENUM" );
protected final String type;
private RestrictionType(String t) {</BUG>
type = t;
| public static final RestrictionType LITERAL = new RestrictionType("LITERAL");
public static final RestrictionType VARIABLE = new RestrictionType("VARIABLE");
public static final RestrictionType QUALIFIED_IDENTIFIER = new RestrictionType("QUALIFIED_IDENTIFIER");
public static final RestrictionType RETURN_VALUE_RESTRICTION = new RestrictionType("RETURN_VALUE_RESTRICTION");
public static final RestrictionType ENUM = new RestrictionType("ENUM");
protected final String type;
private RestrictionType(String t) {
|
738 | public Operator getOperator() {
return operator;
}
public void setOperator(Operator operator) {
this.operator = operator;
<BUG>}
public String getConstraintPath() {
return constraintPath;
}
public void setConstraintPath(String constraintPath) {
this.constraintPath = constraintPath;</BUG>
}
| [DELETED] |
739 | if ( webServerPort == 443 )
{
sb.append( "s" );
}
sb.append( "://" );
<BUG>sb.append( addressResolver.getHostname() );
if ( webServerPort != 80 )</BUG>
{
sb.append( ":" );
sb.append( webServerPort );
| sb.append( getWebServerAddress() );
if ( webServerPort != 80 )
|
740 | import org.neo4j.server.NeoServer;
public interface WebServer
{
void init();
void setNeoServer( NeoServer server );
<BUG>void setPort( int portNo );
void start();</BUG>
void stop();
void setMaxThreads( int maxThreads );
void addJAXRSPackages( List<String> packageNames, String serverMountPoint );
| void setAddress( String addr );
void start();
|
741 | String DEFAULT_CONFIG_DIR = File.separator + "etc" + File.separator + "neo";
String DATABASE_LOCATION_PROPERTY_KEY = "org.neo4j.server.database.location";
String NEO_SERVER_CONFIG_FILE_KEY = "org.neo4j.server.properties";
String DB_MODE_KEY = "org.neo4j.server.database.mode";
int DEFAULT_WEBSERVER_PORT = 7474;
<BUG>String WEBSERVER_PORT_PROPERTY_KEY = "org.neo4j.server.webserver.port";
String WEBSERVER_MAX_THREADS_PROPERTY_KEY = "org.neo4j.server.webserver.maxthreads";</BUG>
String REST_API_PATH_PROPERTY_KEY = "org.neo4j.server.webadmin.data.uri";
String REST_API_PACKAGE = "org.neo4j.server.rest.web";
String DEFAULT_DATA_API_PATH = "/db/data";
| String DEFAULT_WEBSERVER_ADDRESS = "0.0.0.0";
String WEBSERVER_ADDRESS_PROPERTY_KEY = "org.neo4j.server.webserver.address";
String WEBSERVER_MAX_THREADS_PROPERTY_KEY = "org.neo4j.server.webserver.maxthreads";
|
742 | import java.util.TreeSet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.mortbay.jetty.Handler;
<BUG>import org.mortbay.jetty.Server;
import org.mortbay.jetty.SessionManager;</BUG>
import org.mortbay.jetty.handler.MovedContextHandler;
import org.mortbay.jetty.servlet.Context;
import org.mortbay.jetty.servlet.HashSessionManager;
| import org.mortbay.jetty.Connector;
import org.mortbay.jetty.nio.SelectChannelConnector;
import org.mortbay.jetty.SessionManager;
|
743 | import com.sun.jersey.api.core.ResourceConfig;
import com.sun.jersey.spi.container.servlet.ServletContainer;
public class Jetty6WebServer implements WebServer
{
public static final Logger log = Logger.getLogger( Jetty6WebServer.class );
<BUG>public static final int DEFAULT_PORT = 80;
private Server jetty;
private int jettyPort = DEFAULT_PORT;
private final HashMap<String, String> staticContent = new HashMap<String, String>();</BUG>
private final HashMap<String, ServletHolder> jaxRSPackages = new HashMap<String, ServletHolder>();
| public static final String DEFAULT_ADDRESS = "0.0.0.0";
private String jettyAddr = DEFAULT_ADDRESS;
private final HashMap<String, String> staticContent = new HashMap<String, String>();
|
744 | ClassLoader.getSystemClassLoader();
systemClassLoader.loadClass(className);
return true;
}
catch (ClassNotFoundException cnfe) {
<BUG>Class<?> classObj = getClass();
if (classObj.getResource(className) != null) {
</BUG>
return true;
| [DELETED] |
745 | else if (type.equals(String.class.getName())) {
map.put(kvp[0], kvp[1]);
}
else {
try {
<BUG>Class<?> classObj = Class.forName(type);
Constructor<?> constructor = classObj.getConstructor(
</BUG>
new Class<?>[] {String.class});
| Class<?> clazz = Class.forName(type);
Constructor<?> constructor = clazz.getConstructor(
|
746 | return _instance._get(null, null, methodKey);
}
public static Method put(MethodKey methodKey, Method method) {
return _instance._put(methodKey, method);
}
<BUG>public static void remove(Class<?> classObj) {
_instance._remove(classObj);
</BUG>
}
| public static void remove(Class<?> clazz) {
_instance._remove(clazz);
|
747 | Method method = methodsMap.get(methodKey);
if (method == null) {
String className = methodKey.getClassName();
String methodName = methodKey.getMethodName();
Class<?>[] parameterTypes = methodKey.getParameterTypes();
<BUG>Class<?> classObj = classesMap.get(className);
if (classObj == null) {
</BUG>
Thread currentThread = Thread.currentThread();
| Class<?> clazz = classesMap.get(className);
if (clazz == null) {
|
748 | package com.liferay.portal.kernel.search;
import java.util.List;
public class IndexerRegistryUtil {
<BUG>public static Indexer getIndexer(Class<?> classObj) {
return getIndexerRegistry().getIndexer(classObj.getName());
</BUG>
}
| public static Indexer getIndexer(Class<?> clazz) {
return getIndexerRegistry().getIndexer(clazz.getName());
|
749 | package org.eclipse.emf.index.util;
import java.util.Collection;
<BUG>public class CollectionUtils {
public static <T> Collection<T> addIfNotNull(Collection<T> c, T element) {</BUG>
if (element != null)
c.add(element);
return c;
| import java.util.ArrayList;
public static <T> Collection<T> copyOrNull(Collection<T> source) {
if(source == null) return null;
return new ArrayList<T>(source);
}
public static <T> Collection<T> addIfNotNull(Collection<T> c, T element) {
|
750 | import org.eclipse.emf.index.EClassDescriptor;
import org.eclipse.emf.index.EPackageDescriptor;
import org.eclipse.emf.index.IGenericQuery;
import org.eclipse.emf.index.IIndexStore;
import org.eclipse.emf.index.impl.DefaultQueryTool;
<BUG>public class EClassDAOImpl extends BasicCachingMemoryDAO<EClassDescriptor> implements EClassDescriptor.DAO {
</BUG>
protected InverseReferenceCache<EPackageDescriptor, EClassDescriptor> ePackageScope;
public EClassDAOImpl(IIndexStore indexStore) {
super(indexStore);
| public class EClassDAOImpl extends BasicMemoryDAOImpl<EClassDescriptor> implements EClassDescriptor.DAO {
|
751 | return DefaultQueryTool.createQueryEClass(this, eClass);
}
public IGenericQuery<EClassDescriptor> createQueryEClassesInPackage(EPackageDescriptor ePackageDescriptor) {
return ePackageScope.createQuery(ePackageDescriptor);
}
<BUG>protected class EClassQuery extends BasicCachingMemoryDAO<EClassDescriptor>.Query implements EClassDescriptor.Query {
</BUG>
private String namePattern;
private EPackageDescriptor ePackageDescriptor;
private EPackageDescriptor.Query ePackageQuery;
| protected class EClassQuery extends BasicMemoryDAOImpl<EClassDescriptor>.Query implements EClassDescriptor.Query {
|
752 | ePackageQuery = indexStore.ePackageDAO().createQuery();
return ePackageQuery;
}
@Override
protected boolean matches(EClassDescriptor typeDescriptor) {
<BUG>return (namePattern == null || namePattern.equals(typeDescriptor.getName()));
}</BUG>
@Override
protected Collection<EClassDescriptor> scope() {
Collection<EClassDescriptor> eClassesByEPackage = ePackageScope.lookup(ePackageDescriptor, ePackageQuery);
| return matchesGlobbing(typeDescriptor.getName(), namePattern);
|
753 | private TargetDesc target;
protected Query(TargetDesc target) {
this.target = target;
}
public Collection<SourceDesc> executeListResult() {
<BUG>return lookup(target);
}</BUG>
public SourceDesc executeSingleResult() {
Collection<SourceDesc> result = lookup(target);
if(result != null && !result.isEmpty()) {
| return CollectionUtils.copyOrNull(lookup(target));
|
754 | import org.eclipse.emf.index.ECrossReferenceDescriptor;
import org.eclipse.emf.index.EObjectDescriptor;
import org.eclipse.emf.index.IGenericQuery;
import org.eclipse.emf.index.IIndexStore;
import org.eclipse.emf.index.impl.DefaultQueryTool;
<BUG>public class ECrossReferenceDAOImpl extends BasicCachingMemoryDAO<ECrossReferenceDescriptor> implements
</BUG>
ECrossReferenceDescriptor.DAO {
protected InverseReferenceCache<EObjectDescriptor, ECrossReferenceDescriptor> sourceScope;
protected InverseReferenceCache<EObjectDescriptor, ECrossReferenceDescriptor> targetScope;
| public class ECrossReferenceDAOImpl extends BasicMemoryDAOImpl<ECrossReferenceDescriptor> implements
|
755 | return sourceScope.createQuery(sourceDescriptor);
}
public IGenericQuery<ECrossReferenceDescriptor> createQueryCrossReferencesTo(EObjectDescriptor targetDescriptor) {
return targetScope.createQuery(targetDescriptor);
}
<BUG>protected class CrossRefQuery extends BasicCachingMemoryDAO<ECrossReferenceDescriptor>.Query implements
</BUG>
ECrossReferenceDescriptor.Query {
private EObjectDescriptor.Query sourceQuery;
private EObjectDescriptor.Query targetQuery;
| protected class CrossRefQuery extends BasicMemoryDAOImpl<ECrossReferenceDescriptor>.Query implements
|
756 | public ECrossReferenceDescriptor.Query referenceName(String pattern) {
referenceNamePattern = pattern;
return this;
}
protected boolean matches(ECrossReferenceDescriptor crossRefDescriptor) {
<BUG>return referenceNamePattern == null || referenceNamePattern.equals(crossRefDescriptor.getReferenceName());
}</BUG>
@Override
protected Collection<ECrossReferenceDescriptor> scope() {
Collection<ECrossReferenceDescriptor> eCrossReferencesBySource = sourceScope.lookup(sourceDescriptor, sourceQuery);
| return matchesGlobbing(crossRefDescriptor.getReferenceName(), referenceNamePattern);
|
757 | <BUG>package org.eclipse.emf.index.ecore;
import org.eclipse.emf.ecore.EPackage;</BUG>
import org.eclipse.emf.index.EPackageDescriptor;
import org.eclipse.emf.index.IIndexStore;
public class EPackageRegistryIndexFeeder {
| import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.ecore.EPackage;
|
758 | import org.eclipse.emf.index.EPackageDescriptor;
import org.eclipse.emf.index.IIndexStore;
public class EPackageRegistryIndexFeeder {
public static void feedEPackagesFromRegistry(IIndexStore indexStore) {
for (boolean hasChanged = true; hasChanged;) {
<BUG>for (String nsURI : EPackage.Registry.INSTANCE.keySet()) {
hasChanged = false;</BUG>
EPackageDescriptor storedEPackages = indexStore.ePackageDAO().createQuery().nsURI(nsURI)
.executeSingleResult();
if (storedEPackages == null) {
| List<String> nsURIs = new ArrayList<String>(EPackage.Registry.INSTANCE.keySet());
for (String nsURI : nsURIs) {
hasChanged = false;
|
759 | import org.eclipse.emf.index.EObjectDescriptor;
import org.eclipse.emf.index.IGenericQuery;
import org.eclipse.emf.index.IIndexStore;
import org.eclipse.emf.index.ResourceDescriptor;
import org.eclipse.emf.index.impl.DefaultQueryTool;
<BUG>public class EObjectDAOImpl extends BasicCachingMemoryDAO<EObjectDescriptor> implements EObjectDescriptor.DAO {
</BUG>
protected InverseReferenceCache<ResourceDescriptor, EObjectDescriptor> resourceScope;
protected InverseReferenceCache<EClassDescriptor, EObjectDescriptor> eClassScope;
public EObjectDAOImpl(IIndexStore indexStore) {
| public class EObjectDAOImpl extends BasicMemoryDAOImpl<EObjectDescriptor> implements EObjectDescriptor.DAO {
|
760 | return DefaultQueryTool.createQueryEObjectsInResource(this, eObject, resourceDescriptor);
}
public IGenericQuery<EObjectDescriptor> createQueryEObjectsInResource(ResourceDescriptor resourceDescriptor) {
return resourceScope.createQuery(resourceDescriptor);
}
<BUG>private class ElementQuery extends BasicCachingMemoryDAO<EObjectDescriptor>.Query implements EObjectDescriptor.Query {
</BUG>
private ResourceDescriptor resourceDescriptor;
private ResourceDescriptor.Query resourceQuery;
private String fragmentPattern;
| private class ElementQuery extends BasicMemoryDAOImpl<EObjectDescriptor>.Query implements EObjectDescriptor.Query {
|
761 | }
userDataPatterns.put(key, pattern);
return this;
}
public boolean matches(EObjectDescriptor elementDescriptor) {
<BUG>if ((fragmentPattern == null || fragmentPattern.equals(elementDescriptor.getFragment()))
&& (namePattern == null || namePattern.equals(elementDescriptor.getName()))
&& (typeDescriptor == null || typeDescriptor.equals(elementDescriptor.getEClassDescriptor()))) {</BUG>
if (userDataPatterns != null) {
for (Entry<String, String> userDataEntry : userDataPatterns.entrySet()) {
| public IGenericQuery<EObjectDescriptor> createQueryEObjectsByType(EClassDescriptor eClassDescriptor) {
return eClassScope.createQuery(eClassDescriptor);
|
762 | import lu.nowina.nexu.flow.operation.SelectPrivateKeyOperation;
import lu.nowina.nexu.flow.operation.SignOperation;
import lu.nowina.nexu.flow.operation.TokenOperationResultKey;
import lu.nowina.nexu.view.core.UIDisplay;
import lu.nowina.nexu.view.core.UIOperation;
<BUG>import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import eu.europa.esig.dss.SignatureValue;
import eu.europa.esig.dss.token.DSSPrivateKeyEntry;
import eu.europa.esig.dss.token.SignatureTokenConnection;</BUG>
class SignatureFlow extends AbstractCoreFlow<SignatureRequest, SignatureResponse> {
| [DELETED] |
763 | getOperationFactory().getOperation(AdvancedCreationFeedbackOperation.class,
api, map).perform();
}
if(api.getAppConfig().isEnablePopUps()) {
getOperationFactory().getOperation(UIOperation.class, "/fxml/message.fxml",
<BUG>new Object[]{ResourceBundle.getBundle("bundles/nexu").getString("signature.flow.finished")}).perform();
}</BUG>
return new Execution<SignatureResponse>(new SignatureResponse(value, key.getCertificate(), key.getCertificateChain()));
} else {
return handleErrorOperationResult(signOperationResult);
| new Object[]{"signature.flow.finished"}).perform();
|
764 | } else {
return handleErrorOperationResult(signOperationResult);
}
} else {
if(api.getAppConfig().isEnablePopUps()) {
<BUG>getOperationFactory().getOperation(UIOperation.class, "/fxml/message.fxml",
new Object[]{MessageFormat.format(
ResourceBundle.getBundle("bundles/nexu").getString("signature.flow.no.key.selected"),
api.getAppConfig().getApplicationName())
}).perform();</BUG>
}
| new Object[]{"signature.flow.no.key.selected", api.getAppConfig().getApplicationName()}).perform();
|
765 | package lu.nowina.nexu.view.ui;
<BUG>import java.net.URL;
import java.util.ResourceBundle;</BUG>
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
| import java.text.MessageFormat;
import java.util.Arrays;
import java.util.ResourceBundle;
|
766 | public class MessageController extends AbstractUIOperationController<Void> implements Initializable {
@FXML
private Label message;
@FXML
private Button ok;
<BUG>private String defaultErrorText;
@Override</BUG>
public void initialize(URL location, ResourceBundle resources) {
ok.setOnAction((e) -> {
signalEnd(null);
| private ResourceBundle resources;
@Override
|
767 | try {
server.stop();
} catch(Exception e1) {}
throw e;
}
<BUG>new Thread(() -> {
try {
server.join();
} catch(Exception e) {
logger.error("Exception on join", e);
}
});</BUG>
return server;
| server.start();
|
768 | package lu.nowina.nexu.flow;
<BUG>import java.text.MessageFormat;
import java.util.ResourceBundle;</BUG>
import lu.nowina.nexu.api.Execution;
import lu.nowina.nexu.api.Feedback;
import lu.nowina.nexu.api.NexuAPI;
| [DELETED] |
769 | final Feedback feedback = new Feedback(e);
getOperationFactory().getOperation(
UIOperation.class, "/fxml/provide-feedback.fxml",
new Object[]{feedback, api.getAppConfig().getServerUrl(), api.getAppConfig().getApplicationVersion(),
api.getAppConfig().getApplicationName()}).perform();
<BUG>getOperationFactory().getOperation(UIOperation.class, "/fxml/message.fxml",
new Object[]{MessageFormat.format(
ResourceBundle.getBundle("bundles/nexu").getString("exception.failure.message"),
api.getAppConfig().getApplicationName())
}).perform();</BUG>
}
| new Object[]{"exception.failure.message", api.getAppConfig().getApplicationName()}).perform();
|
770 | package lu.nowina.nexu.flow;
import java.util.List;
import java.util.Map;
<BUG>import java.util.ResourceBundle;
import lu.nowina.nexu.api.CardAdapter;</BUG>
import lu.nowina.nexu.api.DetectedCard;
import lu.nowina.nexu.api.Execution;
import lu.nowina.nexu.api.GetCertificateRequest;
| import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import eu.europa.esig.dss.token.DSSPrivateKeyEntry;
import eu.europa.esig.dss.token.SignatureTokenConnection;
import eu.europa.esig.dss.x509.CertificateToken;
import lu.nowina.nexu.api.CardAdapter;
|
771 | import lu.nowina.nexu.flow.operation.GetTokenConnectionOperation;
import lu.nowina.nexu.flow.operation.SelectPrivateKeyOperation;
import lu.nowina.nexu.flow.operation.TokenOperationResultKey;
import lu.nowina.nexu.view.core.UIDisplay;
import lu.nowina.nexu.view.core.UIOperation;
<BUG>import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import eu.europa.esig.dss.token.DSSPrivateKeyEntry;
import eu.europa.esig.dss.token.SignatureTokenConnection;
import eu.europa.esig.dss.x509.CertificateToken;</BUG>
class GetCertificateFlow extends AbstractCoreFlow<GetCertificateRequest, GetCertificateResponse> {
| [DELETED] |
772 | resp.setSupportedDigests(cardAdapter.getSupportedDigestAlgorithms(card));
resp.setPreferredDigest(cardAdapter.getPreferredDigestAlgorithm(card));
}
if(api.getAppConfig().isEnablePopUps()) {
getOperationFactory().getOperation(UIOperation.class, "/fxml/message.fxml",
<BUG>new Object[]{ ResourceBundle.getBundle("bundles/nexu").getString("certificates.flow.finished") }).perform();
}</BUG>
return new Execution<GetCertificateResponse>(resp);
} else {
return handleErrorOperationResult(selectPrivateKeyOperationResult);
| new Object[]{ "certificates.flow.finished" }).perform();
|
773 | when(operationFactory.getOperation(GetMatchingCardAdaptersOperation.class, api)).thenReturn(operation);
final Operation<Object> successOperation = mock(Operation.class);
when(successOperation.perform()).thenReturn(new OperationResult<Object>(BasicOperationStatus.SUCCESS));
when(operationFactory.getOperation(
eq(UIOperation.class), eq("/fxml/provide-feedback.fxml"), any(Object[].class))).thenReturn(successOperation);
<BUG>when(operationFactory.getOperation(
UIOperation.class, "/fxml/message.fxml", new Object[]{"Finished"})).thenReturn(successOperation);</BUG>
final GetCertificateFlow flow = new GetCertificateFlow(display, api);
flow.setOperationFactory(operationFactory);
final GetCertificateRequest req = new GetCertificateRequest();
| [DELETED] |
774 | import java.io.IOException;
import static org.gradle.internal.nativeplatform.jna.Kernel32.*;
public class WindowsHandlesManipulator {
public void uninheritStandardStreams() throws ProcessInitializationException {
Kernel32 kernel32 = INSTANCE;
<BUG>try {
HANDLE stdin = kernel32.GetStdHandle(Kernel32.STD_INPUT_HANDLE);
makeUninheritable(kernel32, stdin);
HANDLE stdout = kernel32.GetStdHandle(Kernel32.STD_OUTPUT_HANDLE);
makeUninheritable(kernel32, stdout);
HANDLE stderr = kernel32.GetStdHandle(Kernel32.STD_ERROR_HANDLE);
makeUninheritable(kernel32, stderr);</BUG>
} catch (Exception e) {
| uninheritStream(kernel32, Kernel32.STD_INPUT_HANDLE);
uninheritStream(kernel32, Kernel32.STD_OUTPUT_HANDLE);
uninheritStream(kernel32, Kernel32.STD_ERROR_HANDLE);
|
775 | }
@RootTask
static Task<Exec.Result> exec(String parameter, int number) {
Task<String> task1 = MyTask.create(parameter);
Task<Integer> task2 = Adder.create(number, number + 2);
<BUG>return Task.ofType(Exec.Result.class).named("exec", "/bin/sh")
.in(() -> task1)</BUG>
.in(() -> task2)
.process(Exec.exec((str, i) -> args("/bin/sh", "-c", "\"echo " + i + "\"")));
}
| return Task.named("exec", "/bin/sh").ofType(Exec.Result.class)
.in(() -> task1)
|
776 | return args;
}
static class MyTask {
static final int PLUS = 10;
static Task<String> create(String parameter) {
<BUG>return Task.ofType(String.class).named("MyTask", parameter)
.in(() -> Adder.create(parameter.length(), PLUS))</BUG>
.in(() -> Fib.create(parameter.length()))
.process((sum, fib) -> something(parameter, sum, fib));
}
| return Task.named("MyTask", parameter).ofType(String.class)
.in(() -> Adder.create(parameter.length(), PLUS))
|
777 | }
@RootTask
public static Task<String> standardArgs(int first, String second) {
firstInt = first;
secondString = second;
<BUG>return Task.ofType(String.class).named("StandardArgs", first, second)
.process(() -> second + " " + first * 100);</BUG>
}
@Test
public void shouldParseFlags() throws Exception {
| return Task.named("StandardArgs", first, second).ofType(String.class)
.process(() -> second + " " + first * 100);
|
778 | assertThat(parsedEnum, is(CustomEnum.BAR));
}
@RootTask
public static Task<String> enums(CustomEnum enm) {
parsedEnum = enm;
<BUG>return Task.ofType(String.class).named("Enums", enm)
.process(enm::toString);</BUG>
}
@Test
public void shouldParseCustomTypes() throws Exception {
| return Task.named("Enums", enm).ofType(String.class)
.process(enm::toString);
|
779 | assertThat(parsedType.content, is("blarg parsed for you!"));
}
@RootTask
public static Task<String> customType(CustomType myType) {
parsedType = myType;
<BUG>return Task.ofType(String.class).named("Types", myType.content)
.process(() -> myType.content);</BUG>
}
public enum CustomEnum {
BAR
| return Task.named("Types", myType.content).ofType(String.class)
.process(() -> myType.content);
|
780 | TaskContext taskContext = TaskContext.inmem();
TaskContext.Value<Long> value = taskContext.evaluate(fib92);
value.consume(f92 -> System.out.println("fib(92) = " + f92));
}
static Task<Long> create(long n) {
<BUG>TaskBuilder<Long> fib = Task.ofType(Long.class).named("Fib", n);
</BUG>
if (n < 2) {
return fib
.process(() -> n);
| TaskBuilder<Long> fib = Task.named("Fib", n).ofType(Long.class);
|
781 | } else {
updateMemo();
callback.updateMemo();
}
dismiss();
<BUG>}else{
</BUG>
Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show();
}
}
| [DELETED] |
782 | }
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_memo);
<BUG>ChinaPhoneHelper.setStatusBar(this,true);
</BUG>
topicId = getIntent().getLongExtra("topicId", -1);
if (topicId == -1) {
finish();
| ChinaPhoneHelper.setStatusBar(this, true);
|
783 | MemoEntry.COLUMN_REF_TOPIC__ID + " = ?"
, new String[]{String.valueOf(topicId)});
}
public Cursor selectMemo(long topicId) {
Cursor c = db.query(MemoEntry.TABLE_NAME, null, MemoEntry.COLUMN_REF_TOPIC__ID + " = ?", new String[]{String.valueOf(topicId)}, null, null,
<BUG>MemoEntry._ID + " DESC", null);
</BUG>
if (c != null) {
c.moveToFirst();
}
| MemoEntry.COLUMN_ORDER + " ASC", null);
|
784 | MemoEntry._ID + " = ?",
new String[]{String.valueOf(memoId)});
}
public long updateMemoContent(long memoId, String memoContent) {
ContentValues values = new ContentValues();
<BUG>values.put(MemoEntry.COLUMN_CONTENT, memoContent);
return db.update(</BUG>
MemoEntry.TABLE_NAME,
values,
MemoEntry._ID + " = ?",
| return db.update(
|
785 | import android.widget.RelativeLayout;
import android.widget.TextView;
import com.kiminonawa.mydiary.R;
import com.kiminonawa.mydiary.db.DBManager;
import com.kiminonawa.mydiary.shared.EditMode;
<BUG>import com.kiminonawa.mydiary.shared.ThemeManager;
import java.util.List;
public class MemoAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements EditMode {
</BUG>
private List<MemoEntity> memoList;
| import com.marshalchen.ultimaterecyclerview.dragsortadapter.DragSortAdapter;
public class MemoAdapter extends DragSortAdapter<DragSortAdapter.ViewHolder> implements EditMode {
|
786 | private DBManager dbManager;
private boolean isEditMode = false;
private EditMemoDialogFragment.MemoCallback callback;
private static final int TYPE_HEADER = 0;
private static final int TYPE_ITEM = 1;
<BUG>public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback) {
this.mActivity = activity;</BUG>
this.topicId = topicId;
this.memoList = memoList;
| public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback, RecyclerView recyclerView) {
super(recyclerView);
this.mActivity = activity;
|
787 | this.memoList = memoList;
this.dbManager = dbManager;
this.callback = callback;
}
@Override
<BUG>public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
</BUG>
View view;
if (isEditMode) {
if (viewType == TYPE_HEADER) {
| public DragSortAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
788 | editMemoDialogFragment.show(mActivity.getSupportFragmentManager(), "editMemoDialogFragment");
}
});
}
}
<BUG>protected class MemoViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
private View rootView;
private TextView TV_memo_item_content;</BUG>
private ImageView IV_memo_item_delete;
| protected class MemoViewHolder extends DragSortAdapter.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
private ImageView IV_memo_item_dot;
private TextView TV_memo_item_content;
|
789 | }
@RootTask
static Task<Exec.Result> exec(String parameter, int number) {
Task<String> task1 = MyTask.create(parameter);
Task<Integer> task2 = Adder.create(number, number + 2);
<BUG>return Task.ofType(Exec.Result.class).named("exec", "/bin/sh")
.in(() -> task1)</BUG>
.in(() -> task2)
.process(Exec.exec((str, i) -> args("/bin/sh", "-c", "\"echo " + i + "\"")));
}
| return Task.named("exec", "/bin/sh").ofType(Exec.Result.class)
.in(() -> task1)
|
790 | return args;
}
static class MyTask {
static final int PLUS = 10;
static Task<String> create(String parameter) {
<BUG>return Task.ofType(String.class).named("MyTask", parameter)
.in(() -> Adder.create(parameter.length(), PLUS))</BUG>
.in(() -> Fib.create(parameter.length()))
.process((sum, fib) -> something(parameter, sum, fib));
}
| return Task.named("MyTask", parameter).ofType(String.class)
.in(() -> Adder.create(parameter.length(), PLUS))
|
791 | final String instanceField = "from instance";
final TaskContext context = TaskContext.inmem();
final AwaitingConsumer<String> val = new AwaitingConsumer<>();
@Test
public void shouldJavaUtilSerialize() throws Exception {
<BUG>Task<Long> task1 = Task.ofType(Long.class).named("Foo", "Bar", 39)
.process(() -> 9999L);
Task<String> task2 = Task.ofType(String.class).named("Baz", 40)
.in(() -> task1)</BUG>
.ins(() -> singletonList(task1))
| Task<Long> task1 = Task.named("Foo", "Bar", 39).ofType(Long.class)
Task<String> task2 = Task.named("Baz", 40).ofType(String.class)
.in(() -> task1)
|
792 | assertEquals(des.id().name(), "Baz");
assertEquals(val.awaitAndGet(), "[9999] hello 10004");
}
@Test(expected = NotSerializableException.class)
public void shouldNotSerializeWithInstanceFieldReference() throws Exception {
<BUG>Task<String> task = Task.ofType(String.class).named("WithRef")
.process(() -> instanceField + " causes an outer reference");</BUG>
serialize(task);
}
@Test
| Task<String> task = Task.named("WithRef").ofType(String.class)
.process(() -> instanceField + " causes an outer reference");
|
793 | serialize(task);
}
@Test
public void shouldSerializeWithLocalReference() throws Exception {
String local = instanceField;
<BUG>Task<String> task = Task.ofType(String.class).named("WithLocalRef")
.process(() -> local + " won't cause an outer reference");</BUG>
serialize(task);
Task<String> des = deserialize();
context.evaluate(des).consume(val);
| Task<String> task = Task.named("WithLocalRef").ofType(String.class)
.process(() -> local + " won't cause an outer reference");
|
794 | }
@RootTask
public static Task<String> standardArgs(int first, String second) {
firstInt = first;
secondString = second;
<BUG>return Task.ofType(String.class).named("StandardArgs", first, second)
.process(() -> second + " " + first * 100);</BUG>
}
@Test
public void shouldParseFlags() throws Exception {
| return Task.named("StandardArgs", first, second).ofType(String.class)
.process(() -> second + " " + first * 100);
|
795 | assertThat(parsedEnum, is(CustomEnum.BAR));
}
@RootTask
public static Task<String> enums(CustomEnum enm) {
parsedEnum = enm;
<BUG>return Task.ofType(String.class).named("Enums", enm)
.process(enm::toString);</BUG>
}
@Test
public void shouldParseCustomTypes() throws Exception {
| return Task.named("Enums", enm).ofType(String.class)
.process(enm::toString);
|
796 | assertThat(parsedType.content, is("blarg parsed for you!"));
}
@RootTask
public static Task<String> customType(CustomType myType) {
parsedType = myType;
<BUG>return Task.ofType(String.class).named("Types", myType.content)
.process(() -> myType.content);</BUG>
}
public enum CustomEnum {
BAR
| return Task.named("Types", myType.content).ofType(String.class)
.process(() -> myType.content);
|
797 | TaskContext taskContext = TaskContext.inmem();
TaskContext.Value<Long> value = taskContext.evaluate(fib92);
value.consume(f92 -> System.out.println("fib(92) = " + f92));
}
static Task<Long> create(long n) {
<BUG>TaskBuilder<Long> fib = Task.ofType(Long.class).named("Fib", n);
</BUG>
if (n < 2) {
return fib
.process(() -> n);
| TaskBuilder<Long> fib = Task.named("Fib", n).ofType(Long.class);
|
798 | public ReportElement getBase() {
return base;
}
@Override
public float print(PDDocument document, PDPageContentStream stream, int pageNumber, float startX, float startY, float allowedWidth) throws IOException {
<BUG>PDPage currPage = (PDPage) document.getDocumentCatalog().getPages().get(pageNo);
PDPageContentStream pageStream = new PDPageContentStream(document, currPage, true, false);
</BUG>
base.print(document, pageStream, pageNo, x, y, width);
pageStream.close();
| PDPage currPage = document.getDocumentCatalog().getPages().get(pageNo);
PDPageContentStream pageStream = new PDPageContentStream(document, currPage, PDPageContentStream.AppendMode.APPEND, false);
|
799 | public PdfTextStyle(String config) {
Assert.hasText(config);
String[] split = config.split(",");
Assert.isTrue(split.length == 3, "config must look like: 10,Times-Roman,#000000");
fontSize = Integer.parseInt(split[0]);
<BUG>font = resolveStandard14Name(split[1]);
color = new Color(Integer.valueOf(split[2].substring(1), 16));</BUG>
}
public int getFontSize() {
return fontSize;
| font = getFont(split[1]);
color = new Color(Integer.valueOf(split[2].substring(1), 16));
|
800 | package cc.catalysts.boot.report.pdf.elements;
import cc.catalysts.boot.report.pdf.config.PdfTextStyle;
import cc.catalysts.boot.report.pdf.utils.ReportAlignType;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
<BUG>import org.apache.pdfbox.pdmodel.font.PDFont;
import org.slf4j.Logger;</BUG>
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import java.io.IOException;
| import org.apache.pdfbox.pdmodel.font.PDType1Font;
import org.apache.pdfbox.util.Matrix;
import org.slf4j.Logger;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.