id int64 1 49k | buggy stringlengths 34 37.5k | fixed stringlengths 2 37k |
|---|---|---|
14,801 | 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.*;
|
14,802 | .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);
|
14,803 | </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) {
|
14,804 | 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)
|
14,805 | .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))
|
14,806 | .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))
|
14,807 | @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;
|
14,808 | 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;
}
|
14,809 | return configDirectory;
}
public boolean isLoaded() {
return loaded;
}
<BUG>public static Cause getCause() {
return instance().pluginCause;
}</BUG>
public EconomyService getEconomyService() {
return economyService;
| [DELETED] |
14,810 | 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.*;
|
14,811 | .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))
|
14,812 | 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) -> {
|
14,813 | 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);
|
14,814 | 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);
|
14,815 | 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() + "\"");
|
14,816 | 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() + "\"");
|
14,817 | 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
|
14,818 | .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")
|
14,819 | containerBuilder = containerBuilder
.withName(serviceName)
.withImage(image)
.withPorts(new ContainerPortBuilder().withContainerPort(port).build())
.withVolumeMounts(volumes.stream().map(Pair::getLeft).collect(Collectors.toList()))
<BUG>.withEnv(envVars);
ReplicaSetBuilder replicaSetBuilder = new ReplicaSetBuilder();</BUG>
replicaSetBuilder = replicaSetBuilder
.withNewMetadata()
.withName(replicaSetName)
| .withEnv(envVars)
.withReadinessProbe(probeBuilder.build());
ReplicaSetBuilder replicaSetBuilder = new ReplicaSetBuilder();
|
14,820 | public void resourcePattern(Resource resource) {
if (resourcePattern != null) {
final String uri = resource.getRelativeUri().replaceAll("\\{[^}/]+\\}", "");
for (final String part : uri.split("/")) {
if (part != null && part.length() > 0 && !resourcePattern.matcher(part).matches()) {
<BUG>violations.add(new Message("resource.name.invalid", locator, resourcePattern.pattern()));
}</BUG>
}
}
}
| violation("resource.name.invalid", locator, resourcePattern.pattern());
|
14,821 | checker.uriParameters(resource.getUriParameters().keySet(), resource);
checker.parameters(resource.getBaseUriParameters(), BASE_URI);
checker.parameters(resource.getUriParameters(), URI);
checker.description(resource.getDescription());
checker.description(resource.getBaseUriParameters(), BASE_URI);
<BUG>checker.description(resource.getUriParameters(), URI);
for (Resource res : resource.getResources().values()) {</BUG>
resource(res);
}
for (Action action : resource.getActions().values()) {
| checker.empty(resource);
for (Resource res : resource.getResources().values()) {
|
14,822 | checker.parameters(action.getQueryParameters(), QUERY);
checker.headerPattern(action.getHeaders().keySet());
checker.description(action.getDescription());
checker.description(action.getBaseUriParameters(), BASE_URI);
checker.description(action.getQueryParameters(), QUERY);
<BUG>checker.description(action.getHeaders(), HEADER);
if (action.getBody() != null) {</BUG>
for (MimeType mimeType : action.getBody().values()) {
locator.requestMime(mimeType);
mimeType(mimeType);
| checker.empty(action);
if (action.getBody() != null) {
|
14,823 | String line = null;
String variable = null;
String value = null;
while ((line = readerSrce.readLine())!=null){
if (!line.startsWith("#") && line.length()>2) { // ce n'est pas un commentaire et longueur>=3 ex: x=b est le minumum
<BUG>String[] tok = line.split("=");
variable = tok[0];
value = tok[1];
attributes.put(variable, value);</BUG>
}
| int cut = line.indexOf("=");
variable = line.substring(0, cut);
value = line.substring(cut+1);
attributes.put(variable, value);
|
14,824 | import de.vanita5.twittnuker.receiver.NotificationReceiver;
import de.vanita5.twittnuker.service.LengthyOperationsService;
import de.vanita5.twittnuker.util.ActivityTracker;
import de.vanita5.twittnuker.util.AsyncTwitterWrapper;
import de.vanita5.twittnuker.util.DataStoreFunctionsKt;
<BUG>import de.vanita5.twittnuker.util.DataStoreUtils;
import de.vanita5.twittnuker.util.ImagePreloader;</BUG>
import de.vanita5.twittnuker.util.InternalTwitterContentUtils;
import de.vanita5.twittnuker.util.JsonSerializer;
import de.vanita5.twittnuker.util.NotificationManagerWrapper;
| import de.vanita5.twittnuker.util.DebugLog;
import de.vanita5.twittnuker.util.ImagePreloader;
|
14,825 | final List<InetAddress> addresses = mDns.lookup(host);
for (InetAddress address : addresses) {
c.addRow(new String[]{host, address.getHostAddress()});
}
} catch (final IOException ignore) {
<BUG>if (BuildConfig.DEBUG) {
Log.w(LOGTAG, ignore);
}</BUG>
}
| DebugLog.w(LOGTAG, null, ignore);
|
14,826 | @Override
public void afterExecute(Bus handler, SingleResponse<Relationship> result) {
if (result.hasData()) {
handler.post(new FriendshipUpdatedEvent(accountKey, userKey, result.getData()));
} else if (result.hasException()) {
<BUG>if (BuildConfig.DEBUG) {
Log.w(LOGTAG, "Unable to update friendship", result.getException());
}</BUG>
}
| public UserKey[] getAccountKeys() {
return DataStoreUtils.getActivatedAccountKeys(context);
|
14,827 | MicroBlog microBlog = MicroBlogAPIFactory.getInstance(context, accountId);
if (!Utils.isOfficialCredentials(context, accountId)) continue;
try {
microBlog.setActivitiesAboutMeUnread(cursor);
} catch (MicroBlogException e) {
<BUG>if (BuildConfig.DEBUG) {
Log.w(LOGTAG, e);
}</BUG>
}
| DebugLog.w(LOGTAG, null, e);
|
14,828 | FileBody fileBody = null;
try {
fileBody = getFileBody(context, imageUri);
twitter.updateProfileBannerImage(fileBody);
} finally {
<BUG>Utils.closeSilently(fileBody);
if (deleteImage && "file".equals(imageUri.getScheme())) {
final File file = new File(imageUri.getPath());
if (!file.delete()) {
Log.w(LOGTAG, String.format("Unable to delete %s", file));
}</BUG>
}
| if (deleteImage) {
Utils.deleteMedia(context, imageUri);
|
14,829 | FileBody fileBody = null;
try {
fileBody = getFileBody(context, imageUri);
twitter.updateProfileBackgroundImage(fileBody, tile);
} finally {
<BUG>Utils.closeSilently(fileBody);
if (deleteImage && "file".equals(imageUri.getScheme())) {
final File file = new File(imageUri.getPath());
if (!file.delete()) {
Log.w(LOGTAG, String.format("Unable to delete %s", file));
}</BUG>
}
| twitter.updateProfileBannerImage(fileBody);
if (deleteImage) {
Utils.deleteMedia(context, imageUri);
|
14,830 | FileBody fileBody = null;
try {
fileBody = getFileBody(context, imageUri);
return twitter.updateProfileImage(fileBody);
} finally {
<BUG>Utils.closeSilently(fileBody);
if (deleteImage && "file".equals(imageUri.getScheme())) {
final File file = new File(imageUri.getPath());
if (!file.delete()) {
Log.w(LOGTAG, String.format("Unable to delete %s", file));
}</BUG>
}
| twitter.updateProfileBannerImage(fileBody);
if (deleteImage) {
Utils.deleteMedia(context, imageUri);
|
14,831 | import de.vanita5.twittnuker.annotation.CustomTabType;
import de.vanita5.twittnuker.library.MicroBlog;
import de.vanita5.twittnuker.library.MicroBlogException;
import de.vanita5.twittnuker.library.twitter.model.RateLimitStatus;
import de.vanita5.twittnuker.library.twitter.model.Status;
<BUG>import de.vanita5.twittnuker.fragment.AbsStatusesFragment;
import org.mariotaku.sqliteqb.library.AllColumns;</BUG>
import org.mariotaku.sqliteqb.library.Columns;
import org.mariotaku.sqliteqb.library.Columns.Column;
import org.mariotaku.sqliteqb.library.Expression;
| import org.mariotaku.pickncrop.library.PNCUtils;
import org.mariotaku.sqliteqb.library.AllColumns;
|
14,832 | context.getApplicationContext().sendBroadcast(intent);
}
}
@Nullable
public static Location getCachedLocation(Context context) {
<BUG>if (BuildConfig.DEBUG) {
Log.v(LOGTAG, "Fetching cached location", new Exception());
}</BUG>
Location location = null;
| DebugLog.v(LOGTAG, "Fetching cached location", new Exception());
|
14,833 | import java.util.List;
import java.util.Map.Entry;
import javax.inject.Singleton;
import okhttp3.Dns;
@Singleton
<BUG>public class TwidereDns implements Constants, Dns {
</BUG>
private static final String RESOLVER_LOGTAG = "TwittnukerDns";
private final SharedPreferences mHostMapping;
private final SharedPreferencesWrapper mPreferences;
| public class TwidereDns implements Dns, Constants {
|
14,834 | for (Location location : twitter.getAvailableTrends()) {
map.put(location);
}
return map.pack();
} catch (final MicroBlogException e) {
<BUG>if (BuildConfig.DEBUG) {
Log.w(LOGTAG, e);
}</BUG>
}
| DebugLog.w(LOGTAG, null, e);
|
14,835 | private WebElement languagesLink;
@FindBy(id = "user--avatar")
private WebElement userAvatar;
private static final By BY_SIGN_IN = By.id("signin_link");
private static final By BY_SIGN_OUT = By.id("right_menu_sign_out_link");
<BUG>private static final By BY_PROFILE_LINK = By.id("profile");
</BUG>
private static final By BY_ADMINISTRATION_LINK = By.id("administration");
public BasePage(final WebDriver driver) {
super(driver);
| private static final By BY_DASHBOARD_LINK = By.id("dashboard");
|
14,836 | public EditProfilePage(WebDriver driver) {
super(driver);
}
public EditProfilePage enterName(String name) {
nameField.clear();
<BUG>nameField.sendKeys(name);
return new EditProfilePage(getDriver());</BUG>
}
public EditProfilePage enterUserName(String userName) {
usernameField.sendKeys(userName);
| defocus();
return new EditProfilePage(getDriver());
|
14,837 | usernameField.sendKeys(userName);
return new EditProfilePage(getDriver());
}
public EditProfilePage enterEmail(String email) {
emailField.clear();
<BUG>emailField.sendKeys(email);
return new EditProfilePage(getDriver());</BUG>
}
public HomePage clickSave() {
saveButton.click();
| defocus();
|
14,838 | }
public HomePage clickSave() {
saveButton.click();
return new HomePage(getDriver());
}
<BUG>public MyAccountPage clickSaveChanges() {
saveButton.click();
return new MyAccountPage(getDriver());
}</BUG>
public EditProfilePage clickSaveAndExpectErrors() {
| public EditProfilePage enterUserName(String userName) {
usernameField.sendKeys(userName);
return new EditProfilePage(getDriver());
public EditProfilePage enterEmail(String email) {
emailField.clear();
emailField.sendKeys(email);
defocus();
return new EditProfilePage(getDriver());
|
14,839 | package org.zanata.page.dashboard;
import java.util.ArrayList;
<BUG>import java.util.List;
import org.openqa.selenium.By;</BUG>
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
| import com.google.common.base.Predicate;
import org.openqa.selenium.By;
|
14,840 | @FindBy(id = "activity-week")
private WebElement thisWeeksActivityTab;
@FindBy(id = "activity-month")
private WebElement thisMonthsActivityTab;
public DashboardBasePage(final WebDriver driver) {
<BUG>super(driver);
}</BUG>
public DashboardActivityTab gotoActivityTab() {
clickWhenTabEnabled(activityTab);
return new DashboardActivityTab(getDriver());
| }
public String getUserFullName() {
return getDriver().findElement(By.id("profile-overview"))
.findElement(By.tagName("h1")).getText();
}
|
14,841 | }
}
});
}
} else {
<BUG>if (n <= m) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {</BUG>
a[i][j] = operator.applyAsBoolean(a[i][j]);
}
| public boolean[] row(final int rowIndex) {
N.checkArgument(rowIndex >= 0 && rowIndex < n, "Invalid row Index: %s", rowIndex);
return a[rowIndex];
|
14,842 | }
}
});
}
} else {
<BUG>if (n <= m) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {</BUG>
result[i][j] = zipFunction.apply(a[i][j], b[i][j]);
}
| public boolean get(final int i, final int j) {
return a[i][j];
|
14,843 | }
}
});
}
} else {
<BUG>if (n <= m) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {</BUG>
result[i][j] = zipFunction.apply(a[i][j], b[i][j], c[i][j]);
}
| return new BooleanMatrix(c);
|
14,844 | }
public AsyncExecutor(int maxConcurrentThreadNumber, long keepAliveTime, TimeUnit unit) {
this.maxConcurrentThreadNumber = maxConcurrentThreadNumber;
this.keepAliveTime = keepAliveTime;
this.unit = unit;
<BUG>}
public AsyncExecutor(final ExecutorService executorService) {
this(8, 300, TimeUnit.SECONDS);
this.executorService = executorService;</BUG>
Runtime.getRuntime().addShutdownHook(new Thread() {
| [DELETED] |
14,845 | results.add(execute(cmd));
}
return results;
}
public <T> CompletableFuture<T> execute(final Callable<T> command) {
<BUG>final CompletableFuture<T> future = new CompletableFuture<T>(this, command);
getExecutorService().execute(future);</BUG>
return future;
}
public <T> List<CompletableFuture<T>> execute(final Callable<T>... commands) {
| final CompletableFuture<T> future = new CompletableFuture<>(this, command);
getExecutorService().execute(future);
|
14,846 | chart.addYAxisLabels(AxisLabelsFactory.newAxisLabels(labels));
chart.addXAxisLabels(AxisLabelsFactory.newNumericRangeAxisLabels(0, max));
chart.setBarWidth(BarChart.AUTO_RESIZE);
chart.setSize(600, 500);
chart.setHorizontal(true);
<BUG>chart.setTitle("Total Evaluations by User");
showChartImg(resp, chart.toURLString());
}</BUG>
private List<Entry<String, Integer>> sortEntries(Collection<Entry<String, Integer>> entries) {
List<Entry<String, Integer>> result = new ArrayList<Entry<String, Integer>>(entries);
| chart.setDataEncoding(DataEncoding.TEXT);
return chart;
}
|
14,847 | checkEvaluationsEqual(eval4, foundissueProto.getEvaluations(0));
checkEvaluationsEqual(eval5, foundissueProto.getEvaluations(1));
}
public void testGetRecentEvaluationsNoneFound() throws Exception {
DbIssue issue = createDbIssue("fad", persistenceHelper);
<BUG>DbEvaluation eval1 = createEvaluation(issue, "someone", 100);
DbEvaluation eval2 = createEvaluation(issue, "someone", 200);
DbEvaluation eval3 = createEvaluation(issue, "someone", 300);
issue.addEvaluations(eval1, eval2, eval3);</BUG>
getPersistenceManager().makePersistent(issue);
| [DELETED] |
14,848 | public int read() throws IOException {
return inputStream.read();
}
});
}
<BUG>}
protected DbEvaluation createEvaluation(DbIssue issue, String who, long when) {</BUG>
DbUser user;
Query query = getPersistenceManager().newQuery("select from " + persistenceHelper.getDbUserClass().getName()
+ " where openid == :myopenid");
| @SuppressWarnings({"unchecked"})
protected DbEvaluation createEvaluation(DbIssue issue, String who, long when) {
|
14,849 | eval.setComment("my comment");
eval.setDesignation("MUST_FIX");
eval.setIssue(issue);
eval.setWhen(when);
eval.setWho(user.createKeyObject());
<BUG>eval.setEmail(who);
return eval;</BUG>
}
protected PersistenceManager getPersistenceManager() {
return testHelper.getPersistenceManager();
| issue.addEvaluation(eval);
return eval;
|
14,850 | long t=t0;
long pnext=t+printInterval_ms;
boolean run = true;
while (!endEvent && run) {
SamplesEventsCount status = null;
<BUG>try {
System.out.println( TAG+" Waiting for " + (nSamples + trialLength_samp + 1) + " samples");</BUG>
status = C.waitForSamples(nSamples + trialLength_samp + 1, this.timeout_ms);
} catch (IOException e) {
e.printStackTrace();
| if ( VERB>1 )
System.out.println( TAG+" Waiting for " + (nSamples + trialLength_samp + 1) + " samples");
|
14,851 | dv = null;
continue;
}
t = System.currentTimeMillis();
if ( t > pnext ) {
<BUG>System.out.println(TAG+ String.format("%d %d %5.3f (samp,event,sec)\r",
status.nSamples,status.nEvents,(t-t0)/1000.0));</BUG>
pnext = t+printInterval_ms;
}
int onSamples = nSamples;
| System.out.println(String.format("%d %d %5.3f (samp,event,sec)\r",
status.nSamples,status.nEvents,(t-t0)/1000.0));
|
14,852 | try {
data = new Matrix(new Matrix(C.getDoubleData(fromId, toId)).transpose());
} catch (IOException e) {
e.printStackTrace();
}
<BUG>if ( VERB>0 ) {
</BUG>
System.out.println(TAG+ String.format("Got data @ %d->%d samples", fromId, toId));
}
Matrix f = new Matrix(classifiers.get(0).getOutputSize(), 1);
| if ( VERB>1 ) {
|
14,853 | ClassifierResult result = null;
for (PreprocClassifier c : classifiers) {
result = c.apply(data);
f = new Matrix(f.add(result.f));
fraw = new Matrix(fraw.add(result.fraw));
<BUG>}
double[] dvColumn = f.getColumn(0);</BUG>
f = new Matrix(dvColumn.length - 1, 1);
f.setColumn(0, Arrays.copyOfRange(dvColumn, 1, dvColumn.length));
if (normalizeLateralization){ // compute alphaLat score
| if ( f.getRowDimension() > 1 ) {
double[] dvColumn = f.getColumn(0);
|
14,854 | f.setColumn(0, Arrays.copyOfRange(dvColumn, 1, dvColumn.length));
if (normalizeLateralization){ // compute alphaLat score
f.setEntry(0, 0, (dvColumn[0] - dvColumn[1]) / (dvColumn[0] + dvColumn[1]));
} else {
f.setEntry(0, 0, dvColumn[0] - dvColumn[1]);
<BUG>}
if (dv == null || predictionFilter < 0) {</BUG>
dv = f;
} else {
if (predictionFilter >= 0.) {// exponiential smoothing of predictions
| if (dv == null || predictionFilter < 0) {
|
14,855 | if (baselinePhase) {
nBaseline++;
dvBaseline = new Matrix(dvBaseline.add(dv));
dv2Baseline = new Matrix(dv2Baseline.add(dv.multiplyElements(dv)));
if (nBaselineStep > 0 && nBaseline > nBaselineStep) {
<BUG>System.out.println( "Baseline timeout\n");
</BUG>
baselinePhase = false;
Tuple<Matrix, Matrix> ret = baselineValues(dvBaseline, dv2Baseline, nBaseline);
baseLineVal = ret.x;
| if(VERB>1) System.out.println( "Baseline timeout\n");
|
14,856 | Tuple<Matrix, Matrix> ret=baselineValues(dvBaseline,dv2Baseline,nBaseline);
baseLineVal = ret.x;
baseLineVar = ret.y;
}
} else if ( value.equals(baselineStart) ) {
<BUG>System.out.println( "Baseline start event received");
</BUG>
baselinePhase = true;
nBaseline = 0;
dvBaseline = Matrix.zeros(classifiers.get(0).getOutputSize() - 1, 1);
| if(VERB>1)System.out.println(TAG+ "Baseline start event received");
|
14,857 | import com.dsh105.echopet.compat.api.event.PetTeleportEvent;
import com.dsh105.echopet.compat.api.plugin.EchoPet;
import com.dsh105.echopet.compat.api.plugin.uuid.UUIDMigration;
import com.dsh105.echopet.compat.api.reflection.ReflectionConstants;
import com.dsh105.echopet.compat.api.reflection.SafeMethod;
<BUG>import com.dsh105.echopet.compat.api.util.Lang;
import com.dsh105.echopet.compat.api.util.PetNames;</BUG>
import com.dsh105.echopet.compat.api.util.PlayerUtil;
import com.dsh105.echopet.compat.api.util.ReflectionUtil;
import com.dsh105.echopet.compat.api.util.StringSimplifier;
| import com.dsh105.echopet.compat.api.util.INMS;
import com.dsh105.echopet.compat.api.util.PetNames;
|
14,858 | this.getRider().removePet(false);
}
new BukkitRunnable() {
@Override
public void run() {
<BUG>method.invoke(PlayerUtil.playerToEntityPlayer(getOwner()), getEntityPet());
ownerIsMounting = false;</BUG>
if (getEntityPet() instanceof IEntityNoClipPet) {
((IEntityNoClipPet) getEntityPet()).noClip(false);
}
| INMS.getInstance().mount(getOwner(), getEntityPet().getBukkitEntity());
ownerIsMounting = false;
|
14,859 | @Override
public void onEnable() {
EchoPet.setPlugin(this);
isUsingNetty = CommonReflection.isUsingNetty();
this.configManager = new YAMLConfigManager(this);
<BUG>COMMAND_MANAGER = new CommandManager(this);
try {
Class.forName(ReflectionUtil.COMPAT_NMS_PATH + ".SpawnUtil");
} catch (ClassNotFoundException e) {</BUG>
EchoPet.LOG.log(ChatColor.RED + "SonarPet " + ChatColor.GOLD
| if (!INMS.isSupported()) {
|
14,860 | </BUG>
import com.jolbox.bonecp.BoneCP;
import org.bukkit.plugin.Plugin;
public interface IEchoPetPlugin extends Plugin {
<BUG>public ISpawnUtil getSpawnUtil();
</BUG>
public String getPrefix();
public String getCommandString();
public String getAdminCommandString();
PetRegistry getPetRegistry();
| import com.dsh105.commodus.config.YAMLConfig;
import com.dsh105.echopet.compat.api.config.ConfigOptions;
import com.dsh105.echopet.compat.api.plugin.hook.IVanishProvider;
import com.dsh105.echopet.compat.api.plugin.hook.IWorldGuardProvider;
import com.dsh105.echopet.compat.api.registration.PetRegistry;
import com.dsh105.echopet.compat.api.util.INMS;
public INMS getSpawnUtil();
|
14,861 | String event = targetSyncFile.getEvent();
if (event.equals(SyncFile.EVENT_ADD) ||
event.equals(SyncFile.EVENT_GET)) {
if (sourceSyncFile != null) {
updateFile(sourceSyncFile, targetSyncFile, filePathName);
<BUG>processDependentSyncFiles(sourceSyncFile);
return;
}
addFile(targetSyncFile, filePathName);
}</BUG>
else if (event.equals(SyncFile.EVENT_DELETE)) {
| else {
|
14,862 | deleteFile(sourceSyncFile, targetSyncFile);
}
else if (event.equals(SyncFile.EVENT_MOVE)) {
if (sourceSyncFile == null) {
addFile(targetSyncFile, filePathName);
<BUG>processDependentSyncFiles(targetSyncFile);
return;</BUG>
}
else if (sourceSyncFile.getParentFolderId() ==
targetSyncFile.getParentFolderId()) {
| [DELETED] |
14,863 | deleteFile(sourceSyncFile, targetSyncFile);
}
else if (event.equals(SyncFile.EVENT_UPDATE)) {
if (sourceSyncFile == null) {
addFile(targetSyncFile, filePathName);
<BUG>processDependentSyncFiles(targetSyncFile);
return;
}
updateFile(sourceSyncFile, targetSyncFile, filePathName);
}</BUG>
processDependentSyncFiles(targetSyncFile);
| else {
|
14,864 | import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.DigestOutputStream;
import java.security.MessageDigest;
<BUG>import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;</BUG>
public final class PatchUtils {
| import java.text.DateFormat;
import java.util.Date;
import java.util.List;
|
14,865 | package org.jboss.as.patching.runner;
<BUG>import org.jboss.as.boot.DirectoryStructure;
import org.jboss.as.patching.LocalPatchInfo;</BUG>
import org.jboss.as.patching.PatchInfo;
import org.jboss.as.patching.PatchLogger;
import org.jboss.as.patching.PatchMessages;
| import static org.jboss.as.patching.runner.PatchUtils.generateTimestamp;
import org.jboss.as.patching.CommonAttributes;
import org.jboss.as.patching.LocalPatchInfo;
|
14,866 | private static final String PATH_DELIMITER = "/";
public static final byte[] NO_CONTENT = PatchingTask.NO_CONTENT;
enum Element {
ADDED_BUNDLE("added-bundle"),
ADDED_MISC_CONTENT("added-misc-content"),
<BUG>ADDED_MODULE("added-module"),
BUNDLES("bundles"),</BUG>
CUMULATIVE("cumulative"),
DESCRIPTION("description"),
MISC_FILES("misc-files"),
| APPLIES_TO_VERSION("applies-to-version"),
BUNDLES("bundles"),
|
14,867 | final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
<BUG>case APPLIES_TO_VERSION:
builder.addAppliesTo(value);
break;</BUG>
case RESULTING_VERSION:
if(type == Patch.PatchType.CUMULATIVE) {
| [DELETED] |
14,868 | final StringBuilder path = new StringBuilder();
for(final String p : item.getPath()) {
path.append(p).append(PATH_DELIMITER);
}
path.append(item.getName());
<BUG>writer.writeAttribute(Attribute.PATH.name, path.toString());
if(type != ModificationType.REMOVE) {</BUG>
writer.writeAttribute(Attribute.HASH.name, bytesToHexString(item.getContentHash()));
}
if(type != ModificationType.ADD) {
| if (item.isDirectory()) {
writer.writeAttribute(Attribute.DIRECTORY.name, "true");
if(type != ModificationType.REMOVE) {
|
14,869 | package org.jboss.as.patching;
import org.jboss.as.controller.OperationFailedException;
import org.jboss.as.patching.runner.PatchingException;
import org.jboss.logging.Messages;
import org.jboss.logging.annotations.Message;
<BUG>import org.jboss.logging.annotations.MessageBundle;
import java.io.IOException;</BUG>
import java.util.List;
@MessageBundle(projectCode = "JBAS")
public interface PatchMessages {
| import org.jboss.logging.annotations.Cause;
import java.io.IOException;
|
14,870 | } else {
updateMemo();
callback.updateMemo();
}
dismiss();
<BUG>}else{
</BUG>
Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show();
}
}
| [DELETED] |
14,871 | }
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_memo);
<BUG>ChinaPhoneHelper.setStatusBar(this,true);
</BUG>
topicId = getIntent().getLongExtra("topicId", -1);
if (topicId == -1) {
finish();
| ChinaPhoneHelper.setStatusBar(this, true);
|
14,872 | MemoEntry.COLUMN_REF_TOPIC__ID + " = ?"
, new String[]{String.valueOf(topicId)});
}
public Cursor selectMemo(long topicId) {
Cursor c = db.query(MemoEntry.TABLE_NAME, null, MemoEntry.COLUMN_REF_TOPIC__ID + " = ?", new String[]{String.valueOf(topicId)}, null, null,
<BUG>MemoEntry._ID + " DESC", null);
</BUG>
if (c != null) {
c.moveToFirst();
}
| MemoEntry.COLUMN_ORDER + " ASC", null);
|
14,873 | MemoEntry._ID + " = ?",
new String[]{String.valueOf(memoId)});
}
public long updateMemoContent(long memoId, String memoContent) {
ContentValues values = new ContentValues();
<BUG>values.put(MemoEntry.COLUMN_CONTENT, memoContent);
return db.update(</BUG>
MemoEntry.TABLE_NAME,
values,
MemoEntry._ID + " = ?",
| return db.update(
|
14,874 | import android.widget.RelativeLayout;
import android.widget.TextView;
import com.kiminonawa.mydiary.R;
import com.kiminonawa.mydiary.db.DBManager;
import com.kiminonawa.mydiary.shared.EditMode;
<BUG>import com.kiminonawa.mydiary.shared.ThemeManager;
import java.util.List;
public class MemoAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements EditMode {
</BUG>
private List<MemoEntity> memoList;
| import com.marshalchen.ultimaterecyclerview.dragsortadapter.DragSortAdapter;
public class MemoAdapter extends DragSortAdapter<DragSortAdapter.ViewHolder> implements EditMode {
|
14,875 | private DBManager dbManager;
private boolean isEditMode = false;
private EditMemoDialogFragment.MemoCallback callback;
private static final int TYPE_HEADER = 0;
private static final int TYPE_ITEM = 1;
<BUG>public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback) {
this.mActivity = activity;</BUG>
this.topicId = topicId;
this.memoList = memoList;
| public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback, RecyclerView recyclerView) {
super(recyclerView);
this.mActivity = activity;
|
14,876 | this.memoList = memoList;
this.dbManager = dbManager;
this.callback = callback;
}
@Override
<BUG>public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
</BUG>
View view;
if (isEditMode) {
if (viewType == TYPE_HEADER) {
| public DragSortAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
14,877 | editMemoDialogFragment.show(mActivity.getSupportFragmentManager(), "editMemoDialogFragment");
}
});
}
}
<BUG>protected class MemoViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
private View rootView;
private TextView TV_memo_item_content;</BUG>
private ImageView IV_memo_item_delete;
| protected class MemoViewHolder extends DragSortAdapter.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
private ImageView IV_memo_item_dot;
private TextView TV_memo_item_content;
|
14,878 | }
@RootTask
static Task<Exec.Result> exec(String parameter, int number) {
Task<String> task1 = MyTask.create(parameter);
Task<Integer> task2 = Adder.create(number, number + 2);
<BUG>return Task.ofType(Exec.Result.class).named("exec", "/bin/sh")
.in(() -> task1)</BUG>
.in(() -> task2)
.process(Exec.exec((str, i) -> args("/bin/sh", "-c", "\"echo " + i + "\"")));
}
| return Task.named("exec", "/bin/sh").ofType(Exec.Result.class)
.in(() -> task1)
|
14,879 | return args;
}
static class MyTask {
static final int PLUS = 10;
static Task<String> create(String parameter) {
<BUG>return Task.ofType(String.class).named("MyTask", parameter)
.in(() -> Adder.create(parameter.length(), PLUS))</BUG>
.in(() -> Fib.create(parameter.length()))
.process((sum, fib) -> something(parameter, sum, fib));
}
| return Task.named("MyTask", parameter).ofType(String.class)
.in(() -> Adder.create(parameter.length(), PLUS))
|
14,880 | final String instanceField = "from instance";
final TaskContext context = TaskContext.inmem();
final AwaitingConsumer<String> val = new AwaitingConsumer<>();
@Test
public void shouldJavaUtilSerialize() throws Exception {
<BUG>Task<Long> task1 = Task.ofType(Long.class).named("Foo", "Bar", 39)
.process(() -> 9999L);
Task<String> task2 = Task.ofType(String.class).named("Baz", 40)
.in(() -> task1)</BUG>
.ins(() -> singletonList(task1))
| Task<Long> task1 = Task.named("Foo", "Bar", 39).ofType(Long.class)
Task<String> task2 = Task.named("Baz", 40).ofType(String.class)
.in(() -> task1)
|
14,881 | assertEquals(des.id().name(), "Baz");
assertEquals(val.awaitAndGet(), "[9999] hello 10004");
}
@Test(expected = NotSerializableException.class)
public void shouldNotSerializeWithInstanceFieldReference() throws Exception {
<BUG>Task<String> task = Task.ofType(String.class).named("WithRef")
.process(() -> instanceField + " causes an outer reference");</BUG>
serialize(task);
}
@Test
| Task<String> task = Task.named("WithRef").ofType(String.class)
.process(() -> instanceField + " causes an outer reference");
|
14,882 | serialize(task);
}
@Test
public void shouldSerializeWithLocalReference() throws Exception {
String local = instanceField;
<BUG>Task<String> task = Task.ofType(String.class).named("WithLocalRef")
.process(() -> local + " won't cause an outer reference");</BUG>
serialize(task);
Task<String> des = deserialize();
context.evaluate(des).consume(val);
| Task<String> task = Task.named("WithLocalRef").ofType(String.class)
.process(() -> local + " won't cause an outer reference");
|
14,883 | }
@RootTask
public static Task<String> standardArgs(int first, String second) {
firstInt = first;
secondString = second;
<BUG>return Task.ofType(String.class).named("StandardArgs", first, second)
.process(() -> second + " " + first * 100);</BUG>
}
@Test
public void shouldParseFlags() throws Exception {
| return Task.named("StandardArgs", first, second).ofType(String.class)
.process(() -> second + " " + first * 100);
|
14,884 | assertThat(parsedEnum, is(CustomEnum.BAR));
}
@RootTask
public static Task<String> enums(CustomEnum enm) {
parsedEnum = enm;
<BUG>return Task.ofType(String.class).named("Enums", enm)
.process(enm::toString);</BUG>
}
@Test
public void shouldParseCustomTypes() throws Exception {
| return Task.named("Enums", enm).ofType(String.class)
.process(enm::toString);
|
14,885 | assertThat(parsedType.content, is("blarg parsed for you!"));
}
@RootTask
public static Task<String> customType(CustomType myType) {
parsedType = myType;
<BUG>return Task.ofType(String.class).named("Types", myType.content)
.process(() -> myType.content);</BUG>
}
public enum CustomEnum {
BAR
| return Task.named("Types", myType.content).ofType(String.class)
.process(() -> myType.content);
|
14,886 | TaskContext taskContext = TaskContext.inmem();
TaskContext.Value<Long> value = taskContext.evaluate(fib92);
value.consume(f92 -> System.out.println("fib(92) = " + f92));
}
static Task<Long> create(long n) {
<BUG>TaskBuilder<Long> fib = Task.ofType(Long.class).named("Fib", n);
</BUG>
if (n < 2) {
return fib
.process(() -> n);
| TaskBuilder<Long> fib = Task.named("Fib", n).ofType(Long.class);
|
14,887 | context.getProfiler().message(this, Profiler.START_SEQUENCES, "CONTEXT SEQUENCE", contextSequence);
if (contextItem != null)
context.getProfiler().message(this, Profiler.START_SEQUENCES, "CONTEXT ITEM", contextItem.toSequence());
}
Sequence result;
<BUG>IntegerValue precision = new IntegerValue(0);
</BUG>
Sequence seq = getArgument(0).eval(contextSequence, contextItem);
if (seq.isEmpty())
result = Sequence.EMPTY_SEQUENCE;
| IntegerValue precision = null;
|
14,888 | .setShared(TransportResourceDefinition.SHARED.resolveModelAttribute(context, transport).asBoolean())
.setTopology(site, rack, machine)
.setSocketBinding(ModelNodes.asString(ProtocolResourceDefinition.SOCKET_BINDING.resolveModelAttribute(context, transport)))
.setDiagnosticsSocket(ModelNodes.asString(TransportResourceDefinition.DIAGNOSTICS_SOCKET_BINDING.resolveModelAttribute(context, transport)));
addProtocolProperties(context, transport, transportBuilder);
<BUG>if (transport.hasDefined(ThreadPoolResourceDefinition.WILDCARD_PATH.getKey())) {
addThreadPoolConfigurationAsProperties(ThreadPoolResourceDefinition.DEFAULT, "thread_pool", context, transport, transportBuilder);
addThreadPoolConfigurationAsProperties(ThreadPoolResourceDefinition.INTERNAL, "internal_thread_pool", context, transport, transportBuilder);
addThreadPoolConfigurationAsProperties(ThreadPoolResourceDefinition.OOB, "oob_thread_pool", context, transport, transportBuilder);
addThreadPoolConfigurationAsProperties(ThreadPoolResourceDefinition.TIMER, "timer", context, transport, transportBuilder);
}</BUG>
transportBuilder.build(target).install();
| addThreadPoolConfigurationProperties(ThreadPoolResourceDefinition.DEFAULT, "thread_pool", context, transport, transportBuilder);
addThreadPoolConfigurationProperties(ThreadPoolResourceDefinition.INTERNAL, "internal_thread_pool", context, transport, transportBuilder);
addThreadPoolConfigurationProperties(ThreadPoolResourceDefinition.OOB, "oob_thread_pool", context, transport, transportBuilder);
addThreadPoolConfigurationProperties(ThreadPoolResourceDefinition.TIMER, "timer", context, transport, transportBuilder);
|
14,889 | int queueSize = pool.getQueueLength().resolveModelAttribute(context, threadModel).asInt();
if (queueSize == 0) {
</BUG>
builder.addProperty(propertyPrefix + ".queue_enabled", Boolean.FALSE.toString());
} else {
<BUG>builder.addProperty(propertyPrefix + ".queue_enabled", Boolean.TRUE.toString());
builder.addProperty(propertyPrefix + ".queue_max_size", String.valueOf(queueSize));
}
}
if (pool.getKeepAliveTime().resolveModelAttribute(context, threadModel).isDefined()) {</BUG>
long keepAliveTime = pool.getKeepAliveTime().resolveModelAttribute(context, threadModel).asLong();
| if (propertyPrefix.equals("timer")) {
} else if (queueSize == 0) {
builder.addProperty(propertyPrefix + ".queue_enabled", Boolean.TRUE.toString())
|
14,890 | throw e;
} catch (Throwable e) {
throw new IOException(e);
}
}
<BUG>@Nullable
public static String sha1(final File file) throws IOException {
return executeIoOperation(new ThreadUtil.Operation<String>() {
</BUG>
@Override
| @Nonnull
return Preconditions.checkNotNull(executeIoOperation(new ThreadUtil.Operation<String>() {
|
14,891 | UnsafeFileUtil.copyDirectory(source, destination);
return null;
}
});
}
<BUG>@Nullable
public static File ensureFileExists(final File file) throws IOException {
return executeIoOperation(new ThreadUtil.Operation<File>() {
</BUG>
@Override
| @Nonnull
return Preconditions.checkNotNull(executeIoOperation(new ThreadUtil.Operation<File>() {
|
14,892 | copyFile(sourceFile, destinationFile);
removeFile(sourceFile);
}
}
}
<BUG>@Nullable
public static byte[] getBytes(final File file) throws IOException {
return executeIoOperation(new ThreadUtil.Operation<byte[]>() {
</BUG>
@Override
| @Nonnull
return Preconditions.checkNotNull(executeIoOperation(new ThreadUtil.Operation<byte[]>() {
|
14,893 | hideFile(file);
}
} catch (IOException ignored) {
}
return file;
<BUG>}
public static boolean equalsOrSameContent(@Nullable File fileA, @Nullable File fileB) throws IOException {</BUG>
if (fileA == null && fileB == null) {
return true;
}
| @Contract("null, null -> true; null, !null -> false; !null, null -> false")
public static boolean equalsOrSameContent(@Nullable File fileA, @Nullable File fileB) throws IOException {
|
14,894 | if (file.isFile() || file.createNewFile() || file.isFile()) {
return file;
}
throw new IOException("Can't create file '" + file + "'.");
}
<BUG>@SuppressWarnings({"DuplicateCondition", "DuplicateBooleanBranch"})
public static File ensureDirectoryExists(File directory) throws IOException {
</BUG>
if (directory.isDirectory() || directory.mkdirs() || directory.isDirectory()) {
return directory;
| @Nonnull
public static File ensureDirectoryExists(@Nonnull File directory) throws IOException {
|
14,895 | throw new IOException("File not found " + file);
}
if (!file.delete()) {
throw new IOException("Can't delete " + file);
}
<BUG>}
public static byte[] getBytes(File file) throws IOException {</BUG>
if (file instanceof TFile) {
TFile trueZipFile = (TFile) file;
try {
| @Nonnull
public static byte[] getBytes(File file) throws IOException {
|
14,896 | deleteTotally(file);
if (!file.mkdir()) {
throw new IOException("Can't create directory '" + file + "'.");
}
return new TemporaryDirectory(file.getAbsolutePath());
<BUG>}
public static File createTemporaryDirectory(String prefix, File parentDirectory) throws IOException {</BUG>
File temporaryDirectory = new File(parentDirectory, prefix + '-' + RandomUtil.getRandomToken());
ensureDirectoryExists(temporaryDirectory);
return new TemporaryDirectory(temporaryDirectory.getAbsolutePath());
| @Nonnull
public static File createTemporaryDirectory(String prefix, File parentDirectory) throws IOException {
|
14,897 | import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.output.NullOutputStream;
import org.apache.commons.net.ftp.FTPClient;
<BUG>import org.apache.tools.zip.ZipFile;
import javax.annotation.Nullable;</BUG>
import java.io.*;
import java.nio.charset.Charset;
import java.security.DigestInputStream;
| import javax.annotation.Nonnull;
import javax.annotation.Nullable;
|
14,898 | return s;
} catch (IOException e) {
closeQuietly(inputStream);
throw new IOException("Can't read from input stream.", e);
}
<BUG>}
public static String toString(InputStream inputStream, @Nullable String charsetName) throws IOException {</BUG>
try {
String s = IOUtils.toString(inputStream, charsetName);
inputStream.close();
| @Nonnull
public static String toString(InputStream inputStream, @Nullable String charsetName) throws IOException {
|
14,899 | OutputStream outputStream = new TFileOutputStream(trueZipFile, false);
IoUtil.copy(inputStream, outputStream, true, true);
} finally {
synchronizeQuietly(trueZipFile);
}
<BUG>}
public static byte[] getZipEntryBytes(File zipFile, String zipEntryPath) throws IOException {</BUG>
ByteArrayOutputStream zipEntryOutputStream = new ByteArrayOutputStream();
writeZipEntryBytes(zipFile, zipEntryPath, zipEntryOutputStream);
return zipEntryOutputStream.toByteArray();
| @Nonnull
public static byte[] getZipEntryBytes(File zipFile, String zipEntryPath) throws IOException {
|
14,900 | cgl.setLexicalvalue(valueEdit);
cgl.setIdgroup(idDomaine);
cgl.setIdthesaurus(idTheso);
cgl.setLang(langueEdit);
GroupHelper cgh = new GroupHelper();
<BUG>if (!cgh.isDomainExist(connect.getPoolConnexion(),
cgl.getLexicalvalue(),</BUG>
cgl.getIdthesaurus(), cgl.getLang())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error4")));
return;
| if (cgh.isDomainExist(connect.getPoolConnexion(),
cgl.getLexicalvalue(),
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.