id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
2,701
.assign((t, v) -> t.setSecurity(getOrCreateSecurity(v))) .section("shares") // .find("Nominal Kurs") // .match("^STK (?<shares>\\d+(,\\d+)?) (\\w{3}+) ([\\d.]+,\\d+)$") .assign((t, v) -> t.setShares(asShares(v.get("shares")))) <BUG>.section("amount", "currency") // </BUG> .find("Wert Konto-Nr. Betrag zu Ihren Gunsten") .match("^(\\d+.\\d+.\\d{4}+) ([0-9]*) (?<currency>\\w{3}+) (?<amount>[\\d.]+,\\d+)$") .assign((t, v) -> {
.find("Wert Konto-Nr. Betrag zu Ihren Lasten")
2,702
.assign((t, v) -> t.setSecurity(getOrCreateSecurity(v))) .section("shares") // .find("Nominal Ex-Tag Zahltag Dividenden-Betrag pro Stück") .match("^STK (?<shares>\\d+(,\\d+)?) .*$") .assign((t, v) -> t.setShares(asShares(v.get("shares")))) <BUG>.section("date", "amount", "currency") </BUG> .find("Wert Konto-Nr. Betrag zu Ihren Gunsten") .match("^(?<date>\\d+.\\d+.\\d{4}+) ([0-9]*) (?<currency>\\w{3}+) (?<amount>[\\d.]+,\\d+)$") .assign((t, v) -> {
.section("date", "amount", "currency") //
2,703
.assign((t, v) -> { t.setDate(asDate(v.get("date"))); t.setAmount(asAmount(v.get("amount"))); t.setCurrencyCode(asCurrencyCode(v.get("currency"))); }) <BUG>.section("forex", "localCurrency", "forexCurrency", "exchangeRate") .optional() </BUG> .find("Wert Konto-Nr. Betrag zu Ihren Gunsten")
.section("forex", "localCurrency", "forexCurrency", "exchangeRate") // .optional() //
2,704
import java.io.FileNotFoundException; import java.io.IOException; import java.util.Map; import java.util.TreeMap; public class CoreProjectLoader { <BUG>public static boolean loadProject(MockProject project, @NotNull VirtualFile virtualFile) throws IOException, JDOMException, InvalidDataException { if (virtualFile.isDirectory() && virtualFile.findChild(Project.DIRECTORY_STORE_FOLDER) != null) { project.setBaseDir(virtualFile); loadDirectoryProject(project, virtualFile); </BUG> return true;
public static boolean loadProject(MockProject project, @NotNull VirtualFile virtualFile) throws IOException, JDOMException { VirtualFile ideaDir = ProjectKt.getProjectStoreDirectory(virtualFile); if (ideaDir != null) { loadDirectoryProject(project, ideaDir);
2,705
throw new JDOMException("cannot find ProjectModuleManager state in modules.xml"); } final CoreModuleManager moduleManager = (CoreModuleManager)ModuleManager.getInstance(project); moduleManager.loadState(moduleManagerState); VirtualFile miscXml = dotIdea.findChild("misc.xml"); <BUG>if (miscXml == null) throw new FileNotFoundException("Missing 'misc.xml' in " + dotIdea.getPath());</BUG> storageData = loadStorageFile(project, miscXml); final Element projectRootManagerState = storageData.get("ProjectRootManager");
if (miscXml != null) {
2,706
storageData = loadStorageFile(project, miscXml); final Element projectRootManagerState = storageData.get("ProjectRootManager"); if (projectRootManagerState == null) { throw new JDOMException("cannot find ProjectRootManager state in misc.xml"); } <BUG>((ProjectRootManagerImpl) ProjectRootManager.getInstance(project)).loadState(projectRootManagerState); VirtualFile libraries = dotIdea.findChild("libraries");</BUG> if (libraries != null) { Map<String, Element> data = DirectoryStorageUtil.loadFrom(libraries, PathMacroManager.getInstance(project).createTrackingSubstitutor()); Element libraryTable = DefaultStateSerializer.deserializeState(DirectoryStorageUtil.getCompositeState(data, new ProjectLibraryTable.LibraryStateSplitter()), Element.class, null);
((ProjectRootManagerImpl)ProjectRootManager.getInstance(project)).loadState(projectRootManagerState); VirtualFile libraries = dotIdea.findChild("libraries");
2,707
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;
2,708
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());
2,709
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
2,710
<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;
2,711
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]
2,712
<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;
2,713
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;
2,714
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;
2,715
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);
2,716
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 {
2,717
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(),
2,718
) ); }else{ return new TimeNode( generateDayCandidatesQuestionMarkNotSupported( <BUG>date.getYear(), date.getMonthOfYear(), </BUG> ((DayOfWeekFieldDefinition) cronDefinition.getFieldDefinition(DAY_OF_WEEK) ).getMondayDoWValue()
date.getYear(), date.getMonthValue(),
2,719
} 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);
2,720
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]
2,721
<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;
2,722
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;
2,723
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()
2,724
DynamicMBean mbean = null; if ((mbean=mbeans.remove(poolName))!=null) { Registry registry = Registry.getRegistry(null, null); ManagedBean managed = registry.findManagedBean(this.getClass().getName()); if (managed!=null) { <BUG>ObjectName oname = new ObjectName("org.apache.tomcat.jdbc.pool.jmx:type="+getClass().getName()+",name=" + poolName); registry.unregisterComponent(oname);</BUG> registry.removeManagedBean(managed); } }
ObjectName oname = new ObjectName(ConnectionPool.POOL_JMX_TYPE_PREFIX+getClass().getName()+",name=" + poolName); registry.unregisterComponent(oname);
2,725
registry.loadDescriptors(getClass().getPackage().getName(),getClass().getClassLoader()); ManagedBean managed = registry.findManagedBean(this.getClass().getName()); DynamicMBean mbean = managed!=null?managed.createMBean(this):null; if (mbean!=null && mbeans.putIfAbsent(poolName, mbean)==null) { registry.getMBeanServer().registerMBean( mbean, oname); <BUG>} else { log.warn(SlowQueryReport.class.getName()+ "- No JMX support, composite type was not found."); </BUG> } } else {
} else if (mbean==null){ log.warn(SlowQueryReport.class.getName()+ "- No JMX support, unable to initiate Tomcat JMX.");
2,726
super(getDefaultNotificationInfo()); this.pool = pool; } public org.apache.tomcat.jdbc.pool.ConnectionPool getPool() { return pool; <BUG>} public static final String NOTIFY_CONNECT = "CONNECTION FAILED";</BUG> public static final String NOTIFY_ABANDON = "CONNECTION ABANDONED"; @Override public MBeanNotificationInfo[] getNotificationInfo() {
public static final String NOTIFY_INIT = "INIT FAILED"; public static final String NOTIFY_CONNECT = "CONNECTION FAILED";
2,727
@Override public MBeanNotificationInfo[] getNotificationInfo() { return getDefaultNotificationInfo(); } public static MBeanNotificationInfo[] getDefaultNotificationInfo() { <BUG>String[] types = new String[] {NOTIFY_CONNECT, NOTIFY_ABANDON}; </BUG> String name = Notification.class.getName(); String description = "A connection pool error condition was met."; MBeanNotificationInfo info = new MBeanNotificationInfo(types, name, description);
String[] types = new String[] {NOTIFY_INIT, NOTIFY_CONNECT, NOTIFY_ABANDON};
2,728
import javax.management.MBeanRegistrationException; import javax.management.MBeanServer; import javax.management.MalformedObjectNameException; import javax.management.NotCompliantMBeanException; import javax.management.ObjectName; <BUG>public class ConnectionPool { protected static Log log = LogFactory.getLog(ConnectionPool.class);</BUG> protected PoolProperties poolProperties; protected BlockingQueue<PooledConnection> busy; protected BlockingQueue<PooledConnection> idle;
public static final String POOL_JMX_TYPE_PREFIX = "org.apache.tomcat.jdbc.pool.jmx:type="; protected static Log log = LogFactory.getLog(ConnectionPool.class);
2,729
properties.setMaxIdle(properties.getMaxActive()); } if (properties.getMaxIdle()<properties.getMinIdle()) { log.warn("maxIdle is smaller than minIdle, setting maxIdle to: "+properties.getMinIdle()); properties.setMaxIdle(properties.getMinIdle()); <BUG>} PoolProperties.InterceptorDefinition[] proxies = getPoolProperties().getJdbcInterceptorsAsArray();</BUG> for (int i=0; i<proxies.length; i++) { try { proxies[i].getInterceptorClass().newInstance().poolStarted(this);
if (this.getPoolProperties().isJmxEnabled()) startJmx(); PoolProperties.InterceptorDefinition[] proxies = getPoolProperties().getJdbcInterceptorsAsArray();
2,730
PooledConnection[] initialPool = new PooledConnection[poolProperties.getInitialSize()]; try { for (int i = 0; i < initialPool.length; i++) { initialPool[i] = this.borrowConnection(0); //don't wait, should be no contention } //for <BUG>} catch (SQLException x) { close(true);</BUG> throw x; } finally { for (int i = 0; i < initialPool.length; i++) {
if (jmxPool!=null) jmxPool.notify(jmxPool.NOTIFY_INIT, getStackTrace(x)); close(true);
2,731
@Override protected void onRegistered(Context context, String registrationId) { if(NotificationModule.LOG_ENABLE) Log.i(NotificationModule.TAG, "Device registered with id = " + registrationId); GCMIntentService.context = context; <BUG>if(NotificationModule.registerRunnable!=null){ NotificationModule.registerRunnable.start(); }</BUG> }
if(NotificationModule.registerRunnable!=null && !NotificationModule.registerRunnable.isAlive()){ Thread t = new Thread(NotificationModule.registerRunnable); t.start();
2,732
@Override protected void onUnregistered(Context context, String registrationId) { if(NotificationModule.LOG_ENABLE) Log.i(NotificationModule.TAG, "Device unregistered"); if (GCMRegistrar.isRegisteredOnServer(context)) { <BUG>if(NotificationModule.unregisterRunnable!=null){ Thread t = new Thread(NotificationModule.unregisterRunnable);</BUG> t.start(); }
protected void onRegistered(Context context, String registrationId) { Log.i(NotificationModule.TAG, "Device registered with id = " + registrationId); GCMIntentService.context = context; if(NotificationModule.registerRunnable!=null && !NotificationModule.registerRunnable.isAlive()){ Thread t = new Thread(NotificationModule.registerRunnable);
2,733
task(); post_task(); } protected abstract void pre_task(); protected abstract void task(); <BUG>protected abstract void post_task(); protected String getGCMRegistrationToken() {</BUG> if(context!=null) return GCMRegistrar.getRegistrationId(context); else
protected void setRegisteredOnServersideFlag(){ GCMRegistrar.setRegisteredOnServer(context, true); protected String getGCMRegistrationToken() {
2,734
import android.util.Log; import com.google.android.gcm.GCMRegistrar; import es.javocsoft.android.lib.toolbox.ToolBox; import es.javocsoft.android.lib.toolbox.gcm.core.CustomNotificationReceiver.OnAckRunnableTask; import es.javocsoft.android.lib.toolbox.gcm.core.CustomNotificationReceiver.OnNewNotificationRunnableTask; <BUG>import es.javocsoft.android.lib.toolbox.gcm.core.GCMIntentService.OnRegistrationRunnableTask; public class NotificationModule {</BUG> public static boolean LOG_ENABLE = true; public static final String TAG = "javocsoft-toolbox: NotificationModule"; private static NotificationModule instance = null;
import es.javocsoft.android.lib.toolbox.gcm.core.GCMIntentService.OnUnregistrationRunnableTask; public class NotificationModule {
2,735
public static Context APPLICATION_CONTEXT; public static EnvironmentType ENVIRONMENT_TYPE = EnvironmentType.PRODUCTION; public static final String NOTIFICATION_ACTION_KEY = "NotificationActionKey"; public static OnAckRunnableTask ackRunnable; public static OnRegistrationRunnableTask registerRunnable; <BUG>public static Runnable unregisterRunnable; </BUG> public static OnNewNotificationRunnableTask doWhenNotificationRunnable; public static boolean multipleNot; public static String groupMultipleNotKey;
public static OnUnregistrationRunnableTask unregisterRunnable;
2,736
</BUG> public static OnNewNotificationRunnableTask doWhenNotificationRunnable; public static boolean multipleNot; public static String groupMultipleNotKey; protected NotificationModule(Context context, EnvironmentType environmentType, String appSenderId, <BUG>OnRegistrationRunnableTask registerRunnable, OnAckRunnableTask ackRunnable, Runnable unregisterRunnable, </BUG> OnNewNotificationRunnableTask doWhenNotificationRunnable, boolean multipleNot, String groupMultipleNotKey) { APPLICATION_CONTEXT = context;
public static Context APPLICATION_CONTEXT; public static EnvironmentType ENVIRONMENT_TYPE = EnvironmentType.PRODUCTION; public static final String NOTIFICATION_ACTION_KEY = "NotificationActionKey"; public static OnAckRunnableTask ackRunnable; public static OnRegistrationRunnableTask registerRunnable; public static OnUnregistrationRunnableTask unregisterRunnable; OnRegistrationRunnableTask registerRunnable, OnAckRunnableTask ackRunnable, OnUnregistrationRunnableTask unregisterRunnable,
2,737
NEW_NOTIFICATION_ACTION = NEW_NOTIFICATION_ACTION.replaceAll(APP_NOTIFICATION_ACTION_KEY, APPLICATION_CONTEXT.getPackageName()); NotificationModule.multipleNot = multipleNot; NotificationModule.groupMultipleNotKey = groupMultipleNotKey; } public static NotificationModule getInstance(Context context, EnvironmentType environmentType, String appSenderId, <BUG>OnRegistrationRunnableTask registerRunnable, OnAckRunnableTask ackRunnable, Runnable unregisterRunnable, </BUG> OnNewNotificationRunnableTask doWhenNotificationRunnable, boolean multipleNot, String groupMultipleNotKey) { if (instance == null) {
OnRegistrationRunnableTask registerRunnable, OnAckRunnableTask ackRunnable, OnUnregistrationRunnableTask unregisterRunnable,
2,738
package com.intellij.execution.process; import com.intellij.openapi.diagnostic.Logger; import com.intellij.util.Consumer; import com.intellij.util.TimeoutUtil; <BUG>import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import java.util.Map; </BUG> public class ProcessWaitFor {
import com.intellij.util.containers.MultiMap; import java.util.Collection; import java.util.Iterator;
2,739
catch (IllegalThreadStateException ignore) { } catch (RuntimeException e) { LOG.debug(e); } } <BUG>} public static void attach(@NotNull Process process, @NotNull Consumer<Integer> callback) { ourQueue.put(process, callback); } public static void detach(@NotNull Process process) { ourQueue.remove(process);</BUG> }
synchronized (ourQueue) { ourQueue.putValue(process, callback);
2,740
public class ProcessWaitForTest { @Test(timeout = 10000) public void notification() throws IOException, InterruptedException { File jvm = new File(System.getProperty("java.home"), "bin/java"); assertTrue(jvm.canExecute()); <BUG>final Semaphore semaphore = new Semaphore(); semaphore.down(); Process process = new ProcessBuilder(jvm.getPath(), "-version").redirectErrorStream(true).start(); ProcessWaitFor.attach(process, new Consumer<Integer>() { </BUG> @Override
final Semaphore semaphore1 = new Semaphore(); semaphore1.down(); Process process1 = new ProcessBuilder(jvm.getPath(), "-help").redirectErrorStream(true).start(); ProcessWaitFor.attach(process1, new Consumer<Integer>() {
2,741
import de.vanita5.twittnuker.receiver.NotificationReceiver; import de.vanita5.twittnuker.service.LengthyOperationsService; import de.vanita5.twittnuker.util.ActivityTracker; import de.vanita5.twittnuker.util.AsyncTwitterWrapper; import de.vanita5.twittnuker.util.DataStoreFunctionsKt; <BUG>import de.vanita5.twittnuker.util.DataStoreUtils; import de.vanita5.twittnuker.util.ImagePreloader;</BUG> import de.vanita5.twittnuker.util.InternalTwitterContentUtils; import de.vanita5.twittnuker.util.JsonSerializer; import de.vanita5.twittnuker.util.NotificationManagerWrapper;
import de.vanita5.twittnuker.util.DebugLog; import de.vanita5.twittnuker.util.ImagePreloader;
2,742
final List<InetAddress> addresses = mDns.lookup(host); for (InetAddress address : addresses) { c.addRow(new String[]{host, address.getHostAddress()}); } } catch (final IOException ignore) { <BUG>if (BuildConfig.DEBUG) { Log.w(LOGTAG, ignore); }</BUG> }
DebugLog.w(LOGTAG, null, ignore);
2,743
@Override public void afterExecute(Bus handler, SingleResponse<Relationship> result) { if (result.hasData()) { handler.post(new FriendshipUpdatedEvent(accountKey, userKey, result.getData())); } else if (result.hasException()) { <BUG>if (BuildConfig.DEBUG) { Log.w(LOGTAG, "Unable to update friendship", result.getException()); }</BUG> }
public UserKey[] getAccountKeys() { return DataStoreUtils.getActivatedAccountKeys(context);
2,744
MicroBlog microBlog = MicroBlogAPIFactory.getInstance(context, accountId); if (!Utils.isOfficialCredentials(context, accountId)) continue; try { microBlog.setActivitiesAboutMeUnread(cursor); } catch (MicroBlogException e) { <BUG>if (BuildConfig.DEBUG) { Log.w(LOGTAG, e); }</BUG> }
DebugLog.w(LOGTAG, null, e);
2,745
FileBody fileBody = null; try { fileBody = getFileBody(context, imageUri); twitter.updateProfileBannerImage(fileBody); } finally { <BUG>Utils.closeSilently(fileBody); if (deleteImage && "file".equals(imageUri.getScheme())) { final File file = new File(imageUri.getPath()); if (!file.delete()) { Log.w(LOGTAG, String.format("Unable to delete %s", file)); }</BUG> }
if (deleteImage) { Utils.deleteMedia(context, imageUri);
2,746
FileBody fileBody = null; try { fileBody = getFileBody(context, imageUri); twitter.updateProfileBackgroundImage(fileBody, tile); } finally { <BUG>Utils.closeSilently(fileBody); if (deleteImage && "file".equals(imageUri.getScheme())) { final File file = new File(imageUri.getPath()); if (!file.delete()) { Log.w(LOGTAG, String.format("Unable to delete %s", file)); }</BUG> }
twitter.updateProfileBannerImage(fileBody); if (deleteImage) { Utils.deleteMedia(context, imageUri);
2,747
FileBody fileBody = null; try { fileBody = getFileBody(context, imageUri); return twitter.updateProfileImage(fileBody); } finally { <BUG>Utils.closeSilently(fileBody); if (deleteImage && "file".equals(imageUri.getScheme())) { final File file = new File(imageUri.getPath()); if (!file.delete()) { Log.w(LOGTAG, String.format("Unable to delete %s", file)); }</BUG> }
twitter.updateProfileBannerImage(fileBody); if (deleteImage) { Utils.deleteMedia(context, imageUri);
2,748
import de.vanita5.twittnuker.annotation.CustomTabType; import de.vanita5.twittnuker.library.MicroBlog; import de.vanita5.twittnuker.library.MicroBlogException; import de.vanita5.twittnuker.library.twitter.model.RateLimitStatus; import de.vanita5.twittnuker.library.twitter.model.Status; <BUG>import de.vanita5.twittnuker.fragment.AbsStatusesFragment; import org.mariotaku.sqliteqb.library.AllColumns;</BUG> import org.mariotaku.sqliteqb.library.Columns; import org.mariotaku.sqliteqb.library.Columns.Column; import org.mariotaku.sqliteqb.library.Expression;
import org.mariotaku.pickncrop.library.PNCUtils; import org.mariotaku.sqliteqb.library.AllColumns;
2,749
context.getApplicationContext().sendBroadcast(intent); } } @Nullable public static Location getCachedLocation(Context context) { <BUG>if (BuildConfig.DEBUG) { Log.v(LOGTAG, "Fetching cached location", new Exception()); }</BUG> Location location = null;
DebugLog.v(LOGTAG, "Fetching cached location", new Exception());
2,750
import java.util.List; import java.util.Map.Entry; import javax.inject.Singleton; import okhttp3.Dns; @Singleton <BUG>public class TwidereDns implements Constants, Dns { </BUG> private static final String RESOLVER_LOGTAG = "TwittnukerDns"; private final SharedPreferences mHostMapping; private final SharedPreferencesWrapper mPreferences;
public class TwidereDns implements Dns, Constants {
2,751
for (Location location : twitter.getAvailableTrends()) { map.put(location); } return map.pack(); } catch (final MicroBlogException e) { <BUG>if (BuildConfig.DEBUG) { Log.w(LOGTAG, e); }</BUG> }
DebugLog.w(LOGTAG, null, e);
2,752
String IMG_OUTLINE_THUMBNAIL = PRE + "outline.thumbnail"; String IMG_ACTOR = PRE + "actor"; String IMG_COMPOSITE = PRE + "composite"; String IMG_DIRECTOR = PRE + "director"; String IMG_INPUTPORT = PRE + "inputport"; <BUG>String IMG_OUTPUTPORT = PRE + "outputport"; String IMG_PARAMETER = PRE + "parameter";</BUG> String IMG_PAUSE_WORKFLOW = PRE + "pause"; String IMG_RUN_WORKFLOW = PRE + "run"; String IMG_STEP_WORKFLOW = PRE + "step";
String IMG_CONNECTION = PRE + "connection"; String IMG_PARAMETER = PRE + "parameter";
2,753
addImageFilePath(ImageConstants.IMG_OUTLINE_THUMBNAIL, ROOT_FOLDER_FOR_IMG + "thumbnail.gif"); addImageFilePath(ImageConstants.IMG_ACTOR, ROOT_FOLDER_FOR_IMG + "actor.gif"); addImageFilePath(ImageConstants.IMG_COMPOSITE, ROOT_FOLDER_FOR_IMG + "composite.gif"); addImageFilePath(ImageConstants.IMG_DIRECTOR, ROOT_FOLDER_FOR_IMG + "director.gif"); addImageFilePath(ImageConstants.IMG_INPUTPORT, ROOT_FOLDER_FOR_IMG + "input.gif"); <BUG>addImageFilePath(ImageConstants.IMG_OUTPUTPORT, ROOT_FOLDER_FOR_IMG + "output.gif"); addImageFilePath(ImageConstants.IMG_PARAMETER, ROOT_FOLDER_FOR_IMG + "parameter.gif");</BUG> addImageFilePath(ImageConstants.IMG_PAUSE_WORKFLOW, ROOT_FOLDER_FOR_IMG + "pause_workflow.gif"); addImageFilePath(ImageConstants.IMG_RUN_WORKFLOW, ROOT_FOLDER_FOR_IMG + "run_workflow.gif"); addImageFilePath(ImageConstants.IMG_STEP_WORKFLOW, ROOT_FOLDER_FOR_IMG + "step_workflow.png");
addImageFilePath(ImageConstants.IMG_CONNECTION, ROOT_FOLDER_FOR_IMG + "connection.gif"); addImageFilePath(ImageConstants.IMG_PARAMETER, ROOT_FOLDER_FOR_IMG + "parameter.gif");
2,754
import org.eclipse.graphiti.features.custom.ICustomFeature; import org.eclipse.graphiti.mm.pictograms.PictogramElement;</BUG> import org.eclipse.graphiti.palette.IObjectCreationToolEntry; import org.eclipse.graphiti.palette.IPaletteCompartmentEntry; import org.eclipse.graphiti.palette.IToolEntry; <BUG>import org.eclipse.graphiti.palette.impl.PaletteCompartmentEntry; import org.eclipse.graphiti.tb.ContextButtonEntry;</BUG> import org.eclipse.graphiti.tb.DefaultToolBehaviorProvider; import org.eclipse.graphiti.tb.IContextButtonPadData; import org.eclipse.triquetrum.workflow.editor.features.ModelElementConfigureFeature;
import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm; import org.eclipse.graphiti.mm.pictograms.Anchor; import org.eclipse.graphiti.mm.pictograms.AnchorContainer; import org.eclipse.graphiti.mm.pictograms.PictogramElement; import org.eclipse.graphiti.services.Graphiti; import org.eclipse.graphiti.tb.ContextButtonEntry;
2,755
import org.eclipse.triquetrum.workflow.editor.features.ModelElementConfigureFeature; import org.eclipse.triquetrum.workflow.editor.features.ModelElementCreateFeature; import org.eclipse.triquetrum.workflow.editor.features.PauseFeature; import org.eclipse.triquetrum.workflow.editor.features.ResumeFeature; import org.eclipse.triquetrum.workflow.editor.features.RunFeature; <BUG>import org.eclipse.triquetrum.workflow.editor.features.StopFeature; public class TriqToolBehaviorProvider extends DefaultToolBehaviorProvider {</BUG> public TriqToolBehaviorProvider(IDiagramTypeProvider diagramTypeProvider) { super(diagramTypeProvider); }
import org.eclipse.triquetrum.workflow.model.NamedObj; import org.eclipse.triquetrum.workflow.model.Vertex; public class TriqToolBehaviorProvider extends DefaultToolBehaviorProvider {
2,756
import org.eclipse.graphiti.features.ICreateConnectionFeature; import org.eclipse.graphiti.features.ICreateFeature; import org.eclipse.graphiti.features.IDeleteFeature; import org.eclipse.graphiti.features.IDirectEditingFeature; import org.eclipse.graphiti.features.IFeature; <BUG>import org.eclipse.graphiti.features.ILayoutFeature; import org.eclipse.graphiti.features.IRemoveFeature;</BUG> import org.eclipse.graphiti.features.IResizeShapeFeature; import org.eclipse.graphiti.features.IUpdateFeature; import org.eclipse.graphiti.features.context.IAddContext;
import org.eclipse.graphiti.features.IReconnectionFeature; import org.eclipse.graphiti.features.IRemoveFeature;
2,757
import org.eclipse.triquetrum.workflow.editor.features.ActorUpdateFeature; import org.eclipse.triquetrum.workflow.editor.features.AnnotationAddFeature; import org.eclipse.triquetrum.workflow.editor.features.AnnotationResizeFeature; import org.eclipse.triquetrum.workflow.editor.features.AnnotationUpdateFeature; import org.eclipse.triquetrum.workflow.editor.features.ConnectionAddFeature; <BUG>import org.eclipse.triquetrum.workflow.editor.features.ConnectionCreateFeature; import org.eclipse.triquetrum.workflow.editor.features.ConnectionRemoveFeature;</BUG> import org.eclipse.triquetrum.workflow.editor.features.DirectorAddFeature; import org.eclipse.triquetrum.workflow.editor.features.DirectorUpdateFeature; import org.eclipse.triquetrum.workflow.editor.features.ModelElementConfigureFeature;
import org.eclipse.triquetrum.workflow.editor.features.ConnectionDeleteFeature; import org.eclipse.triquetrum.workflow.editor.features.ConnectionReconnectFeature; import org.eclipse.triquetrum.workflow.editor.features.ConnectionRemoveFeature;
2,758
import org.eclipse.triquetrum.workflow.editor.features.ModelElementLayoutFeature; import org.eclipse.triquetrum.workflow.editor.features.ModelElementNameDirectEditFeature; import org.eclipse.triquetrum.workflow.editor.features.ModelElementResizeFeature; import org.eclipse.triquetrum.workflow.editor.features.ParameterAddFeature; import org.eclipse.triquetrum.workflow.editor.features.ParameterUpdateFeature; <BUG>import org.eclipse.triquetrum.workflow.editor.features.PortAddFeature; import org.eclipse.triquetrum.workflow.model.Actor;</BUG> import org.eclipse.triquetrum.workflow.model.Annotation; import org.eclipse.triquetrum.workflow.model.Director; import org.eclipse.triquetrum.workflow.model.NamedObj;
import org.eclipse.triquetrum.workflow.editor.features.VertexAddFeature; import org.eclipse.triquetrum.workflow.model.Actor;
2,759
import org.eclipse.triquetrum.workflow.model.Annotation; import org.eclipse.triquetrum.workflow.model.Director; import org.eclipse.triquetrum.workflow.model.NamedObj; import org.eclipse.triquetrum.workflow.model.Parameter; import org.eclipse.triquetrum.workflow.model.Port; <BUG>import org.eclipse.triquetrum.workflow.model.Relation; import org.slf4j.Logger;</BUG> import org.slf4j.LoggerFactory; public class TriqFeatureProvider extends DefaultFeatureProvider { private final static Logger LOGGER = LoggerFactory.getLogger(TriqFeatureProvider.class);
import org.eclipse.triquetrum.workflow.model.Vertex; import org.slf4j.Logger;
2,760
if (context.getNewObject() instanceof Director) { return new DirectorAddFeature(this); } else if (context.getNewObject() instanceof Actor) { return new ActorAddFeature(this); } else if (context.getNewObject() instanceof Relation) { <BUG>return new ConnectionAddFeature(this); } else if (context.getNewObject() instanceof Port) {</BUG> return new PortAddFeature(this); } else if (context.getNewObject() instanceof Parameter) { return new ParameterAddFeature(this);
} else if (context.getNewObject() instanceof Vertex) { return new VertexAddFeature(this); } else if (context.getNewObject() instanceof Port) {
2,761
package com.projecttango.examples.java.augmentedreality; import com.google.atap.tangoservice.Tango; import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoCameraIntrinsics; import com.google.atap.tangoservice.TangoConfig; <BUG>import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoEvent;</BUG> import com.google.atap.tangoservice.TangoOutOfDateException; import com.google.atap.tangoservice.TangoPoseData; import com.google.atap.tangoservice.TangoXyzIjData;
import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
2,762
super.onResume(); if (!mIsConnected) { mTango = new Tango(AugmentedRealityActivity.this, new Runnable() { @Override public void run() { <BUG>try { connectTango();</BUG> setupRenderer(); mIsConnected = true; } catch (TangoOutOfDateException e) {
TangoSupport.initialize(); connectTango();
2,763
if (lastFramePose.statusCode == TangoPoseData.POSE_VALID) { mRenderer.updateRenderCameraPose(lastFramePose, mExtrinsics); mCameraPoseTimestamp = lastFramePose.timestamp;</BUG> } else { <BUG>Log.w(TAG, "Can't get device pose at time: " + mRgbTimestampGlThread); }</BUG> } } } @Override
mRenderer.updateRenderCameraPose(lastFramePose); mCameraPoseTimestamp = lastFramePose.timestamp; Log.w(TAG, "Can't get device pose at time: " +
2,764
import org.rajawali3d.materials.Material; import org.rajawali3d.materials.methods.DiffuseMethod; import org.rajawali3d.materials.textures.ATexture; import org.rajawali3d.materials.textures.StreamingTexture; import org.rajawali3d.materials.textures.Texture; <BUG>import org.rajawali3d.math.Matrix4; import org.rajawali3d.math.vector.Vector3;</BUG> import org.rajawali3d.primitives.ScreenQuad; import org.rajawali3d.primitives.Sphere; import org.rajawali3d.renderer.RajawaliRenderer;
import org.rajawali3d.math.Quaternion; import org.rajawali3d.math.vector.Vector3;
2,765
translationMoon.setRepeatMode(Animation.RepeatMode.INFINITE); translationMoon.setTransformable3D(moon); getCurrentScene().registerAnimation(translationMoon); translationMoon.play(); } <BUG>public void updateRenderCameraPose(TangoPoseData devicePose, DeviceExtrinsics extrinsics) { Pose cameraPose = ScenePoseCalculator.toOpenGlCameraPose(devicePose, extrinsics); getCurrentCamera().setRotation(cameraPose.getOrientation()); getCurrentCamera().setPosition(cameraPose.getPosition()); }</BUG> public int getTextureId() {
public void updateRenderCameraPose(TangoPoseData cameraPose) { float[] rotation = cameraPose.getRotationAsFloats(); float[] translation = cameraPose.getTranslationAsFloats(); Quaternion quaternion = new Quaternion(rotation[3], rotation[0], rotation[1], rotation[2]); getCurrentCamera().setRotation(quaternion.conjugate()); getCurrentCamera().setPosition(translation[0], translation[1], translation[2]);
2,766
package com.projecttango.examples.java.helloareadescription; import com.google.atap.tangoservice.Tango; <BUG>import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoConfig;</BUG> import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
import com.google.atap.tangoservice.TangoAreaDescriptionMetaData; import com.google.atap.tangoservice.TangoConfig;
2,767
public class DeleteProductsActivity extends AppCompatActivity { private ProductService productService; private ShoppingListService shoppingListService; private DeleteProductsCache cache; <BUG>private String listId; @Override</BUG> protected final void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState);
private ListDto dto; @Override
2,768
return observable; } private Void deleteListsSync() { List<ListDto> shoppingList = cache.getDeleteListsAdapter().getShoppingList(); <BUG>List<String> deletedIds = shoppingListService.deleteSelected(shoppingList); Observable.from(deletedIds) .doOnNext(id -> productService.deleteAllFromList(id).subscribe()) .doOnCompleted(() -> { for ( String id : deletedIds ) {</BUG> ReminderReceiver alarm = new ReminderReceiver();
shoppingListService.deleteSelected(shoppingList) .doOnNext(id -> productService.deleteAllFromList(id).subscribe();
2,769
assertEquals(date, newDto.getDeadlineDate()); assertEquals(time, newDto.getDeadlineTime()); assertEquals(notes, newDto.getNotes()); String expectedName = "newName"; newDto.setListName(expectedName); <BUG>shoppingListService.saveOrUpdate(newDto); ListDto updatedDto = shoppingListService.getById(id); </BUG> assertEquals(expectedName, updatedDto.getListName());
shoppingListService.saveOrUpdate(newDto).toBlocking().single(); ListDto updatedDto = shoppingListService.getById(id).toBlocking().single();
2,770
dto.setPriority(priority); dto.setIcon(icon); dto.setDeadlineDate(date); dto.setDeadlineTime(time); dto.setNotes(notes); <BUG>shoppingListService.saveOrUpdate(dto); </BUG> listId = dto.getId(); } @Test
shoppingListService.saveOrUpdate(dto).toBlocking().single();
2,771
dto2.setId(null); productService.saveOrUpdate(dto2, listId).toBlocking().single(); List<ProductDto> products = productService.getAllProducts(listId).toList().toBlocking().single(); assertEquals(2, products.size()); productService.deleteAllFromList(listId).toBlocking().single(); <BUG>shoppingListService.deleteById(listId); </BUG> products = productService.getAllProducts(listId).toList().toBlocking().single(); assertEquals(0, products.size()); }
shoppingListService.deleteById(listId).toBlocking().single();
2,772
@Override public Observable<ProductDto> getById(String entityId) { Observable<ProductDto> observable = Observable .fromCallable(() -> getByIdSync(entityId)) <BUG>.observeOn(Schedulers.newThread()) .subscribeOn(AndroidSchedulers.mainThread()); </BUG> return observable;
public void setContext(Context context, DB db) this.context = context; productItemDao.setContext(context, db); shoppingListService.setContext(context, db); converterService.setContext(context, db);
2,773
import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.context.InstanceFactory; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.utils.MessageUtils; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.logic.shoppingList.business.ShoppingListService; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.logic.shoppingList.business.domain.ListDto; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.deletelists.listeners.DeleteListsOnClickListener; <BUG>import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.settings.SettingsKeys; import java.util.List;</BUG> public class DeleteListsActivity extends AppCompatActivity { private ShoppingListService shoppingListService;
import java.util.ArrayList; import java.util.List;
2,774
cache.getDeleteFab().setOnClickListener(new DeleteListsOnClickListener(cache)); overridePendingTransition(0, 0); } public void updateListView() { <BUG>List<ListDto> allListDtos = shoppingListService.getAllListDtos(); SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);</BUG> String sortBy = sharedPref.getString(SettingsKeys.LIST_SORT_BY, PFAComparators.SORT_BY_NAME); boolean sortAscending = sharedPref.getBoolean(SettingsKeys.LIST_SORT_ASCENDING, true); shoppingListService.sortList(allListDtos, sortBy, sortAscending);
List<ListDto> allListDtos = new ArrayList<>(); shoppingListService.getAllListDtos() .doOnNext(dto -> allListDtos.add(dto)) .doOnCompleted(() -> SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
2,775
import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.logic.shoppingList.business.domain.ListDto; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.logic.shoppingList.business.impl.comparators.ListsComparators; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.logic.shoppingList.business.impl.converter.ShoppingListConverter; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.logic.shoppingList.persistence.ShoppingListDao; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.logic.shoppingList.persistence.entity.ShoppingListEntity; <BUG>import rx.Observable; import javax.inject.Inject;</BUG> import java.util.ArrayList; import java.util.Collections; import java.util.List;
import rx.android.schedulers.AndroidSchedulers; import rx.schedulers.Schedulers; import javax.inject.Inject;
2,776
.filter(dto -> dto.isSelected()) .subscribe( dto -> { String id = dto.getId(); <BUG>deleteById(id); </BUG> deletedIds.add(id); } );
deleteByIdSync(id);
2,777
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;
2,778
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());
2,779
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
2,780
<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;
2,781
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]
2,782
<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;
2,783
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;
2,784
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;
2,785
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);
2,786
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 {
2,787
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(),
2,788
) ); }else{ return new TimeNode( generateDayCandidatesQuestionMarkNotSupported( <BUG>date.getYear(), date.getMonthOfYear(), </BUG> ((DayOfWeekFieldDefinition) cronDefinition.getFieldDefinition(DAY_OF_WEEK) ).getMondayDoWValue()
date.getYear(), date.getMonthValue(),
2,789
} 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);
2,790
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]
2,791
<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;
2,792
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;
2,793
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()
2,794
import java.util.Locale; import java.util.Map; import java.util.TreeMap; public class DependencyConvergenceReport extends AbstractProjectInfoReport <BUG>{ private List reactorProjects; private static final int PERCENTAGE = 100;</BUG> public String getOutputName() {
private static final int PERCENTAGE = 100; private static final List SUPPORTED_FONT_FAMILY_NAMES = Arrays.asList( GraphicsEnvironment .getLocalGraphicsEnvironment().getAvailableFontFamilyNames() );
2,795
sink.section1(); sink.sectionTitle1(); sink.text( getI18nString( locale, "title" ) ); sink.sectionTitle1_(); Map dependencyMap = getDependencyMap(); <BUG>generateLegend( locale, sink ); generateStats( locale, sink, dependencyMap ); generateConvergence( locale, sink, dependencyMap ); sink.section1_();</BUG> sink.body_();
sink.lineBreak(); sink.section1_();
2,796
Iterator it = artifactMap.keySet().iterator(); while ( it.hasNext() ) { String version = (String) it.next(); sink.tableRow(); <BUG>sink.tableCell(); sink.text( version );</BUG> sink.tableCell_(); sink.tableCell(); generateVersionDetails( sink, artifactMap, version );
sink.tableCell( String.valueOf( cellWidth ) + "px" ); sink.text( version );
2,797
sink.tableCell(); sink.text( getI18nString( locale, "legend.shared" ) ); sink.tableCell_(); sink.tableRow_(); sink.tableRow(); <BUG>sink.tableCell(); iconError( sink );</BUG> sink.tableCell_(); sink.tableCell(); sink.text( getI18nString( locale, "legend.different" ) );
sink.tableCell( "15px" ); // according /images/icon_error_sml.gif iconError( sink );
2,798
sink.tableCaption(); sink.text( getI18nString( locale, "stats.caption" ) ); sink.tableCaption_();</BUG> sink.tableRow(); <BUG>sink.tableHeaderCell(); sink.text( getI18nString( locale, "stats.subprojects" ) + ":" ); sink.tableHeaderCell_();</BUG> sink.tableCell(); sink.text( String.valueOf( reactorProjects.size() ) ); sink.tableCell_();
sink.bold(); sink.bold_(); sink.tableCaption_(); sink.tableHeaderCell( headerCellWidth ); sink.text( getI18nString( locale, "stats.subprojects" ) ); sink.tableHeaderCell_();
2,799
sink.tableCell(); sink.text( String.valueOf( reactorProjects.size() ) ); sink.tableCell_(); sink.tableRow_(); sink.tableRow(); <BUG>sink.tableHeaderCell(); sink.text( getI18nString( locale, "stats.dependencies" ) + ":" ); sink.tableHeaderCell_();</BUG> sink.tableCell(); sink.text( String.valueOf( depCount ) );
sink.tableHeaderCell( headerCellWidth ); sink.text( getI18nString( locale, "stats.dependencies" ) ); sink.tableHeaderCell_();
2,800
sink.text( String.valueOf( convergence ) + "%" ); sink.bold_(); sink.tableCell_(); sink.tableRow_(); sink.tableRow(); <BUG>sink.tableHeaderCell(); sink.text( getI18nString( locale, "stats.readyrelease" ) + ":" ); sink.tableHeaderCell_();</BUG> sink.tableCell(); if ( convergence >= PERCENTAGE && snapshotCount <= 0 )
sink.tableHeaderCell( headerCellWidth ); sink.text( getI18nString( locale, "stats.readyrelease" ) ); sink.tableHeaderCell_();