id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
40,501
Link pageTranslationLink = objectFactory.createLink(); pageTranslationLink.setHref(pageTranslationUri); pageTranslationLink.setRel(Relations.PAGE); translation.getLinks().add(pageTranslationLink); String historyUri = <BUG>UriBuilder.fromUri(baseUri).path(PageTranslationHistoryResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName(), language).toString(); Link historyLink = objectFactory.createLink();</BUG> historyLink.setHref(historyUri); historyLink.setRel(Relations.HISTORY);
uri(baseUri, PageTranslationHistoryResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), language); Link historyLink = objectFactory.createLink();
40,502
pageSummary.setParent(doc.getParent()); if (parent != null && !parent.isNew()) { pageSummary.setParentId(parent.getPrefixedFullName()); } else { pageSummary.setParentId(""); <BUG>} String spaceUri = UriBuilder.fromUri(baseUri).path(SpaceResource.class).build(doc.getWiki(), doc.getSpace()).toString();</BUG> Link spaceLink = objectFactory.createLink(); spaceLink.setHref(spaceUri);
String spaceUri = uri(baseUri, SpaceResource.class, doc.getWiki(), doc.getSpace());
40,503
UriBuilder.fromUri(baseUri).path(SpaceResource.class).build(doc.getWiki(), doc.getSpace()).toString();</BUG> Link spaceLink = objectFactory.createLink(); spaceLink.setHref(spaceUri); spaceLink.setRel(Relations.SPACE); pageSummary.getLinks().add(spaceLink); <BUG>if (parent != null) { String parentUri = UriBuilder.fromUri(baseUri).path(PageResource.class) .build(parent.getWiki(), parent.getSpace(), parent.getName()).toString();</BUG> Link parentLink = objectFactory.createLink();
pageSummary.setParent(doc.getParent()); if (parent != null && !parent.isNew()) { pageSummary.setParentId(parent.getPrefixedFullName()); } else { pageSummary.setParentId(""); } String spaceUri = uri(baseUri, SpaceResource.class, doc.getWiki(), doc.getSpace()); String parentUri = uri(baseUri, PageResource.class, parent.getWiki(), parent.getSpace(), parent.getName());
40,504
Link historyLink = objectFactory.createLink(); historyLink.setHref(historyUri); historyLink.setRel(Relations.HISTORY); pageSummary.getLinks().add(historyLink); if (!doc.getChildren().isEmpty()) { <BUG>String pageChildrenUri = UriBuilder.fromUri(baseUri).path(PageChildrenResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName()).toString();</BUG> Link pageChildrenLink = objectFactory.createLink(); pageChildrenLink.setHref(pageChildrenUri);
uri(baseUri, PageChildrenResource.class, doc.getWiki(), doc.getSpace(), doc.getName());
40,505
objectsLink.setRel(Relations.OBJECTS); pageSummary.getLinks().add(objectsLink); } com.xpn.xwiki.api.Object tagsObject = doc.getObject("XWiki.TagClass", 0); if (tagsObject != null) { <BUG>if (tagsObject.getProperty("tags") != null) { String tagsUri = UriBuilder.fromUri(baseUri).path(PageTagsResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName()).toString();</BUG> Link tagsLink = objectFactory.createLink();
String tagsUri = uri(baseUri, PageTagsResource.class, doc.getWiki(), doc.getSpace(), doc.getName());
40,506
tagsLink.setHref(tagsUri); tagsLink.setRel(Relations.TAGS); pageSummary.getLinks().add(tagsLink); } } <BUG>String syntaxesUri = UriBuilder.fromUri(baseUri).path(SyntaxesResource.class).build().toString(); Link syntaxesLink = objectFactory.createLink();</BUG> syntaxesLink.setHref(syntaxesUri); syntaxesLink.setRel(Relations.SYNTAXES); pageSummary.getLinks().add(syntaxesLink);
String syntaxesUri = uri(baseUri, SyntaxesResource.class); Link syntaxesLink = objectFactory.createLink();
40,507
} return historySummary; } private static void fillAttachment(Attachment attachment, ObjectFactory objectFactory, URI baseUri, <BUG>com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, Boolean withPrettyNames) {</BUG> Document doc = xwikiAttachment.getDocument(); attachment.setId(String.format("%s@%s", doc.getPrefixedFullName(), xwikiAttachment.getFilename()));
com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, {
40,508
Calendar calendar = Calendar.getInstance(); calendar.setTime(xwikiAttachment.getDate()); attachment.setDate(calendar); attachment.setXwikiRelativeUrl(xwikiRelativeUrl); attachment.setXwikiAbsoluteUrl(xwikiAbsoluteUrl); <BUG>String pageUri = UriBuilder.fromUri(baseUri).path(PageResource.class).build(doc.getWiki(), doc.getSpace(), doc.getName()) .toString();</BUG> Link pageLink = objectFactory.createLink();
String pageUri = uri(baseUri, PageResource.class, doc.getWiki(), doc.getSpace(), doc.getName());
40,509
} return attachmentUri; }</BUG> public static Attachment createAttachment(ObjectFactory objectFactory, URI baseUri, <BUG>com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, Boolean withPrettyNames) {</BUG> Attachment attachment = objectFactory.createAttachment(); fillAttachment(attachment, objectFactory, baseUri, xwikiAttachment, xwikiRelativeUrl, xwikiAbsoluteUrl,
com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, {
40,510
attachmentLink.setRel(Relations.ATTACHMENT_DATA); attachment.getLinks().add(attachmentLink); return attachment; } public static Attachment createAttachmentAtVersion(ObjectFactory objectFactory, URI baseUri, <BUG>com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, Boolean withPrettyNames) {</BUG> Attachment attachment = new Attachment();
com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, {
40,511
.build(doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(), xwikiObject.getNumber()).toString();</BUG> } else { <BUG>propertiesUri = UriBuilder .fromUri(baseUri) .path(ObjectPropertiesResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber()).toString();</BUG> }
fillObjectSummary(objectSummary, objectFactory, baseUri, doc, xwikiObject, xwikiApi, withPrettyNames); Link objectLink = getObjectLink(objectFactory, baseUri, doc, xwikiObject, useVersion, Relations.OBJECT); objectSummary.getLinks().add(objectLink); String propertiesUri; if (useVersion) { uri(baseUri, ObjectPropertiesAtPageVersionResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(), xwikiObject.getNumber()); uri(baseUri, ObjectPropertiesResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber());
40,512
.build(doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(), xwikiObject.getNumber(), propertyClass.getName()) .toString();</BUG> } else { <BUG>propertyUri = UriBuilder .fromUri(baseUri) .path(ObjectPropertyResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber(), propertyClass.getName()).toString();</BUG> }
propertiesUri = uri(baseUri, ObjectPropertiesResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber());
40,513
.build(doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(), xwikiObject.getNumber()).toString();</BUG> } else { <BUG>objectUri = UriBuilder .fromUri(baseUri) .path(ObjectResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber()).toString();</BUG> }
private static Link getObjectLink(ObjectFactory objectFactory, URI baseUri, Document doc, BaseObject xwikiObject, boolean useVersion, String relation) String objectUri; if (useVersion) { uri(baseUri, ObjectAtPageVersionResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(), xwikiObject.getNumber()); uri(baseUri, ObjectResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber());
40,514
Link propertyLink = objectFactory.createLink(); propertyLink.setHref(propertyUri); propertyLink.setRel(Relations.SELF); property.getLinks().add(propertyLink); clazz.getProperties().add(property); <BUG>} String classUri = UriBuilder.fromUri(baseUri).path(ClassResource.class).build(wikiName, xwikiClass.getName()).toString();</BUG> Link classLink = objectFactory.createLink(); classLink.setHref(classUri);
String classUri = uri(baseUri, ClassResource.class, wikiName, xwikiClass.getName());
40,515
String classUri = UriBuilder.fromUri(baseUri).path(ClassResource.class).build(wikiName, xwikiClass.getName()).toString();</BUG> Link classLink = objectFactory.createLink(); classLink.setHref(classUri); classLink.setRel(Relations.SELF); <BUG>clazz.getLinks().add(classLink); String propertiesUri = UriBuilder.fromUri(baseUri).path(ClassPropertiesResource.class).build(wikiName, xwikiClass.getName()) .toString();</BUG> Link propertyLink = objectFactory.createLink();
propertyLink.setHref(propertyUri); propertyLink.setRel(Relations.SELF); property.getLinks().add(propertyLink); clazz.getProperties().add(property); } String classUri = uri(baseUri, ClassResource.class, wikiName, xwikiClass.getName()); String propertiesUri = uri(baseUri, ClassPropertiesResource.class, wikiName, xwikiClass.getName());
40,516
<BUG>package org.xwiki.rest.internal; import org.apache.commons.lang3.StringUtils;</BUG> import org.xwiki.component.manager.ComponentManager; import org.xwiki.context.Execution; import org.xwiki.model.reference.EntityReferenceSerializer;
import java.net.URI; import javax.ws.rs.core.UriBuilder; import org.apache.commons.httpclient.URIException; import org.apache.commons.httpclient.util.URIUtil; import org.apache.commons.lang3.StringUtils;
40,517
import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; class Properties { private Map<String, String> properties = new HashMap<String, String>() { <BUG>{ put("duration limit", null);</BUG> put("player song limit", null); put("queue limit", null); put("ignore bind", null);
put("default game", null); put("duration limit", null);
40,518
import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Locale; <BUG>import java.util.Map; import java.util.Set;</BUG> public class Playlist implements Closeable { private static Properties properties = Properties.getInstance(); private static Playlist instance;
import java.util.Scanner; import java.util.Set;
40,519
interval = DateHistogram.Interval.DAY; break; } String dateHistogramKey = Utils.sanitizeFieldForAggregation(parameter.getField()); SearchResponse response = getConnection().getClient().prepareSearch( <BUG>ElasticsearchUtils.getIndices(parameter.getTable(), parameter)) .setTypes(ElasticsearchUtils.TYPE_NAME)</BUG> .setQuery(new ElasticSearchQueryGenerator(FilterCombinerType.and) .genFilter(parameter.getFilters())) .setSize(0)
.setIndicesOptions(Utils.indicesOptions()) .setTypes(ElasticsearchUtils.TYPE_NAME)
40,520
import com.flipkart.foxtrot.core.querystore.actions.spi.AnalyticsProvider; import com.flipkart.foxtrot.core.querystore.impl.ElasticsearchConnection; import com.flipkart.foxtrot.core.querystore.impl.ElasticsearchUtils; import com.flipkart.foxtrot.core.querystore.query.ElasticSearchQueryGenerator; import com.google.common.collect.Lists; <BUG>import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchType; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.sort.SortOrder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Collections; import java.util.Vector;</BUG> @AnalyticsProvider(opcode = "query", request = Query.class, response = QueryResponse.class, cacheable = false)
[DELETED]
40,521
throw new QueryStoreException(QueryStoreException.ErrorCode.INVALID_REQUEST, "Invalid field name"); } try { AbstractAggregationBuilder aggregation = buildAggregation(parameter); SearchResponse response = getConnection().getClient().prepareSearch( <BUG>ElasticsearchUtils.getIndices(parameter.getTable(), parameter)) .setTypes(ElasticsearchUtils.TYPE_NAME)</BUG> .setQuery(new ElasticSearchQueryGenerator(parameter.getCombiner()).genFilter(parameter.getFilters())) .setSize(0) .setSearchType(SearchType.COUNT)
.setIndicesOptions(Utils.indicesOptions()) .setTypes(ElasticsearchUtils.TYPE_NAME)
40,522
parameter.getFilters().add(filter); } try { AbstractAggregationBuilder aggregationBuilder = buildAggregation(parameter); SearchResponse searchResponse = getConnection().getClient() <BUG>.prepareSearch(ElasticsearchUtils.getIndices(parameter.getTable(), parameter)) .setQuery(new ElasticSearchQueryGenerator(FilterCombinerType.and).genFilter(parameter.getFilters()))</BUG> .setSearchType(SearchType.COUNT) .addAggregation(aggregationBuilder) .execute()
.setIndicesOptions(Utils.indicesOptions()) .setQuery(new ElasticSearchQueryGenerator(FilterCombinerType.and).genFilter(parameter.getFilters()))
40,523
parameter.getFilters().add(new ExistsFilter(parameter.getField())); } try { if (parameter.isDistinct()){ SearchRequestBuilder query = getConnection().getClient() <BUG>.prepareSearch(ElasticsearchUtils.getIndices(parameter.getTable(), parameter)) .setSearchType(SearchType.COUNT)</BUG> .setQuery(new ElasticSearchQueryGenerator(FilterCombinerType.and) .genFilter(parameter.getFilters())) .addAggregation(AggregationBuilders
.setIndicesOptions(Utils.indicesOptions()) .setSearchType(SearchType.COUNT)
40,524
if (null == request.getTable()) { throw new QueryStoreException(QueryStoreException.ErrorCode.INVALID_REQUEST, "Invalid Table"); } try { SearchResponse response = getConnection().getClient().prepareSearch( <BUG>ElasticsearchUtils.getIndices(request.getTable(), request)) .setTypes(ElasticsearchUtils.TYPE_NAME)</BUG> .setQuery(new ElasticSearchQueryGenerator(request.getCombiner()).genFilter(request.getFilters())) .setSize(0) .setSearchType(SearchType.COUNT)
.setIndicesOptions(Utils.indicesOptions()) .setTypes(ElasticsearchUtils.TYPE_NAME)
40,525
customTokens.put("%%mlFinalForestsPerHost%%", hubConfig.finalForestsPerHost.toString()); customTokens.put("%%mlTraceAppserverName%%", hubConfig.traceHttpName); customTokens.put("%%mlTracePort%%", hubConfig.tracePort.toString()); customTokens.put("%%mlTraceDbName%%", hubConfig.traceDbName); customTokens.put("%%mlTraceForestsPerHost%%", hubConfig.traceForestsPerHost.toString()); <BUG>customTokens.put("%%mlModulesDbName%%", hubConfig.modulesDbName); }</BUG> public void init() { try { LOGGER.error("PLUGINS DIR: " + pluginsDir.toString());
customTokens.put("%%mlTriggersDbName%%", hubConfig.triggersDbName); customTokens.put("%%mlSchemasDbName%%", hubConfig.schemasDbName); }
40,526
import java.util.Locale; import java.util.Map; import java.util.TreeMap; public class DependencyConvergenceReport extends AbstractProjectInfoReport <BUG>{ private List reactorProjects; private static final int PERCENTAGE = 100;</BUG> public String getOutputName() {
private static final int PERCENTAGE = 100; private static final List SUPPORTED_FONT_FAMILY_NAMES = Arrays.asList( GraphicsEnvironment .getLocalGraphicsEnvironment().getAvailableFontFamilyNames() );
40,527
sink.section1(); sink.sectionTitle1(); sink.text( getI18nString( locale, "title" ) ); sink.sectionTitle1_(); Map dependencyMap = getDependencyMap(); <BUG>generateLegend( locale, sink ); generateStats( locale, sink, dependencyMap ); generateConvergence( locale, sink, dependencyMap ); sink.section1_();</BUG> sink.body_();
sink.lineBreak(); sink.section1_();
40,528
Iterator it = artifactMap.keySet().iterator(); while ( it.hasNext() ) { String version = (String) it.next(); sink.tableRow(); <BUG>sink.tableCell(); sink.text( version );</BUG> sink.tableCell_(); sink.tableCell(); generateVersionDetails( sink, artifactMap, version );
sink.tableCell( String.valueOf( cellWidth ) + "px" ); sink.text( version );
40,529
sink.tableCell(); sink.text( getI18nString( locale, "legend.shared" ) ); sink.tableCell_(); sink.tableRow_(); sink.tableRow(); <BUG>sink.tableCell(); iconError( sink );</BUG> sink.tableCell_(); sink.tableCell(); sink.text( getI18nString( locale, "legend.different" ) );
sink.tableCell( "15px" ); // according /images/icon_error_sml.gif iconError( sink );
40,530
sink.tableCaption(); sink.text( getI18nString( locale, "stats.caption" ) ); sink.tableCaption_();</BUG> sink.tableRow(); <BUG>sink.tableHeaderCell(); sink.text( getI18nString( locale, "stats.subprojects" ) + ":" ); sink.tableHeaderCell_();</BUG> sink.tableCell(); sink.text( String.valueOf( reactorProjects.size() ) ); sink.tableCell_();
sink.bold(); sink.bold_(); sink.tableCaption_(); sink.tableHeaderCell( headerCellWidth ); sink.text( getI18nString( locale, "stats.subprojects" ) ); sink.tableHeaderCell_();
40,531
sink.tableCell(); sink.text( String.valueOf( reactorProjects.size() ) ); sink.tableCell_(); sink.tableRow_(); sink.tableRow(); <BUG>sink.tableHeaderCell(); sink.text( getI18nString( locale, "stats.dependencies" ) + ":" ); sink.tableHeaderCell_();</BUG> sink.tableCell(); sink.text( String.valueOf( depCount ) );
sink.tableHeaderCell( headerCellWidth ); sink.text( getI18nString( locale, "stats.dependencies" ) ); sink.tableHeaderCell_();
40,532
sink.text( String.valueOf( convergence ) + "%" ); sink.bold_(); sink.tableCell_(); sink.tableRow_(); sink.tableRow(); <BUG>sink.tableHeaderCell(); sink.text( getI18nString( locale, "stats.readyrelease" ) + ":" ); sink.tableHeaderCell_();</BUG> sink.tableCell(); if ( convergence >= PERCENTAGE && snapshotCount <= 0 )
sink.tableHeaderCell( headerCellWidth ); sink.text( getI18nString( locale, "stats.readyrelease" ) ); sink.tableHeaderCell_();
40,533
{ ReverseDependencyLink p1 = (ReverseDependencyLink) o1; ReverseDependencyLink p2 = (ReverseDependencyLink) o2; return p1.getProject().getId().compareTo( p2.getProject().getId() ); } <BUG>else {</BUG> return 0; } }
iconError( sink );
40,534
public static boolean debugMode = false; @ModConfigProperty(category = "Debug", name = "debugModeGOTG", comment = "Enable/Disable Debug Mode for the Gift Of The Gods") public static boolean debugModeGOTG = false; @ModConfigProperty(category = "Debug", name = "debugModeEnchantments", comment = "Enable/Disable Debug Mode for the Enchantments") public static boolean debugModeEnchantments = false; <BUG>@ModConfigProperty(category = "Weapons", name = "enableSwordsRecipes", comment = "Enable/Disable The ArmorPlus Sword's Recipes") public static boolean enableSwordsRecipes = true; @ModConfigProperty(category = "Weapons", name = "enableBattleAxesRecipes", comment = "Enable/Disable The ArmorPlus Battle Axes's Recipes") public static boolean enableBattleAxesRecipes = true; @ModConfigProperty(category = "Weapons", name = "enableBowsRecipes", comment = "Enable/Disable The ArmorPlus Bows's Recipes") public static boolean enableBowsRecipes = true; @ModConfigProperty(category = "Armors.SuperStarArmor.Effects", name = "enableSuperStarHRegen", comment = "Enable/Disable The Super Star Helmet Regeneration") </BUG> public static boolean enableSuperStarHRegen = true;
@ModConfigProperty(category = "Weapons", name = "enableSwordsRecipes", comment = "Enable/Disable ArmorPlus Sword's Recipes") @ModConfigProperty(category = "Weapons", name = "enableBattleAxesRecipes", comment = "Enable/Disable ArmorPlus Battle Axes's Recipes") @ModConfigProperty(category = "Weapons", name = "enableBowsRecipes", comment = "Enable/Disable ArmorPlus Bows's Recipes")
40,535
void fixjump(int pc, int dest) { InstructionPtr jmp = new InstructionPtr(this.f.code, pc); int offset = dest - (pc + 1); _assert(dest != LexState.NO_JUMP); if (Math.abs(offset) > MAXARG_sBx) { <BUG>ls.syntaxerror("control structure too long"); </BUG> } SETARG_sBx(jmp, offset); }
throw ls.syntaxerror("control structure too long");
40,536
public class FileResourceManipulator implements ResourceManipulator { @Override public InputStream findResource(String filename) { File f = new File(filename); if (!f.exists()) { <BUG>Class c = getClass(); </BUG> return c.getResourceAsStream(filename.startsWith("/") ? filename : "/" + filename); } try {
Class<?> c = getClass();
40,537
return new String(buff, 0, nbuff); default: return token2str(token); } } <BUG>void lexerror(String msg, int token) { </BUG> String cid = chunkid(source.toString()); // TODO: get source name from source L.pushfstring(cid + ":" + linenumber + ": " + msg); if (token != 0) {
LuaError lexerror(String msg, int token) {
40,538
String cid = chunkid(source.toString()); // TODO: get source name from source L.pushfstring(cid + ":" + linenumber + ": " + msg); if (token != 0) { L.pushfstring("syntax error: " + msg + " near " + txtToken(token)); } <BUG>throw new LuaError(cid + ":" + linenumber + ": " + msg); </BUG> } String chunkid(String source) { if (source.startsWith("=")) {
return new LuaError(cid + ":" + linenumber + ": " + msg);
40,539
if (n > MAXSRC) { source = source.substring(0, MAXSRC - end.length() - 3) + "..."; } return source + end; } <BUG>void syntaxerror(String msg) { lexerror(msg, t.token); </BUG> }
LuaError syntaxerror(String msg) { return lexerror(msg, t.token);
40,540
int old = current; LuaC._assert(currIsNewline()); if (currIsNewline() && current != old) { } if (++linenumber >= MAX_INT) { <BUG>syntaxerror("chunk has too many lines"); </BUG> } } void setinput(LuaC L, int firstByte, InputStream z, LuaString source) {
throw syntaxerror("chunk has too many lines");
40,541
if (currIsNewline()) /* string starts with a newline? */ { } for (boolean endloop = false; !endloop; ) { switch (current) { case EOZ: <BUG>lexerror((seminfo != null) ? "unfinished long string" : "unfinished long comment", TK_EOS); case '[': {</BUG> if (skip_sep() == sep) {
String msg = (seminfo != null) ? "unfinished long string" : "unfinished long comment"; throw lexerror(msg, TK_EOS); case '[': {
40,542
do { c = 10 * c + (current - '0'); nextChar(); } while (++i < 3 && isdigit(current)); if (c > UCHAR_MAX) { <BUG>lexerror("escape sequence too large", TK_STRING); </BUG> } save(c); }
throw lexerror("escape sequence too large", TK_STRING);
40,543
read_long_string(seminfo, sep); return TK_STRING; } else if (sep == -1) { return '['; } else { <BUG>lexerror("invalid long string delimiter", TK_STRING); </BUG> } } case '=': {
throw lexerror("invalid long string delimiter", TK_STRING);
40,544
check(c); next(); } void check_condition(boolean c, String msg) { if (!(c)) { <BUG>syntaxerror(msg); </BUG> } } void check_match(int what, int who, int where) {
throw syntaxerror(msg);
40,545
void check_match(int what, int who, int where) { if (!testnext(what)) { if (where == linenumber) { error_expected(what); } else { <BUG>syntaxerror(L.pushfstring(LUA_QS(token2str(what)) </BUG> + " expected " + "(to close " + LUA_QS(token2str(who)) + " at line " + where + ")")); }
throw syntaxerror(L.pushfstring(LUA_QS(token2str(what))
40,546
expdesc args = new expdesc(); int base, nparams; int line = this.linenumber; switch (this.t.token) { if (line != this.lastline) { <BUG>this.syntaxerror("ambiguous syntax (function call x new statement)"); </BUG> } this.next(); if (this.t.token == ')') /* arg list is empty? */ {
throw syntaxerror("ambiguous syntax (function call x new statement)");
40,547
case TK_NAME: { this.singlevar(v); return; } default: { <BUG>this.syntaxerror("unexpected symbol"); </BUG> } } }
throw syntaxerror("unexpected symbol");
40,548
while (bl != null && !bl.isbreakable) { upval |= bl.upval; bl = bl.previous; } if (bl == null) { <BUG>this.syntaxerror("no loop to break"); </BUG> } if (upval) { fs.codeABC(Lua.OP_CLOSE, bl.nactvar, 0, 0);
throw syntaxerror("no loop to break");
40,549
case ',': case TK_IN: this.forlist(varname); break; default: <BUG>this.syntaxerror(LUA_QL("=") + " or " + LUA_QL("in") + " expected"); </BUG> } this.check_match(TK_END, TK_FOR, line); }
throw syntaxerror(LUA_QL("=") + " or " + LUA_QL("in") + " expected");
40,550
private final I18n i18n; private Filter filter; ApplicationElement(TodoItemRepository repository, I18n i18n) { this.repository = repository; this.i18n = i18n; <BUG>Elements.Builder builder = new Elements.Builder() .section().css("todoapp")</BUG> .header().css("header") .h(1).innerText(i18n.constants().todos()).end() .input(text)
TodoBuilder builder = new TodoBuilder() .section().css("todoapp")
40,551
import static org.junit.Assert.assertNotNull; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; public class ElementsBuilderTest { <BUG>private Elements.Builder builder; </BUG> @Before public void setUp() { Document document = mock(Document.class);
private TestableBuilder builder;
40,552
when(document.createParagraphElement()).thenAnswer(invocation -> new StandaloneElement("p")); when(document.createSelectElement()).thenAnswer(invocation -> new StandaloneInputElement("select")); when(document.createSpanElement()).thenAnswer(invocation -> new StandaloneElement("span")); when(document.createTextAreaElement()).thenAnswer(invocation -> new StandaloneInputElement("textarea")); when(document.createUListElement()).thenAnswer(invocation -> new StandaloneElement("ul")); <BUG>builder = new Elements.Builder(document); </BUG> } @Test public void headings() {
builder = new TestableBuilder(document);
40,553
TodoItemRepository repository = new TodoItemRepository(BEAN_FACTORY); ApplicationElement application = new ApplicationElement(repository, i18n); Element body = Browser.getDocument().getBody(); body.appendChild(application.asElement()); body.appendChild(new FooterElement(i18n).asElement()); <BUG>Element e = new MyBuilder().ahref( "http://www.google.com" ) .img( "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" ).end() .end().build(); body.appendChild( e );</BUG> History.addValueChangeHandler(event -> application.filter(event.getValue()));
[DELETED]
40,554
@Override public String toString() { return (container ? "container" : "simple") + " @ " + level + ": " + element.getTagName(); } } <BUG>public static class Builder extends CoreBuilder<Builder> { public Builder() { super(Browser.getDocument()); } protected Builder(Document document) { super( document );</BUG> }
[DELETED]
40,555
return start(document.createElement(tag)); } public B start(Element element) { elements.push(new ElementInfo(element, true, level)); level++; <BUG>return (B) this; }</BUG> public B end() { assertCurrent(); if (level == 0) {
return that();
40,556
Element closingElement = elements.peek().element; for (ElementInfo child : children) { closingElement.appendChild(child.element); } level--; <BUG>return (B) this; }</BUG> private String dumpElements() { return elements.toString(); }
return that();
40,557
} public B on(EventType type, EventListener listener) { assertCurrent(); Element element = elements.peek().element; type.register(element, listener); <BUG>return (B) this; }</BUG> public B rememberAs(String id) { assertCurrent(); references.put(id, elements.peek().element);
public B attr(String name, String value) { elements.peek().element.setAttribute(name, value); return that();
40,558
double lambda_max; @API(help = "regularization strength", filter = Default.class, json=true) public double [] lambda = new double[]{1e-5}; @API(help = "beta_eps", filter = Default.class, json=true) double beta_epsilon = DEFAULT_BETA_EPS; <BUG>private double ADMM_GRAD_EPS = 1e-2; @API(help="use line search (slower speed, possibly greater accuracy)",filter=Default.class)</BUG> boolean higher_accuracy; int _lambdaIdx = 0; private transient double _addedL2;
private static final double MIN_ADMM_GRAD_EPS = 1e-8; @API(help="use line search (slower speed, possibly greater accuracy)",filter=Default.class)
40,559
double step = 0.5; for(int i = 0; i < glmt._objvals.length; ++i){ if(!needLineSearch(glmt._betas[i],glmt._objvals[i],step)){ Log.info("GLM line search: found admissible step=" + step); if(step < 1e-2) // too small a step, increase precision of the solver <BUG>ADMM_GRAD_EPS = 1e-8; _lastResult = null; // set last result to null so that the Iteration will not attempt to verify whether or not it should do the line search.</BUG> new GLMIterationTask(GLM2.this,_dinfo,_glm,true,true,true,glmt._betas[i],_ymu,_reg,new Iteration()).asyncExec(_dinfo._adaptedFrame); return; }
ADMM_GRAD_EPS = MIN_ADMM_GRAD_EPS; _lastResult = null; // set last result to null so that the Iteration will not attempt to verify whether or not it should do the line search.
40,560
new GLMIterationTask(GLM2.this,_dinfo,_glm,true,true,true,glmt._betas[i],_ymu,_reg,new Iteration()).asyncExec(_dinfo._adaptedFrame); return; } step *= 0.5; } // no line step works, forcibly converge <BUG>if(ADMM_GRAD_EPS > 1e-8) { ADMM_GRAD_EPS = 1e-8; new GLMIterationTask(GLM2.this,_dinfo,_glm,true,true,true,_lastResult._glmt._beta,_ymu,_reg,new Iteration()).asyncExec(_dinfo._adaptedFrame);</BUG> } Log.info("GLM: line search failed to find feasible step. Forcibly converged.");
if(ADMM_GRAD_EPS > MIN_ADMM_GRAD_EPS) { ADMM_GRAD_EPS = MIN_ADMM_GRAD_EPS; new GLMIterationTask(GLM2.this,_dinfo,_glm,true,true,true,_lastResult._glmt._beta,_ymu,_reg,new Iteration()).asyncExec(_dinfo._adaptedFrame);
40,561
@Override public boolean onExceptionalCompletion(Throwable ex, CountedCompleter caller){ GLM2.this.cancel(ex); return true; } } <BUG>public void nextLambda(final GLMIterationTask glmt){ System.out.println("computing validation at t = " + (System.currentTimeMillis() - start)); H2OCallback fin = new H2OCallback<GLMValidationTask>() { @Override public void callback(GLMValidationTask tsk) { System.out.println("validation computed at t = " + (System.currentTimeMillis() - start)); boolean improved = _model.setAndTestValidation(_lambdaIdx,tsk._res); </BUG> _model.clone().update(self());
protected void nextLambda(final GLMIterationTask glmt, GLMValidation val){ boolean improved = _model.setAndTestValidation(_lambdaIdx,val);
40,562
import org.bukkit.entity.Player; import org.bukkit.help.HelpTopic; import org.bukkit.util.ChatPaginator; import java.util.UUID; public final class DragonTravelCommands { <BUG>public byte __SECTION_GENERAL__; public byte __SECTION_FLYING__; public byte __SECTION_EDITING__;</BUG> @Console @Command(aliases = {"help", "?", "h"},
[DELETED]
40,563
package eu.phiwa.dragontravel.core.hooks.payment; import org.bukkit.ChatColor; import org.bukkit.entity.Player; public class FreePaymentHandler implements PaymentHandler { <BUG>public FreePaymentHandler() { }</BUG> @Override public boolean setup() { return true;
[DELETED]
40,564
sender.sendMessage("Available flights: "); int i = 0; for (String string : flightSection.getKeys(false)) { Flight flight = getFlight(string); if (flight != null) { <BUG>sender.sendMessage(" - " + (sender instanceof Player ? (PermissionsHandler.hasFlightPermission((Player) sender, flight.getName()) ? ChatColor.GREEN : ChatColor.RED) : ChatColor.AQUA) + flight.getName()); i++;</BUG> } } sender.sendMessage(String.format("(total %d)", i));
sender.sendMessage(" - " + (sender instanceof Player ? (PermissionsHandler.hasFlightPermission(sender, flight.getName()) ? ChatColor.GREEN : ChatColor.RED) : ChatColor.AQUA) + flight.getName()); i++;
40,565
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import java.util.Map; public class ResourcesPaymentHandler implements PaymentHandler { <BUG>public ResourcesPaymentHandler() { }</BUG> @Override public boolean setup() { return DragonTravel.getInstance().getConfigHandler().isByResources();
[DELETED]
40,566
riderDragons.put(player, ryeDragon); if (asNew) riderStartPoints.put(player, player.getLocation()); return true; } <BUG>public String removeDragons() { String output = "Removing riderless dragons from all worlds:"; for (org.bukkit.World world : Bukkit.getWorlds()) output += "\n - " + removeDragons(world, false); return output; }</BUG> public String removeDragons(org.bukkit.World world, boolean includeStationaryDragons) {
[DELETED]
40,567
private HashMap<Block, Block> wayPointMarkers = new HashMap<>(); public void addEditor(Player player, String flightName, String displayName) { if (!editors.containsKey(player)) editors.put(player, new Flight(flightName, displayName)); } <BUG>public boolean isEditor(Player player) { return editors.containsKey(player); }</BUG> public boolean removeEditor(Player player) { return editors.remove(player) != null;
[DELETED]
40,568
}</BUG> public boolean removeEditor(Player player) { return editors.remove(player) != null; } @EventHandler <BUG>public void onWP(PlayerInteractEvent event) { </BUG> Player player = event.getPlayer(); Location loc = player.getLocation(); if (!editors.containsKey(player))
private HashMap<Block, Block> wayPointMarkers = new HashMap<>(); public void addEditor(Player player, String flightName, String displayName) { editors.put(player, new Flight(flightName, displayName)); public void onWayPointSelect(PlayerInteractEvent event) {
40,569
import org.bukkit.entity.Player; import org.bukkit.plugin.RegisteredServiceProvider; import java.util.logging.Level; public class EconomyPaymentHandler implements PaymentHandler { private Economy economyProvider; <BUG>public EconomyPaymentHandler() { }</BUG> @Override public boolean setup() { if (!DragonTravel.getInstance().getConfigHandler().isByEconomy()) {
[DELETED]
40,570
this.worldName = (String) data.get("world"); this.displayName = (String) data.get("displayname"); if (data.containsKey("owner")) { this.owner = (String) data.get("owner"); } else { <BUG>this.owner = new String("admin"); }</BUG> this.dragon = createDragon(false); } public IRyeDragon createDragon(boolean isNew) {
this.owner = "admin";
40,571
cmdRegister.register(DragonTravelCommands.DragonTravelParentCommand.class); } @Override public void onDisable() { dbStatDragonsHandler.unloadStationaryDragons(); <BUG>Bukkit.getLogger().log(Level.INFO, String.format("[DragonTravel] -----------------------------------------------")); Bukkit.getLogger().log(Level.INFO, String.format("[DragonTravel] Successfully disabled %s %s", getDescription().getName(), getDescription().getVersion())); Bukkit.getLogger().log(Level.INFO, String.format("[DragonTravel] -----------------------------------------------")); }</BUG> @Override
Bukkit.getLogger().log(Level.INFO, "[DragonTravel] -----------------------------------------------"); Bukkit.getLogger().log(Level.INFO, "[DragonTravel] -----------------------------------------------");
40,572
if (Bukkit.getPluginManager().getPlugin("Heroes") != null) { Bukkit.getPluginManager().registerEvents(new HeroesListener(), this); } } private void setupFileHandlers() { <BUG>if (!(new File(getDataFolder(), "databases").exists())) new File(getDataFolder(), "databases").mkdirs(); configHandler = new Config();</BUG> if (configHandler.getConfig().getString("File.Version") == null) {
if (!(new File(getDataFolder(), "databases").exists())) { configHandler = new Config();
40,573
dbFlightsHandler = new FlightsDB(); dbStatDragonsHandler = new StatDragonsDB(); } private void setupMetrics() { try { <BUG>Metrics metrics = new Metrics(DragonTravel.getInstance()); Metrics.Graph dragonsFlyingGraph = metrics.createGraph("Number of dragons flying");</BUG> dragonsFlyingGraph.addPlotter(new Metrics.Plotter("Flight") { @Override public int getValue() {
Metrics metrics = new Metrics(this); Metrics.Graph dragonsFlyingGraph = metrics.createGraph("Number of dragons flying");
40,574
void flight(); void setMoveFlight(); void startFlight(Flight flight); void travel(); void setMoveTravel(); <BUG>void startTravel(Location destLoc, boolean interworld); </BUG> DragonType getDragonType(); Entity getEntity(); String getCustomName();
void startTravel(Location destLoc, boolean interWorld);
40,575
if (cmd.aliases().length > 0) { sb.append("\n"); sb.append(ChatColor.GOLD); sb.append("Aliases: "); sb.append(ChatColor.WHITE); <BUG>sb.append(ChatColor.WHITE + StringUtils.join(cmd.aliases(), ", ")); </BUG> } sb.append("\n"); sb.append(cmd.help());
sb.append(ChatColor.WHITE).append(StringUtils.join(cmd.aliases(), ", "));
40,576
sender.sendMessage("Available stations: "); int i = 0; for (String string : dbStationsConfig.getConfigurationSection("Stations").getKeys(false)) { Station station = getStation(string); if (station != null) { <BUG>sender.sendMessage(ChatColor.translateAlternateColorCodes('&', " - " + (sender instanceof Player ? (PermissionsHandler.hasTravelPermission((Player) sender, "travel", station.getDisplayName()) ? ChatColor.GREEN : ChatColor.RED) : ChatColor.AQUA) + station.getDisplayName())); i++;</BUG> } } sender.sendMessage(String.format("(total %d)", i));
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', " - " + (sender instanceof Player ? (PermissionsHandler.hasTravelPermission(sender, "travel", station.getDisplayName()) ? ChatColor.GREEN : ChatColor.RED) : ChatColor.AQUA) + station.getDisplayName())); i++;
40,577
import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.LocalFileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.util.Progressable; <BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*; public class S3AFileSystem extends FileSystem {</BUG> private URI uri; private Path workingDir; private AmazonS3Client s3;
import static org.apache.hadoop.fs.s3a.Constants.*; public class S3AFileSystem extends FileSystem {
40,578
public void initialize(URI name, Configuration conf) throws IOException { super.initialize(name, conf); uri = URI.create(name.getScheme() + "://" + name.getAuthority()); workingDir = new Path("/user", System.getProperty("user.name")).makeQualified(this.uri, this.getWorkingDirectory()); <BUG>String accessKey = conf.get(ACCESS_KEY, null); String secretKey = conf.get(SECRET_KEY, null); </BUG> String userInfo = name.getUserInfo();
String accessKey = conf.get(NEW_ACCESS_KEY, conf.get(OLD_ACCESS_KEY, null)); String secretKey = conf.get(NEW_SECRET_KEY, conf.get(OLD_SECRET_KEY, null));
40,579
} else { accessKey = userInfo; } } AWSCredentialsProviderChain credentials = new AWSCredentialsProviderChain( <BUG>new S3ABasicAWSCredentialsProvider(accessKey, secretKey), new InstanceProfileCredentialsProvider(), new S3AAnonymousAWSCredentialsProvider() );</BUG> bucket = name.getHost();
new BasicAWSCredentialsProvider(accessKey, secretKey), new AnonymousAWSCredentialsProvider()
40,580
awsConf.setSocketTimeout(conf.getInt(SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT)); </BUG> s3 = new AmazonS3Client(credentials, awsConf); <BUG>maxKeys = conf.getInt(MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS); partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD); </BUG> if (partSize < 5 * 1024 * 1024) {
new InstanceProfileCredentialsProvider(), new AnonymousAWSCredentialsProvider() bucket = name.getHost(); ClientConfiguration awsConf = new ClientConfiguration(); awsConf.setMaxConnections(conf.getInt(NEW_MAXIMUM_CONNECTIONS, conf.getInt(OLD_MAXIMUM_CONNECTIONS, DEFAULT_MAXIMUM_CONNECTIONS))); awsConf.setProtocol(conf.getBoolean(NEW_SECURE_CONNECTIONS, conf.getBoolean(OLD_SECURE_CONNECTIONS, DEFAULT_SECURE_CONNECTIONS)) ? Protocol.HTTPS : Protocol.HTTP); awsConf.setMaxErrorRetry(conf.getInt(NEW_MAX_ERROR_RETRIES, conf.getInt(OLD_MAX_ERROR_RETRIES, DEFAULT_MAX_ERROR_RETRIES))); awsConf.setSocketTimeout(conf.getInt(NEW_SOCKET_TIMEOUT, conf.getInt(OLD_SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT))); maxKeys = conf.getInt(NEW_MAX_PAGING_KEYS, conf.getInt(OLD_MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS)); partSize = conf.getLong(NEW_MULTIPART_SIZE, conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE)); partSizeThreshold = conf.getInt(NEW_MIN_MULTIPART_THRESHOLD, conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD));
40,581
cannedACL = null; } if (!s3.doesBucketExist(bucket)) { throw new IOException("Bucket " + bucket + " does not exist"); } <BUG>boolean purgeExistingMultipart = conf.getBoolean(PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART); long purgeExistingMultipartAge = conf.getLong(PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE); </BUG> if (purgeExistingMultipart) {
boolean purgeExistingMultipart = conf.getBoolean(NEW_PURGE_EXISTING_MULTIPART, conf.getBoolean(OLD_PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART)); long purgeExistingMultipartAge = conf.getLong(NEW_PURGE_EXISTING_MULTIPART_AGE, conf.getLong(OLD_PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE));
40,582
import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; <BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*; public class S3AOutputStream extends OutputStream {</BUG> private OutputStream backupStream; private File backupFile; private boolean closed;
import static org.apache.hadoop.fs.s3a.Constants.*; public class S3AOutputStream extends OutputStream {
40,583
this.client = client; this.progress = progress; this.fs = fs; this.cannedACL = cannedACL; this.statistics = statistics; <BUG>partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD); </BUG> if (conf.get(BUFFER_DIR, null) != null) {
partSize = conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD);
40,584
package org.icij.sql.concurrent; <BUG>import org.apache.commons.lang.StringEscapeUtils; import static org.apache.commons.lang.StringEscapeUtils.escapeSql;</BUG> import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet;
[DELETED]
40,585
} } @Override public int clear(final Connection c) throws SQLException { try (final PreparedStatement q = c.prepareStatement("DELETE FROM " + table + " WHERE " + <BUG>escapeSql(codec.getStatusKey()) + "=?;")) { </BUG> q.setString(1, codec.getWaitingStatus()); return q.executeUpdate(); }
public int remove(final Connection c, final Object o) throws SQLException { final Map<String, Object> keys = codec.encodeKey(o); final Set<String> keySet = keys.keySet(); String.join(" AND ", keySet.stream().map(k -> k + " = ?").toArray(String[]::new)) + " AND " + codec.getStatusKey() + "=?;")) { int i = 1; for (String k: keySet) { q.setObject(i++, keys.get(k)); q.setString(i, codec.getWaitingStatus());
40,586
import java.sql.ResultSet; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; @Option(name = "reportTable", description = "The report table. Defaults to \"document_report\".", parameter = "name") <BUG>@Option(name = "reportIdKey", description = "For reports tables that have an ID column, specify the key. This will " + "then be used as the unique key.", parameter = "name") @Option(name = "reportPathKey", description = "The report table key for storing the document path.", parameter = "name")</BUG> @Option(name = "reportStatusKey", description = "The table key for storing the report status.", parameter = "name")
@Option(name = "reportIdKey", description = "For reports tables that have an ID column, specify the column name. This" + " will then be used as the unique key.", parameter = "name") @Option(name = "reportForeignIdKey", description = "For reports that have a foreign ID column, specify the column " + "name.", parameter = "name") @Option(name = "reportPathKey", description = "The report table key for storing the document path.", parameter = "name")
40,587
@Option(name = "reportFailureStatus", description = "A general failure status value to use instead of the more " + "specific values.", parameter = "value") @OptionsClass(DataSourceFactory.class) public class MySQLReport extends SQLConcurrentMap<Document, ExtractionStatus> implements Report { private static class ReportCodec implements SQLCodec<ExtractionStatus> { <BUG>private final String idKey; private final String pathKey;</BUG> private final String statusKey; private final String successStatus; private final String failureStatus;
private final String foreignIdKey; private final String pathKey;
40,588
import java.util.List; import java.util.Map; import java.util.function.Supplier; public class Document { private final Path path; <BUG>private Supplier<String> id; private final Metadata metadata;</BUG> private Identifier identifier; private List<EmbeddedDocument> embeds = new LinkedList<>(); private Map<String, EmbeddedDocument> lookup = new HashMap<>();
private String foreignId = null; private final Metadata metadata;
40,589
import java.sql.SQLException; import java.util.HashMap; import java.util.Map; @Option(name = "queueTable", description = "The queue table Defaults to \"document_queue\".", parameter = "name") @Option(name = "queueIdKey", description = "For queues that provide an ID, use this option to specify the key.", <BUG>parameter = "name") @Option(name = "queuePathKey", description = "The table key for storing the document path. Must be unique in the " +</BUG> "table. Defaults to \"path\".", parameter = "name") @Option(name = "queueStatusKey", description = "The table key for storing the queue status.", parameter = "name") @Option(name = "queueWaitingStatus", description = "The status value for waiting documents.", parameter = "value")
@Option(name = "queueForeignIdKey", description = "For queues that have a foreign ID column, specify the column name.", @Option(name = "queuePathKey", description = "The table key for storing the document path. Must be unique in the " +
40,590
@Option(name = "queueProcessedStatus", description = "The status value for non-waiting documents.", parameter = "value") @OptionsClass(DataSourceFactory.class) public class MySQLDocumentQueue extends SQLBlockingQueue<Document> implements DocumentQueue { private static class DocumentQueueCodec implements SQLQueueCodec<Document> { private final DocumentFactory factory; <BUG>private final String idKey; private final String pathKey;</BUG> private final String statusKey; private final String waitingStatus; private final String processedStatus;
private final String foreignIdKey; private final String pathKey;
40,591
private final String statusKey; private final String waitingStatus; private final String processedStatus; DocumentQueueCodec(final DocumentFactory factory, final Options<String> options) { this.factory = factory; <BUG>this.idKey = options.get("queueIdKey").value().orElse(null); this.pathKey = options.get("queuePathKey").value().orElse("path");</BUG> this.statusKey = options.get("queueStatusKey").value().orElse("queue_status"); this.waitingStatus = options.get("queueWaitingStatus").value().orElse("waiting"); this.processedStatus = options.get("queueProcessedStatus").value().orElse("processed");
this.foreignIdKey = options.get("queueForeignIdKey").value().orElse(null); this.pathKey = options.get("queuePathKey").value().orElse("path");
40,592
} return factory.create(path); }</BUG> @Override <BUG>public Map<String, Object> encodeValue(final Object o) { if (!(o instanceof Document)) { throw new IllegalArgumentException(); }</BUG> final Map<String, Object> map = new HashMap<>(); if (null != idKey) {
public String getWaitingStatus() { return waitingStatus;
40,593
import org.spongepowered.api.world.Locatable; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; import java.util.List; <BUG>import java.util.Optional; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG> public class CommandDelete extends FCCommandBase { private static final FlagMapper MAPPER = map -> key -> value -> { map.put(key, value);
import java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
40,594
.append(Text.of(TextColors.GREEN, "Usage: ")) .append(getUsage(source)) .build()); return CommandResult.empty(); } else if (isIn(REGIONS_ALIASES, parse.args[0])) { <BUG>if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); IRegion region = FGManager.getInstance().getRegion(parse.args[1]); </BUG> boolean isWorldRegion = false; if (region == null) {
String regionName = parse.args[1]; IRegion region = FGManager.getInstance().getRegion(regionName).orElse(null);
40,595
</BUG> isWorldRegion = true; } if (region == null) <BUG>throw new CommandException(Text.of("No region exists with the name \"" + parse.args[1] + "\"!")); if (region instanceof GlobalWorldRegion) { </BUG> throw new CommandException(Text.of("You may not delete the global region!")); }
if (world == null) throw new CommandException(Text.of("No world exists with name \"" + worldName + "\"!")); if (world == null) throw new CommandException(Text.of("Must specify a world!")); region = FGManager.getInstance().getWorldRegion(world, regionName).orElse(null); throw new CommandException(Text.of("No region exists with the name \"" + regionName + "\"!")); if (region instanceof IGlobal) {
40,596
source.getName() + " deleted " + (isWorldRegion ? "world" : "") + "region" ); return CommandResult.success(); } else if (isIn(HANDLERS_ALIASES, parse.args[0])) { if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); <BUG>IHandler handler = FGManager.getInstance().gethandler(parse.args[1]); if (handler == null) throw new ArgumentParseException(Text.of("No handler exists with that name!"), parse.args[1], 1); if (handler instanceof GlobalHandler)</BUG> throw new CommandException(Text.of("You may not delete the global handler!"));
Optional<IHandler> handlerOpt = FGManager.getInstance().gethandler(parse.args[1]); if (!handlerOpt.isPresent()) IHandler handler = handlerOpt.get(); if (handler instanceof GlobalHandler)
40,597
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
40,598
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
40,599
@Dependency(id = "foxcore") }, description = "A world protection plugin built for SpongeAPI. Requires FoxCore.", authors = {"gravityfox"}, url = "https://github.com/FoxDenStudio/FoxGuard") <BUG>public final class FoxGuardMain { public final Cause pluginCause = Cause.builder().named("plugin", this).build(); private static FoxGuardMain instanceField;</BUG> @Inject private Logger logger;
private static FoxGuardMain instanceField;
40,600
private UserStorageService userStorage; private EconomyService economyService = null; private boolean loaded = false; private FCCommandDispatcher fgDispatcher; public static FoxGuardMain instance() { <BUG>return instanceField; }</BUG> @Listener public void construct(GameConstructionEvent event) { instanceField = this;
} public static Cause getCause() { return instance().pluginCause; }