id
int64 1
49k
| buggy
stringlengths 34
37.5k
| fixed
stringlengths 2
37k
|
---|---|---|
901 | public void init()
{
minecraftbyexample.mbe70_configuration.StartupCommon.initCommon();
minecraftbyexample.mbe01_block_simple.StartupCommon.initCommon();
minecraftbyexample.mbe02_block_partial.StartupCommon.initCommon();
<BUG>minecraftbyexample.mbe03_block_variants.StartupCommon.initCommon();
minecraftbyexample.mbe08_creative_tab.StartupCommon.initCommon();</BUG>
minecraftbyexample.mbe10_item_simple.StartupCommon.initCommon();
minecraftbyexample.mbe11_item_variants.StartupCommon.initCommon();
minecraftbyexample.mbe12_item_nbt_animate.StartupCommon.initCommon();
| minecraftbyexample.mbe06_redstone.StartupCommon.initCommon();
minecraftbyexample.mbe08_creative_tab.StartupCommon.initCommon();
|
902 | public void postInit()
{
minecraftbyexample.mbe70_configuration.StartupCommon.postInitCommon();
minecraftbyexample.mbe01_block_simple.StartupCommon.postInitCommon();
minecraftbyexample.mbe02_block_partial.StartupCommon.postInitCommon();
<BUG>minecraftbyexample.mbe03_block_variants.StartupCommon.postInitCommon();
minecraftbyexample.mbe08_creative_tab.StartupCommon.postInitCommon();</BUG>
minecraftbyexample.mbe10_item_simple.StartupCommon.postInitCommon();
minecraftbyexample.mbe11_item_variants.StartupCommon.postInitCommon();
minecraftbyexample.mbe12_item_nbt_animate.StartupCommon.postInitCommon();
| minecraftbyexample.mbe06_redstone.StartupCommon.postInitCommon();
minecraftbyexample.mbe08_creative_tab.StartupCommon.postInitCommon();
|
903 | package minecraftbyexample.mbe06_redstone;
import minecraftbyexample.mbe06_redstone.input_and_output.TileEntityRedstoneMeter;
import minecraftbyexample.mbe06_redstone.input_and_output.TileEntitySpecialRendererRedstoneMeter;
import net.minecraft.client.Minecraft;
<BUG>import net.minecraft.client.resources.model.ModelResourceLocation;
</BUG>
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.client.registry.ClientRegistry;
| import minecraftbyexample.mbe06_redstone.input.LampColour;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
904 | import forestry.api.genetics.ISpeciesRoot;
import forestry.api.lepidopterology.IButterflyRoot;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.event.world.WorldEvent;
<BUG>import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import java.util.ArrayList;</BUG>
import java.util.Collection;
import java.util.Comparator;
import java.util.LinkedHashMap;
| import javax.annotation.Nullable;
import java.util.ArrayList;
|
905 | public IButterflyRoot getButterflyRoot() {
return (IButterflyRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootButterflies");
}
public IFlowerRoot getFlowerRoot() {
return (IFlowerRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootFlowers");
<BUG>}
public BreedingSystem getSystem(final String string) {</BUG>
for (final BreedingSystem system : this.BREEDING_SYSTEMS.values()) {
if (system.getIdent().equals(string)) {
return system;
| @Nullable
public BreedingSystem getSystem(final String string) {
|
906 | if (system.getIdent().equals(string)) {
return system;
}
}
return null;
<BUG>}
public BreedingSystem getSystem(final ISpeciesRoot root) {</BUG>
return this.getSystem(root.getUID());
}
public ISpeciesRoot getSpeciesRoot(final IAlleleSpecies species) {
| @Nullable
public BreedingSystem getSystem(final ISpeciesRoot root) {
|
907 | import binnie.genetics.api.IItemChargeable;
import binnie.genetics.integration.jei.incubator.IncubatorRecipeCategory;
import binnie.genetics.integration.jei.incubator.IncubatorRecipeHandler;
import binnie.genetics.integration.jei.incubator.LarvaeIncubatorRecipeCategory;
import binnie.genetics.integration.jei.incubator.LarvaeIncubatorRecipeMaker;
<BUG>import binnie.genetics.integration.jei.incubator.LarvaeIncubatorRecipeWrapper;
import binnie.genetics.integration.jei.isolator.IsolatorRecipeCategory;</BUG>
import binnie.genetics.integration.jei.isolator.IsolatorRecipeMaker;
import binnie.genetics.integration.jei.isolator.IsolatorRecipeWrapper;
import binnie.genetics.integration.jei.polymeriser.PolymeriserRecipeCategory;
| import binnie.genetics.integration.jei.inoculator.InoculatorRecipeCategory;
import binnie.genetics.integration.jei.inoculator.InoculatorRecipeMaker;
import binnie.genetics.integration.jei.inoculator.InoculatorRecipeWrapper;
import binnie.genetics.integration.jei.isolator.IsolatorRecipeCategory;
|
908 | registry.addRecipeCategories(
new IncubatorRecipeCategory(),
new LarvaeIncubatorRecipeCategory(),
new IsolatorRecipeCategory(),
new PolymeriserRecipeCategory(),
<BUG>new SequencerRecipeCategory()
);</BUG>
registry.addRecipeHandlers(
new IncubatorRecipeHandler(),
| new SequencerRecipeCategory(),
new InoculatorRecipeCategory()
);
|
909 | registry.addRecipeHandlers(
new IncubatorRecipeHandler(),
new SimpleRecipeHandler<>(LarvaeIncubatorRecipeWrapper.class, RecipeUids.INCUBATOR_LARVAE),
new SimpleRecipeHandler<>(IsolatorRecipeWrapper.class, RecipeUids.ISOLATOR),
new SimpleRecipeHandler<>(PolymeriserRecipeWrapper.class, RecipeUids.POLYMERISER),
<BUG>new SimpleRecipeHandler<>(SequencerRecipeWrapper.class, RecipeUids.SEQUENCER)
);</BUG>
registry.addRecipeCategoryCraftingItem(LaboratoryMachine.Incubator.get(1), RecipeUids.INCUBATOR, RecipeUids.INCUBATOR_LARVAE);
registry.addRecipeCategoryCraftingItem(GeneticMachine.Isolator.get(1), RecipeUids.ISOLATOR);
| new SimpleRecipeHandler<>(SequencerRecipeWrapper.class, RecipeUids.SEQUENCER),
new SimpleRecipeHandler<>(InoculatorRecipeWrapper.class, RecipeUids.INOCULATOR)
|
910 | import binnie.genetics.item.ItemSequence;
import binnie.genetics.item.ItemSerum;
import binnie.genetics.item.ItemSerumArray;
import binnie.genetics.item.ModuleItem;
import binnie.genetics.machine.ModuleMachine;
<BUG>import binnie.genetics.proxy.Proxy;
import net.minecraft.item.Item;</BUG>
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
| import com.google.common.base.Preconditions;
import net.minecraft.item.Item;
|
911 | @Mod.Instance(Constants.GENETICS_MOD_ID)
public static Genetics instance;
@SidedProxy(clientSide = "binnie.genetics.proxy.ProxyClient", serverSide = "binnie.genetics.proxy.ProxyServer")
public static Proxy proxy;
public static String channel = "GEN";
<BUG>public static Item itemGenetics;
</BUG>
public static ItemSerum itemSerum;
public static ItemSequence itemSequencer;
public static MachineGroup packageGenetic;
| private static Item itemGenetics;
|
912 | return false;
}
if (stack.getItem() instanceof IItemSerum) {
return ((IItemSerum) stack.getItem()).getCharges(stack) == 0;
}
<BUG>return stack.getItem() == Genetics.itemGenetics && (stack.getItemDamage() == GeneticsItems.EmptySerum.ordinal() || stack.getItemDamage() == GeneticsItems.EmptyGenome.ordinal());
</BUG>
}
public static boolean canAcceptGene(final ItemStack stack, final IGene gene) {
if (stack.getItem() instanceof ItemSerum) {
| return stack.getItem() == Genetics.getItemGenetics() && (stack.getItemDamage() == GeneticsItems.EmptySerum.ordinal() || stack.getItemDamage() == GeneticsItems.EmptyGenome.ordinal());
|
913 | import org.apache.camel.impl.DefaultCamelContext;
final class CdiCamelContextBean implements Bean<DefaultCamelContext>, PassivationCapable {
private final Set<Annotation> qualifiers;
private final Set<Type> types;
private final InjectionTarget<DefaultCamelContext> target;
<BUG>CdiCamelContextBean(BeanManager manager, InjectionTarget<DefaultCamelContext> target) {
this.qualifiers = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(AnyLiteral.INSTANCE, DefaultLiteral.INSTANCE)));
this.types = Collections.unmodifiableSet(manager.createAnnotatedType(DefaultCamelContext.class).getTypeClosure());
this.target = target;</BUG>
}
| CdiCamelContextBean(CdiCamelContextAnnotated annotated, InjectionTarget<DefaultCamelContext> target) {
this.qualifiers = annotated.getAnnotations();
this.types = annotated.getTypeClosure();
this.target = target;
|
914 | package org.apache.camel.cdi;
import java.beans.Introspector;
import java.lang.annotation.Annotation;
<BUG>import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;</BUG>
import java.util.Set;
import javax.enterprise.context.spi.CreationalContext;
| [DELETED] |
915 | this.extension = extension;
}
@Override
public T produce(CreationalContext<T> ctx) {
T context = super.produce(ctx);
<BUG>if (annotated != null && context.getNameStrategy() instanceof DefaultCamelContextNameStrategy) {
context.setNameStrategy(nameStrategy(annotated));</BUG>
}
if (context instanceof DefaultCamelContext) {
DefaultCamelContext adapted = context.adapt(DefaultCamelContext.class);
| if (context.getNameStrategy() instanceof DefaultCamelContextNameStrategy) {
context.setNameStrategy(nameStrategy(annotated));
|
916 | adapted.setRegistry(new CdiCamelRegistry(manager));
adapted.setInjector(new CdiCamelInjector(context.getInjector(), manager));
} else {
throw new InjectionException("Camel CDI requires Camel context [" + context.getName() + "] to be a subtype of DefaultCamelContext");
}
<BUG>Set<Annotation> events = new HashSet<>(extension.getObserverEvents());
Collection<Annotation> qualifiers = annotated != null ? extension.getContextBean(new AnnotatedWrapper(annotated)).getQualifiers() : Arrays.asList(AnyLiteral.INSTANCE, DefaultLiteral.INSTANCE);
events.retainAll(qualifiers);
if (!events.isEmpty()) {
</BUG>
context.getManagementStrategy().addEventNotifier(new CdiEventNotifier(manager, qualifiers));
| Set<Annotation> qualifiers = CdiSpiHelper.excludeElementOfTypes(CdiSpiHelper.getQualifiers(annotated, manager), Named.class);
qualifiers.add(AnyLiteral.INSTANCE);
if (qualifiers.size() == 1) {
qualifiers.add(DefaultLiteral.INSTANCE);
qualifiers.retainAll(extension.getObserverEvents());
if (!qualifiers.isEmpty()) {
|
917 | ForwardingObserverMethod<?> getObserverMethod(InjectionPoint ip) {
return cdiEventEndpoints.get(ip);
}
Set<Annotation> getObserverEvents() {
return eventQualifiers;
<BUG>}
Bean<?> getContextBean(Annotated annotated) {
return contextBeans.get(annotated);</BUG>
}
Set<Annotation> getContextQualifiers() {
| [DELETED] |
918 | private CdiSpiHelper() {
}
static <T extends Annotation> T getQualifierByType(InjectionPoint ip, Class<T> type) {
return getFirstElementOfType(ip.getQualifiers(), type);
}
<BUG>private static <E, T extends E> T getFirstElementOfType(Collection<E> collection, Class<T> type) {
for (E item : collection) {</BUG>
if ((item != null) && type.isAssignableFrom(item.getClass())) {
return ObjectHelper.cast(type, item);
}
| for (E item : collection) {
|
919 | import javax.enterprise.inject.spi.InjectionTarget;
import org.apache.camel.impl.DefaultCamelContext;
@Vetoed
final class CamelContextDefaultProducer implements InjectionTarget<DefaultCamelContext> {
@Override
<BUG>public DefaultCamelContext produce(CreationalContext<DefaultCamelContext> ctx) {
DefaultCamelContext context = new DefaultCamelContext();
context.setNameStrategy(new CdiCamelContextNameStrategy());
return context;</BUG>
}
| [DELETED] |
920 | import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
public class DependencyConvergenceReport
extends AbstractProjectInfoReport
<BUG>{
private List reactorProjects;
private static final int PERCENTAGE = 100;</BUG>
public String getOutputName()
{
| private static final int PERCENTAGE = 100;
private static final List SUPPORTED_FONT_FAMILY_NAMES = Arrays.asList( GraphicsEnvironment
.getLocalGraphicsEnvironment().getAvailableFontFamilyNames() );
|
921 | sink.section1();
sink.sectionTitle1();
sink.text( getI18nString( locale, "title" ) );
sink.sectionTitle1_();
Map dependencyMap = getDependencyMap();
<BUG>generateLegend( locale, sink );
generateStats( locale, sink, dependencyMap );
generateConvergence( locale, sink, dependencyMap );
sink.section1_();</BUG>
sink.body_();
| sink.lineBreak();
sink.section1_();
|
922 | Iterator it = artifactMap.keySet().iterator();
while ( it.hasNext() )
{
String version = (String) it.next();
sink.tableRow();
<BUG>sink.tableCell();
sink.text( version );</BUG>
sink.tableCell_();
sink.tableCell();
generateVersionDetails( sink, artifactMap, version );
| sink.tableCell( String.valueOf( cellWidth ) + "px" );
sink.text( version );
|
923 | sink.tableCell();
sink.text( getI18nString( locale, "legend.shared" ) );
sink.tableCell_();
sink.tableRow_();
sink.tableRow();
<BUG>sink.tableCell();
iconError( sink );</BUG>
sink.tableCell_();
sink.tableCell();
sink.text( getI18nString( locale, "legend.different" ) );
| sink.tableCell( "15px" ); // according /images/icon_error_sml.gif
iconError( sink );
|
924 | 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_();
|
925 | 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_();
|
926 | 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_();
|
927 | {
ReverseDependencyLink p1 = (ReverseDependencyLink) o1;
ReverseDependencyLink p2 = (ReverseDependencyLink) o2;
return p1.getProject().getId().compareTo( p2.getProject().getId() );
}
<BUG>else
{</BUG>
return 0;
}
}
| iconError( sink );
|
928 | } catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
public void schedule(BiConsumer<Backend, Consumer<Backend>> annotate) {
<BUG>queueLock.lock();
</BUG>
try {
queue.add(annotate);
enqueued.signal();
| stateLock.lock();
|
929 | </BUG>
try {
queue.add(annotate);
enqueued.signal();
} finally {
<BUG>queueLock.unlock();
</BUG>
}
}
} // end static class BackEndScheduler
| } catch (InterruptedException e) {
throw new RuntimeException(e);
public void schedule(BiConsumer<Backend, Consumer<Backend>> annotate) {
stateLock.lock();
stateLock.unlock();
|
930 | this.apiKey = apiKey;
this.apiSecret = apiSecret;
serverProperties.setProperty("inputFormat", "serialized");
serverProperties.setProperty("outputFormat", "serialized");
serverProperties.setProperty("inputSerializer", ProtobufAnnotationSerializer.class.getName());
<BUG>serverProperties.setProperty("outputSerializer", ProtobufAnnotationSerializer.class.getName());
List<String> jsonProperties = new ArrayList<>();
for (String key : serverProperties.stringPropertyNames()) {
jsonProperties.add('"' + JSONOutputter.cleanJSON(key) + "\": \"" +
JSONOutputter.cleanJSON(serverProperties.getProperty(key)) + '"');
}
this.propsAsJSON = "{ " + StringUtils.join(jsonProperties, ", ") + " }";</BUG>
this.scheduler.start();
| List<String> jsonProperties = serverProperties.stringPropertyNames().stream().map(key -> '"' + JSONOutputter.cleanJSON(key) + "\": \"" +
JSONOutputter
.cleanJSON(serverProperties.getProperty(key)) + '"')
.collect(Collectors.toList());
this.propsAsJSON = "{ " + StringUtils.join(jsonProperties, ", ") + " }";
|
931 | String helpValue = hasH ? props.getProperty("h") : props.getProperty("help");
StanfordCoreNLP.printHelp(System.err, helpValue);
return;
}
List<Backend> backends = new ArrayList<>();
<BUG>String defaultBack = "corenlp.run";
String backStr = props.getProperty("backends");</BUG>
if (backStr == null) {
String host = props.getProperty("host");
String port = props.getProperty("port");
| String defaultBack = "http://localhost:9000";
String backStr = props.getProperty("backends");
|
932 | import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
public class DependencyConvergenceReport
extends AbstractProjectInfoReport
<BUG>{
private List reactorProjects;
private static final int PERCENTAGE = 100;</BUG>
public String getOutputName()
{
| private static final int PERCENTAGE = 100;
private static final List SUPPORTED_FONT_FAMILY_NAMES = Arrays.asList( GraphicsEnvironment
.getLocalGraphicsEnvironment().getAvailableFontFamilyNames() );
|
933 | sink.section1();
sink.sectionTitle1();
sink.text( getI18nString( locale, "title" ) );
sink.sectionTitle1_();
Map dependencyMap = getDependencyMap();
<BUG>generateLegend( locale, sink );
generateStats( locale, sink, dependencyMap );
generateConvergence( locale, sink, dependencyMap );
sink.section1_();</BUG>
sink.body_();
| sink.lineBreak();
sink.section1_();
|
934 | Iterator it = artifactMap.keySet().iterator();
while ( it.hasNext() )
{
String version = (String) it.next();
sink.tableRow();
<BUG>sink.tableCell();
sink.text( version );</BUG>
sink.tableCell_();
sink.tableCell();
generateVersionDetails( sink, artifactMap, version );
| sink.tableCell( String.valueOf( cellWidth ) + "px" );
sink.text( version );
|
935 | sink.tableCell();
sink.text( getI18nString( locale, "legend.shared" ) );
sink.tableCell_();
sink.tableRow_();
sink.tableRow();
<BUG>sink.tableCell();
iconError( sink );</BUG>
sink.tableCell_();
sink.tableCell();
sink.text( getI18nString( locale, "legend.different" ) );
| sink.tableCell( "15px" ); // according /images/icon_error_sml.gif
iconError( sink );
|
936 | 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_();
|
937 | 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_();
|
938 | 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_();
|
939 | {
ReverseDependencyLink p1 = (ReverseDependencyLink) o1;
ReverseDependencyLink p2 = (ReverseDependencyLink) o2;
return p1.getProject().getId().compareTo( p2.getProject().getId() );
}
<BUG>else
{</BUG>
return 0;
}
}
| iconError( sink );
|
940 | protected XYSeries smoothMafData = new XYSeries(smoothedDataName);
protected XYSeries runData = null;
protected Insets insets0 = new Insets(0, 0, 0, 0);
protected Insets insets1 = new Insets(1, 1, 1, 1);
protected Insets insets2 = new Insets(2, 2, 2, 2);
<BUG>protected Insets insets3 = new Insets(3, 3, 3, 3);
public AMafScaling(int tabPlacement, PrimaryOpenLoopFuelingTable table, MafCompare comparer) {</BUG>
super(tabPlacement);
polfTable = table;
mafCompare = comparer;
| protected String[] optionButtons = { "Yes", "No", "No to all" };
public AMafScaling(int tabPlacement, PrimaryOpenLoopFuelingTable table, MafCompare comparer) {
|
941 | import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseAdapter;
<BUG>import java.awt.event.MouseEvent;
import java.net.URI;</BUG>
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
| import java.io.File;
import java.net.URI;
|
942 | import java.util.regex.Pattern;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JCheckBox;
<BUG>import javax.swing.JComboBox;
import javax.swing.JLabel;</BUG>
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
| import javax.swing.JFileChooser;
import javax.swing.JLabel;
|
943 | protected String y3dAxisName;
protected String z3dAxisName;
protected Insets insets0 = new Insets(0, 0, 0, 0);
protected Insets insets1 = new Insets(1, 1, 1, 1);
protected Insets insets2 = new Insets(2, 2, 2, 2);
<BUG>protected Insets insets3 = new Insets(3, 3, 3, 3);
public ACompCalc(int tabPlacement) {</BUG>
super(tabPlacement);
}
protected abstract void createControlPanel(JPanel dataPanel);
| protected String[] optionButtons = { "Yes", "No", "No to all" };
public ACompCalc(int tabPlacement) {
|
944 | package com.vgi.mafscaling;
<BUG>import java.io.File;
import javax.swing.JFileChooser;
import javax.swing.JTabbedPane;
public class FCTabbedPane extends JTabbedPane {
</BUG>
private static final long serialVersionUID = -1927797105079280969L;
| import java.awt.datatransfer.DataFlavor;
import java.util.List;
import javax.swing.JOptionPane;
import javax.swing.TransferHandler;
import javax.swing.filechooser.FileNameExtensionFilter;
public abstract class FCTabbedPane extends JTabbedPane {
|
945 | maxDvDt = Config.getDvDtMaximumValue();
maxMafV = Config.getMafVMaximumValue();
maxIat = Config.getIatMaximumValue();
return ret;
}
<BUG>protected void loadLogFile() {
fileChooser.setMultiSelectionEnabled(true);
if (JFileChooser.APPROVE_OPTION != fileChooser.showOpenDialog(this))
return;</BUG>
boolean isPolSet = polfTable.isSet();
| boolean displayDialog = true;
|
946 | File[] files = fileChooser.getSelectedFiles();
for (File file : files) {
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(file.getAbsoluteFile()));
<BUG>String line = br.readLine();
if (line != null) {
String [] elements = line.split("\\s*,\\s*", -1);
getColumnsFilters(elements);</BUG>
boolean resetColumns = false;
| String line = null;
String [] elements = null;
while ((line = br.readLine()) != null && (elements = line.split("\\s*,\\s*", -1)) != null && elements.length < 2)
continue;
getColumnsFilters(elements);
|
947 | import com.android.volley.VolleyError;
import java.io.ByteArrayInputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Date;
<BUG>import java.util.List;
import androidrss.MediaEnclosure;</BUG>
import androidrss.RSSConfig;
import androidrss.RSSFeed;
import androidrss.RSSItem;
| import java.util.regex.Matcher;
import java.util.regex.Pattern;
import androidrss.MediaEnclosure;
|
948 | private int currentWorkingThreads = 0;
private IDatabaseHandler databaseHandler;
private boolean updateDatabase;
public void start() {
sendMessage(context.getString(R.string.update_news), STATUS_CHANGED);
<BUG>if (updateDatabase){
dropCategory();
}</BUG>
results = new ArrayList<FetchingResult>();
currentWorkingThreads = category.getFeeds().size();
| [DELETED] |
949 | results.add(result);
}
if (currentWorkingThreads <= 0){
new AsyncTask<Void, Void, Void>(){
@Override
<BUG>protected Void doInBackground(Void... params) {
parseInformation();</BUG>
return null;
}
}.execute();
| if (updateDatabase){
dropCategory();
parseInformation();
|
950 | if (pubDate != null){
time = pubDate.getTime();
}
String desc = item.getDescription();
if (desc != null) {
<BUG>desc = desc.replaceAll("\\<.*?>","").replaceAll("()", "");
</BUG>
}
return new Entry(-1, feedId, category.getId(), item.getTitle(), desc, time, source, url, mediaUri);
}
| desc = desc.replaceAll("\\<.*?>","").replace("()", "").replace(" ", "");
|
951 | protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mNavigationDrawerFragment = (NavigationDrawerFragment)
getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
<BUG>mTitle = getTitle();
mNavigationDrawerFragment.setUp(</BUG>
R.id.navigation_drawer,
(DrawerLayout) findViewById(R.id.drawer_layout));
databaseHandler = DatabaseHandler.getInstance();
| getSupportActionBar().setTitle(getString(R.string.simple_news_title));
mNavigationDrawerFragment.setUp(
|
952 | bottomView = (RelativeLayout) findViewById(R.id.bottom_view);
createProgressView();
onPageSelected(0);
overridePendingTransition(R.anim.open_translate,R.anim.close_scale);
}
<BUG>@Override
protected void onPause() {</BUG>
super.onPause();
overridePendingTransition(R.anim.open_scale,R.anim.close_translate);
}
| public void onBackPressed() {
finish();
protected void onPause() {
|
953 | import colorpicker.ColorUtils;
import colorpicker.OnColorSelectedListener;
import de.dala.simplenews.R;
import de.dala.simplenews.common.Category;
import de.dala.simplenews.database.DatabaseHandler;
<BUG>import de.dala.simplenews.utilities.UIUtils;
public class CategorySelectionFragment extends Fragment implements ContextualUndoAdapter.DeleteItemCallback {</BUG>
public interface OnCategoryClicked {
void onMoreClicked(Category category);
void onRSSSavedClick(Category category, String rssPath);
| import de.keyboardsurfer.android.widget.crouton.Crouton;
import de.keyboardsurfer.android.widget.crouton.Style;
public class CategorySelectionFragment extends Fragment implements ContextualUndoAdapter.DeleteItemCallback {
|
954 | private String rssPath;
private static final String CATEGORIES_KEY = "categories";
private static final String FROM_RSS_KEY = "rss";
private static final String RSS_PATH_KEY = "path";
OnCategoryClicked categoryClicked;
<BUG>private TextView topView;
public CategorySelectionFragment(){</BUG>
}
public static CategorySelectionFragment newInstance(ArrayList<Category> categories, boolean fromRSS, String path){
| private TextView topTextView;
private ViewGroup topView;
public CategorySelectionFragment(){
|
955 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
this.categoryClicked = UIUtils.getParent(this, OnCategoryClicked.class);
if (categoryClicked == null){
throw new ClassCastException("No Parent with Interface OnCategoryClicked");
}
<BUG>View rootView = inflater.inflate(R.layout.category_selection, container, false);
if (fromRSS){
topView = (TextView) rootView.findViewById(R.id.topTextView);
topView.setText("Select Category to add Feed");
topView.setVisibility(View.VISIBLE);
</BUG>
}
| topView = (ViewGroup) rootView.findViewById(R.id.topView);
topTextView = (TextView) rootView.findViewById(R.id.topTextView);
topTextView.setText(getActivity().getString(R.string.category_add));
topTextView.setVisibility(View.VISIBLE);
|
956 | break;
}
}
};
new AlertDialog.Builder(getActivity()).
<BUG>setPositiveButton("Ok", dialogClickListener).setNegativeButton("Cancel", dialogClickListener).setTitle(getActivity().getString(R.string.create_category_1_2))
.setMessage("Name for the Category").setView(input).show();
}</BUG>
private void editClicked(final Category category) {
| case R.id.edit:
editClicked(category);
case R.id.show:
case R.id.more:
categoryClicked.onMoreClicked(category);
private void createCategoryClicked(){
|
957 | case DialogInterface.BUTTON_POSITIVE:
String newName = input.getText().toString();
category.setName(newName);
adapter.notifyDataSetChanged();
DatabaseHandler.getInstance().updateCategoryName(category.getId(), newName);
<BUG>Toast.makeText(getActivity(), "New name: " + newName, Toast.LENGTH_SHORT).show();
break;</BUG>
case DialogInterface.BUTTON_NEGATIVE:
break;
}
| String categoryName = input.getText().toString();
selectColor(categoryName);
|
958 | newCategory.setColor(color);
long id = DatabaseHandler.getInstance().addCategory(newCategory, true, true);
newCategory.setId(id);
adapter.add(newCategory);
adapter.notifyDataSetChanged();
<BUG>Toast.makeText(getActivity(), "Category created", Toast.LENGTH_SHORT).show();
}</BUG>
});
colorCalendar.show(getChildFragmentManager(), "dash");
}
| Crouton.makeText(getActivity(), R.string.category_created, Style.CONFIRM, topView).show();
|
959 | private static String LOG_PREFIX = "prefix";
private static int LOG_PREFIX_LENGTH = LOG_PREFIX.length();
private static final int MAX_LOG_TAG_LENGTH = 23;
private enum LogType {TOAST, LOG, BOTH};
private Toast currentToast;
<BUG>private LogType type = LogType.BOTH;
</BUG>
private boolean shouldInterrupt = true;
private int toastLength = Toast.LENGTH_LONG;
private Toasty(Context context){
| private LogType type = LogType.LOG;
|
960 | DatabaseHandler.getInstance().removeFeeds(null, feed.getId(), false);
category.getFeeds().remove(feed);
}
private class MyFormatCountDownCallback implements ContextualUndoAdapter.CountDownFormatter {
@Override
<BUG>public String getCountDownString(long millisUntilFinished) {
int seconds = (int) Math.ceil((millisUntilFinished / 1000.0));</BUG>
if (seconds > 0) {
return getResources().getQuantityString(R.plurals.countdown_seconds, seconds, seconds);
}
| if (getActivity() == null)
return "";
int seconds = (int) Math.ceil((millisUntilFinished / 1000.0));
|
961 | import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
<BUG>import android.widget.RelativeLayout;
import java.util.ArrayList;</BUG>
import de.dala.simplenews.R;
import de.dala.simplenews.common.Category;
import de.dala.simplenews.common.Feed;
| import com.actionbarsherlock.app.SherlockFragmentActivity;
import java.util.ArrayList;
|
962 | private boolean fromRSS = false;
private int currentFragment = CATEGORY_SELECTION;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
<BUG>setContentView(R.layout.category_modifier);
categories = new ArrayList<Category>(DatabaseHandler.getInstance().getCategories(false, true));</BUG>
Fragment fragment = null;
if(this.getIntent().getDataString()!=null)
{
| getSupportActionBar().setTitle(getString(R.string.categories_title));
categories = new ArrayList<Category>(DatabaseHandler.getInstance().getCategories(false, true));
|
963 | customTokens.put("%%mlFinalForestsPerHost%%", hubConfig.finalForestsPerHost.toString());
customTokens.put("%%mlTraceAppserverName%%", hubConfig.traceHttpName);
customTokens.put("%%mlTracePort%%", hubConfig.tracePort.toString());
customTokens.put("%%mlTraceDbName%%", hubConfig.traceDbName);
customTokens.put("%%mlTraceForestsPerHost%%", hubConfig.traceForestsPerHost.toString());
<BUG>customTokens.put("%%mlModulesDbName%%", hubConfig.modulesDbName);
}</BUG>
public void init() {
try {
LOGGER.error("PLUGINS DIR: " + pluginsDir.toString());
| customTokens.put("%%mlTriggersDbName%%", hubConfig.triggersDbName);
customTokens.put("%%mlSchemasDbName%%", hubConfig.schemasDbName);
}
|
964 | customTokens.put("%%mlFinalForestsPerHost%%", hubConfig.finalForestsPerHost.toString());
customTokens.put("%%mlTraceAppserverName%%", hubConfig.traceHttpName);
customTokens.put("%%mlTracePort%%", hubConfig.tracePort.toString());
customTokens.put("%%mlTraceDbName%%", hubConfig.traceDbName);
customTokens.put("%%mlTraceForestsPerHost%%", hubConfig.traceForestsPerHost.toString());
<BUG>customTokens.put("%%mlModulesDbName%%", hubConfig.modulesDbName);
}</BUG>
public void init() {
try {
LOGGER.error("PLUGINS DIR: " + pluginsDir.toString());
| customTokens.put("%%mlTriggersDbName%%", hubConfig.triggersDbName);
customTokens.put("%%mlSchemasDbName%%", hubConfig.schemasDbName);
}
|
965 | String vgName = "vg-" + Hashes.getRandom(4);
String lvName = "lv-" + Hashes.getRandom(4);
String loDevName = createLoopback(rawFileName, absoluteSize);
createLogicalVolume(loDevName, vgName, lvName);
lvmVolumeInfo.setVgName(vgName);
<BUG>lvmVolumeInfo.setLvName(lvName);
lvmVolumeInfo.setVolumeId(volumeId);</BUG>
lvmVolumeInfo.setStatus(StorageProperties.Status.available.toString());
lvmVolumeInfo.setSize(size);
String absoluteLVName = lvmRootDirectory + PATH_SEPARATOR + vgName + PATH_SEPARATOR + lvName;
| lvmVolumeInfo.setPvName(loDevName);
lvmVolumeInfo.setVolumeId(volumeId);
|
966 | package org.gradle.language.base.internal.tasks.apigen;
<BUG>import com.google.common.collect.Sets;
import org.objectweb.asm.*;</BUG>
import org.objectweb.asm.signature.SignatureReader;
import org.objectweb.asm.signature.SignatureVisitor;
import java.io.IOException;
| import com.google.common.collect.Lists;
import org.gradle.language.base.internal.tasks.apigen.abi.*;
import org.objectweb.asm.*;
|
967 | import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Modifier;
import java.util.Collections;
import java.util.List;
<BUG>import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;</BUG>
import java.util.regex.Pattern;
public class ApiStubGenerator {
private final static Pattern AIC_LOCAL_CLASS_PATTERN = Pattern.compile(".+\\$[0-9]+(?:[\\p{Alnum}_$]+)?$");
| import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicBoolean;
|
968 |
if ((access & ACC_ABSTRACT) != ACC_ABSTRACT) {
</BUG>
mv.visitCode();
mv.visitMethodInsn(INVOKESTATIC, internalClassName, UOE_METHOD, "()Ljava/lang/UnsupportedOperationException;", false);
mv.visitInsn(ATHROW);
mv.visitMaxs(1, 0);
<BUG>mv.visitEnd();
return createAnnotationVisitor(access, name, desc, signature, exceptions, false);
}
return mv;</BUG>
} else {
| throw new InvalidPublicAPIException(String.format("'%s' is annotated with '%s' effectively exposing it in the public API but its package is not one of the allowed packages.", owner, annotation));
@Override
public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) {
if ("<clinit>".equals(name)) {
return null;
if (isPublicAPI(access) || ("<init>".equals(name) && isInnerClass)) {
Set<String> invalidReferencedTypes = invalidReferencedTypes(signature == null ? desc : signature);
if (invalidReferencedTypes.isEmpty()) {
methods.add(new MethodSig(access, name, desc, signature, exceptions));
return createMethodAnnotationChecker(access, name, desc, signature, exceptions, true);
|
969 | sb.append(" - ").append(invalidReferencedType).append("\n");
}
throw new InvalidPublicAPIException(sb.toString());
}
}
<BUG>return new FieldVisitor(Opcodes.ASM5, cv.visitField(access, name, desc, signature, value)) {
@Override</BUG>
public AnnotationVisitor visitAnnotation(String annotationDesc, boolean visible) {
checkAnnotation(fieldDescriptor, annotationDesc);
return super.visitAnnotation(annotationDesc, visible);
| fields.add(new FieldSig(access, name, desc, signature));
return new FieldVisitor(Opcodes.ASM5) {
@Override
|
970 | 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 {
|
971 | 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));
|
972 | } 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()
|
973 |
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));
|
974 | 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));
|
975 | 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 {
|
976 | 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);
|
977 | package com.hazelcast.map.impl;
<BUG>import com.hazelcast.config.InMemoryFormat;
import com.hazelcast.test.HazelcastParallelClassRunner;
import com.hazelcast.test.annotation.ParallelTest;</BUG>
import com.hazelcast.test.annotation.QuickTest;
import org.junit.Test;
| import com.hazelcast.config.MapConfig;
import com.hazelcast.test.HazelcastTestSupport;
import com.hazelcast.test.annotation.ParallelTest;
|
978 | 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.*;
|
979 | .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);
|
980 | </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) {
|
981 | 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)
|
982 | .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))
|
983 | .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))
|
984 | @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;
|
985 | 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;
}
|
986 | return configDirectory;
}
public boolean isLoaded() {
return loaded;
}
<BUG>public static Cause getCause() {
return instance().pluginCause;
}</BUG>
public EconomyService getEconomyService() {
return economyService;
| [DELETED] |
987 | 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.*;
|
988 | .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))
|
989 | 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) -> {
|
990 | 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);
|
991 | 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);
|
992 | 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() + "\"");
|
993 | 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() + "\"");
|
994 | 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
|
995 | .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")
|
996 | import org.springframework.util.Assert;
import org.springframework.web.util.UriTemplate;
public class RestTemplate extends HttpAccessor implements RestOperations {
private final ResponseExtractor<HttpHeaders> headersExtractor = new HeadersExtractor();
private HttpMessageConverter<?>[] messageConverters =
<BUG>new HttpMessageConverter[] {new ByteArrayHttpMessageConverter(), new StringHttpMessageConverter()};
private ResponseErrorHandler errorHandler = new DefaultResponseErrorHandler();</BUG>
public RestTemplate() {
}
public RestTemplate(ClientHttpRequestFactory requestFactory) {
| new HttpMessageConverter[]{new ByteArrayHttpMessageConverter(), new StringHttpMessageConverter()};
private ResponseErrorHandler errorHandler = new DefaultResponseErrorHandler();
|
997 | this.errorHandler = errorHandler;
}
public ResponseErrorHandler getErrorHandler() {
return this.errorHandler;
}
<BUG>public <T> T getForObject(String url, Class<T> responseType, String... urlVariables)
throws RestClientException {</BUG>
checkForSupportedMessageConverter(responseType);
return execute(url, HttpMethod.GET, new GetCallback<T>(responseType),
| public <T> T getForObject(String url, Class<T> responseType, String... urlVariables) throws RestClientException {
|
998 | return execute(url, HttpMethod.HEAD, null, this.headersExtractor, urlVariables);
}
public HttpHeaders headForHeaders(String url, Map<String, String> urlVariables) throws RestClientException {
return execute(url, HttpMethod.HEAD, null, this.headersExtractor, urlVariables);
}
<BUG>public URI postForLocation(String url, Object request, String... urlVariables)
throws RestClientException {
checkForSupportedMessageConverter(request.getClass());
HttpHeaders headers =</BUG>
execute(url, HttpMethod.POST, new PostPutCallback(request), this.headersExtractor, urlVariables);
| public URI postForLocation(String url, Object request, String... urlVariables) throws RestClientException {
if (request != null) {
HttpHeaders headers =
|
999 | execute(url, HttpMethod.DELETE, null, null, urlVariables);
}
public void delete(String url, Map<String, String> urlVariables) throws RestClientException {
execute(url, HttpMethod.DELETE, null, null, urlVariables);
}
<BUG>public Set<HttpMethod> optionsForAllow(String url, String... urlVariables)
throws RestClientException {</BUG>
HttpHeaders headers = execute(url, HttpMethod.OPTIONS, null, this.headersExtractor, urlVariables);
return headers.getAllow();
| public Set<HttpMethod> optionsForAllow(String url, String... urlVariables) throws RestClientException {
|
1,000 |
throws RestClientException {</BUG>
HttpHeaders headers = execute(url, HttpMethod.OPTIONS, null, this.headersExtractor, urlVariables);
return headers.getAllow();
}
<BUG>public Set<HttpMethod> optionsForAllow(String url, Map<String, String> urlVariables)
throws RestClientException {</BUG>
HttpHeaders headers = execute(url, HttpMethod.OPTIONS, null, this.headersExtractor, urlVariables);
return headers.getAllow();
| execute(url, HttpMethod.DELETE, null, null, urlVariables);
public void delete(String url, Map<String, String> urlVariables) throws RestClientException {
execute(url, HttpMethod.DELETE, null, null, urlVariables);
public Set<HttpMethod> optionsForAllow(String url, String... urlVariables) throws RestClientException {
public Set<HttpMethod> optionsForAllow(String url, Map<String, String> urlVariables) throws RestClientException {
|