id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
19,001
package com.projecttango.examples.java.augmentedreality; import com.google.atap.tangoservice.Tango; import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoCameraIntrinsics; import com.google.atap.tangoservice.TangoConfig; <BUG>import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoEvent;</BUG> import com.google.atap.tangoservice.TangoOutOfDateException; import com.google.atap.tangoservice.TangoPoseData; import com.google.atap.tangoservice.TangoXyzIjData;
import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
19,002
super.onResume(); if (!mIsConnected) { mTango = new Tango(AugmentedRealityActivity.this, new Runnable() { @Override public void run() { <BUG>try { connectTango();</BUG> setupRenderer(); mIsConnected = true; } catch (TangoOutOfDateException e) {
TangoSupport.initialize(); connectTango();
19,003
if (lastFramePose.statusCode == TangoPoseData.POSE_VALID) { mRenderer.updateRenderCameraPose(lastFramePose, mExtrinsics); mCameraPoseTimestamp = lastFramePose.timestamp;</BUG> } else { <BUG>Log.w(TAG, "Can't get device pose at time: " + mRgbTimestampGlThread); }</BUG> } } } @Override
mRenderer.updateRenderCameraPose(lastFramePose); mCameraPoseTimestamp = lastFramePose.timestamp; Log.w(TAG, "Can't get device pose at time: " +
19,004
import org.rajawali3d.materials.Material; import org.rajawali3d.materials.methods.DiffuseMethod; import org.rajawali3d.materials.textures.ATexture; import org.rajawali3d.materials.textures.StreamingTexture; import org.rajawali3d.materials.textures.Texture; <BUG>import org.rajawali3d.math.Matrix4; import org.rajawali3d.math.vector.Vector3;</BUG> import org.rajawali3d.primitives.ScreenQuad; import org.rajawali3d.primitives.Sphere; import org.rajawali3d.renderer.RajawaliRenderer;
import org.rajawali3d.math.Quaternion; import org.rajawali3d.math.vector.Vector3;
19,005
translationMoon.setRepeatMode(Animation.RepeatMode.INFINITE); translationMoon.setTransformable3D(moon); getCurrentScene().registerAnimation(translationMoon); translationMoon.play(); } <BUG>public void updateRenderCameraPose(TangoPoseData devicePose, DeviceExtrinsics extrinsics) { Pose cameraPose = ScenePoseCalculator.toOpenGlCameraPose(devicePose, extrinsics); getCurrentCamera().setRotation(cameraPose.getOrientation()); getCurrentCamera().setPosition(cameraPose.getPosition()); }</BUG> public int getTextureId() {
public void updateRenderCameraPose(TangoPoseData cameraPose) { float[] rotation = cameraPose.getRotationAsFloats(); float[] translation = cameraPose.getTranslationAsFloats(); Quaternion quaternion = new Quaternion(rotation[3], rotation[0], rotation[1], rotation[2]); getCurrentCamera().setRotation(quaternion.conjugate()); getCurrentCamera().setPosition(translation[0], translation[1], translation[2]);
19,006
package com.projecttango.examples.java.helloareadescription; import com.google.atap.tangoservice.Tango; <BUG>import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoConfig;</BUG> import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
import com.google.atap.tangoservice.TangoAreaDescriptionMetaData; import com.google.atap.tangoservice.TangoConfig;
19,007
public static TextComponent formatMsg(String input, String... args) { TextComponent finalText = new TextComponent(""); ProxiedPlayer player = ProxyServer.getInstance().getPlayer(args[3]); if (player != null) { int count = (input.length() - input.replace("{{ MESSAGE }}", "").length()) / 13; <BUG>TextComponent message = format("{{ MESSAGE }}", player.hasPermission(Permissions.General.MESSAGE_COLOR), player.hasPermission(Permissions.General.MESSAGE_HOVER), player.hasPermission(Permissions.General.MESSAGE_CLICK), args); </BUG> if (input.startsWith("{{ MESSAGE }}")) { count--; finalText.addExtra(message);
TextComponent message = format("{{ MESSAGE }}", Permissions.hasPerm(player, Permissions.General.MESSAGE_COLOR), Permissions.hasPerm(player, Permissions.General.MESSAGE_HOVER), Permissions.hasPerm(player, Permissions.General.MESSAGE_CLICK), args);
19,008
}, annc.getInterval(), TimeUnit.SECONDS); } private void annc(Collection<ProxiedPlayer> players, String anncName, String... msg) { for (String singMsg : msg) { if (!players.isEmpty()) { <BUG>players.stream().filter(p -> p.hasPermission(Permissions.General.ANNOUNCEMENT) || p.hasPermission(Permissions.General.ANNOUNCEMENT + "." + anncName)).forEach(p -> p.sendMessage(Dictionary.format(Dictionary.FORMAT_ALERT, "MESSAGE", singMsg))); </BUG> } ProxyServer.getInstance().getConsole().sendMessage(Dictionary.format(Dictionary.FORMAT_ALERT, "MESSAGE", singMsg)); }
players.stream().filter(p -> Permissions.hasPerm(p, Permissions.General.ANNOUNCEMENT) || Permissions.hasPerm(p, Permissions.General.ANNOUNCEMENT + "." + anncName)).forEach(p -> p.sendMessage(Dictionary.format(Dictionary.FORMAT_ALERT, "MESSAGE", singMsg)));
19,009
super("lookup", Permissions.Admin.LOOKUP); } @Override public void run(CommandSender sender, String[] args) { Set<String> matches = new HashSet<>(); <BUG>if (args.length == 1 && sender.hasPermission(Permissions.Admin.LOOKUP_INFO)) { </BUG> String uuid = null; for (Object nameO : pD.listAllData("lastname")) { String name = (String) nameO;
if (args.length == 1 && Permissions.hasPerm(sender, Permissions.Admin.LOOKUP_INFO)) {
19,010
recipient = p; break; } } } <BUG>if (recipient != null && (!(sender instanceof ProxiedPlayer) || ((ProxiedPlayer) sender).getServer().getInfo() == recipient.getServer().getInfo() || sender.hasPermission(Permissions.General.MESSAGE_GLOBAL))) { </BUG> ProxyServer.getInstance().getPluginManager().callEvent(new MessageEvent(sender, recipient, Dictionary.combine(0, args))); } else { sender.sendMessage(Dictionary.format(Dictionary.ERROR_PLAYER_NOT_FOUND));
if (recipient != null && (!(sender instanceof ProxiedPlayer) || ((ProxiedPlayer) sender).getServer().getInfo() == recipient.getServer().getInfo() || Permissions.hasPerm(sender, Permissions.General.MESSAGE_GLOBAL))) {
19,011
public PlayerData pD = BungeeEssentials.getInstance().getPlayerData(); public BECommand(String name, String permission) { super(BungeeEssentials.getInstance().getMain(name), permission, BungeeEssentials.getInstance().getAlias(name)); } public Iterable<String> tabPlayers(CommandSender sender, String search) { <BUG>return BungeeEssentials.getInstance().getMessenger().getVisiblePlayers(sender.hasPermission(Permissions.Admin.SEE_HIDDEN)).stream().filter(player -> !player.getName().equals(sender.getName()) && player.getName().toLowerCase().startsWith(search.toLowerCase())).map(ProxiedPlayer::getName).collect(Collectors.toSet()); </BUG> } protected Iterable<String> tabStrings(String search, String[] strings) { Set<String> matches = new HashSet<>();
return BungeeEssentials.getInstance().getMessenger().getVisiblePlayers(Permissions.hasPerm(sender, Permissions.Admin.SEE_HIDDEN)).stream().filter(player -> !player.getName().equals(sender.getName()) && player.getName().toLowerCase().startsWith(search.toLowerCase())).map(ProxiedPlayer::getName).collect(Collectors.toSet());
19,012
this.main = main; this.commands = commands; } @Override public void execute(CommandSender sender, String[] args) { <BUG>if (sender.hasPermission(Permissions.General.ALIAS) || sender.hasPermission(Permissions.General.ALIAS + "." + main)) { </BUG> for (String command : commands) { runCommand(command, sender, args); }
if (Permissions.hasPerm(sender, Permissions.General.ALIAS, Permissions.General.ALIAS + "." + main)) {
19,013
} String message = msg; if (isMutedF(player, msg)) { return null; } <BUG>if (!player.hasPermission(Permissions.Admin.BYPASS_FILTER)) { </BUG> if (BungeeEssentials.getInstance().contains(ct.getRule())) { List<RuleManager.MatchResult> results = BungeeEssentials.getInstance().getRuleManager().matches(msg); for (RuleManager.MatchResult result : results) {
public String filter(ProxiedPlayer player, String msg, ChatType ct) { if (msg == null || player == null) { return msg; if (!Permissions.hasPerm(player, Permissions.Admin.BYPASS_FILTER)) {
19,014
return hiddenNum; } boolean isMutedF(ProxiedPlayer player, String msg) { Preconditions.checkNotNull(player, "Invalid player specified"); BungeeEssentials bInst = BungeeEssentials.getInstance(); <BUG>if (!player.hasPermission(Permissions.Admin.MUTE_EXEMPT) && (pD.isMuted(player.getUniqueId().toString()) || (bInst.isIntegrated() && bInst.getIntegrationProvider().isMuted(player)))) { </BUG> player.sendMessage(Dictionary.format(Dictionary.MUTE_ERROR)); ruleNotify(Dictionary.MUTE_ERRORN, player, msg); return true;
if (!Permissions.hasPerm(player, Permissions.Admin.MUTE_EXEMPT) && (pD.isMuted(player.getUniqueId().toString()) || (bInst.isIntegrated() && bInst.getIntegrationProvider().isMuted(player)))) {
19,015
if (event.isCommand()) { if (BungeeEssentials.getInstance().contains("fulllog")) { Log.log(Dictionary.format("[COMMAND] " + Dictionary.FORMAT_CHAT, "PLAYER", sender, "MESSAGE", event.getMessage()).toLegacyText()); } String cmd = event.getMessage().substring(1); <BUG>if (BungeeEssentials.getInstance().contains("spam-command") && !player.hasPermission(Permissions.Admin.BYPASS_FILTER)) { </BUG> if (cmds.get(player.getUniqueId()) != null && cmd.equals(cmds.get(player.getUniqueId())) & cmdLog.containsKey(player.getUniqueId())) { player.sendMessage(Dictionary.format(Dictionary.WARNING_LEVENSHTEIN_DISTANCE)); event.setCancelled(true);
if (BungeeEssentials.getInstance().contains("spam-command") && !Permissions.hasPerm(player, Permissions.Admin.BYPASS_FILTER)) {
19,016
if (cmdLog.containsKey(player.getUniqueId()) && cmdLog.get(player.getUniqueId()).equals(time)) { cmdLog.remove(player.getUniqueId()); } }, 5, TimeUnit.SECONDS); } <BUG>if (!event.isCancelled() && !player.hasPermission(Permissions.Admin.SPY_EXEMPT) && BungeeEssentials.getInstance().contains("commandSpy")) { ProxyServer.getInstance().getPlayers().stream().filter(onlinePlayer -> (onlinePlayer.getUniqueId() != player.getUniqueId()) && (onlinePlayer.hasPermission(Permissions.Admin.SPY_COMMAND)) && pD.isCSpy(onlinePlayer.getUniqueId().toString())).forEach(onlinePlayer -> onlinePlayer.sendMessage(Dictionary.format(Dictionary.CSPY_COMMAND, "SENDER", sender, "COMMAND", event.getMessage()))); </BUG> if (pD.isCSpy("CONSOLE")) {
if (!event.isCancelled() && !Permissions.hasPerm(player, Permissions.Admin.SPY_EXEMPT) && BungeeEssentials.getInstance().contains("commandSpy")) { ProxyServer.getInstance().getPlayers().stream().filter(onlinePlayer -> (onlinePlayer.getUniqueId() != player.getUniqueId()) && (Permissions.hasPerm(onlinePlayer, Permissions.Admin.SPY_COMMAND)) && pD.isCSpy(onlinePlayer.getUniqueId().toString())).forEach(onlinePlayer -> onlinePlayer.sendMessage(Dictionary.format(Dictionary.CSPY_COMMAND, "SENDER", sender, "COMMAND", event.getMessage())));
19,017
</BUG> String server = player.getServer().getInfo().getName(); ProxyServer.getInstance().getPluginManager().callEvent(new StaffChatEvent(server, sender, event.getMessage())); event.setCancelled(true); <BUG>} else if (player.hasPermission(Permissions.General.CHAT) && pD.isGlobalChat(uuid)) { </BUG> String server = player.getServer().getInfo().getName(); ProxyServer.getInstance().getPluginManager().callEvent(new GlobalChatEvent(server, sender, event.getMessage())); event.setCancelled(true); }
int upperC = msg.replaceAll("[^A-Z]", "").length(); if (upperC * 100 / msg.length() >= BungeeEssentials.getInstance().getConfig().getDouble("capspam.percent", 50)) event.setMessage(event.getMessage().toLowerCase()); if (!event.isCancelled() && !event.isCommand()) { if (Permissions.hasPerm(player, Permissions.Admin.CHAT) && pD.isStaffChat(uuid)) { } else if (Permissions.hasPerm(player, Permissions.General.CHAT) && pD.isGlobalChat(uuid)) {
19,018
if (!connections.contains(event.getPlayer().getAddress().getAddress())) { connections.add(event.getPlayer().getAddress().getAddress()); ProxyServer.getInstance().getScheduler().schedule(BungeeEssentials.getInstance(), () -> connections.remove(event.getPlayer().getAddress().getAddress()), 3, TimeUnit.SECONDS); } } <BUG>if (BungeeEssentials.getInstance().contains("joinAnnounce") && !(Dictionary.FORMAT_QUIT.equals("")) && event.getPlayer().hasPermission(Permissions.General.QUITANNC) && !pD.isHidden(event.getPlayer().getUniqueId().toString())) { </BUG> ProxyServer.getInstance().broadcast(Dictionary.format(Dictionary.FORMAT_QUIT, "PLAYER", event.getPlayer().getName())); } if (BungeeEssentials.getInstance().contains("fulllog")) {
if (BungeeEssentials.getInstance().contains("joinAnnounce") && !(Dictionary.FORMAT_QUIT.equals("")) && Permissions.hasPerm(event.getPlayer(), Permissions.General.QUITANNC) && !pD.isHidden(event.getPlayer().getUniqueId().toString())) {
19,019
List<ServerPing.PlayerInfo> staff = new ArrayList<>(); List<ServerPing.PlayerInfo> other = new ArrayList<>(); for (ProxiedPlayer p : mess.getVisiblePlayers(false)) { ServerPing.PlayerInfo info = new ServerPing.PlayerInfo(p.getName(), p.getUniqueId()); if (!friends.contains(info)) { <BUG>if (p.hasPermission(Permissions.Admin.HOVER_LIST)) { </BUG> staff.add(info); } else { other.add(info);
if (Permissions.hasPerm(p, Permissions.Admin.HOVER_LIST)) {
19,020
run(sender, args);</BUG> } else { ProxiedPlayer player = (ProxiedPlayer) sender; String server = player.getServer().getInfo().getName().toLowerCase().replace(" ", "-"); <BUG>if (player.hasPermission(permission + "." + server)) { </BUG> run(sender, args); } else { player.sendMessage(ProxyServer.getInstance().getTranslation("no_permission")); }
super(name, ""); this.permission = permission; @Override public final void execute(CommandSender sender, String[] args) { if (Permissions.hasPerm(sender, permission)) { if (Permissions.hasPerm(player, permission + "." + server)) {
19,021
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.*;
19,022
.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);
19,023
</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) {
19,024
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)
19,025
.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))
19,026
.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))
19,027
@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;
19,028
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; }
19,029
return configDirectory; } public boolean isLoaded() { return loaded; } <BUG>public static Cause getCause() { return instance().pluginCause; }</BUG> public EconomyService getEconomyService() { return economyService;
[DELETED]
19,030
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.*;
19,031
.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))
19,032
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) -> {
19,033
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);
19,034
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);
19,035
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() + "\"");
19,036
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() + "\"");
19,037
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
19,038
.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")
19,039
.setId(user.getId()) .setPhone(user.getPhone()) .setCreateDate(user.getCreateDate()) .setStatus(user.getStatus()) .setLastUpdate(user.getLastUpdate()) <BUG>.setTenancyId(user.getTenancyId() == null ? null : user.getTenancyId().intValue()); return userDto;</BUG> } } public static PermTypeDto convert(PermType pt) {
.setTenancyId(user.getTenancyId()); return userDto;
19,040
} catch (Exception ex) { log.error("username + password login, error :" + ex); throw ex; } } <BUG>Map<String, Object> attributes = new HashMap<String, Object>();attributes.put(CasProtocal.DianRongCas.getTenancyIdName(),response.getData().getTenancyId());return createHandlerResult(credential, this.principalFactory.createPrincipal(userName, attributes), null); </BUG> } @Override
Map<String, Object> attributes = new HashMap<String, Object>(); attributes.put(CasProtocal.DianRongCas.getTenancyIdName(), response.getData().getTenancyId()); return createHandlerResult(credential, this.principalFactory.createPrincipal(userName, attributes), null);
19,041
private DomainMapper domainMapper; @Override protected boolean multiFieldsDuplicateCheck(FilterData... equalsField) { DomainExample condition = new DomainExample(); DomainExample.Criteria criteria = condition.createCriteria(); <BUG>criteria.andStatusEqualTo(AppConstants.STATUS_ENABLED).andTenancyIdEqualTo(AppConstants.TENANCY_UNRELATED_TENANCY_ID); for(FilterData fd: equalsField){</BUG> switch(fd.getType()) { case FIELD_TYPE_ID: criteria.andIdEqualTo(TypeParseUtil.parseToIntegerFromObject(fd.getValue()));
criteria.andStatusEqualTo(AppConstants.STATUS_ENABLED); for(FilterData fd: equalsField){
19,042
throw new InvalidRequestException(String.format("Invalid call to function %s, none of its type signature matches (known type signatures: %s)", name, signatures(factories, receiver))); return candidate; } private static void validateTypes(Function fun, List<? extends AssignementTestable> providedArgs, ColumnSpecification receiver) throws InvalidRequestException { <BUG>if (!receiver.type.equals(fun.returnType())) </BUG> throw new InvalidRequestException(String.format("Type error: cannot assign result of function %s (type %s) to %s (type %s)", fun.name(), fun.returnType().asCQL3Type(), receiver, receiver.type.asCQL3Type())); if (providedArgs.size() != fun.argsType().size()) throw new InvalidRequestException(String.format("Invalid number of arguments in call to function %s: %d required but %d provided", fun.name(), fun.argsType().size(), providedArgs.size()));
if (!receiver.type.asCQL3Type().equals(fun.returnType().asCQL3Type()))
19,043
throw new InvalidRequestException(String.format("Type error: %s cannot be passed as argument %d of function %s of type %s", provided, i, fun.name(), expected.type.asCQL3Type())); } } private static boolean isValidType(Function fun, List<? extends AssignementTestable> providedArgs, ColumnSpecification receiver) { <BUG>if (!receiver.type.equals(fun.returnType())) </BUG> return false; if (providedArgs.size() != fun.argsType().size()) return false;
if (!receiver.type.asCQL3Type().equals(fun.returnType().asCQL3Type()))
19,044
int ttl = rs.ttls[idx]; return ttl > 0 ? ByteBufferUtil.bytes(ttl) : null; } public boolean isAssignableTo(ColumnSpecification receiver) { <BUG>return receiver.type.equals(isWritetime ? LongType.instance : Int32Type.instance); }</BUG> } private static class SelectionWithFunctions extends Selection {
return receiver.type.asCQL3Type().equals(isWritetime ? CQL3Type.Native.BIGINT : CQL3Type.Native.INT);
19,045
package org.apache.cassandra.db.marshal; import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; <BUG>import java.util.List; import org.apache.cassandra.exceptions.ConfigurationException;</BUG> import org.apache.cassandra.exceptions.SyntaxException; public class ReversedType<T> extends AbstractType<T> {
import org.apache.cassandra.cql3.CQL3Type; import org.apache.cassandra.exceptions.ConfigurationException;
19,046
package com.projecttango.examples.java.augmentedreality; import com.google.atap.tangoservice.Tango; import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoCameraIntrinsics; import com.google.atap.tangoservice.TangoConfig; <BUG>import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoEvent;</BUG> import com.google.atap.tangoservice.TangoOutOfDateException; import com.google.atap.tangoservice.TangoPoseData; import com.google.atap.tangoservice.TangoXyzIjData;
import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
19,047
super.onResume(); if (!mIsConnected) { mTango = new Tango(AugmentedRealityActivity.this, new Runnable() { @Override public void run() { <BUG>try { connectTango();</BUG> setupRenderer(); mIsConnected = true; } catch (TangoOutOfDateException e) {
TangoSupport.initialize(); connectTango();
19,048
if (lastFramePose.statusCode == TangoPoseData.POSE_VALID) { mRenderer.updateRenderCameraPose(lastFramePose, mExtrinsics); mCameraPoseTimestamp = lastFramePose.timestamp;</BUG> } else { <BUG>Log.w(TAG, "Can't get device pose at time: " + mRgbTimestampGlThread); }</BUG> } } } @Override
mRenderer.updateRenderCameraPose(lastFramePose); mCameraPoseTimestamp = lastFramePose.timestamp; Log.w(TAG, "Can't get device pose at time: " +
19,049
import org.rajawali3d.materials.Material; import org.rajawali3d.materials.methods.DiffuseMethod; import org.rajawali3d.materials.textures.ATexture; import org.rajawali3d.materials.textures.StreamingTexture; import org.rajawali3d.materials.textures.Texture; <BUG>import org.rajawali3d.math.Matrix4; import org.rajawali3d.math.vector.Vector3;</BUG> import org.rajawali3d.primitives.ScreenQuad; import org.rajawali3d.primitives.Sphere; import org.rajawali3d.renderer.RajawaliRenderer;
import org.rajawali3d.math.Quaternion; import org.rajawali3d.math.vector.Vector3;
19,050
translationMoon.setRepeatMode(Animation.RepeatMode.INFINITE); translationMoon.setTransformable3D(moon); getCurrentScene().registerAnimation(translationMoon); translationMoon.play(); } <BUG>public void updateRenderCameraPose(TangoPoseData devicePose, DeviceExtrinsics extrinsics) { Pose cameraPose = ScenePoseCalculator.toOpenGlCameraPose(devicePose, extrinsics); getCurrentCamera().setRotation(cameraPose.getOrientation()); getCurrentCamera().setPosition(cameraPose.getPosition()); }</BUG> public int getTextureId() {
public void updateRenderCameraPose(TangoPoseData cameraPose) { float[] rotation = cameraPose.getRotationAsFloats(); float[] translation = cameraPose.getTranslationAsFloats(); Quaternion quaternion = new Quaternion(rotation[3], rotation[0], rotation[1], rotation[2]); getCurrentCamera().setRotation(quaternion.conjugate()); getCurrentCamera().setPosition(translation[0], translation[1], translation[2]);
19,051
package com.projecttango.examples.java.helloareadescription; import com.google.atap.tangoservice.Tango; <BUG>import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoConfig;</BUG> import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
import com.google.atap.tangoservice.TangoAreaDescriptionMetaData; import com.google.atap.tangoservice.TangoConfig;
19,052
} @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)
19,053
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))
19,054
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)
19,055
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");
19,056
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");
19,057
} @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);
19,058
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);
19,059
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);
19,060
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);
19,061
public class HotelsMessageQueue { private static YamlConfiguration queue = HotelsConfigHandler.getMessageQueue(); public static HashMap<UUID, Set<String>> getMessages(MessageType type){ //Get all messages, regardless of player HashMap<UUID, Set<String>> allExpiryMessages = new HashMap<UUID, Set<String>>(); ConfigurationSection section = queue.getConfigurationSection("messages." + type); <BUG>if(section != null){ Set<String> keys = section.getKeys(false); if(keys != null){ for(String key : keys){ //Loop through all expiry messages</BUG> UUID configUUID = UUID.fromString(queue.getString("messages." + type + "." + key + ".UUID"));
if(section == null) return allExpiryMessages; if(keys == null) return allExpiryMessages; for(String key : keys){ //Loop through all expiry messages
19,062
Set<String> messages = messageSection.getKeys(false); if(configUUID != null && messages != null && !messages.isEmpty())//If there actually are valid messages allExpiryMessages.put(configUUID, messages); queue.set("messages." + type + "." + key, null); //Remove the gathered messages from the queue } <BUG>} }</BUG> HotelsConfigHandler.saveMessageQueue(queue); return allExpiryMessages; }
[DELETED]
19,063
return allExpiryMessages; } public static Set<String> getMessages(MessageType type, UUID uuid){ //Get messages for specific player Set<String> expiryMessages = new HashSet<String>(); ConfigurationSection allExpiryMessages = queue.getConfigurationSection("messages." + type); <BUG>if(allExpiryMessages != null){ Set<String> keys = allExpiryMessages.getKeys(false); if(keys != null){ for(String key : keys){</BUG> String uuidString = queue.getString("messages." + type + "." + key + ".UUID");
if(allExpiryMessages == null) return expiryMessages; if(keys == null) return expiryMessages; for(String key : keys){
19,064
expiryMessages.add(queue.getString("messages." + type + "." + key + ".message")); queue.set("messages." + type + "." + key, null); HotelsConfigHandler.saveMessageQueue(queue); <BUG>} } }</BUG> } return expiryMessages; } public static void addMessage(MessageType type, UUID uuid, String message){
[DELETED]
19,065
RoomCreateEvent rce = new RoomCreateEvent(room); Bukkit.getPluginManager().callEvent(rce);// Call RoomCreateEvent if(rce.isCancelled()) return; ProtectedRegion pr = hotel.getRegion(); if(sel==null){ Mes.mes(p, "chat.creationMode.noSelection"); return; } <BUG>if((sel instanceof Polygonal2DSelection) && (pr.containsAny(((Polygonal2DSelection) sel).getNativePoints()))|| ((sel instanceof CuboidSelection) && (pr.contains(sel.getNativeMinimumPoint()) && pr.contains(sel.getNativeMaximumPoint())))){ ProtectedRegion r;</BUG> if(sel instanceof CuboidSelection){
if( !( (sel instanceof Polygonal2DSelection) && (pr.containsAny(((Polygonal2DSelection) sel).getNativePoints())) ) && !((sel instanceof CuboidSelection) && (pr.contains(sel.getNativeMinimumPoint()) && pr.contains(sel.getNativeMaximumPoint()))) ){ Mes.mes(p, "chat.creationMode.rooms.notInHotel"); return; } ProtectedRegion r;
19,066
public static void saveInventory(CommandSender s){ Player p = ((Player) s); UUID playerUUID = p.getUniqueId(); PlayerInventory pinv = p.getInventory(); File file = HotelsConfigHandler.getInventoryFile(playerUUID); <BUG>if(!file.exists()){ try {</BUG> file.createNewFile(); } catch (IOException e){ Mes.mes(p, "chat.creationMode.inventory.storeFail");
if(file.exists()){ Mes.mes(p, "chat.commands.creationMode.alreadyIn"); return; } try {
19,067
import org.switchyard.as7.extension.deployment.SwitchYardModuleDependencyProcessor; import org.switchyard.as7.extension.services.SwitchYardComponentService; import org.switchyard.as7.extension.services.SwitchYardInjectorService; import org.switchyard.deploy.Component; public final class SwitchYardModuleAdd extends AbstractAddStepHandler { <BUG>private static final Logger LOG = Logger.getLogger("org.switchyard"); private static final ServiceName RA_REPOSITORY_SERVICE_NAME = ServiceName.JBOSS.append("rarepository"); static final SwitchYardModuleAdd INSTANCE = new SwitchYardModuleAdd();</BUG> private static List<String> _componentNames = new ArrayList<String>(); public static int _priority = 0x4005;
private static final ExtensionLogger LOG = ExtensionLogger.ROOT_LOGGER; private static final ServiceName RA_REPOSITORY_SERVICE_NAME = ConnectorServices.RA_REPOSITORY_SERVICE; static final SwitchYardModuleAdd INSTANCE = new SwitchYardModuleAdd();
19,068
import static org.switchyard.as7.extension.CommonAttributes.MODULE; import static org.switchyard.as7.extension.CommonAttributes.SECURITY_CONFIG; import java.util.Locale; import org.jboss.as.controller.Extension; import org.jboss.as.controller.ExtensionContext; <BUG>import org.jboss.as.controller.PathElement; import org.jboss.as.controller.ReloadRequiredWriteAttributeHandler;</BUG> import org.jboss.as.controller.ResourceBuilder; import org.jboss.as.controller.ResourceDefinition; import org.jboss.as.controller.SimpleResourceDefinition;
import org.jboss.as.controller.ReloadRequiredRemoveStepHandler; import org.jboss.as.controller.ReloadRequiredWriteAttributeHandler;
19,069
import org.switchyard.common.version.Versions; public class SwitchYardExtension implements Extension { private static final Logger LOGGER = Logger.getLogger("org.switchyard"); public static final String SUBSYSTEM_NAME = "switchyard"; public static final String NAMESPACE = "urn:jboss:domain:switchyard:1.0"; <BUG>private static final PathElement SUBSYSTEM_PATH = PathElement.pathElement(SUBSYSTEM, SUBSYSTEM_NAME); private static final PathElement SECURITY_CONFIG_PATH = PathElement.pathElement(SECURITY_CONFIG); private static final PathElement MODULE_PATH = PathElement.pathElement(MODULE); private static final PathElement EXTENSION_PATH = PathElement.pathElement(EXTENSION); private static final String RESOURCE_NAME = SwitchYardExtension.class.getPackage().getName() + ".LocalDescriptions";</BUG> public static StandardResourceDescriptionResolver getResourceDescriptionResolver(final String... keyPrefix) {
private static final String RESOURCE_NAME = SwitchYardExtension.class.getPackage().getName() + ".LocalDescriptions";
19,070
.pushChild(securityConfigsResource).pop() .pushChild(modulesResource).pop() .pushChild(extensionsResource).pop() .build(); subsystem.registerSubsystemModel(subsystemResource); <BUG>DescriptionProvider nullDescriptionProvider = new DescriptionProvider() { @Override public ModelNode getModelDescription(Locale locale) { return new ModelNode(); } };</BUG> final ManagementResourceRegistration registration = subsystem.registerDeploymentModel(new SimpleResourceDefinition(SUBSYSTEM_PATH, getResourceDescriptionResolver("deployment")));
[DELETED]
19,071
import java.util.List; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import org.jboss.as.controller.PathAddress; import org.jboss.as.controller.PathElement; <BUG>import org.jboss.as.controller.descriptions.ModelDescriptionConstants; import org.jboss.dmr.ModelNode;</BUG> import org.jboss.staxmapper.XMLElementReader; import org.jboss.staxmapper.XMLExtendedStreamReader; final class SwitchYardSubsystemReader implements XMLStreamConstants, XMLElementReader<List<ModelNode>> {
import org.jboss.as.controller.operations.common.Util; import org.jboss.dmr.ModelNode;
19,072
return INSTANCE; } @Override public void readElement(final XMLExtendedStreamReader reader, List<ModelNode> list) throws XMLStreamException { requireNoAttributes(reader); <BUG>ModelNode subsystem = SwitchYardExtension.createAddSubsystemOperation(); list.add(subsystem);</BUG> while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { if (reader.getNamespaceURI().equals(SwitchYardExtension.NAMESPACE)) { final Element element = Element.forName(reader.getLocalName());
ModelNode subsystem = Util.createAddOperation(PathAddress.pathAddress(SwitchYardExtension.SUBSYSTEM_PATH)); list.add(subsystem);
19,073
package org.switchyard.as7.extension; <BUG>import static org.switchyard.as7.extension.CommonAttributes.MODULE; import static org.switchyard.as7.extension.CommonAttributes.SECURITY_CONFIG; import static org.switchyard.as7.extension.CommonAttributes.PROPERTIES;</BUG> import static org.switchyard.as7.extension.CommonAttributes.SOCKET_BINDING; import java.util.List;
[DELETED]
19,074
</BUG> ServerUtil.setRegistry(context.getServiceRegistry(false)); final SwitchYardInjectorService injectorService = new SwitchYardInjectorService(); final ServiceBuilder<Map<String, String>> injectorServiceBuilder = context.getServiceTarget().addService(SwitchYardInjectorService.SERVICE_NAME, injectorService); <BUG>if (operation.has(SOCKET_BINDING)) { StringTokenizer sockets = new StringTokenizer(operation.get(SOCKET_BINDING).asString(), ","); while (sockets.hasMoreTokens()) {</BUG> String socketName = sockets.nextToken(); injectorServiceBuilder.addDependency(SocketBinding.JBOSS_BINDING_NAME.append(socketName), SocketBinding.class, injectorService.getSocketBinding(socketName));
processorTarget.addDeploymentProcessor(SwitchYardExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, priority++, new SwitchYardDependencyProcessor()); processorTarget.addDeploymentProcessor(SwitchYardExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, priority++, new SwitchYardConfigProcessor()); processorTarget.addDeploymentProcessor(SwitchYardExtension.SUBSYSTEM_NAME, Phase.INSTALL, priority++, new SwitchYardDeploymentProcessor()); } }, OperationContext.Stage.RUNTIME); LOG.trace("Activating SwitchYard Subsystem"); if (model.hasDefined(SOCKET_BINDING)) { StringTokenizer sockets = new StringTokenizer(Attributes.SOCKET_BINDING.resolveModelAttribute(context,model).asString(), ","); while (sockets.hasMoreTokens()) {
19,075
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();
PDPage currPage = document.getDocumentCatalog().getPages().get(pageNo); PDPageContentStream pageStream = new PDPageContentStream(document, currPage, PDPageContentStream.AppendMode.APPEND, false);
19,076
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;
font = getFont(split[1]); color = new Color(Integer.valueOf(split[2].substring(1), 16));
19,077
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;
import org.apache.pdfbox.pdmodel.font.PDType1Font; import org.apache.pdfbox.util.Matrix; import org.slf4j.Logger;
19,078
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 {
String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, text);
19,079
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()); }
stream.setTextMatrix(new Matrix(1,0,0,1, textX, textY)); stream.showText(text);
19,080
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) {
stream.moveTo(textX, textY - lineOffset); stream.lineTo(textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset);
19,081
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<String> breakSplitted = Arrays.asList(text.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList()); if (breakSplitted.size() > 1) {
19,082
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;
import org.apache.pdfbox.pdmodel.PDPageContentStream; import java.io.IOException;
19,083
if (Common.debug) { System.out.println(this.getClass().getSimpleName() + ": Received map " + map); </BUG> } <BUG>String word = map.get("word"); </BUG> if (word == null) { return; } if (!Character.isUpperCase(word.charAt(0))) {
System.out.println(this.getClass().getSimpleName() + ": Received tuple " + tupleIn); String word = tupleIn.get("word");
19,084
} <BUG>output.emit(tuple); </BUG> } }
public void process(Map<String, String> tupleIn) { if (Common.debug) { System.out.println(this.getClass().getSimpleName() + ": Received tuple " + tupleIn);
19,085
int count = 0; if (text != null) { count = text.split(delimiters).length; } if (Common.debug) { <BUG>System.out.println(this.getClass().getSimpleName() + ": Emitting tuple " + output); </BUG> } output.emit(count); }
System.out.println(this.getClass().getSimpleName() + ": Emitting count " + output);
19,086
public class StreamSource extends AbstractFlowlet { static String keyTotal = ":sourceTotal:"; private OutputEmitter<String> output; CounterTable counters; public StreamSource() { <BUG>super("StreamSource"); } public void process(StreamEvent event, InputContext context) throws CharacterCodingException { this.counters = getContext().getDataSet(Common.tableName);</BUG> if (Common.debug) {
super("source"); public void process(StreamEvent event) {
19,087
public class Main implements Application { @Override public ApplicationSpecification configure() { return ApplicationSpecification.Builder.with() .setName("CountCountsDemo") <BUG>.setDescription("Application for counting counts of words") .withStreams().add(new Stream("text")) .withDataSets().add(new KeyValueTable(Common.tableName)) .withFlows().add(new CountCounts()) .withProcedures().add(new CountQuery())</BUG> .build();
.withStreams() .withDataSets() .withFlows() .withProcedures().add(new CountQuery())
19,088
.setName("CountCounts") .setDescription("Flow for counting words") .withFlowlets() .add("source", new StreamSource()) .add("count", new WordCounter()) <BUG>.add("tick", new Incrementer()) .connect().fromStream("text").to("source") .from("source").to("count")</BUG> .from("count").to("tick") .build();
.connect() .from("source").to("count")
19,089
package CountCounts; import com.continuuity.api.flow.flowlet.AbstractFlowlet; <BUG>import com.continuuity.api.flow.flowlet.InputContext; import java.nio.charset.CharacterCodingException;</BUG> public class Incrementer extends AbstractFlowlet { static String keyTotal = ":sinkTotal:"; CounterTable counters;
[DELETED]
19,090
import java.nio.charset.CharacterCodingException;</BUG> public class Incrementer extends AbstractFlowlet { static String keyTotal = ":sinkTotal:"; CounterTable counters; public Incrementer() { <BUG>super("Incrementer"); } public void process(Integer count, InputContext context) throws CharacterCodingException { this.counters = getContext().getDataSet(Common.tableName);</BUG> if (Common.debug) {
package CountCounts; import com.continuuity.api.flow.flowlet.AbstractFlowlet; super("tick"); public void process(Integer count) {
19,091
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
19,092
final int lineStride = dst.getScanlineStride(); final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final byte[][] data = dst.getByteDataArrays(); final float[] warpData = new float[2 * dstWidth]; <BUG>int lineOffset = 0; if (ctable == null) { // source does not have IndexColorModel if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset;
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
19,093
pixelOffset += pixelStride; } // COLS LOOP } // ROWS LOOP } } else {// source has IndexColorModel <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
} else if (caseB) { for (int h = 0; h < dstHeight; h++) {
19,094
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
19,095
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final short[][] data = dst.getShortDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
19,096
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
19,097
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final short[][] data = dst.getShortDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
19,098
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
19,099
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final int[][] data = dst.getIntDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
19,100
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding