buggy_function stringlengths 1 391k | fixed_function stringlengths 0 392k |
|---|---|
public LwjglSound (LwjglAudio audio, LwjglFileHandle file) throws UnsupportedAudioFileException, IOException {
this.audio = audio;
InputStream fin = new BufferedInputStream(file.readFile());
AudioInputStream ain = AudioSystem.getAudioInputStream(fin);
AudioFormat baseFormat = ain.getFormat();
AudioFormat dec... | public LwjglSound (LwjglAudio audio, LwjglFileHandle file) throws UnsupportedAudioFileException, IOException {
this.audio = audio;
InputStream fin = new BufferedInputStream(file.read());
AudioInputStream ain = AudioSystem.getAudioInputStream(fin);
AudioFormat baseFormat = ain.getFormat();
AudioFormat decoded... |
public HieroSettings (String hieroFileRef) {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(Gdx.files.readFile(hieroFileRef, FileType.Absolute)));
while (true) {
String line = reader.readLine();
if (line == null) break;
line = line.trim();
if (line.length() == 0) continu... | public HieroSettings (String hieroFileRef) {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(Gdx.files.absolute(hieroFileRef).read()));
while (true) {
String line = reader.readLine();
if (line == null) break;
line = line.trim();
if (line.length() == 0) continue;
Strin... |
static private Font createFont (String ttfFileRef) {
try {
return Font.createFont(Font.TRUETYPE_FONT, Gdx.files.readFile(ttfFileRef, FileType.Absolute));
} catch (FontFormatException ex) {
throw new GdxRuntimeException("Invalid font: " + ttfFileRef, ex);
} catch (IOException ex) {
throw new GdxRuntimeEx... | static private Font createFont (String ttfFileRef) {
try {
return Font.createFont(Font.TRUETYPE_FONT, Gdx.files.absolute(ttfFileRef).read());
} catch (FontFormatException ex) {
throw new GdxRuntimeException("Invalid font: " + ttfFileRef, ex);
} catch (IOException ex) {
throw new GdxRuntimeException("Err... |
public InputStream getInputStream () {
if (!path.endsWith(".xml")) return null; // Only theme files are loaded through the URL.
return fileHandle.readFile();
}
};
}
});
}
| public InputStream getInputStream () {
if (!path.endsWith(".xml")) return null; // Only theme files are loaded through the URL.
return fileHandle.read();
}
};
}
});
}
|
@Override public void create () {
mesh = ModelLoader.loadObj(Gdx.files.readFile("data/cube.obj", FileType.Internal));
texture = Gdx.graphics.newTexture(Gdx.files.getFileHandle("data/badlogic.jpg", FileType.Internal), TextureFilter.MipMap,
TextureFilter.Linear, TextureWrap.ClampToEdge, TextureWrap.ClampToEdge);
... | @Override public void create () {
mesh = ModelLoader.loadObj(Gdx.files.internal("data/cube.obj").read());
texture = Gdx.graphics.newTexture(Gdx.files.getFileHandle("data/badlogic.jpg", FileType.Internal), TextureFilter.MipMap,
TextureFilter.Linear, TextureWrap.ClampToEdge, TextureWrap.ClampToEdge);
cam = new... |
public void doXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(WildcardQueryParser.NAME);
if (boost == -1 && rewrite != null) {
builder.field(name, wildcard);
} else {
builder.startObject(name);
builder.field("wildc... | public void doXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(WildcardQueryParser.NAME);
if (boost == -1 && rewrite == null) {
builder.field(name, wildcard);
} else {
builder.startObject(name);
builder.field("wildc... |
public File shardLocation(ShardId shardId) {
return new File(new File(location, Integer.toString(shardId.id())), "index");
}
} | public File shardIndexLocation(ShardId shardId) {
return new File(new File(location, Integer.toString(shardId.id())), "index");
}
} |
@Inject public MmapFsStore(ShardId shardId, @IndexSettings Settings indexSettings, IndexStore indexStore) throws IOException {
super(shardId, indexSettings);
// by default, we don't need to sync to disk, since we use the gateway
this.syncToDisk = componentSettings.getAsBoolean("sync_to_disk"... | @Inject public MmapFsStore(ShardId shardId, @IndexSettings Settings indexSettings, IndexStore indexStore) throws IOException {
super(shardId, indexSettings);
// by default, we don't need to sync to disk, since we use the gateway
this.syncToDisk = componentSettings.getAsBoolean("sync_to_disk"... |
@Inject public NioFsStore(ShardId shardId, @IndexSettings Settings indexSettings, IndexStore indexStore) throws IOException {
super(shardId, indexSettings);
// by default, we don't need to sync to disk, since we use the gateway
this.syncToDisk = componentSettings.getAsBoolean("sync_to_disk",... | @Inject public NioFsStore(ShardId shardId, @IndexSettings Settings indexSettings, IndexStore indexStore) throws IOException {
super(shardId, indexSettings);
// by default, we don't need to sync to disk, since we use the gateway
this.syncToDisk = componentSettings.getAsBoolean("sync_to_disk",... |
@Inject public SimpleFsStore(ShardId shardId, @IndexSettings Settings indexSettings, IndexStore indexStore) throws IOException {
super(shardId, indexSettings);
// by default, we don't need to sync to disk, since we use the gateway
this.syncToDisk = componentSettings.getAsBoolean("sync_to_dis... | @Inject public SimpleFsStore(ShardId shardId, @IndexSettings Settings indexSettings, IndexStore indexStore) throws IOException {
super(shardId, indexSettings);
// by default, we don't need to sync to disk, since we use the gateway
this.syncToDisk = componentSettings.getAsBoolean("sync_to_dis... |
public List<Issue> loadInBackground() {
Log.i(TAG, "started loadInBackground");
try {
return issueService.getIssues("rtyley","agit", Collections.<String, String>emptyMap());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
};
}
| public List<Issue> loadInBackground() {
Log.i(TAG, "started loadInBackground");
try {
return issueService.getIssues();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
};
}
|
public InternalAggregation buildEmptyAggregation() {
return new InternalTopHits(name, topHitsContext.size(), topHitsContext.sort(), Lucene.EMPTY_TOP_DOCS, InternalSearchHits.empty());
}
| public InternalAggregation buildEmptyAggregation() {
return new InternalTopHits(name, topHitsContext.from(), topHitsContext.size(), topHitsContext.sort(), Lucene.EMPTY_TOP_DOCS, InternalSearchHits.empty());
}
|
public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
Query query = null;
boolean queryFound = false;
float boost = 1.0f;
String childType = null;
ScoreType scoreType = ScoreType.... | public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
Query query = null;
boolean queryFound = false;
float boost = 1.0f;
String childType = null;
ScoreType scoreType = ScoreType.... |
protected ShardValidateQueryResponse shardOperation(ShardValidateQueryRequest request) throws ElasticsearchException {
IndexService indexService = indicesService.indexServiceSafe(request.shardId().getIndex());
IndexQueryParserService queryParserService = indexService.queryParserService();
In... | protected ShardValidateQueryResponse shardOperation(ShardValidateQueryRequest request) throws ElasticsearchException {
IndexService indexService = indicesService.indexServiceSafe(request.shardId().getIndex());
IndexQueryParserService queryParserService = indexService.queryParserService();
In... |
protected ShardCountResponse shardOperation(ShardCountRequest request) throws ElasticsearchException {
IndexService indexService = indicesService.indexServiceSafe(request.shardId().getIndex());
IndexShard indexShard = indexService.shardSafe(request.shardId().id());
SearchShardTarget shardTa... | protected ShardCountResponse shardOperation(ShardCountRequest request) throws ElasticsearchException {
IndexService indexService = indicesService.indexServiceSafe(request.shardId().getIndex());
IndexShard indexShard = indexService.shardSafe(request.shardId().id());
SearchShardTarget shardTa... |
protected ShardExistsResponse shardOperation(ShardExistsRequest request) throws ElasticsearchException {
IndexService indexService = indicesService.indexServiceSafe(request.shardId().getIndex());
IndexShard indexShard = indexService.shardSafe(request.shardId().id());
SearchShardTarget shard... | protected ShardExistsResponse shardOperation(ShardExistsRequest request) throws ElasticsearchException {
IndexService indexService = indicesService.indexServiceSafe(request.shardId().getIndex());
IndexShard indexShard = indexService.shardSafe(request.shardId().id());
SearchShardTarget shard... |
protected ExplainResponse shardOperation(ExplainRequest request, ShardId shardId) throws ElasticsearchException {
IndexService indexService = indicesService.indexServiceSafe(shardId.getIndex());
IndexShard indexShard = indexService.shardSafe(shardId.id());
Term uidTerm = new Term(UidFieldMap... | protected ExplainResponse shardOperation(ExplainRequest request, ShardId shardId) throws ElasticsearchException {
IndexService indexService = indicesService.indexServiceSafe(shardId.getIndex());
IndexShard indexShard = indexService.shardSafe(shardId.id());
Term uidTerm = new Term(UidFieldMap... |
private SearchContext findContext(long id) throws SearchContextMissingException {
SearchContext context = activeContexts.get(id);
if (context == null) {
throw new SearchContextMissingException(id);
}
SearchContext.setCurrent(context);
return context;
}
fi... | private SearchContext findContext(long id) throws SearchContextMissingException {
SearchContext context = activeContexts.get(id);
if (context == null) {
throw new SearchContextMissingException(id);
}
SearchContext.setCurrent(context);
return context;
}
fi... |
public void search(List<AtomicReaderContext> leaves, Weight weight, Collector collector) throws IOException {
final boolean timeoutSet = searchContext.timeoutInMillis() != -1;
final boolean terminateAfterSet = searchContext.terminateAfter() != SearchContext.DEFAULT_TERMINATE_AFTER;
if (time... | public void search(List<AtomicReaderContext> leaves, Weight weight, Collector collector) throws IOException {
final boolean timeoutSet = searchContext.timeoutInMillis() != -1;
final boolean terminateAfterSet = searchContext.terminateAfter() != SearchContext.DEFAULT_TERMINATE_AFTER;
if (time... |
public void simpleTimeoutTest() throws Exception {
client().prepareIndex("test", "type", "1").setSource("field", "value").setRefresh(true).execute().actionGet();
SearchResponse searchResponse = client().prepareSearch("test")
.setTimeout("10ms")
.setQuery(filteredQuer... | public void simpleTimeoutTest() throws Exception {
client().prepareIndex("test", "type", "1").setSource("field", "value").setRefresh(true).execute().actionGet();
SearchResponse searchResponse = client().prepareSearch("test")
.setTimeout("10ms")
.setQuery(filteredQuer... |
public void run() {
try {
Thread.sleep(20000);
} catch (InterruptedException ex) {
latch.countDown();
Thread.currentThread().interrupt();
}
}
});
threadPool.updateSettings(... | public void run() {
try {
Thread.sleep(20000);
} catch (InterruptedException ex) {
latch.countDown();
Thread.currentThread().interrupt();
}
}
});
threadPool.updateSettings(... |
public void tearDown() throws Exception {
super.tearDown();
serviceA.close();
serviceB.close();
threadPool.shutdown();
}
| public void tearDown() throws Exception {
super.tearDown();
serviceA.close();
serviceB.close();
terminate(threadPool);
}
|
public static void main (String[] args) throws Exception {
new NativeCodeGenerator().generate("src/", "bin/", "jni/");
BuildConfig buildConfig = new BuildConfig("gdx-controllers-desktop");
String[] windowsSrc = {"*.cpp",
"ois-v1-4svn/src/*.cpp",
"ois-v1-4svn/src/win32/*.cpp"
};
String[] linuxSrc ... | public static void main (String[] args) throws Exception {
new NativeCodeGenerator().generate("src/", "bin/", "jni/");
BuildConfig buildConfig = new BuildConfig("gdx-controllers-desktop");
String[] windowsSrc = {"*.cpp",
"ois-v1-4svn/src/*.cpp",
"ois-v1-4svn/src/win32/*.cpp"
};
String[] linuxSrc ... |
protected void onSuccess(Gist gist) throws Exception {
super.onSuccess(gist);
startActivity(ViewGistsActivity.createIntent(gist));
setResult(RESULT_OK);
finish();
}
}.create();
}
} | protected void onSuccess(Gist gist) throws Exception {
super.onSuccess(gist);
startActivity(GistsViewActivity.createIntent(gist));
setResult(RESULT_OK);
finish();
}
}.create();
}
} |
public void onListItemClick(ListView l, View v, int position, long id) {
startActivityForResult(ViewGistsActivity.createIntent(items, position), GIST_VIEW);
}
| public void onListItemClick(ListView l, View v, int position, long id) {
startActivityForResult(GistsViewActivity.createIntent(items, position), GIST_VIEW);
}
|
protected void onSuccess(Gist gist) throws Exception {
super.onSuccess(gist);
((Activity) getContext()).startActivityForResult(ViewGistsActivity.createIntent(gist), GIST_VIEW);
}
| protected void onSuccess(Gist gist) throws Exception {
super.onSuccess(gist);
((Activity) getContext()).startActivityForResult(GistsViewActivity.createIntent(gist), GIST_VIEW);
}
|
@Override public String name() {
return "attachments";
}
| @Override public String name() {
return "mapper-attachments";
}
|
@Override public String name() {
return "memcached";
}
| @Override public String name() {
return "transport-memcached";
}
|
public boolean exists() {
return source == null;
}
| public boolean exists() {
return source != null && source.length > 0;
}
|
@Override public Filter parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
boolean cache = false;
String fieldName = null;
String value = null;
String filterName = null;
String currentFiel... | @Override public Filter parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
boolean cache = true;
String fieldName = null;
String value = null;
String filterName = null;
String currentField... |
@Override public Filter parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
boolean cache = false;
String fieldName = null;
String from = null;
String to = null;
boolean includeLower = true;... | @Override public Filter parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
boolean cache = true;
String fieldName = null;
String from = null;
String to = null;
boolean includeLower = true;
... |
@Override public Filter parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
MapperService.SmartNameFieldMappers smartNameFieldMappers = null;
boolean cache = false;
TermsFilter termsFilter = new PublicTerms... | @Override public Filter parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
MapperService.SmartNameFieldMappers smartNameFieldMappers = null;
boolean cache = true;
TermsFilter termsFilter = new PublicTermsF... |
public NodesInfoResponse newInstance() {
return new NodesInfoResponse();
}
}).txGet();
if (!ignoreClusterName && !clusterName.equals(nodeInfo.getClusterName())) {
... | public NodesInfoResponse newInstance() {
return new NodesInfoResponse();
}
}).txGet();
if (!ignoreClusterName && !clusterName.equals(nodeInfo.getClusterName())) {
... |
public final void glTexEnvfv (int target, int pname, float[] params, int offset) {
glTexEnvf(target, pname, params[offset]);
}
| public final void glTexEnvfv (int target, int pname, float[] params, int offset) {
GL11.glTexEnv(target, pname, toBuffer(params, offset));
}
|
public void writeSamples (float[] samples, int offset, int numSamples) {
if (bytes.length < samples.length * 2) bytes = new byte[samples.length * 2];
for (int i = offset, j = 0; i < offset + numSamples; i++, j += 2) {
float fValue = samples[i];
if (fValue > 1) fValue = 1;
if (fValue < -1) fValue = -1;
... | public void writeSamples (float[] samples, int offset, int numSamples) {
if (bytes.length < samples.length * 2) bytes = new byte[samples.length * 2];
for (int i = offset, j = 0; i < offset + numSamples; i++, j += 2) {
float fValue = samples[i];
if (fValue > 1) fValue = 1;
if (fValue < -1) fValue = -1;
... |
public void run() throws Exception {
long numberOfRounds = 0;
Random random = new Random(0);
long testStart = System.currentTimeMillis();
while (true) {
Node[] nodes = new Node[numberOfNodes];
for (int i = 0; i < nodes.length; i++) {
nodes[i] =... | public void run() throws Exception {
long numberOfRounds = 0;
Random random = new Random(0);
long testStart = System.currentTimeMillis();
while (true) {
Node[] nodes = new Node[numberOfNodes];
for (int i = 0; i < nodes.length; i++) {
nodes[i] =... |
public int getVersion() {
return Build.VERSION.SDK.charAt(0) - '0';
}
| public int getVersion() {
return Integer.parseInt(android.os.Build.VERSION.SDK);
}
|
public FSTBytesAtomicFieldData loadDirect(AtomicReaderContext context) throws Exception {
AtomicReader reader = context.reader();
Terms terms = reader.terms(getFieldNames().indexName());
FSTBytesAtomicFieldData data = null;
// TODO: Use an actual estimator to estimate before loading... | public FSTBytesAtomicFieldData loadDirect(AtomicReaderContext context) throws Exception {
AtomicReader reader = context.reader();
Terms terms = reader.terms(getFieldNames().indexName());
FSTBytesAtomicFieldData data = null;
// TODO: Use an actual estimator to estimate before loading... |
public AtomicGeoPointFieldData<ScriptDocValues> load(AtomicReaderContext context) {
try {
return new GeoPointBinaryDVAtomicFieldData(context.reader(), context.reader().getBinaryDocValues(fieldNames.indexName()));
} catch (IOException e) {
throw new ElasticsearchIllegalStateEx... | public AtomicGeoPointFieldData<ScriptDocValues> load(AtomicReaderContext context) {
try {
return new GeoPointBinaryDVAtomicFieldData(context.reader().getBinaryDocValues(fieldNames.indexName()));
} catch (IOException e) {
throw new ElasticsearchIllegalStateException("Cannot lo... |
protected Recycler<byte[]> newRecycler() {
return new NoneRecycler<byte[]>(RECYCLER_C);
}
| protected Recycler<byte[]> newRecycler() {
return Recyclers.none(RECYCLER_C);
}
|
protected Recycler<byte[]> newRecycler() {
return new QueueRecycler<byte[]>(RECYCLER_C, randomIntBetween(5, 10));
}
| protected Recycler<byte[]> newRecycler() {
return Recyclers.concurrentDeque(RECYCLER_C, randomIntBetween(5, 10));
}
|
protected Recycler<byte[]> newRecycler() {
return new SoftThreadLocalRecycler<byte[]>(RECYCLER_C, randomIntBetween(5, 10));
}
| protected Recycler<byte[]> newRecycler() {
return Recyclers.threadLocal(Recyclers.softFactory(Recyclers.dequeFactory(RECYCLER_C, 10)));
}
|
protected Recycler<byte[]> newRecycler() {
return new ThreadLocalRecycler<byte[]>(RECYCLER_C, randomIntBetween(5, 10));
}
| protected Recycler<byte[]> newRecycler() {
return Recyclers.threadLocal(Recyclers.dequeFactory(RECYCLER_C, 10));
}
|
public Environment(Settings settings) {
if (settings.get("path.home") != null) {
homeFile = new File(cleanPath(settings.get("path.home")));
} else {
homeFile = new File(".");
}
homeFile.mkdirs();
if (settings.get("path.conf") != null) {
co... | public Environment(Settings settings) {
if (settings.get("path.home") != null) {
homeFile = new File(cleanPath(settings.get("path.home")));
} else {
homeFile = new File(System.getProperty("user.dir"));
}
homeFile.mkdirs();
if (settings.get("path.conf"... |
public Filter searchFilter(String... types) {
if (types == null || types.length == 0) {
if (hasNested) {
return NonNestedDocsFilter.INSTANCE;
} else {
return null;
}
}
// if we filter by types, we don't need to filter by non... | public Filter searchFilter(String... types) {
if (types == null || types.length == 0) {
if (hasNested) {
return NonNestedDocsFilter.INSTANCE;
} else {
return null;
}
}
// if we filter by types, we don't need to filter by non... |
public boolean includeInAll(Boolean includeInAll, FieldMapper mapper) {
return includeInAll(includeInAll, mapper.indexed());
}
| public boolean includeInAll(Boolean includeInAll, FieldMapper mapper) {
return includeInAll(includeInAll, mapper.fieldType().indexed());
}
|
protected Field parseCreateField(ParseContext context) throws IOException {
if (!stored()) {
return null;
}
byte[] value;
if (context.parser().currentToken() == XContentParser.Token.VALUE_NULL) {
return null;
} else {
value = context.parser... | protected Field parseCreateField(ParseContext context) throws IOException {
if (!fieldType().stored()) {
return null;
}
byte[] value;
if (context.parser().currentToken() == XContentParser.Token.VALUE_NULL) {
return null;
} else {
value = co... |
protected Field parseCreateField(ParseContext context) throws IOException {
if (!indexed() && !stored()) {
return null;
}
XContentParser.Token token = context.parser().currentToken();
String value = null;
if (token == XContentParser.Token.VALUE_NULL) {
... | protected Field parseCreateField(ParseContext context) throws IOException {
if (!fieldType().indexed() && !fieldType().stored()) {
return null;
}
XContentParser.Token token = context.parser().currentToken();
String value = null;
if (token == XContentParser.Token.V... |
protected Field parseCreateField(ParseContext context) throws IOException {
String value = nullValue;
float boost = this.boost;
if (context.externalValueSet()) {
value = (String) context.externalValue();
} else {
XContentParser parser = context.parser();
... | protected Field parseCreateField(ParseContext context) throws IOException {
String value = nullValue;
float boost = this.boost;
if (context.externalValueSet()) {
value = (String) context.externalValue();
} else {
XContentParser parser = context.parser();
... |
protected Field parseCreateField(ParseContext context) throws IOException {
if (!enabled) {
return null;
}
if (!stored()) {
return null;
}
if (context.flyweight()) {
return null;
}
BytesReference source = context.source();
... | protected Field parseCreateField(ParseContext context) throws IOException {
if (!enabled) {
return null;
}
if (!fieldType.stored()) {
return null;
}
if (context.flyweight()) {
return null;
}
BytesReference source = context.s... |
public void execute(SearchContext context) {
FieldsVisitor fieldsVisitor;
List<String> extractFieldNames = null;
boolean sourceRequested = false;
if (!context.hasFieldNames()) {
if (context.hasPartialFields()) {
// partial fields need the source, so fetch ... | public void execute(SearchContext context) {
FieldsVisitor fieldsVisitor;
List<String> extractFieldNames = null;
boolean sourceRequested = false;
if (!context.hasFieldNames()) {
if (context.hasPartialFields()) {
// partial fields need the source, so fetch ... |
@Override protected void doXContent(XContentBuilder builder, ToXContent.Params params) throws IOException {
if (dateTimeFormatters != Defaults.DATE_TIME_FORMATTERS) {
if (dateTimeFormatters.length > 0) {
builder.startArray("date_formats");
for (FormatDateTimeForma... | @Override protected void doXContent(XContentBuilder builder, ToXContent.Params params) throws IOException {
if (dateTimeFormatters != Defaults.DATE_TIME_FORMATTERS) {
if (dateTimeFormatters.length > 0) {
builder.startArray("date_formats");
for (FormatDateTimeForma... |
public ClusterState execute(final ClusterState currentState) throws Exception {
List<String> indicesToClose = Lists.newArrayList();
try {
for (String index : request.indices()) {
if (!currentState.metaData().hasIndex(index)) {
... | public ClusterState execute(final ClusterState currentState) throws Exception {
List<String> indicesToClose = Lists.newArrayList();
try {
for (String index : request.indices()) {
if (!currentState.metaData().hasIndex(index)) {
... |
public ZenDiscovery(Settings settings, ClusterName clusterName, ThreadPool threadPool,
TransportService transportService, ClusterService clusterService, NodeSettingsService nodeSettingsService,
DiscoveryNodeService discoveryNodeService, ZenPingService pingService, Ele... | public ZenDiscovery(Settings settings, ClusterName clusterName, ThreadPool threadPool,
TransportService transportService, ClusterService clusterService, NodeSettingsService nodeSettingsService,
DiscoveryNodeService discoveryNodeService, ZenPingService pingService, Ele... |
public void testMaxSizeExceededOnNew() throws Exception {
final int size = scaledRandomIntBetween(5, 1 << 22);
for (String type : Arrays.asList("Byte", "Int", "Long", "Float", "Double", "Object")) {
HierarchyCircuitBreakerService hcbs = new HierarchyCircuitBreakerService(
... | public void testMaxSizeExceededOnNew() throws Exception {
final int size = scaledRandomIntBetween(5, 1 << 22);
for (String type : Arrays.asList("Byte", "Int", "Long", "Float", "Double", "Object")) {
HierarchyCircuitBreakerService hcbs = new HierarchyCircuitBreakerService(
... |
public static void main(String[] args) {
final String executor = ThreadPool.Names.GENERIC;
final boolean waitForRequest = true;
final ByteSizeValue payloadSize = new ByteSizeValue(100, ByteSizeUnit.BYTES);
final int NUMBER_OF_CLIENTS = 1;
final int NUMBER_OF_ITERATIONS = 1000... | public static void main(String[] args) {
final String executor = ThreadPool.Names.GENERIC;
final boolean waitForRequest = true;
final ByteSizeValue payloadSize = new ByteSizeValue(100, ByteSizeUnit.BYTES);
final int NUMBER_OF_CLIENTS = 10;
final int NUMBER_OF_ITERATIONS = 100... |
protected String executor() {
return ThreadPool.Names.SEARCH;
}
| protected String executor() {
return ThreadPool.Names.GET;
}
|
public static void main( String[] argv )
{
Mpg123Decoder decoder = new Mpg123Decoder( "data/threeofaperfectpair.mp3");
System.out.println( "rate: " + decoder.getRate() + ", channels: " + decoder.getNumChannels() + ", length: " + decoder.getLength() );
JoglAudioDevice device = new JoglAudioDevice( true );
S... | public static void main( String[] argv )
{
Mpg123Decoder decoder = new Mpg123Decoder( "data/threeofaperfectpair.mp3");
System.out.println( "rate: " + decoder.getRate() + ", channels: " + decoder.getNumChannels() + ", length: " + decoder.getLength() );
JoglAudioDevice device = new JoglAudioDevice( true );
S... |
public void setToOrtho (boolean yDown, float viewportWidth, float viewportHeight) {
if (yDown) {
up.set(0, -1, 0);
direction.set(0, 0, 1);
} else {
up.set(0, 1, 0);
direction.set(0, 0, 1);
}
position.set(zoom * viewportWidth / 2.0f, zoom * viewportHeight / 2.0f, 0);
this.viewportWidth = viewportW... | public void setToOrtho (boolean yDown, float viewportWidth, float viewportHeight) {
if (yDown) {
up.set(0, -1, 0);
direction.set(0, 0, 1);
} else {
up.set(0, 1, 0);
direction.set(0, 0, -1);
}
position.set(zoom * viewportWidth / 2.0f, zoom * viewportHeight / 2.0f, 0);
this.viewportWidth = viewport... |
public void circle (float x, float y, float radius) {
circle(x, y, radius, (int)(4 * (float)Math.sqrt(radius)));
}
| public void circle (float x, float y, float radius) {
circle(x, y, radius, (int)(6 * (float)Math.cbrt(radius)));
}
|
public boolean touchDown (int x, int y, int pointer) {
System.out.println("Not handled by TWL!");
return false;
}
| public boolean touchDown (int x, int y, int pointer) {
System.out.println("This touch made it through and was not handled by TWL.");
return false;
}
|
@Override public boolean paramAsBoolean(String key, boolean defaultValue) {
String sValue = param(key);
if (sValue == null) {
return defaultValue;
}
return sValue.equals("true") || sValue.equals("1");
}
| @Override public boolean paramAsBoolean(String key, boolean defaultValue) {
String sValue = param(key);
if (sValue == null) {
return defaultValue;
}
return sValue.equals("true") || sValue.equals("1") || sValue.equals("on");
}
|
protected void createIndex() {
cluster().wipeIndices(getConcreteIndexName());
createIndex(getConcreteIndexName());
}
| protected void createIndex() {
immutableCluster().wipeIndices(getConcreteIndexName());
createIndex(getConcreteIndexName());
}
|
public void percolateOnRecreatedIndex() throws Exception {
createIndex("test");
ensureGreen();
client().prepareIndex("test", "test", "1").setSource("field1", "value1").execute().actionGet();
logger.info("--> register a query");
client().prepareIndex("my-queries-index", Perco... | public void percolateOnRecreatedIndex() throws Exception {
createIndex("test");
ensureGreen();
client().prepareIndex("test", "test", "1").setSource("field1", "value1").execute().actionGet();
logger.info("--> register a query");
client().prepareIndex("my-queries-index", Perco... |
public void testDuelTerms() throws Exception {
// These high numbers of docs and terms are important to trigger page recycling
final int numDocs = scaledRandomIntBetween(10000, 20000);
final int maxNumTerms = randomIntBetween(10, 100000);
final IntOpenHashSet valuesSet = new IntOpen... | public void testDuelTerms() throws Exception {
// These high numbers of docs and terms are important to trigger page recycling
final int numDocs = scaledRandomIntBetween(10000, 20000);
final int maxNumTerms = randomIntBetween(10, 100000);
final IntOpenHashSet valuesSet = new IntOpen... |
private void searchWhileCreatingIndex(boolean createIndex, int numberOfReplicas) throws Exception {
// make sure we have enough nodes to guaranty default QUORUM consistency.
// TODO: add a smarter choice based on actual consistency (when that is randomized)
int shardsNo = numberOfReplicas +... | private void searchWhileCreatingIndex(boolean createIndex, int numberOfReplicas) throws Exception {
// make sure we have enough nodes to guaranty default QUORUM consistency.
// TODO: add a smarter choice based on actual consistency (when that is randomized)
int shardsNo = numberOfReplicas +... |
public void restoreIndexWithMissingShards() throws Exception {
logger.info("--> start 2 nodes");
cluster().startNode(settingsBuilder().put("gateway.type", "local"));
cluster().startNode(settingsBuilder().put("gateway.type", "local"));
cluster().wipeIndices("_all");
assertAck... | public void restoreIndexWithMissingShards() throws Exception {
logger.info("--> start 2 nodes");
cluster().startNode(settingsBuilder().put("gateway.type", "local"));
cluster().startNode(settingsBuilder().put("gateway.type", "local"));
immutableCluster().wipeIndices("_all");
... |
private <V> V read(File file) {
long start = System.currentTimeMillis();
long length = file.length();
V data = new RequestReader(file, FORMAT_VERSION).read();
if (data != null)
Log.d(TAG,
MessageFormat.format("Cache hit to {0}, {1} ms to load {2} bytes... | private <V> V read(File file) {
long start = System.currentTimeMillis();
long length = file.length();
V data = new RequestReader(file, FORMAT_VERSION).read();
if (data != null)
Log.d(TAG,
MessageFormat.format("Cache hit to {0}, {1} ms to load {2} bytes... |
public <V> V read() {
if (!handle.exists() || handle.length() == 0)
return null;
RandomAccessFile dir = null;
FileLock lock = null;
ObjectInputStream input = null;
boolean delete = false;
try {
dir = new RandomAccessFile(handle, "rw");
... | public <V> V read() {
if (!handle.exists() || handle.length() == 0)
return null;
RandomAccessFile dir = null;
FileLock lock = null;
ObjectInputStream input = null;
boolean delete = false;
try {
dir = new RandomAccessFile(handle, "rw");
... |
protected NodeInfo nodeOperation(NodeInfoRequest nodeRequest) throws ElasticSearchException {
NodesInfoRequest request = nodeRequest.request;
return nodeService.info(request.settings(), request.os(), request.process(), request.jvm(), request.threadPool(), request.network(), request.transport(), requ... | protected NodeInfo nodeOperation(NodeInfoRequest nodeRequest) throws ElasticSearchException {
NodesInfoRequest request = nodeRequest.request;
return nodeService.info(request.isSettings(), request.isOs(), request.isProcess(), request.isJvm(), request.isThreadPool(), request.isNetwork(), request.isTra... |
protected NodeStats nodeOperation(NodeStatsRequest nodeStatsRequest) throws ElasticSearchException {
NodesStatsRequest request = nodeStatsRequest.request;
return nodeService.stats(request.indices(), request.os(), request.process(), request.jvm(), request.threadPool(), request.network(), request.fs()... | protected NodeStats nodeOperation(NodeStatsRequest nodeStatsRequest) throws ElasticSearchException {
NodesStatsRequest request = nodeStatsRequest.request;
return nodeService.stats(request.isIndices(), request.isOs(), request.isProcess(), request.isJvm(), request.isThreadPool(), request.isNetwork(), ... |
public ClusterRerouteRequestBuilder setSource(BytesReference source) throws Exception {
request.source(source);
return this;
}
| public ClusterRerouteRequestBuilder setSource(BytesReference source) throws Exception {
request.setSource(source);
return this;
}
|
public IndicesAliasesRequestBuilder setTimeout(TimeValue timeout) {
request.timeout(timeout);
return this;
}
| public IndicesAliasesRequestBuilder setTimeout(TimeValue timeout) {
request.setTimeout(timeout);
return this;
}
|
public IndicesExistsRequestBuilder setIndices(String... indices) {
request.indices(indices);
return this;
}
| public IndicesExistsRequestBuilder setIndices(String... indices) {
request.setIndices(indices);
return this;
}
|
public RefreshRequestBuilder setWaitForOperations(boolean waitForOperations) {
request.waitForOperations(waitForOperations);
return this;
}
| public RefreshRequestBuilder setWaitForOperations(boolean waitForOperations) {
request.setWaitForOperations(waitForOperations);
return this;
}
|
private Map<DiscoveryNode, TransportNodesListShardStoreMetaData.StoreFilesMetaData> buildShardStores(DiscoveryNodes nodes, MutableShardRouting shard) {
Map<DiscoveryNode, TransportNodesListShardStoreMetaData.StoreFilesMetaData> shardStores = cachedStores.get(shard.shardId());
Set<String> nodesIds;
... | private Map<DiscoveryNode, TransportNodesListShardStoreMetaData.StoreFilesMetaData> buildShardStores(DiscoveryNodes nodes, MutableShardRouting shard) {
Map<DiscoveryNode, TransportNodesListShardStoreMetaData.StoreFilesMetaData> shardStores = cachedStores.get(shard.shardId());
Set<String> nodesIds;
... |
public ActionFuture<NodesLocalGatewayMetaState> list(Set<String> nodesIds, @Nullable TimeValue timeout) {
return execute(new Request(nodesIds).timeout(timeout));
}
| public ActionFuture<NodesLocalGatewayMetaState> list(Set<String> nodesIds, @Nullable TimeValue timeout) {
return execute(new Request(nodesIds).setTimeout(timeout));
}
|
public ActionFuture<NodesLocalGatewayStartedShards> list(ShardId shardId, Set<String> nodesIds, @Nullable TimeValue timeout) {
return execute(new Request(shardId, nodesIds).timeout(timeout));
}
| public ActionFuture<NodesLocalGatewayStartedShards> list(ShardId shardId, Set<String> nodesIds, @Nullable TimeValue timeout) {
return execute(new Request(shardId, nodesIds).setTimeout(timeout));
}
|
public void run() {
synchronized (mutex) {
boolean activeInactiveStatusChanges = false;
List<IndexShard> activeToInactiveIndexingShards = Lists.newArrayList();
List<IndexShard> inactiveToActiveIndexingShards = Lists.newArrayList();
for ... | public void run() {
synchronized (mutex) {
boolean activeInactiveStatusChanges = false;
List<IndexShard> activeToInactiveIndexingShards = Lists.newArrayList();
List<IndexShard> inactiveToActiveIndexingShards = Lists.newArrayList();
for ... |
public ActionFuture<NodesStoreFilesMetaData> list(ShardId shardId, boolean onlyUnallocated, Set<String> nodesIds, @Nullable TimeValue timeout) {
return execute(new Request(shardId, onlyUnallocated, nodesIds).timeout(timeout));
}
| public ActionFuture<NodesStoreFilesMetaData> list(ShardId shardId, boolean onlyUnallocated, Set<String> nodesIds, @Nullable TimeValue timeout) {
return execute(new Request(shardId, onlyUnallocated, nodesIds).setTimeout(timeout));
}
|
private void purgeShards(List<IndexShard> shardsToPurge) {
for (IndexShard shardToPurge : shardsToPurge) {
Query query = NumericRangeQuery.newLongRange(TTLFieldMapper.NAME, null, System.currentTimeMillis(), false, true);
Engine.Searcher searcher = shardToPurge.searcher();
... | private void purgeShards(List<IndexShard> shardsToPurge) {
for (IndexShard shardToPurge : shardsToPurge) {
Query query = NumericRangeQuery.newLongRange(TTLFieldMapper.NAME, null, System.currentTimeMillis(), false, true);
Engine.Searcher searcher = shardToPurge.searcher();
... |
public synchronized FsStats stats() {
if ((System.currentTimeMillis() - cachedStats.timestamp()) > refreshInterval.millis()) {
cachedStats = probe.stats();
}
return cachedStats;
}
| public synchronized FsStats stats() {
if ((System.currentTimeMillis() - cachedStats.getTimestamp()) > refreshInterval.millis()) {
cachedStats = probe.stats();
}
return cachedStats;
}
|
public InternalScrollSearchRequest(SearchScrollRequest request, long id) {
super(request);
this.id = id;
this.scroll = request.scroll();
}
| public InternalScrollSearchRequest(SearchScrollRequest request, long id) {
super(request);
this.id = id;
this.scroll = request.getScroll();
}
|
public static void main(String[] args) throws Exception {
Settings settings = settingsBuilder()
.put("cluster.routing.schedule", 200, TimeUnit.MILLISECONDS)
.put("gateway.type", "none")
.put(SETTING_NUMBER_OF_SHARDS, 2)
.put(SETTING_NUMBER_OF_R... | public static void main(String[] args) throws Exception {
Settings settings = settingsBuilder()
.put("cluster.routing.schedule", 200, TimeUnit.MILLISECONDS)
.put("gateway.type", "none")
.put(SETTING_NUMBER_OF_SHARDS, 2)
.put(SETTING_NUMBER_OF_R... |
public static void main(String[] args) throws Exception {
Settings settings = settingsBuilder()
.put("index.refresh_interval", "1s")
.put("index.merge.async", true)
.put("index.translog.flush_threshold_ops", 5000)
.put("gateway.type", "none")
... | public static void main(String[] args) throws Exception {
Settings settings = settingsBuilder()
.put("index.refresh_interval", "1s")
.put("index.merge.async", true)
.put("index.translog.flush_threshold_ops", 5000)
.put("gateway.type", "none")
... |
public ImmutableSet<ClusterBlock> waitForNoBlocks(TimeValue timeout, String node) throws InterruptedException {
long start = System.currentTimeMillis();
ImmutableSet<ClusterBlock> blocks;
do {
blocks = client(node).admin().cluster().prepareState().setLocal(true).execute().actionG... | public ImmutableSet<ClusterBlock> waitForNoBlocks(TimeValue timeout, String node) throws InterruptedException {
long start = System.currentTimeMillis();
ImmutableSet<ClusterBlock> blocks;
do {
blocks = client(node).admin().cluster().prepareState().setLocal(true).execute().actionG... |
public void testNoMasterActions() throws Exception {
Settings settings = settingsBuilder()
.put("discovery.type", "zen")
.put("action.auto_create_index", false)
.put("discovery.zen.minimum_master_nodes", 2)
.put("discovery.zen.ping_timeout", "2... | public void testNoMasterActions() throws Exception {
Settings settings = settingsBuilder()
.put("discovery.type", "zen")
.put("action.auto_create_index", false)
.put("discovery.zen.minimum_master_nodes", 2)
.put("discovery.zen.ping_timeout", "2... |
protected void createIndex() {
logger.info("Creating index [test1] with alias [test]");
try {
client1.admin().indices().prepareDelete("test1").execute().actionGet();
} catch (Exception e) {
// ignore
}
logger.info("--> creating index test");
cl... | protected void createIndex() {
logger.info("Creating index [test1] with alias [test]");
try {
client1.admin().indices().prepareDelete("test1").execute().actionGet();
} catch (Exception e) {
// ignore
}
logger.info("--> creating index test");
cl... |
public void searchWhileCreatingIndex() {
Node node = startNode("node1");
try {
node.client().admin().indices().prepareDelete("test").execute().actionGet();
} catch (Exception e) {
// ignore
}
for (int i = 0; i < 20; i++) {
node.client().a... | public void searchWhileCreatingIndex() {
Node node = startNode("node1");
try {
node.client().admin().indices().prepareDelete("test").execute().actionGet();
} catch (Exception e) {
// ignore
}
for (int i = 0; i < 20; i++) {
node.client().a... |
public void simpleTimeoutTest() throws Exception {
client.admin().indices().prepareDelete().execute().actionGet();
for (int i = 0; i < 10; i++) {
client.prepareIndex("test", "type", Integer.toString(i)).setSource("field", "value").execute().actionGet();
}
client.admin().... | public void simpleTimeoutTest() throws Exception {
client.admin().indices().prepareDelete().execute().actionGet();
for (int i = 0; i < 10; i++) {
client.prepareIndex("test", "type", Integer.toString(i)).setSource("field", "value").execute().actionGet();
}
client.admin().... |
public void run() {
ThreadLocalRandom random = ThreadLocalRandom.current();
while (!done.get()) {
String id = String.valueOf(idGenerator.incrementAndGet());
client.client().prepareIndex("test", "type1", id)
... | public void run() {
ThreadLocalRandom random = ThreadLocalRandom.current();
while (!done.get()) {
String id = String.valueOf(idGenerator.incrementAndGet());
client.client().prepareIndex("test", "type1", id)
... |
public static void main(String[] args) {
final int NUMBER_OF_NODES = 4;
final int NUMBER_OF_INDICES = 600;
final int BATCH = 300;
final Settings nodeSettings = ImmutableSettings.settingsBuilder().put("index.number_of_shards", 2).build();
Node[] nodes = new Node[NUMBER_OF_NO... | public static void main(String[] args) {
final int NUMBER_OF_NODES = 4;
final int NUMBER_OF_INDICES = 600;
final int BATCH = 300;
final Settings nodeSettings = ImmutableSettings.settingsBuilder().put("index.number_of_shards", 2).build();
Node[] nodes = new Node[NUMBER_OF_NO... |
public void run() {
for (int i = 0; i < 1000; i++) {
SearchResponse searchResponse = client.prepareSearch("test")
.setQuery(QueryBuilders.matchAllQuery())
.setSize(i % 100)
... | public void run() {
for (int i = 0; i < 1000; i++) {
SearchResponse searchResponse = client.prepareSearch("test")
.setQuery(QueryBuilders.matchAllQuery())
.setSize(i % 100)
... |
private FieldSelector buildFieldSelectors(SearchContext context) {
if (context.fieldNames() == null || context.fieldNames().length == 0) {
return new UidAndSourceFieldSelector();
}
FieldMappersFieldSelector fieldSelector = new FieldMappersFieldSelector();
for (String fie... | private FieldSelector buildFieldSelectors(SearchContext context) {
if (context.fieldNames() == null) {
return new UidAndSourceFieldSelector();
}
FieldMappersFieldSelector fieldSelector = new FieldMappersFieldSelector();
for (String fieldName : context.fieldNames()) {
... |
public void testFacetsAndAggregations() throws Exception {
client().admin().indices().prepareCreate("test").execute().actionGet();
ensureGreen();
int numQueries = atLeast(250);
int numUniqueQueries = between(1, numQueries / 2);
String[] values = new String[numUniqueQueries];... | public void testFacetsAndAggregations() throws Exception {
client().admin().indices().prepareCreate("test").execute().actionGet();
ensureGreen();
int numQueries = atLeast(250);
int numUniqueQueries = between(1, numQueries / 2);
String[] values = new String[numUniqueQueries];... |
protected void processFile (Entry inputFile) throws Exception {
inputFile.inputFile.delete();
}
};
deleteProcessor.setRecursive(false);
String scaledPackFileName = rootSettings.getScaledPackFileName(packFileName, i);
File packFile = new File(scaledPackFileName);
String prefix = pac... | protected void processFile (Entry inputFile) throws Exception {
inputFile.inputFile.delete();
}
};
deleteProcessor.setRecursive(false);
String scaledPackFileName = rootSettings.scaledPackFileName(packFileName, i);
File packFile = new File(scaledPackFileName);
String prefix = packFi... |
protected IOSApplication createApplication() {
IOSApplicationConfiguration config = new IOSApplicationConfiguration();
config.useAccelerometer = false;
return new IOSApplication(new BulletTestCollection(), config);
}
| protected IOSApplication createApplication() {
IOSApplicationConfiguration config = new IOSApplicationConfiguration();
config.useAccelerometer = false;
return new IOSApplication(new DownloadTest(), config);
}
|
public void message(String component, String message) {
logger.trace("{}: {}", component, message);
}
| public void message(String component, String message) {
logger.trace("{} {}: {}", Thread.currentThread().getName(), component, message);
}
|
public void testJustMasterNode() throws Exception {
logger.info("--> cleaning nodes");
logger.info("--> starting 1 master node non data");
cluster().startNode(settingsBuilder().put("node.data", false).put("gateway.type", "local").put("index.number_of_shards", 2).put("index.number_of_replica... | public void testJustMasterNode() throws Exception {
logger.info("--> cleaning nodes");
logger.info("--> starting 1 master node non data");
cluster().startNode(settingsBuilder().put("node.data", false).put("gateway.type", "local").put("index.number_of_shards", 2).put("index.number_of_replica... |
public void testThatLoadingTemplateFromFileWorks() throws Exception {
final int iters = atLeast(5);
Set<String> indices = new HashSet<String>();
for (int i = 0; i < iters; i++) {
String indexName = "foo" + randomRealisticUnicodeOfLengthBetween(0, 5);
if (indices.conta... | public void testThatLoadingTemplateFromFileWorks() throws Exception {
final int iters = atLeast(5);
Set<String> indices = new HashSet<String>();
for (int i = 0; i < iters; i++) {
String indexName = "foo" + randomRealisticUnicodeOfLengthBetween(0, 5);
if (indices.conta... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.