id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
11,901
e.printStackTrace(); return ""; } } private static Score checkScore( <BUG>ArrayList<Template> arrayList, Bitmap bitmap, int start) throws Exception { </BUG> int width = bitmap.getWidth(), height = bitmap.getHeight(); ArrayList<Score> scoreList = new ArrayList<Score>(); int size = arrayList.size();
ArrayList<Template> arrayList, Bitmap bitmap, int start) throws Exception, Error {
11,902
score = s; } } return score; } <BUG>private static ArrayList<Template> getList() throws Exception { </BUG> ArrayList<Template> arrayList = new ArrayList<Template>(); arrayList.add(new Template('1', 6, 10, new int[]{2, 9, 101, 102, 109, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 409, 509})); arrayList.add(new Template('1', 5, 10, new int[]{2, 9, 101, 109, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 309, 409}));
private static ArrayList<Template> getList() throws Exception, Error {
11,903
score = _score; template = _temp; } @SuppressLint("UseSparseArrays") public static Score getScore(Bitmap bitmap, Template template, <BUG>int x, int y) throws Exception { </BUG> int width = bitmap.getWidth(), height = bitmap.getHeight(); ArrayList<Integer> arrayList = template.arrayList; int size = arrayList.size();
int x, int y) throws Exception, Error {
11,904
wantToExit(); } getGrades(); } @SuppressWarnings("unchecked") <BUG>void getGrades() { new RequestingTask(this, "正在获取成绩...", Constants.domain + "/services/pkuhelper/allGrade.php?phpsessid=" + phpsessid, Constants.REQUEST_DEAN_GETTING_GRADE).execute(new ArrayList<Parameters>());</BUG> }
new GradeTask(this, phpsessid).execute();
11,905
e.printStackTrace(); } } private ArrayList<Semester> setGrade(JSONArray gpas, JSONArray courses) { try { <BUG>ArrayList<Semester> arrayList = new ArrayList<Semester>(); int len = gpas.length();</BUG> for (int i = 0; i < len; i++) { JSONObject termObject = gpas.optJSONObject(i); String year = termObject.getString("year");
if (gpas==null || courses==null) return arrayList; int len = gpas.length();
11,906
package com.pkuhelper.lib.webconnection; import android.util.Log; <BUG>import com.pkuhelper.lib.Constants; import org.apache.http.HttpHost;</BUG> import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.auth.AuthScope;
import org.apache.http.Header; import org.apache.http.HttpHost;
11,907
.setTitle("存在版本" + Constants.updateVersion + "更新!").setMessage( Constants.updateMessage) .setCancelable(true).setPositiveButton("立即下载", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { <BUG>Uri uri = Uri.parse(Constants.domain + "/applications/pkuhelper/getandroid.php"); try {</BUG> DownloadManager.Request request = new Request(uri); request.setTitle("正在下载PKU Helper..."); File file = MyFile.getFile(PKUHelper.pkuhelper, null, "PKUHelper.apk");
Uri uri = Uri.parse(Constants.domain + "/pkuhelper/getandroid.php"); try {
11,908
try { Drawable drawable = Drawable.createFromStream( WebConnection.connect("http://dean.pku.edu.cn/student/yanzheng.php?act=init"), "dean"); handler.sendMessage(Message.obtain(handler, Constants.MESSAGE_DEAN_PICTURE_FINISHED, drawable)); <BUG>} catch (Exception e) { </BUG> handler.sendEmptyMessage(Constants.MESSAGE_DEAN_PICTURE_FAILED); } }
} catch (Exception | Error e) {
11,909
import java.util.Map; import opennlp.tools.ml.AbstractEventTrainer; import opennlp.tools.ml.maxent.quasinewton.QNMinimizer.Evaluator; import opennlp.tools.ml.model.AbstractModel; import opennlp.tools.ml.model.Context; <BUG>import opennlp.tools.ml.model.DataIndexer; public class QNTrainer extends AbstractEventTrainer {</BUG> public static final String MAXENT_QN_VALUE = "MAXENT_QN"; public static final String THREADS_PARAM = "Threads"; public static final int THREADS_DEFAULT = 1;
import opennlp.tools.util.TrainingParameters; public class QNTrainer extends AbstractEventTrainer {
11,910
package opennlp.tools.ml; import java.util.Map; <BUG>import opennlp.tools.ml.maxent.GIS; public abstract class AbstractTrainer {</BUG> public static final String ALGORITHM_PARAM = "Algorithm"; public static final String TRAINER_TYPE_PARAM = "TrainerType"; public static final String CUTOFF_PARAM = "Cutoff";
import java.util.HashMap; import opennlp.tools.util.TrainingParameters; public abstract class AbstractTrainer {
11,911
</BUG> } public boolean isValid() { try { <BUG>parameters.getIntParam(CUTOFF_PARAM, CUTOFF_DEFAULT); parameters.getIntParam(ITERATIONS_PARAM, ITERATIONS_DEFAULT); </BUG> } catch (NumberFormatException e) { return false;
public int getCutoff() { return trainingParameters.getIntParameter(CUTOFF_PARAM, CUTOFF_DEFAULT); public int getIterations() { return trainingParameters.getIntParameter(ITERATIONS_PARAM, ITERATIONS_DEFAULT); trainingParameters.getIntParameter(CUTOFF_PARAM, CUTOFF_DEFAULT); trainingParameters.getIntParameter(ITERATIONS_PARAM, ITERATIONS_DEFAULT);
11,912
public static final String CUTOFF_PARAM = AbstractTrainer.CUTOFF_PARAM; public static final int CUTOFF_DEFAULT = AbstractTrainer.CUTOFF_DEFAULT; public static final String SORT_PARAM = "sort"; public static final boolean SORT_DEFAULT = true; <BUG>PluggableParameters parameters; public void init(Map<String,String> indexingParameters, Map<String, String> reportMap) { parameters = new PluggableParameters(indexingParameters, reportMap); }</BUG> private int numEvents;
protected TrainingParameters trainingParameters; protected Map<String,String> reportMap; public void init(TrainingParameters indexingParameters,Map<String, String> reportMap) { this.reportMap = reportMap; if (this.reportMap == null) reportMap = new HashMap<>(); trainingParameters = indexingParameters; }
11,913
package opennlp.tools.ml; import java.io.IOException; import java.util.HashMap; import java.util.Map; import opennlp.tools.ml.model.AbstractDataIndexer; <BUG>import opennlp.tools.ml.model.DataIndexer; import opennlp.tools.ml.model.Event;</BUG> import opennlp.tools.ml.model.HashSumEventStream; import opennlp.tools.ml.model.MaxentModel; import opennlp.tools.ml.model.OnePassDataIndexer;
import opennlp.tools.ml.model.DataIndexerFactory; import opennlp.tools.ml.model.Event;
11,914
import opennlp.tools.ml.model.TwoPassDataIndexer; import opennlp.tools.util.ObjectStream; public abstract class AbstractEventTrainer extends AbstractTrainer implements EventTrainer { public static final String DATA_INDEXER_PARAM = "DataIndexer"; public static final String DATA_INDEXER_ONE_PASS_VALUE = "OnePass"; <BUG>public static final String DATA_INDEXER_TWO_PASS_VALUE = "TwoPass"; public AbstractEventTrainer() {</BUG> } @Override public boolean isValid() {
public static final String DATA_INDEXER_ONE_PASS_REAL_VALUE = "OnePassRealValue"; protected Map<String,String> reportMap = new HashMap<>(); public AbstractEventTrainer() {
11,915
@Override public boolean isValid() { if (!super.isValid()) { return false; } <BUG>String dataIndexer = parameters.getStringParam(DATA_INDEXER_PARAM, DATA_INDEXER_TWO_PASS_VALUE); if (dataIndexer != null) { if (!(DATA_INDEXER_ONE_PASS_VALUE.equals(dataIndexer) || DATA_INDEXER_TWO_PASS_VALUE .equals(dataIndexer))) { return false; } }</BUG> return true;
[DELETED]
11,916
public final MaxentModel train(DataIndexer indexer) throws IOException { if (!isValid()) { throw new IllegalArgumentException("trainParams are not valid!"); } MaxentModel model = doTrain(indexer); <BUG>parameters.addToReport(AbstractTrainer.TRAINER_TYPE_PARAM, EventTrainer.EVENT_VALUE); return model;</BUG> } public final MaxentModel train(ObjectStream<Event> events) throws IOException { if (!isValid()) {
return model;
11,917
import opennlp.tools.ml.model.Event; import opennlp.tools.ml.model.MutableContext; import opennlp.tools.ml.model.OnePassDataIndexer; import opennlp.tools.ml.model.Prior; import opennlp.tools.ml.model.UniformPrior; <BUG>import opennlp.tools.util.ObjectStream; class GISTrainer {</BUG> private static final double LLThreshold = 0.0001; private final boolean printMessages; private boolean useSimpleSmoothing = false;
import opennlp.tools.util.TrainingParameters; class GISTrainer {
11,918
private String[] predLabels; private MutableContext[] observedExpects; private MutableContext[] params; private MutableContext[][] modelExpects; private Prior prior; <BUG>private EvalParameters evalParams; GISTrainer() {</BUG> printMessages = false; } GISTrainer(boolean printMessages) {
private Map<String, String> reportMap = new HashMap<>(); GISTrainer() {
11,919
return true; } public AbstractModel doTrain(DataIndexer indexer) throws IOException { int iterations = getIterations(); AbstractModel model; <BUG>boolean printMessages = parameters.getBooleanParam(VERBOSE_PARAM, VERBOSE_DEFAULT); boolean smoothing = parameters.getBooleanParam(SMOOTHING_PARAM, SMOOTHING_DEFAULT); int threads = parameters.getIntParam(TrainingParameters.THREADS_PARAM, 1); </BUG> model = trainModel(iterations, indexer, printMessages, smoothing, null, threads);
boolean printMessages = trainingParameters.getBooleanParameter(VERBOSE_PARAM, VERBOSE_DEFAULT); boolean smoothing = trainingParameters.getBooleanParameter(SMOOTHING_PARAM, SMOOTHING_DEFAULT); int threads = trainingParameters.getIntParameter(TrainingParameters.THREADS_PARAM, 1);
11,920
import groovy.lang.MissingPropertyException; import groovy.lang.Script; import hudson.Functions; import java.lang.reflect.Constructor; import java.lang.reflect.Field; <BUG>import java.lang.reflect.Method; import org.codehaus.groovy.runtime.DefaultGroovyMethods;</BUG> import org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException; import org.jenkinsci.plugins.scriptsecurity.sandbox.Whitelist; import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.EnumeratingWhitelist;
import javax.annotation.Nonnull; import org.codehaus.groovy.runtime.DefaultGroovyMethods;
11,921
@Override public Object onSetProperty(GroovyInterceptor.Invoker invoker, Object receiver, String property, Object value) throws Throwable { </BUG> if (receiver instanceof Script && !property.equals("binding") && !property.equals("metaClass")) { return super.onSetProperty(invoker, receiver, property, value); <BUG>} Field f = GroovyCallSiteSelector.field(receiver, property); if (f != null && whitelist.permitsFieldSet(f, receiver, value)) { return super.onSetProperty(invoker, receiver, property, value); } Object[] args1 = new Object[] {value}; </BUG> String setter = "set" + Functions.capitalize(property);
return super.onStaticCall(invoker, receiver, method, args); } else { throw StaticWhitelist.rejectStaticMethod(m); @Override public Object onSetProperty(GroovyInterceptor.Invoker invoker, final Object receiver, final String property, Object value) throws Throwable {
11,922
import org.eclipse.jdt.core.IClasspathContainer; import org.eclipse.jdt.core.IClasspathEntry; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.internal.launching.JREContainer; <BUG>import org.eclipse.jdt.launching.JavaRuntime; import org.eclipse.osgi.service.resolver.BundleDescription;</BUG> import org.eclipse.pde.core.plugin.IPluginModelBase; import org.eclipse.pde.core.plugin.PluginRegistry; import org.eclipse.pde.internal.build.site.PDEState;
import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.osgi.service.resolver.BundleDescription;
11,923
IClasspathContainer classpathContainer = JavaCore.getClasspathContainer(entry.getPath(), javaProject); if (classpathContainer != null && !(classpathContainer instanceof JREContainer)) { IClasspathEntry[] classpathEntries = classpathContainer.getClasspathEntries(); for (IClasspathEntry iClasspathEntry : classpathEntries) { IPath path = iClasspathEntry.getPath(); <BUG>if (path != null && path.toFile().exists()) { classPath.add(path.toOSString());</BUG> } } }
if (isValidPath(path)) { classPath.add(path.toOSString());
11,924
import java.util.Set; import java.util.TreeSet; import de.tobject.findbugs.marker.FindBugsMarker; public final class FindBugsConstants { private FindBugsConstants() { <BUG>} public final static String KEY_CUSTOM_DETECTORS = "customDetectors";</BUG> public final static String PRIO_LOW_MARKER_SEVERITY = FindBugsMarker.NAME_LOW; public final static String PRIO_NORMAL_MARKER_SEVERITY = FindBugsMarker.NAME_NORMAL; public final static String PRIO_HIGH_MARKER_SEVERITY = FindBugsMarker.NAME_HIGH;
public final static String KEY_SHORT_CLASSPATH = "useShortClasspath4EclipsePlugins"; public final static String KEY_CUSTOM_DETECTORS = "customDetectors";
11,925
filePath = filePath.removeFirstSegments(matchingSegments).setDevice(null); } return filePath; } private String[] createAuxClasspath() { <BUG>String[] classPath = PDEClassPathGenerator.computeClassPath(javaProject); return classPath;</BUG> } private Map<IPath, IPath> createOutputLocations() throws CoreException {
return PDEClassPathGenerator.computeClassPath(javaProject);
11,926
e.printStackTrace(); } filePlayback=null; } @Override <BUG>public void stop() { if ( filePlayback!=null ) filePlayback.stop(); } void initFiles() throws FileNotFoundException {</BUG> if ((dataDir.length() != 0) && !dataDir.endsWith("/")) { dataDir = dataDir + "/"; } // guard path if needed String samples_str = dataDir + "samples"; String events_str = dataDir + "events";
@Override public boolean isrunning(){ if ( filePlayback!=null ) return filePlayback.isrunning(); return false; } void initFiles() throws FileNotFoundException {
11,927
public class BufferMonitor extends Thread implements FieldtripBufferMonitor { public static final String TAG = BufferMonitor.class.toString(); private final Context context; private final SparseArray<BufferConnectionInfo> clients = new SparseArray<BufferConnectionInfo>(); private final BufferInfo info; <BUG>private final BroadcastReceiver mMessageReceiver = new BroadcastReceiver() { @Override public void onReceive(final Context context, final Intent intent) { if (intent.getIntExtra(C.MESSAGE_TYPE, -1) == C.UPDATE_REQUEST) { Log.i(TAG, "Received update request."); sendAllInfo(); } } };</BUG> private boolean run = true;
[DELETED]
11,928
public static final String CLIENT_INFO_TIME = "c_time"; public static final String CLIENT_INFO_WAITTIMEOUT = "c_waitTimeout"; public static final String CLIENT_INFO_CONNECTED = "c_connected"; public static final String CLIENT_INFO_CHANGED = "c_changed"; public static final String CLIENT_INFO_DIFF = "c_diff"; <BUG>public static final int UPDATE_REQUEST = 0; </BUG> public static final int UPDATE = 1; public static final int REQUEST_PUT_HEADER = 2; public static final int REQUEST_FLUSH_HEADER = 3;
public static final int THREAD_INFO_TYPE = 0;
11,929
package nl.dcc.buffer_bci.bufferclientsservice; import android.os.Parcel; import android.os.Parcelable; <BUG>import nl.dcc.buffer_bci.bufferservicecontroller.C; public class ThreadInfo implements Parcelable {</BUG> public static final Creator<ThreadInfo> CREATOR = new Creator<ThreadInfo>() { @Override public ThreadInfo createFromParcel(final Parcel in) {
import nl.dcc.buffer_bci.C; public class ThreadInfo implements Parcelable {
11,930
RedisConnection<K, V> conn = super.connect(codec); conn.auth(password); return conn;</BUG> } @Override <BUG>public <K, V> RedisAsyncConnection<K, V> connectAsync(RedisCodec<K, V> codec) { RedisAsyncConnection<K, V> conn = super.connectAsync(codec); conn.auth(password); return conn;</BUG> }
public AuthenticatingRedisClient(String host, int port, String password) { super(null, RedisURI.builder().withHost(host).withPort(port).withPassword(password).build()); public AuthenticatingRedisClient(String host, String password) { super(null, RedisURI.builder().withHost(host).withPassword(password).build()); public <K, V> StatefulRedisConnection<K, V> connect(RedisCodec<K, V> codec) { return super.connect(codec);
11,931
RedisAsyncConnection<K, V> conn = super.connectAsync(codec); conn.auth(password); return conn;</BUG> } @Override <BUG>public <K, V> RedisPubSubConnection<K, V> connectPubSub(RedisCodec<K, V> codec) { RedisPubSubConnection<K, V> conn = super.connectPubSub(codec); conn.auth(password); return conn;</BUG> }
public AuthenticatingRedisClient(String host, int port, String password) { super(null, RedisURI.builder().withHost(host).withPort(port).withPassword(password).build()); public AuthenticatingRedisClient(String host, String password) { super(null, RedisURI.builder().withHost(host).withPassword(password).build()); public <K, V> StatefulRedisConnection<K, V> connect(RedisCodec<K, V> codec) { return super.connect(codec);
11,932
this.client = RedisClient.create(clientResources, getRedisURI()); } else { this.client = RedisClient.create(getRedisURI()); } client.setDefaultTimeout(timeout, TimeUnit.MILLISECONDS); <BUG>this.internalPool = new GenericObjectPool<RedisAsyncConnection>(new LettuceFactory(client, dbIndex), poolConfig); }</BUG> private RedisURI getRedisURI() { RedisURI redisUri = isRedisSentinelAware()
this.internalPool = new GenericObjectPool<StatefulConnection<byte[], byte[]>>(new LettuceFactory(client, dbIndex),
11,933
return internalPool.borrowObject(); } catch (Exception e) { throw new PoolException("Could not get a resource from the pool", e); } } <BUG>public void returnBrokenResource(final RedisAsyncConnection<byte[], byte[]> resource) { </BUG> try { internalPool.invalidateObject(resource); } catch (Exception e) {
public void returnBrokenResource(final StatefulConnection<byte[], byte[]> resource) {
11,934
internalPool.invalidateObject(resource); } catch (Exception e) { throw new PoolException("Could not invalidate the broken resource", e); } } <BUG>public void returnResource(final RedisAsyncConnection<byte[], byte[]> resource) { </BUG> try { internalPool.returnObject(resource); } catch (Exception e) {
public void returnResource(final StatefulConnection<byte[], byte[]> resource) {
11,935
super(); this.client = client; this.dbIndex = dbIndex; } @Override <BUG>public void activateObject(PooledObject<RedisAsyncConnection> pooledObject) throws Exception { pooledObject.getObject().select(dbIndex); } public void destroyObject(final PooledObject<RedisAsyncConnection> obj) throws Exception { </BUG> try {
public void activateObject(PooledObject<StatefulConnection<byte[], byte[]>> pooledObject) throws Exception { if (pooledObject.getObject() instanceof StatefulRedisConnection) { ((StatefulRedisConnection) pooledObject.getObject()).sync().select(dbIndex); public void destroyObject(final PooledObject<StatefulConnection<byte[], byte[]>> obj) throws Exception {
11,936
myLanguageSpecificCaches = new HashMap<Language, LanguageConceptsCache>(); } fireCacheChanged(); } public static List<String> getParentsNames(String conceptFqName) { <BUG>return ConceptRegistry.getInstance().getStructureDescriptor(conceptFqName).getParentsNames(); </BUG> } public List<String> _getParentsNames(final String conceptFqName) { fireReadAccessPerformed();
return ConceptRegistry.getInstance().getConceptDescriptor(conceptFqName).structure().getParentsNames();
11,937
if (structureDescriptors.containsKey(fqName) || conceptsInLoading.contains(fqName)) { return; } conceptsInLoading.add(fqName); languageToConcepts.putValue(NameUtil.namespaceFromConceptFQName(fqName), fqName); <BUG>ModelAccess.instance().runReadAction(new Runnable() { @Override public void run() { LanguageRuntime languageRuntime = LanguageRegistry.getInstance().getLanguage(NameUtil.namespaceFromConceptFQName(fqName)); structureDescriptors.put(fqName, languageRuntime.getStructureAspect().getDescriptor(fqName));</BUG> behaviorDescriptors.put(fqName, languageRuntime.getBehaviorAspect().getDescriptor(fqName));
if (languageRuntime != null) { structureDescriptors.put(fqName, languageRuntime.getStructureAspect().getDescriptor(fqName));
11,938
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;
11,939
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());
11,940
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
11,941
<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;
11,942
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]
11,943
<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;
11,944
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;
11,945
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;
11,946
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);
11,947
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 {
11,948
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(),
11,949
) ); }else{ return new TimeNode( generateDayCandidatesQuestionMarkNotSupported( <BUG>date.getYear(), date.getMonthOfYear(), </BUG> ((DayOfWeekFieldDefinition) cronDefinition.getFieldDefinition(DAY_OF_WEEK) ).getMondayDoWValue()
date.getYear(), date.getMonthValue(),
11,950
} 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);
11,951
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]
11,952
<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;
11,953
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;
11,954
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()
11,955
package org.jetbrains.jet.lang.psi; import com.intellij.lang.ASTNode; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; <BUG>import org.jetbrains.jet.lexer.JetToken; import org.jetbrains.jet.lexer.JetTokens; </BUG> public class JetBinaryExpressionWithTypeRHS extends JetExpression { public JetBinaryExpressionWithTypeRHS(@NotNull ASTNode node) {
import org.jetbrains.jet.JetNodeTypes;
11,956
assert left != null; return left; } @Nullable @IfNotParsed public JetTypeReference getRight() { <BUG>ASTNode node = getOperationTokenNode(); </BUG> while (node != null) { PsiElement psi = node.getPsi(); if (psi instanceof JetTypeReference) {
ASTNode node = getOperationReference().getNode();
11,957
} node = node.getTreeNext(); } return null; } <BUG>@NotNull public ASTNode getOperationTokenNode() { ASTNode operationNode = getNode().findChildByType(JetTokens.OPERATIONS); assert operationNode != null; return operationNode; } @NotNull public JetToken getOperationSign() { return (JetToken) getOperationTokenNode().getElementType();</BUG> }
@Override public void accept(JetVisitor visitor) { visitor.visitBinaryWithTypeRHSExpression(this);
11,958
package org.jetbrains.jet.lang.psi; import com.intellij.lang.ASTNode; import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiElement; <BUG>import com.intellij.psi.PsiReference; import com.intellij.psi.tree.TokenSet;</BUG> import com.intellij.psi.util.PsiTreeUtil; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull;
import com.intellij.psi.tree.IElementType; import com.intellij.psi.tree.TokenSet;
11,959
public PsiReference getReference() { if (getReferencedName() == null) return null; return new PsiReference() { @Override public PsiElement getElement() { <BUG>return findChildByType(REFERENCE_TOKENS); }</BUG> @Override public TextRange getRangeInElement() { return new TextRange(0, getElement().getTextLength());
return getReferencedNameElement(); }
11,960
package org.jetbrains.jet.lang.psi; import com.intellij.lang.ASTNode; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; <BUG>import org.jetbrains.jet.lexer.JetToken; import org.jetbrains.jet.lexer.JetTokens; </BUG> public class JetBinaryExpression extends JetExpression { public JetBinaryExpression(@NotNull ASTNode node) {
import org.jetbrains.jet.JetNodeTypes;
11,961
assert left != null; return left; } @Nullable @IfNotParsed public JetExpression getRight() { <BUG>ASTNode node = getOperationTokenNode(); while (node != null) {</BUG> PsiElement psi = node.getPsi(); if (psi instanceof JetExpression) { return (JetExpression) psi;
ASTNode node = getOperationReference().getNode().getTreeNext(); while (node != null) {
11,962
} node = node.getTreeNext(); } return null; } <BUG>@NotNull public ASTNode getOperationTokenNode() { ASTNode operationNode = getNode().findChildByType(JetTokens.OPERATIONS); assert operationNode != null; return operationNode; } @NotNull public JetToken getOperationSign() { return (JetToken) getOperationTokenNode().getElementType();</BUG> }
@Override public void accept(JetVisitor visitor) { visitor.visitBinaryExpression(this);
11,963
import com.intellij.lang.PsiBuilder; import com.intellij.psi.tree.IElementType; import com.intellij.psi.tree.TokenSet; import org.jetbrains.jet.JetNodeType; import org.jetbrains.jet.lexer.JetTokens; <BUG>import java.util.ArrayList; import java.util.List; </BUG> import static org.jetbrains.jet.JetNodeTypes.*; import static org.jetbrains.jet.lexer.JetTokens.*;
import java.util.*;
11,964
package org.jetbrains.jet.lexer; import com.intellij.psi.TokenType; import com.intellij.psi.tree.IElementType; <BUG>import com.intellij.psi.tree.TokenSet; public interface JetTokens {</BUG> JetToken EOF = new JetToken("EOF"); JetToken BLOCK_COMMENT = new JetToken("BLOCK_COMMENT"); JetToken DOC_COMMENT = new JetToken("DOC_COMMENT");
import org.jetbrains.jet.lang.parsing.JetExpressionParsing; public interface JetTokens {
11,965
public void recordTypeResolution(@NotNull JetTypeReference typeReference, @NotNull Type type) { types.put(typeReference, type); } @Override public void recordDeclarationResolution(@NotNull PsiElement declaration, @NotNull DeclarationDescriptor descriptor) { <BUG>descriptorToDeclarations.put(descriptor, declaration); declarationsToDescriptors.put(declaration, descriptor); </BUG> }
descriptorToDeclarations.put(descriptor.getOriginal(), declaration); declarationsToDescriptors.put(declaration, descriptor.getOriginal());
11,966
JetNodeType LOOP_RANGE = new JetNodeType("LOOP_RANGE", JetContainerNode.class); JetNodeType BODY = new JetNodeType("BODY", JetContainerNode.class); JetNodeType BLOCK = new JetNodeType("BLOCK", JetBlockExpression.class); JetNodeType FUNCTION_LITERAL = new JetNodeType("FUNCTION_LITERAL", JetFunctionLiteralExpression.class); JetNodeType ANNOTATED_EXPRESSION = new JetNodeType("ANNOTATED_EXPRESSION", JetAnnotatedExpression.class); <BUG>JetNodeType REFERENCE_EXPRESSION = new JetNodeType("REFERENCE_EXPRESSION", JetReferenceExpression.class); JetNodeType THIS_EXPRESSION = new JetNodeType("THIS_EXPRESSION", JetThisExpression.class);</BUG> JetNodeType BINARY_EXPRESSION = new JetNodeType("BINARY_EXPRESSION", JetBinaryExpression.class); JetNodeType BINARY_WITH_TYPE = new JetNodeType("BINARY_WITH_TYPE", JetBinaryExpressionWithTypeRHS.class); JetNodeType BINARY_WITH_PATTERN = new JetNodeType("BINARY_WITH_PATTERN", JetExpression.class); // TODO:
JetNodeType OPERATION_REFERENCE = new JetNodeType("OPERATION_REFERENCE", JetReferenceExpression.class); JetNodeType THIS_EXPRESSION = new JetNodeType("THIS_EXPRESSION", JetThisExpression.class);
11,967
public void visitTypeofExpression(JetTypeofExpression expression) { throw new UnsupportedOperationException("Return some reflection interface"); // TODO } @Override public void visitBinaryWithTypeRHSExpression(JetBinaryExpressionWithTypeRHS expression) { <BUG>if (expression.getOperationSign() == JetTokens.COLON) { Type actualType = getType(scope, expression.getLeft(), false);</BUG> Type expectedType = typeResolver.resolveType(scope, expression.getRight()); if (JetTypeChecker.INSTANCE.isSubtypeOf(actualType, expectedType)) { result[0] = expectedType;
if (expression.getOperationReference().getReferencedNameElementType() == JetTokens.COLON) { Type actualType = getType(scope, expression.getLeft(), false);
11,968
List<JetExpression> functionLiteralArguments = expression.getFunctionLiteralArguments(); assert functionLiteralArguments.size() <= 1; OverloadDomain overloadDomain = getOverloadDomain(scope, calleeExpression); if (someNamed) { throw new UnsupportedOperationException(); // TODO <BUG>} else { List<JetExpression> positionedValueArguments = new ArrayList<JetExpression>();</BUG> for (JetArgument argument : valueArguments) { positionedValueArguments.add(argument.getArgumentExpression()); }
List<Type> types = new ArrayList<Type>(); for (JetTypeProjection projection : typeArguments) { types.add(typeResolver.resolveType(scope, projection.getTypeReference())); List<JetExpression> positionedValueArguments = new ArrayList<JetExpression>();
11,969
if(!destination.getPermissions().validate(user, Permission.UPDATE)) throw new PermissionDeniedException("Resource with same name exists in target " + "collection and update is denied"); if(!oldDoc.getPermissions().validate(user, Permission.UPDATE)) throw new PermissionDeniedException("Resource with same name exists in target " + <BUG>"collection and update is denied"); collection.removeDocument(this, oldDoc.getFileName());</BUG> } else if(!destination.getPermissions().validate(user, Permission.WRITE)) throw new PermissionDeniedException("Insufficient privileges on target collection " +
if (oldDoc.getResourceType() == DocumentImpl.BINARY_FILE) collection.removeBinaryResource(this, oldDoc); collection.removeDocument(this, oldDoc.getFileName());
11,970
} else if(!destination.getPermissions().validate(user, Permission.WRITE)) throw new PermissionDeniedException("Insufficient privileges on target collection " + destination.getName()); boolean renameOnly = collection.getId() == destination.getId(); <BUG>collection.unlinkDocument(doc); if(!renameOnly) {</BUG> elementIndex.dropIndex(doc); textEngine.dropIndex(doc); valueIndex.dropIndex(doc);
doc.setFileName(newName); doc.setCollection(destination); if (doc.getResourceType() == DocumentImpl.XML_FILE) { if(!renameOnly) {
11,971
import java.util.Collections; import java.util.Comparator; import java.util.List; public class VideoUtil { public static final int ORIENTATION_HYSTERESIS = 5; <BUG>public static Camera.Size getBestResolution(Camera camera, ImageSize targetSize) { if (targetSize.areDimensionsDefined()) {</BUG> float aspectRatio = (float) targetSize.width / targetSize.height; float bestSizeAspectRatioDiff = Float.POSITIVE_INFINITY; Camera.Size bestSize = null;
public static Camera.Size getBestResolution( Camera camera, boolean isRecordingLanscape, ImageSize targetSize) { if (!isRecordingLanscape) { targetSize = new ImageSize(targetSize.height, targetSize.width); } if (targetSize.areDimensionsDefined()) {
11,972
package com.amosyuen.videorecorder; import android.content.DialogInterface; import android.content.Intent; <BUG>import android.content.pm.PackageManager; import android.graphics.drawable.Drawable;</BUG> import android.hardware.Camera; import android.hardware.Camera.CameraInfo; import android.net.Uri;
import android.content.res.Configuration; import android.graphics.drawable.Drawable;
11,973
import com.amosyuen.videorecorder.video.VideoFrameRecorderView; import com.amosyuen.videorecorder.video.VideoFrameTransformerTask; import org.bytedeco.javacv.FFmpegFrameRecorder; import java.io.File; import java.security.InvalidParameterException; <BUG>import java.util.concurrent.TimeUnit; public class FFmpegRecorderActivity extends AbstractDynamicStyledActivity</BUG> implements OnClickListener, OnTouchListener, RecorderListener { public static final int RESULT_ERROR = RESULT_FIRST_USER; public static final String ERROR_PATH_KEY = "error";
import static java.security.AccessController.getContext; public class FFmpegRecorderActivity extends AbstractDynamicStyledActivity
11,974
protected boolean mIsFrontCamera; protected boolean mIsNextEnabled; protected boolean mIsAudioRecorderReady; protected boolean mIsVideoFrameRecorderReady; protected boolean mIsFinishedRecording; <BUG>protected long mLatestTimestampNanos; @Override</BUG> public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (mThemeParams == null) {
protected int mOriginalRequestedOrientation; @Override
11,975
mFlashButton.setOnClickListener(this); mFlashButton.setColorFilter(widgetcolor); mProgressBar = (ProgressBar) findViewById(R.id.progress_bar) ; mProgressText = (TextView) findViewById(R.id.progress_text) ; mVideoFrameRecorder = new ListVideoFrameRecorder(); <BUG>mAudioRecorder = new ListAudioRecorder(); initRecorders();</BUG> } @Override protected boolean extractIntentParams() {
mOriginalRequestedOrientation = getRequestedOrientation(); initRecorders();
11,976
mVideoFrameRecorder.clear(); mVideoFrameRecorderView.clearData(); mAudioRecorder.clear(); mAudioRecorderThread = new AudioRecorderThread(getThemeParams(), mAudioRecorder); mAudioRecorderThread.setRecorderListener(this); <BUG>mAudioRecorderThread.start(); openCamera();</BUG> } protected void openCamera() { int cameraFacing =
setRequestedOrientation(mOriginalRequestedOrientation); openCamera();
11,977
mVideoThumbnailOutputFile = new File(Uri.parse(videoThumbnailOutputUri).getPath()); } mRecorder = Util.createFrameRecorder(mVideoOutputFile, getThemeParams()); Camera.Size previewSize = mVideoFrameRecorderView.getPreviewSize(); mVideoTransformerTask = new VideoFrameTransformerTask( <BUG>mRecorder, mVideoThumbnailOutputFile, getThemeParams(), previewSize.width, previewSize.height, mVideoFrameRecorder.getRecordedFrames());</BUG> mVideoTransformerTask.setProgressListener(this); try { mAudioRecorderThread.join();
mVideoFrameRecorderView.isRecordingLandscape(), previewSize.width, previewSize.height, mVideoFrameRecorder.getRecordedFrames());
11,978
} catch (InterruptedException e) { e.printStackTrace(); } mAudioTransformerTask = new AudioTransformerTask(mRecorder, mAudioRecorder.getRecordedSamples()); <BUG>mAudioTransformerTask.setProgressListener(this); }</BUG> @Override protected Exception doInBackground(Object[] params) { if (mVideoOutputFile == null) {
Log.d(LOG_TAG, "AudioRecorder length " + mAudioRecorderThread.getRecordingLengthNanos()); Log.d(LOG_TAG, "VideoRecorder length " + mVideoFrameRecorderView.getRecordingLengthNanos());
11,979
package com.amosyuen.videorecorder.video; <BUG>import android.content.Context; import android.graphics.Canvas;</BUG> import android.graphics.ImageFormat; import android.hardware.Camera; import android.os.AsyncTask;
import android.content.res.Configuration; import android.graphics.Canvas;
11,980
import android.util.Log; import android.view.OrientationEventListener; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; <BUG>import com.amosyuen.videorecorder.util.RecorderListener; import com.amosyuen.videorecorder.util.VideoUtil;</BUG> import java.io.IOException; import java.util.List; import java.util.concurrent.TimeUnit;
import com.amosyuen.videorecorder.util.Util; import com.amosyuen.videorecorder.util.VideoUtil;
11,981
protected RecorderListener mRecorderListener; protected DeviceOrientationEventListener mOrientationListener; protected long mFrameTimeNanos; protected int mCameraId; protected Camera mCamera; <BUG>protected Camera.Size mPreviewSize; protected ImageSize mScaledPreviewSize;</BUG> protected ImageSize mScaledTargetSize; @ColorInt protected int mBlackColor;
protected boolean mIsRecordingLandscape; protected ImageSize mScaledPreviewSize;
11,982
return; } ImageSize targetSize = mParams == null ? new ImageSize() : new ImageSize(mParams.getVideoWidth(), mParams.getVideoHeight()); <BUG>ImageSize previewSize = mPreviewSize == null ? new ImageSize(parentSize.width, targetSize.areDimensionsDefined() ? (int)(parentSize.width / targetSize.getAspectRatio()) : parentSize.height) : new ImageSize(mPreviewSize.width, mPreviewSize.height); if (targetSize.isAtLeastOneDimensionDefined()) { targetSize.calculateUndefinedDimensions(previewSize); </BUG> previewSize.scale(targetSize, mParams.getVideoScaleType(), mParams.canUpscaleVideo());
ImageSize previewSize; ImageSize scalePreviewSize; if (mPreviewSize == null) { int height = targetSize.areDimensionsDefined() ? (int) (parentSize.width / targetSize.getAspectRatio()) : parentSize.height; previewSize = new ImageSize(parentSize.width, height); scalePreviewSize = previewSize;
11,983
if (targetSize.isAtLeastOneDimensionDefined()) { targetSize.calculateUndefinedDimensions(previewSize); </BUG> previewSize.scale(targetSize, mParams.getVideoScaleType(), mParams.canUpscaleVideo()); } else { <BUG>targetSize = previewSize.clone(); </BUG> } Log.v(LOG_TAG, String.format("Parent %s", parentSize)); Log.v(LOG_TAG, String.format("Target %s", targetSize));
targetSize.calculateUndefinedDimensions(scalePreviewSize); targetSize = scalePreviewSize.clone();
11,984
mScaledPreviewSize.width = mScaledPreviewSize.width * mScaledTargetSize.width / targetSize.width; mScaledPreviewSize.height = mScaledPreviewSize.height * mScaledTargetSize.height / targetSize.height; Log.v(LOG_TAG, String.format("Scaled Target %s", mScaledTargetSize)); <BUG>Log.v(LOG_TAG, String.format("Scaled Preview %s", mScaledPreviewSize)); setMeasuredDimension(mScaledPreviewSize.width, mScaledPreviewSize.height); invalidate(); }</BUG> @Override
if (getMeasuredWidth() != mScaledPreviewSize.width || getMeasuredHeight() != mScaledPreviewSize.height) { } }
11,985
protected static final String LOG_TAG = "VideoFrameTransformer"; private static final int IMAGE_DEPTH = DEPTH_UBYTE; private static final int IMAGE_CHANNELS = 2; protected FFmpegFrameRecorder mFrameRecorder; protected File mThumbnailFile; <BUG>protected final VideoFrameTransformerParams mParams; protected final int mRecordedWidth;</BUG> protected final int mRecordedHeight; protected Collection<VideoFrameData> mFrameDatas; protected TaskListener mProgressListener;
protected final boolean mIsLandscape; protected final int mRecordedWidth;
11,986
protected FFmpegFrameFilter filterCropFrontCam = null; protected boolean mIsFirstImage = true; public VideoFrameTransformerTask( FFmpegFrameRecorder frameRecorder, @Nullable File thumbnailFile, <BUG>VideoFrameTransformerParams params, int recordedWidth,</BUG> int recordedHeight, Collection<VideoFrameData> frameDatas) { mFrameRecorder = frameRecorder;
boolean isLandscape, int recordedWidth,
11,987
<BUG>package com.amosyuen.videorecorder.util; import android.content.res.Resources;</BUG> import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.support.annotation.AttrRes;
import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources;
11,988
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) setOutlineProvider(ViewOutlineProvider.BOUNDS); } } @Override <BUG>public void draw(@NonNull Canvas canvas) { if (cornerRadius > 0 && getWidth() > 0 && getHeight() > 0 && Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT_WATCH) {</BUG> int saveCount = canvas.saveLayer(0, 0, getWidth(), getHeight(), null, Canvas.ALL_SAVE_FLAG); super.draw(canvas); paint.setXfermode(pdMode);
drawCalled = true; if (cornerRadius > 0 && getWidth() > 0 && getHeight() > 0 && Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT_WATCH) {
11,989
package tachyon.master; import java.io.IOException; import java.net.InetSocketAddress; <BUG>import org.apache.thrift.server.THsHaServer; import org.apache.thrift.server.TServer; import org.apache.thrift.transport.TNonblockingServerSocket;</BUG> import org.apache.thrift.transport.TTransportException; import org.apache.log4j.Logger;
import org.apache.thrift.server.TThreadedSelectorServer; import org.apache.thrift.transport.TNonblockingServerSocket;
11,990
private UIWebServer mWebServer; private TServer mMasterServiceServer; private MasterServiceHandler mMasterServiceHandler; private Journal mJournal; private EditLogProcessor mEditLogProcessor; <BUG>private int mWebPort; private int mWorkerThreads;</BUG> private boolean mZookeeperMode = false; private LeaderSelectorClient mLeaderSelectorClient = null; public TachyonMaster(InetSocketAddress address, int webPort, int selectorThreads,
private int mSelectorThreads; private int mAcceptQueueSizePerThread; private int mWorkerThreads;
11,991
int acceptQueueSizePerThreads, int workerThreads) { if (CommonConf.get().USE_ZOOKEEPER) { mZookeeperMode = true; } mIsStarted = false; <BUG>mWebPort = webPort; mWorkerThreads = workerThreads;</BUG> try { mMasterAddress = address; String journalFolder = MasterConf.get().JOURNAL_FOLDER;
mSelectorThreads = selectorThreads; mAcceptQueueSizePerThread = acceptQueueSizePerThreads; mWorkerThreads = workerThreads;
11,992
mMasterAddress.getHostName(), mWebPort), mMasterInfo); mMasterServiceHandler = new MasterServiceHandler(mMasterInfo); MasterService.Processor<MasterServiceHandler> masterServiceProcessor = new MasterService.Processor<MasterServiceHandler>(mMasterServiceHandler); mMasterServiceServer = <BUG>new THsHaServer(new THsHaServer.Args(new TNonblockingServerSocket(mMasterAddress)) .processor(masterServiceProcessor).workerThreads(mWorkerThreads)); mIsStarted = true;</BUG> }
new TThreadedSelectorServer(new TThreadedSelectorServer.Args(new TNonblockingServerSocket( mMasterAddress)).processor(masterServiceProcessor).selectorThreads(mSelectorThreads) .acceptQueueSizePerThread(mAcceptQueueSizePerThread).workerThreads(mWorkerThreads)); mIsStarted = true;
11,993
package tachyon.worker; import java.io.IOException; import java.net.InetSocketAddress; import java.net.UnknownHostException; import org.apache.thrift.TException; <BUG>import org.apache.thrift.server.THsHaServer; import org.apache.thrift.server.TServer; import org.apache.thrift.transport.TNonblockingServerSocket;</BUG> import org.apache.thrift.transport.TTransportException; import org.apache.log4j.Logger;
import org.apache.thrift.server.TThreadedSelectorServer; import org.apache.thrift.transport.TNonblockingServerSocket;
11,994
if(worldIn.getTileEntity(pos) != null){ TileEntity te = worldIn.getTileEntity(pos); if(te.hasCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null) && te.getCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null).getTemp() >= -273D + mult){ te.getCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null).addHeat(-mult); } <BUG>for(EnumFacing dir : EnumFacing.values()){ if(te.hasCapability(Capabilities.ROTARY_HANDLER_CAPABILITY, dir)){ te.getCapability(Capabilities.ROTARY_HANDLER_CAPABILITY, dir).addEnergy(-mult, false, false); break;</BUG> }
if(te.hasCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null)){ te.getCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null).addHeat(mult);
11,995
public static double betterRound(double numIn, int decPlac){ double opOn = Math.round(numIn * Math.pow(10, decPlac)) / Math.pow(10D, decPlac); return opOn; } public static double centerCeil(double numIn, int tiers){ <BUG>return ((numIn > 0) ? Math.ceil(numIn * tiers) : Math.floor(numIn * tiers)) / tiers; </BUG> } public static double findEfficiency(double speedIn, double lowerLimit, double upperLimit){ speedIn = Math.abs(speedIn);
return ((numIn > 0) ? Math.ceil(numIn * (double) tiers) : Math.floor(numIn * (double) tiers)) / (double) tiers;
11,996
package com.Da_Technomancer.crossroads.API; import com.Da_Technomancer.crossroads.API.DefaultStorageHelper.DefaultStorage; import com.Da_Technomancer.crossroads.API.heat.DefaultHeatHandler; import com.Da_Technomancer.crossroads.API.heat.IHeatHandler; import com.Da_Technomancer.crossroads.API.magic.DefaultMagicHandler; <BUG>import com.Da_Technomancer.crossroads.API.magic.IMagicHandler; import com.Da_Technomancer.crossroads.API.rotary.DefaultRotaryHandler; import com.Da_Technomancer.crossroads.API.rotary.IRotaryHandler; </BUG> import net.minecraftforge.common.capabilities.Capability;
import com.Da_Technomancer.crossroads.API.rotary.DefaultAxleHandler; import com.Da_Technomancer.crossroads.API.rotary.DefaultCogHandler; import com.Da_Technomancer.crossroads.API.rotary.IAxleHandler; import com.Da_Technomancer.crossroads.API.rotary.ICogHandler;
11,997
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityInject; import net.minecraftforge.common.capabilities.CapabilityManager; public class Capabilities{ @CapabilityInject(IHeatHandler.class) <BUG>public static Capability<IHeatHandler> HEAT_HANDLER_CAPABILITY = null; @CapabilityInject(IRotaryHandler.class) public static Capability<IRotaryHandler> ROTARY_HANDLER_CAPABILITY = null; </BUG> @CapabilityInject(IMagicHandler.class)
@CapabilityInject(IAxleHandler.class) public static Capability<IAxleHandler> AXLE_HANDLER_CAPABILITY = null; @CapabilityInject(ICogHandler.class) public static Capability<ICogHandler> COG_HANDLER_CAPABILITY = null;
11,998
public IEffect getMixEffect(Color col){ if(col == null){ return effect; } int top = Math.max(col.getBlue(), Math.max(col.getRed(), col.getGreen())); <BUG>if(top < rand.nextInt(128) + 128){ return voidEffect;</BUG> } return effect; }
if(top != 255){ return voidEffect;
11,999
package org.neo4j.io.pagecache.stress; import static org.hamcrest.CoreMatchers.is; <BUG>import static org.junit.Assert.assertThat; import org.neo4j.io.pagecache.PageCursor;</BUG> public class RecordVerifierUpdater { private static final int SizeOfLong = 8;
import java.io.IOException; import org.neo4j.io.pagecache.PageCursor;
12,000
private final int numberOfCounters; public RecordVerifierUpdater( int numberOfCounters ) { this.numberOfCounters = numberOfCounters; } <BUG>public void verifyChecksumAndUpdateCount( PageCursor cursor, int recordNumber, int counterNumber ) </BUG> { verifyChecksum( cursor, recordNumber ); updateCount( cursor, recordNumber, counterNumber );
public void verifyChecksumAndUpdateCount( PageCursor cursor, int recordNumber, int counterNumber ) throws IOException