id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
15,001
addAnnotation(new IFCAnnotation(AnnotationType.SOURCE, level, toMark, context)); </BUG> } <BUG>private void addSinkAnnotation(SDGProgramPart toMark, String level, SDGMethod context) { addAnnotation(new IFCAnnotation(AnnotationType.SINK, level, toMark, context)); </BUG> } public void addDeclassification(SDGProgramPart toMark, String level1, String level2) {
return program; public IStaticLattice<String> getLattice() { return secLattice; private void addSourceAnnotation(SDGProgramPart toMark, String level, SDGMethod context, AnnotationCause cause) { addAnnotation(new IFCAnnotation(AnnotationType.SOURCE, level, toMark, context, cause)); private void addSinkAnnotation(SDGProgramPart toMark, String level, SDGMethod context, AnnotationCause cause) { addAnnotation(new IFCAnnotation(AnnotationType.SINK, level, toMark, context, cause));
15,002
(AnnotationPolicy) Source.class.getMethod("annotate").getDefaultValue() : source.annotate(); final String level = fromSet.get(Sets.newHashSet(includes)); if (!stringEncodedLattice.getElements().contains(level)) { throw new IllegalArgumentException("Unknown dataset in includes == " + Arrays.toString(includes)); } <BUG>annotatePart(Source.class, part, level, annotate); </BUG> } catch (NoSuchMethodException nsme) { throw new AssertionError("Default value for invalid annotation attribute requested"); }
annotatePart(Source.class, source, part, level, annotate, sourceFile);
15,003
(AnnotationPolicy) Source.class.getMethod("annotate").getDefaultValue() : source.annotate(); final String level = fromSet.get(Sets.newHashSet(mayKnow)); if (!stringEncodedLattice.getElements().contains(level)) { throw new IllegalArgumentException("Unknown dataset in mayKnow == " + Arrays.toString(mayKnow)); } <BUG>annotatePart(Source.class, part, level, annotate); </BUG> } catch (NoSuchMethodException nsme) { throw new AssertionError("Default value for invalid annotation attribute requested"); }
annotatePart(Source.class, source, part, level, annotate, sourceFile);
15,004
final TypeReference sink = TypeReference.findOrCreate( ClassLoaderReference.Application, TypeName.findOrCreate(JavaType.parseSingleTypeFromString(Sink.class.getCanonicalName()).toBCString(false))); final TypeName annotationPolicy = TypeName.findOrCreate(JavaType.parseSingleTypeFromString(AnnotationPolicy.class.getCanonicalName()).toBCString()); final TypeName positionDefinition = TypeName.findOrCreate(JavaType.parseSingleTypeFromString(AnnotationPolicy.class.getCanonicalName()).toBCString()); <BUG>final Map<SDGProgramPart,Collection<Annotation>> annotations = program.getJavaSourceAnnotations(); for (final Entry<SDGProgramPart,Collection<Annotation>> e : annotations.entrySet()) { for(final Annotation a : e.getValue()) { debug.outln("Processing::: " + a);</BUG> if (source.equals(a.getType())) {
final Map<SDGProgramPart,Collection<Pair<Annotation,String>>> annotations = program.getJavaSourceAnnotations(); for (final Entry<SDGProgramPart,Collection<Pair<Annotation,String>>> e : annotations.entrySet()) { for(final Pair<Annotation,String> p : e.getValue()) { final Annotation a = p.getFirst(); final String sourceFile = p.getSecond(); debug.outln("Processing::: " + a);
15,005
columnNumber = -1; } else { final ConstantElementValue constantvalue = (ConstantElementValue) columnNumberValue; columnNumber = (Integer) constantvalue.val; } <BUG>sources.put(e.getKey(), new Source() { </BUG> @Override public Class<? extends java.lang.annotation.Annotation> annotationType() { return Source.class;
sources.put(e.getKey(), Pair.pair(new Source() {
15,006
return lineNumber; } @Override public int columnNumber() { return columnNumber; <BUG>} }); } else if (sink.equals(a.getType())) {</BUG> final ElementValue levelValue = a.getNamedArguments().get("level"); final String level;
public String toString() { return "@Source(level = " + level + ", includes = " + Arrays.toString(includes) + ", mayKnow = " + Arrays.toString(mayKnow) + ")"; }; }, sourceFile)); } else if (sink.equals(a.getType())) {
15,007
columnNumber = -1; } else { final ConstantElementValue constantvalue = (ConstantElementValue) columnNumberValue; columnNumber = (Integer) constantvalue.val; } <BUG>sinks.put(e.getKey(), new Sink() { </BUG> @Override public Class<? extends java.lang.annotation.Annotation> annotationType() { return Sink.class;
sinks.put(e.getKey(), Pair.pair(new Sink() {
15,008
(source.level() == null) ? (String) Source.class.getMethod("level").getDefaultValue() : source.level(); final AnnotationPolicy annotate = (source.annotate() == null) ? (AnnotationPolicy) Source.class.getMethod("annotate").getDefaultValue() : source.annotate(); <BUG>annotatePart(Source.class, part, level, annotate); </BUG> } catch (NoSuchMethodException nsme) { throw new AssertionError("Default value for invalid annotation attribute requested"); }
annotatePart(Source.class, source, part, level, annotate, sourceFile);
15,009
protected Void visitAttribute(SDGAttribute attribute, Void data) { if (annotate != AnnotationPolicy.ANNOTATE_USAGES) { throw new IllegalArgumentException("Fields may onlye be annotated with annotate == " + AnnotationPolicy.ANNOTATE_USAGES); } <BUG>if (ann == Source.class) addSourceAnnotation(attribute, level); if (ann == Sink.class) addSinkAnnotation(attribute, level); </BUG> return null;
[DELETED]
15,010
protected Void visitParameter(SDGFormalParameter p, Void data) { if (annotate != AnnotationPolicy.ANNOTATE_USAGES) { throw new IllegalArgumentException("Fields may onlye be annotated with annotate == " + AnnotationPolicy.ANNOTATE_USAGES); } <BUG>if (ann == Source.class) addSourceAnnotation(p, level); if (ann == Sink.class) addSinkAnnotation(p, level); </BUG> return null;
[DELETED]
15,011
protected Void visitLocalVariable(SDGLocalVariable local, Void data) { if (annotate != AnnotationPolicy.ANNOTATE_USAGES) { throw new IllegalArgumentException("Local Variables may onlye be annotated with annotate == " + AnnotationPolicy.ANNOTATE_USAGES); } <BUG>if (ann == Source.class) addSourceAnnotation(local, level); if (ann == Sink.class) addSinkAnnotation(local, level); </BUG> return null;
[DELETED]
15,012
import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.Map; <BUG>import edu.kit.joana.api.IFCAnalysis; import edu.kit.joana.api.sdg.SDGActualParameter;</BUG> import edu.kit.joana.api.sdg.SDGAttribute; import edu.kit.joana.api.sdg.SDGCall; import edu.kit.joana.api.sdg.SDGCallExceptionNode;
import edu.kit.joana.api.annotations.cause.AnnotationCause; import edu.kit.joana.api.sdg.SDGActualParameter;
15,013
addAnnotation(new IFCAnnotation(AnnotationType.SOURCE, level, progPart, context)); </BUG> } <BUG>public void addSinkAnnotation(SDGProgramPart progPart, String level, SDGMethod context) { addAnnotation(new IFCAnnotation(AnnotationType.SINK, level, progPart, context)); </BUG> } public void addDeclassification(SDGProgramPart progPart, String level1, String level2) {
public void removeAllAnnotations() { sourceAnnotations.clear(); sinkAnnotations.clear(); declassAnnotations.clear(); public void addSourceAnnotation(SDGProgramPart progPart, String level, SDGMethod context, AnnotationCause cause) { addAnnotation(new IFCAnnotation(AnnotationType.SOURCE, level, progPart, context, cause)); public void addSinkAnnotation(SDGProgramPart progPart, String level, SDGMethod context, AnnotationCause cause) { addAnnotation(new IFCAnnotation(AnnotationType.SINK, level, progPart, context, cause));
15,014
} else { PwiLogger.debug("Player was not in cache! Loading from file"); dataWriter.getFromDatabase(group, gamemode, player); } } <BUG>public void savePlayer(Group group, Player player, boolean async) { String key = player.getUniqueId().toString() + "." + group.getName() + "."; if (settings.getProperty(PwiProperties.SEPARATE_GAMEMODE_INVENTORIES)) key += player.getGameMode().toString().toLowerCase(); else key += "survival";</BUG> playerCache.remove(key);
String key = makeKey(player.getUniqueId(), group, player.getGameMode());
15,015
pwiPlayer, async); dataWriter.saveLogoutData(pwiPlayer, async); removePlayer(player); } <BUG>public boolean isPlayerCached(Group group, GameMode gameMode, Player player) { String key = player.getUniqueId().toString() + "." + group.getName() + "."; if (settings.getProperty(PwiProperties.SEPARATE_GAMEMODE_INVENTORIES)) key += gameMode.toString().toLowerCase(); else key += "survival";</BUG> return playerCache.containsKey(key);
[DELETED]
15,016
} else { PwiLogger.warning("[ECON] Unable to withdraw currency from bank of '" + player.getName() + "': " + er.errorMessage); } } } <BUG>private PWIPlayer getCachedPlayer(Group group, GameMode gameMode, UUID uuid) { String key = uuid.toString() + "." + group.getName() + "."; if (settings.getProperty(PwiProperties.SEPARATE_GAMEMODE_INVENTORIES)) key += gameMode.toString().toLowerCase(); else key += "survival";</BUG> PwiLogger.debug("Looking for cached data with key '" + key + "'");
PwiLogger.warning("[ECON] Unable to withdraw currency from '" + player.getName() + "': " + er.errorMessage); EconomyResponse bankER = econ.bankWithdraw(player.getName(), econ.bankBalance(player.getName()).amount); if (bankER.transactionSuccess()) { econ.bankDeposit(player.getName(), cachedPlayer.getBankBalance()); String key = makeKey(uuid, group, gameMode);
15,017
import org.apache.sling.jcr.resource.JcrResourceConstants; import org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl; import org.apache.sling.jcr.resource.internal.helper.MapEntries; import org.apache.sling.jcr.resource.internal.helper.Mapping; import org.apache.sling.performance.annotation.PerformanceTestSuite; <BUG>import org.apache.sling.performance.tests.ResolveNonExistingWith10000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith10000VanityPathTest; import org.apache.sling.performance.tests.ResolveNonExistingWith1000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith1000VanityPathTest; import org.apache.sling.performance.tests.ResolveNonExistingWith5000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith5000VanityPathTest;</BUG> import org.junit.runner.RunWith;
import org.apache.sling.performance.tests.ResolveNonExistingWithManyAliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWithManyVanityPathTest;
15,018
@PerformanceTestSuite public ParameterizedTestList testPerformance() throws Exception { Helper helper = new Helper(); ParameterizedTestList testCenter = new ParameterizedTestList(); testCenter.setTestSuiteTitle("jcr.resource-2.0.10"); <BUG>testCenter.addTestObject(new ResolveNonExistingWith1000VanityPathTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith5000VanityPathTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith10000VanityPathTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith1000AliasTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith5000AliasTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith10000AliasTest(helper)); </BUG> return testCenter;
testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith1000VanityPathTest",helper, 100, 10)); testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith5000VanityPathTest",helper, 100, 50)); testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith10000VanityPathTest",helper, 100, 100)); testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWithManyAliasTest",helper, 1000)); testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWith5000AliasTest",helper, 5000)); testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWith10000AliasTest",helper, 10000));
15,019
package org.apache.sling.performance; <BUG>import static org.mockito.Mockito.*; import javax.jcr.NamespaceRegistry;</BUG> import javax.jcr.Session; import junitx.util.PrivateAccessor;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.mock; import javax.jcr.NamespaceRegistry;
15,020
import org.apache.sling.jcr.resource.JcrResourceConstants; import org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl; import org.apache.sling.jcr.resource.internal.helper.MapEntries; import org.apache.sling.jcr.resource.internal.helper.Mapping; import org.apache.sling.performance.annotation.PerformanceTestSuite; <BUG>import org.apache.sling.performance.tests.ResolveNonExistingWith10000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith10000VanityPathTest; import org.apache.sling.performance.tests.ResolveNonExistingWith1000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith1000VanityPathTest; import org.apache.sling.performance.tests.ResolveNonExistingWith5000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith5000VanityPathTest;</BUG> import org.junit.runner.RunWith;
import org.apache.sling.performance.tests.ResolveNonExistingWithManyAliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWithManyVanityPathTest;
15,021
import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.jcr.api.SlingRepository; import org.apache.sling.jcr.resource.JcrResourceConstants; import org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProviderFactory; import org.apache.sling.performance.annotation.PerformanceTestSuite; <BUG>import org.apache.sling.performance.tests.ResolveNonExistingWith10000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith10000VanityPathTest; import org.apache.sling.performance.tests.ResolveNonExistingWith1000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith1000VanityPathTest; import org.apache.sling.performance.tests.ResolveNonExistingWith5000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith5000VanityPathTest;</BUG> import org.apache.sling.resourceresolver.impl.ResourceResolverFactoryActivator;
import org.apache.sling.performance.tests.ResolveNonExistingWithManyAliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWithManyVanityPathTest;
15,022
@PerformanceTestSuite public ParameterizedTestList testPerformance() throws Exception { Helper helper = new Helper(); ParameterizedTestList testCenter = new ParameterizedTestList(); testCenter.setTestSuiteTitle("jcr.resource-2.2.0"); <BUG>testCenter.addTestObject(new ResolveNonExistingWith1000VanityPathTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith5000VanityPathTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith10000VanityPathTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith1000AliasTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith5000AliasTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith10000AliasTest(helper)); </BUG> return testCenter;
testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith1000VanityPathTest",helper, 100, 10)); testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith5000VanityPathTest",helper, 100, 50)); testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith10000VanityPathTest",helper, 100, 100)); testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWith1000AliasTest",helper, 1000)); testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWith5000AliasTest",helper, 5000)); testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWith10000AliasTest",helper, 10000));
15,023
import me.wcy.weather.utils.RequestCode; import me.wcy.weather.utils.SnackbarUtils; import me.wcy.weather.utils.SystemUtils; import me.wcy.weather.utils.UpdateUtils; import rx.Subscriber; <BUG>import rx.android.schedulers.AndroidSchedulers; import rx.functions.Action1;</BUG> import rx.functions.Func1; import rx.schedulers.Schedulers; public class WeatherActivity extends BaseActivity implements AMapLocationListener
import rx.exceptions.Exceptions; import rx.functions.Action1;
15,024
public void setContentView(View view, ViewGroup.LayoutParams params) { super.setContentView(view, params); initView(); } private void initView() { <BUG>ButterKnife.bind(this); if (mToolbar == null) {</BUG> throw new IllegalStateException("Layout is required to include a Toolbar with id 'toolbar'"); } setSupportActionBar(mToolbar);
mToolbar = (Toolbar) findViewById(R.id.toolbar); if (mToolbar == null) {
15,025
import me.wcy.weather.utils.Extras; import me.wcy.weather.utils.SnackbarUtils; import me.wcy.weather.utils.SystemUtils; import rx.Observable; import rx.Subscriber; <BUG>import rx.android.schedulers.AndroidSchedulers; import rx.functions.Action0; import rx.functions.Func1;</BUG> import rx.schedulers.Schedulers; public class AddCityActivity extends BaseActivity implements View.OnClickListener
import rx.exceptions.Exceptions; import rx.functions.Action1; import rx.functions.Func1;
15,026
tvSearchTips.setVisibility(View.VISIBLE); rvCity.setVisibility(View.GONE); currentType = AddCityAdapter.Type.SEARCH; } }) <BUG>.subscribeOn(AndroidSchedulers.mainThread()) .filter(new Func1<CityInfoEntity, Boolean>() {</BUG> @Override public Boolean call(CityInfoEntity cityInfoEntity) { return cityInfoEntity.area.contains(text);
.observeOn(Schedulers.io()) .filter(new Func1<CityInfoEntity, Boolean>() {
15,027
.map(new Func1<String, List<CityInfoEntity>>() { @Override public List<CityInfoEntity> call(String s) { return parseCityList(s); } <BUG>}) .subscribe(new Subscriber<List<CityInfoEntity>>() {</BUG> @Override public void onCompleted() { }
.observeOn(AndroidSchedulers.mainThread()) .subscribe(new Subscriber<List<CityInfoEntity>>() {
15,028
public void onCompleted() { } @Override public void onError(Throwable e) { mProgressDialog.cancel(); <BUG>Log.e(TAG, "fetchCityList", e); }</BUG> @Override public void onNext(List<CityInfoEntity> cityInfoEntities) { mCityList = cityInfoEntities;
finish();
15,029
import android.net.Uri; import com.fuck_boilerplate.rx_paparazzo.entities.Config; import com.fuck_boilerplate.rx_paparazzo.entities.TargetUi; import com.yalantis.ucrop.UCrop; import java.io.File; <BUG>import javax.inject.Inject; import rx.Observable; public final class CropImage extends UseCase<Uri> {</BUG> private final Config config; private final StartIntent startIntent;
import rx.functions.Func1; public final class CropImage extends UseCase<Uri> {
15,030
private final StartIntent startIntent; private final GetPath getPath; private final TargetUi targetUi; private final GetDimens getDimens; private Uri uri; <BUG>@Inject public CropImage(TargetUi targetUi, Config config, StartIntent startIntent, GetPath getPath, GetDimens getDimens) { this.targetUi = targetUi;</BUG> this.config = config; this.startIntent = startIntent; this.getPath = getPath;
this.targetUi = targetUi;
15,031
import android.net.Uri; import android.util.DisplayMetrics; import com.fuck_boilerplate.rx_paparazzo.entities.Config; import com.fuck_boilerplate.rx_paparazzo.entities.Size; import com.fuck_boilerplate.rx_paparazzo.entities.TargetUi; <BUG>import javax.inject.Inject; import rx.Observable; public final class GetDimens extends UseCase<int[]> {</BUG> private final TargetUi targetUi; private final Config config;
import rx.functions.Func1; public final class GetDimens extends UseCase<int[]> {
15,032
String id = DocumentsContract.getDocumentId(uri); Uri contentUri = ContentUris.withAppendedId( Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); return getDataColumn(context, contentUri, null, null); } else if (isMediaDocument(uri)) { Document document = getDocument(uri); <BUG>Uri contentUri = null; if ("image".equals(document.type)) contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; else if ("video".equals(document.type)) contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; else if ("audio".equals(document.type)) contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; return getDataColumn(context, contentUri, "_id=?", new String[] {document.id});</BUG> }
if ("image".equals(document.type)) {
15,033
cursor.moveToFirst(); return cursor.getString(cursor.getColumnIndexOrThrow(column)); } catch (Exception e) { throw Exceptions.propagate(e); } finally { <BUG>if (cursor != null) cursor.close(); }</BUG> } private boolean isExternalStorageDocument(Uri uri) { return "com.android.externalstorage.documents".equals(uri.getAuthority());
if (cursor != null) {
15,034
} public Activity activity() { return fragment() != null ? fragment().getActivity() : (Activity) ui; } @Nullable public Fragment fragment() { <BUG>if (ui instanceof Fragment) return (Fragment) ui; return null;</BUG> } public Object ui() { return ui;
if (ui instanceof Fragment) { return null;
15,035
import rx.Observable; public final class GrantPermissions extends UseCase<Void> {</BUG> private final TargetUi targetUi; private String[] permissions; <BUG>@Inject public GrantPermissions(TargetUi targetUi) { this.targetUi = targetUi;</BUG> } public GrantPermissions with(String... permissions) { this.permissions = permissions; return this;
import rx.functions.Func1; public final class GrantPermissions extends UseCase<Void> { this.targetUi = targetUi;
15,036
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.*;
15,037
.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);
15,038
</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) {
15,039
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)
15,040
.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))
15,041
.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))
15,042
@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;
15,043
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; }
15,044
return configDirectory; } public boolean isLoaded() { return loaded; } <BUG>public static Cause getCause() { return instance().pluginCause; }</BUG> public EconomyService getEconomyService() { return economyService;
[DELETED]
15,045
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.*;
15,046
.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))
15,047
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) -> {
15,048
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);
15,049
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);
15,050
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() + "\"");
15,051
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() + "\"");
15,052
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
15,053
.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")
15,054
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;
15,055
} 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;
15,056
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;
15,057
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;
15,058
import com.google.cloud.MonitoredResource; import com.google.cloud.MonitoredResourceDescriptor; import com.google.cloud.Page; import com.google.cloud.PageImpl; import com.google.cloud.logging.spi.LoggingRpc; <BUG>import com.google.cloud.logging.spi.v2.ConfigServiceV2Client; import com.google.cloud.logging.spi.v2.LoggingServiceV2Client; import com.google.cloud.logging.spi.v2.MetricsServiceV2Client;</BUG> import com.google.common.base.Function; import com.google.common.base.Throwables;
[DELETED]
15,059
import com.google.logging.v2.ListLogMetricsRequest; import com.google.logging.v2.ListLogMetricsResponse; import com.google.logging.v2.ListMonitoredResourceDescriptorsRequest; import com.google.logging.v2.ListMonitoredResourceDescriptorsResponse; import com.google.logging.v2.ListSinksRequest; <BUG>import com.google.logging.v2.ListSinksResponse; import com.google.logging.v2.UpdateLogMetricRequest;</BUG> import com.google.logging.v2.UpdateSinkRequest; import com.google.logging.v2.WriteLogEntriesRequest; import com.google.logging.v2.WriteLogEntriesResponse;
import com.google.logging.v2.LogName; import com.google.logging.v2.MetricName; import com.google.logging.v2.ProjectName; import com.google.logging.v2.SinkName; import com.google.logging.v2.UpdateLogMetricRequest;
15,060
return get(createAsync(sink)); } @Override public Future<Sink> createAsync(SinkInfo sink) { CreateSinkRequest request = CreateSinkRequest.newBuilder() <BUG>.setParent(ConfigServiceV2Client.formatParentName(getOptions().getProjectId())) .setSink(sink.toPb(getOptions().getProjectId()))</BUG> .build(); return transform(rpc.create(request), Sink.fromPbFunction(this)); }
.setParent(ProjectName.create(getOptions().getProjectId()).toString()) .setSink(sink.toPb(getOptions().getProjectId()))
15,061
return get(updateAsync(sink)); } @Override public Future<Sink> updateAsync(SinkInfo sink) { UpdateSinkRequest request = UpdateSinkRequest.newBuilder() <BUG>.setSinkName(ConfigServiceV2Client.formatSinkName(getOptions().getProjectId(), sink.getName())) .setSink(sink.toPb(getOptions().getProjectId()))</BUG> .build(); return transform(rpc.update(request), Sink.fromPbFunction(this)); }
.setSinkName(SinkName.create(getOptions().getProjectId(), sink.getName()).toString()) .setSink(sink.toPb(getOptions().getProjectId()))
15,062
return get(getSinkAsync(sink)); } @Override public Future<Sink> getSinkAsync(String sink) { GetSinkRequest request = GetSinkRequest.newBuilder() <BUG>.setSinkName(ConfigServiceV2Client.formatSinkName(getOptions().getProjectId(), sink)) .build();</BUG> return transform(rpc.get(request), Sink.fromPbFunction(this)); } private static ListSinksRequest listSinksRequest(LoggingOptions serviceOptions,
.setSinkName(SinkName.create(getOptions().getProjectId(), sink).toString()) .build();
15,063
return transform(rpc.get(request), Sink.fromPbFunction(this)); } private static ListSinksRequest listSinksRequest(LoggingOptions serviceOptions, Map<Option.OptionType, ?> options) { ListSinksRequest.Builder builder = ListSinksRequest.newBuilder(); <BUG>builder.setParent(ConfigServiceV2Client.formatParentName(serviceOptions.getProjectId())); Integer pageSize = PAGE_SIZE.get(options);</BUG> String pageToken = PAGE_TOKEN.get(options); if (pageSize != null) { builder.setPageSize(pageSize);
builder.setParent(ProjectName.create(serviceOptions.getProjectId()).toString()); Integer pageSize = PAGE_SIZE.get(options);
15,064
return get(deleteSinkAsync(sink)); } @Override public Future<Boolean> deleteSinkAsync(String sink) { DeleteSinkRequest request = DeleteSinkRequest.newBuilder() <BUG>.setSinkName(ConfigServiceV2Client.formatSinkName(getOptions().getProjectId(), sink)) .build();</BUG> return transform(rpc.delete(request), EMPTY_TO_BOOLEAN_FUNCTION); } public boolean deleteLog(String log) {
.setSinkName(SinkName.create(getOptions().getProjectId(), sink).toString()) .build();
15,065
public boolean deleteLog(String log) { return get(deleteLogAsync(log)); } public Future<Boolean> deleteLogAsync(String log) { DeleteLogRequest request = DeleteLogRequest.newBuilder() <BUG>.setLogName(LoggingServiceV2Client.formatLogName(getOptions().getProjectId(), log)) .build();</BUG> return transform(rpc.delete(request), EMPTY_TO_BOOLEAN_FUNCTION); } private static ListMonitoredResourceDescriptorsRequest listMonitoredResourceDescriptorsRequest(
.setLogName(LogName.create(getOptions().getProjectId(), log).toString()) .build();
15,066
return get(createAsync(metric)); } @Override public Future<Metric> createAsync(MetricInfo metric) { CreateLogMetricRequest request = CreateLogMetricRequest.newBuilder() <BUG>.setParent(MetricsServiceV2Client.formatParentName(getOptions().getProjectId())) .setMetric(metric.toPb())</BUG> .build(); return transform(rpc.create(request), Metric.fromPbFunction(this)); }
.setParent(ProjectName.create(getOptions().getProjectId()).toString()) .setMetric(metric.toPb())
15,067
public Metric update(MetricInfo metric) { return get(updateAsync(metric)); } @Override public Future<Metric> updateAsync(MetricInfo metric) { <BUG>UpdateLogMetricRequest request = UpdateLogMetricRequest.newBuilder() .setMetricName(MetricsServiceV2Client.formatMetricName(getOptions().getProjectId(), metric.getName()))</BUG> .setMetric(metric.toPb()) .build();
.setMetricName(MetricName.create(getOptions().getProjectId(), metric.getName()).toString())
15,068
return get(getMetricAsync(metric)); } @Override public Future<Metric> getMetricAsync(String metric) { GetLogMetricRequest request = GetLogMetricRequest.newBuilder() <BUG>.setMetricName(MetricsServiceV2Client.formatMetricName(getOptions().getProjectId(), metric)) .build();</BUG> return transform(rpc.get(request), Metric.fromPbFunction(this)); } private static ListLogMetricsRequest listMetricsRequest(LoggingOptions serviceOptions,
.setMetricName(MetricName.create(getOptions().getProjectId(), metric).toString()) .build();
15,069
return transform(rpc.get(request), Metric.fromPbFunction(this)); } private static ListLogMetricsRequest listMetricsRequest(LoggingOptions serviceOptions, Map<Option.OptionType, ?> options) { ListLogMetricsRequest.Builder builder = ListLogMetricsRequest.newBuilder(); <BUG>builder.setParent(MetricsServiceV2Client.formatParentName(serviceOptions.getProjectId())); Integer pageSize = PAGE_SIZE.get(options);</BUG> String pageToken = PAGE_TOKEN.get(options); if (pageSize != null) { builder.setPageSize(pageSize);
builder.setParent(ProjectName.create(serviceOptions.getProjectId()).toString()); Integer pageSize = PAGE_SIZE.get(options);
15,070
return get(deleteMetricAsync(metric)); } @Override public Future<Boolean> deleteMetricAsync(String metric) { DeleteLogMetricRequest request = DeleteLogMetricRequest.newBuilder() <BUG>.setMetricName(MetricsServiceV2Client.formatMetricName(getOptions().getProjectId(), metric)) .build();</BUG> return transform(rpc.delete(request), EMPTY_TO_BOOLEAN_FUNCTION); } private static WriteLogEntriesRequest writeLogEntriesRequest(LoggingOptions serviceOptions,
.setMetricName(MetricName.create(getOptions().getProjectId(), metric).toString()) .build();
15,071
Iterable<LogEntry> logEntries, Map<Option.OptionType, ?> options) { String projectId = serviceOptions.getProjectId(); WriteLogEntriesRequest.Builder builder = WriteLogEntriesRequest.newBuilder(); String logName = LOG_NAME.get(options); if (logName != null) { <BUG>builder.setLogName(LoggingServiceV2Client.formatLogName(projectId, logName)); }</BUG> MonitoredResource resource = RESOURCE.get(options); if (resource != null) { builder.setResource(resource.toPb());
builder.setLogName(LogName.create(projectId, logName).toString()); }
15,072
static LogEntry fromPb(com.google.logging.v2.LogEntry entryPb) { Builder builder = newBuilder(Payload.fromPb(entryPb)); builder.setLabels(entryPb.getLabelsMap()); builder.setSeverity(Severity.fromPb(entryPb.getSeverity())); if (!entryPb.getLogName().equals("")) { <BUG>builder.setLogName(LoggingServiceV2Client.parseLogFromLogName(entryPb.getLogName())); }</BUG> if (!entryPb.getResource().equals(com.google.api.MonitoredResource.getDefaultInstance())) { builder.setResource(MonitoredResource.fromPb(entryPb.getResource())); }
builder.setLogName(LogName.parse(entryPb.getLogName()).getLog());
15,073
ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader(); try { if (plexusClassLoader != null) { Thread.currentThread().setContextClassLoader(plexusClassLoader); } <BUG>doExecute(); } finally {</BUG> plexusClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(originalClassLoader); }
publish(); } finally {
15,074
for (AdditionalArtifact attachedArtifact : additionalArtifacts) { Artifact attach = createAttachedArtifact(artifact, attachedArtifact.getType(), attachedArtifact.getClassifier()); doPublish(attach, attachedArtifact.getFile(), localRepo); } } <BUG>public Artifact createMainArtifact(ParsedMavenPom builder) { return new DefaultArtifact(builder.getGroup(), builder.getArtifactId(), VersionRange.createFromVersion(builder.getVersion()), null, builder.getPackaging(), null, artifactHandler(builder.getPackaging())); } public Artifact createAttachedArtifact(Artifact mainArtifact, String type, String classifier) { </BUG> return new AttachedArtifact(mainArtifact, type, classifier, artifactHandler(type));
[DELETED]
15,075
import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.geom.RoundRectangle2D; import java.util.LinkedList; import java.util.Queue; <BUG>import javax.swing.AbstractAction; import javax.swing.BorderFactory;</BUG> import javax.swing.GroupLayout; import javax.swing.JButton; import javax.swing.JFrame;
import javax.swing.Action; import javax.swing.BorderFactory;
15,076
import javax.swing.JLayeredPane; import javax.swing.JPanel; import javax.swing.JToolBar; import javax.swing.SwingUtilities; import javax.swing.Timer; <BUG>import org.openstreetmap.josm.Main; import org.openstreetmap.josm.tools.ImageProvider;</BUG> class NotificationManager { private Timer hideTimer; // started when message is shown, responsible for hiding the message private Timer pauseTimer; // makes sure the is a small pause between to consecutive messages
import org.openstreetmap.josm.gui.help.HelpBrowser; import org.openstreetmap.josm.gui.help.HelpUtil; import org.openstreetmap.josm.tools.ImageProvider;
15,077
build(note); } public void setNotificationBackground(Color c) { innerPanel.setBackground(c); } <BUG>private void build(Notification note) { JButton close = new JButton(new HideAction()); close.setPreferredSize(new Dimension(50, 50)); JToolBar tbClose = new JToolBar(); close.setMargin(new Insets(0, 0, 1, 1)); close.setContentAreaFilled(false);</BUG> tbClose.setFloatable(false);
private void build(final Notification note) { JButton btnClose = new JButton(new HideAction()); btnClose.setPreferredSize(new Dimension(50, 50)); btnClose.setMargin(new Insets(0, 0, 1, 1)); btnClose.setContentAreaFilled(false);
15,078
public class Notification { public final static int DEFAULT_CONTENT_WIDTH = 350; public final static int TIME_SHORT = Main.pref.getInteger("notification-time-short-ms", 3000); public final static int TIME_DEFAULT = Main.pref.getInteger("notification-time-default-ms", 5000); public final static int TIME_LONG = Main.pref.getInteger("notification-time-long-ms", 10000); <BUG>public final static int TIME_VERY_LONG = Main.pref.getInteger("notification-time-very_long-ms", 20000); private Icon icon; private int duration; private Component content;</BUG> public Notification() {
private Component content; private String helpTopic;
15,079
case JOptionPane.PLAIN_MESSAGE: return setIcon(null); default: throw new IllegalArgumentException("Unknown message type!"); } <BUG>} public Component getContent() {</BUG> return content; } public int getDuration() {
public Notification setHelpTopic(String helpTopic) { this.helpTopic = helpTopic; return this; public Component getContent() {
15,080
import org.openstreetmap.josm.data.osm.DataSet; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.data.osm.OsmPrimitive; import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.gui.HelpAwareOptionPane; <BUG>import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec; import org.openstreetmap.josm.gui.help.HelpUtil;</BUG> import org.openstreetmap.josm.tools.ImageProvider; import org.openstreetmap.josm.tools.Shortcut; public class SimplifyWayAction extends JosmAction {
import org.openstreetmap.josm.gui.Notification; import org.openstreetmap.josm.gui.help.HelpUtil;
15,081
e.printStackTrace(); } filePlayback=null; } @Override <BUG>public void stop() { if ( filePlayback!=null ) filePlayback.stop(); } void initFiles() throws FileNotFoundException {</BUG> if ((dataDir.length() != 0) && !dataDir.endsWith("/")) { dataDir = dataDir + "/"; } // guard path if needed String samples_str = dataDir + "samples"; String events_str = dataDir + "events";
@Override public boolean isrunning(){ if ( filePlayback!=null ) return filePlayback.isrunning(); return false; } void initFiles() throws FileNotFoundException {
15,082
public class BufferMonitor extends Thread implements FieldtripBufferMonitor { public static final String TAG = BufferMonitor.class.toString(); private final Context context; private final SparseArray<BufferConnectionInfo> clients = new SparseArray<BufferConnectionInfo>(); private final BufferInfo info; <BUG>private final BroadcastReceiver mMessageReceiver = new BroadcastReceiver() { @Override public void onReceive(final Context context, final Intent intent) { if (intent.getIntExtra(C.MESSAGE_TYPE, -1) == C.UPDATE_REQUEST) { Log.i(TAG, "Received update request."); sendAllInfo(); } } };</BUG> private boolean run = true;
[DELETED]
15,083
public static final String CLIENT_INFO_TIME = "c_time"; public static final String CLIENT_INFO_WAITTIMEOUT = "c_waitTimeout"; public static final String CLIENT_INFO_CONNECTED = "c_connected"; public static final String CLIENT_INFO_CHANGED = "c_changed"; public static final String CLIENT_INFO_DIFF = "c_diff"; <BUG>public static final int UPDATE_REQUEST = 0; </BUG> public static final int UPDATE = 1; public static final int REQUEST_PUT_HEADER = 2; public static final int REQUEST_FLUSH_HEADER = 3;
public static final int THREAD_INFO_TYPE = 0;
15,084
package nl.dcc.buffer_bci.bufferclientsservice; import android.os.Parcel; import android.os.Parcelable; <BUG>import nl.dcc.buffer_bci.bufferservicecontroller.C; public class ThreadInfo implements Parcelable {</BUG> public static final Creator<ThreadInfo> CREATOR = new Creator<ThreadInfo>() { @Override public ThreadInfo createFromParcel(final Parcel in) {
import nl.dcc.buffer_bci.C; public class ThreadInfo implements Parcelable {
15,085
else if (t == ANY_CYPHER_OPTION) { r = AnyCypherOption(b, 0); } else if (t == ANY_FUNCTION_INVOCATION) { r = AnyFunctionInvocation(b, 0); <BUG>} else if (t == BULK_IMPORT_QUERY) {</BUG> r = BulkImportQuery(b, 0); } else if (t == CALL) {
else if (t == ARRAY) { r = Array(b, 0); else if (t == BULK_IMPORT_QUERY) {
15,086
if (!r) r = MapLiteral(b, l + 1); if (!r) r = MapProjection(b, l + 1); if (!r) r = CountStar(b, l + 1); if (!r) r = ListComprehension(b, l + 1); if (!r) r = PatternComprehension(b, l + 1); <BUG>if (!r) r = Expression1_12(b, l + 1); if (!r) r = FilterFunctionInvocation(b, l + 1);</BUG> if (!r) r = ExtractFunctionInvocation(b, l + 1); if (!r) r = ReduceFunctionInvocation(b, l + 1); if (!r) r = AllFunctionInvocation(b, l + 1);
if (!r) r = Array(b, l + 1); if (!r) r = FilterFunctionInvocation(b, l + 1);
15,087
import java.util.UUID; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; <BUG>import javax.servlet.http.HttpServletResponse; import org.apache.commons.fileupload.servlet.ServletFileUpload;</BUG> import org.apache.commons.io.IOUtils; import org.apache.log4j.Logger; import azkaban.project.Project;
import azkaban.utils.WebUtils; import org.apache.commons.fileupload.servlet.ServletFileUpload;
15,088
if (ServletFileUpload.isMultipartContent(req)) { Map<String, Object> params = multipartParser.parseMultipart(req); if (session == null) { if (params.containsKey("session.id")) { String sessionId = (String) params.get("session.id"); <BUG>String ip = req.getRemoteAddr(); session = getSessionFromSessionId(sessionId, ip);</BUG> if (session != null) { handleMultiformPost(req, resp, params, session); return;
String ip = getRealClientIpAddr(req); session = getSessionFromSessionId(sessionId, ip);
15,089
writeResponse(resp, "Login error. Need username and password"); return; } String username = (String) params.get("username"); String password = (String) params.get("password"); <BUG>String ip = req.getRemoteAddr(); try {</BUG> session = createSession(username, password, ip); } catch (UserManagerException e) { writeResponse(resp, "Login error: " + e.getMessage());
String ip = getRealClientIpAddr(req); try {
15,090
import azkaban.project.Project; import azkaban.user.Permission; import azkaban.user.Role; import azkaban.user.User; import azkaban.user.UserManager; <BUG>import azkaban.user.UserManagerException; import azkaban.webapp.AzkabanWebServer; import azkaban.server.session.Session; public class ResourceUtils {</BUG> public static boolean hasPermission(Project project, User user,
import azkaban.utils.WebUtils; import com.linkedin.restli.server.ResourceContext; import java.util.Map; public class ResourceUtils {
15,091
package azkaban.utils; <BUG>import java.text.NumberFormat; import org.joda.time.DateTime;</BUG> import org.joda.time.DurationFieldType; import org.joda.time.ReadablePeriod; import org.joda.time.format.DateTimeFormat;
import java.util.Map; import org.joda.time.DateTime;
15,092
public class WebUtils { public static final String DATE_TIME_STRING = "YYYY-MM-dd HH:mm:ss"; private static final long ONE_KB = 1024; private static final long ONE_MB = 1024 * ONE_KB; private static final long ONE_GB = 1024 * ONE_MB; <BUG>private static final long ONE_TB = 1024 * ONE_GB; public String formatDate(long timeMS) {</BUG> if (timeMS == -1) { return "-"; }
public static final String X_FORWARDED_FOR_HEADER = "X-Forwarded-For"; public String formatDate(long timeMS) {
15,093
return AzkabanWebServer.getInstance(); } @Action(name = "login") public String login(@ActionParam("username") String username, @ActionParam("password") String password) throws UserManagerException, <BUG>ServletException { String ip = (String) this.getContext().getRawRequestContext() .getLocalAttr("REMOTE_ADDR");</BUG> logger
String ip = ResourceUtils.getRealClientIpAddr(this.getContext());
15,094
logger.info("Session id " + session.getSessionId() + " created for user '" + username + "' and ip " + ip); return session.getSessionId(); } @Action(name = "getUserFromSessionId") <BUG>public User getUserFromSessionId(@ActionParam("sessionId") String sessionId) { String ip = (String) this.getContext().getRawRequestContext() .getLocalAttr("REMOTE_ADDR");</BUG> Session session = getSessionFromSessionId(sessionId, ip);
String ip = ResourceUtils.getRealClientIpAddr(this.getContext());
15,095
@ActionParam("projectName") String projectName, @ActionParam("packageUrl") String packageUrl) throws ProjectManagerException, RestLiServiceException, UserManagerException, ServletException, IOException { logger.info("Deploy called. {sessionId: " + sessionId + ", projectName: " <BUG>+ projectName + ", packageUrl:" + packageUrl + "}"); String ip = (String) this.getContext().getRawRequestContext() .getLocalAttr("REMOTE_ADDR");</BUG> User user = ResourceUtils.getUserFromSessionId(sessionId, ip);
String ip = ResourceUtils.getRealClientIpAddr(this.getContext());
15,096
Debug.checkNull("mysql_connection", this.mysql_connection); return this.mysql_connection; } @Override public String toString () { <BUG>return "MySQLConnection[" + this.dataSource.getUrl() + " : " + this.dataSource.getURL() + "]"; }</BUG> @Override protected void finalize () throws Throwable { super.finalize();
return "MySQLConnection[" + this.mySQL.getUrl() + "]";
15,097
package com.jfixby.cmns.adopted.gdx.log; import com.badlogic.gdx.Application; import com.badlogic.gdx.Gdx; import com.jfixby.cmns.api.collections.EditableCollection; <BUG>import com.jfixby.cmns.api.collections.Map; import com.jfixby.cmns.api.log.LoggerComponent;</BUG> import com.jfixby.cmns.api.util.JUtils; public class GdxLogger implements LoggerComponent { public GdxLogger () {
import com.jfixby.cmns.api.err.Err; import com.jfixby.cmns.api.log.LoggerComponent;
15,098
package com.jfixby.red.collections; <BUG>import com.jfixby.cmns.api.java.IntValue; import com.jfixby.cmns.api.math.FloatMath;</BUG> public class RedHistogrammValue { private RedHistogramm master; public RedHistogrammValue (RedHistogramm redHistogramm) {
import com.jfixby.cmns.api.java.Int; import com.jfixby.cmns.api.math.FloatMath;
15,099
public static final String PackageName = "app.version.package_name"; } public static final String VERSION_FILE_NAME = "version.json"; private static final long serialVersionUID = 6662721574596241247L; public String packageName; <BUG>public int major = -1; public int minor = -1; public VERSION_STAGE stage = null; public int build = -1; </BUG> public int versionCode = -1;
public String major = ""; public String minor = ""; public String build = "";
15,100
<BUG>package com.jfixby.cmns.db.mysql; import com.jfixby.cmns.api.debug.Debug;</BUG> import com.jfixby.cmns.api.log.L; import com.jfixby.cmns.db.api.DBComponent; import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
import java.sql.Connection; import java.sql.SQLException; import com.jfixby.cmns.api.debug.Debug;