id
int64 1
194k
| buggy
stringlengths 23
37.5k
| fixed
stringlengths 6
37.4k
|
---|---|---|
193,201 | Assert.notBlank(packageName);
return this.addRoutePackages(packageName);
}
public Blade addRoutePackages(String... packages) {
Assert.notNull(packages);
<BUG>applicationConfig.addRoutePkgs(packages);
</BUG>
return this;
}
public Blade basePackage(String basePackage) {
| Assert.notBlank(packageName);
return this.addRoutePackages(packageName);
}
public Blade addRoutePackages(String... packages) {
Assert.notNull(packages);
configuration.addRoutePkgs(packages);
return this;
}
public Blade basePackage(String basePackage) {
|
193,202 | </BUG>
return this;
}
public Blade basePackage(String basePackage) {
Assert.notBlank(basePackage);
<BUG>applicationConfig.setBasePackage(basePackage);
</BUG>
return this;
}
public Blade interceptor(String packageName) {
| Assert.notBlank(packageName);
return this.addRoutePackages(packageName);
}
public Blade addRoutePackages(String... packages) {
Assert.notNull(packages);
configuration.addRoutePkgs(packages);
return this;
}
public Blade basePackage(String basePackage) {
Assert.notBlank(basePackage);
configuration.setBasePackage(basePackage);
return this;
}
public Blade interceptor(String packageName) {
|
193,203 | public Blade after(String path, RouteHandler handler) {
routers.route(path, handler, HttpMethod.AFTER);
return this;
}
public Blade addResources(final String... resources) {
<BUG>applicationConfig.addResources(resources);
</BUG>
return this;
}
public Blade addInterceptor(Class<? extends Interceptor> interceptor) {
| public Blade after(String path, RouteHandler handler) {
routers.route(path, handler, HttpMethod.AFTER);
return this;
}
public Blade addResources(final String... resources) {
configuration.addResources(resources);
return this;
}
public Blade addInterceptor(Class<? extends Interceptor> interceptor) {
|
193,204 | embedServer.join();
return embedServer;
}
public EmbedServer startNoJoin(Class<?> applicationClass) {
this.loadAppConf(Const.APP_PROPERTIES);
<BUG>applicationConfig.setEnv(config);</BUG>
if(null != applicationClass){
<BUG>applicationConfig.setApplicationClass(applicationClass);
if(StringKit.isBlank(applicationConfig.getBasePackage())){
applicationConfig.setBasePackage(applicationClass.getPackage().getName());
</BUG>
}
| embedServer.join();
return embedServer;
}
public EmbedServer startNoJoin(Class<?> applicationClass) {
this.loadAppConf(Const.APP_PROPERTIES);
if(null != applicationClass){
configuration.setApplicationClass(applicationClass);
if(StringKit.isBlank(configuration.getBasePackage())){
configuration.setBasePackage(applicationClass.getPackage().getName());
|
193,205 | public String encoding() {
<BUG>return applicationConfig.getEncoding();
</BUG>
}
public String webRoot() {
<BUG>return applicationConfig.webRoot();
}</BUG>
public boolean isDev() {
<BUG>return applicationConfig.isDev();
}</BUG>
public Blade plugin(Class<? extends Plugin> plugin) {
| public String encoding() {
return configuration.getEncoding();
}
public String webRoot() {
return configuration.webRoot();
}
public boolean isDev() {
return configuration.isDev();
}
public Blade plugin(Class<? extends Plugin> plugin) {
|
193,206 | import org.jitsi.impl.neomedia.device.*;
import org.jitsi.service.resources.*;
import org.osgi.framework.*;
public class AudioDeviceConfigurationListener
extends AbstractDeviceConfigurationListener
<BUG>{
public AudioDeviceConfigurationListener(</BUG>
ConfigurationForm configurationForm)
{
super(configurationForm);
| import org.jitsi.impl.neomedia.device.*;
import org.jitsi.service.resources.*;
import org.osgi.framework.*;
public class AudioDeviceConfigurationListener
extends AbstractDeviceConfigurationListener
{
private CaptureDeviceInfo captureDevice = null;
private CaptureDeviceInfo playbackDevice = null;
private CaptureDeviceInfo notificationDevice = null;
public AudioDeviceConfigurationListener(
ConfigurationForm configurationForm)
{
super(configurationForm);
|
193,207 | ResourceManagementService resources
= NeomediaActivator.getResources();
notificationService.fireNotification(
popUpEvent,
title,
<BUG>device.getName()
+ "\r\n"
</BUG>
+ resources.getI18NString(
"impl.media.configform"
| ResourceManagementService resources
= NeomediaActivator.getResources();
notificationService.fireNotification(
popUpEvent,
title,
body
+ "\r\n\r\n"
+ resources.getI18NString(
"impl.media.configform"
|
193,208 | package groovy.swing;
import groovy.model.DefaultTableModel;
import groovy.swing.factory.ActionFactory;
import groovy.swing.factory.BoxFactory;
import groovy.swing.factory.BoxLayoutFactory;
<BUG>import groovy.swing.factory.ButtonFactory;
import groovy.swing.factory.CheckBoxFactory;
import groovy.swing.factory.CheckBoxMenuItemFactory;</BUG>
import groovy.swing.factory.CollectionFactory;
| package groovy.swing;
import groovy.model.DefaultTableModel;
import groovy.swing.factory.ActionFactory;
import groovy.swing.factory.BoxFactory;
import groovy.swing.factory.BoxLayoutFactory;
import groovy.swing.factory.RichActionWidgetFactory;
import groovy.swing.factory.CollectionFactory;
|
193,209 | import groovy.swing.factory.CheckBoxFactory;
import groovy.swing.factory.CheckBoxMenuItemFactory;</BUG>
import groovy.swing.factory.CollectionFactory;
import groovy.swing.factory.ComboBoxFactory;
import groovy.swing.factory.DialogFactory;
<BUG>import groovy.swing.factory.EditorPaneFactory;</BUG>
import groovy.swing.factory.Factory;
import groovy.swing.factory.FormattedTextFactory;
import groovy.swing.factory.FrameFactory;
<BUG>import groovy.swing.factory.LabelFactory;</BUG>
import groovy.swing.factory.MapFactory;
| package groovy.swing;
import groovy.model.DefaultTableModel;
import groovy.swing.factory.ActionFactory;
import groovy.swing.factory.BoxFactory;
import groovy.swing.factory.BoxLayoutFactory;
import groovy.swing.factory.RichActionWidgetFactory;
import groovy.swing.factory.CollectionFactory;
import groovy.swing.factory.ComboBoxFactory;
import groovy.swing.factory.DialogFactory;
import groovy.swing.factory.Factory;
import groovy.swing.factory.FormattedTextFactory;
import groovy.swing.factory.FrameFactory;
|
193,210 | import groovy.swing.factory.FormattedTextFactory;
import groovy.swing.factory.FrameFactory;
<BUG>import groovy.swing.factory.LabelFactory;</BUG>
import groovy.swing.factory.MapFactory;
<BUG>import groovy.swing.factory.MenuItemFactory;
import groovy.swing.factory.PasswordFieldFactory;
import groovy.swing.factory.RadioButtonFactory;
import groovy.swing.factory.RadioButtonMenuItemFactory;</BUG>
import groovy.swing.factory.SeparatorFactory;
import groovy.swing.factory.SplitPaneFactory;
| import groovy.swing.factory.FormattedTextFactory;
import groovy.swing.factory.FrameFactory;
import groovy.swing.factory.MapFactory;
import groovy.swing.factory.SeparatorFactory;
import groovy.swing.factory.SplitPaneFactory;
|
193,211 | import groovy.swing.factory.RadioButtonMenuItemFactory;</BUG>
import groovy.swing.factory.SeparatorFactory;
import groovy.swing.factory.SplitPaneFactory;
import groovy.swing.factory.TableLayoutFactory;
import groovy.swing.factory.TableModelFactory;
<BUG>import groovy.swing.factory.TextAreaFactory;
import groovy.swing.factory.TextFieldFactory;
import groovy.swing.factory.TextPaneFactory;
import groovy.swing.factory.ToggleButtonFactory;</BUG>
import groovy.swing.factory.WidgetFactory;
| import groovy.swing.factory.FormattedTextFactory;
import groovy.swing.factory.FrameFactory;
import groovy.swing.factory.MapFactory;
import groovy.swing.factory.SeparatorFactory;
import groovy.swing.factory.SplitPaneFactory;
import groovy.swing.factory.TableLayoutFactory;
import groovy.swing.factory.TableModelFactory;
import groovy.swing.factory.TextArgWidgetFactory;
import groovy.swing.factory.WidgetFactory;
|
193,212 | import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.ButtonGroup;
<BUG>import javax.swing.DefaultBoundedRangeModel;
import javax.swing.JColorChooser;</BUG>
import javax.swing.JComponent;
import javax.swing.JDesktopPane;
import javax.swing.JEditorPane;
| import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.ButtonGroup;
import javax.swing.DefaultBoundedRangeModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JColorChooser;
import javax.swing.JComponent;
import javax.swing.JDesktopPane;
import javax.swing.JEditorPane;
|
193,213 | import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JTextField;
<BUG>import javax.swing.JTextPane;
import javax.swing.JToolBar;</BUG>
import javax.swing.JTree;
import javax.swing.JViewport;
import javax.swing.KeyStroke;
| import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import javax.swing.JToggleButton;
import javax.swing.JToolBar;
import javax.swing.JTree;
import javax.swing.JViewport;
import javax.swing.KeyStroke;
|
193,214 | registerBeanFactory("spinner", JSpinner.class);
registerFactory("splitPane", new SplitPaneFactory());
registerBeanFactory("tabbedPane", JTabbedPane.class);
registerBeanFactory("table", JTable.class);
registerBeanFactory("tableColumn", TableColumn.class);
<BUG>registerFactory("textArea", new TextAreaFactory());
registerFactory("textPane", new TextPaneFactory());
registerFactory("textField", new TextFieldFactory());
registerFactory("toggleButton", new ToggleButtonFactory());</BUG>
registerBeanFactory("toolBar", JToolBar.class);
| registerBeanFactory("spinner", JSpinner.class);
registerFactory("splitPane", new SplitPaneFactory());
registerBeanFactory("tabbedPane", JTabbedPane.class);
registerBeanFactory("table", JTable.class);
registerBeanFactory("tableColumn", TableColumn.class);
registerBeanFactory("toolBar", JToolBar.class);
|
193,215 | package com.github.games647.fastlogin.bukkit.commands;
<BUG>import com.github.games647.fastlogin.bukkit.BukkitCore;
</BUG>
import com.github.games647.fastlogin.core.AuthStorage;
<BUG>import com.github.games647.fastlogin.core.importer.ImportPlugin;
import org.bukkit.ChatColor;</BUG>
import org.bukkit.command.Command;
| package com.github.games647.fastlogin.bukkit.commands;
import com.github.games647.fastlogin.bukkit.FastLoginBukkit;
import com.github.games647.fastlogin.core.AuthStorage;
import com.github.games647.fastlogin.core.importer.ImportPlugin;
import com.github.games647.fastlogin.core.shared.FastLoginCore;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
|
193,216 | import com.github.games647.fastlogin.core.AuthStorage;
<BUG>import com.github.games647.fastlogin.core.importer.ImportPlugin;
import org.bukkit.ChatColor;</BUG>
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
<BUG>import org.bukkit.command.CommandSender;
public class ImportCommand implements CommandExecutor {
private final BukkitCore core;
public ImportCommand(BukkitCore core) {
this.core = core;</BUG>
}
| import com.github.games647.fastlogin.core.AuthStorage;
import com.github.games647.fastlogin.core.importer.ImportPlugin;
import com.github.games647.fastlogin.core.shared.FastLoginCore;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class ImportCommand implements CommandExecutor {
private final FastLoginCore<Player, CommandSender, FastLoginBukkit> core;
public ImportCommand(FastLoginCore<Player, CommandSender, FastLoginBukkit> core) {
this.core = core;
}
|
193,217 | String id = '/' + address.getAddress().getHostAddress() + ':' + address.getPort();
if ("AUTO_LOGIN".equalsIgnoreCase(subchannel)) {
BukkitLoginSession playerSession = new BukkitLoginSession(playerName, true);
playerSession.setVerified(true);
plugin.getSessions().put(id, playerSession);
<BUG>Bukkit.getScheduler().runTaskAsynchronously(plugin, new ForceLoginTask(plugin, player));
</BUG>
} else if ("AUTO_REGISTER".equalsIgnoreCase(subchannel)) {
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
AuthPlugin<Player> authPlugin = plugin.getCore().getAuthPluginHook();
| String id = '/' + address.getAddress().getHostAddress() + ':' + address.getPort();
if ("AUTO_LOGIN".equalsIgnoreCase(subchannel)) {
BukkitLoginSession playerSession = new BukkitLoginSession(playerName, true);
playerSession.setVerified(true);
plugin.getSessions().put(id, playerSession);
Bukkit.getScheduler().runTaskAsynchronously(plugin, new ForceLoginTask(plugin.getCore(), player));
} else if ("AUTO_REGISTER".equalsIgnoreCase(subchannel)) {
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
AuthPlugin<Player> authPlugin = plugin.getCore().getAuthPluginHook();
|
193,218 | try {
if (authPlugin == null || !authPlugin.isRegistered(playerName)) {
BukkitLoginSession playerSession = new BukkitLoginSession(playerName, false);
playerSession.setVerified(true);
plugin.getSessions().put(id, playerSession);
<BUG>new ForceLoginTask(plugin, player).run();
</BUG>
}
} catch (Exception ex) {
plugin.getLogger().log(Level.SEVERE, "Failed to query isRegistered", ex);
| try {
if (authPlugin == null || !authPlugin.isRegistered(playerName)) {
BukkitLoginSession playerSession = new BukkitLoginSession(playerName, false);
playerSession.setVerified(true);
plugin.getSessions().put(id, playerSession);
new ForceLoginTask(plugin.getCore(), player).run();
}
} catch (Exception ex) {
plugin.getLogger().log(Level.SEVERE, "Failed to query isRegistered", ex);
|
193,219 | }
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args.length == 0) {
if (!(sender instanceof Player)) {
<BUG>sender.sendMessage(plugin.getCore().getMessage("no-console"));
return true;</BUG>
}
if (plugin.isBungeeCord()) {
<BUG>plugin.sendBungeeActivateMessage(sender, sender.getName(), true);
String message = plugin.getCore().getMessage("wait-on-proxy");
if (message != null) {
sender.sendMessage(message);
}</BUG>
} else {
| }
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args.length == 0) {
if (!(sender instanceof Player)) {
plugin.getCore().sendLocaleMessage("no-console", sender);
return true;
}
if (plugin.isBungeeCord()) {
plugin.sendBungeeActivateMessage(sender, sender.getName(), true);
plugin.getCore().sendLocaleMessage("wait-on-proxy", sender);
} else {
|
193,220 | BukkitLoginSession session = plugin.getSessions().get(fromPlayer.getAddress().toString());
if (session == null) {
disconnect(plugin.getCore().getMessage("invalid-requst"), true
, "Player {0} tried to send encryption response at invalid state", fromPlayer.getAddress());
} else {
<BUG>String ip = fromPlayer.getAddress().getAddress().getHostAddress();
plugin.getCore().getPendingLogins().remove(ip + session.getUsername());</BUG>
verifyResponse(session);
}
} finally {
| BukkitLoginSession session = plugin.getSessions().get(fromPlayer.getAddress().toString());
if (session == null) {
disconnect(plugin.getCore().getMessage("invalid-requst"), true
, "Player {0} tried to send encryption response at invalid state", fromPlayer.getAddress());
} else {
verifyResponse(session);
}
} finally {
|
193,221 | import com.github.games647.fastlogin.bukkit.BukkitLoginSession;
import com.github.games647.fastlogin.bukkit.FastLoginBukkit;
import com.github.games647.fastlogin.core.PlayerProfile;
import com.github.games647.fastlogin.core.shared.JoinManagement;
import java.util.Random;
<BUG>import java.util.logging.Level;
import org.bukkit.entity.Player;
public class NameCheckTask extends JoinManagement<Player, ProtocolLibLoginSource> implements Runnable {
private final FastLoginBukkit plugin;</BUG>
private final PacketEvent packetEvent;
| import com.github.games647.fastlogin.bukkit.BukkitLoginSession;
import com.github.games647.fastlogin.bukkit.FastLoginBukkit;
import com.github.games647.fastlogin.core.PlayerProfile;
import com.github.games647.fastlogin.core.shared.JoinManagement;
import java.util.Random;
import java.util.logging.Level;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class NameCheckTask extends JoinManagement<Player, CommandSender, ProtocolLibLoginSource>
implements Runnable {
private final FastLoginBukkit plugin;
private final PacketEvent packetEvent;
|
193,222 | import java.util.logging.Level;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;</BUG>
import org.bukkit.plugin.java.JavaPlugin;
<BUG>public class FastLoginBukkit extends JavaPlugin {
private static final int WORKER_THREADS = 3;</BUG>
private final KeyPair keyPair = EncryptionUtil.generateKeyPair();
private boolean bungeeCord;
<BUG>private BukkitCore core;
private boolean serverStarted;</BUG>
private final ConcurrentMap<String, BukkitLoginSession> session = FastLoginCore.buildCache(1, -1);
| import java.util.logging.Level;
import java.util.logging.Logger;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class FastLoginBukkit extends JavaPlugin implements PlatformPlugin<CommandSender> {
private static final int WORKER_THREADS = 3;
private final KeyPair keyPair = EncryptionUtil.generateKeyPair();
private boolean bungeeCord;
private FastLoginCore<Player, CommandSender, FastLoginBukkit> core;
private boolean serverStarted;
private final ConcurrentMap<String, BukkitLoginSession> session = FastLoginCore.buildCache(1, -1);
|
193,223 | if (core != null) {
core.close();
}
getServer().getOnlinePlayers().forEach(player -> player.removeMetadata(getName(), this));
}
<BUG>public BukkitCore getCore() {
return core;</BUG>
}
public void sendBungeeActivateMessage(CommandSender sender, String target, boolean activate) {
if (sender instanceof Player) {
| if (core != null) {
core.close();
}
getServer().getOnlinePlayers().forEach(player -> player.removeMetadata(getName(), this));
}
public FastLoginCore<Player, CommandSender, FastLoginBukkit> getCore() {
return core;
}
public void sendBungeeActivateMessage(CommandSender sender, String target, boolean activate) {
if (sender instanceof Player) {
|
193,224 | if (!(sender instanceof Player)) {
sender.sendMessage(plugin.getCore().getMessage("no-console"));
return true;
}
if (plugin.isBungeeCord()) {
<BUG>plugin.sendBungeeActivateMessage(sender, sender.getName(), false);
String message = plugin.getCore().getMessage("wait-on-proxy");
if (message != null) {
sender.sendMessage(message);
}</BUG>
} else {
| if (!(sender instanceof Player)) {
sender.sendMessage(plugin.getCore().getMessage("no-console"));
return true;
}
if (plugin.isBungeeCord()) {
plugin.sendBungeeActivateMessage(sender, sender.getName(), false);
plugin.getCore().sendLocaleMessage("wait-on-proxy", sender);
} else {
|
193,225 | profile.setUuid(null);
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
plugin.getCore().getStorage().save(profile);
});
} else {
<BUG>sender.sendMessage(plugin.getCore().getMessage("not-premium"));
}</BUG>
}
return true;
} else {
| profile.setUuid(null);
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
plugin.getCore().getStorage().save(profile);
});
} else {
plugin.getCore().sendLocaleMessage("not-premium", sender);
}
}
return true;
} else {
|
193,226 | if (profile == null) {
sender.sendMessage("Error occured");
return;
}
if (profile.getUserId() != -1 && !profile.isPremium()) {
<BUG>sender.sendMessage(plugin.getCore().getMessage("not-premium-other"));
} else {
sender.sendMessage(plugin.getCore().getMessage("remove-premium"));
profile.setPremium(false);</BUG>
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
| if (profile == null) {
sender.sendMessage("Error occured");
return;
}
if (profile.getUserId() != -1 && !profile.isPremium()) {
plugin.getCore().sendLocaleMessage("not-premium-other", sender);
} else {
plugin.getCore().sendLocaleMessage("remove-premium", sender);
profile.setPremium(false);
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
193,227 | import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
<BUG>import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;</BUG>
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
| import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
|
193,228 | import com.wm.remusic.recent.SongLoader;
import com.wm.remusic.recent.TopTracksLoader;
import com.wm.remusic.service.MediaService;
import com.wm.remusic.service.MusicPlayer;
import com.wm.remusic.uitl.CommonUtils;
<BUG>import com.wm.remusic.uitl.IConstants;
import com.wm.remusic.uitl.MusicUtils;</BUG>
import com.wm.remusic.widget.DividerItemDecoration;
import java.util.HashMap;
import java.util.List;
| import com.wm.remusic.recent.SongLoader;
import com.wm.remusic.recent.TopTracksLoader;
import com.wm.remusic.service.MediaService;
import com.wm.remusic.service.MusicPlayer;
import com.wm.remusic.uitl.CommonUtils;
import com.wm.remusic.uitl.IConstants;
import com.wm.remusic.uitl.L;
import com.wm.remusic.uitl.MusicUtils;
import com.wm.remusic.widget.DividerItemDecoration;
import java.util.HashMap;
import java.util.List;
|
193,229 | throw new IllegalArgumentException("model Data must not be null");
}
mList = list;
}
public void updateDataSet(List<Song> list) {
<BUG>this.mList = list;
}</BUG>
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
if (viewType == FIRST_ITEM)
| throw new IllegalArgumentException("model Data must not be null");
}
mList = list;
}
public void updateDataSet(List<Song> list) {
this.mList = list;
notifyDataSetChanged();
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
if (viewType == FIRST_ITEM)
|
193,230 | import android.graphics.drawable.TransitionDrawable;
import android.media.AudioManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
<BUG>import android.os.Environment;
import android.os.ParcelFileDescriptor;</BUG>
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
| import android.graphics.drawable.TransitionDrawable;
import android.media.AudioManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.ParcelFileDescriptor;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
|
193,231 | import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBar;
<BUG>import android.support.v7.widget.Toolbar;
import android.view.Menu;</BUG>
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
| import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
|
193,232 | import com.wm.remusic.fragment.SimpleMoreFragment;
import com.wm.remusic.handler.HandlerUtil;
import com.wm.remusic.info.MusicInfo;
import com.wm.remusic.lrc.DefaultLrcParser;
import com.wm.remusic.lrc.LrcRow;
<BUG>import com.wm.remusic.lrc.LrcView;
import com.wm.remusic.provider.PlaylistsManager;</BUG>
import com.wm.remusic.service.MediaService;
import com.wm.remusic.service.MusicPlayer;
import com.wm.remusic.uitl.IConstants;
| import com.wm.remusic.fragment.SimpleMoreFragment;
import com.wm.remusic.handler.HandlerUtil;
import com.wm.remusic.info.MusicInfo;
import com.wm.remusic.lrc.DefaultLrcParser;
import com.wm.remusic.lrc.LrcRow;
import com.wm.remusic.lrc.LrcView;
import com.wm.remusic.provider.MusicPlaybackState;
import com.wm.remusic.provider.PlaylistsManager;
import com.wm.remusic.service.MediaService;
import com.wm.remusic.service.MusicPlayer;
import com.wm.remusic.uitl.IConstants;
|
193,233 | private FrameLayout albumLayout;
private RelativeLayout lrcViewContainer;
private LrcView mLrcView;
private TextView tryGetLrc;
private LinearLayout musicTool;
<BUG>private SeekBar mVolumeSeek;
private boolean print = true;</BUG>
private String TAG = PlayingActivity.class.getSimpleName();
@Override
protected void showQuickControl(boolean show) {
| private FrameLayout albumLayout;
private RelativeLayout lrcViewContainer;
private LrcView mLrcView;
private TextView tryGetLrc;
private LinearLayout musicTool;
private SeekBar mVolumeSeek;
private Handler mHandler;
private boolean print = true;
private String TAG = PlayingActivity.class.getSimpleName();
@Override
protected void showQuickControl(boolean show) {
|
193,234 | needle = (ImageView) findViewById(R.id.needle);
mViewPager = (AlbumViewPager) findViewById(R.id.view_pager);
mViewPager.setOffscreenPageLimit(2);
mVolumeSeek = (SeekBar) findViewById(R.id.volume_seek);
mProgress.setIndeterminate(false);
<BUG>mProgress.setProgress(1);
if (MusicPlayer.isTrackLocal()) {
mProgress.setSecondaryProgress(100);
}</BUG>
loadOther();
| needle = (ImageView) findViewById(R.id.needle);
mViewPager = (AlbumViewPager) findViewById(R.id.view_pager);
mViewPager.setOffscreenPageLimit(2);
mVolumeSeek = (SeekBar) findViewById(R.id.volume_seek);
mProgress.setIndeterminate(false);
mProgress.setProgress(1);
mProgress.setMax(1000);
loadOther();
|
193,235 | HandlerUtil.getInstance(PlayingActivity.this).postDelayed(new Runnable() {
@Override
public void run() {
MusicPlayer.previous(PlayingActivity.this, true);
}
<BUG>}, 396);
} else if (pPosition > MusicPlayer.getQueuePosition() + 1) {</BUG>
HandlerUtil.getInstance(PlayingActivity.this).postDelayed(new Runnable() {
@Override
public void run() {
| HandlerUtil.getInstance(PlayingActivity.this).postDelayed(new Runnable() {
@Override
public void run() {
MusicPlayer.previous(PlayingActivity.this, true);
}
}, 500);
} else if (pPosition > MusicPlayer.getQueuePosition() + 1) {
HandlerUtil.getInstance(PlayingActivity.this).postDelayed(new Runnable() {
@Override
public void run() {
|
193,236 | super.onStart();
mViewPager.setCurrentItem(MusicPlayer.getQueuePosition() + 1);
}
@Override
public void onResume() {
<BUG>super.onResume();
}</BUG>
public void updateQueue() {
if (MusicPlayer.getQueueSize() == 0) {
MusicPlayer.stop();
| super.onStart();
mViewPager.setCurrentItem(MusicPlayer.getQueuePosition() + 1);
}
@Override
public void onResume() {
super.onResume();
lastAlbum = -1;
}
public void updateQueue() {
if (MusicPlayer.getQueueSize() == 0) {
MusicPlayer.stop();
|
193,237 | needleAnim.setInterpolator(new LinearInterpolator());
}
animatorSet.play(needleAnim).before(animator);
animatorSet.start();
}
<BUG>} else {
if (needleAnim != null) {</BUG>
needleAnim.reverse();
needleAnim.end();
}
| needleAnim.setInterpolator(new LinearInterpolator());
}
animatorSet.play(needleAnim).before(animator);
animatorSet.start();
}
} else {
mProgress.removeCallbacks(mUpdateProgress);
control.setImageResource(R.drawable.play_rdi_btn_play);
if (needleAnim != null) {
needleAnim.reverse();
needleAnim.end();
}
|
193,238 | mViewPager.setCurrentItem(MusicPlayer.getQueuePosition() + 1);
isNextOrPreSetPage = true;
}
}
@Override
<BUG>public void updateTime() {
duration.setText(MusicUtils.makeShortTimeString(PlayingActivity.this.getApplication(), MusicPlayer.duration() / 1000));
duration.setText(MusicUtils.makeTimeString(MusicPlayer.duration()));
}
@Override</BUG>
public void updateBuffer(int p) {
| mViewPager.setCurrentItem(MusicPlayer.getQueuePosition() + 1);
isNextOrPreSetPage = true;
}
}
@Override
|
193,239 | duration.setText(MusicUtils.makeTimeString(MusicPlayer.duration()));
}
@Override</BUG>
public void updateBuffer(int p) {
<BUG>mProgress.setSecondaryProgress(p);
</BUG>
}
@Override
public void loading(boolean l) {
mProgress.setLoading(l);
| mViewPager.setCurrentItem(MusicPlayer.getQueuePosition() + 1);
isNextOrPreSetPage = true;
}
}
@Override
public void updateBuffer(int p) {
mProgress.setSecondaryProgress(p*10);
}
@Override
public void loading(boolean l) {
mProgress.setLoading(l);
|
193,240 | @Override
public void run() {
if (mProgress != null) {
long position = MusicPlayer.position();
long duration = MusicPlayer.duration();
<BUG>if (duration > 0)
mProgress.setProgress((int) (mProgress.getMax() * position / duration));
timePlayed.setText(MusicUtils.makeShortTimeString(PlayingActivity.this.getApplication(), position / 1000));
if (MusicPlayer.isPlaying()) {
mProgress.postDelayed(mUpdateProgress, 100);
}</BUG>
}
| @Override
public void updateBuffer(int p) {
mProgress.setSecondaryProgress(p*10);
|
193,241 | if (mProgress != null)
mProgress.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
int progress = 0;
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
<BUG>i = (int) (i * MusicPlayer.duration() / 100);
</BUG>
mLrcView.seekTo(i, true, b);
if (b) {
<BUG>MusicPlayer.seek((long) i);
timePlayed.setText(MusicUtils.makeShortTimeString(PlayingActivity.this.getApplication(), i / 1000));
}</BUG>
}
| if (mProgress != null)
mProgress.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
int progress = 0;
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
i = (int) (i * MusicPlayer.duration() / 1000);
mLrcView.seekTo(i, true, b);
if (b) {
MusicPlayer.seek((long)i);
timePlayed.setText(MusicUtils.makeTimeString( i ));
}
}
|
193,242 | animator.setFloatValues(valueAvatar, 360f + valueAvatar);
}
}
}
}
<BUG>private Bitmap mBitmap;
private class setBlurredAlbumArt extends AsyncTask<Void, Void, Drawable> {</BUG>
long albumid = MusicPlayer.getCurrentAlbumId();
@Override
<BUG>protected Drawable doInBackground(Void... loadedImage) {
Drawable drawable = null;</BUG>
mBitmap = null;
| animator.setFloatValues(valueAvatar, 360f + valueAvatar);
}
}
}
}
private Bitmap mBitmap;
private long lastAlbum;
private class setBlurredAlbumArt extends AsyncTask<Void, Void, Drawable> {
long albumid = MusicPlayer.getCurrentAlbumId();
@Override
protected Drawable doInBackground(Void... loadedImage) {
lastAlbum = albumid;
Drawable drawable = null;
mBitmap = null;
|
193,243 | return view;
}
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
<BUG>if (isVisibleToUser && mContext != null) {
reloadAdapter();</BUG>
}
}
private void setInfo(String title, int count, int id, int i) {
| return view;
}
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser) {
reloadAdapter();
}
}
private void setInfo(String title, int count, int id, int i) {
|
193,244 | package uk.co.coen.capsulecrm.client;
<BUG>import com.google.common.base.Objects;
import com.thoughtworks.xstream.io.xml.DomReader;
import play.libs.F;
import play.libs.WS;</BUG>
public class COrganisation extends CParty {
| package uk.co.coen.capsulecrm.client;
import com.google.common.base.Objects;
import java.util.concurrent.Future;
import static com.google.common.util.concurrent.Futures.transform;
public class COrganisation extends CParty {
|
193,245 | package uk.co.coen.capsulecrm.client;
import com.google.common.base.Objects;
<BUG>import com.thoughtworks.xstream.io.xml.DomReader;</BUG>
import org.joda.time.DateTime;
<BUG>import play.libs.F;
import play.libs.WS;
import java.util.concurrent.TimeUnit;
public class COpportunity extends CapsuleEntity {</BUG>
public String name;
| package uk.co.coen.capsulecrm.client;
import com.google.common.base.Objects;
import org.joda.time.DateTime;
import java.io.IOException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import static com.google.common.util.concurrent.Futures.transform;
public class COpportunity extends CapsuleEntity {
public String name;
|
193,246 | private LocalBroadcastManager mLocalBroadcastManager;
private String mActiveDownloadUrlString;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
<BUG>setContentView(R.layout.activity_app_details2);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);</BUG>
toolbar.setTitle(""); // Nice and clean toolbar
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
| private LocalBroadcastManager mLocalBroadcastManager;
private String mActiveDownloadUrlString;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.app_details2);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle(""); // Nice and clean toolbar
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
193,247 | .inflate(R.layout.app_details2_screenshots, parent, false);
return new ScreenShotsViewHolder(view);
} else if (viewType == VIEWTYPE_WHATS_NEW) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.app_details2_whatsnew, parent, false);
<BUG>return new WhatsNewViewHolder(view);
} else if (viewType == VIEWTYPE_LINKS) {</BUG>
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.app_details2_links, parent, false);
return new ExpandableLinearLayoutViewHolder(view);
| .inflate(R.layout.app_details2_screenshots, parent, false);
return new ScreenShotsViewHolder(view);
} else if (viewType == VIEWTYPE_WHATS_NEW) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.app_details2_whatsnew, parent, false);
return new WhatsNewViewHolder(view);
} else if (viewType == VIEWTYPE_DONATE) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.app_details2_donate, parent, false);
return new DonateViewHolder(view);
} else if (viewType == VIEWTYPE_LINKS) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.app_details2_links, parent, false);
return new ExpandableLinearLayoutViewHolder(view);
|
193,248 | }
<BUG>if (TypeChecker.getInstance().getSubtypingManager().isSubtype(type, _quotation_createNode_x583g4_b0a3a41())) {
</BUG>
return SNodeOperations.getNode("r:53684c5c-ca9d-4308-a9d7-6866aa7b486b(jetbrains.mps.lang.smodel.query.runtime)", "1125969196844632137");
}
<BUG>if (TypeChecker.getInstance().getSubtypingManager().isSubtype(type, _quotation_createNode_x583g4_b0a4a41())) {
</BUG>
return SNodeOperations.getNode("r:53684c5c-ca9d-4308-a9d7-6866aa7b486b(jetbrains.mps.lang.smodel.query.runtime)", "1125969196844632254");
}
return null;
| }
if (TypeChecker.getInstance().getSubtypingManager().isSubtype(elementType, _quotation_createNode_x583g4_b0a4a31())) {
return SNodeOperations.getNode("r:53684c5c-ca9d-4308-a9d7-6866aa7b486b(jetbrains.mps.lang.smodel.query.runtime)", "3501374812263262593");
}
if (TypeChecker.getInstance().getSubtypingManager().isSubtype(elementType, _quotation_createNode_x583g4_b0a5a31())) {
return SNodeOperations.getNode("r:53684c5c-ca9d-4308-a9d7-6866aa7b486b(jetbrains.mps.lang.smodel.query.runtime)", "3501374812263265578");
}
if (TypeChecker.getInstance().getSubtypingManager().isSubtype(elementType, _quotation_createNode_x583g4_b0a6a31())) {
return SNodeOperations.getNode("r:53684c5c-ca9d-4308-a9d7-6866aa7b486b(jetbrains.mps.lang.smodel.query.runtime)", "3501374812263268620");
}
return null;
|
193,249 | import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
<BUG>import java.io.InputStreamReader;</BUG>
import java.io.Reader;
import java.util.ArrayList;
<BUG>import java.util.Arrays;
import java.util.Collections;</BUG>
import java.util.Date;
| import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
|
193,250 | public RejarClassesForAnalysis(RejarClassesForAnalysisCommandLine commandLine, int argCount, String[] args) {
this.commandLine = commandLine;
this.argCount = argCount;
this.args = args;
}
<BUG>public static List<String> readFromStandardInput() throws IOException {
return readFrom(UserTextFile.bufferedReader(System.in));
</BUG>
}
| public RejarClassesForAnalysis(RejarClassesForAnalysisCommandLine commandLine, int argCount, String[] args) {
this.commandLine = commandLine;
this.argCount = argCount;
this.args = args;
}
public static void readFromStandardInput(Collection<String> result) throws IOException {
readFrom(result, UserTextFile.bufferedReader(System.in));
}
|
193,251 | public ReportElement getBase() {
return base;
}
@Override
public float print(PDDocument document, PDPageContentStream stream, int pageNumber, float startX, float startY, float allowedWidth) throws IOException {
<BUG>PDPage currPage = (PDPage) document.getDocumentCatalog().getPages().get(pageNo);
PDPageContentStream pageStream = new PDPageContentStream(document, currPage, true, false);
</BUG>
base.print(document, pageStream, pageNo, x, y, width);
pageStream.close();
| public ReportElement getBase() {
return base;
}
@Override
public float print(PDDocument document, PDPageContentStream stream, int pageNumber, float startX, float startY, float allowedWidth) throws IOException {
PDPage currPage = document.getDocumentCatalog().getPages().get(pageNo);
PDPageContentStream pageStream = new PDPageContentStream(document, currPage, PDPageContentStream.AppendMode.APPEND, false);
base.print(document, pageStream, pageNo, x, y, width);
pageStream.close();
|
193,252 | public PdfTextStyle(String config) {
Assert.hasText(config);
String[] split = config.split(",");
Assert.isTrue(split.length == 3, "config must look like: 10,Times-Roman,#000000");
fontSize = Integer.parseInt(split[0]);
<BUG>font = resolveStandard14Name(split[1]);
color = new Color(Integer.valueOf(split[2].substring(1), 16));</BUG>
}
public int getFontSize() {
return fontSize;
| public PdfTextStyle(String config) {
Assert.hasText(config);
String[] split = config.split(",");
Assert.isTrue(split.length == 3, "config must look like: 10,Times-Roman,#000000");
fontSize = Integer.parseInt(split[0]);
font = getFont(split[1]);
color = new Color(Integer.valueOf(split[2].substring(1), 16));
}
public int getFontSize() {
return fontSize;
|
193,253 | import org.apache.pdfbox.pdmodel.PDDocument;
<BUG>import org.apache.pdfbox.pdmodel.edit.PDPageContentStream;
import org.apache.pdfbox.pdmodel.font.PDFont;</BUG>
import org.springframework.util.StringUtils;
<BUG>import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;</BUG>
public class ReportRichTextBox extends ReportTextBox {
public ReportRichTextBox(PdfTextStyle textConfig, float lineDistance, String text) {
| import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
import org.springframework.util.StringUtils;
public class ReportRichTextBox extends ReportTextBox {
public ReportRichTextBox(PdfTextStyle textConfig, float lineDistance, String text) {
|
193,254 | package cc.catalysts.boot.report.pdf.elements;
import org.apache.pdfbox.pdmodel.PDDocument;
<BUG>import org.apache.pdfbox.pdmodel.edit.PDPageContentStream;
import java.io.IOException;</BUG>
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
| package cc.catalysts.boot.report.pdf.elements;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
|
193,255 | package cc.catalysts.boot.report.pdf.elements;
import cc.catalysts.boot.report.pdf.config.PdfTextStyle;
import cc.catalysts.boot.report.pdf.utils.ReportAlignType;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
<BUG>import org.apache.pdfbox.pdmodel.font.PDFont;
import org.slf4j.Logger;</BUG>
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import java.io.IOException;
| package cc.catalysts.boot.report.pdf.elements;
import cc.catalysts.boot.report.pdf.config.PdfTextStyle;
import cc.catalysts.boot.report.pdf.utils.ReportAlignType;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
import org.apache.pdfbox.pdmodel.font.PDFont;
import org.apache.pdfbox.pdmodel.font.PDType1Font;
import org.apache.pdfbox.util.Matrix;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import java.io.IOException;
|
193,256 | addTextSimple(stream, textConfig, textX, nextLineY, "");
return nextLineY;
}
try {
<BUG>String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, fixedText);
</BUG>
float x = calculateAlignPosition(textX, align, textConfig, allowedWidth, split[0]);
if (!underline) {
addTextSimple(stream, textConfig, x, nextLineY, split[0]);
} else {
| addTextSimple(stream, textConfig, textX, nextLineY, "");
return nextLineY;
}
try {
String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, text);
float x = calculateAlignPosition(textX, align, textConfig, allowedWidth, split[0]);
if (!underline) {
addTextSimple(stream, textConfig, x, nextLineY, split[0]);
} else {
|
193,257 | public static void addTextSimple(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) {
try {
stream.setFont(textConfig.getFont(), textConfig.getFontSize());
stream.setNonStrokingColor(textConfig.getColor());
stream.beginText();
<BUG>stream.newLineAtOffset(textX, textY);
stream.showText(text);</BUG>
} catch (Exception e) {
LOG.warn("Could not add text: " + e.getClass() + " - " + e.getMessage());
}
| public static void addTextSimple(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) {
try {
stream.setFont(textConfig.getFont(), textConfig.getFontSize());
stream.setNonStrokingColor(textConfig.getColor());
stream.beginText();
stream.setTextMatrix(new Matrix(1,0,0,1, textX, textY));
stream.showText(text);
} catch (Exception e) {
LOG.warn("Could not add text: " + e.getClass() + " - " + e.getMessage());
}
|
193,258 | public static void addTextSimpleUnderlined(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) {
addTextSimple(stream, textConfig, textX, textY, text);
try {
float lineOffset = textConfig.getFontSize() / 8F;
stream.setStrokingColor(textConfig.getColor());
<BUG>stream.setLineWidth(0.5F);
stream.drawLine(textX, textY - lineOffset, textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset);
</BUG>
stream.stroke();
} catch (IOException e) {
| public static void addTextSimpleUnderlined(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) {
addTextSimple(stream, textConfig, textX, textY, text);
try {
float lineOffset = textConfig.getFontSize() / 8F;
stream.setStrokingColor(textConfig.getColor());
stream.setLineWidth(0.5F);
stream.moveTo(textX, textY - lineOffset);
stream.lineTo(textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset);
stream.stroke();
} catch (IOException e) {
|
193,259 | list.add(text.length());
return list;
}
public static String[] splitText(PDFont font, int fontSize, float allowedWidth, String text) {
String endPart = "";
<BUG>String shortenedText = text;
List<String> breakSplitted = Arrays.asList(shortenedText.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList());
if (breakSplitted.size() > 1) {</BUG>
String[] splittedFirst = splitText(font, fontSize, allowedWidth, breakSplitted.get(0));
StringBuilder remaining = new StringBuilder(splittedFirst[1] == null ? "" : splittedFirst[1] + "\n");
| list.add(text.length());
return list;
}
public static String[] splitText(PDFont font, int fontSize, float allowedWidth, String text) {
String endPart = "";
List<String> breakSplitted = Arrays.asList(text.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList());
if (breakSplitted.size() > 1) {
String[] splittedFirst = splitText(font, fontSize, allowedWidth, breakSplitted.get(0));
StringBuilder remaining = new StringBuilder(splittedFirst[1] == null ? "" : splittedFirst[1] + "\n");
|
193,260 | StringBuilder remaining = new StringBuilder(splittedFirst[1] == null ? "" : splittedFirst[1] + "\n");
breakSplitted.stream().skip(1).forEach(s -> remaining.append(s + "\n"));
remaining.deleteCharAt(remaining.length() - 1);
return new String[]{splittedFirst[0], remaining.toString()};
}
<BUG>if (getTextWidth(font, fontSize, shortenedText) <= allowedWidth && shortenedText.indexOf((char) 13) == -1) {
return new String[]{shortenedText, null};
}</BUG>
boolean cleanSplit = true;
<BUG>List<Integer> indexes = getWrapableIndexes(shortenedText);
int start = 0;</BUG>
int j = indexes.size() - 1;
| StringBuilder remaining = new StringBuilder(splittedFirst[1] == null ? "" : splittedFirst[1] + "\n");
breakSplitted.stream().skip(1).forEach(s -> remaining.append(s + "\n"));
remaining.deleteCharAt(remaining.length() - 1);
return new String[]{splittedFirst[0], remaining.toString()};
}
if (getTextWidth(font, fontSize, text) <= allowedWidth && text.indexOf((char) 13) == -1) {
return new String[]{text, null};
}
boolean cleanSplit = true;
List<Integer> indexes = getWrapableIndexes(text);
int start = 0;
int j = indexes.size() - 1;
|
193,261 | boolean cleanSplit = true;
<BUG>List<Integer> indexes = getWrapableIndexes(shortenedText);
int start = 0;</BUG>
int j = indexes.size() - 1;
int end = indexes.get(j);
<BUG>int lineBreakPos = shortenedText.indexOf(10);
if (lineBreakPos != -1 && getTextWidth(font, fontSize, shortenedText.substring(start, lineBreakPos)) <= allowedWidth) {
end = lineBreakPos;</BUG>
} else {
<BUG>while (getTextWidth(font, fontSize, shortenedText.substring(start, end)) > allowedWidth) {
if (j == 0) {</BUG>
cleanSplit = false;
| boolean cleanSplit = true;
List<Integer> indexes = getWrapableIndexes(text);
int start = 0;
int j = indexes.size() - 1;
int end = indexes.get(j);
int lineBreakPos = text.indexOf(10);
if (lineBreakPos != -1 && getTextWidth(font, fontSize, text.substring(start, lineBreakPos)) <= allowedWidth) {
end = lineBreakPos;
} else {
while (getTextWidth(font, fontSize, text.substring(start, end)) > allowedWidth) {
if (j == 0) {
cleanSplit = false;
|
193,262 | @SideOnly(Side.CLIENT)
public class GuiSeedAnalyzer extends GuiContainer {
public static final ResourceLocation texture = new ResourceLocation(Reference.MOD_ID, "textures/gui/GuiSeedAnalyzer.png");
public TileEntitySeedAnalyzer seedAnalyzer;
private boolean journalOpen;
<BUG>private GuiJournal guiJournal;
</BUG>
public GuiSeedAnalyzer(InventoryPlayer inventory, TileEntitySeedAnalyzer seedAnalyzer) {
super(new ContainerSeedAnalyzer(inventory, seedAnalyzer));
this.seedAnalyzer = seedAnalyzer;
| @SideOnly(Side.CLIENT)
public class GuiSeedAnalyzer extends GuiContainer {
public static final ResourceLocation texture = new ResourceLocation(Reference.MOD_ID, "textures/gui/GuiSeedAnalyzer.png");
public TileEntitySeedAnalyzer seedAnalyzer;
private boolean journalOpen;
private AgriGuiWrapper guiJournal;
public GuiSeedAnalyzer(InventoryPlayer inventory, TileEntitySeedAnalyzer seedAnalyzer) {
super(new ContainerSeedAnalyzer(inventory, seedAnalyzer));
this.seedAnalyzer = seedAnalyzer;
|
193,263 | return;
}
ItemStack journal = seedAnalyzer.getStackInSlot(ContainerSeedAnalyzer.journalSlotId);
if(journal != null) {
journalOpen = true;
<BUG>guiJournal = new GuiJournal(journal);
</BUG>
guiJournal.setWorldAndResolution(this.mc, this.width, this.height);
}
}
| return;
}
ItemStack journal = seedAnalyzer.getStackInSlot(ContainerSeedAnalyzer.journalSlotId);
if(journal != null) {
journalOpen = true;
guiJournal = new AgriGuiWrapper(new GuiJournal(journal));
guiJournal.setWorldAndResolution(this.mc, this.width, this.height);
}
}
|
193,264 | package org.jetbrains.jet.di;
import com.intellij.openapi.project.Project;
import org.jetbrains.jet.context.GlobalContext;
import org.jetbrains.jet.storage.StorageManager;
import org.jetbrains.jet.lang.resolve.BindingTrace;
<BUG>import org.jetbrains.jet.lang.descriptors.ModuleDescriptorImpl;
import org.jetbrains.jet.lang.PlatformToKotlinClassMap;
import org.jetbrains.jet.lang.resolve.TopDownAnalyzer;
import org.jetbrains.jet.lang.resolve.MutablePackageFragmentProvider;</BUG>
import org.jetbrains.jet.lang.types.DependencyClassByQualifiedNameResolverDummyImpl;
| package org.jetbrains.jet.di;
import com.intellij.openapi.project.Project;
import org.jetbrains.jet.context.GlobalContext;
import org.jetbrains.jet.storage.StorageManager;
import org.jetbrains.jet.lang.resolve.BindingTrace;
import org.jetbrains.jet.lang.descriptors.ModuleDescriptor;
import org.jetbrains.jet.lang.PlatformToKotlinClassMap;
import org.jetbrains.jet.lang.resolve.TopDownAnalyzer;
import org.jetbrains.jet.lang.resolve.LazyTopDownAnalyzer;
import org.jetbrains.jet.lang.resolve.MutablePackageFragmentProvider;
import org.jetbrains.jet.lang.types.DependencyClassByQualifiedNameResolverDummyImpl;
|
193,265 | this.globalContext = globalContext;
this.storageManager = globalContext.getStorageManager();
this.bindingTrace = bindingTrace;
this.moduleDescriptor = moduleDescriptor;
this.platformToKotlinClassMap = moduleDescriptor.getPlatformToKotlinClassMap();
<BUG>this.topDownAnalyzer = new TopDownAnalyzer();
this.mutablePackageFragmentProvider = new MutablePackageFragmentProvider(getModuleDescriptor());</BUG>
this.dependencyClassByQualifiedNameResolverDummy = new DependencyClassByQualifiedNameResolverDummyImpl();
this.bodyResolver = new BodyResolver();
this.annotationResolver = new AnnotationResolver();
| this.globalContext = globalContext;
this.storageManager = globalContext.getStorageManager();
this.bindingTrace = bindingTrace;
this.moduleDescriptor = moduleDescriptor;
this.platformToKotlinClassMap = moduleDescriptor.getPlatformToKotlinClassMap();
this.topDownAnalyzer = new TopDownAnalyzer();
this.lazyTopDownAnalyzer = new LazyTopDownAnalyzer();
this.mutablePackageFragmentProvider = new MutablePackageFragmentProvider(getModuleDescriptor());
this.dependencyClassByQualifiedNameResolverDummy = new DependencyClassByQualifiedNameResolverDummyImpl();
this.bodyResolver = new BodyResolver();
this.annotationResolver = new AnnotationResolver();
|
193,266 | jetImportsFactory.setProject(project);
scriptHeaderResolver.setPackageFragmentProvider(mutablePackageFragmentProvider);
scriptHeaderResolver.setScriptParameterResolver(scriptParameterResolver);
scriptHeaderResolver.setTrace(bindingTrace);
scriptParameterResolver.setDependencyClassByQualifiedNameResolver(dependencyClassByQualifiedNameResolverDummy);
<BUG>lazyTopDownAnalyzer.setBodyResolver(bodyResolver);
lazyTopDownAnalyzer.setDeclarationResolver(declarationResolver);
lazyTopDownAnalyzer.setModuleDescriptor(moduleDescriptor);
lazyTopDownAnalyzer.setOverloadResolver(overloadResolver);
lazyTopDownAnalyzer.setOverrideResolver(overrideResolver);
lazyTopDownAnalyzer.setTrace(bindingTrace);</BUG>
overloadResolver.setTrace(bindingTrace);
| jetImportsFactory.setProject(project);
scriptHeaderResolver.setPackageFragmentProvider(mutablePackageFragmentProvider);
scriptHeaderResolver.setScriptParameterResolver(scriptParameterResolver);
scriptHeaderResolver.setTrace(bindingTrace);
scriptParameterResolver.setDependencyClassByQualifiedNameResolver(dependencyClassByQualifiedNameResolverDummy);
overloadResolver.setTrace(bindingTrace);
|
193,267 | package org.jetbrains.jet.di;
import com.intellij.openapi.project.Project;
import org.jetbrains.jet.context.GlobalContext;
import org.jetbrains.jet.storage.StorageManager;
import org.jetbrains.jet.lang.resolve.BindingTrace;
<BUG>import org.jetbrains.jet.lang.descriptors.ModuleDescriptorImpl;
import org.jetbrains.jet.lang.PlatformToKotlinClassMap;
import org.jetbrains.jet.lang.resolve.TopDownAnalyzer;
import org.jetbrains.jet.lang.resolve.MutablePackageFragmentProvider;</BUG>
import org.jetbrains.jet.descriptors.serialization.descriptors.MemberFilter;
| package org.jetbrains.jet.di;
import com.intellij.openapi.project.Project;
import org.jetbrains.jet.context.GlobalContext;
import org.jetbrains.jet.storage.StorageManager;
import org.jetbrains.jet.lang.resolve.BindingTrace;
import org.jetbrains.jet.lang.descriptors.ModuleDescriptor;
import org.jetbrains.jet.lang.PlatformToKotlinClassMap;
import org.jetbrains.jet.lang.resolve.TopDownAnalyzer;
import org.jetbrains.jet.lang.resolve.LazyTopDownAnalyzer;
import org.jetbrains.jet.lang.resolve.MutablePackageFragmentProvider;
import org.jetbrains.jet.descriptors.serialization.descriptors.MemberFilter;
|
193,268 | this.globalContext = globalContext;
this.storageManager = globalContext.getStorageManager();
this.bindingTrace = bindingTrace;
this.moduleDescriptor = moduleDescriptor;
this.platformToKotlinClassMap = moduleDescriptor.getPlatformToKotlinClassMap();
<BUG>this.topDownAnalyzer = new TopDownAnalyzer();
this.mutablePackageFragmentProvider = new MutablePackageFragmentProvider(getModuleDescriptor());</BUG>
this.memberFilter = memberFilter;
this.javaClassFinder = new JavaClassFinderImpl();
this.virtualFileFinder = org.jetbrains.jet.lang.resolve.kotlin.VirtualFileFinder.SERVICE.getInstance(project);
| this.globalContext = globalContext;
this.storageManager = globalContext.getStorageManager();
this.bindingTrace = bindingTrace;
this.moduleDescriptor = moduleDescriptor;
this.platformToKotlinClassMap = moduleDescriptor.getPlatformToKotlinClassMap();
this.topDownAnalyzer = new TopDownAnalyzer();
this.lazyTopDownAnalyzer = new LazyTopDownAnalyzer();
this.mutablePackageFragmentProvider = new MutablePackageFragmentProvider(getModuleDescriptor());
this.memberFilter = memberFilter;
this.javaClassFinder = new JavaClassFinderImpl();
this.virtualFileFinder = org.jetbrains.jet.lang.resolve.kotlin.VirtualFileFinder.SERVICE.getInstance(project);
|
193,269 | jetImportsFactory.setProject(project);
scriptHeaderResolver.setPackageFragmentProvider(mutablePackageFragmentProvider);
scriptHeaderResolver.setScriptParameterResolver(scriptParameterResolver);
scriptHeaderResolver.setTrace(bindingTrace);
scriptParameterResolver.setDependencyClassByQualifiedNameResolver(javaDescriptorResolver);
<BUG>lazyTopDownAnalyzer.setBodyResolver(bodyResolver);
lazyTopDownAnalyzer.setDeclarationResolver(declarationResolver);
lazyTopDownAnalyzer.setModuleDescriptor(moduleDescriptor);
lazyTopDownAnalyzer.setOverloadResolver(overloadResolver);
lazyTopDownAnalyzer.setOverrideResolver(overrideResolver);
lazyTopDownAnalyzer.setTrace(bindingTrace);</BUG>
overloadResolver.setTrace(bindingTrace);
| jetImportsFactory.setProject(project);
scriptHeaderResolver.setPackageFragmentProvider(mutablePackageFragmentProvider);
scriptHeaderResolver.setScriptParameterResolver(scriptParameterResolver);
scriptHeaderResolver.setTrace(bindingTrace);
scriptParameterResolver.setDependencyClassByQualifiedNameResolver(javaDescriptorResolver);
overloadResolver.setTrace(bindingTrace);
|
193,270 | package org.jetbrains.jet.di;
import com.intellij.openapi.project.Project;
import org.jetbrains.jet.context.GlobalContext;
import org.jetbrains.jet.storage.StorageManager;
import org.jetbrains.jet.lang.resolve.BindingTrace;
<BUG>import org.jetbrains.jet.lang.descriptors.ModuleDescriptorImpl;
import org.jetbrains.jet.lang.PlatformToKotlinClassMap;
import org.jetbrains.jet.lang.resolve.TopDownAnalyzer;
import org.jetbrains.jet.lang.resolve.MutablePackageFragmentProvider;</BUG>
import org.jetbrains.jet.lang.types.DependencyClassByQualifiedNameResolverDummyImpl;
| package org.jetbrains.jet.di;
import com.intellij.openapi.project.Project;
import org.jetbrains.jet.context.GlobalContext;
import org.jetbrains.jet.storage.StorageManager;
import org.jetbrains.jet.lang.resolve.BindingTrace;
import org.jetbrains.jet.lang.descriptors.ModuleDescriptor;
import org.jetbrains.jet.lang.PlatformToKotlinClassMap;
import org.jetbrains.jet.lang.resolve.TopDownAnalyzer;
import org.jetbrains.jet.lang.resolve.LazyTopDownAnalyzer;
import org.jetbrains.jet.lang.resolve.MutablePackageFragmentProvider;
import org.jetbrains.jet.lang.types.DependencyClassByQualifiedNameResolverDummyImpl;
|
193,271 | this.globalContext = globalContext;
this.storageManager = globalContext.getStorageManager();
this.bindingTrace = bindingTrace;
this.moduleDescriptor = moduleDescriptor;
this.platformToKotlinClassMap = moduleDescriptor.getPlatformToKotlinClassMap();
<BUG>this.topDownAnalyzer = new TopDownAnalyzer();
this.mutablePackageFragmentProvider = new MutablePackageFragmentProvider(getModuleDescriptor());</BUG>
this.dependencyClassByQualifiedNameResolverDummy = new DependencyClassByQualifiedNameResolverDummyImpl();
this.bodyResolver = new BodyResolver();
this.annotationResolver = new AnnotationResolver();
| this.globalContext = globalContext;
this.storageManager = globalContext.getStorageManager();
this.bindingTrace = bindingTrace;
this.moduleDescriptor = moduleDescriptor;
this.platformToKotlinClassMap = moduleDescriptor.getPlatformToKotlinClassMap();
this.topDownAnalyzer = new TopDownAnalyzer();
this.lazyTopDownAnalyzer = new LazyTopDownAnalyzer();
this.mutablePackageFragmentProvider = new MutablePackageFragmentProvider(getModuleDescriptor());
this.dependencyClassByQualifiedNameResolverDummy = new DependencyClassByQualifiedNameResolverDummyImpl();
this.bodyResolver = new BodyResolver();
this.annotationResolver = new AnnotationResolver();
|
193,272 | jetImportsFactory.setProject(project);
scriptHeaderResolver.setPackageFragmentProvider(mutablePackageFragmentProvider);
scriptHeaderResolver.setScriptParameterResolver(scriptParameterResolver);
scriptHeaderResolver.setTrace(bindingTrace);
scriptParameterResolver.setDependencyClassByQualifiedNameResolver(dependencyClassByQualifiedNameResolverDummy);
<BUG>lazyTopDownAnalyzer.setBodyResolver(bodyResolver);
lazyTopDownAnalyzer.setDeclarationResolver(declarationResolver);
lazyTopDownAnalyzer.setModuleDescriptor(moduleDescriptor);
lazyTopDownAnalyzer.setOverloadResolver(overloadResolver);
lazyTopDownAnalyzer.setOverrideResolver(overrideResolver);
lazyTopDownAnalyzer.setTrace(bindingTrace);</BUG>
overloadResolver.setTrace(bindingTrace);
| jetImportsFactory.setProject(project);
scriptHeaderResolver.setPackageFragmentProvider(mutablePackageFragmentProvider);
scriptHeaderResolver.setScriptParameterResolver(scriptParameterResolver);
scriptHeaderResolver.setTrace(bindingTrace);
scriptParameterResolver.setDependencyClassByQualifiedNameResolver(dependencyClassByQualifiedNameResolverDummy);
overloadResolver.setTrace(bindingTrace);
|
193,273 | import java.net.URI;
import java.util.Calendar;
import java.util.Date;
import java.util.Formatter;
import java.util.List;
<BUG>import javax.ws.rs.core.UriBuilder;
import org.apache.commons.httpclient.URIException;
import org.apache.commons.httpclient.util.URIUtil;</BUG>
import org.suigeneris.jrcs.rcs.Version;
import org.xwiki.rest.Relations;
| import java.net.URI;
import java.util.Calendar;
import java.util.Date;
import java.util.Formatter;
import java.util.List;
import org.suigeneris.jrcs.rcs.Version;
import org.xwiki.rest.Relations;
|
193,274 | if (home != null) {
space.setHome(home.getPrefixedFullName());
space.setXwikiRelativeUrl(home.getURL("view"));
space.setXwikiAbsoluteUrl(home.getExternalURL("view"));
}
<BUG>String pagesUri = UriBuilder.fromUri(baseUri).path(PagesResource.class).build(wikiName, spaceName).toString();
</BUG>
Link pagesLink = objectFactory.createLink();
pagesLink.setHref(pagesUri);
pagesLink.setRel(Relations.PAGES);
| if (home != null) {
space.setHome(home.getPrefixedFullName());
space.setXwikiRelativeUrl(home.getURL("view"));
space.setXwikiAbsoluteUrl(home.getExternalURL("view"));
}
String pagesUri = uri(baseUri, PagesResource.class, wikiName, spaceName);
Link pagesLink = objectFactory.createLink();
pagesLink.setHref(pagesUri);
pagesLink.setRel(Relations.PAGES);
|
193,275 | Link pagesLink = objectFactory.createLink();
pagesLink.setHref(pagesUri);
pagesLink.setRel(Relations.PAGES);
space.getLinks().add(pagesLink);
if (home != null) {
<BUG>String homeUri =
UriBuilder.fromUri(baseUri).path(PageResource.class).build(wikiName, spaceName, home.getName())
.toString();</BUG>
Link homeLink = objectFactory.createLink();
| Link pagesLink = objectFactory.createLink();
pagesLink.setHref(pagesUri);
pagesLink.setRel(Relations.PAGES);
space.getLinks().add(pagesLink);
if (home != null) {
String homeUri = uri(baseUri, PageResource.class, wikiName, spaceName, home.getName());
Link homeLink = objectFactory.createLink();
|
193,276 | .toString();</BUG>
Link homeLink = objectFactory.createLink();
homeLink.setHref(homeUri);
homeLink.setRel(Relations.HOME);
space.getLinks().add(homeLink);
<BUG>}
String searchUri =
UriBuilder.fromUri(baseUri).path(SpaceSearchResource.class).build(wikiName, spaceName).toString();</BUG>
Link searchLink = objectFactory.createLink();
searchLink.setHref(searchUri);
| Link pagesLink = objectFactory.createLink();
pagesLink.setHref(pagesUri);
pagesLink.setRel(Relations.PAGES);
space.getLinks().add(pagesLink);
if (home != null) {
String homeUri = uri(baseUri, PageResource.class, wikiName, spaceName, home.getName());
Link homeLink = objectFactory.createLink();
homeLink.setHref(homeUri);
homeLink.setRel(Relations.HOME);
space.getLinks().add(homeLink);
}
String searchUri = uri(baseUri, SpaceSearchResource.class, wikiName, spaceName);
Link searchLink = objectFactory.createLink();
searchLink.setHref(searchUri);
|
193,277 | if (!languages.isEmpty()) {
if (!doc.getDefaultLanguage().equals("")) {
translations.setDefault(doc.getDefaultLanguage());
Translation translation = objectFactory.createTranslation();
translation.setLanguage(doc.getDefaultLanguage());
<BUG>String pageTranslationUri =
UriBuilder.fromUri(baseUri).path(PageResource.class)
.build(doc.getWiki(), doc.getSpace(), doc.getName()).toString();</BUG>
Link pageTranslationLink = objectFactory.createLink();
pageTranslationLink.setHref(pageTranslationUri);
| if (!languages.isEmpty()) {
if (!doc.getDefaultLanguage().equals("")) {
translations.setDefault(doc.getDefaultLanguage());
Translation translation = objectFactory.createTranslation();
translation.setLanguage(doc.getDefaultLanguage());
String pageTranslationUri =
uri(baseUri, PageResource.class, doc.getWiki(), doc.getSpace(), doc.getName());
Link pageTranslationLink = objectFactory.createLink();
pageTranslationLink.setHref(pageTranslationUri);
|
193,278 | }
}
for (String language : languages) {
Translation translation = objectFactory.createTranslation();
translation.setLanguage(language);
<BUG>String pageTranslationUri =
UriBuilder.fromUri(baseUri).path(PageTranslationResource.class)
.build(doc.getWiki(), doc.getSpace(), doc.getName(), language).toString();</BUG>
Link pageTranslationLink = objectFactory.createLink();
pageTranslationLink.setHref(pageTranslationUri);
| }
}
for (String language : languages) {
Translation translation = objectFactory.createTranslation();
translation.setLanguage(language);
String pageTranslationUri =
uri(baseUri, PageTranslationResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), language);
Link pageTranslationLink = objectFactory.createLink();
pageTranslationLink.setHref(pageTranslationUri);
|
193,279 | Link pageTranslationLink = objectFactory.createLink();
pageTranslationLink.setHref(pageTranslationUri);
pageTranslationLink.setRel(Relations.PAGE);
translation.getLinks().add(pageTranslationLink);
String historyUri =
<BUG>UriBuilder.fromUri(baseUri).path(PageTranslationHistoryResource.class)
.build(doc.getWiki(), doc.getSpace(), doc.getName(), language).toString();
Link historyLink = objectFactory.createLink();</BUG>
historyLink.setHref(historyUri);
historyLink.setRel(Relations.HISTORY);
| Link pageTranslationLink = objectFactory.createLink();
pageTranslationLink.setHref(pageTranslationUri);
pageTranslationLink.setRel(Relations.PAGE);
translation.getLinks().add(pageTranslationLink);
String historyUri =
uri(baseUri, PageTranslationHistoryResource.class, doc.getWiki(), doc.getSpace(), doc.getName(),
language);
Link historyLink = objectFactory.createLink();
historyLink.setHref(historyUri);
historyLink.setRel(Relations.HISTORY);
|
193,280 | pageSummary.setParent(doc.getParent());
if (parent != null && !parent.isNew()) {
pageSummary.setParentId(parent.getPrefixedFullName());
} else {
pageSummary.setParentId("");
<BUG>}
String spaceUri =
UriBuilder.fromUri(baseUri).path(SpaceResource.class).build(doc.getWiki(), doc.getSpace()).toString();</BUG>
Link spaceLink = objectFactory.createLink();
spaceLink.setHref(spaceUri);
| pageSummary.setParent(doc.getParent());
if (parent != null && !parent.isNew()) {
pageSummary.setParentId(parent.getPrefixedFullName());
} else {
pageSummary.setParentId("");
}
String spaceUri = uri(baseUri, SpaceResource.class, doc.getWiki(), doc.getSpace());
Link spaceLink = objectFactory.createLink();
spaceLink.setHref(spaceUri);
|
193,281 | UriBuilder.fromUri(baseUri).path(SpaceResource.class).build(doc.getWiki(), doc.getSpace()).toString();</BUG>
Link spaceLink = objectFactory.createLink();
spaceLink.setHref(spaceUri);
spaceLink.setRel(Relations.SPACE);
pageSummary.getLinks().add(spaceLink);
<BUG>if (parent != null) {
String parentUri =
UriBuilder.fromUri(baseUri).path(PageResource.class)
.build(parent.getWiki(), parent.getSpace(), parent.getName()).toString();</BUG>
Link parentLink = objectFactory.createLink();
| pageSummary.setParent(doc.getParent());
if (parent != null && !parent.isNew()) {
pageSummary.setParentId(parent.getPrefixedFullName());
} else {
pageSummary.setParentId("");
}
String spaceUri = uri(baseUri, SpaceResource.class, doc.getWiki(), doc.getSpace());
Link spaceLink = objectFactory.createLink();
spaceLink.setHref(spaceUri);
spaceLink.setRel(Relations.SPACE);
pageSummary.getLinks().add(spaceLink);
if (parent != null) {
String parentUri = uri(baseUri, PageResource.class, parent.getWiki(), parent.getSpace(), parent.getName());
Link parentLink = objectFactory.createLink();
|
193,282 | Link historyLink = objectFactory.createLink();
historyLink.setHref(historyUri);
historyLink.setRel(Relations.HISTORY);
pageSummary.getLinks().add(historyLink);
if (!doc.getChildren().isEmpty()) {
<BUG>String pageChildrenUri =
UriBuilder.fromUri(baseUri).path(PageChildrenResource.class)
.build(doc.getWiki(), doc.getSpace(), doc.getName()).toString();</BUG>
Link pageChildrenLink = objectFactory.createLink();
pageChildrenLink.setHref(pageChildrenUri);
| Link historyLink = objectFactory.createLink();
historyLink.setHref(historyUri);
historyLink.setRel(Relations.HISTORY);
pageSummary.getLinks().add(historyLink);
if (!doc.getChildren().isEmpty()) {
String pageChildrenUri =
uri(baseUri, PageChildrenResource.class, doc.getWiki(), doc.getSpace(), doc.getName());
Link pageChildrenLink = objectFactory.createLink();
pageChildrenLink.setHref(pageChildrenUri);
|
193,283 | objectsLink.setRel(Relations.OBJECTS);
pageSummary.getLinks().add(objectsLink);
}
com.xpn.xwiki.api.Object tagsObject = doc.getObject("XWiki.TagClass", 0);
if (tagsObject != null) {
<BUG>if (tagsObject.getProperty("tags") != null) {
String tagsUri =
UriBuilder.fromUri(baseUri).path(PageTagsResource.class)
.build(doc.getWiki(), doc.getSpace(), doc.getName()).toString();</BUG>
Link tagsLink = objectFactory.createLink();
| objectsLink.setRel(Relations.OBJECTS);
pageSummary.getLinks().add(objectsLink);
}
com.xpn.xwiki.api.Object tagsObject = doc.getObject("XWiki.TagClass", 0);
if (tagsObject != null) {
if (tagsObject.getProperty("tags") != null) {
String tagsUri = uri(baseUri, PageTagsResource.class, doc.getWiki(), doc.getSpace(), doc.getName());
Link tagsLink = objectFactory.createLink();
|
193,284 | tagsLink.setHref(tagsUri);
tagsLink.setRel(Relations.TAGS);
pageSummary.getLinks().add(tagsLink);
}
}
<BUG>String syntaxesUri = UriBuilder.fromUri(baseUri).path(SyntaxesResource.class).build().toString();
Link syntaxesLink = objectFactory.createLink();</BUG>
syntaxesLink.setHref(syntaxesUri);
syntaxesLink.setRel(Relations.SYNTAXES);
pageSummary.getLinks().add(syntaxesLink);
| tagsLink.setHref(tagsUri);
tagsLink.setRel(Relations.TAGS);
pageSummary.getLinks().add(tagsLink);
}
}
String syntaxesUri = uri(baseUri, SyntaxesResource.class);
Link syntaxesLink = objectFactory.createLink();
syntaxesLink.setHref(syntaxesUri);
syntaxesLink.setRel(Relations.SYNTAXES);
pageSummary.getLinks().add(syntaxesLink);
|
193,285 | }
return historySummary;
}
private static void fillAttachment(Attachment attachment, ObjectFactory objectFactory, URI baseUri,
<BUG>com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl,
XWiki xwikiApi, Boolean withPrettyNames)
{</BUG>
Document doc = xwikiAttachment.getDocument();
attachment.setId(String.format("%s@%s", doc.getPrefixedFullName(), xwikiAttachment.getFilename()));
| }
return historySummary;
}
private static void fillAttachment(Attachment attachment, ObjectFactory objectFactory, URI baseUri,
com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi,
Boolean withPrettyNames)
{
Document doc = xwikiAttachment.getDocument();
attachment.setId(String.format("%s@%s", doc.getPrefixedFullName(), xwikiAttachment.getFilename()));
|
193,286 | Calendar calendar = Calendar.getInstance();
calendar.setTime(xwikiAttachment.getDate());
attachment.setDate(calendar);
attachment.setXwikiRelativeUrl(xwikiRelativeUrl);
attachment.setXwikiAbsoluteUrl(xwikiAbsoluteUrl);
<BUG>String pageUri =
UriBuilder.fromUri(baseUri).path(PageResource.class).build(doc.getWiki(), doc.getSpace(), doc.getName())
.toString();</BUG>
Link pageLink = objectFactory.createLink();
| Calendar calendar = Calendar.getInstance();
calendar.setTime(xwikiAttachment.getDate());
attachment.setDate(calendar);
attachment.setXwikiRelativeUrl(xwikiRelativeUrl);
attachment.setXwikiAbsoluteUrl(xwikiAbsoluteUrl);
String pageUri = uri(baseUri, PageResource.class, doc.getWiki(), doc.getSpace(), doc.getName());
Link pageLink = objectFactory.createLink();
|
193,287 | }
return attachmentUri;
}</BUG>
public static Attachment createAttachment(ObjectFactory objectFactory, URI baseUri,
<BUG>com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl,
XWiki xwikiApi, Boolean withPrettyNames)
{</BUG>
Attachment attachment = objectFactory.createAttachment();
fillAttachment(attachment, objectFactory, baseUri, xwikiAttachment, xwikiRelativeUrl, xwikiAbsoluteUrl,
| }
public static Attachment createAttachment(ObjectFactory objectFactory, URI baseUri,
com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi,
Boolean withPrettyNames)
{
Attachment attachment = objectFactory.createAttachment();
fillAttachment(attachment, objectFactory, baseUri, xwikiAttachment, xwikiRelativeUrl, xwikiAbsoluteUrl,
|
193,288 | attachmentLink.setRel(Relations.ATTACHMENT_DATA);
attachment.getLinks().add(attachmentLink);
return attachment;
}
public static Attachment createAttachmentAtVersion(ObjectFactory objectFactory, URI baseUri,
<BUG>com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl,
XWiki xwikiApi, Boolean withPrettyNames)
{</BUG>
Attachment attachment = new Attachment();
| attachmentLink.setRel(Relations.ATTACHMENT_DATA);
attachment.getLinks().add(attachmentLink);
return attachment;
}
public static Attachment createAttachmentAtVersion(ObjectFactory objectFactory, URI baseUri,
com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi,
Boolean withPrettyNames)
{
Attachment attachment = new Attachment();
|
193,289 | .build(doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(),
xwikiObject.getClassName(),
xwikiObject.getNumber()).toString();</BUG>
} else {
<BUG>propertiesUri =
UriBuilder
.fromUri(baseUri)
.path(ObjectPropertiesResource.class)
.build(doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(),
xwikiObject.getNumber()).toString();</BUG>
}
| fillObjectSummary(objectSummary, objectFactory, baseUri, doc, xwikiObject, xwikiApi, withPrettyNames);
Link objectLink = getObjectLink(objectFactory, baseUri, doc, xwikiObject, useVersion, Relations.OBJECT);
objectSummary.getLinks().add(objectLink);
String propertiesUri;
if (useVersion) {
propertiesUri =
uri(baseUri, ObjectPropertiesAtPageVersionResource.class, doc.getWiki(), doc.getSpace(), doc.getName(),
doc.getVersion(), xwikiObject.getClassName(), xwikiObject.getNumber());
} else {
propertiesUri =
uri(baseUri, ObjectPropertiesResource.class, doc.getWiki(), doc.getSpace(), doc.getName(),
xwikiObject.getClassName(), xwikiObject.getNumber());
}
|
193,290 | .build(doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(),
xwikiObject.getClassName(), xwikiObject.getNumber(), propertyClass.getName())
.toString();</BUG>
} else {
<BUG>propertyUri =
UriBuilder
.fromUri(baseUri)
.path(ObjectPropertyResource.class)
.build(doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(),
xwikiObject.getNumber(), propertyClass.getName()).toString();</BUG>
}
| } else {
propertiesUri =
uri(baseUri, ObjectPropertiesResource.class, doc.getWiki(), doc.getSpace(), doc.getName(),
xwikiObject.getClassName(), xwikiObject.getNumber());
}
|
193,291 | .build(doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(),
xwikiObject.getClassName(),
xwikiObject.getNumber()).toString();</BUG>
} else {
<BUG>objectUri =
UriBuilder
.fromUri(baseUri)
.path(ObjectResource.class)
.build(doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(),
xwikiObject.getNumber()).toString();</BUG>
}
| private static Link getObjectLink(ObjectFactory objectFactory, URI baseUri, Document doc, BaseObject xwikiObject,
boolean useVersion, String relation)
{
String objectUri;
if (useVersion) {
objectUri =
uri(baseUri, ObjectAtPageVersionResource.class, doc.getWiki(), doc.getSpace(), doc.getName(),
doc.getVersion(), xwikiObject.getClassName(), xwikiObject.getNumber());
} else {
objectUri =
uri(baseUri, ObjectResource.class, doc.getWiki(), doc.getSpace(), doc.getName(),
xwikiObject.getClassName(), xwikiObject.getNumber());
}
|
193,292 | Link propertyLink = objectFactory.createLink();
propertyLink.setHref(propertyUri);
propertyLink.setRel(Relations.SELF);
property.getLinks().add(propertyLink);
clazz.getProperties().add(property);
<BUG>}
String classUri =
UriBuilder.fromUri(baseUri).path(ClassResource.class).build(wikiName, xwikiClass.getName()).toString();</BUG>
Link classLink = objectFactory.createLink();
classLink.setHref(classUri);
| Link propertyLink = objectFactory.createLink();
propertyLink.setHref(propertyUri);
propertyLink.setRel(Relations.SELF);
property.getLinks().add(propertyLink);
clazz.getProperties().add(property);
}
String classUri = uri(baseUri, ClassResource.class, wikiName, xwikiClass.getName());
Link classLink = objectFactory.createLink();
classLink.setHref(classUri);
|
193,293 | String classUri =
UriBuilder.fromUri(baseUri).path(ClassResource.class).build(wikiName, xwikiClass.getName()).toString();</BUG>
Link classLink = objectFactory.createLink();
classLink.setHref(classUri);
classLink.setRel(Relations.SELF);
<BUG>clazz.getLinks().add(classLink);
String propertiesUri =
UriBuilder.fromUri(baseUri).path(ClassPropertiesResource.class).build(wikiName, xwikiClass.getName())
.toString();</BUG>
Link propertyLink = objectFactory.createLink();
| Link propertyLink = objectFactory.createLink();
propertyLink.setHref(propertyUri);
propertyLink.setRel(Relations.SELF);
property.getLinks().add(propertyLink);
clazz.getProperties().add(property);
}
String classUri = uri(baseUri, ClassResource.class, wikiName, xwikiClass.getName());
Link classLink = objectFactory.createLink();
classLink.setHref(classUri);
classLink.setRel(Relations.SELF);
clazz.getLinks().add(classLink);
String propertiesUri = uri(baseUri, ClassPropertiesResource.class, wikiName, xwikiClass.getName());
Link propertyLink = objectFactory.createLink();
|
193,294 | <BUG>package org.xwiki.rest.internal;
import org.apache.commons.lang3.StringUtils;</BUG>
import org.xwiki.component.manager.ComponentManager;
import org.xwiki.context.Execution;
import org.xwiki.model.reference.EntityReferenceSerializer;
| package org.xwiki.rest.internal;
import java.net.URI;
import javax.ws.rs.core.UriBuilder;
import org.apache.commons.httpclient.URIException;
import org.apache.commons.httpclient.util.URIUtil;
import org.apache.commons.lang3.StringUtils;
import org.xwiki.component.manager.ComponentManager;
import org.xwiki.context.Execution;
import org.xwiki.model.reference.EntityReferenceSerializer;
|
193,295 | private final Duration maxDelay;
<BUG>private final BundlingFlowController<E> flowController;</BUG>
private final Lock lock = new ReentrantLock();
private final Condition bundleCondition = lock.newCondition();
private Bundle currentOpenBundle;
<BUG>private List<Bundle> closedBundles = new ArrayList<>();
private ThresholdBundler(
ImmutableList<BundlingThreshold<E>> thresholds,
Duration maxDelay,
BundlingFlowController<E> flowController) {</BUG>
this.thresholdPrototypes = copyResetThresholds(Preconditions.checkNotNull(thresholds));
| private final Duration maxDelay;
private final Lock lock = new ReentrantLock();
private final Condition bundleCondition = lock.newCondition();
private Bundle currentOpenBundle;
private List<Bundle> closedBundles = new ArrayList<>();
private ThresholdBundler(ImmutableList<BundlingThreshold<E>> thresholds, Duration maxDelay) {
this.thresholdPrototypes = copyResetThresholds(Preconditions.checkNotNull(thresholds));
|
193,296 | ImmutableList<BundlingThreshold<E>> thresholds,
Duration maxDelay,
BundlingFlowController<E> flowController) {</BUG>
this.thresholdPrototypes = copyResetThresholds(Preconditions.checkNotNull(thresholds));
this.maxDelay = maxDelay;
<BUG>this.flowController = Preconditions.checkNotNull(flowController);</BUG>
this.currentOpenBundle = null;
}
public static final class Builder<E> {
private List<BundlingThreshold<E>> thresholds;
private Duration maxDelay;
<BUG>private BundlingFlowController<E> flowController;</BUG>
private Builder() {
| private final Duration maxDelay;
private final Lock lock = new ReentrantLock();
private final Condition bundleCondition = lock.newCondition();
private Bundle currentOpenBundle;
private List<Bundle> closedBundles = new ArrayList<>();
private ThresholdBundler(ImmutableList<BundlingThreshold<E>> thresholds, Duration maxDelay) {
this.thresholdPrototypes = copyResetThresholds(Preconditions.checkNotNull(thresholds));
this.maxDelay = maxDelay;
this.currentOpenBundle = null;
}
public static final class Builder<E> {
private List<BundlingThreshold<E>> thresholds;
private Duration maxDelay;
private Builder() {
|
193,297 | public static <T> Builder<T> newBuilder() {
return new Builder<T>();
}
<BUG>public void add(E e) throws FlowControlException {
final Lock lock = this.lock;
flowController.reserve(e);</BUG>
lock.lock();
try {
boolean signalBundleIsReady = false;
if (currentOpenBundle == null) {
| public static <T> Builder<T> newBuilder() {
return new Builder<T>();
}
public void add(E e) {
final Lock lock = this.lock;
lock.lock();
try {
boolean signalBundleIsReady = false;
if (currentOpenBundle == null) {
|
193,298 | } else if (currentOpenBundle != null) {
outBundle = currentOpenBundle;
currentOpenBundle = null;
}
if (outBundle != null) {
<BUG>List<E> data = outBundle.getData();
for (E e : data) {
flowController.release(e);
}
outputCollection.addAll(data);
</BUG>
return outputCollection.size();
| } else if (currentOpenBundle != null) {
outBundle = currentOpenBundle;
currentOpenBundle = null;
}
if (outBundle != null) {
outputCollection.addAll(outBundle.getData());
return outputCollection.size();
|
193,299 | package com.google.api.gax.grpc;
<BUG>import com.google.api.gax.bundling.BundlingFlowController;
import com.google.api.gax.bundling.BundlingSettings;</BUG>
import com.google.api.gax.bundling.BundlingThreshold;
import com.google.api.gax.bundling.ElementCounter;
import com.google.api.gax.bundling.NumericThreshold;
| package com.google.api.gax.grpc;
import com.google.api.gax.bundling.BundlingThreshold;
import com.google.api.gax.bundling.ElementCounter;
import com.google.api.gax.bundling.NumericThreshold;
|
193,300 | import com.google.api.gax.bundling.BundlingThreshold;
import com.google.api.gax.bundling.ElementCounter;
import com.google.api.gax.bundling.NumericThreshold;
import com.google.api.gax.bundling.ThresholdBundler;
import com.google.api.gax.bundling.ThresholdBundlingForwarder;
<BUG>import com.google.api.gax.core.FlowControlSettings;
import com.google.api.gax.core.FlowController;
import com.google.api.gax.core.FlowController.LimitExceededBehavior;</BUG>
import com.google.common.collect.ImmutableList;
import java.util.Map;
| import com.google.api.gax.bundling.BundlingThreshold;
import com.google.api.gax.bundling.ElementCounter;
import com.google.api.gax.bundling.NumericThreshold;
import com.google.api.gax.bundling.ThresholdBundler;
import com.google.api.gax.bundling.ThresholdBundlingForwarder;
import com.google.common.collect.ImmutableList;
import java.util.Map;
|