id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
42,301
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_();
42,302
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_();
42,303
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_();
42,304
{ ReverseDependencyLink p1 = (ReverseDependencyLink) o1; ReverseDependencyLink p2 = (ReverseDependencyLink) o2; return p1.getProject().getId().compareTo( p2.getProject().getId() ); } <BUG>else {</BUG> return 0; } }
iconError( sink );
42,305
return total; } public long getTimeInMillis() { return timeInMillis; } <BUG>public Map<String, List<FacetValue>> getFacets() { return this.facets; </BUG> }
public Map<String, Collection<FacetValue>> getFacets() { return this.facets.asMap();
42,306
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.query.BoolFilterBuilder; import org.elasticsearch.index.query.FilterBuilder; import org.elasticsearch.index.query.FilterBuilders; import org.elasticsearch.index.query.QueryBuilder; <BUG>import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.search.facet.FacetBuilders;</BUG> import org.elasticsearch.search.facet.terms.TermsFacet; import org.elasticsearch.search.sort.FieldSortBuilder; import org.elasticsearch.search.sort.SortBuilders;
import org.elasticsearch.search.aggregations.AggregationBuilders; import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.search.facet.FacetBuilders;
42,307
mapping.startObject(RuleNormalizer.RuleField.TAGS.key()) .field("type", "string") .endObject(); mapping.startObject(RuleNormalizer.RuleField.SYSTEM_TAGS.key()) .field("type", "string") <BUG>.field("analyzer","whitespace") </BUG> .endObject(); mapping.startObject(RuleNormalizer.RuleField.NOTE_CREATED_AT.key()) .field("type", "date")
.field("analyzer", "whitespace")
42,308
for (RuleStatus status : query.getStatuses()) { stringStatus.add(status.name()); } this.addTermFilter(RuleNormalizer.RuleField.STATUS.key(), stringStatus, fb); } <BUG>if(query.getActivation() != null && !query.getActivation().isEmpty()){ if(query.getActivation().equals("false")){ </BUG> fb.mustNot(FilterBuilders.hasChildFilter(new ActiveRuleIndexDefinition().getIndexType(),
if (query.getActivation() != null && !query.getActivation().isEmpty()) { if (query.getActivation().equals("false")) {
42,309
esSearch.setQuery(QueryBuilders.filteredQuery(qb, fb)); SearchResponse esResult = esSearch.get(); return new RuleResult(esResult); } @Override <BUG>protected Rule toDoc(Map<String,Object> fields, QueryOptions options) { </BUG> Preconditions.checkArgument(fields != null, "Cannot construct Rule with null response!!!"); return new RuleDoc(fields); }
protected Rule toDoc(Map<String, Object> fields, QueryOptions options) {
42,310
package org.sonar.server.search; import org.apache.commons.lang.builder.ReflectionToStringBuilder; <BUG>public class FacetValue<K extends Comparable<K>> implements Comparable<FacetValue<K>>{ String key; K value; public FacetValue(String key, K value){ </BUG> this.key = key;
public class FacetValue { Integer value; public FacetValue(String key, Integer value){
42,311
} @Override public void execute(List<WriteOperation> writes) throws OperationException { } @Override <BUG>public OperationResult<DequeueResult> execute(QueueDequeue dequeue) { return new OperationResult<DequeueResult>(StatusCode.QUEUE_EMPTY);</BUG> } @Override public OperationResult<Long> execute(QueueAdmin.GetGroupID getGroupId) {
public DequeueResult execute(QueueDequeue dequeue) { return new OperationResult<DequeueResult>(StatusCode.QUEUE_EMPTY);
42,312
package com.continuuity.data.operation.executor.omid; import com.continuuity.data.operation.executor.TransactionException; public class OmidTransactionException extends TransactionException { private static final long serialVersionUID = 7253274239927817754L; <BUG>public OmidTransactionException(String msg) { super(msg); </BUG> }
public OmidTransactionException(int status, String msg) { super(status, msg);
42,313
import com.continuuity.data.operation.ttqueue.QueueAdmin.GetGroupID; import com.continuuity.data.operation.ttqueue.QueueAdmin.GetQueueMeta; import com.continuuity.data.operation.ttqueue.QueueAdmin.QueueMeta; import com.continuuity.data.operation.ttqueue.QueueDequeue; public interface InternalOperationExecutor { <BUG>public OperationResult<DequeueResult> execute(QueueDequeue dequeue) throws OperationException;</BUG> public OperationResult<Long> execute(GetGroupID getGroupId) throws OperationException; public OperationResult<QueueMeta> execute(GetQueueMeta getQueueMeta)
public DequeueResult execute(QueueDequeue dequeue)
42,314
} try (Connection conn = FoxGuardMain.instance().getDataSource(dataBaseDir + "foxguard").getConnection()) { try (Statement statement = conn.createStatement()) { try (ResultSet linkSet = statement.executeQuery("SELECT * FROM LINKAGES;")) { while (linkSet.next()) { <BUG>FGManager.getInstance().link(world, linkSet.getString("REGION"), linkSet.getString("HANDLER")); </BUG> } } }
return instance; public synchronized void initHandlers() { Server server = Sponge.getGame().getServer(); try (Connection conn = FoxGuardMain.instance().getDataSource("jdbc:h2:" + Sponge.getGame().getSavesDirectory().resolve(server.getDefaultWorldName()) + "/foxguard/foxguard").getConnection()) { statement.execute( "CREATE TABLE IF NOT EXISTS HANDLERS (" + "NAME VARCHAR(256), " + "TYPE VARCHAR(256)," + "PRIORITY INTEGER," + "ENABLED BOOLEAN);");
42,315
statement.executeBatch(); } } catch (SQLException e) { e.printStackTrace(); } <BUG>FGManager.getInstance().getRegionsList(world).stream().filter(IFGObject::autoSave).forEach(region -> { try {</BUG> DataSource source = FoxGuardMain.instance().getDataSource(dataBaseDir + "regions/" + region.getName()); try (Connection conn = source.getConnection()) { try (Statement statement = conn.createStatement()) {
FGManager.getInstance().getHandlerList().stream().filter(IFGObject::autoSave).forEach(handler -> { try { DataSource source = FoxGuardMain.instance().getDataSource( "jdbc:h2:" + Sponge.getGame().getSavesDirectory().resolve(server.getDefaultWorldName()) + "/foxguard/handlers/" + handler.getName());
42,316
dataBaseDir = "jdbc:h2:" + Sponge.getGame().getSavesDirectory().resolve(server.getDefaultWorldName()) + "/" + world.getName() + "/foxguard/"; } try (Connection conn = FoxGuardMain.instance().getDataSource(dataBaseDir + "foxguard").getConnection()) { try (Statement statement = conn.createStatement()) { statement.addBatch("DELETE FROM REGIONS; DELETE FROM LINKAGES;"); <BUG>for (IRegion region : FGManager.getInstance().getRegionsList(world)) { if (region.autoSave()) {</BUG> statement.addBatch("INSERT INTO REGIONS(NAME, TYPE, ENABLED) VALUES ('" + region.getName() + "', '" + region.getUniqueTypeString() + "', " +
for (IRegion region : FGManager.getInstance().getRegionList(world)) { if (region.autoSave()) {
42,317
import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; public final class FGManager { <BUG>public static final String[] TYPES = {"region", "handler"}; </BUG> private static FGManager instance; private final Map<World, List<IRegion>> regions; private final List<IHandler> handlers;
public static final String[] TYPES = {"region", "handler", "controller"};
42,318
private boolean unlink(World world, String regionName, String handlerName) { IRegion region = getRegion(world, regionName); IHandler handler = gethandler(handlerName); return this.unlink(region, handler); } <BUG>public boolean unlink(IRegion region, IHandler handler) { if (region == null || handler == null || !region.getHandlers().contains(handler)) return false; </BUG> Sponge.getGame().getEventManager().post(new FGUpdateEvent() {
public boolean unlink(ILinkable linkable, IHandler handler) { if (linkable == null || handler == null || !linkable.getHandlers().contains(handler)) return false;
42,319
@Override public Cause getCause() { return Cause.of(FoxGuardMain.instance()); } }); <BUG>return !(handler instanceof GlobalHandler && region instanceof GlobalRegion) && region.removeHandler(handler); </BUG> } public boolean renameRegion(World world, String oldName, String newName) { return this.rename(this.getRegion(world, oldName), newName);
return !(handler instanceof GlobalHandler && linkable instanceof GlobalRegion) && linkable.removeHandler(handler);
42,320
public GlobalHandler getGlobalHandler() { return globalHandler; } private List<IRegion> calculateRegionsForChunk(Vector3i chunk, World world) { List<IRegion> cache = new ArrayList<>(); <BUG>this.getRegionsList(world).stream() .filter(IFGObject::isEnabled)</BUG> .filter(region -> region.isInChunk(chunk)) .forEach(cache::add); return cache;
this.getRegionList(world).stream() .filter(IFGObject::isEnabled)
42,321
public void gameConstruct(GameConstructionEvent event) { instanceField = this; } @Listener public void gamePreInit(GamePreInitializationEvent event) { <BUG>loggerField.info("Beginning FoxGuard initialization"); loggerField.info("Loading configs");</BUG> new FGConfigManager(); loggerField.info("Saving configs"); FGConfigManager.getInstance().save();
loggerField.info("Version: " + PLUGIN_VERSION); loggerField.info("Loading configs");
42,322
FGStorageManager.getInstance().writeWorld(world); } } @Listener public void serverStopping(GameStoppingServerEvent event) { <BUG>loggerField.info("Saving Handlers"); </BUG> FGStorageManager.getInstance().writeHandlers(); } @Listener
loggerField.info("Saving handlers");
42,323
loggerField.info("Saving configs"); FGConfigManager.getInstance().save(); } @Listener public void worldUnload(UnloadWorldEvent event) { <BUG>loggerField.info("Saving data for World: \"" + event.getTargetWorld().getName() + "\""); </BUG> FGStorageManager.getInstance().writeWorld(event.getTargetWorld()); FGManager.getInstance().unloadWorld(event.getTargetWorld()); }
loggerField.info("Saving data for world: \"" + event.getTargetWorld().getName() + "\"");
42,324
fgDispatcher.register(new CommandEnableDisable(false), "disable", "deactivate", "disengage", "off"); fgDispatcher.register(new CommandList(), "list", "ls"); fgDispatcher.register(new CommandHere(), "here", "around"); fgDispatcher.register(new CommandDetail(), "detail", "det", "show"); fgDispatcher.register(new CommandSave(), "save", "saveall", "save-all"); <BUG>fgHandlerDispatcher.register(new CommandPriority(), "priority", "prio", "level", "rank"); fgDispatcher.register(fgHandlerDispatcher, HANDLERS_ALIASES);</BUG> game.getCommandManager().register(this, fgDispatcher, "foxguard", "foxg", "fguard", "fg"); } private void registerCommonCommands(FCCommandDispatcher dispatcher) {
fgDispatcher.register(new CommandPriority(), "priority", "prio", "level", "rank");
42,325
final Cancellable thresholdSubscription = getStreamCoordinatorClient().addListener(streamName, new StreamPropertyListener() { @Override public void thresholdChanged(String streamName, int threshold) { StreamSizeAggregator aggregator = aggregators.get(streamName); <BUG>if (aggregator == null) { LOG.warn("StreamSizeAggregator should not be null for stream {}", streamName); return; }</BUG> aggregator.setStreamThresholdMB(threshold);
while (aggregator == null) { Thread.yield(); }
42,326
private final AtomicLong streamBaseCount; private final AtomicLong countFromFiles; private final AtomicInteger streamThresholdMB; private final Cancellable cancellable; private boolean isInit; <BUG>protected StreamSizeAggregator(String streamName, long baseCount, AtomicInteger streamThresholdMB, Cancellable cancellable) {</BUG> this.streamWriterSizes = Maps.newHashMap(); this.streamBaseCount = new AtomicLong(baseCount);
protected StreamSizeAggregator(String streamName, long baseCount, int streamThresholdMB, Cancellable cancellable) {
42,327
Cancellable cancellable) {</BUG> this.streamWriterSizes = Maps.newHashMap(); this.streamBaseCount = new AtomicLong(baseCount); this.countFromFiles = new AtomicLong(baseCount); <BUG>this.streamThresholdMB = streamThresholdMB; </BUG> this.cancellable = cancellable; this.isInit = true; this.streamFeed = new NotificationFeed.Builder()
private final AtomicLong streamBaseCount; private final AtomicLong countFromFiles; private final AtomicInteger streamThresholdMB; private final Cancellable cancellable; private boolean isInit; protected StreamSizeAggregator(String streamName, long baseCount, int streamThresholdMB, Cancellable cancellable) { this.streamThresholdMB = new AtomicInteger(streamThresholdMB);
42,328
cancellable.cancel(); } public void setStreamThresholdMB(int newThreshold) { streamThresholdMB.set(newThreshold); } <BUG>public AtomicInteger getStreamThresholdMB() { return streamThresholdMB; }</BUG> public void bytesReceived(int instanceId, long nbBytes) { LOG.trace("Bytes received from instanceId {}: {}B", instanceId, nbBytes);
public void resetCount() { streamBaseCount.set(0); countFromFiles.set(0);
42,329
@Override protected void initialize() throws Exception { for (StreamSpecification streamSpec : streamMetaStore.listStreams()) { StreamConfig config = streamAdmin.getConfig(streamSpec.getName()); long filesSize = StreamUtils.fetchStreamFilesSize(config); <BUG>createSizeAggregator(streamSpec.getName(), filesSize, new AtomicInteger(config.getNotificationThresholdMB())); }</BUG> } @Override protected void doShutdown() throws Exception {
createSizeAggregator(streamSpec.getName(), filesSize, config.getNotificationThresholdMB());
42,330
protected void runOneIteration() throws Exception { for (StreamSpecification streamSpec : streamMetaStore.listStreams()) { StreamSizeAggregator streamSizeAggregator = aggregators.get(streamSpec.getName()); if (streamSizeAggregator == null) { StreamConfig config = streamAdmin.getConfig(streamSpec.getName()); <BUG>streamSizeAggregator = createSizeAggregator(streamSpec.getName(), 0, new AtomicInteger(config.getNotificationThresholdMB()));</BUG> } streamSizeAggregator.checkAggregatedSize();
streamSizeAggregator = createSizeAggregator(streamSpec.getName(), 0, config.getNotificationThresholdMB());
42,331
private final NotificationFeed streamFeed; private final String streamName; private final AtomicLong streamBaseCount; private final AtomicInteger streamThresholdMB; private final Cancellable cancellable; <BUG>protected StreamSizeAggregator(String streamName, long baseCount, AtomicInteger streamThresholdMB, Cancellable cancellable) {</BUG> this.streamName = streamName; this.streamInitSize = new AtomicLong(baseCount);
protected StreamSizeAggregator(String streamName, long baseCount, int streamThresholdMB, Cancellable cancellable) {
42,332
this.streamFeed = new NotificationFeed.Builder() .setNamespace(Constants.DEFAULT_NAMESPACE) .setCategory(Constants.Notification.Stream.STREAM_FEED_CATEGORY) .setName(streamName) .build(); <BUG>this.streamThresholdMB = streamThresholdMB; </BUG> } @Override public void cancel() {
this.streamThresholdMB = new AtomicInteger(streamThresholdMB);
42,333
@Override public int send(List<Argument> arguments) { m_arguments = arguments; String fileName = getFileName(); String lang = getLangClass(); <BUG>String engine = getBsfEngine(); String[] extensions = getFileExtensions();</BUG> LOG.info("Loading notification script from file '{}'", fileName); File scriptFile = new File(fileName); BSFManager bsfManager = new BSFManager();
String runType = getBsfRunType(); String[] extensions = getFileExtensions();
42,334
public ReportElement getBase() { return base; } @Override public float print(PDDocument document, PDPageContentStream stream, int pageNumber, float startX, float startY, float allowedWidth) throws IOException { <BUG>PDPage currPage = (PDPage) document.getDocumentCatalog().getPages().get(pageNo); PDPageContentStream pageStream = new PDPageContentStream(document, currPage, true, false); </BUG> base.print(document, pageStream, pageNo, x, y, width); pageStream.close();
PDPage currPage = document.getDocumentCatalog().getPages().get(pageNo); PDPageContentStream pageStream = new PDPageContentStream(document, currPage, PDPageContentStream.AppendMode.APPEND, false);
42,335
public PdfTextStyle(String config) { Assert.hasText(config); String[] split = config.split(","); Assert.isTrue(split.length == 3, "config must look like: 10,Times-Roman,#000000"); fontSize = Integer.parseInt(split[0]); <BUG>font = resolveStandard14Name(split[1]); color = new Color(Integer.valueOf(split[2].substring(1), 16));</BUG> } public int getFontSize() { return fontSize;
font = getFont(split[1]); color = new Color(Integer.valueOf(split[2].substring(1), 16));
42,336
package cc.catalysts.boot.report.pdf.elements; import cc.catalysts.boot.report.pdf.config.PdfTextStyle; import cc.catalysts.boot.report.pdf.utils.ReportAlignType; import org.apache.pdfbox.pdmodel.PDPageContentStream; <BUG>import org.apache.pdfbox.pdmodel.font.PDFont; import org.slf4j.Logger;</BUG> import org.slf4j.LoggerFactory; import org.springframework.util.StringUtils; import java.io.IOException;
import org.apache.pdfbox.pdmodel.font.PDType1Font; import org.apache.pdfbox.util.Matrix; import org.slf4j.Logger;
42,337
addTextSimple(stream, textConfig, textX, nextLineY, ""); return nextLineY; } try { <BUG>String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, fixedText); </BUG> float x = calculateAlignPosition(textX, align, textConfig, allowedWidth, split[0]); if (!underline) { addTextSimple(stream, textConfig, x, nextLineY, split[0]); } else {
String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, text);
42,338
public static void addTextSimple(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) { try { stream.setFont(textConfig.getFont(), textConfig.getFontSize()); stream.setNonStrokingColor(textConfig.getColor()); stream.beginText(); <BUG>stream.newLineAtOffset(textX, textY); stream.showText(text);</BUG> } catch (Exception e) { LOG.warn("Could not add text: " + e.getClass() + " - " + e.getMessage()); }
stream.setTextMatrix(new Matrix(1,0,0,1, textX, textY)); stream.showText(text);
42,339
public static void addTextSimpleUnderlined(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) { addTextSimple(stream, textConfig, textX, textY, text); try { float lineOffset = textConfig.getFontSize() / 8F; stream.setStrokingColor(textConfig.getColor()); <BUG>stream.setLineWidth(0.5F); stream.drawLine(textX, textY - lineOffset, textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset); </BUG> stream.stroke(); } catch (IOException e) {
stream.moveTo(textX, textY - lineOffset); stream.lineTo(textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset);
42,340
list.add(text.length()); return list; } public static String[] splitText(PDFont font, int fontSize, float allowedWidth, String text) { String endPart = ""; <BUG>String shortenedText = text; List<String> breakSplitted = Arrays.asList(shortenedText.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList()); if (breakSplitted.size() > 1) {</BUG> String[] splittedFirst = splitText(font, fontSize, allowedWidth, breakSplitted.get(0)); StringBuilder remaining = new StringBuilder(splittedFirst[1] == null ? "" : splittedFirst[1] + "\n");
List<String> breakSplitted = Arrays.asList(text.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList()); if (breakSplitted.size() > 1) {
42,341
package cc.catalysts.boot.report.pdf.elements; import org.apache.pdfbox.pdmodel.PDDocument; <BUG>import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; import java.io.IOException;</BUG> import java.util.ArrayList; import java.util.Collection; import java.util.LinkedList;
import org.apache.pdfbox.pdmodel.PDPageContentStream; import java.io.IOException;
42,342
package org.dbtools.android.domain; import org.dbtools.android.domain.database.DatabaseWrapper; import org.dbtools.android.domain.database.contentvalues.DBToolsContentValues; import org.dbtools.android.domain.database.statement.StatementWrapper; <BUG>import org.dbtools.android.domain.task.DeleteTask; import org.dbtools.android.domain.task.DeleteWhereTask; import org.dbtools.android.domain.task.InsertTask; import org.dbtools.android.domain.task.UpdateTask; import org.dbtools.android.domain.task.UpdateWhereTask;</BUG> import java.util.HashSet;
[DELETED]
42,343
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import javax.annotation.Nonnull; import javax.annotation.Nullable; @SuppressWarnings("UnusedDeclaration") <BUG>public abstract class AndroidBaseManagerWritable<T extends AndroidBaseRecord> extends AndroidBaseManager<T> implements AsyncManager<T> { private final AtomicBoolean transactionInsertOccurred = new AtomicBoolean(false);</BUG> private final AtomicBoolean transactionUpdateOccurred = new AtomicBoolean(false); private final AtomicBoolean transactionDeleteOccurred = new AtomicBoolean(false); private long lastTableModifiedTs = -1L;
public abstract class AndroidBaseManagerWritable<T extends AndroidBaseRecord> extends AndroidBaseManager<T> { private final AtomicBoolean transactionInsertOccurred = new AtomicBoolean(false);
42,344
androidDatabase.getManagerExecutorServiceInstance().submit(new InsertTask<T>(databaseName, this, e)); }</BUG> public int update(@Nullable T e) { return update(getDatabaseName(), e); } <BUG>public int update(@Nonnull String databaseName, @Nullable T e) { return update(getWritableDatabase(databaseName), e); } public int update(@Nonnull DatabaseWrapper db, @Nullable T e) {</BUG> if (e == null) {
ex.printStackTrace(); } // retry return rowId; DatabaseWrapper<? super AndroidBaseRecord, ? super DBToolsContentValues<?>> db = getWritableDatabase(databaseName);
42,345
}</BUG> public int delete(@Nullable T e) { return delete(getDatabaseName(), e); } public int delete(@Nonnull String databaseName, @Nullable T e) { <BUG>return delete(getWritableDatabase(databaseName), e); } public int delete(@Nonnull DatabaseWrapper db, @Nullable T e) {</BUG> if (e == null) { return 0;
if (success && rowsAffectedCount > 0) { notifyTableListeners(false, db, new DatabaseTableChange(getTableName(), false, true, false)); return rowsAffectedCount;
42,346
return delete(getPrimaryKey() + " = ?", new String[]{String.valueOf(rowId)}); } public int delete(@Nullable String where, @Nullable String[] whereArgs) { return delete(getDatabaseName(), where, whereArgs); } <BUG>public int delete(@Nonnull String databaseName, @Nullable String where, @Nullable String[] whereArgs) { return delete(getWritableDatabase(databaseName), where, whereArgs); } public int delete(@Nonnull DatabaseWrapper db, @Nullable String where, @Nullable String[] whereArgs) {</BUG> checkDB(db);
DatabaseWrapper<? super AndroidBaseRecord, ? super DBToolsContentValues<?>> db = getWritableDatabase(databaseName);
42,347
}</BUG> public long deleteAll() { return deleteAll(getDatabaseName()); } public long deleteAll(@Nonnull String databaseName) { <BUG>return delete(getWritableDatabase(databaseName), null, null); } public void deleteAllAsync() { deleteAllAsync(getDatabaseName()); } public void deleteAllAsync(@Nonnull String databaseName) { AndroidDatabase androidDatabase = getAndroidDatabase(databaseName); androidDatabase.getManagerExecutorServiceInstance().submit(new DeleteWhereTask<T>(databaseName, this, null, null));</BUG> }
if (success && rowCountAffected > 0) { notifyTableListeners(false, db, new DatabaseTableChange(getTableName(), false, false, true)); return rowCountAffected; return delete(databaseName, null, null);
42,348
tableChangeListeners.clear(); } finally { listenerLock.unlock(); } } <BUG>private void notifyTableListeners(boolean forceNotify, @Nullable DatabaseWrapper db, @Nonnull DatabaseTableChange changeType) { </BUG> updateLastTableModifiedTs(); if (forceNotify || !(db != null && db.inTransaction())) { listenerLock.lock();
private void notifyTableListeners(boolean forceNotify, @Nullable DatabaseWrapper<? super AndroidBaseRecord, ? super DBToolsContentValues<?>> db, @Nonnull DatabaseTableChange changeType) {
42,349
package org.dbtools.android.domain; import android.database.Cursor; import android.database.MatrixCursor; <BUG>import android.database.MergeCursor; import org.dbtools.android.domain.config.DatabaseConfig;</BUG> import org.dbtools.android.domain.database.DatabaseWrapper; import org.dbtools.android.domain.database.contentvalues.DBToolsContentValues; import org.dbtools.android.domain.database.statement.StatementWrapper;
import android.support.annotation.NonNull; import org.dbtools.android.domain.config.DatabaseConfig;
42,350
import javax.annotation.Nullable; @SuppressWarnings("UnusedDeclaration") public abstract class AndroidBaseManager<T extends AndroidBaseRecord> { public static final int MAX_TRY_COUNT = 3; public static final String DEFAULT_COLLATE_LOCALIZED = " COLLATE LOCALIZED"; <BUG>public abstract DatabaseWrapper getReadableDatabase(String databaseName); public abstract DatabaseWrapper getWritableDatabase(String databaseName); public abstract AndroidDatabase getAndroidDatabase(String databaseName);</BUG> public abstract String getDatabaseName(); public abstract String getTableName();
public abstract DatabaseWrapper<? super AndroidBaseRecord, ? super DBToolsContentValues<?>> getReadableDatabase(String databaseName); public abstract DatabaseWrapper<? super AndroidBaseRecord, ? super DBToolsContentValues<?>> getWritableDatabase(String databaseName); public abstract AndroidDatabase getAndroidDatabase(String databaseName);
42,351
public void createTable(@Nonnull DatabaseWrapper db) { executeSql(db, getCreateSql()); </BUG> } <BUG>public static void createTable(@Nonnull DatabaseWrapper db, String sql) { executeSql(db, sql);</BUG> } public void dropTable() { executeSql(getDatabaseName(), getDropSql()); }
public void createTable() { executeSql(getDatabaseName(), getCreateSql()); public void createTable(@Nonnull String databaseName) { executeSql(databaseName, getCreateSql()); public static void createTable(@Nonnull DatabaseWrapper<? super AndroidBaseRecord, ? super DBToolsContentValues<?>> db, String sql) { executeSql(db, sql);
42,352
foundItems.add(record); } while (cursor.moveToNext()); } cursor.close(); } else { <BUG>foundItems = new ArrayList<T>(); }</BUG> return foundItems; } @Nullable
foundItems = new ArrayList<>();
42,353
return findCountBySelection(getDatabaseName(), selection, selectionArgs); } public long findCountBySelection(@Nonnull String databaseName, @Nullable String selection, @Nullable String[] selectionArgs) { return findCountBySelection(getReadableDatabase(databaseName), getTableName(), selection, selectionArgs); } <BUG>public static long findCountBySelection(@Nonnull DatabaseWrapper database, @Nonnull String tableName, @Nullable String selection, @Nullable String[] selectionArgs) { </BUG> long count = -1; Cursor c = database.query(tableName, new String[]{"count(1)"}, selection, selectionArgs, null, null, null); if (c != null) {
public static long findCountBySelection(@Nonnull DatabaseWrapper<? super AndroidBaseRecord, ? super DBToolsContentValues<?>> database, @Nonnull String tableName, @Nullable String selection, @Nullable String[] selectionArgs) {
42,354
return findCountByRawQuery(getDatabaseName(), rawQuery, selectionArgs); } public long findCountByRawQuery(@Nonnull String databaseName, @Nonnull String rawQuery, @Nullable String[] selectionArgs) { return findCountByRawQuery(getReadableDatabase(databaseName), rawQuery, selectionArgs); } <BUG>public static long findCountByRawQuery(@Nonnull DatabaseWrapper database, @Nonnull String rawQuery, @Nullable String[] selectionArgs) { </BUG> long count = 0; Cursor c = database.rawQuery(rawQuery, selectionArgs); if (c != null) {
public static long findCountByRawQuery(@Nonnull DatabaseWrapper<? super AndroidBaseRecord, ? super DBToolsContentValues<?>> database, @Nonnull String rawQuery, @Nullable String[] selectionArgs) {
42,355
return findValueByRawQuery(getDatabaseName(), valueType, rawQuery, selectionArgs, defaultValue); } public <I> I findValueByRawQuery(@Nonnull String databaseName, @Nonnull Class<I> valueType, @Nonnull String rawQuery, @Nullable String[] selectionArgs, I defaultValue) { return findValueByRawQuery(getReadableDatabase(databaseName), valueType, rawQuery, selectionArgs, defaultValue); } <BUG>public static <I> I findValueByRawQuery(@Nonnull DatabaseWrapper database, @Nonnull Class<I> valueType, @Nonnull String rawQuery, @Nullable String[] selectionArgs, I defaultValue) { </BUG> DatabaseValue<I> databaseValue = getDatabaseValue(valueType); I value = defaultValue; Cursor c = database.rawQuery(rawQuery, selectionArgs);
public static <I> I findValueByRawQuery(@Nonnull DatabaseWrapper<? super AndroidBaseRecord, ? super DBToolsContentValues<?>> database, @Nonnull Class<I> valueType, @Nonnull String rawQuery, @Nullable String[] selectionArgs, I defaultValue) {
42,356
return tableExists(getReadableDatabase(databaseName), tableName); } public static boolean tableExists(@Nonnull AndroidDatabase androidDatabase, @Nonnull String tableName) { return tableExists(androidDatabase.getDatabaseWrapper(), tableName); } <BUG>public static boolean tableExists(@Nullable DatabaseWrapper db, @Nullable String tableName) { </BUG> if (tableName == null || db == null || !db.isOpen()) { return false; }
public static boolean tableExists(@Nullable DatabaseWrapper<? super AndroidBaseRecord, ? super DBToolsContentValues<?>> db, @Nullable String tableName) {
42,357
</BUG> return mergeCursors(toMatrixCursor(records), cursor); } public Cursor addAllToCursorBottom(Cursor cursor, List<T> records) { return mergeCursors(cursor, toMatrixCursor(records)); <BUG>} public Cursor addAllToCursorBottom(Cursor cursor, T... records) { </BUG> return mergeCursors(cursor, toMatrixCursor(records)); }
return new MergeCursor(cursors); @NonNull public Cursor addAllToCursorTop(Cursor cursor, List<T> records) { @SafeVarargs public final Cursor addAllToCursorTop(Cursor cursor, T... records) {
42,358
Session session = null; try { session = openSession(); String sql = CustomSQLUtil.get(FIND_BY_MODIFIED_DATE); SQLQuery q = session.createSQLQuery(sql); <BUG>q.addScalar("userId", Type.LONG); q.addScalar("firstName", Type.STRING);</BUG> q.addScalar("middleName", Type.STRING); q.addScalar("lastName", Type.STRING); q.addScalar("portraitId", Type.LONG);
q.addScalar("screenName", Type.STRING); q.addScalar("firstName", Type.STRING);
42,359
Session session = null; try { session = openSession(); String sql = CustomSQLUtil.get(FIND_BY_SOCIAL_RELATION_TYPE); SQLQuery q = session.createSQLQuery(sql); <BUG>q.addScalar("userId", Type.LONG); q.addScalar("firstName", Type.STRING);</BUG> q.addScalar("middleName", Type.STRING); q.addScalar("lastName", Type.STRING); q.addScalar("portraitId", Type.LONG);
String sql = CustomSQLUtil.get(FIND_BY_MODIFIED_DATE); q.addScalar("screenName", Type.STRING); q.addScalar("firstName", Type.STRING);
42,360
Session session = null; try { session = openSession(); String sql = CustomSQLUtil.get(FIND_BY_USERS_GROUPS); SQLQuery q = session.createSQLQuery(sql); <BUG>q.addScalar("userId", Type.LONG); q.addScalar("firstName", Type.STRING);</BUG> q.addScalar("middleName", Type.STRING); q.addScalar("lastName", Type.STRING); q.addScalar("portraitId", Type.LONG);
String sql = CustomSQLUtil.get(FIND_BY_MODIFIED_DATE); q.addScalar("screenName", Type.STRING); q.addScalar("firstName", Type.STRING);
42,361
Status buddyStatus = StatusLocalServiceUtil.getUserStatus( userId); awake = buddyStatus.getAwake(); String statusMessage = buddyStatus.getMessage(); JSONObject curUserJSON = JSONFactoryUtil.createJSONObject(); <BUG>curUserJSON.put("userId", userId); curUserJSON.put("fullName", fullName);</BUG> curUserJSON.put("portraitId", portraitId); curUserJSON.put("awake", awake); curUserJSON.put("statusMessage", statusMessage);
curUserJSON.put("screenName", screenName); curUserJSON.put("fullName", fullName);
42,362
import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.StringUtil; <BUG>import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.model.User;</BUG> import com.liferay.portal.service.UserLocalServiceUtil; import java.util.ArrayList; import java.util.Collection;
import com.liferay.portal.model.ContactConstants; import com.liferay.portal.model.User;
42,363
package org.eclipse.xtext.index; <BUG>import java.util.List; </BUG> import org.eclipse.core.resources.IProject; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EClass;
import java.util.Collection;
42,364
private int containerID; public ResourceVisitor(WorkspaceModelIndexer workspaceModelIndex, int containerID) { </BUG> this.workspaceModelIndex = workspaceModelIndex; ignoredResources = new ArrayList<IResource>(); <BUG>this.containerID = containerID; }</BUG> public void addIgnoredResource(IResource ignoredResource) { ignoredResources.add(ignoredResource); }
public ResourceVisitor(WorkspaceModelIndexer workspaceModelIndex, int containerID, List<URI> resourceURIsFromDB) { this.resourceURIsFromDB=resourceURIsFromDB;
42,365
private IProject project; public ResourceDeltaVisitor(WorkspaceModelIndexer workspaceModelIndexer) { this.workspaceModelIndexer = workspaceModelIndexer; } public boolean visit(IResourceDelta delta) throws CoreException { <BUG>IResource resource = delta.getResource(); int type = resource.getType();</BUG> int kind = delta.getKind(); if (type == IResource.PROJECT) { project = (IProject) resource;
if (!resource.isDerived()) { int type = resource.getType();
42,366
if (project.isOpen()) { switch (kind) { case IResourceDelta.CHANGED: return true; case IResourceDelta.ADDED: <BUG>workspaceModelIndexer.indexProject(project); return false;</BUG> case IResourceDelta.REMOVED: workspaceModelIndexer.removeProject(project); return false;
workspaceModelIndexer.indexProject(project, Collections.<Integer> emptyList());
42,367
if (type == IResource.ROOT || type == IResource.FOLDER) { return true; } if (type == IResource.FILE) { IFile file = (IFile) delta.getResource(); <BUG>String fileExtension = file.getFileExtension(); if (WorkspaceModelIndexer.REGISTERED_EXTENSIONS.contains(fileExtension)) { </BUG> switch (kind) { case IResourceDelta.ADDED:
if ("classpath".equals(fileExtension) || "MANIFEST.MF".equals(file.getName())) { workspaceModelIndexer.indexProject(file.getProject(), Collections.<Integer> emptyList()); else if (WorkspaceModelIndexer.REGISTERED_EXTENSIONS.contains(fileExtension)) {
42,368
package org.eclipse.xtext.index.internal; <BUG>import java.sql.SQLException; import java.util.Collections; import java.util.List; import org.apache.log4j.Logger;</BUG> import org.eclipse.core.resources.IProject;
import java.util.Collection; import java.util.HashSet; import java.util.Set; import org.apache.log4j.Logger;
42,369
ecoreRegistryIndexer = new EcoreRegistryIndexer(indexDatabase); if (isRegisterEPackages) { ecoreRegistryIndexer.indexRegisteredEPackages(); } resourceDeltaVisitor = new ResourceDeltaVisitor(workspaceModelIndexer); <BUG>ResourcesPlugin.getWorkspace().addResourceChangeListener(this); }</BUG> public boolean exists(URI fragmentURI) { int containerURILength = indexDatabase.getResourceContainerDAO().getContainerURILength(fragmentURI); String resourceUriAsString = fragmentURI.trimFragment().toString();
startListening();
42,370
long t=t0; long pnext=t+printInterval_ms; boolean run = true; while (!endEvent && run) { SamplesEventsCount status = null; <BUG>try { System.out.println( TAG+" Waiting for " + (nSamples + trialLength_samp + 1) + " samples");</BUG> status = C.waitForSamples(nSamples + trialLength_samp + 1, this.timeout_ms); } catch (IOException e) { e.printStackTrace();
if ( VERB>1 ) System.out.println( TAG+" Waiting for " + (nSamples + trialLength_samp + 1) + " samples");
42,371
dv = null; continue; } t = System.currentTimeMillis(); if ( t > pnext ) { <BUG>System.out.println(TAG+ String.format("%d %d %5.3f (samp,event,sec)\r", status.nSamples,status.nEvents,(t-t0)/1000.0));</BUG> pnext = t+printInterval_ms; } int onSamples = nSamples;
System.out.println(String.format("%d %d %5.3f (samp,event,sec)\r", status.nSamples,status.nEvents,(t-t0)/1000.0));
42,372
try { data = new Matrix(new Matrix(C.getDoubleData(fromId, toId)).transpose()); } catch (IOException e) { e.printStackTrace(); } <BUG>if ( VERB>0 ) { </BUG> System.out.println(TAG+ String.format("Got data @ %d->%d samples", fromId, toId)); } Matrix f = new Matrix(classifiers.get(0).getOutputSize(), 1);
if ( VERB>1 ) {
42,373
ClassifierResult result = null; for (PreprocClassifier c : classifiers) { result = c.apply(data); f = new Matrix(f.add(result.f)); fraw = new Matrix(fraw.add(result.fraw)); <BUG>} double[] dvColumn = f.getColumn(0);</BUG> f = new Matrix(dvColumn.length - 1, 1); f.setColumn(0, Arrays.copyOfRange(dvColumn, 1, dvColumn.length)); if (normalizeLateralization){ // compute alphaLat score
if ( f.getRowDimension() > 1 ) { double[] dvColumn = f.getColumn(0);
42,374
f.setColumn(0, Arrays.copyOfRange(dvColumn, 1, dvColumn.length)); if (normalizeLateralization){ // compute alphaLat score f.setEntry(0, 0, (dvColumn[0] - dvColumn[1]) / (dvColumn[0] + dvColumn[1])); } else { f.setEntry(0, 0, dvColumn[0] - dvColumn[1]); <BUG>} if (dv == null || predictionFilter < 0) {</BUG> dv = f; } else { if (predictionFilter >= 0.) {// exponiential smoothing of predictions
if (dv == null || predictionFilter < 0) {
42,375
if (baselinePhase) { nBaseline++; dvBaseline = new Matrix(dvBaseline.add(dv)); dv2Baseline = new Matrix(dv2Baseline.add(dv.multiplyElements(dv))); if (nBaselineStep > 0 && nBaseline > nBaselineStep) { <BUG>System.out.println( "Baseline timeout\n"); </BUG> baselinePhase = false; Tuple<Matrix, Matrix> ret = baselineValues(dvBaseline, dv2Baseline, nBaseline); baseLineVal = ret.x;
if(VERB>1) System.out.println( "Baseline timeout\n");
42,376
Tuple<Matrix, Matrix> ret=baselineValues(dvBaseline,dv2Baseline,nBaseline); baseLineVal = ret.x; baseLineVar = ret.y; } } else if ( value.equals(baselineStart) ) { <BUG>System.out.println( "Baseline start event received"); </BUG> baselinePhase = true; nBaseline = 0; dvBaseline = Matrix.zeros(classifiers.get(0).getOutputSize() - 1, 1);
if(VERB>1)System.out.println(TAG+ "Baseline start event received");
42,377
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.*;
42,378
.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);
42,379
</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) {
42,380
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)
42,381
.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))
42,382
.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))
42,383
@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;
42,384
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; }
42,385
return configDirectory; } public boolean isLoaded() { return loaded; } <BUG>public static Cause getCause() { return instance().pluginCause; }</BUG> public EconomyService getEconomyService() { return economyService;
[DELETED]
42,386
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.*; <BUG>import java.util.stream.Collectors; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG> public class CommandHere extends FCCommandBase { private static final String[] PRIORITY_ALIASES = {"priority", "prio", "p"}; private static final FlagMapper MAPPER = map -> key -> value -> {
import java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
42,387
.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 > 0) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
42,388
private static FGStorageManager instance; private final Logger logger = FoxGuardMain.instance().getLogger();</BUG> private final Set<LoadEntry> loaded = new HashSet<>(); private final Path directory = getDirectory(); private final Map<String, Path> worldDirectories; <BUG>private FGStorageManager() { defaultModifiedMap = new CacheMap<>((k, m) -> {</BUG> if (k instanceof IFGObject) { m.put((IFGObject) k, true); return true;
public final HashMap<IFGObject, Boolean> defaultModifiedMap; private final UserStorageService userStorageService; private final Logger logger = FoxGuardMain.instance().getLogger(); userStorageService = FoxGuardMain.instance().getUserStorage(); defaultModifiedMap = new CacheMap<>((k, m) -> {
42,389
String name = fgObject.getName(); Path singleDir = dir.resolve(name.toLowerCase()); </BUG> boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { <BUG>logger.info((shouldSave ? "S" : "Force s") + "aving handler \"" + name + "\" in directory: " + singleDir); </BUG> constructDirectory(singleDir); try { fgObject.save(singleDir);
UUID owner = fgObject.getOwner(); boolean isOwned = !owner.equals(SERVER_UUID); Optional<User> userOwner = userStorageService.get(owner); String logName = (userOwner.isPresent() ? userOwner.get().getName() + ":" : "") + (isOwned ? owner + ":" : "") + name; if (fgObject.autoSave()) { Path singleDir = serverDir.resolve(name.toLowerCase()); logger.info((shouldSave ? "S" : "Force s") + "aving handler " + logName + " in directory: " + singleDir);
42,390
if (fgObject.autoSave()) { Path singleDir = dir.resolve(name.toLowerCase()); </BUG> boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { <BUG>logger.info((shouldSave ? "S" : "Force s") + "aving world region \"" + name + "\" in directory: " + singleDir); </BUG> constructDirectory(singleDir); try { fgObject.save(singleDir);
Path singleDir = serverDir.resolve(name.toLowerCase()); logger.info((shouldSave ? "S" : "Force s") + "aving world region " + logName + " in directory: " + singleDir);
42,391
public synchronized void loadRegionLinks() { logger.info("Loading region links"); try (DB mainDB = DBMaker.fileDB(directory.resolve("regions.foxdb").normalize().toString()).make()) { Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen(); linksMap.entrySet().forEach(entry -> { <BUG>IRegion region = FGManager.getInstance().getRegion(entry.getKey()); if (region != null) { logger.info("Loading links for region \"" + region.getName() + "\"");</BUG> String handlersString = entry.getValue();
Optional<IRegion> regionOpt = FGManager.getInstance().getRegion(entry.getKey()); if (regionOpt.isPresent()) { IRegion region = regionOpt.get(); logger.info("Loading links for region \"" + region.getName() + "\"");
42,392
public synchronized void loadWorldRegionLinks(World world) { logger.info("Loading world region links for world \"" + world.getName() + "\""); try (DB mainDB = DBMaker.fileDB(worldDirectories.get(world.getName()).resolve("wregions.foxdb").normalize().toString()).make()) { Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen(); linksMap.entrySet().forEach(entry -> { <BUG>IRegion region = FGManager.getInstance().getWorldRegion(world, entry.getKey()); if (region != null) { logger.info("Loading links for world region \"" + region.getName() + "\"");</BUG> String handlersString = entry.getValue();
Optional<IWorldRegion> regionOpt = FGManager.getInstance().getWorldRegion(world, entry.getKey()); if (regionOpt.isPresent()) { IWorldRegion region = regionOpt.get(); logger.info("Loading links for world region \"" + region.getName() + "\"");
42,393
StringBuilder builder = new StringBuilder(); for (Iterator<IHandler> it = handlers.iterator(); it.hasNext(); ) { builder.append(it.next().getName()); if (it.hasNext()) builder.append(","); } <BUG>return builder.toString(); }</BUG> private final class LoadEntry { public final String name; public final Type type;
public enum Type { REGION, WREGION, HANDLER
42,394
.autoCloseQuotes(true) .leaveFinalAsIs(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "worldregion", "handler", "controller").stream() </BUG> .filter(new StartsWithPredicate(parse.current.token)) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "worldregion", "handler", "controller")
42,395
import java.io.IOException; import java.util.*; import java.util.regex.Pattern; public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOMExternalizable, ExportableApplicationComponent { private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl"); <BUG>private final static int VERSION = 1; </BUG> private final Set<FileType> myDefaultTypes = new THashSet<FileType>(); private SetWithArray myFileTypes = new SetWithArray(new THashSet<FileType>()); private final ArrayList<FakeFileType> mySpecialFileTypes = new ArrayList<FakeFileType>();
private final static int VERSION = 2;
42,396
for (int i = 0; i < removedMappings.size(); i++) { Element mapping = (Element)removedMappings.get(i); String ext = mapping.getAttributeValue("ext"); String name = mapping.getAttributeValue("type"); FileType type = getFileTypeByName(name); <BUG>if (type != null) { removeAssociation(type, ext, false);</BUG> } } }
if (savedVersion < VERSION) { if((type == StdFileTypes.DTD && ext.equals("dtd")) || (type == StdFileTypes.XHTML && ext.equals("xhtml")) continue;
42,397
SyntaxTable table = null; Element element = typeElement.getChild("highlighting"); if (element != null) { table = readSyntaxTable(element); } <BUG>FileType type = getFileTypeByName(fileTypeName); String[] exts = parse(extensionsStr);</BUG> if (type != null) { if (extensionsStr != null) { removeAllAssociations(type);
if (!isDefaults && type == StdFileTypes.XML) { extensionsStr = removeExtension(extensionsStr,"dtd"); extensionsStr = removeExtension(extensionsStr,"xhtml"); String[] exts = parse(extensionsStr);
42,398
ResourcePolicy rp = ResourcePolicy.create(c); rp.setResource(o); rp.setAction(actionID); rp.setEPerson(e); rp.setRpType(type); <BUG>rp.update(); o.updateLastModified(); }</BUG> public static void addPolicy(Context c, DSpaceObject o, int actionID, Group g) throws SQLException, AuthorizeException
c.turnOffAuthorisationSystem(); c.restoreAuthSystemState(); }
42,399
drp.setEndDate(srp.getEndDate()); drp.setRpName(srp.getRpName()); drp.setRpDescription(srp.getRpDescription()); drp.setRpType(srp.getRpType()); drp.update(); <BUG>} dest.updateLastModified(); }</BUG> public static void removeAllPolicies(Context c, DSpaceObject o) throws SQLException
c.turnOffAuthorisationSystem(); c.restoreAuthSystemState();
42,400
EPerson eperson = null; try { context = new Context(); eperson = EPerson.find(context, oldEPerson.getID()); context.setCurrentUser(eperson); <BUG>context.setIgnoreAuthorization(true); boolean isResume = theResumeDir!=null;</BUG> List<Collection> collectionList = new ArrayList<Collection>(); if (theOtherCollections != null){ for (String colID : theOtherCollections){
context.turnOffAuthorisationSystem(); boolean isResume = theResumeDir!=null;