id
int64
1
60k
buggy
stringlengths
34
37.5k
fixed
stringlengths
6
37.4k
1,501
private static final String C_PROPERTY_WRITE = "INSERT INTO PROPERTIES VALUES(?,?)"; private static final String C_PROPERTY_UPDATE="UPDATE PROPERTIES SET PROPERTY_VALUE = ? WHERE PROPERTY_NAME = ? "; private static final String C_PROPERTY_DELETE="DELETE FROM PROPERTIES WHERE PROPERTY_NAME = ?"; private static final String C_PROPERTY_VALUE="PROPERTY_VALUE"; private Connection m_Con = null; <BUG>private PreparedStatement m_statementPropertyRead; private PreparedStatement m_statementPropertyWrite; private PreparedStatement m_statementPropertyUpdate; private PreparedStatement m_statementPropertyDelete;</BUG> public CmsAccessPropertyMySql(String driver,String conUrl)
private static final String C_PROPERTY_WRITE = "INSERT INTO PROPERTIES VALUES(?,?)"; private static final String C_PROPERTY_UPDATE="UPDATE PROPERTIES SET PROPERTY_VALUE = ? WHERE PROPERTY_NAME = ? "; private static final String C_PROPERTY_DELETE="DELETE FROM PROPERTIES WHERE PROPERTY_NAME = ?"; private static final String C_PROPERTY_VALUE="PROPERTY_VALUE"; private Connection m_Con = null; public CmsAccessPropertyMySql(String driver,String conUrl)
1,502
ObjectInputStream oin = new ObjectInputStream(bin); property=(Serializable)oin.readObject(); } } catch (SQLException e){ <BUG>throw new CmsException(e.getMessage(),CmsException.C_SQL_ERROR, e); </BUG> } catch (IOException e){ <BUG>throw new CmsException(CmsException. C_SERIALIZATION, e); </BUG> }
ObjectInputStream oin = new ObjectInputStream(bin); property=(Serializable)oin.readObject(); } } catch (SQLException e){ throw new CmsException("["+this.getClass().getName()+"]"+e.getMessage(),CmsException.C_SQL_ERROR, e); } catch (IOException e){ throw new CmsException("["+this.getClass().getName()+"]"+CmsException. C_SERIALIZATION, e); }
1,503
catch (IOException e){ <BUG>throw new CmsException(CmsException. C_SERIALIZATION, e); </BUG> } catch (ClassNotFoundException e){ <BUG>throw new CmsException(CmsException. C_SERIALIZATION, e); </BUG> } return property; }
catch (IOException e){ throw new CmsException("["+this.getClass().getName()+"]"+CmsException. C_SERIALIZATION, e); } catch (ClassNotFoundException e){ throw new CmsException("["+this.getClass().getName()+"]"+CmsException. C_SERIALIZATION, e); } return property; }
1,504
ByteArrayOutputStream bout= new ByteArrayOutputStream(); ObjectOutputStream oout=new ObjectOutputStream(bout); oout.writeObject(object); oout.close(); value=bout.toByteArray(); <BUG>synchronized (m_statementPropertyUpdate) { m_statementPropertyUpdate.setBytes(1,value); m_statementPropertyUpdate.setString(2,name); m_statementPropertyUpdate.executeUpdate(); }</BUG> }
ByteArrayOutputStream bout= new ByteArrayOutputStream(); ObjectOutputStream oout=new ObjectOutputStream(bout); oout.writeObject(object); oout.close(); value=bout.toByteArray(); PreparedStatement statementPropertyUpdate=m_Con.prepareStatement(C_PROPERTY_UPDATE); statementPropertyUpdate.setBytes(1,value); statementPropertyUpdate.setString(2,name); statementPropertyUpdate.executeUpdate(); }
1,505
public MetricsAssertHelper HELPER = CompatibilityFactory.getInstance(MetricsAssertHelper.class); @Test public void testRegionWrapperMetrics() { MetricsRegion mr = new MetricsRegion(new MetricsRegionWrapperStub()); MetricsRegionAggregateSource agg = mr.getSource().getAggregateSource(); <BUG>HELPER.assertGauge("table.MetricsRegionWrapperStub.region.DEADBEEF001.storeCount", 101, agg); HELPER.assertGauge("table.MetricsRegionWrapperStub.region.DEADBEEF001.storeFileCount", 102, agg); HELPER.assertGauge("table.MetricsRegionWrapperStub.region.DEADBEEF001.memstoreSize", 103, agg); </BUG> mr.close();
public MetricsAssertHelper HELPER = CompatibilityFactory.getInstance(MetricsAssertHelper.class); @Test public void testRegionWrapperMetrics() { MetricsRegion mr = new MetricsRegion(new MetricsRegionWrapperStub()); MetricsRegionAggregateSource agg = mr.getSource().getAggregateSource(); HELPER.assertGauge("namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_storeCount", 101, agg); HELPER.assertGauge("namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_storeFileCount", 102, agg); HELPER.assertGauge("namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_memstoreSize", 103, agg); mr.close();
1,506
</BUG> @InterfaceAudience.Private public class MetricsThriftServerSourceImpl extends BaseSourceImpl implements MetricsThriftServerSource { <BUG>private MutableStat batchGetStat; private MutableStat batchMutateStat; private MutableStat queueTimeStat; private MutableStat thriftCallStat; private MutableStat thriftSlowCallStat; </BUG> private MutableGaugeLong callQueueLenGauge;
package org.apache.hadoop.hbase.thrift; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.hbase.metrics.BaseSourceImpl; import org.apache.hadoop.metrics2.lib.MutableGaugeLong; import org.apache.hadoop.metrics2.lib.MutableHistogram; @InterfaceAudience.Private public class MetricsThriftServerSourceImpl extends BaseSourceImpl implements MetricsThriftServerSource { private MutableHistogram batchGetStat; private MutableHistogram batchMutateStat; private MutableHistogram queueTimeStat; private MutableHistogram thriftCallStat; private MutableHistogram thriftSlowCallStat; private MutableGaugeLong callQueueLenGauge;
1,507
public void incNumRowKeysInBatchMutate(int diff) { batchMutateStat.add(diff); } @Override public void incMethodTime(String name, long time) { <BUG>MutableStat s = getMetricsRegistry().newRate(name); </BUG> s.add(time); } @Override
public void incNumRowKeysInBatchMutate(int diff) { batchMutateStat.add(diff); } @Override public void incMethodTime(String name, long time) { MutableHistogram s = getMetricsRegistry().getHistogram(name); s.add(time); } @Override
1,508
public RegionWrapperStub(String regionName) { this.regionName = regionName; } @Override public String getTableName() { <BUG>return null; //To change body of implemented methods use File | Settings | File Templates. }</BUG> @Override public String getRegionName() { return this.regionName;
public RegionWrapperStub(String regionName) { this.regionName = regionName; } @Override public String getTableName() { return null; } @Override public String getNamespace() { return null; } @Override public String getRegionName() { return this.regionName;
1,509
public String getRegionName() { return this.regionName; } @Override public long getNumStores() { <BUG>return 0; //To change body of implemented methods use File | Settings | File Templates. }</BUG> @Override public long getNumStoreFiles() { <BUG>return 0; //To change body of implemented methods use File | Settings | File Templates. }</BUG> @Override
public String getRegionName() { return this.regionName; } @Override public long getNumStores() { return 0; } @Override public long getNumStoreFiles() { return 0; } @Override
1,510
public long getNumStoreFiles() { <BUG>return 0; //To change body of implemented methods use File | Settings | File Templates. }</BUG> @Override public long getMemstoreSize() { <BUG>return 0; //To change body of implemented methods use File | Settings | File Templates. }</BUG> @Override public long getStoreFileSize() { <BUG>return 0; //To change body of implemented methods use File | Settings | File Templates. }</BUG> @Override
public long getNumStoreFiles() { return 0; } @Override public long getMemstoreSize() { return 0; } @Override public long getStoreFileSize() { return 0; } @Override
1,511
public long getStoreFileSize() { <BUG>return 0; //To change body of implemented methods use File | Settings | File Templates. }</BUG> @Override public long getReadRequestCount() { <BUG>return 0; //To change body of implemented methods use File | Settings | File Templates. }</BUG> @Override public long getWriteRequestCount() { <BUG>return 0; //To change body of implemented methods use File | Settings | File Templates. }</BUG> }
public long getStoreFileSize() { return 0; } @Override public long getReadRequestCount() { return 0; } @Override public long getWriteRequestCount() { return 0;
1,512
package org.apache.hadoop.hbase.regionserver; public interface MetricsRegionWrapper { <BUG>String getTableName(); String getRegionName();</BUG> long getNumStores(); long getNumStoreFiles(); long getMemstoreSize();
package org.apache.hadoop.hbase.regionserver; public interface MetricsRegionWrapper { String getTableName(); String getNamespace(); String getRegionName(); long getNumStores(); long getNumStoreFiles(); long getMemstoreSize();
1,513
public void incNumRowKeysInBatchMutate(int diff) { batchMutateStat.add(diff); } @Override public void incMethodTime(String name, long time) { <BUG>MetricMutableStat s = getMetricsRegistry().newStat(name); </BUG> s.add(time); } @Override
public void incNumRowKeysInBatchMutate(int diff) { batchMutateStat.add(diff); } @Override public void incMethodTime(String name, long time) { MetricMutableHistogram s = getMetricsRegistry().getHistogram(name); s.add(time); } @Override
1,514
public RegionWrapperStub(String regionName) { this.regionName = regionName; } @Override public String getTableName() { <BUG>return null; //To change body of implemented methods use File | Settings | File Templates. }</BUG> @Override public String getRegionName() { return this.regionName;
public RegionWrapperStub(String regionName) { this.regionName = regionName; } @Override public String getTableName() { return null; } @Override public String getNamespace() { return null; } @Override public String getRegionName() { return this.regionName;
1,515
public String getRegionName() { return this.regionName; } @Override public long getNumStores() { <BUG>return 0; //To change body of implemented methods use File | Settings | File Templates. }</BUG> @Override public long getNumStoreFiles() { <BUG>return 0; //To change body of implemented methods use File | Settings | File Templates. }</BUG> @Override
public String getRegionName() { return this.regionName; } @Override public long getNumStores() { return 0; } @Override public long getNumStoreFiles() { return 0; } @Override
1,516
public long getNumStoreFiles() { <BUG>return 0; //To change body of implemented methods use File | Settings | File Templates. }</BUG> @Override public long getMemstoreSize() { <BUG>return 0; //To change body of implemented methods use File | Settings | File Templates. }</BUG> @Override public long getStoreFileSize() { <BUG>return 0; //To change body of implemented methods use File | Settings | File Templates. }</BUG> @Override
public long getNumStoreFiles() { return 0; } @Override public long getMemstoreSize() { return 0; } @Override public long getStoreFileSize() { return 0; } @Override
1,517
public long getStoreFileSize() { <BUG>return 0; //To change body of implemented methods use File | Settings | File Templates. }</BUG> @Override public long getReadRequestCount() { <BUG>return 0; //To change body of implemented methods use File | Settings | File Templates. }</BUG> @Override public long getWriteRequestCount() { <BUG>return 0; //To change body of implemented methods use File | Settings | File Templates. }</BUG> }
public long getStoreFileSize() { return 0; } @Override public long getReadRequestCount() { return 0; } @Override public long getWriteRequestCount() { return 0;
1,518
package org.apache.hadoop.hbase.regionserver; public class MetricsRegionWrapperStub implements MetricsRegionWrapper { @Override public String getTableName() { <BUG>return "MetricsRegionWrapperStub"; }</BUG> @Override public String getRegionName() { return "DEADBEEF001";
package org.apache.hadoop.hbase.regionserver; public class MetricsRegionWrapperStub implements MetricsRegionWrapper { @Override public String getTableName() { return "MetricsRegionWrapperStub"; } @Override public String getNamespace() { return "TestNS"; } @Override public String getRegionName() { return "DEADBEEF001";
1,519
import org.apache.hadoop.metrics2.MetricsRecordBuilder; import org.apache.hadoop.metrics2.impl.JmxCacheBuster; import org.apache.hadoop.metrics2.lib.DynamicMetricsRegistry; import org.apache.hadoop.metrics2.lib.Interns; import org.apache.hadoop.metrics2.lib.MutableCounterLong; <BUG>import org.apache.hadoop.metrics2.lib.MutableStat; </BUG> @InterfaceAudience.Private public class MetricsRegionSourceImpl implements MetricsRegionSource { private final MetricsRegionWrapper regionWrapper;
import org.apache.hadoop.metrics2.MetricsRecordBuilder; import org.apache.hadoop.metrics2.impl.JmxCacheBuster; import org.apache.hadoop.metrics2.lib.DynamicMetricsRegistry; import org.apache.hadoop.metrics2.lib.Interns; import org.apache.hadoop.metrics2.lib.MutableCounterLong; import org.apache.hadoop.metrics2.lib.MutableHistogram; @InterfaceAudience.Private public class MetricsRegionSourceImpl implements MetricsRegionSource { private final MetricsRegionWrapper regionWrapper;
1,520
private String regionScanNextKey; private MutableCounterLong regionPut; private MutableCounterLong regionDelete; private MutableCounterLong regionIncrement; private MutableCounterLong regionAppend; <BUG>private MutableStat regionGet; private MutableStat regionScanNext; </BUG> public MetricsRegionSourceImpl(MetricsRegionWrapper regionWrapper,
private String regionScanNextKey; private MutableCounterLong regionPut; private MutableCounterLong regionDelete; private MutableCounterLong regionIncrement; private MutableCounterLong regionAppend; private MutableHistogram regionGet; private MutableHistogram regionScanNext; public MetricsRegionSourceImpl(MetricsRegionWrapper regionWrapper,
1,521
regionWrapper.getTableName() + " " + regionWrapper.getRegionName());</BUG> registry = agg.getMetricsRegistry(); <BUG>regionNamePrefix = "table." + regionWrapper.getTableName() + "." + "region." + regionWrapper.getRegionName() + "."; String suffix = "Count";</BUG> regionPutKey = regionNamePrefix + MetricsRegionServerSource.MUTATE_KEY + suffix;
public MetricsRegionSourceImpl(MetricsRegionWrapper regionWrapper, MetricsRegionAggregateSourceImpl aggregate) { this.regionWrapper = regionWrapper; agg = aggregate; agg.register(this); LOG.debug("Creating new MetricsRegionSourceImpl for table " + regionWrapper.getTableName() + " " + regionWrapper.getRegionName()); registry = agg.getMetricsRegistry(); regionNamePrefix = "namespace_" + regionWrapper.getNamespace() + "_table_" + regionWrapper.getTableName() + "_region_" + regionWrapper.getRegionName() + "_metric_"; String suffix = "Count"; regionPutKey = regionNamePrefix + MetricsRegionServerSource.MUTATE_KEY + suffix;
1,522
regionIncrementKey = regionNamePrefix + MetricsRegionServerSource.INCREMENT_KEY + suffix; regionIncrement = registry.getLongCounter(regionIncrementKey, 0l); regionAppendKey = regionNamePrefix + MetricsRegionServerSource.APPEND_KEY + suffix; regionAppend = registry.getLongCounter(regionAppendKey, 0l); regionGetKey = regionNamePrefix + MetricsRegionServerSource.GET_KEY; <BUG>regionGet = registry.newStat(regionGetKey, "", OPS_SAMPLE_NAME, SIZE_VALUE_NAME); regionScanNextKey = regionNamePrefix + MetricsRegionServerSource.SCAN_NEXT_KEY; regionScanNext = registry.newStat(regionScanNextKey, "", OPS_SAMPLE_NAME, SIZE_VALUE_NAME); }</BUG> @Override
regionIncrementKey = regionNamePrefix + MetricsRegionServerSource.INCREMENT_KEY + suffix; regionIncrement = registry.getLongCounter(regionIncrementKey, 0l); regionAppendKey = regionNamePrefix + MetricsRegionServerSource.APPEND_KEY + suffix; regionAppend = registry.getLongCounter(regionAppendKey, 0l); regionGetKey = regionNamePrefix + MetricsRegionServerSource.GET_KEY; regionGet = registry.newHistogram(regionGetKey); regionScanNextKey = regionNamePrefix + MetricsRegionServerSource.SCAN_NEXT_KEY; regionScanNext = registry.newHistogram(regionScanNextKey); } @Override
1,523
import org.apache.commons.logging.LogFactory; import org.apache.hadoop.metrics2.MetricsRecordBuilder; import org.apache.hadoop.metrics2.impl.JmxCacheBuster; import org.apache.hadoop.metrics2.lib.DynamicMetricsRegistry; import org.apache.hadoop.metrics2.lib.MetricMutableCounterLong; <BUG>import org.apache.hadoop.metrics2.lib.MetricMutableStat; </BUG> public class MetricsRegionSourceImpl implements MetricsRegionSource { private final MetricsRegionWrapper regionWrapper; private boolean closed = false;
import org.apache.commons.logging.LogFactory; import org.apache.hadoop.metrics2.MetricsRecordBuilder; import org.apache.hadoop.metrics2.impl.JmxCacheBuster; import org.apache.hadoop.metrics2.lib.DynamicMetricsRegistry; import org.apache.hadoop.metrics2.lib.MetricMutableCounterLong; import org.apache.hadoop.metrics2.lib.MetricMutableHistogram; public class MetricsRegionSourceImpl implements MetricsRegionSource { private final MetricsRegionWrapper regionWrapper; private boolean closed = false;
1,524
private String regionScanNextKey; private MetricMutableCounterLong regionPut; private MetricMutableCounterLong regionDelete; private MetricMutableCounterLong regionIncrement; private MetricMutableCounterLong regionAppend; <BUG>private MetricMutableStat regionGet; private MetricMutableStat regionScanNext; </BUG> public MetricsRegionSourceImpl(MetricsRegionWrapper regionWrapper,
private String regionScanNextKey; private MetricMutableCounterLong regionPut; private MetricMutableCounterLong regionDelete; private MetricMutableCounterLong regionIncrement; private MetricMutableCounterLong regionAppend; private MetricMutableHistogram regionGet; private MetricMutableHistogram regionScanNext; public MetricsRegionSourceImpl(MetricsRegionWrapper regionWrapper,
1,525
regionWrapper.getTableName() + " " + regionWrapper.getRegionName());</BUG> registry = agg.getMetricsRegistry(); <BUG>regionNamePrefix = "table." + regionWrapper.getTableName() + "." + "region." + regionWrapper.getRegionName() + "."; String suffix = "Count";</BUG> regionPutKey = regionNamePrefix + MetricsRegionServerSource.MUTATE_KEY + suffix;
public MetricsRegionSourceImpl(MetricsRegionWrapper regionWrapper, MetricsRegionAggregateSourceImpl aggregate) { this.regionWrapper = regionWrapper; agg = aggregate; agg.register(this); LOG.debug("Creating new MetricsRegionSourceImpl for table " + regionWrapper.getTableName() + " " + regionWrapper.getRegionName()); registry = agg.getMetricsRegistry(); regionNamePrefix = "namespace_" + regionWrapper.getNamespace() + "_table_" + regionWrapper.getTableName() + "_region_" + regionWrapper.getRegionName() + "_metric_"; String suffix = "Count"; regionPutKey = regionNamePrefix + MetricsRegionServerSource.MUTATE_KEY + suffix;
1,526
regionIncrementKey = regionNamePrefix + MetricsRegionServerSource.INCREMENT_KEY + suffix; regionIncrement = registry.getLongCounter(regionIncrementKey, 0l); regionAppendKey = regionNamePrefix + MetricsRegionServerSource.APPEND_KEY + suffix; regionAppend = registry.getLongCounter(regionAppendKey, 0l); regionGetKey = regionNamePrefix + MetricsRegionServerSource.GET_KEY; <BUG>regionGet = registry.newStat(regionGetKey, "", OPS_SAMPLE_NAME, SIZE_VALUE_NAME); regionScanNextKey = regionNamePrefix + MetricsRegionServerSource.SCAN_NEXT_KEY; regionScanNext = registry.newStat(regionScanNextKey, "", OPS_SAMPLE_NAME, SIZE_VALUE_NAME); }</BUG> @Override
regionIncrementKey = regionNamePrefix + MetricsRegionServerSource.INCREMENT_KEY + suffix; regionIncrement = registry.getLongCounter(regionIncrementKey, 0l); regionAppendKey = regionNamePrefix + MetricsRegionServerSource.APPEND_KEY + suffix; regionAppend = registry.getLongCounter(regionAppendKey, 0l); regionGetKey = regionNamePrefix + MetricsRegionServerSource.GET_KEY; regionGet = registry.newHistogram(regionGetKey); regionScanNextKey = regionNamePrefix + MetricsRegionServerSource.SCAN_NEXT_KEY; regionScanNext = registry.newHistogram(regionScanNextKey); } @Override
1,527
import java.util.Map; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; public class MetricsRegionWrapperImpl implements MetricsRegionWrapper, Closeable { <BUG>public static final int PERIOD = 45; private final HRegion region;</BUG> private ScheduledExecutorService executor; private Runnable runnable; private long numStoreFiles;
import java.util.Map; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; public class MetricsRegionWrapperImpl implements MetricsRegionWrapper, Closeable { public static final int PERIOD = 45; public static final String UNKNOWN = "unknown"; private final HRegion region; private ScheduledExecutorService executor; private Runnable runnable; private long numStoreFiles;
1,528
import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Optional; <BUG>import org.slf4j.Logger; import org.slf4j.LoggerFactory;</BUG> import org.webpieces.data.api.BufferPool; import org.webpieces.data.api.DataWrapper; import org.webpieces.data.api.DataWrapperGenerator;
import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Optional; import org.webpieces.data.api.BufferPool; import org.webpieces.data.api.DataWrapper; import org.webpieces.data.api.DataWrapperGenerator;
1,529
HttpRequestLine requestLine = new HttpRequestLine(); requestLine.setMethod(KnownHttpMethod.GET); requestLine.setUri(new HttpUri("http://www.deano.com")); HttpRequest req = new HttpRequest(); req.setRequestLine(requestLine); <BUG>byte[] array = parser.marshalToBytes(req); </BUG> ByteBuffer buffer = ByteBuffer.wrap(array); dataListener.incomingData(mockTcpChannel, ByteBuffer.allocate(0)); dataListener.incomingData(mockTcpChannel, buffer);
HttpRequestLine requestLine = new HttpRequestLine(); requestLine.setMethod(KnownHttpMethod.GET); requestLine.setUri(new HttpUri("http://www.deano.com")); HttpRequest req = new HttpRequest(); req.setRequestLine(requestLine); byte[] array = unwrap(parser.marshalToByteBuffer(req)); ByteBuffer buffer = ByteBuffer.wrap(array); dataListener.incomingData(mockTcpChannel, ByteBuffer.allocate(0)); dataListener.incomingData(mockTcpChannel, buffer);
1,530
Assert.assertEquals(msg, result2); } @Test public void testAsciiConverter() { HttpResponse response = createOkResponse(); <BUG>byte[] payload = parser.marshalToBytes(response); </BUG> ConvertAscii converter = new ConvertAscii(); String readableForm = converter.convertToReadableForm(payload); Assert.assertEquals(
Assert.assertEquals(msg, result2); } @Test public void testAsciiConverter() { HttpResponse response = createOkResponse(); byte[] payload = unwrap(parser.marshalToByteBuffer(response)); ConvertAscii converter = new ConvertAscii(); String readableForm = converter.convertToReadableForm(payload); Assert.assertEquals(
1,531
Assert.assertEquals(response, httpMessage); } @Test public void test2AndHalfHttpMessages() { HttpResponse response = createOkResponse(); <BUG>byte[] payload = parser.marshalToBytes(response); </BUG> byte[] first = new byte[2*payload.length + 20]; byte[] second = new byte[payload.length - 20]; System.arraycopy(payload, 0, first, 0, payload.length);
Assert.assertEquals(response, httpMessage); } @Test public void test2AndHalfHttpMessages() { HttpResponse response = createOkResponse(); byte[] payload = unwrap(parser.marshalToByteBuffer(response)); byte[] first = new byte[2*payload.length + 20]; byte[] second = new byte[payload.length - 20]; System.arraycopy(payload, 0, first, 0, payload.length);
1,532
Assert.assertEquals(msg, result2); } @Test public void testAsciiConverter() { HttpRequest request = createPostRequest(); <BUG>byte[] payload = parser.marshalToBytes(request); </BUG> ConvertAscii converter = new ConvertAscii(); String readableForm = converter.convertToReadableForm(payload); String expected = "POST\\s http://myhost.com\\s HTTP/1.1\\r\\n\r\n"
Assert.assertEquals(msg, result2); } @Test public void testAsciiConverter() { HttpRequest request = createPostRequest(); byte[] payload = unwrap(parser.marshalToByteBuffer(request)); ConvertAscii converter = new ConvertAscii(); String readableForm = converter.convertToReadableForm(payload); String expected = "POST\\s http://myhost.com\\s HTTP/1.1\\r\\n\r\n"
1,533
Assert.assertEquals(request, httpMessage); } @Test public void test2AndHalfHttpMessages() { HttpRequest request = createPostRequest(); <BUG>byte[] payload = parser.marshalToBytes(request); </BUG> byte[] first = new byte[2*payload.length + 20]; byte[] second = new byte[payload.length - 20]; System.arraycopy(payload, 0, first, 0, payload.length);
Assert.assertEquals(request, httpMessage); } @Test public void test2AndHalfHttpMessages() { HttpRequest request = createPostRequest(); byte[] payload = unwrap(parser.marshalToByteBuffer(request)); byte[] first = new byte[2*payload.length + 20]; byte[] second = new byte[payload.length - 20]; System.arraycopy(payload, 0, first, 0, payload.length);
1,534
DataWrapper payload1 = dataGen.wrapByteArray("0123456789".getBytes()); HttpChunk chunk = new HttpChunk(); chunk.addExtension(new HttpChunkExtension("asdf", "value")); chunk.addExtension(new HttpChunkExtension("something")); chunk.setBody(payload1); <BUG>byte[] payload = parser.marshalToBytes(chunk); </BUG> String str = new String(payload); Assert.assertEquals("a;asdf=value;something\r\n0123456789\r\n", str); HttpLastChunk lastChunk = new HttpLastChunk();
DataWrapper payload1 = dataGen.wrapByteArray("0123456789".getBytes()); HttpChunk chunk = new HttpChunk(); chunk.addExtension(new HttpChunkExtension("asdf", "value")); chunk.addExtension(new HttpChunkExtension("something")); chunk.setBody(payload1); byte[] payload = unwrap(parser.marshalToByteBuffer(chunk)); String str = new String(payload); Assert.assertEquals("a;asdf=value;something\r\n0123456789\r\n", str); HttpLastChunk lastChunk = new HttpLastChunk();
1,535
HttpLastChunk lastChunk = new HttpLastChunk(); lastChunk.addExtension(new HttpChunkExtension("this", "that")); lastChunk.addHeader(new Header("customer", "value")); String lastPayload = parser.marshalToString(lastChunk); Assert.assertEquals("0;this=that\r\ncustomer: value\r\n\r\n", lastPayload); <BUG>byte[] lastBytes = parser.marshalToBytes(lastChunk); </BUG> String lastPayloadFromBytes = new String(lastBytes, HttpParserFactory.iso8859_1); Assert.assertEquals("0;this=that\r\ncustomer: value\r\n\r\n", lastPayloadFromBytes); }
HttpLastChunk lastChunk = new HttpLastChunk(); lastChunk.addExtension(new HttpChunkExtension("this", "that")); lastChunk.addHeader(new Header("customer", "value")); String lastPayload = parser.marshalToString(lastChunk); Assert.assertEquals("0;this=that\r\ncustomer: value\r\n\r\n", lastPayload); byte[] lastBytes = unwrap(parser.marshalToByteBuffer(lastChunk)); String lastPayloadFromBytes = new String(lastBytes, HttpParserFactory.iso8859_1); Assert.assertEquals("0;this=that\r\ncustomer: value\r\n\r\n", lastPayloadFromBytes); }
1,536
import java.nio.ByteBuffer; import org.webpieces.data.api.DataWrapper; import org.webpieces.httpparser.api.dto.HttpPayload; public interface HttpParser { ByteBuffer marshalToByteBuffer(HttpPayload request); <BUG>byte[] marshalToBytes(HttpPayload request);</BUG> String marshalToString(HttpPayload request); Memento prepareToParse(); Memento parse(Memento state, DataWrapper moreData); HttpPayload unmarshal(byte[] msg); }
import java.nio.ByteBuffer; import org.webpieces.data.api.DataWrapper; import org.webpieces.httpparser.api.dto.HttpPayload; public interface HttpParser { ByteBuffer marshalToByteBuffer(HttpPayload request); String marshalToString(HttpPayload request); Memento prepareToParse(); Memento parse(Memento state, DataWrapper moreData); HttpPayload unmarshal(byte[] msg);
1,537
import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Key; import com.intellij.psi.PsiClass;</BUG> import com.intellij.ui.content.Content; import com.intellij.ui.content.ContentManagerAdapter; <BUG>import com.intellij.ui.content.ContentManagerEvent; import com.intellij.xdebugger.XDebuggerBundle;</BUG> import icons.AndroidIcons; import org.jetbrains.android.dom.manifest.Instrumentation; import org.jetbrains.android.dom.manifest.Manifest;
import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.Ref; import com.intellij.openapi.wm.ToolWindowId; import com.intellij.psi.PsiClass; import com.intellij.ui.content.Content; import com.intellij.ui.content.ContentManagerAdapter; import com.intellij.ui.content.ContentManagerEvent; import com.intellij.xdebugger.DefaultDebugProcessHandler; import com.intellij.xdebugger.XDebuggerBundle; import icons.AndroidIcons; import org.jetbrains.android.dom.manifest.Instrumentation; import org.jetbrains.android.dom.manifest.Manifest;
1,538
import org.jetbrains.android.run.testing.AndroidTestRunConfiguration; import org.jetbrains.android.util.AndroidBundle; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; <BUG>import javax.swing.*; import static com.intellij.execution.process.ProcessOutputTypes.STDERR; public class AndroidDebugRunner extends DefaultProgramRunner {</BUG> private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.run.AndroidDebugRunner"); <BUG>public static final Key<RunContentDescriptor> ANDROID_PROCESS_HANDLER = new Key<RunContentDescriptor>("ANDROID_PROCESS_HANDLER"); private static final Object myReaderLock = new Object();</BUG> private static final Object myDebugLock = new Object();
import org.jetbrains.android.run.testing.AndroidTestRunConfiguration; import org.jetbrains.android.util.AndroidBundle; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.util.List; import static com.intellij.execution.process.ProcessOutputTypes.STDERR; import static com.intellij.execution.process.ProcessOutputTypes.STDOUT; public class AndroidDebugRunner extends DefaultProgramRunner { private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.run.AndroidDebugRunner"); public static final Key<AndroidSessionInfo> ANDROID_SESSION_INFO = new Key<AndroidSessionInfo>("ANDROID_SESSION_INFO"); private static final Object myReaderLock = new Object(); private static final Object myDebugLock = new Object();
1,539
public static final String ANDROID_LOGCAT_CONTENT_ID = "Android Logcat"; private static void tryToCloseOldSessions(final Executor executor, Project project) { final ExecutionManager manager = ExecutionManager.getInstance(project); ProcessHandler[] processes = manager.getRunningProcesses(); for (ProcessHandler process : processes) { <BUG>final RunContentDescriptor descriptor = process.getUserData(ANDROID_PROCESS_HANDLER); if (descriptor != null) { </BUG> process.addProcessListener(new ProcessAdapter() { @Override
public static final String ANDROID_LOGCAT_CONTENT_ID = "Android Logcat"; private static void tryToCloseOldSessions(final Executor executor, Project project) { final ExecutionManager manager = ExecutionManager.getInstance(project); ProcessHandler[] processes = manager.getRunningProcesses(); for (ProcessHandler process : processes) { final AndroidSessionInfo info = process.getUserData(ANDROID_SESSION_INFO); if (info != null) { process.addProcessListener(new ProcessAdapter() { @Override
1,540
process.addProcessListener(new ProcessAdapter() { @Override public void processTerminated(ProcessEvent event) { ApplicationManager.getApplication().invokeLater(new Runnable() { public void run() { <BUG>manager.getContentManager().removeRunContent(executor, descriptor); </BUG> } }); }
process.addProcessListener(new ProcessAdapter() { @Override public void processTerminated(ProcessEvent event) { ApplicationManager.getApplication().invokeLater(new Runnable() { public void run() { manager.getContentManager().removeRunContent(executor, info.getDescriptor()); } }); }
1,541
private final Project myProject; private final RemoteConnection myConnection; private final RunnerSettings myRunnerSettings; private final ConfigurationPerRunnerSettings myConfigurationSettings; private final AndroidRunningState myState; <BUG>private final IDevice myDevice; public AndroidDebugState(Project project,</BUG> RemoteConnection connection, RunnerSettings runnerSettings, ConfigurationPerRunnerSettings configurationSettings,
private final Project myProject; private final RemoteConnection myConnection; private final RunnerSettings myRunnerSettings; private final ConfigurationPerRunnerSettings myConfigurationSettings; private final AndroidRunningState myState; private final IDevice myDevice; private volatile ConsoleView myConsoleView; public AndroidDebugState(Project project, RemoteConnection connection, RunnerSettings runnerSettings, ConfigurationPerRunnerSettings configurationSettings,
1,542
return myConfigurationSettings; } public ExecutionResult execute(final Executor executor, @NotNull final ProgramRunner runner) throws ExecutionException { RemoteDebugProcessHandler process = new RemoteDebugProcessHandler(myProject); myState.setProcessHandler(process); <BUG>final ConsoleView c = myState.getConfiguration().attachConsole(myState, executor); </BUG> final boolean resetSelectedTab = myState.getConfiguration() instanceof AndroidRunConfiguration; <BUG>final MyLogcatExecutionConsole console = new MyLogcatExecutionConsole(myProject, myDevice, process, c, resetSelectedTab); </BUG> return new DefaultExecutionResult(console, process);
return myConfigurationSettings; } public ExecutionResult execute(final Executor executor, @NotNull final ProgramRunner runner) throws ExecutionException { RemoteDebugProcessHandler process = new RemoteDebugProcessHandler(myProject); myState.setProcessHandler(process); myConsoleView = myState.getConfiguration().attachConsole(myState, executor); final boolean resetSelectedTab = myState.getConfiguration() instanceof AndroidRunConfiguration; final MyLogcatExecutionConsole console = new MyLogcatExecutionConsole(myProject, myDevice, process, myConsoleView, resetSelectedTab);
1,543
return "AndroidDebugRunner"; } public boolean canRun(@NotNull String executorId, @NotNull RunProfile profile) { return DefaultDebugExecutor.EXECUTOR_ID.equals(executorId) && profile instanceof AndroidRunConfigurationBase; } <BUG>private static class MyLogcatExecutionConsole implements ExecutionConsoleEx { </BUG> private final Project myProject; private final AndroidLogcatView myToolWindowView; private final ConsoleView myConsoleView;
return "AndroidDebugRunner"; } public boolean canRun(@NotNull String executorId, @NotNull RunProfile profile) { return DefaultDebugExecutor.EXECUTOR_ID.equals(executorId) && profile instanceof AndroidRunConfigurationBase; } private static class MyLogcatExecutionConsole implements ExecutionConsoleEx, ObservableConsoleView { private final Project myProject; private final AndroidLogcatView myToolWindowView; private final ConsoleView myConsoleView;
1,544
public void launchDebug(final IDevice device, final String debugPort) { ApplicationManager.getApplication().invokeLater(new Runnable() { @SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"}) public void run() { final DebuggerPanelsManager manager = DebuggerPanelsManager.getInstance(myProject); <BUG>RemoteState st = new AndroidDebugState(myProject, new RemoteConnection(true, "localhost", debugPort, false), myEnvironment.getRunnerSettings(),</BUG> myEnvironment.getConfigurationSettings(), myRunningState, device); RunContentDescriptor debugDescriptor = null; final ProcessHandler processHandler = myRunningState.getProcessHandler();
public void launchDebug(final IDevice device, final String debugPort) { ApplicationManager.getApplication().invokeLater(new Runnable() { @SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"}) public void run() { final DebuggerPanelsManager manager = DebuggerPanelsManager.getInstance(myProject); AndroidDebugState st = new AndroidDebugState(myProject, new RemoteConnection(true, "localhost", debugPort, false), myEnvironment.getRunnerSettings(), myEnvironment.getConfigurationSettings(), myRunningState, device); RunContentDescriptor debugDescriptor = null; final ProcessHandler processHandler = myRunningState.getProcessHandler();
1,545
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.Pair; import org.jetbrains.android.facet.AndroidFacet; <BUG>import org.jetbrains.android.run.AndroidDebugRunner; import org.jetbrains.android.sdk.AndroidSdkUtils;</BUG> import org.jetbrains.android.util.AndroidBundle; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.Pair; import org.jetbrains.android.facet.AndroidFacet; import org.jetbrains.android.run.AndroidDebugRunner; import org.jetbrains.android.run.AndroidSessionInfo; import org.jetbrains.android.sdk.AndroidSdkUtils; import org.jetbrains.android.util.AndroidBundle; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable;
1,546
final List<Pair<ProcessHandler, RunContentDescriptor>> pairs = new ArrayList<Pair<ProcessHandler, RunContentDescriptor>>(); for (Project p : ProjectManager.getInstance().getOpenProjects()) { final ProcessHandler[] processes = ExecutionManager.getInstance(p).getRunningProcesses(); for (ProcessHandler process : processes) { if (!process.isProcessTerminated()) { <BUG>final RunContentDescriptor descriptor = process.getUserData(AndroidDebugRunner.ANDROID_PROCESS_HANDLER); if (descriptor != null) { pairs.add(Pair.create(process, descriptor)); </BUG> }
final List<Pair<ProcessHandler, RunContentDescriptor>> pairs = new ArrayList<Pair<ProcessHandler, RunContentDescriptor>>(); for (Project p : ProjectManager.getInstance().getOpenProjects()) { final ProcessHandler[] processes = ExecutionManager.getInstance(p).getRunningProcesses(); for (ProcessHandler process : processes) { if (!process.isProcessTerminated()) { final AndroidSessionInfo info = process.getUserData(AndroidDebugRunner.ANDROID_SESSION_INFO); if (info != null) { pairs.add(Pair.create(process, info.getDescriptor()));
1,547
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 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"; public static final int THREAD_INFO_TYPE = 0; public static final int UPDATE = 1; public static final int REQUEST_PUT_HEADER = 2; public static final int REQUEST_FLUSH_HEADER = 3;
1,548
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";
e.printStackTrace(); } filePlayback=null; } @Override public void stop() { if ( filePlayback!=null ) filePlayback.stop(); } @Override public boolean isrunning(){ if ( filePlayback!=null ) return filePlayback.isrunning(); return false; } void initFiles() throws FileNotFoundException { if ((dataDir.length() != 0) && !dataDir.endsWith("/")) { dataDir = dataDir + "/"; } // guard path if needed String samples_str = dataDir + "samples"; String events_str = dataDir + "events";
1,549
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;
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; private boolean run = true;
1,550
@Override public void onReceive(final Context context, Intent intent) { Log.i(TAG, "Dealing with Flush request"); switch (intent.getIntExtra(C.MESSAGE_TYPE, -1)) { case C.REQUEST_PUT_HEADER: <BUG>buffer.putHeader(0, 0, 0); break;</BUG> case C.REQUEST_FLUSH_HEADER: <BUG>buffer.flushHeader(); break;</BUG> case C.REQUEST_FLUSH_SAMPLES:
@Override public void onReceive(final Context context, Intent intent) { Log.i(TAG, "Dealing with Flush request"); switch (intent.getIntExtra(C.MESSAGE_TYPE, -1)) { case C.REQUEST_PUT_HEADER: if ( buffer!= null ) buffer.putHeader(0, 0, 0); break; case C.REQUEST_FLUSH_HEADER: if ( buffer!= null ) buffer.flushHeader(); break;
1,551
case C.REQUEST_FLUSH_HEADER: <BUG>buffer.flushHeader(); break;</BUG> case C.REQUEST_FLUSH_SAMPLES: <BUG>buffer.flushSamples(); break;</BUG> case C.REQUEST_FLUSH_EVENTS: <BUG>buffer.flushEvents(); break; default:</BUG> }
case C.REQUEST_FLUSH_HEADER: if ( buffer!= null ) buffer.flushHeader(); break; case C.REQUEST_FLUSH_SAMPLES: if ( buffer!= null ) buffer.flushSamples(); break; case C.REQUEST_FLUSH_EVENTS: if ( buffer!= null ) buffer.flushEvents(); break; case C.BUFFER_INFO_BROADCAST: if ( monitor != null ) monitor.sendAllInfo(); default:
1,552
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 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"; public static final int THREAD_INFO_TYPE = 0; public static final int UPDATE = 1; public static final int REQUEST_PUT_HEADER = 2; public static final int REQUEST_FLUSH_HEADER = 3;
1,553
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";
e.printStackTrace(); } filePlayback=null; } @Override public void stop() { if ( filePlayback!=null ) filePlayback.stop(); } @Override public boolean isrunning(){ if ( filePlayback!=null ) return filePlayback.isrunning(); return false; } void initFiles() throws FileNotFoundException { if ((dataDir.length() != 0) && !dataDir.endsWith("/")) { dataDir = dataDir + "/"; } // guard path if needed String samples_str = dataDir + "samples"; String events_str = dataDir + "events";
1,554
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) {
package nl.dcc.buffer_bci.bufferclientsservice; import android.os.Parcel; import android.os.Parcelable; import nl.dcc.buffer_bci.C; public class ThreadInfo implements Parcelable { public static final Creator<ThreadInfo> CREATOR = new Creator<ThreadInfo>() { @Override public ThreadInfo createFromParcel(final Parcel in) {
1,555
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;
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; private boolean run = true;
1,556
@Override public void onReceive(final Context context, Intent intent) { Log.i(TAG, "Dealing with Flush request"); switch (intent.getIntExtra(C.MESSAGE_TYPE, -1)) { case C.REQUEST_PUT_HEADER: <BUG>buffer.putHeader(0, 0, 0); break;</BUG> case C.REQUEST_FLUSH_HEADER: <BUG>buffer.flushHeader(); break;</BUG> case C.REQUEST_FLUSH_SAMPLES:
@Override public void onReceive(final Context context, Intent intent) { Log.i(TAG, "Dealing with Flush request"); switch (intent.getIntExtra(C.MESSAGE_TYPE, -1)) { case C.REQUEST_PUT_HEADER: if ( buffer!= null ) buffer.putHeader(0, 0, 0); break; case C.REQUEST_FLUSH_HEADER: if ( buffer!= null ) buffer.flushHeader(); break;
1,557
case C.REQUEST_FLUSH_HEADER: <BUG>buffer.flushHeader(); break;</BUG> case C.REQUEST_FLUSH_SAMPLES: <BUG>buffer.flushSamples(); break;</BUG> case C.REQUEST_FLUSH_EVENTS: <BUG>buffer.flushEvents(); break; default:</BUG> }
case C.REQUEST_FLUSH_HEADER: if ( buffer!= null ) buffer.flushHeader(); break; case C.REQUEST_FLUSH_SAMPLES: if ( buffer!= null ) buffer.flushSamples(); break; case C.REQUEST_FLUSH_EVENTS: if ( buffer!= null ) buffer.flushEvents(); break; case C.BUFFER_INFO_BROADCAST: if ( monitor != null ) monitor.sendAllInfo(); default:
1,558
loadPicture(picture, task, null, true); } else if (!TextUtils.isEmpty(picture.pic) && !highRes) { picture.retries = 0; loadPicture(picture, task, null, false); } else if (task.collection.site.hasFlag(Site.FLAG_SINGLE_PAGE_BIG_PICTURE) <BUG>&& task.collection.site.extraRule != null && task.collection.site.extraRule.pictureUrl != null) { </BUG> getPictureUrl(picture, task, task.collection.site.extraRule.pictureUrl, task.collection.site.extraRule.pictureHighRes);
loadPicture(picture, task, null, true); } else if (!TextUtils.isEmpty(picture.pic) && !highRes) { picture.retries = 0; loadPicture(picture, task, null, false); } else if (task.collection.site.hasFlag(Site.FLAG_SINGLE_PAGE_BIG_PICTURE) && task.collection.site.extraRule != null) { if(task.collection.site.extraRule.pictureRule != null && task.collection.site.extraRule.pictureRule.url != null) getPictureUrl(picture, task, task.collection.site.extraRule.pictureRule.url, task.collection.site.extraRule.pictureRule.highRes); else if(task.collection.site.extraRule.pictureUrl != null) getPictureUrl(picture, task, task.collection.site.extraRule.pictureUrl, task.collection.site.extraRule.pictureHighRes);
1,559
if (Picture.hasPicPosfix(picture.url)) { picture.pic = picture.url; loadPicture(picture, task, null, false); } else if (task.collection.site.hasFlag(Site.FLAG_JS_NEEDED_ALL)) { <BUG>new Handler(Looper.getMainLooper()).post(()->{ </BUG> WebView webView = new WebView(HViewerApplication.mContext); WebSettings mWebSettings = webView.getSettings(); mWebSettings.setJavaScriptEnabled(true);
if (Picture.hasPicPosfix(picture.url)) { picture.pic = picture.url; loadPicture(picture, task, null, false); } else if (task.collection.site.hasFlag(Site.FLAG_JS_NEEDED_ALL)) { new Handler(Looper.getMainLooper()).post(() -> { WebView webView = new WebView(HViewerApplication.mContext); WebSettings mWebSettings = webView.getSettings(); mWebSettings.setJavaScriptEnabled(true);
1,560
import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; <BUG>import android.view.ViewGroup; import android.widget.TextView; import com.dpizarro.autolabel.library.AutoLabelUI;</BUG> import com.dpizarro.autolabel.library.Label; <BUG>import java.util.List; import butterknife.BindView;</BUG> import butterknife.ButterKnife;
import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import com.balysv.materialripple.MaterialRippleLayout; import com.dpizarro.autolabel.library.AutoLabelUI; import com.dpizarro.autolabel.library.Label; import java.util.List; import java.util.zip.Inflater; import butterknife.BindView; import butterknife.ButterKnife;
1,561
notifyItemChanged(position); if (mItemClickListener != null) mItemClickListener.onItemClick(v, position); } }); <BUG>if (tag.selected) label.getChildAt(0).setBackgroundResource(R.color.colorPrimary); else label.getChildAt(0).setBackgroundResource(R.color.dimgray);</BUG> }
notifyItemChanged(position); if (mItemClickListener != null) mItemClickListener.onItemClick(v, position);
1,562
import ml.puredark.hviewer.ui.activities.BaseActivity; import ml.puredark.hviewer.ui.dataproviders.ListDataProvider; import ml.puredark.hviewer.ui.fragments.SettingFragment; import ml.puredark.hviewer.ui.listeners.OnItemLongClickListener; import ml.puredark.hviewer.utils.SharedPreferencesUtil; <BUG>import static android.webkit.WebSettings.LOAD_CACHE_ELSE_NETWORK; public class PictureViewerAdapter extends RecyclerView.Adapter<PictureViewerAdapter.PictureViewerViewHolder> {</BUG> private BaseActivity activity; private Site site; private ListDataProvider mProvider;
import ml.puredark.hviewer.ui.activities.BaseActivity; import ml.puredark.hviewer.ui.dataproviders.ListDataProvider; import ml.puredark.hviewer.ui.fragments.SettingFragment; import ml.puredark.hviewer.ui.listeners.OnItemLongClickListener; import ml.puredark.hviewer.utils.SharedPreferencesUtil; import static android.webkit.WebSettings.LOAD_CACHE_ELSE_NETWORK; import static ml.puredark.hviewer.R.id.container; public class PictureViewerAdapter extends RecyclerView.Adapter<PictureViewerAdapter.PictureViewerViewHolder> { private BaseActivity activity; private Site site; private ListDataProvider mProvider;
1,563
final PictureViewHolder viewHolder = new PictureViewHolder(view); if (pictures != null && position < pictures.size()) { final Picture picture = pictures.get(getPicturePostion(position)); if (picture.pic != null) { loadImage(container.getContext(), picture, viewHolder); <BUG>} else if (site.hasFlag(Site.FLAG_SINGLE_PAGE_BIG_PICTURE) && site.extraRule != null && site.extraRule.pictureUrl != null) { getPictureUrl(container.getContext(), viewHolder, picture, site, site.extraRule.pictureUrl, site.extraRule.pictureHighRes);</BUG> } else if (site.picUrlSelector != null) { getPictureUrl(container.getContext(), viewHolder, picture, site, site.picUrlSelector, null); } else {
final PictureViewHolder viewHolder = new PictureViewHolder(view); if (pictures != null && position < pictures.size()) { final Picture picture = pictures.get(getPicturePostion(position)); if (picture.pic != null) { loadImage(container.getContext(), picture, viewHolder); } else if (site.hasFlag(Site.FLAG_SINGLE_PAGE_BIG_PICTURE) && site.extraRule != null) { if(site.extraRule.pictureRule != null && site.extraRule.pictureRule.url != null) getPictureUrl(container.getContext(), viewHolder, picture, site, site.extraRule.pictureRule.url, site.extraRule.pictureRule.highRes); else if(site.extraRule.pictureUrl != null) getPictureUrl(container.getContext(), viewHolder, picture, site, site.extraRule.pictureUrl, site.extraRule.pictureHighRes); } else if (site.picUrlSelector != null) { getPictureUrl(container.getContext(), viewHolder, picture, site, site.picUrlSelector, null); } else {
1,564
import java.util.regex.Pattern; import butterknife.BindView; import butterknife.ButterKnife; import ml.puredark.hviewer.R; import ml.puredark.hviewer.beans.Category; <BUG>import ml.puredark.hviewer.beans.CommentRule; import ml.puredark.hviewer.beans.Rule;</BUG> import ml.puredark.hviewer.beans.Selector; import ml.puredark.hviewer.beans.Site; import ml.puredark.hviewer.ui.adapters.CategoryInputAdapter;
import java.util.regex.Pattern; import butterknife.BindView; import butterknife.ButterKnife; import ml.puredark.hviewer.R; import ml.puredark.hviewer.beans.Category; import ml.puredark.hviewer.beans.CommentRule; import ml.puredark.hviewer.beans.PictureRule; import ml.puredark.hviewer.beans.Rule; import ml.puredark.hviewer.beans.Selector; import ml.puredark.hviewer.beans.Site; import ml.puredark.hviewer.ui.adapters.CategoryInputAdapter;
1,565
inputGalleryRulePictureUrlReplacement.setText(site.galleryRule.pictureUrl.replacement); } if (site.galleryRule.pictureHighRes != null) { inputGalleryRulePictureHighResSelector.setText(joinSelector(site.galleryRule.pictureHighRes)); inputGalleryRulePictureHighResRegex.setText(site.galleryRule.pictureHighRes.regex); <BUG>inputGalleryRulePictureHighResReplacement.setText(site.galleryRule.pictureHighRes.replacement); }</BUG> if (site.galleryRule.commentRule != null) { if (site.galleryRule.commentRule.item != null) { inputGalleryRuleCommentItemSelector.setText(joinSelector(site.galleryRule.commentRule.item));
inputGalleryRulePictureUrlReplacement.setText(site.galleryRule.pictureUrl.replacement); } if (site.galleryRule.pictureHighRes != null) { inputGalleryRulePictureHighResSelector.setText(joinSelector(site.galleryRule.pictureHighRes)); inputGalleryRulePictureHighResRegex.setText(site.galleryRule.pictureHighRes.regex); inputGalleryRulePictureHighResReplacement.setText(site.galleryRule.pictureHighRes.replacement); } } if (site.galleryRule.commentRule != null) { if (site.galleryRule.commentRule.item != null) { inputGalleryRuleCommentItemSelector.setText(joinSelector(site.galleryRule.commentRule.item));
1,566
inputExtraRuleCommentDatetimeReplacement.setText(site.extraRule.commentDatetime.replacement); } if (site.extraRule.commentContent != null) { inputExtraRuleCommentContentSelector.setText(joinSelector(site.extraRule.commentContent)); inputExtraRuleCommentContentRegex.setText(site.extraRule.commentContent.regex); <BUG>inputExtraRuleCommentContentReplacement.setText(site.extraRule.commentContent.replacement); }</BUG> } } }
inputExtraRuleCommentDatetimeReplacement.setText(site.extraRule.commentDatetime.replacement); } if (site.extraRule.commentContent != null) { inputExtraRuleCommentContentSelector.setText(joinSelector(site.extraRule.commentContent)); inputExtraRuleCommentContentRegex.setText(site.extraRule.commentContent.regex); inputExtraRuleCommentContentReplacement.setText(site.extraRule.commentContent.replacement); } } } } }
1,567
lastSite.galleryRule.cover = loadSelector(inputGalleryRuleCoverSelector, inputGalleryRuleCoverRegex, inputGalleryRuleCoverReplacement); lastSite.galleryRule.category = loadSelector(inputGalleryRuleCategorySelector, inputGalleryRuleCategoryRegex, inputGalleryRuleCategoryReplacement); lastSite.galleryRule.datetime = loadSelector(inputGalleryRuleDatetimeSelector, inputGalleryRuleDatetimeRegex, inputGalleryRuleDatetimeReplacement); lastSite.galleryRule.rating = loadSelector(inputGalleryRuleRatingSelector, inputGalleryRuleRatingRegex, inputGalleryRuleRatingReplacement); lastSite.galleryRule.description = loadSelector(inputGalleryRuleDescriptionSelector, inputGalleryRuleDescriptionRegex, inputGalleryRuleDescriptionReplacement); <BUG>lastSite.galleryRule.tags = loadSelector(inputGalleryRuleTagsSelector, inputGalleryRuleTagsRegex, inputGalleryRuleTagsReplacement); lastSite.galleryRule.pictureThumbnail = loadSelector(inputGalleryRulePictureThumbnailSelector, inputGalleryRulePictureThumbnailRegex, inputGalleryRulePictureThumbnailReplacement); lastSite.galleryRule.pictureUrl = loadSelector(inputGalleryRulePictureUrlSelector, inputGalleryRulePictureUrlRegex, inputGalleryRulePictureUrlReplacement); lastSite.galleryRule.pictureHighRes = loadSelector(inputGalleryRulePictureHighResSelector, inputGalleryRulePictureHighResRegex, inputGalleryRulePictureHighResReplacement); lastSite.galleryRule.commentRule = new CommentRule(); lastSite.galleryRule.commentRule.item = loadSelector(inputGalleryRuleCommentItemSelector, inputGalleryRuleCommentItemRegex, inputGalleryRuleCommentItemReplacement);</BUG> lastSite.galleryRule.commentRule.avatar = loadSelector(inputGalleryRuleCommentAvatarSelector, inputGalleryRuleCommentAvatarRegex, inputGalleryRuleCommentAvatarReplacement);
lastSite.galleryRule.cover = loadSelector(inputGalleryRuleCoverSelector, inputGalleryRuleCoverRegex, inputGalleryRuleCoverReplacement); lastSite.galleryRule.category = loadSelector(inputGalleryRuleCategorySelector, inputGalleryRuleCategoryRegex, inputGalleryRuleCategoryReplacement); lastSite.galleryRule.datetime = loadSelector(inputGalleryRuleDatetimeSelector, inputGalleryRuleDatetimeRegex, inputGalleryRuleDatetimeReplacement); lastSite.galleryRule.rating = loadSelector(inputGalleryRuleRatingSelector, inputGalleryRuleRatingRegex, inputGalleryRuleRatingReplacement); lastSite.galleryRule.description = loadSelector(inputGalleryRuleDescriptionSelector, inputGalleryRuleDescriptionRegex, inputGalleryRuleDescriptionReplacement); lastSite.galleryRule.tags = loadSelector(inputGalleryRuleTagsSelector, inputGalleryRuleTagsRegex, inputGalleryRuleTagsReplacement); lastSite.galleryRule.pictureRule = (lastSite.galleryRule.pictureRule == null) ? new PictureRule() : lastSite.galleryRule.pictureRule; lastSite.galleryRule.pictureRule.thumbnail = loadSelector(inputGalleryRulePictureThumbnailSelector, inputGalleryRulePictureThumbnailRegex, inputGalleryRulePictureThumbnailReplacement); lastSite.galleryRule.pictureRule.url = loadSelector(inputGalleryRulePictureUrlSelector, inputGalleryRulePictureUrlRegex, inputGalleryRulePictureUrlReplacement); lastSite.galleryRule.pictureRule.highRes = loadSelector(inputGalleryRulePictureHighResSelector, inputGalleryRulePictureHighResRegex, inputGalleryRulePictureHighResReplacement); lastSite.galleryRule.commentRule = (lastSite.galleryRule.commentRule == null) ? new CommentRule() : lastSite.galleryRule.commentRule; lastSite.galleryRule.commentRule.item = loadSelector(inputGalleryRuleCommentItemSelector, inputGalleryRuleCommentItemRegex, inputGalleryRuleCommentItemReplacement); lastSite.galleryRule.commentRule.avatar = loadSelector(inputGalleryRuleCommentAvatarSelector, inputGalleryRuleCommentAvatarRegex, inputGalleryRuleCommentAvatarReplacement);
1,568
lastSite.extraRule.cover = loadSelector(inputExtraRuleCoverSelector, inputExtraRuleCoverRegex, inputExtraRuleCoverReplacement); lastSite.extraRule.category = loadSelector(inputExtraRuleCategorySelector, inputExtraRuleCategoryRegex, inputExtraRuleCategoryReplacement); lastSite.extraRule.datetime = loadSelector(inputExtraRuleDatetimeSelector, inputExtraRuleDatetimeRegex, inputExtraRuleDatetimeReplacement); lastSite.extraRule.rating = loadSelector(inputExtraRuleRatingSelector, inputExtraRuleRatingRegex, inputExtraRuleRatingReplacement); lastSite.extraRule.description = loadSelector(inputExtraRuleDescriptionSelector, inputExtraRuleDescriptionRegex, inputExtraRuleDescriptionReplacement); <BUG>lastSite.extraRule.tags = loadSelector(inputExtraRuleTagsSelector, inputExtraRuleTagsRegex, inputExtraRuleTagsReplacement); lastSite.extraRule.pictureThumbnail = loadSelector(inputExtraRulePictureThumbnailSelector, inputExtraRulePictureThumbnailRegex, inputExtraRulePictureThumbnailReplacement); lastSite.extraRule.pictureUrl = loadSelector(inputExtraRulePictureUrlSelector, inputExtraRulePictureUrlRegex, inputExtraRulePictureUrlReplacement); lastSite.extraRule.pictureHighRes = loadSelector(inputExtraRulePictureHighResSelector, inputExtraRulePictureHighResRegex, inputExtraRulePictureHighResReplacement); lastSite.extraRule.commentRule = new CommentRule(); lastSite.extraRule.commentRule.item = loadSelector(inputExtraRuleCommentItemSelector, inputExtraRuleCommentItemRegex, inputExtraRuleCommentItemReplacement);</BUG> lastSite.extraRule.commentRule.avatar = loadSelector(inputExtraRuleCommentAvatarSelector, inputExtraRuleCommentAvatarRegex, inputExtraRuleCommentAvatarReplacement);
lastSite.extraRule.cover = loadSelector(inputExtraRuleCoverSelector, inputExtraRuleCoverRegex, inputExtraRuleCoverReplacement); lastSite.extraRule.category = loadSelector(inputExtraRuleCategorySelector, inputExtraRuleCategoryRegex, inputExtraRuleCategoryReplacement); lastSite.extraRule.datetime = loadSelector(inputExtraRuleDatetimeSelector, inputExtraRuleDatetimeRegex, inputExtraRuleDatetimeReplacement); lastSite.extraRule.rating = loadSelector(inputExtraRuleRatingSelector, inputExtraRuleRatingRegex, inputExtraRuleRatingReplacement); lastSite.extraRule.description = loadSelector(inputExtraRuleDescriptionSelector, inputExtraRuleDescriptionRegex, inputExtraRuleDescriptionReplacement); lastSite.extraRule.tags = loadSelector(inputExtraRuleTagsSelector, inputExtraRuleTagsRegex, inputExtraRuleTagsReplacement); lastSite.extraRule.pictureRule = (lastSite.extraRule.pictureRule == null) ? new PictureRule() : lastSite.extraRule.pictureRule; lastSite.extraRule.pictureRule.thumbnail = loadSelector(inputExtraRulePictureThumbnailSelector, inputExtraRulePictureThumbnailRegex, inputExtraRulePictureThumbnailReplacement); lastSite.extraRule.pictureRule.url = loadSelector(inputExtraRulePictureUrlSelector, inputExtraRulePictureUrlRegex, inputExtraRulePictureUrlReplacement); lastSite.extraRule.pictureRule.highRes = loadSelector(inputExtraRulePictureHighResSelector, inputExtraRulePictureHighResRegex, inputExtraRulePictureHighResReplacement); lastSite.extraRule.commentRule = (lastSite.extraRule.commentRule == null) ? new CommentRule() : lastSite.extraRule.commentRule; lastSite.extraRule.commentRule.item = loadSelector(inputExtraRuleCommentItemSelector, inputExtraRuleCommentItemRegex, inputExtraRuleCommentItemReplacement); lastSite.extraRule.commentRule.avatar = loadSelector(inputExtraRuleCommentAvatarSelector, inputExtraRuleCommentAvatarRegex, inputExtraRuleCommentAvatarReplacement);
1,569
import android.content.Context; import android.content.SharedPreferences; import android.location.Location; import android.os.AsyncTask; import android.support.annotation.NonNull; <BUG>import android.util.Log; import org.mariotaku.twidere.BuildConfig; import org.mariotaku.twidere.Constants; import org.mariotaku.twidere.util.JsonSerializer;</BUG> import org.mariotaku.twidere.util.Utils;
import android.content.Context; import android.content.SharedPreferences; import android.location.Location; import android.os.AsyncTask; import android.support.annotation.NonNull; import org.mariotaku.twidere.Constants; import org.mariotaku.twidere.util.DebugLog; import org.mariotaku.twidere.util.JsonSerializer; import org.mariotaku.twidere.util.Utils;
1,570
} public static LatLng getCachedLatLng(@NonNull final Context context) { final Context appContext = context.getApplicationContext(); final SharedPreferences prefs = DependencyHolder.Companion.get(context).getPreferences(); if (!prefs.getBoolean(KEY_USAGE_STATISTICS, false)) return null; <BUG>if (BuildConfig.DEBUG) { Log.d(HotMobiLogger.LOGTAG, "getting cached location"); }</BUG> final Location location = Utils.getCachedLocation(appContext);
} public static LatLng getCachedLatLng(@NonNull final Context context) { final Context appContext = context.getApplicationContext(); final SharedPreferences prefs = DependencyHolder.Companion.get(context).getPreferences(); if (!prefs.getBoolean(KEY_USAGE_STATISTICS, false)) return null; DebugLog.d(HotMobiLogger.LOGTAG, "getting cached location", null); final Location location = Utils.getCachedLocation(appContext);
1,571
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> }
FileBody fileBody = null; try { fileBody = getFileBody(context, imageUri); twitter.updateProfileBannerImage(fileBody); } finally { Utils.closeSilently(fileBody); if (deleteImage) { Utils.deleteMedia(context, imageUri);
1,572
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> }
FileBody fileBody = null; try { fileBody = getFileBody(context, imageUri); twitter.updateProfileBannerImage(fileBody); } finally { Utils.closeSilently(fileBody); if (deleteImage) { Utils.deleteMedia(context, imageUri);
1,573
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> }
FileBody fileBody = null; try { fileBody = getFileBody(context, imageUri); twitter.updateProfileBannerImage(fileBody); } finally { Utils.closeSilently(fileBody); if (deleteImage) { Utils.deleteMedia(context, imageUri);
1,574
import org.mariotaku.twidere.receiver.NotificationReceiver; import org.mariotaku.twidere.service.LengthyOperationsService; import org.mariotaku.twidere.util.ActivityTracker; import org.mariotaku.twidere.util.AsyncTwitterWrapper; import org.mariotaku.twidere.util.DataStoreFunctionsKt; <BUG>import org.mariotaku.twidere.util.DataStoreUtils; import org.mariotaku.twidere.util.ImagePreloader;</BUG> import org.mariotaku.twidere.util.InternalTwitterContentUtils; import org.mariotaku.twidere.util.JsonSerializer; import org.mariotaku.twidere.util.NotificationManagerWrapper;
import org.mariotaku.twidere.receiver.NotificationReceiver; import org.mariotaku.twidere.service.LengthyOperationsService; import org.mariotaku.twidere.util.ActivityTracker; import org.mariotaku.twidere.util.AsyncTwitterWrapper; import org.mariotaku.twidere.util.DataStoreFunctionsKt; import org.mariotaku.twidere.util.DataStoreUtils; import org.mariotaku.twidere.util.DebugLog; import org.mariotaku.twidere.util.ImagePreloader; import org.mariotaku.twidere.util.InternalTwitterContentUtils; import org.mariotaku.twidere.util.JsonSerializer; import org.mariotaku.twidere.util.NotificationManagerWrapper;
1,575
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> }
final List<InetAddress> addresses = mDns.lookup(host); for (InetAddress address : addresses) { c.addRow(new String[]{host, address.getHostAddress()}); } } catch (final IOException ignore) { DebugLog.w(LOGTAG, null, ignore); }
1,576
public int destroySavedSearchAsync(final UserKey accountKey, final long searchId) { final DestroySavedSearchTask task = new DestroySavedSearchTask(accountKey, searchId); return asyncTaskManager.add(task, true); } public int destroyStatusAsync(final UserKey accountKey, final String statusId) { <BUG>final DestroyStatusTask task = new DestroyStatusTask(context,accountKey, statusId); </BUG> return asyncTaskManager.add(task, true); } public int destroyUserListAsync(final UserKey accountKey, final String listId) {
public int destroySavedSearchAsync(final UserKey accountKey, final long searchId) { final DestroySavedSearchTask task = new DestroySavedSearchTask(accountKey, searchId); return asyncTaskManager.add(task, true); } public int destroyStatusAsync(final UserKey accountKey, final String statusId) { final DestroyStatusTask task = new DestroyStatusTask(context, accountKey, statusId); return asyncTaskManager.add(task, true); } public int destroyUserListAsync(final UserKey accountKey, final String listId) {
1,577
@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> }
@Override public UserKey[] getAccountKeys() { return DataStoreUtils.getActivatedAccountKeys(context);
1,578
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> }
MicroBlog microBlog = MicroBlogAPIFactory.getInstance(context, accountId); if (!Utils.isOfficialCredentials(context, accountId)) continue; try { microBlog.setActivitiesAboutMeUnread(cursor); } catch (MicroBlogException e) { DebugLog.w(LOGTAG, null, e);
1,579
for (Location location : twitter.getAvailableTrends()) { map.put(location); } return map.pack(); } catch (final MicroBlogException e) { <BUG>if (BuildConfig.DEBUG) { Log.w(LOGTAG, e); }</BUG> }
for (Location location : twitter.getAvailableTrends()) { map.put(location); } return map.pack(); } catch (final MicroBlogException e) { DebugLog.w(LOGTAG, null, e); }
1,580
import org.apache.commons.lang3.math.NumberUtils; import org.json.JSONException; import org.mariotaku.microblog.library.MicroBlog; import org.mariotaku.microblog.library.MicroBlogException; import org.mariotaku.microblog.library.twitter.model.RateLimitStatus; <BUG>import org.mariotaku.microblog.library.twitter.model.Status; 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.apache.commons.lang3.math.NumberUtils; import org.json.JSONException; import org.mariotaku.microblog.library.MicroBlog; import org.mariotaku.microblog.library.MicroBlogException; import org.mariotaku.microblog.library.twitter.model.RateLimitStatus; import org.mariotaku.microblog.library.twitter.model.Status; import org.mariotaku.pickncrop.library.PNCUtils; import org.mariotaku.sqliteqb.library.AllColumns; import org.mariotaku.sqliteqb.library.Columns; import org.mariotaku.sqliteqb.library.Columns.Column; import org.mariotaku.sqliteqb.library.Expression;
1,581
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;
context.getApplicationContext().sendBroadcast(intent); } } @Nullable public static Location getCachedLocation(Context context) { DebugLog.v(LOGTAG, "Fetching cached location", new Exception()); Location location = null;
1,582
public void setShowHeader(String boolVal) { m_showHeader = Boolean.valueOf(boolVal); } @Override public void selectionChanged(SelectionContext selectionContext) { <BUG>synchronized (m_currentHudDisplayLock) { if (m_currentHudDisplay != null) { m_currentHudDisplay.setVertexSelectionCount(selectionContext.getSelectedVertexRefs().size()); m_currentHudDisplay.setEdgeSelectionCount(selectionContext.getSelectedEdgeRefs().size()); } }</BUG> if(m_panBtn != null && !m_panBtn.getStyleName().equals("toolbar-button down")){
public void setShowHeader(String boolVal) { m_showHeader = Boolean.valueOf(boolVal); } @Override public void selectionChanged(SelectionContext selectionContext) { m_hudDisplay.setVertexSelectionCount(selectionContext.getSelectedVertexRefs().size()); m_hudDisplay.setEdgeSelectionCount(selectionContext.getSelectedEdgeRefs().size()); if(m_panBtn != null && !m_panBtn.getStyleName().equals("toolbar-button down")){
1,583
checkEvaluationsEqual(eval4, foundissueProto.getEvaluations(0)); checkEvaluationsEqual(eval5, foundissueProto.getEvaluations(1)); } public void testGetRecentEvaluationsNoneFound() throws Exception { DbIssue issue = createDbIssue("fad", persistenceHelper); <BUG>DbEvaluation eval1 = createEvaluation(issue, "someone", 100); DbEvaluation eval2 = createEvaluation(issue, "someone", 200); DbEvaluation eval3 = createEvaluation(issue, "someone", 300); issue.addEvaluations(eval1, eval2, eval3);</BUG> getPersistenceManager().makePersistent(issue);
checkEvaluationsEqual(eval4, foundissueProto.getEvaluations(0)); checkEvaluationsEqual(eval5, foundissueProto.getEvaluations(1)); } public void testGetRecentEvaluationsNoneFound() throws Exception { DbIssue issue = createDbIssue("fad", persistenceHelper); createEvaluation(issue, "someone", 100); createEvaluation(issue, "someone", 200); createEvaluation(issue, "someone", 300); getPersistenceManager().makePersistent(issue);
1,584
public int read() throws IOException { return inputStream.read(); } }); } <BUG>} protected DbEvaluation createEvaluation(DbIssue issue, String who, long when) {</BUG> DbUser user; Query query = getPersistenceManager().newQuery("select from " + persistenceHelper.getDbUserClass().getName() + " where openid == :myopenid");
public int read() throws IOException { return inputStream.read(); } }); } } @SuppressWarnings({"unchecked"}) protected DbEvaluation createEvaluation(DbIssue issue, String who, long when) { DbUser user; Query query = getPersistenceManager().newQuery("select from " + persistenceHelper.getDbUserClass().getName() + " where openid == :myopenid");
1,585
eval.setComment("my comment"); eval.setDesignation("MUST_FIX"); eval.setIssue(issue); eval.setWhen(when); eval.setWho(user.createKeyObject()); <BUG>eval.setEmail(who); return eval;</BUG> } protected PersistenceManager getPersistenceManager() { return testHelper.getPersistenceManager();
eval.setComment("my comment"); eval.setDesignation("MUST_FIX"); eval.setIssue(issue); eval.setWhen(when); eval.setWho(user.createKeyObject()); eval.setEmail(who); issue.addEvaluation(eval); return eval; } protected PersistenceManager getPersistenceManager() { return testHelper.getPersistenceManager();
1,586
import java.util.Collections; <BUG>import java.util.Comparator; import java.util.HashMap;</BUG> import java.util.List; import java.util.Map; <BUG>import java.util.Map.Entry; public class ReportServlet extends AbstractFlybushServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp)</BUG> throws IOException { String uri = req.getRequestURI();
import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; public class ReportServlet extends AbstractFlybushServlet { private static final DateFormat DATE_FORMAT = DateFormat.getDateInstance(DateFormat.SHORT); public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { String uri = req.getRequestURI();
1,587
chart.addYAxisLabels(AxisLabelsFactory.newAxisLabels(labels)); chart.addXAxisLabels(AxisLabelsFactory.newNumericRangeAxisLabels(0, max)); chart.setBarWidth(BarChart.AUTO_RESIZE); chart.setSize(600, 500); chart.setHorizontal(true); <BUG>chart.setTitle("Total Evaluations by User"); showChartImg(resp, chart.toURLString()); }</BUG> private List<Entry<String, Integer>> sortEntries(Collection<Entry<String, Integer>> entries) { List<Entry<String, Integer>> result = new ArrayList<Entry<String, Integer>>(entries);
chart.addYAxisLabels(AxisLabelsFactory.newAxisLabels(labels)); chart.addXAxisLabels(AxisLabelsFactory.newNumericRangeAxisLabels(0, max)); chart.setBarWidth(BarChart.AUTO_RESIZE); chart.setSize(600, 500); chart.setHorizontal(true); chart.setDataEncoding(DataEncoding.TEXT); return chart; } private List<Entry<String, Integer>> sortEntries(Collection<Entry<String, Integer>> entries) { List<Entry<String, Integer>> result = new ArrayList<Entry<String, Integer>>(entries);
1,588
package org.camunda.bpm.dmn.engine.impl; import java.util.ArrayList; <BUG>import java.util.Collection; import java.util.LinkedHashMap;</BUG> import java.util.List; import java.util.Map; import java.util.Set;
package org.camunda.bpm.dmn.engine.impl; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set;
1,589
} else { return getFirstValueTyped(); } } @SuppressWarnings("unchecked") <BUG>public <T> T getValue(String name) { if (outputValues.containsKey(name)) { return (T) getValueTyped(name).getValue(); } else { return null; } } @SuppressWarnings("unchecked")</BUG> public <T> T getFirstValue() {
} else { return null; } } @Override public <T extends TypedValue> T getSingleValueTyped() { if (outputValues.size() > 1) { throw LOG.decisionOutputHasMoreThanOneValue(this); } else { return getFirstValueTyped(); } } @SuppressWarnings("unchecked") public <T> T getFirstValue() {
1,590
return outputValues.keySet(); } @Override public Collection<Object> values() { List<Object> values = new ArrayList<Object>(); <BUG>for(TypedValue typedValue : outputValues.values()) { </BUG> values.add(typedValue.getValue()); } return values();
return outputValues.keySet(); } @Override public Collection<Object> values() { List<Object> values = new ArrayList<Object>(); for (TypedValue typedValue : outputValues.values()) { values.add(typedValue.getValue()); } return values();
1,591
package org.camunda.bpm.dmn.engine; import java.io.Serializable; import java.util.Collection; <BUG>import java.util.Set; </BUG> import org.camunda.bpm.engine.variable.value.TypedValue; <BUG>public interface DmnDecisionOutput extends Serializable { <T> T getValue(String name);</BUG> <T> T getFirstValue();
package org.camunda.bpm.dmn.engine; import java.io.Serializable; import java.util.Collection; import java.util.Map; import org.camunda.bpm.engine.variable.value.TypedValue; public interface DmnDecisionOutput extends Map<String, Object>, Serializable { <T> T getFirstValue();
1,592
<T> T getFirstValue(); <T> T getSingleValue(); <T extends TypedValue> T getValueTyped(String name); <T extends TypedValue> T getFirstValueTyped(); <T extends TypedValue> T getSingleValueTyped(); <BUG>int size(); boolean isEmpty(); boolean containsKey(String key); Set<String> keySet(); Collection<Object> values(); Collection<TypedValue> valuesTyped(); }</BUG>
<T> T getFirstValue(); <T> T getSingleValue(); <T extends TypedValue> T getValueTyped(String name); <T extends TypedValue> T getFirstValueTyped(); <T extends TypedValue> T getSingleValueTyped();
1,593
app.mountPages("org.orienteer.camel.web"); app.registerWidgets("org.orienteer.camel.widget"); } private void makeSchema(OrienteerWebApplication app, ODatabaseDocument db){ OSchemaHelper helper = OSchemaHelper.bind(db); <BUG>helper.oClass("OIntegrationConfig"). oProperty("name", OType.STRING). oProperty("description", OType.STRING). oProperty("script", OType.STRING); }</BUG> @Override
app.mountPages("org.orienteer.camel.web"); app.registerWidgets("org.orienteer.camel.widget"); } private void makeSchema(OrienteerWebApplication app, ODatabaseDocument db){ OSchemaHelper helper = OSchemaHelper.bind(db); helper.oClass("OIntegrationConfig") .oProperty("name", OType.STRING, 10).markAsDocumentName() .oProperty("description", OType.STRING, 20) .oProperty("script", OType.STRING, 30).assignVisualization("textarea"); } @Override
1,594
import java.util.Comparator; import java.util.HashMap; import java.util.Map; public class DeanDecode { private static ArrayList<Template> arrayList = null; <BUG>public static String decode(Drawable drawable) { if (drawable == null) return ""; return decode(((BitmapDrawable) drawable).getBitmap()); }</BUG> public static String decode(Bitmap bitmap) {
import java.util.Comparator; import java.util.HashMap; import java.util.Map; public class DeanDecode { private static ArrayList<Template> arrayList = null; public static String decode(Drawable drawable) { try { if (drawable == null) return ""; return decode(((BitmapDrawable) drawable).getBitmap()); } catch (Exception | Error e) {return "";} } public static String decode(Bitmap bitmap) {
1,595
Score s1 = checkScore(arrayList, bitmap, 0); Score s2 = checkScore(arrayList, bitmap, s1.x + s1.template.width - 3); Score s3 = checkScore(arrayList, bitmap, s2.x + s2.template.width - 3); Score s4 = checkScore(arrayList, bitmap, s3.x + s3.template.width - 3); return "" + s1.template.c + s2.template.c + s3.template.c + s4.template.c; <BUG>} catch (Exception e) { </BUG> e.printStackTrace(); return ""; }
Score s1 = checkScore(arrayList, bitmap, 0); Score s2 = checkScore(arrayList, bitmap, s1.x + s1.template.width - 3); Score s3 = checkScore(arrayList, bitmap, s2.x + s2.template.width - 3); Score s4 = checkScore(arrayList, bitmap, s3.x + s3.template.width - 3); return "" + s1.template.c + s2.template.c + s3.template.c + s4.template.c; } catch (Exception | Error e) { e.printStackTrace(); return "";
1,596
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();
e.printStackTrace(); return ""; } } private static Score checkScore( ArrayList<Template> arrayList, Bitmap bitmap, int start) throws Exception, Error { int width = bitmap.getWidth(), height = bitmap.getHeight(); ArrayList<Score> scoreList = new ArrayList<Score>(); int size = arrayList.size();
1,597
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}));
score = s; } } return score; } private static ArrayList<Template> getList() throws Exception, Error { 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}));
1,598
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();
score = _score; template = _temp; } @SuppressLint("UseSparseArrays") public static Score getScore(Bitmap bitmap, Template template, int x, int y) throws Exception, Error { int width = bitmap.getWidth(), height = bitmap.getHeight(); ArrayList<Integer> arrayList = template.arrayList; int size = arrayList.size();
1,599
.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");
.setTitle("存在版本" + Constants.updateVersion + "更新!").setMessage( Constants.updateMessage) .setCancelable(true).setPositiveButton("立即下载", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Uri uri = Uri.parse(Constants.domain + "/pkuhelper/getandroid.php"); try { DownloadManager.Request request = new Request(uri); request.setTitle("正在下载PKU Helper..."); File file = MyFile.getFile(PKUHelper.pkuhelper, null, "PKUHelper.apk");
1,600
public static boolean hasUpdate = false; public static int newMsg = 0; public static int newPass = 0; public static ArrayList<Features> features = new ArrayList<>(); public static String updateVersion = Constants.version; <BUG>public static String updateMessage = ""; public static void setDrawable(int id, Drawable drawable) {</BUG> if (id >= features.size()) return; features.get(id).drawable = drawable; MYPKU.setOthers(features);
public static boolean hasUpdate = false; public static int newMsg = 0; public static int newPass = 0; public static ArrayList<Features> features = new ArrayList<>(); public static String updateVersion = Constants.version; public static String updateMessage = ""; public static String privacy = ""; public static void setDrawable(int id, Drawable drawable) { if (id >= features.size()) return; features.get(id).drawable = drawable; MYPKU.setOthers(features);