id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
40,601
return configDirectory; } public boolean isLoaded() { return loaded; } <BUG>public static Cause getCause() { return instance().pluginCause; }</BUG> public EconomyService getEconomyService() { return economyService;
[DELETED]
40,602
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.*;
40,603
.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))
40,604
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) -> {
40,605
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);
40,606
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);
40,607
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() + "\"");
40,608
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() + "\"");
40,609
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
40,610
.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")
40,611
import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.os.Handler; <BUG>import android.support.v4.app.NavUtils; import android.support.v7.app.AppCompatActivity;</BUG> import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.ContextMenu;
import android.support.v4.view.MenuItemCompat; import android.support.v7.app.AppCompatActivity;
40,612
import android.database.ContentObserver; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; import android.os.Handler; <BUG>import android.support.v4.app.NavUtils; import android.support.v7.app.AppCompatActivity;</BUG> import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.ContextMenu;
import android.support.v4.view.MenuItemCompat; import android.support.v7.app.AppCompatActivity;
40,613
import android.os.Handler; import android.os.Looper; import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.preference.PreferenceManager; <BUG>import android.support.design.widget.FloatingActionButton; import android.support.v7.widget.Toolbar;</BUG> import android.util.Log; import android.view.ContextMenu; import android.view.KeyEvent;
import android.support.v4.view.MenuItemCompat; import android.support.v7.widget.Toolbar;
40,614
mAltitude.setOnCheckedChangeListener(mCheckedChangeListener); mDistance.setOnCheckedChangeListener(mCheckedChangeListener); mCompass.setOnCheckedChangeListener(mCheckedChangeListener); mLocation.setOnCheckedChangeListener(mCheckedChangeListener); builder.setTitle(R.string.dialog_layer_title).setIcon(android.R.drawable.ic_dialog_map).setPositiveButton <BUG>(R.string.btn_okay, null).setView(view); </BUG> dialog = builder.create(); return dialog; case DIALOG_NOTRACK:
(android.R.string.ok, null).setView(view);
40,615
stopQmsService(); startQmsService(); </BUG> } <BUG>private static void startQmsService() { </BUG> m_QmsStarted = true; try { if (!QmsNotifier.isUse(getContext())) return;
startQmsService(adaptive); private static void startQmsService(Boolean adaptive) {
40,616
try { if (!QmsNotifier.isUse(getContext())) return; Intent intent = new Intent(INSTANCE, MainService.class); intent.putExtra("CookiesPath", PreferencesActivity.getCookieFilePath(INSTANCE)); <BUG>intent.putExtra(QmsNotifier.TIME_OUT_KEY, Math.max(ExtPreferences.parseFloat(App.getInstance().getPreferences(), QmsNotifier.TIME_OUT_KEY, 5), 1)); QmsNotifier.restartTask(INSTANCE, intent);</BUG> } catch (Throwable e) {
float timeout = Math.max(ExtPreferences.parseFloat(App.getInstance().getPreferences(), QmsNotifier.TIME_OUT_KEY, 5), 1); intent.putExtra(QmsNotifier.TIME_OUT_KEY, timeout); if(adaptive) intent.putExtra(QmsNotifier.ADAPTIVE_TIME_OUT_KEY, 1.0f); QmsNotifier.restartTask(INSTANCE, intent);
40,617
import java.util.Locale; import java.util.Map; import java.util.TreeMap; public class DependencyConvergenceReport extends AbstractProjectInfoReport <BUG>{ private List reactorProjects; private static final int PERCENTAGE = 100;</BUG> public String getOutputName() {
private static final int PERCENTAGE = 100; private static final List SUPPORTED_FONT_FAMILY_NAMES = Arrays.asList( GraphicsEnvironment .getLocalGraphicsEnvironment().getAvailableFontFamilyNames() );
40,618
sink.section1(); sink.sectionTitle1(); sink.text( getI18nString( locale, "title" ) ); sink.sectionTitle1_(); Map dependencyMap = getDependencyMap(); <BUG>generateLegend( locale, sink ); generateStats( locale, sink, dependencyMap ); generateConvergence( locale, sink, dependencyMap ); sink.section1_();</BUG> sink.body_();
sink.lineBreak(); sink.section1_();
40,619
Iterator it = artifactMap.keySet().iterator(); while ( it.hasNext() ) { String version = (String) it.next(); sink.tableRow(); <BUG>sink.tableCell(); sink.text( version );</BUG> sink.tableCell_(); sink.tableCell(); generateVersionDetails( sink, artifactMap, version );
sink.tableCell( String.valueOf( cellWidth ) + "px" ); sink.text( version );
40,620
sink.tableCell(); sink.text( getI18nString( locale, "legend.shared" ) ); sink.tableCell_(); sink.tableRow_(); sink.tableRow(); <BUG>sink.tableCell(); iconError( sink );</BUG> sink.tableCell_(); sink.tableCell(); sink.text( getI18nString( locale, "legend.different" ) );
sink.tableCell( "15px" ); // according /images/icon_error_sml.gif iconError( sink );
40,621
sink.tableCaption(); sink.text( getI18nString( locale, "stats.caption" ) ); sink.tableCaption_();</BUG> sink.tableRow(); <BUG>sink.tableHeaderCell(); sink.text( getI18nString( locale, "stats.subprojects" ) + ":" ); sink.tableHeaderCell_();</BUG> sink.tableCell(); sink.text( String.valueOf( reactorProjects.size() ) ); sink.tableCell_();
sink.bold(); sink.bold_(); sink.tableCaption_(); sink.tableHeaderCell( headerCellWidth ); sink.text( getI18nString( locale, "stats.subprojects" ) ); sink.tableHeaderCell_();
40,622
sink.tableCell(); sink.text( String.valueOf( reactorProjects.size() ) ); sink.tableCell_(); sink.tableRow_(); sink.tableRow(); <BUG>sink.tableHeaderCell(); sink.text( getI18nString( locale, "stats.dependencies" ) + ":" ); sink.tableHeaderCell_();</BUG> sink.tableCell(); sink.text( String.valueOf( depCount ) );
sink.tableHeaderCell( headerCellWidth ); sink.text( getI18nString( locale, "stats.dependencies" ) ); sink.tableHeaderCell_();
40,623
sink.text( String.valueOf( convergence ) + "%" ); sink.bold_(); sink.tableCell_(); sink.tableRow_(); sink.tableRow(); <BUG>sink.tableHeaderCell(); sink.text( getI18nString( locale, "stats.readyrelease" ) + ":" ); sink.tableHeaderCell_();</BUG> sink.tableCell(); if ( convergence >= PERCENTAGE && snapshotCount <= 0 )
sink.tableHeaderCell( headerCellWidth ); sink.text( getI18nString( locale, "stats.readyrelease" ) ); sink.tableHeaderCell_();
40,624
{ ReverseDependencyLink p1 = (ReverseDependencyLink) o1; ReverseDependencyLink p2 = (ReverseDependencyLink) o2; return p1.getProject().getId().compareTo( p2.getProject().getId() ); } <BUG>else {</BUG> return 0; } }
iconError( sink );
40,625
R.raw.calendriers, "calendriers.txt"), new CoupleResourceFichier(R.raw.calendriers_exceptions, "calendriers_exceptions.txt"), new CoupleResourceFichier(R.raw.directions, "directions.txt"), new CoupleResourceFichier(R.raw.lignes, "lignes.txt"), new CoupleResourceFichier(R.raw.trajets, "trajets.txt")); startService(new Intent(UpdateTimeService.ACTION_UPDATE)); <BUG>PackageManager pm = getPackageManager(); pm.setComponentEnabledSetting(new ComponentName("fr.ybo.transportsbordeaux", ".services.UpdateTimeService"), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); new AsyncTask<Void, Void, Void>() {</BUG> @Override
if (pm != null) { pm.setComponentEnabledSetting(new ComponentName(this, UpdateTimeService.class), } new AsyncTask<Void, Void, Void>() {
40,626
new CoupleResourceFichier(R.raw.arrets_routes, "arrets_routes.txt"), new CoupleResourceFichier( R.raw.calendriers, "calendriers.txt"), new CoupleResourceFichier(R.raw.directions, "directions.txt"), new CoupleResourceFichier(R.raw.lignes, "lignes.txt"), new CoupleResourceFichier(R.raw.trajets, "trajets.txt")); startService(new Intent(UpdateTimeService.ACTION_UPDATE)); <BUG>PackageManager pm = getPackageManager(); pm.setComponentEnabledSetting(new ComponentName("fr.ybo.transportsrennes", ".services.UpdateTimeService"), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); final String dateCourante = new SimpleDateFormat("ddMMyyyy").format(new Date());</BUG> Bounds boundsBdd = getDataBaseHelper().selectSingle(new Bounds());
if (pm != null) { pm.setComponentEnabledSetting(new ComponentName(this, UpdateTimeService.class), } final String dateCourante = new SimpleDateFormat("ddMMyyyy").format(new Date());
40,627
import org.junit.After; import org.junit.Before; import org.junit.Test; import java.io.File; import java.io.IOException; <BUG>import java.net.URL; </BUG> import java.util.concurrent.TimeUnit; import static org.elasticsearch.test.ElasticsearchIntegrationTest.*; import static org.hamcrest.CoreMatchers.is;
import java.net.URI;
40,628
deletePluginsFolder(); } @Test public void testLocalPluginInstallSingleFolder() throws Exception { String pluginName = "plugin-test"; <BUG>URL url = PluginManagerTests.class.getResource("plugin_single_folder.zip"); downloadAndExtract(pluginName, "file://" + url.getFile()); </BUG> cluster().startNode(SETTINGS);
@Before public void beforeTest() { URI uri = URI.create(PluginManagerTests.class.getResource("plugin_single_folder.zip").toString()); downloadAndExtract(pluginName, "file://" + uri.getPath());
40,629
assertPluginAvailable(pluginName); } @Test public void testLocalPluginInstallSiteFolder() throws Exception { String pluginName = "plugin-test"; <BUG>URL url = PluginManagerTests.class.getResource("plugin_folder_site.zip"); downloadAndExtract(pluginName, "file://" + url.getFile()); </BUG> String nodeName = cluster().startNode(SETTINGS);
URI uri = URI.create(PluginManagerTests.class.getResource("plugin_folder_site.zip").toString()); downloadAndExtract(pluginName, "file://" + uri.getPath());
40,630
assertPluginAvailable(pluginName); } @Test public void testLocalPluginWithoutFolders() throws Exception { String pluginName = "plugin-test"; <BUG>URL url = PluginManagerTests.class.getResource("plugin_without_folders.zip"); downloadAndExtract(pluginName, "file://" + url.getFile()); </BUG> cluster().startNode(SETTINGS);
public void testLocalPluginInstallSiteFolder() throws Exception { URI uri = URI.create(PluginManagerTests.class.getResource("plugin_folder_site.zip").toString()); downloadAndExtract(pluginName, "file://" + uri.getPath()); String nodeName = cluster().startNode(SETTINGS);
40,631
assertPluginAvailable(pluginName); } @Test public void testLocalPluginFolderAndFile() throws Exception { String pluginName = "plugin-test"; <BUG>URL url = PluginManagerTests.class.getResource("plugin_folder_file.zip"); downloadAndExtract(pluginName, "file://" + url.getFile()); </BUG> cluster().startNode(SETTINGS);
public void testLocalPluginInstallSiteFolder() throws Exception { URI uri = URI.create(PluginManagerTests.class.getResource("plugin_folder_site.zip").toString()); downloadAndExtract(pluginName, "file://" + uri.getPath()); String nodeName = cluster().startNode(SETTINGS);
40,632
public void testInstallPluginNull() throws IOException { pluginManager(null).downloadAndExtract(""); } @Test public void testInstallPlugin() throws IOException { <BUG>PluginManager pluginManager = pluginManager("file://".concat(PluginManagerTests.class.getResource("plugin_with_classfile.zip").getFile())); pluginManager.downloadAndExtract("plugin");</BUG> File[] plugins = pluginManager.getListInstalledPlugins(); assertThat(plugins, notNullValue()); assertThat(plugins.length, is(1));
PluginManager pluginManager = pluginManager("file://".concat( URI.create(PluginManagerTests.class.getResource("plugin_with_classfile.zip").toString()).getPath())); pluginManager.downloadAndExtract("plugin");
40,633
private void deletePluginsFolder() { FileSystemUtils.deleteRecursively(new File(PLUGIN_DIR)); } @Test public void testRemovePlugin() throws Exception { <BUG>singlePluginInstallAndRemove("plugintest", "file://".concat(PluginManagerTests.class.getResource("plugin_without_folders.zip").getFile())); singlePluginInstallAndRemove("groupid/plugintest/1.0.0", "file://".concat(PluginManagerTests.class.getResource("plugin_without_folders.zip").getFile())); singlePluginInstallAndRemove("groupid/plugintest", "file://".concat(PluginManagerTests.class.getResource("plugin_without_folders.zip").getFile())); }</BUG> @Test(expected = ElasticsearchIllegalArgumentException.class)
singlePluginInstallAndRemove("plugintest", "file://".concat( URI.create(PluginManagerTests.class.getResource("plugin_without_folders.zip").toString()).getPath())); singlePluginInstallAndRemove("groupid/plugintest/1.0.0", "file://".concat( URI.create(PluginManagerTests.class.getResource("plugin_without_folders.zip").toString()).getPath())); singlePluginInstallAndRemove("groupid/plugintest", "file://".concat( URI.create(PluginManagerTests.class.getResource("plugin_without_folders.zip").toString()).getPath()));
40,634
systemBuckets.addAll(bucketNames); } }catch(final Exception ex){ throw new Exception("Failed to check the existing buckets", ex); } <BUG>} for(final ImageInfo image: images){</BUG> try{ if(!(image instanceof MachineImageInfo)) continue;
String newBucket = null; for(final ImageInfo image: images){
40,635
}catch(final Exception ex2){ ; }</BUG> try{ Images.setImageState(image.getDisplayName(), ImageMetadata.State.failed); <BUG>}catch(final Exception ex2){ ; }</BUG> }
LOG.error("Failed to cleanup the image's system bucket; setting image state failed: "+image.getDisplayName()); }catch(final Exception ex3){
40,636
this.cleanupBuckets(Lists.newArrayList(image), false); }catch(final Exception ex2){ </BUG> ; } <BUG>LOG.error("Failed to convert partitioned image", ex); }catch(final Exception ex1){ ;</BUG> } }
this.resetImagePendingAvailable(image.getDisplayName(), null); }catch(final Exception ex){ LOG.error("Failed to cleanup the image's system bucket; setting image state failed: "+image.getDisplayName()); Images.setImageState(machineImage.getDisplayName(), ImageMetadata.State.failed);
40,637
import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.LocalFileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.util.Progressable; <BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*; public class S3AFileSystem extends FileSystem {</BUG> private URI uri; private Path workingDir; private AmazonS3Client s3;
import static org.apache.hadoop.fs.s3a.Constants.*; public class S3AFileSystem extends FileSystem {
40,638
public void initialize(URI name, Configuration conf) throws IOException { super.initialize(name, conf); uri = URI.create(name.getScheme() + "://" + name.getAuthority()); workingDir = new Path("/user", System.getProperty("user.name")).makeQualified(this.uri, this.getWorkingDirectory()); <BUG>String accessKey = conf.get(ACCESS_KEY, null); String secretKey = conf.get(SECRET_KEY, null); </BUG> String userInfo = name.getUserInfo();
String accessKey = conf.get(NEW_ACCESS_KEY, conf.get(OLD_ACCESS_KEY, null)); String secretKey = conf.get(NEW_SECRET_KEY, conf.get(OLD_SECRET_KEY, null));
40,639
} else { accessKey = userInfo; } } AWSCredentialsProviderChain credentials = new AWSCredentialsProviderChain( <BUG>new S3ABasicAWSCredentialsProvider(accessKey, secretKey), new InstanceProfileCredentialsProvider(), new S3AAnonymousAWSCredentialsProvider() );</BUG> bucket = name.getHost();
new BasicAWSCredentialsProvider(accessKey, secretKey), new AnonymousAWSCredentialsProvider()
40,640
awsConf.setSocketTimeout(conf.getInt(SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT)); </BUG> s3 = new AmazonS3Client(credentials, awsConf); <BUG>maxKeys = conf.getInt(MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS); partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD); </BUG> if (partSize < 5 * 1024 * 1024) {
new InstanceProfileCredentialsProvider(), new AnonymousAWSCredentialsProvider() bucket = name.getHost(); ClientConfiguration awsConf = new ClientConfiguration(); awsConf.setMaxConnections(conf.getInt(NEW_MAXIMUM_CONNECTIONS, conf.getInt(OLD_MAXIMUM_CONNECTIONS, DEFAULT_MAXIMUM_CONNECTIONS))); awsConf.setProtocol(conf.getBoolean(NEW_SECURE_CONNECTIONS, conf.getBoolean(OLD_SECURE_CONNECTIONS, DEFAULT_SECURE_CONNECTIONS)) ? Protocol.HTTPS : Protocol.HTTP); awsConf.setMaxErrorRetry(conf.getInt(NEW_MAX_ERROR_RETRIES, conf.getInt(OLD_MAX_ERROR_RETRIES, DEFAULT_MAX_ERROR_RETRIES))); awsConf.setSocketTimeout(conf.getInt(NEW_SOCKET_TIMEOUT, conf.getInt(OLD_SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT))); maxKeys = conf.getInt(NEW_MAX_PAGING_KEYS, conf.getInt(OLD_MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS)); partSize = conf.getLong(NEW_MULTIPART_SIZE, conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE)); partSizeThreshold = conf.getInt(NEW_MIN_MULTIPART_THRESHOLD, conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD));
40,641
cannedACL = null; } if (!s3.doesBucketExist(bucket)) { throw new IOException("Bucket " + bucket + " does not exist"); } <BUG>boolean purgeExistingMultipart = conf.getBoolean(PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART); long purgeExistingMultipartAge = conf.getLong(PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE); </BUG> if (purgeExistingMultipart) {
boolean purgeExistingMultipart = conf.getBoolean(NEW_PURGE_EXISTING_MULTIPART, conf.getBoolean(OLD_PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART)); long purgeExistingMultipartAge = conf.getLong(NEW_PURGE_EXISTING_MULTIPART_AGE, conf.getLong(OLD_PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE));
40,642
import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; <BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*; public class S3AOutputStream extends OutputStream {</BUG> private OutputStream backupStream; private File backupFile; private boolean closed;
import static org.apache.hadoop.fs.s3a.Constants.*; public class S3AOutputStream extends OutputStream {
40,643
this.client = client; this.progress = progress; this.fs = fs; this.cannedACL = cannedACL; this.statistics = statistics; <BUG>partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD); </BUG> if (conf.get(BUFFER_DIR, null) != null) {
partSize = conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD);
40,644
package com.daasuu.library.anim; import android.graphics.Canvas; import com.daasuu.library.Anim; <BUG>import com.daasuu.library.AnimParameter; import com.daasuu.library.callback.AnimCallBack;</BUG> import com.daasuu.library.constant.Constant; import com.daasuu.library.easing.Ease; import com.daasuu.library.easing.EaseProvider;
import com.daasuu.library.DisplayObject2; import com.daasuu.library.callback.AnimCallBack;
40,645
protected long mFps = 1000 / Constant.DEFAULT_FPS; private int mDrawCount = -1; protected final List<AnimParameter> mAnimParameters; protected final List<TweenParameter> mTweenParameters; private final Map<AnimParameter, AnimCallBack> mCallbacks; <BUG>public static Builder builder() { return new Builder(); </BUG> } public TweenAnim(boolean tweenLoop, AnimParameter initialParam, List<TweenParameter> tweenParameters) {
public static Builder builder(DisplayObject2 displayObject) { return new Builder(displayObject);
40,646
@Override public void call() { mFPSTextureView.removeChild(parabolicDisplay); } }) <BUG>.build() );</BUG> mFPSTextureView .setFps(24)
.build();
40,647
package com.daasuu.library.anim; import android.graphics.Canvas; import android.support.annotation.NonNull; import com.daasuu.library.Anim; <BUG>import com.daasuu.library.AnimParameter; import com.daasuu.library.callback.AnimCallBack;</BUG> import com.daasuu.library.constant.Constant; public class ParabolicAnim implements Anim { private static final String TAG = ParabolicAnim.class.getSimpleName();
import com.daasuu.library.DisplayObject2; import com.daasuu.library.callback.AnimCallBack;
40,648
private boolean mReboundRight = true; private AnimCallBack mBottomHitCallback; private AnimCallBack mLeftHitCallback; private AnimCallBack mRightHitCallback; private boolean mParabolicMotionPause = false; <BUG>public static Builder builder() { return new Builder(); </BUG> } private ParabolicAnim(AnimParameter initialPosition, int mDrawingNum, float mMovementY, float mCoefficientRestitutionY, float mCoefficientRestitutionX, float mInitialVelocityY, float mAccelerationY, float mAccelerationX, int mFrequency, float mBottomBase, float mRightSide, float mLeftSide, boolean mReboundBottom, boolean mReboundLeft, boolean mReboundRight, AnimCallBack mBottomHitCallback, AnimCallBack mLeftHitCallback, AnimCallBack mRightHitCallback, boolean mParabolicMotionPause) {
public static Builder builder(DisplayObject2 displayObject) { return new Builder(displayObject);
40,649
private boolean mReboundRight = true; private AnimCallBack mBottomHitCallback; private AnimCallBack mLeftHitCallback; private AnimCallBack mRightHitCallback; private boolean mParabolicMotionPause = false; <BUG>private Builder() { } public ParabolicAnim build() { ParabolicAnim anim = new ParabolicAnim( new AnimParameter(x, y),</BUG> mDrawingNum,
private Builder(DisplayObject2 displayObject2) { mDisplayObject = displayObject2; public void build() { mDisplayObject.setAnim(new ParabolicAnim( new AnimParameter(x, y),
40,650
mReboundRight, mBottomHitCallback, mLeftHitCallback, mRightHitCallback, mParabolicMotionPause <BUG>); return anim;</BUG> } public Builder transform(float x, float y) {
));
40,651
} return new OrientJdbcResultSet(new OrientJdbcStatement(connection), records, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT); } public ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) <BUG>throws SQLException { final List<ODocument> records = new ArrayList<ODocument>(); final OFunction f = metadata.getFunctionLibrary().getFunction(procedureNamePattern); </BUG> for (String p : f.getParameters()) {
public String getUserName() throws SQLException { database.activateOnCurrentThread(); return database.getUser().getName();
40,652
doc.field("DATA_TYPE", java.sql.Types.OTHER); doc.field("SPECIFIC_NAME", f.getName()); records.add(doc);</BUG> } <BUG>final ODocument doc = new ODocument(); doc.field("PROCEDURE_CAT", (Object) null); doc.field("PROCEDURE_SCHEM", (Object) null); doc.field("PROCEDURE_NAME", f.getName()); doc.field("COLUMN_NAME", "return"); doc.field("COLUMN_TYPE", procedureColumnReturn); doc.field("DATA_TYPE", java.sql.Types.OTHER); doc.field("SPECIFIC_NAME", f.getName()); records.add(doc);</BUG> return new OrientJdbcResultSet(new OrientJdbcStatement(connection), records, ResultSet.TYPE_FORWARD_ONLY,
final List<ODocument> records = new ArrayList<ODocument>(); for (String fName : database.getMetadata().getFunctionLibrary().getFunctionNames()) { final ODocument doc = new ODocument() .field("PROCEDURE_CAT", (Object) null) .field("PROCEDURE_SCHEM", (Object) null) .field("PROCEDURE_NAME", fName) .field("REMARKS", "") .field("PROCEDURE_TYPE", procedureResultUnknown) .field("SPECIFIC_NAME", fName); records.add(doc);
40,653
final String type; if (OMetadata.SYSTEM_CLUSTER.contains(cls.getName())) type = "SYSTEM TABLE"; else type = "TABLE"; <BUG>if (tableTypes.contains(type) && (tableNamePattern == null || tableNamePattern.equals("%") || tableNamePattern.equalsIgnoreCase(className))) { </BUG> final ODocument doc = new ODocument() .field("TABLE_CAT", database.getName())
if (tableTypes.contains(type) && (tableNamePattern == null || tableNamePattern.equals("%") || tableNamePattern.equalsIgnoreCase(className))) {
40,654
} return new OrientJdbcResultSet(new OrientJdbcStatement(connection), records, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT); } @Override <BUG>public ResultSet getSchemas() throws SQLException { final List<ODocument> records = new ArrayList<ODocument>(); records.add(new ODocument().field("TABLE_SCHEM", database.getName()) .field("TABLE_CATALOG", database.getName()));</BUG> return new OrientJdbcResultSet(new OrientJdbcStatement(connection), records, ResultSet.TYPE_FORWARD_ONLY,
[DELETED]
40,655
records.add(new ODocument().field("TABLE_SCHEM", database.getName()) .field("TABLE_CATALOG", database.getName()));</BUG> return new OrientJdbcResultSet(new OrientJdbcStatement(connection), records, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT); } <BUG>public ResultSet getCatalogs() throws SQLException { final List<ODocument> records = new ArrayList<ODocument>();</BUG> records.add(new ODocument().field("TABLE_CAT", database.getName())); return new OrientJdbcResultSet(new OrientJdbcStatement(connection), records, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT);
@Override public ResultSet getSchemas() throws SQLException { database.activateOnCurrentThread(); final List<ODocument> records = new ArrayList<ODocument>(); records.add(new ODocument() .field("TABLE_CATALOG", database.getName()));
40,656
} final List<ODocument> records = new ArrayList<ODocument>(); for (OIndex<?> unique : uniqueIndexes) { int keyFiledSeq = 1; for (String keyFieldName : unique.getDefinition().getFields()) { <BUG>ODocument doc = new ODocument(); doc.field("TABLE_CAT", catalog); doc.field("TABLE_SCHEM", catalog); doc.field("TABLE_NAME", table); doc.field("COLUMN_NAME", keyFieldName); doc.field("KEY_SEQ", Integer.valueOf(keyFiledSeq), OType.INTEGER); doc.field("PK_NAME", unique.getName()); keyFiledSeq++;</BUG> records.add(doc);
return new OrientJdbcResultSet(new OrientJdbcStatement(connection), records, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT);
40,657
if (!unique || oIndex.getType().equals(INDEX_TYPE.UNIQUE.name())) indexes.add(oIndex); } final List<ODocument> records = new ArrayList<ODocument>(); for (OIndex<?> idx : indexes) { <BUG>boolean notUniqueIndex = !( idx.getType().equals(INDEX_TYPE.UNIQUE.name())); final String fieldNames = idx.getDefinition().getFields().toString();</BUG> ODocument doc = new ODocument() .field("TABLE_CAT", catalog) .field("TABLE_SCHEM", schema)
boolean notUniqueIndex = !(idx.getType().equals(INDEX_TYPE.UNIQUE.name())); final String fieldNames = idx.getDefinition().getFields().toString();
40,658
doc.field("DATA_TYPE", java.sql.Types.OTHER); doc.field("SPECIFIC_NAME", f.getName()); records.add(doc);</BUG> } <BUG>final ODocument doc = new ODocument(); doc.field("FUNCTION_CAT", (Object) null); doc.field("FUNCTION_SCHEM", (Object) null); doc.field("FUNCTION_NAME", f.getName()); doc.field("COLUMN_NAME", "return"); doc.field("COLUMN_TYPE", procedureColumnReturn); doc.field("DATA_TYPE", java.sql.Types.OTHER); doc.field("SPECIFIC_NAME", f.getName()); records.add(doc);</BUG> return new OrientJdbcResultSet(new OrientJdbcStatement(connection), records, ResultSet.TYPE_FORWARD_ONLY,
final List<ODocument> records = new ArrayList<ODocument>(); for (OClass cls : classes) { final ODocument doc = new ODocument() .field("TYPE_CAT", (Object) null) .field("TYPE_SCHEM", (Object) null) .field("TYPE_NAME", cls.getName()) .field("CLASS_NAME", cls.getName()) .field("DATA_TYPE", java.sql.Types.STRUCT) .field("REMARKS", (Object) null); records.add(doc);
40,659
package com.orientechnologies.orient.jdbc; import com.orientechnologies.orient.core.id.ORecordId; import org.junit.Test; import java.math.BigDecimal; <BUG>import java.sql.Date; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Statement; import java.sql.Types;</BUG> import java.util.Calendar;
import java.sql.*;
40,660
import java.sql.ResultSetMetaData; import java.sql.Statement; import java.sql.Types;</BUG> import java.util.Calendar; import java.util.TimeZone; <BUG>import static java.sql.Types.*; import static org.assertj.core.api.Assertions.*; </BUG> public class OrientJdbcResultSetMetaDataTest extends OrientJdbcBaseTest {
package com.orientechnologies.orient.jdbc; import com.orientechnologies.orient.core.id.ORecordId; import org.junit.Test; import java.math.BigDecimal; import java.sql.*; import static java.sql.Types.BIGINT; import static org.assertj.core.api.Assertions.assertThat;
40,661
import com.orientechnologies.orient.core.db.record.ORecordLazyMultiValue; import com.orientechnologies.orient.core.metadata.schema.OType; import com.orientechnologies.orient.core.record.impl.OBlob; import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.functions.ODefaultSQLFunctionFactory; <BUG>import com.orientechnologies.orient.core.sql.parser.OIdentifier; import com.orientechnologies.orient.core.sql.parser.OProjectionItem; import com.orientechnologies.orient.core.sql.parser.OSelectStatement; import com.orientechnologies.orient.core.sql.parser.OrientSql; import com.orientechnologies.orient.core.sql.parser.ParseException;</BUG> import java.io.ByteArrayInputStream;
import com.orientechnologies.orient.core.sql.parser.*;
40,662
if (fields.isEmpty()) { fields.addAll(Arrays.asList(document.fieldNames())); } return fields; } <BUG>private void activateDatabaseOnCurrentThread() { statement.database.activateOnCurrentThread();</BUG> } public void close() throws SQLException { cursor = 0;
if (!statement.database.isActiveOnCurrentThread()) statement.database.activateOnCurrentThread();
40,663
else if (rawResult instanceof Collection) return ((Collection) rawResult).size(); return 0; } protected <RET> RET executeCommand(OCommandRequest query) throws SQLException { <BUG>try { return database.command(query).execute();</BUG> } catch (OQueryParsingException e) { throw new SQLSyntaxErrorException("Error while parsing command", e); } catch (OException e) {
database.activateOnCurrentThread(); return database.command(query).execute();
40,664
import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; <BUG>import static org.assertj.core.api.Assertions.assertThat; public class OrientDataSourceTest extends OrientJdbcBaseTest {</BUG> @Test public void shouldConnect() throws SQLException { OrientDataSource ds = new OrientDataSource();
import static org.assertj.core.api.Assertions.fail; public class OrientDataSourceTest extends OrientJdbcBaseTest {
40,665
assertThat(rs.first()).isTrue(); assertThat(rs.getString("stringKey")).isEqualTo("1"); rs.close(); statement.close(); conn.close(); <BUG>assertThat(conn.isClosed()).isTrue(); }</BUG> return Boolean.TRUE; } };
} catch (Exception e) { e.printStackTrace(); fail("WTF:::", e);
40,666
ExecutorService pool = Executors.newCachedThreadPool(); pool.submit(dbClient); pool.submit(dbClient); pool.submit(dbClient); pool.submit(dbClient); <BUG>TimeUnit.SECONDS.sleep(2); </BUG> queryTheDb.set(false); pool.shutdown(); }
TimeUnit.SECONDS.sleep(5);
40,667
import java.util.Map; import java.util.Set;</BUG> import static org.assertj.core.api.Assertions.assertThat; <BUG>import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; </BUG> public class OrientJdbcDatabaseMetaDataTest extends OrientJdbcBaseTest {
import org.junit.Test; import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.*; import static org.junit.Assert.*;
40,668
assertEquals("OrientDB", metaData.getDatabaseProductName()); assertEquals(OConstants.ORIENT_VERSION, metaData.getDatabaseProductVersion()); assertEquals(2, metaData.getDatabaseMajorVersion()); assertEquals(2, metaData.getDatabaseMinorVersion()); assertEquals("OrientDB JDBC Driver", metaData.getDriverName()); <BUG>assertEquals("OrientDB "+OConstants.getVersion()+" JDBC Driver", metaData.getDriverVersion()); </BUG> assertEquals(2, metaData.getDriverMajorVersion()); assertEquals(2, metaData.getDriverMinorVersion()); }
assertEquals("OrientDB " + OConstants.getVersion() + " JDBC Driver", metaData.getDriverVersion());
40,669
final String keywordsStr = metaData.getSQLKeywords(); assertNotNull(keywordsStr); assertThat(Arrays.asList(keywordsStr.toUpperCase().split(",\\s*"))).contains("TRAVERSE"); } @Test <BUG>public void shouldRetrieveUniqueIndexInfoForTable() throws Exception { ResultSet indexInfo = metaData.getIndexInfo("OrientJdbcDatabaseMetaDataTest", "OrientJdbcDatabaseMetaDataTest", "Item", true, false); indexInfo.next();</BUG> assertThat(indexInfo.getString("INDEX_NAME")).isEqualTo("Item.intKey"); assertThat(indexInfo.getBoolean("NON_UNIQUE")).isFalse();
ResultSet indexInfo = metaData indexInfo.next();
40,670
import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.LocalFileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.util.Progressable; <BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*; public class S3AFileSystem extends FileSystem {</BUG> private URI uri; private Path workingDir; private AmazonS3Client s3;
import static org.apache.hadoop.fs.s3a.Constants.*; public class S3AFileSystem extends FileSystem {
40,671
public void initialize(URI name, Configuration conf) throws IOException { super.initialize(name, conf); uri = URI.create(name.getScheme() + "://" + name.getAuthority()); workingDir = new Path("/user", System.getProperty("user.name")).makeQualified(this.uri, this.getWorkingDirectory()); <BUG>String accessKey = conf.get(ACCESS_KEY, null); String secretKey = conf.get(SECRET_KEY, null); </BUG> String userInfo = name.getUserInfo();
String accessKey = conf.get(NEW_ACCESS_KEY, conf.get(OLD_ACCESS_KEY, null)); String secretKey = conf.get(NEW_SECRET_KEY, conf.get(OLD_SECRET_KEY, null));
40,672
} else { accessKey = userInfo; } } AWSCredentialsProviderChain credentials = new AWSCredentialsProviderChain( <BUG>new S3ABasicAWSCredentialsProvider(accessKey, secretKey), new InstanceProfileCredentialsProvider(), new S3AAnonymousAWSCredentialsProvider() );</BUG> bucket = name.getHost();
new BasicAWSCredentialsProvider(accessKey, secretKey), new AnonymousAWSCredentialsProvider()
40,673
awsConf.setSocketTimeout(conf.getInt(SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT)); </BUG> s3 = new AmazonS3Client(credentials, awsConf); <BUG>maxKeys = conf.getInt(MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS); partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD); </BUG> if (partSize < 5 * 1024 * 1024) {
new InstanceProfileCredentialsProvider(), new AnonymousAWSCredentialsProvider() bucket = name.getHost(); ClientConfiguration awsConf = new ClientConfiguration(); awsConf.setMaxConnections(conf.getInt(NEW_MAXIMUM_CONNECTIONS, conf.getInt(OLD_MAXIMUM_CONNECTIONS, DEFAULT_MAXIMUM_CONNECTIONS))); awsConf.setProtocol(conf.getBoolean(NEW_SECURE_CONNECTIONS, conf.getBoolean(OLD_SECURE_CONNECTIONS, DEFAULT_SECURE_CONNECTIONS)) ? Protocol.HTTPS : Protocol.HTTP); awsConf.setMaxErrorRetry(conf.getInt(NEW_MAX_ERROR_RETRIES, conf.getInt(OLD_MAX_ERROR_RETRIES, DEFAULT_MAX_ERROR_RETRIES))); awsConf.setSocketTimeout(conf.getInt(NEW_SOCKET_TIMEOUT, conf.getInt(OLD_SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT))); maxKeys = conf.getInt(NEW_MAX_PAGING_KEYS, conf.getInt(OLD_MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS)); partSize = conf.getLong(NEW_MULTIPART_SIZE, conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE)); partSizeThreshold = conf.getInt(NEW_MIN_MULTIPART_THRESHOLD, conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD));
40,674
cannedACL = null; } if (!s3.doesBucketExist(bucket)) { throw new IOException("Bucket " + bucket + " does not exist"); } <BUG>boolean purgeExistingMultipart = conf.getBoolean(PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART); long purgeExistingMultipartAge = conf.getLong(PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE); </BUG> if (purgeExistingMultipart) {
boolean purgeExistingMultipart = conf.getBoolean(NEW_PURGE_EXISTING_MULTIPART, conf.getBoolean(OLD_PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART)); long purgeExistingMultipartAge = conf.getLong(NEW_PURGE_EXISTING_MULTIPART_AGE, conf.getLong(OLD_PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE));
40,675
import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; <BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*; public class S3AOutputStream extends OutputStream {</BUG> private OutputStream backupStream; private File backupFile; private boolean closed;
import static org.apache.hadoop.fs.s3a.Constants.*; public class S3AOutputStream extends OutputStream {
40,676
this.client = client; this.progress = progress; this.fs = fs; this.cannedACL = cannedACL; this.statistics = statistics; <BUG>partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD); </BUG> if (conf.get(BUFFER_DIR, null) != null) {
partSize = conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD);
40,677
import ml.puredark.hviewer.ui.activities.BaseActivity; import ml.puredark.hviewer.ui.dataproviders.ListDataProvider; import ml.puredark.hviewer.ui.fragments.SettingFragment; import ml.puredark.hviewer.ui.listeners.OnItemLongClickListener; import ml.puredark.hviewer.utils.SharedPreferencesUtil; <BUG>import static android.webkit.WebSettings.LOAD_CACHE_ELSE_NETWORK; public class PictureViewerAdapter extends RecyclerView.Adapter<PictureViewerAdapter.PictureViewerViewHolder> {</BUG> private BaseActivity activity; private Site site; private ListDataProvider mProvider;
import static ml.puredark.hviewer.R.id.container; public class PictureViewerAdapter extends RecyclerView.Adapter<PictureViewerAdapter.PictureViewerViewHolder> {
40,678
final PictureViewHolder viewHolder = new PictureViewHolder(view); if (pictures != null && position < pictures.size()) { final Picture picture = pictures.get(getPicturePostion(position)); if (picture.pic != null) { loadImage(container.getContext(), picture, viewHolder); <BUG>} else if (site.hasFlag(Site.FLAG_SINGLE_PAGE_BIG_PICTURE) && site.extraRule != null && site.extraRule.pictureUrl != null) { getPictureUrl(container.getContext(), viewHolder, picture, site, site.extraRule.pictureUrl, site.extraRule.pictureHighRes);</BUG> } else if (site.picUrlSelector != null) { getPictureUrl(container.getContext(), viewHolder, picture, site, site.picUrlSelector, null); } else {
} else if (site.hasFlag(Site.FLAG_SINGLE_PAGE_BIG_PICTURE) && site.extraRule != null) { if(site.extraRule.pictureRule != null && site.extraRule.pictureRule.url != null) getPictureUrl(container.getContext(), viewHolder, picture, site, site.extraRule.pictureRule.url, site.extraRule.pictureRule.highRes); else if(site.extraRule.pictureUrl != null) getPictureUrl(container.getContext(), viewHolder, picture, site, site.extraRule.pictureUrl, site.extraRule.pictureHighRes);
40,679
import java.util.regex.Pattern; import butterknife.BindView; import butterknife.ButterKnife; import ml.puredark.hviewer.R; import ml.puredark.hviewer.beans.Category; <BUG>import ml.puredark.hviewer.beans.CommentRule; import ml.puredark.hviewer.beans.Rule;</BUG> import ml.puredark.hviewer.beans.Selector; import ml.puredark.hviewer.beans.Site; import ml.puredark.hviewer.ui.adapters.CategoryInputAdapter;
import ml.puredark.hviewer.beans.PictureRule; import ml.puredark.hviewer.beans.Rule;
40,680
inputGalleryRulePictureUrlReplacement.setText(site.galleryRule.pictureUrl.replacement); } if (site.galleryRule.pictureHighRes != null) { inputGalleryRulePictureHighResSelector.setText(joinSelector(site.galleryRule.pictureHighRes)); inputGalleryRulePictureHighResRegex.setText(site.galleryRule.pictureHighRes.regex); <BUG>inputGalleryRulePictureHighResReplacement.setText(site.galleryRule.pictureHighRes.replacement); }</BUG> if (site.galleryRule.commentRule != null) { if (site.galleryRule.commentRule.item != null) { inputGalleryRuleCommentItemSelector.setText(joinSelector(site.galleryRule.commentRule.item));
[DELETED]
40,681
inputExtraRuleCommentDatetimeReplacement.setText(site.extraRule.commentDatetime.replacement); } if (site.extraRule.commentContent != null) { inputExtraRuleCommentContentSelector.setText(joinSelector(site.extraRule.commentContent)); inputExtraRuleCommentContentRegex.setText(site.extraRule.commentContent.regex); <BUG>inputExtraRuleCommentContentReplacement.setText(site.extraRule.commentContent.replacement); }</BUG> } } }
[DELETED]
40,682
lastSite.galleryRule.cover = loadSelector(inputGalleryRuleCoverSelector, inputGalleryRuleCoverRegex, inputGalleryRuleCoverReplacement); lastSite.galleryRule.category = loadSelector(inputGalleryRuleCategorySelector, inputGalleryRuleCategoryRegex, inputGalleryRuleCategoryReplacement); lastSite.galleryRule.datetime = loadSelector(inputGalleryRuleDatetimeSelector, inputGalleryRuleDatetimeRegex, inputGalleryRuleDatetimeReplacement); lastSite.galleryRule.rating = loadSelector(inputGalleryRuleRatingSelector, inputGalleryRuleRatingRegex, inputGalleryRuleRatingReplacement); lastSite.galleryRule.description = loadSelector(inputGalleryRuleDescriptionSelector, inputGalleryRuleDescriptionRegex, inputGalleryRuleDescriptionReplacement); <BUG>lastSite.galleryRule.tags = loadSelector(inputGalleryRuleTagsSelector, inputGalleryRuleTagsRegex, inputGalleryRuleTagsReplacement); lastSite.galleryRule.pictureThumbnail = loadSelector(inputGalleryRulePictureThumbnailSelector, inputGalleryRulePictureThumbnailRegex, inputGalleryRulePictureThumbnailReplacement); lastSite.galleryRule.pictureUrl = loadSelector(inputGalleryRulePictureUrlSelector, inputGalleryRulePictureUrlRegex, inputGalleryRulePictureUrlReplacement); lastSite.galleryRule.pictureHighRes = loadSelector(inputGalleryRulePictureHighResSelector, inputGalleryRulePictureHighResRegex, inputGalleryRulePictureHighResReplacement); lastSite.galleryRule.commentRule = new CommentRule(); lastSite.galleryRule.commentRule.item = loadSelector(inputGalleryRuleCommentItemSelector, inputGalleryRuleCommentItemRegex, inputGalleryRuleCommentItemReplacement);</BUG> lastSite.galleryRule.commentRule.avatar = loadSelector(inputGalleryRuleCommentAvatarSelector, inputGalleryRuleCommentAvatarRegex, inputGalleryRuleCommentAvatarReplacement);
lastSite.galleryRule.pictureRule = (lastSite.galleryRule.pictureRule == null) ? new PictureRule() : lastSite.galleryRule.pictureRule; lastSite.galleryRule.pictureRule.thumbnail = loadSelector(inputGalleryRulePictureThumbnailSelector, inputGalleryRulePictureThumbnailRegex, inputGalleryRulePictureThumbnailReplacement); lastSite.galleryRule.pictureRule.url = loadSelector(inputGalleryRulePictureUrlSelector, inputGalleryRulePictureUrlRegex, inputGalleryRulePictureUrlReplacement); lastSite.galleryRule.pictureRule.highRes = loadSelector(inputGalleryRulePictureHighResSelector, inputGalleryRulePictureHighResRegex, inputGalleryRulePictureHighResReplacement); lastSite.galleryRule.commentRule = (lastSite.galleryRule.commentRule == null) ? new CommentRule() : lastSite.galleryRule.commentRule; lastSite.galleryRule.commentRule.item = loadSelector(inputGalleryRuleCommentItemSelector, inputGalleryRuleCommentItemRegex, inputGalleryRuleCommentItemReplacement);
40,683
lastSite.extraRule.cover = loadSelector(inputExtraRuleCoverSelector, inputExtraRuleCoverRegex, inputExtraRuleCoverReplacement); lastSite.extraRule.category = loadSelector(inputExtraRuleCategorySelector, inputExtraRuleCategoryRegex, inputExtraRuleCategoryReplacement); lastSite.extraRule.datetime = loadSelector(inputExtraRuleDatetimeSelector, inputExtraRuleDatetimeRegex, inputExtraRuleDatetimeReplacement); lastSite.extraRule.rating = loadSelector(inputExtraRuleRatingSelector, inputExtraRuleRatingRegex, inputExtraRuleRatingReplacement); lastSite.extraRule.description = loadSelector(inputExtraRuleDescriptionSelector, inputExtraRuleDescriptionRegex, inputExtraRuleDescriptionReplacement); <BUG>lastSite.extraRule.tags = loadSelector(inputExtraRuleTagsSelector, inputExtraRuleTagsRegex, inputExtraRuleTagsReplacement); lastSite.extraRule.pictureThumbnail = loadSelector(inputExtraRulePictureThumbnailSelector, inputExtraRulePictureThumbnailRegex, inputExtraRulePictureThumbnailReplacement); lastSite.extraRule.pictureUrl = loadSelector(inputExtraRulePictureUrlSelector, inputExtraRulePictureUrlRegex, inputExtraRulePictureUrlReplacement); lastSite.extraRule.pictureHighRes = loadSelector(inputExtraRulePictureHighResSelector, inputExtraRulePictureHighResRegex, inputExtraRulePictureHighResReplacement); lastSite.extraRule.commentRule = new CommentRule(); lastSite.extraRule.commentRule.item = loadSelector(inputExtraRuleCommentItemSelector, inputExtraRuleCommentItemRegex, inputExtraRuleCommentItemReplacement);</BUG> lastSite.extraRule.commentRule.avatar = loadSelector(inputExtraRuleCommentAvatarSelector, inputExtraRuleCommentAvatarRegex, inputExtraRuleCommentAvatarReplacement);
lastSite.extraRule.pictureRule = (lastSite.extraRule.pictureRule == null) ? new PictureRule() : lastSite.extraRule.pictureRule; lastSite.extraRule.pictureRule.thumbnail = loadSelector(inputExtraRulePictureThumbnailSelector, inputExtraRulePictureThumbnailRegex, inputExtraRulePictureThumbnailReplacement); lastSite.extraRule.pictureRule.url = loadSelector(inputExtraRulePictureUrlSelector, inputExtraRulePictureUrlRegex, inputExtraRulePictureUrlReplacement); lastSite.extraRule.pictureRule.highRes = loadSelector(inputExtraRulePictureHighResSelector, inputExtraRulePictureHighResRegex, inputExtraRulePictureHighResReplacement); lastSite.extraRule.commentRule = (lastSite.extraRule.commentRule == null) ? new CommentRule() : lastSite.extraRule.commentRule; lastSite.extraRule.commentRule.item = loadSelector(inputExtraRuleCommentItemSelector, inputExtraRuleCommentItemRegex, inputExtraRuleCommentItemReplacement);
40,684
notifyItemChanged(position); if (mItemClickListener != null) mItemClickListener.onItemClick(v, position); } }); <BUG>if (tag.selected) label.getChildAt(0).setBackgroundResource(R.color.colorPrimary); else label.getChildAt(0).setBackgroundResource(R.color.dimgray);</BUG> }
[DELETED]
40,685
loadPicture(picture, task, null, true); } else if (!TextUtils.isEmpty(picture.pic) && !highRes) { picture.retries = 0; loadPicture(picture, task, null, false); } else if (task.collection.site.hasFlag(Site.FLAG_SINGLE_PAGE_BIG_PICTURE) <BUG>&& task.collection.site.extraRule != null && task.collection.site.extraRule.pictureUrl != null) { </BUG> getPictureUrl(picture, task, task.collection.site.extraRule.pictureUrl, task.collection.site.extraRule.pictureHighRes);
&& task.collection.site.extraRule != null) { if(task.collection.site.extraRule.pictureRule != null && task.collection.site.extraRule.pictureRule.url != null) getPictureUrl(picture, task, task.collection.site.extraRule.pictureRule.url, task.collection.site.extraRule.pictureRule.highRes); else if(task.collection.site.extraRule.pictureUrl != null)
40,686
if (Picture.hasPicPosfix(picture.url)) { picture.pic = picture.url; loadPicture(picture, task, null, false); } else if (task.collection.site.hasFlag(Site.FLAG_JS_NEEDED_ALL)) { <BUG>new Handler(Looper.getMainLooper()).post(()->{ </BUG> WebView webView = new WebView(HViewerApplication.mContext); WebSettings mWebSettings = webView.getSettings(); mWebSettings.setJavaScriptEnabled(true);
new Handler(Looper.getMainLooper()).post(() -> {
40,687
import org.spongepowered.api.world.Locatable; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; import java.util.List; <BUG>import java.util.Optional; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG> public class CommandDelete extends FCCommandBase { private static final FlagMapper MAPPER = map -> key -> value -> { map.put(key, value);
import java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
40,688
.append(Text.of(TextColors.GREEN, "Usage: ")) .append(getUsage(source)) .build()); return CommandResult.empty(); } else if (isIn(REGIONS_ALIASES, parse.args[0])) { <BUG>if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); IRegion region = FGManager.getInstance().getRegion(parse.args[1]); </BUG> boolean isWorldRegion = false; if (region == null) {
String regionName = parse.args[1]; IRegion region = FGManager.getInstance().getRegion(regionName).orElse(null);
40,689
</BUG> isWorldRegion = true; } if (region == null) <BUG>throw new CommandException(Text.of("No region exists with the name \"" + parse.args[1] + "\"!")); if (region instanceof GlobalWorldRegion) { </BUG> throw new CommandException(Text.of("You may not delete the global region!")); }
if (world == null) throw new CommandException(Text.of("No world exists with name \"" + worldName + "\"!")); if (world == null) throw new CommandException(Text.of("Must specify a world!")); region = FGManager.getInstance().getWorldRegion(world, regionName).orElse(null); throw new CommandException(Text.of("No region exists with the name \"" + regionName + "\"!")); if (region instanceof IGlobal) {
40,690
source.getName() + " deleted " + (isWorldRegion ? "world" : "") + "region" ); return CommandResult.success(); } else if (isIn(HANDLERS_ALIASES, parse.args[0])) { if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); <BUG>IHandler handler = FGManager.getInstance().gethandler(parse.args[1]); if (handler == null) throw new ArgumentParseException(Text.of("No handler exists with that name!"), parse.args[1], 1); if (handler instanceof GlobalHandler)</BUG> throw new CommandException(Text.of("You may not delete the global handler!"));
Optional<IHandler> handlerOpt = FGManager.getInstance().gethandler(parse.args[1]); if (!handlerOpt.isPresent()) IHandler handler = handlerOpt.get(); if (handler instanceof GlobalHandler)
40,691
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
40,692
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
40,693
@Dependency(id = "foxcore") }, description = "A world protection plugin built for SpongeAPI. Requires FoxCore.", authors = {"gravityfox"}, url = "https://github.com/FoxDenStudio/FoxGuard") <BUG>public final class FoxGuardMain { public final Cause pluginCause = Cause.builder().named("plugin", this).build(); private static FoxGuardMain instanceField;</BUG> @Inject private Logger logger;
private static FoxGuardMain instanceField;
40,694
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; }
40,695
return configDirectory; } public boolean isLoaded() { return loaded; } <BUG>public static Cause getCause() { return instance().pluginCause; }</BUG> public EconomyService getEconomyService() { return economyService;
[DELETED]
40,696
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.*;
40,697
.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))
40,698
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) -> {
40,699
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);
40,700
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);