id int64 1 49k | buggy stringlengths 34 37.5k | fixed stringlengths 2 37k |
|---|---|---|
8,701 | 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;
|
8,702 | package com.intellij.codeInsight.editorActions;
import com.intellij.codeInsight.highlighting.BraceMatchingUtil;
<BUG>import com.intellij.lang.xml.XMLLanguage;
import com.intellij.openapi.editor.Editor;</BUG>
import com.intellij.openapi.editor.ScrollType;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.editor.highlighter.HighlighterIterator;
| import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
|
8,703 | <BUG>package com.intellij.codeInsight.completion;
import com.intellij.codeInsight.lookup.LookupItem;
import com.intellij.codeInsight.lookup.Lookup;
import com.intellij.codeInsight.CodeInsightUtil;
import com.intellij.codeInsight.template.Template;
import com.intellij.codeInsight.template.TemplateManager;
import com.intellij.codeInsight.template.Expression;
import com.intellij.codeInsight.template.TemplateEditingListener;</BUG>
import com.intellij.codeInsight.template.macro.MacroFactory;
| import com.intellij.codeInsight.template.TemplateEditingListener;
|
8,704 | import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.DigestOutputStream;
import java.security.MessageDigest;
<BUG>import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;</BUG>
public final class PatchUtils {
| import java.text.DateFormat;
import java.util.Date;
import java.util.List;
|
8,705 | package org.jboss.as.patching.runner;
<BUG>import org.jboss.as.boot.DirectoryStructure;
import org.jboss.as.patching.LocalPatchInfo;</BUG>
import org.jboss.as.patching.PatchInfo;
import org.jboss.as.patching.PatchLogger;
import org.jboss.as.patching.PatchMessages;
| import static org.jboss.as.patching.runner.PatchUtils.generateTimestamp;
import org.jboss.as.patching.CommonAttributes;
import org.jboss.as.patching.LocalPatchInfo;
|
8,706 | private static final String PATH_DELIMITER = "/";
public static final byte[] NO_CONTENT = PatchingTask.NO_CONTENT;
enum Element {
ADDED_BUNDLE("added-bundle"),
ADDED_MISC_CONTENT("added-misc-content"),
<BUG>ADDED_MODULE("added-module"),
BUNDLES("bundles"),</BUG>
CUMULATIVE("cumulative"),
DESCRIPTION("description"),
MISC_FILES("misc-files"),
| APPLIES_TO_VERSION("applies-to-version"),
BUNDLES("bundles"),
|
8,707 | final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
<BUG>case APPLIES_TO_VERSION:
builder.addAppliesTo(value);
break;</BUG>
case RESULTING_VERSION:
if(type == Patch.PatchType.CUMULATIVE) {
| [DELETED] |
8,708 | final StringBuilder path = new StringBuilder();
for(final String p : item.getPath()) {
path.append(p).append(PATH_DELIMITER);
}
path.append(item.getName());
<BUG>writer.writeAttribute(Attribute.PATH.name, path.toString());
if(type != ModificationType.REMOVE) {</BUG>
writer.writeAttribute(Attribute.HASH.name, bytesToHexString(item.getContentHash()));
}
if(type != ModificationType.ADD) {
| if (item.isDirectory()) {
writer.writeAttribute(Attribute.DIRECTORY.name, "true");
if(type != ModificationType.REMOVE) {
|
8,709 | package org.jboss.as.patching;
import org.jboss.as.controller.OperationFailedException;
import org.jboss.as.patching.runner.PatchingException;
import org.jboss.logging.Messages;
import org.jboss.logging.annotations.Message;
<BUG>import org.jboss.logging.annotations.MessageBundle;
import java.io.IOException;</BUG>
import java.util.List;
@MessageBundle(projectCode = "JBAS")
public interface PatchMessages {
| import org.jboss.logging.annotations.Cause;
import java.io.IOException;
|
8,710 | import org.codehaus.groovy.control.CompilationUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public final class GroovyTreeParser implements TreeParser {
private static final Logger logger = LoggerFactory.getLogger(GroovyTreeParser.class);
<BUG>private static final String GROOVY_DEFAULT_INTERFACE = "groovy.lang.GroovyObject";
private static final String JAVA_DEFAULT_OBJECT = "java.lang.Object";
private Map<URI, Set<SymbolInformation>> fileSymbols = Maps.newHashMap();
private Map<String, Set<SymbolInformation>> typeReferences = Maps.newHashMap();</BUG>
private final Supplier<CompilationUnit> unitSupplier;
| private Indexer indexer = new Indexer();
|
8,711 | if (scriptClass != null) {
sourceUnit.getAST().getStatementBlock().getVariableScope().getDeclaredVariables().values().forEach(
variable -> {
SymbolInformation symbol =
getVariableSymbolInformation(scriptClass.getName(), sourceUri, variable);
<BUG>addToValueSet(newTypeReferences, variable.getType().getName(), symbol);
symbols.add(symbol);
});
}
newFileSymbols.put(workspaceUriSupplier.get(sourceUri), symbols);</BUG>
});
| newIndexer.addSymbol(sourceUnit.getSource().getURI(), symbol);
if (classes.containsKey(variable.getType().getName())) {
newIndexer.addReference(classes.get(variable.getType().getName()),
GroovyLocations.createLocation(sourceUri, variable.getType()));
|
8,712 | }
if (typeReferences.containsKey(foundSymbol.getName())) {
foundReferences.addAll(typeReferences.get(foundSymbol.getName()));</BUG>
}
<BUG>return foundReferences;
}</BUG>
@Override
public Set<SymbolInformation> getFilteredSymbols(String query) {
checkNotNull(query, "query must not be null");
Pattern pattern = getQueryPattern(query);
| });
sourceUnit.getAST().getStatementBlock()
.visit(new MethodVisitor(newIndexer, sourceUri, sourceUnit.getAST().getScriptClassDummy(),
classes, Maps.newHashMap(), Optional.absent(), workspaceUriSupplier));
|
8,713 | <BUG>package com.palantir.ls.server.api;
import io.typefox.lsapi.ReferenceParams;</BUG>
import io.typefox.lsapi.SymbolInformation;
import java.net.URI;
import java.util.Map;
| import com.google.common.base.Optional;
import io.typefox.lsapi.Location;
import io.typefox.lsapi.Position;
import io.typefox.lsapi.ReferenceParams;
|
8,714 | import java.util.Map;
import java.util.Set;
public interface TreeParser {
void parseAllSymbols();
Map<URI, Set<SymbolInformation>> getFileSymbols();
<BUG>Map<String, Set<SymbolInformation>> getTypeReferences();
Set<SymbolInformation> findReferences(ReferenceParams params);
Set<SymbolInformation> getFilteredSymbols(String query);</BUG>
}
| Map<Location, Set<Location>> getReferences();
Set<Location> findReferences(ReferenceParams params);
Optional<Location> gotoDefinition(URI uri, Position position);
Set<SymbolInformation> getFilteredSymbols(String query);
|
8,715 | .workspaceSymbolProvider(true)
.referencesProvider(true)
.completionProvider(new CompletionOptionsBuilder()
.resolveProvider(false)
.triggerCharacter(".")
<BUG>.build())
.build();</BUG>
InitializeResult result = new InitializeResultBuilder()
.capabilities(capabilities)
.build();
| .definitionProvider(true)
|
8,716 | package com.palantir.ls.server;
import com.palantir.ls.server.api.CompilerWrapper;
import com.palantir.ls.server.api.TreeParser;
import com.palantir.ls.server.api.WorkspaceCompiler;
<BUG>import io.typefox.lsapi.FileEvent;
import io.typefox.lsapi.PublishDiagnosticsParams;</BUG>
import io.typefox.lsapi.ReferenceParams;
import io.typefox.lsapi.SymbolInformation;
import io.typefox.lsapi.TextDocumentContentChangeEvent;
| import com.google.common.base.Optional;
import io.typefox.lsapi.Location;
import io.typefox.lsapi.Position;
import io.typefox.lsapi.PublishDiagnosticsParams;
|
8,717 | chart.addYAxisLabels(AxisLabelsFactory.newAxisLabels(labels));
chart.addXAxisLabels(AxisLabelsFactory.newNumericRangeAxisLabels(0, max));
chart.setBarWidth(BarChart.AUTO_RESIZE);
chart.setSize(600, 500);
chart.setHorizontal(true);
<BUG>chart.setTitle("Total Evaluations by User");
showChartImg(resp, chart.toURLString());
}</BUG>
private List<Entry<String, Integer>> sortEntries(Collection<Entry<String, Integer>> entries) {
List<Entry<String, Integer>> result = new ArrayList<Entry<String, Integer>>(entries);
| chart.setDataEncoding(DataEncoding.TEXT);
return chart;
}
|
8,718 | checkEvaluationsEqual(eval4, foundissueProto.getEvaluations(0));
checkEvaluationsEqual(eval5, foundissueProto.getEvaluations(1));
}
public void testGetRecentEvaluationsNoneFound() throws Exception {
DbIssue issue = createDbIssue("fad", persistenceHelper);
<BUG>DbEvaluation eval1 = createEvaluation(issue, "someone", 100);
DbEvaluation eval2 = createEvaluation(issue, "someone", 200);
DbEvaluation eval3 = createEvaluation(issue, "someone", 300);
issue.addEvaluations(eval1, eval2, eval3);</BUG>
getPersistenceManager().makePersistent(issue);
| [DELETED] |
8,719 | public int read() throws IOException {
return inputStream.read();
}
});
}
<BUG>}
protected DbEvaluation createEvaluation(DbIssue issue, String who, long when) {</BUG>
DbUser user;
Query query = getPersistenceManager().newQuery("select from " + persistenceHelper.getDbUserClass().getName()
+ " where openid == :myopenid");
| @SuppressWarnings({"unchecked"})
protected DbEvaluation createEvaluation(DbIssue issue, String who, long when) {
|
8,720 | eval.setComment("my comment");
eval.setDesignation("MUST_FIX");
eval.setIssue(issue);
eval.setWhen(when);
eval.setWho(user.createKeyObject());
<BUG>eval.setEmail(who);
return eval;</BUG>
}
protected PersistenceManager getPersistenceManager() {
return testHelper.getPersistenceManager();
| issue.addEvaluation(eval);
return eval;
|
8,721 | 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.*;
|
8,722 | .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);
|
8,723 | </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) {
|
8,724 | 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)
|
8,725 | .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))
|
8,726 | .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))
|
8,727 | @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;
|
8,728 | 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;
}
|
8,729 | return configDirectory;
}
public boolean isLoaded() {
return loaded;
}
<BUG>public static Cause getCause() {
return instance().pluginCause;
}</BUG>
public EconomyService getEconomyService() {
return economyService;
| [DELETED] |
8,730 | 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.*;
|
8,731 | .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))
|
8,732 | 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) -> {
|
8,733 | 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);
|
8,734 | 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);
|
8,735 | 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() + "\"");
|
8,736 | 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() + "\"");
|
8,737 | 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
|
8,738 | .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")
|
8,739 | import jetbrains.mps.openapi.editor.cells.CellActionType;
import jetbrains.mps.editor.runtime.cells.AbstractCellAction;
import jetbrains.mps.internal.collections.runtime.ListSequence;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
<BUG>import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
public class IfStatement_LastBrace {</BUG>
public static void setCellActions(EditorCell editorCell, SNode node, EditorContext context) {
editorCell.setAction(CellActionType.DELETE, new IfStatement_LastBrace.IfStatement_LastBrace_DELETE(node));
editorCell.setAction(CellActionType.BACKSPACE, new IfStatement_LastBrace.IfStatement_LastBrace_BACKSPACE(node));
| import jetbrains.mps.editor.runtime.selection.SelectionUtil;
import jetbrains.mps.openapi.editor.selection.SelectionManager;
public class IfStatement_LastBrace {
|
8,740 | package org.jetbrains.plugins.groovy.overrideImplement;
<BUG>import com.intellij.codeInsight.generation.OverrideImplementUtil;
import com.intellij.lang.LanguageCodeInsightActionHandler;</BUG>
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiClass;
| import com.intellij.codeInsight.hint.HintManager;
import com.intellij.lang.LanguageCodeInsightActionHandler;
|
8,741 | public boolean isValidFor(Editor editor, PsiFile psiFile) {
return psiFile != null && GroovyFileType.GROOVY_FILE_TYPE.equals(psiFile.getFileType());
}
public void invoke(@NotNull final Project project, @NotNull Editor editor, @NotNull PsiFile file) {
PsiClass aClass = OverrideImplementUtil.getContextClass(project, editor, file, true);
<BUG>if (aClass != null) {
OverrideImplementUtil.chooseAndOverrideMethods(project, editor, aClass);
}</BUG>
}
| if (aClass == null) return;
if (OverrideImplementUtil.getMethodSignaturesToImplement(aClass).isEmpty()) {
HintManager.getInstance().showErrorHint(editor, "No methods to override have been found");
return;
|
8,742 | public boolean isValidFor(final Editor editor, final PsiFile file) {
return file instanceof PsiJavaFile && OverrideImplementUtil.getContextClass(file.getProject(), editor, file, true) != null;
}
public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) {
PsiClass aClass = OverrideImplementUtil.getContextClass(project, editor, file, true);
<BUG>if (aClass != null) {
OverrideImplementUtil.chooseAndOverrideMethods(project, editor, aClass);
}</BUG>
}
| if (aClass == null) return;
if (OverrideImplementUtil.getMethodSignaturesToImplement(aClass).isEmpty()) {
HintManager.getInstance().showErrorHint(editor, "No methods to override have been found");
return;
|
8,743 | package org.jetbrains.plugins.groovy.overrideImplement;
<BUG>import com.intellij.codeInsight.generation.OverrideImplementUtil;
import com.intellij.lang.LanguageCodeInsightActionHandler;</BUG>
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiClass;
| import com.intellij.codeInsight.hint.HintManager;
import com.intellij.lang.LanguageCodeInsightActionHandler;
|
8,744 | public boolean isValidFor(Editor editor, PsiFile psiFile) {
return psiFile != null && GroovyFileType.GROOVY_FILE_TYPE.equals(psiFile.getFileType());
}
public void invoke(@NotNull final Project project, @NotNull Editor editor, @NotNull PsiFile file) {
PsiClass aClass = OverrideImplementUtil.getContextClass(project, editor, file, true);
<BUG>if (aClass != null) {
OverrideImplementUtil.chooseAndImplementMethods(project, editor, aClass);
}</BUG>
}
| if (aClass == null) return;
if (OverrideImplementUtil.getMethodSignaturesToImplement(aClass).isEmpty()) {
HintManager.getInstance().showErrorHint(editor, "No methods to implement have been found");
return;
|
8,745 | EditorCell_Collection result = jetbrains.mps.nodeEditor.cells.EditorCell_Collection.createIndent2(editorContext, node);
result.setBig(true);
result.getStyle().putAll(StyleRegistry.getInstance().getStyle("LINE_COMMENT"), 1);
result.addEditorCell(createCommentConstantCell(editorContext, node, true));
result.addEditorCell(mainCell);
<BUG>result.addEditorCell(createCommentConstantCell(editorContext, node, false));
return result;</BUG>
}
private EditorCell_Constant createCommentConstantCell(jetbrains.mps.openapi.editor.EditorContext editorContext, SNode node, boolean left) {
EditorCell_Constant cell = new EditorCell_Constant(editorContext, node, left ? "/*" : "*/", false);
| result.setCellId("main_comment_collection");
return result;
|
8,746 | }
private EditorCell_Constant createCommentConstantCell(jetbrains.mps.openapi.editor.EditorContext editorContext, SNode node, boolean left) {
EditorCell_Constant cell = new EditorCell_Constant(editorContext, node, left ? "/*" : "*/", false);
StyleImpl style = new StyleImpl();
style.set(left ? StyleAttributes.PUNCTUATION_RIGHT : StyleAttributes.PUNCTUATION_LEFT, 0, true);
<BUG>cell.getStyle().putAll(style, 0);
return cell;</BUG>
}
@Override
public EditorCell createInspectedCell(jetbrains.mps.openapi.editor.EditorContext editorContext, SNode node) {
| cell.setCellId(left ? "left_comment_constant" : "right_comment_constant");
return cell;
|
8,747 | import org.jetbrains.annotations.NotNull;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
import jetbrains.mps.openapi.editor.EditorContext;
import jetbrains.mps.openapi.editor.selection.Selection;
import jetbrains.mps.openapi.editor.selection.SingularSelection;
<BUG>import jetbrains.mps.openapi.editor.cells.EditorCell;
import jetbrains.mps.nodeEditor.cells.CellFinderUtil;</BUG>
import org.jetbrains.mps.util.Condition;
import jetbrains.mps.editor.runtime.selection.SelectionUtil;
import jetbrains.mps.openapi.editor.selection.SelectionManager;
| import jetbrains.mps.openapi.editor.cells.EditorCell_Label;
import jetbrains.mps.nodeEditor.cells.CellFinderUtil;
|
8,748 | import jetbrains.mps.editor.runtime.cells.AbstractCellAction;
import org.jetbrains.mps.openapi.model.SNode;
import org.jetbrains.annotations.NotNull;
import jetbrains.mps.openapi.editor.EditorContext;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
<BUG>import jetbrains.mps.openapi.editor.cells.EditorCell;
import jetbrains.mps.nodeEditor.cells.CellFinderUtil;</BUG>
import org.jetbrains.mps.util.Condition;
import jetbrains.mps.editor.runtime.selection.SelectionUtil;
import jetbrains.mps.openapi.editor.selection.SelectionManager;
| import jetbrains.mps.openapi.editor.cells.EditorCell_Label;
import jetbrains.mps.nodeEditor.cells.CellFinderUtil;
|
8,749 | import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Constructor;
import java.util.stream.Stream;
import java.lang.reflect.Modifier;
<BUG>import java.util.function.Predicate;
public final class Extractors {</BUG>
private Extractors() {
throw new UnsupportedOperationException("don't instantiate");
}
| import static org.eclipse.golo.runtime.TypeMatching.argumentsNumberMatches;
import static org.eclipse.golo.runtime.DecoratorsHelper.isMethodDecorated;
public final class Extractors {
|
8,750 | return PRIMITIVE_MAP.get(type) == value.getClass();
}
public static boolean isLastArgumentAnArray(int index, Object[] args) {
return index > 0 && args.length == index && args[index - 1] instanceof Object[];
}
<BUG>private static boolean argumentsNumberMatches(int paramsNumber, int argsNumber, boolean isVarArgs) {
return (!isVarArgs && paramsNumber == argsNumber) || (isVarArgs && argsNumber >= paramsNumber - 1);
}</BUG>
public static boolean argumentsMatch(Method method, Object[] arguments) {
| public static boolean argumentsNumberMatches(int paramsNumber, int argsNumber, boolean isVarArgs) {
return argsNumber < 0
|| (!isVarArgs && paramsNumber == argsNumber)
|
8,751 | Object[] args = Modifier.isStatic(method.getModifiers())
? arguments
: copyOfRange(arguments, 1, arguments.length);
return
isMethodDecorated(method)
<BUG>|| (argumentsNumberMatches(method.getParameterTypes().length, args.length, varargs)
</BUG>
&& canAssign(method.getParameterTypes(), args, varargs));
}
public static boolean argumentsMatch(Constructor<?> constructor, Object[] arguments) {
| || (argumentsNumberMatches(method.getParameterCount(), args.length, varargs)
|
8,752 | </BUG>
&& canAssign(method.getParameterTypes(), args, varargs));
}
public static boolean argumentsMatch(Constructor<?> constructor, Object[] arguments) {
return
<BUG>argumentsNumberMatches(constructor.getParameterTypes().length, arguments.length, constructor.isVarArgs())
</BUG>
&& canAssign(constructor.getParameterTypes(), arguments, constructor.isVarArgs());
}
public static boolean returnsValue(Method m) {
| Object[] args = Modifier.isStatic(method.getModifiers())
? arguments
: copyOfRange(arguments, 1, arguments.length);
isMethodDecorated(method)
|| (argumentsNumberMatches(method.getParameterCount(), args.length, varargs)
argumentsNumberMatches(constructor.getParameterCount(), arguments.length, constructor.isVarArgs())
|
8,753 | public final class Loader implements Function<String, Class<?>> {
private final ClassLoader loader;
Loader(ClassLoader loader) {
this.loader = loader;
}
<BUG>static Loader forClass(Class<?> klass) {
</BUG>
return new Loader(klass.getClassLoader());
}
public Class<?> load(String name) {
| public static Loader forClass(Class<?> klass) {
|
8,754 | 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.*;
|
8,755 | .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);
|
8,756 | </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) {
|
8,757 | 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)
|
8,758 | .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))
|
8,759 | .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))
|
8,760 | @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;
|
8,761 | 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;
}
|
8,762 | return configDirectory;
}
public boolean isLoaded() {
return loaded;
}
<BUG>public static Cause getCause() {
return instance().pluginCause;
}</BUG>
public EconomyService getEconomyService() {
return economyService;
| [DELETED] |
8,763 | 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.*;
|
8,764 | .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))
|
8,765 | 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) -> {
|
8,766 | 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);
|
8,767 | 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);
|
8,768 | 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() + "\"");
|
8,769 | 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() + "\"");
|
8,770 | 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
|
8,771 | .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")
|
8,772 | for (String column: columns) {
if (match = tve.getColumnName().equals(column)) {
break;
}
}
<BUG>assertTrue(match == true);
}</BUG>
}
private void checkIndexPredicateDoesNotHave(AbstractPlanNode pn, String[] columns)
{
| assertEquals(true, match);
|
8,773 | this.myOutputFileDelta = new FilesDelta(myModelOutputDir, myModelCacheOutputDir);
this.myCachesFileDelta = new FilesDelta(myModelCacheOutputDir);
}
public void saveStream(String name, String content, boolean isCache) {
IFile file = getFile(name, isCache);
<BUG>myProcessor.saveContent(file, content);
mySavedFiles.add(file);
getDelta(isCache).written(file);
}</BUG>
public void saveStream(String name, Element content, boolean isCache) {
| [DELETED] |
8,774 | mySavedFiles.add(file);
getDelta(isCache).written(file);
}</BUG>
public void saveStream(String name, Element content, boolean isCache) {
IFile file = getFile(name, isCache);
<BUG>myProcessor.saveContent(file, content);
mySavedFiles.add(file);
getDelta(isCache).written(file);
}</BUG>
public void saveStream(String name, byte[] content, boolean isCache) {
| if (myProcessor.saveContent(file, content)) {
} else {
getDelta(isCache).kept(file);
}
}
|
8,775 | mySavedFiles.add(file);
getDelta(isCache).written(file);
}</BUG>
public void saveStream(String name, byte[] content, boolean isCache) {
IFile file = getFile(name, isCache);
<BUG>myProcessor.saveContent(file, content);
mySavedFiles.add(file);
getDelta(isCache).written(file);
}</BUG>
public boolean touch(String name, boolean isCache) {
| if (myProcessor.saveContent(file, content)) {
} else {
getDelta(isCache).kept(file);
}
}
public void saveStream(String name, Element content, boolean isCache) {
|
8,776 | package jetbrains.mps.lang.quotation.helgins;
import jetbrains.mps.bootstrap.helgins.runtime.NonTypesystemRule_Runtime;
<BUG>import jetbrains.mps.smodel.SNode;
import jetbrains.mps.bootstrap.smodelLanguage.generator.smodelAdapter.SNodeOperations;</BUG>
import jetbrains.mps.smodel.SModelUtil_new;
import jetbrains.mps.bootstrap.smodelLanguage.generator.smodelAdapter.SLinkOperations;
import jetbrains.mps.intentions.BaseIntentionProvider;
| import jetbrains.mps.bootstrap.helgins.runtime.AbstractNonTypesystemRule_Runtime;
import jetbrains.mps.helgins.inference.TypeCheckingContext;
import jetbrains.mps.bootstrap.smodelLanguage.generator.smodelAdapter.SNodeOperations;
|
8,777 | package jetbrains.mps.lang.quotation.helgins;
import jetbrains.mps.bootstrap.helgins.runtime.NonTypesystemRule_Runtime;
<BUG>import jetbrains.mps.smodel.SNode;
import jetbrains.mps.bootstrap.smodelLanguage.generator.smodelAdapter.SNodeOperations;</BUG>
import jetbrains.mps.smodel.SModelUtil_new;
import jetbrains.mps.bootstrap.smodelLanguage.generator.smodelAdapter.SLinkOperations;
import jetbrains.mps.intentions.BaseIntentionProvider;
| import jetbrains.mps.bootstrap.helgins.runtime.AbstractNonTypesystemRule_Runtime;
import jetbrains.mps.helgins.inference.TypeCheckingContext;
import jetbrains.mps.bootstrap.smodelLanguage.generator.smodelAdapter.SNodeOperations;
|
8,778 | import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.BorderFactory;
<BUG>import javax.swing.JCheckBox;
import javax.swing.JPanel;
import javax.swing.JTextField;</BUG>
import org.apache.commons.lang3.StringUtils;
import org.apache.jmeter.config.ConfigTestElement;
| import javax.swing.JComboBox;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
|
8,779 | });
concurrentDwn = new JCheckBox(JMeterUtils.getResString("web_testing_concurrent_download")); // $NON-NLS-1$
concurrentDwn.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(final ItemEvent e) {
<BUG>if (imageParser.isSelected() && e.getStateChange() == ItemEvent.SELECTED) { concurrentPool.setEnabled(true); }
</BUG>
else { concurrentPool.setEnabled(false); }
}
});
| if (retrieveEmbeddedResources.isSelected() && e.getStateChange() == ItemEvent.SELECTED) { concurrentPool.setEnabled(true); }
|
8,780 | concurrentDwn.setEnabled(false);
concurrentPool.setEnabled(false);
embeddedRE.setEnabled(false);
}
}
<BUG>public void itemStateChanged(final ItemEvent event) {
if (event.getStateChange() == ItemEvent.SELECTED) {
enableConcurrentDwn(true);
} else {
enableConcurrentDwn(false);</BUG>
}
| [DELETED] |
8,781 | 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 {
|
8,782 | 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));
|
8,783 | } 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()
|
8,784 |
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));
|
8,785 | 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));
|
8,786 | 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 {
|
8,787 | 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);
|
8,788 | CHEVRON_RIGHT ("chevron-right", "png", false, false),
CHEVRON_LEFT ("chevron-left", "png", false, false),
SEARCH ("search", "png", false, false),
CONTROL_SLIDER_BALL ("control-sliderball", "png", false, false),
CONTROL_CHECK_ON ("control-check-on", "png", false, false),
<BUG>CONTROL_CHECK_OFF ("control-check-off", "png", false, false),
ALPHA_MAP ("alpha", "png", false, false);</BUG>
private static final byte
IMG_PNG = 1,
IMG_JPG = 2;
| USER ("user", "user%d", "png", false, false),
ALPHA_MAP ("alpha", "png", false, false);
|
8,789 | GameImage(String filename, String type, boolean beatmapSkinnable, boolean preload) {
this.filename = filename;
this.type = getType(type);
this.beatmapSkinnable = beatmapSkinnable;
this.preload = preload;
<BUG>}
public boolean isBeatmapSkinnable() { return beatmapSkinnable; }</BUG>
public boolean isPreload() { return preload; }
public Image getImage() {
setDefaultImage();
| GameImage(String filename, String filenameFormat, String type, boolean beatmapSkinnable, boolean preload) {
this(filename, type, beatmapSkinnable, preload);
this.filenameFormat = filenameFormat;
public boolean isBeatmapSkinnable() { return beatmapSkinnable; }
|
8,790 | g.drawRect(0, yPos, rectWidth, rectHeight);
g.setLineWidth(oldLineWidth);
data.drawSymbolString(rankString, rectWidth, yPos, 1.0f, alpha * 0.2f, true);
white.a = blue.a = alpha * 0.75f;
if (playerName != null)
<BUG>Fonts.MEDIUMBOLD.drawString(xPaddingLeft, yPos + yPadding, playerName, white);
Fonts.DEFAULT.drawString(</BUG>
xPaddingLeft, yPos + rectHeight - Fonts.DEFAULT.getLineHeight() - yPadding, scoreString, white
);
Fonts.DEFAULT.drawString(
| Fonts.MEDIUM.drawString(xPaddingLeft, yPos + yPadding, playerName, white);
|
8,791 | int objectCount = hit300 + hit100 + hit50 + miss;
if (objectCount > 0)
percent = (hit300 * 300 + hit100 * 100 + hit50 * 50) / (objectCount * 300f) * 100f;
return percent;
}
<BUG>private float getScorePercent() {
</BUG>
return getScorePercent(
hitResultCount[HIT_300], hitResultCount[HIT_100],
hitResultCount[HIT_50], hitResultCount[HIT_MISS]
| public float getScorePercent() {
|
8,792 | sd.score = slidingScore ? scoreDisplay : score;
sd.combo = comboMax;
sd.perfect = (comboMax == fullObjectCount);
sd.mods = GameMod.getModState();
sd.replayString = (replay == null) ? null : replay.getReplayFilename();
<BUG>sd.playerName = null; // TODO
return sd;</BUG>
}
public Replay getReplay(ReplayFrame[] frames, Beatmap beatmap) {
if (replay != null && frames == null)
| sd.playerName = GameMod.AUTO.isActive() ?
UserList.AUTO_USER_NAME : UserList.get().getCurrentUser().getName();
return sd;
|
8,793 | return null;
replay = new Replay();
replay.mode = Beatmap.MODE_OSU;
replay.version = Updater.get().getBuildDate();
replay.beatmapHash = (beatmap == null) ? "" : beatmap.md5Hash;
<BUG>replay.playerName = ""; // TODO
replay.replayHash = Long.toString(System.currentTimeMillis()); // TODO</BUG>
replay.hit300 = (short) hitResultCount[HIT_300];
replay.hit100 = (short) hitResultCount[HIT_100];
replay.hit50 = (short) hitResultCount[HIT_50];
| replay.playerName = UserList.get().getCurrentUser().getName();
replay.replayHash = Long.toString(System.currentTimeMillis()); // TODO
|
8,794 | import itdelatrisu.opsu.downloads.Download;
import itdelatrisu.opsu.downloads.DownloadNode;
import itdelatrisu.opsu.replay.PlaybackSpeed;
import itdelatrisu.opsu.ui.Colors;
import itdelatrisu.opsu.ui.Fonts;
<BUG>import itdelatrisu.opsu.ui.UI;
import java.awt.image.BufferedImage;</BUG>
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.File;
| import itdelatrisu.opsu.user.UserButton;
import itdelatrisu.opsu.user.UserList;
import java.awt.image.BufferedImage;
|
8,795 | typeDescriptorCache.put(String.class, new TypeDescriptor(String.class));
}
private Class<?> type;
private MethodParameter methodParameter;
private Field field;
<BUG>private Object value;
public TypeDescriptor(MethodParameter methodParameter) {</BUG>
Assert.notNull(methodParameter, "MethodParameter must not be null");
this.methodParameter = methodParameter;
}
| private TypeDescriptor elementType;
private TypeDescriptor mapKeyType;
private TypeDescriptor mapValueType;
public TypeDescriptor(MethodParameter methodParameter) {
|
8,796 | EditorCell_Collection result = jetbrains.mps.nodeEditor.cells.EditorCell_Collection.createIndent2(editorContext, node);
result.setBig(true);
result.getStyle().putAll(StyleRegistry.getInstance().getStyle("LINE_COMMENT"), 1);
result.addEditorCell(createCommentConstantCell(editorContext, node, true));
result.addEditorCell(mainCell);
<BUG>result.addEditorCell(createCommentConstantCell(editorContext, node, false));
return result;</BUG>
}
private EditorCell_Constant createCommentConstantCell(jetbrains.mps.openapi.editor.EditorContext editorContext, SNode node, boolean left) {
EditorCell_Constant cell = new EditorCell_Constant(editorContext, node, left ? "/*" : "*/", false);
| result.setCellId("main_comment_collection");
return result;
|
8,797 | }
private EditorCell_Constant createCommentConstantCell(jetbrains.mps.openapi.editor.EditorContext editorContext, SNode node, boolean left) {
EditorCell_Constant cell = new EditorCell_Constant(editorContext, node, left ? "/*" : "*/", false);
StyleImpl style = new StyleImpl();
style.set(left ? StyleAttributes.PUNCTUATION_RIGHT : StyleAttributes.PUNCTUATION_LEFT, 0, true);
<BUG>cell.getStyle().putAll(style, 0);
return cell;</BUG>
}
@Override
public EditorCell createInspectedCell(jetbrains.mps.openapi.editor.EditorContext editorContext, SNode node) {
| cell.setCellId(left ? "left_comment_constant" : "right_comment_constant");
return cell;
|
8,798 | import org.jetbrains.annotations.NotNull;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
import jetbrains.mps.openapi.editor.EditorContext;
import jetbrains.mps.openapi.editor.selection.Selection;
import jetbrains.mps.openapi.editor.selection.SingularSelection;
<BUG>import jetbrains.mps.openapi.editor.cells.EditorCell;
import jetbrains.mps.nodeEditor.cells.CellFinderUtil;</BUG>
import org.jetbrains.mps.util.Condition;
import jetbrains.mps.editor.runtime.selection.SelectionUtil;
import jetbrains.mps.openapi.editor.selection.SelectionManager;
| import jetbrains.mps.openapi.editor.cells.EditorCell_Label;
import jetbrains.mps.nodeEditor.cells.CellFinderUtil;
|
8,799 | import jetbrains.mps.editor.runtime.cells.AbstractCellAction;
import org.jetbrains.mps.openapi.model.SNode;
import org.jetbrains.annotations.NotNull;
import jetbrains.mps.openapi.editor.EditorContext;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
<BUG>import jetbrains.mps.openapi.editor.cells.EditorCell;
import jetbrains.mps.nodeEditor.cells.CellFinderUtil;</BUG>
import org.jetbrains.mps.util.Condition;
import jetbrains.mps.editor.runtime.selection.SelectionUtil;
import jetbrains.mps.openapi.editor.selection.SelectionManager;
| import jetbrains.mps.openapi.editor.cells.EditorCell_Label;
import jetbrains.mps.nodeEditor.cells.CellFinderUtil;
|
8,800 | if(worldIn.getTileEntity(pos) != null){
TileEntity te = worldIn.getTileEntity(pos);
if(te.hasCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null) && te.getCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null).getTemp() >= -273D + mult){
te.getCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null).addHeat(-mult);
}
<BUG>for(EnumFacing dir : EnumFacing.values()){
if(te.hasCapability(Capabilities.ROTARY_HANDLER_CAPABILITY, dir)){
te.getCapability(Capabilities.ROTARY_HANDLER_CAPABILITY, dir).addEnergy(-mult, false, false);
break;</BUG>
}
| if(te.hasCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null)){
te.getCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null).addHeat(mult);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.