id int64 1 49k | buggy stringlengths 34 37.5k | fixed stringlengths 2 37k |
|---|---|---|
15,401 | </BUG>
listeners.add(listener);
addListenerToCandidates(listener);
} else {
<BUG>logger.warn("Adding a listener to ModelDistributer failed, duplicated listener! " + listener.toString());
</BUG>
}
}
}
private void addListenerToCandidates(DistributionRequest listener) {
| private ConcurrentHashMap<DistributionRequest, DataEnumeratorIF> candidateListeners = new ConcurrentHashMap<DistributionRequest, DataEnumeratorIF>();
private ConcurrentHashMap<DistributionRequest, Boolean> candidatesForNextRound = new ConcurrentHashMap<DistributionRequest, Boolean>();
public void addListener(DistributionRequest listener) {
synchronized (listeners) {
if (!listeners.contains(listener)) {
logger.info("Adding a listener to ModelDistributer:" + listener.toString());
logger.info("Adding a listener to ModelDistributer failed, duplicated listener! " + listener.toString());
|
15,402 | import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.UUID;
import org.bukkit.Bukkit;
<BUG>import org.bukkit.Location;
import org.bukkit.World;</BUG>
import org.bukkit.block.Block;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
| import org.bukkit.OfflinePlayer;
import org.bukkit.World;
|
15,403 | private World world;
private String name;
public YamlConfiguration hconfig;
public Hotel(World world, String name){
this.world = world;
<BUG>this.name = name;
this.hconfig = getHotelConfig();</BUG>
}
public Hotel(String name){
this.name = name;
| this.name = name.toLowerCase();
this.hconfig = getHotelConfig();
|
15,404 | }
public boolean isInCreationMode(UUID uuid){
</BUG>
return HotelsConfigHandler.getInventoryFile(uuid).exists();
}
<BUG>public void hotelSetup(String hotelName, CommandSender s){
</BUG>
Player p = (Player) s;
if(hotelName.contains("-")){ p.sendMessage(Mes.mes("chat.creationMode.invalidChar")); return; }
if(Mes.hasPerm(p, "hotels.create")){ p.sendMessage(Mes.mes("chat.noPermission")); return; }
| public static boolean isInCreationMode(UUID uuid){
public static void hotelSetup(String hotelName, CommandSender s){
|
15,405 | Selection sel = getWorldEdit().getSelection(p);
Hotel hotel = new Hotel(p.getWorld(), hotelName);
if(hotel.exists()){ p.sendMessage(Mes.mes("chat.creationMode.hotelCreationFailed")); return; }
if(sel==null){ p.sendMessage(Mes.mes("chat.creationMode.noSelection")); return; }
int ownedHotels = HotelsAPI.getHotelsOwnedBy(p.getUniqueId()).size();
<BUG>int maxHotels = plugin.getConfig().getInt("settings.max_hotels_owned");
</BUG>
if(ownedHotels>maxHotels && !Mes.hasPerm(p, "hotels.create.admin")){
p.sendMessage((Mes.mes("chat.commands.create.maxHotelsReached")).replaceAll("%max%", String.valueOf(maxHotels))); return;
}
| int maxHotels = HotelsConfigHandler.getconfigyml().getInt("settings.max_hotels_owned");
|
15,406 | else{
p.sendMessage(Mes.mes("chat.creationMode.selectionInvalid")); return; }
hotel.create(r, p);
Bukkit.getPluginManager().callEvent(new HotelCreateEvent(hotel)); //Call HotelCreateEvent
}
<BUG>public void roomSetup(String hotelName,int roomNum,Player p){
</BUG>
Selection sel = getWorldEdit().getSelection(p);
World world = p.getWorld();
Hotel hotel = new Hotel(world, hotelName);
| public static void roomSetup(String hotelName, int roomNum, Player p){
|
15,407 | Selection sel = getWorldEdit().getSelection(p);
World world = p.getWorld();
Hotel hotel = new Hotel(world, hotelName);
if(!hotel.exists()){ p.sendMessage(Mes.mes("chat.creationMode.rooms.fail")); return; }
Room room = new Room(hotel, roomNum);
<BUG>if(room.exists()){ p.sendMessage(Mes.mes("chat.creationMode.rooms.alreadyExists")); return; }
ProtectedRegion pr = hotel.getRegion();</BUG>
if(sel==null){ p.sendMessage(Mes.mes("chat.creationMode.noSelection")); return; }
if((sel instanceof Polygonal2DSelection) && (pr.containsAny(((Polygonal2DSelection) sel).getNativePoints()))||
((sel instanceof CuboidSelection) && (pr.contains(sel.getNativeMinimumPoint()) && pr.contains(sel.getNativeMaximumPoint())))){
| RoomCreateEvent rce = new RoomCreateEvent(room);
Bukkit.getPluginManager().callEvent(rce);// Call RoomCreateEvent
if(rce.isCancelled()) return;
ProtectedRegion pr = hotel.getRegion();
|
15,408 | UUID playerUUID = p.getUniqueId();
File invFile = HotelsConfigHandler.getInventoryFile(playerUUID);
if(invFile.exists())
invFile.delete();
}
<BUG>public void saveInventory(CommandSender s){
</BUG>
Player p = ((Player) s);
UUID playerUUID = p.getUniqueId();
PlayerInventory pinv = p.getInventory();
| public static void saveInventory(CommandSender s){
|
15,409 | ArrayList<Hotel> hotels = new ArrayList<Hotel>();
for(ProtectedRegion r : WorldGuardManager.getRegions(w)){
String id = r.getId();
if(id.matches("hotel-\\w+$")){
String name = id.replaceFirst("hotel-", "");
<BUG>Hotel hotel = new Hotel(w,name);
</BUG>
hotels.add(hotel);
}
}
| Hotel hotel = new Hotel(w, name);
|
15,410 | for(World w : worlds)
hotels.addAll(getHotelsInWorld(w));
return hotels;
}
public static ArrayList<Hotel> getHotelsOwnedBy(UUID uuid){
<BUG>ArrayList<Hotel> hotels = getAllHotels();
for(Hotel hotel : hotels){
if(!hotel.isOwner(uuid))
hotels.remove(hotel);
}
hotels.trimToSize();
return hotels;
</BUG>
}
| ArrayList<Hotel> owned = new ArrayList<Hotel>();
if(hotel.isOwner(uuid))
owned.add(hotel);
return owned;
|
15,411 | super.doClose();
Neo4JSession session = Neo4JGraph.this.currentSession();
session.closeTransaction();
}
}
<BUG>private final String[] partition;
private final Driver driver;</BUG>
private final Neo4JElementIdProvider<?> vertexIdProvider;
private final Neo4JElementIdProvider<?> edgeIdProvider;
private final Neo4JElementIdProvider<?> propertyIdProvider;
| private final Neo4JReadPartition partition;
private final Set<String> vertexLabels;
private final Driver driver;
|
15,412 | public Neo4JGraph(Driver driver, Neo4JElementIdProvider<?> vertexIdProvider, Neo4JElementIdProvider<?> edgeIdProvider, Neo4JElementIdProvider<?> propertyIdProvider) {
Objects.requireNonNull(driver, "driver cannot be null");
Objects.requireNonNull(vertexIdProvider, "vertexIdProvider cannot be null");
Objects.requireNonNull(edgeIdProvider, "edgeIdProvider cannot be null");
Objects.requireNonNull(propertyIdProvider, "propertyIdProvider cannot be null");
<BUG>this.partition = new String[0];
this.driver = driver;</BUG>
this.vertexIdProvider = vertexIdProvider;
this.edgeIdProvider = edgeIdProvider;
this.propertyIdProvider = propertyIdProvider;
| this.partition = new NoLabelReadPartition();
this.vertexLabels = Collections.emptySet();
this.driver = driver;
|
15,413 | Objects.requireNonNull(partition, "partition cannot be null");
Objects.requireNonNull(driver, "driver cannot be null");</BUG>
Objects.requireNonNull(vertexIdProvider, "vertexIdProvider cannot be null");
Objects.requireNonNull(edgeIdProvider, "edgeIdProvider cannot be null");
Objects.requireNonNull(propertyIdProvider, "propertyIdProvider cannot be null");
<BUG>this.partition = partition.clone();
this.driver = driver;</BUG>
this.vertexIdProvider = vertexIdProvider;
this.edgeIdProvider = edgeIdProvider;
this.propertyIdProvider = propertyIdProvider;
| Objects.requireNonNull(vertexLabels, "vertexLabels cannot be null");
Objects.requireNonNull(driver, "driver cannot be null");
this.partition = partition;
this.vertexLabels = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(vertexLabels)));
this.driver = driver;
|
15,414 | session = new Neo4JSession(this, driver.session(), vertexIdProvider, edgeIdProvider, propertyIdProvider);
this.session.set(session);
}
return session;
}
<BUG>public String[] getPartition() {
return partition.clone();
}</BUG>
@Override
public Vertex addVertex(Object... keyValues) {
| public Neo4JReadPartition getPartition() {
return partition;
Set<String> vertexLabels() {
return vertexLabels;
|
15,415 | import org.neo4j.driver.v1.exceptions.ClientException;
import org.neo4j.driver.v1.types.Node;
import org.neo4j.driver.v1.types.Relationship;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
<BUG>import java.util.Arrays;
import java.util.HashMap;</BUG>
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
| import java.util.Collections;
import java.util.HashMap;
|
15,416 | Objects.requireNonNull(edgeIdProvider, "edgeIdProvider cannot be null");
Objects.requireNonNull(propertyIdProvider, "propertyIdProvider cannot be null");
if (logger.isDebugEnabled())
logger.debug("Creating session [{}]", session.hashCode());
this.graph = graph;
<BUG>this.partition = new HashSet<>(Arrays.asList(graph.getPartition()));
this.session = session;</BUG>
this.vertexIdProvider = vertexIdProvider;
this.edgeIdProvider = edgeIdProvider;
this.propertyIdProvider = propertyIdProvider;
| this.partition = graph.getPartition();
this.session = session;
|
15,417 | verifyIdentifiers(Vertex.class, ids);
if (!verticesLoaded) {
if (ids.length > 0) {
Set<Object> identifiers = Arrays.stream(ids).map(Neo4JSession::processIdentifier).collect(Collectors.toSet());
List<Object> filter = identifiers.stream().filter(id -> !vertices.containsKey(id)).collect(Collectors.toList());
<BUG>if (!filter.isEmpty()) {
Statement statement = new Statement("MATCH " + generateVertexMatch("n") + " WHERE n." + vertexIdFieldName + " in {ids} RETURN n", Values.parameters("ids", filter));
</BUG>
Stream<Vertex> query = vertices(statement);
return combine(identifiers.stream().filter(vertices::containsKey).map(id -> (Vertex)vertices.get(id)), query);
| String predicate = partition.generateVertexMatchPredicate("n");
Statement statement = new Statement("MATCH " + generateVertexMatchPattern("n") + " WHERE n." + vertexIdFieldName + " in {ids}" + (predicate != null ? " AND " + predicate : "") + " RETURN n", Values.parameters("ids", filter));
|
15,418 | if (!edgesLoaded) {
if (ids.length > 0) {
Set<Object> identifiers = Arrays.stream(ids).map(Neo4JSession::processIdentifier).collect(Collectors.toSet());
List<Object> filter = identifiers.stream().filter(id -> !edges.containsKey(id)).collect(Collectors.toList());
if (!filter.isEmpty()) {
<BUG>Statement statement = new Statement("MATCH " + generateVertexMatch("n") + "-[r]->" + generateVertexMatch("m") + " WHERE r." + edgeIdFieldName + " in {ids} RETURN n, r, m", Values.parameters("ids", filter));
Stream<Edge> query = edges(statement);</BUG>
return combine(identifiers.stream().filter(edges::containsKey).map(id -> (Edge)edges.get(id)), query);
}
return combine(identifiers.stream().filter(edges::containsKey).map(id -> (Edge)edges.get(id)), Stream.empty());
| String outVertexPredicate = partition.generateVertexMatchPredicate("n");
String inVertexPredicate = partition.generateVertexMatchPredicate("m");
Statement statement = new Statement("MATCH " + generateVertexMatchPattern("n") + "-[r]->" + generateVertexMatchPattern("m") + " WHERE r." + edgeIdFieldName + " in {ids}" + (outVertexPredicate != null && inVertexPredicate != null ? " AND " + outVertexPredicate + " AND " + inVertexPredicate : "") + " RETURN n, r, m", Values.parameters("ids", filter));
Stream<Edge> query = edges(statement);
|
15,419 | if (edge == null) {
Node firstNode = record.get(0).asNode();
Node secondNode = record.get(2).asNode();
Object firstNodeId = firstNode.get(vertexIdFieldName).asObject();
Object secondNodeId = secondNode.get(vertexIdFieldName).asObject();
<BUG>if (deletedVertices.contains(firstNodeId) || deletedVertices.contains(secondNodeId) || (!partition.isEmpty() && (!StreamSupport.stream(firstNode.labels().spliterator(), false).anyMatch(partition::contains) || !StreamSupport.stream(secondNode.labels().spliterator(), false).anyMatch(partition::contains))))
return null;</BUG>
Neo4JVertex firstVertex = vertices.get(firstNodeId);
if (firstVertex == null) {
firstVertex = new Neo4JVertex(graph, this, propertyIdProvider, vertexIdFieldName, firstNode);
| if (deletedVertices.contains(firstNodeId) || deletedVertices.contains(secondNodeId) || !partition.containsVertex(StreamSupport.stream(firstNode.labels().spliterator(), false).collect(Collectors.toSet())) || !partition.containsVertex(StreamSupport.stream(secondNode.labels().spliterator(), false).collect(Collectors.toSet())))
return null;
|
15,420 | .toConfig();
String graphName = configuration.getString(Neo4JGraphConfigurationBuilder.Neo4JGraphNameConfigurationKey);
Driver driver = GraphDatabase.driver(configuration.getString(Neo4JGraphConfigurationBuilder.Neo4JUrlConfigurationKey), AuthTokens.basic(configuration.getString(Neo4JGraphConfigurationBuilder.Neo4JUsernameConfigurationKey), configuration.getString(Neo4JGraphConfigurationBuilder.Neo4JPasswordConfigurationKey)), config);
Neo4JElementIdProvider<?> vertexIdProvider = loadProvider(configuration.getString(Neo4JGraphConfigurationBuilder.Neo4JVertexIdProviderClassNameConfigurationKey));
Neo4JElementIdProvider<?> edgeIdProvider = loadProvider(configuration.getString(Neo4JGraphConfigurationBuilder.Neo4JEdgeIdProviderClassNameConfigurationKey));
<BUG>Neo4JElementIdProvider<?> propertyIdProvider = loadProvider(configuration.getString(Neo4JGraphConfigurationBuilder.Neo4JPropertyIdProviderClassNameConfigurationKey));
return new Neo4JGraph(graphName != null ? new String[]{graphName} : new String[0], driver, vertexIdProvider, edgeIdProvider, propertyIdProvider);
}</BUG>
catch (Throwable ex) {
| if (graphName != null)
return new Neo4JGraph(new AnyLabelReadPartition(graphName), new String[]{graphName}, driver, vertexIdProvider, edgeIdProvider, propertyIdProvider);
return new Neo4JGraph(driver, vertexIdProvider, edgeIdProvider, propertyIdProvider);
}
|
15,421 | import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIBE;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUBSYSTEM;
import java.util.Collections;
import java.util.Comparator;
<BUG>import java.util.EnumSet;
import java.util.Locale;</BUG>
import java.util.Set;
import java.util.TreeSet;
import org.jboss.as.controller.OperationContext;
| import java.util.LinkedHashSet;
import java.util.Locale;
|
15,422 | customTokens.put("%%mlFinalForestsPerHost%%", hubConfig.finalForestsPerHost.toString());
customTokens.put("%%mlTraceAppserverName%%", hubConfig.traceHttpName);
customTokens.put("%%mlTracePort%%", hubConfig.tracePort.toString());
customTokens.put("%%mlTraceDbName%%", hubConfig.traceDbName);
customTokens.put("%%mlTraceForestsPerHost%%", hubConfig.traceForestsPerHost.toString());
<BUG>customTokens.put("%%mlModulesDbName%%", hubConfig.modulesDbName);
}</BUG>
public void init() {
try {
LOGGER.error("PLUGINS DIR: " + pluginsDir.toString());
| customTokens.put("%%mlTriggersDbName%%", hubConfig.triggersDbName);
customTokens.put("%%mlSchemasDbName%%", hubConfig.schemasDbName);
}
|
15,423 | public void testUncheckedBoundsWithErasure() throws Exception {
doTest(false);
}
public void testLambdaGroundTest() throws Exception {
doTest(false);
<BUG>}
private void doTest(final boolean checkWarnings) {</BUG>
doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, false);
}
@Override
| public void testIntersectionTypeStrictSubtypingConstraint() throws Exception {
private void doTest(final boolean checkWarnings) {
|
15,424 | chart.addYAxisLabels(AxisLabelsFactory.newAxisLabels(labels));
chart.addXAxisLabels(AxisLabelsFactory.newNumericRangeAxisLabels(0, max));
chart.setBarWidth(BarChart.AUTO_RESIZE);
chart.setSize(600, 500);
chart.setHorizontal(true);
<BUG>chart.setTitle("Total Evaluations by User");
showChartImg(resp, chart.toURLString());
}</BUG>
private List<Entry<String, Integer>> sortEntries(Collection<Entry<String, Integer>> entries) {
List<Entry<String, Integer>> result = new ArrayList<Entry<String, Integer>>(entries);
| chart.setDataEncoding(DataEncoding.TEXT);
return chart;
}
|
15,425 | checkEvaluationsEqual(eval4, foundissueProto.getEvaluations(0));
checkEvaluationsEqual(eval5, foundissueProto.getEvaluations(1));
}
public void testGetRecentEvaluationsNoneFound() throws Exception {
DbIssue issue = createDbIssue("fad", persistenceHelper);
<BUG>DbEvaluation eval1 = createEvaluation(issue, "someone", 100);
DbEvaluation eval2 = createEvaluation(issue, "someone", 200);
DbEvaluation eval3 = createEvaluation(issue, "someone", 300);
issue.addEvaluations(eval1, eval2, eval3);</BUG>
getPersistenceManager().makePersistent(issue);
| [DELETED] |
15,426 | public int read() throws IOException {
return inputStream.read();
}
});
}
<BUG>}
protected DbEvaluation createEvaluation(DbIssue issue, String who, long when) {</BUG>
DbUser user;
Query query = getPersistenceManager().newQuery("select from " + persistenceHelper.getDbUserClass().getName()
+ " where openid == :myopenid");
| @SuppressWarnings({"unchecked"})
protected DbEvaluation createEvaluation(DbIssue issue, String who, long when) {
|
15,427 | eval.setComment("my comment");
eval.setDesignation("MUST_FIX");
eval.setIssue(issue);
eval.setWhen(when);
eval.setWho(user.createKeyObject());
<BUG>eval.setEmail(who);
return eval;</BUG>
}
protected PersistenceManager getPersistenceManager() {
return testHelper.getPersistenceManager();
| issue.addEvaluation(eval);
return eval;
|
15,428 | package com.shiny.joypadmod.inputevent;
<BUG>import org.lwjgl.input.Controllers;
import com.shiny.joypadmod.helpers.LogHelper;</BUG>
public abstract class ControllerInputEvent
{
protected final EventType type;
| import com.shiny.joypadmod.ControllerSettings;
import com.shiny.joypadmod.helpers.LogHelper;
|
15,429 | }
public boolean wasReleased()
{
boolean bRet = false;
if (wasReleased)
<BUG>{
System.out.println("wasReleased returning true for " + getName());
</BUG>
bRet = true;
wasReleased = false;
| public ControllerInputEvent(EventType type, int controllerNumber, int buttonNumber, float threshold, float deadzone)
LogHelper.Info("ControllerInputEvent constructor params:( type: " + type + ", controllerNumber: "
+ controllerNumber + ", buttonNumber: " + buttonNumber + ", threshhold: " + threshold + ", deadzone: "
+ deadzone + ")");
this.type = type;
this.controllerNumber = controllerNumber;
this.buttonNumber = buttonNumber;
this.threshold = threshold;
this.deadzone = deadzone;
isActive = false;
|
15,430 | y = 0;
if (x > scaledResolution.getScaledWidth())
x = scaledResolution.getScaledWidth() - 5;
if (y > scaledResolution.getScaledHeight())
y = scaledResolution.getScaledHeight() - 5;
<BUG>if (debug)
LogHelper.Debug("Virtual Mouse x: " + x + " y: " + y);</BUG>
mcY = mc.displayHeight - (int) (y * scaledResolution.getScaleFactor());
mcX = x * scaledResolution.getScaleFactor();
}
| if (ControllerSettings.loggingLevel > 2)
LogHelper.Debug("Virtual Mouse x: " + x + " y: " + y);
|
15,431 | package com.shiny.joypadmod.lwjglVirtualInput;
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
<BUG>import org.lwjgl.input.Keyboard;
import com.shiny.joypadmod.helpers.LogHelper;</BUG>
public class VirtualKeyboard
{
private static Field keyDownField;
| import com.shiny.joypadmod.ControllerSettings;
import com.shiny.joypadmod.helpers.LogHelper;
|
15,432 | if (!checkCreated())
{
return;
}
if (keyHelper(keycode, 1))
<BUG>{
LogHelper.Info("Pressing key " + Keyboard.getKeyName(keycode));</BUG>
keyState[keycode] = 1;
holdKey(keycode, true);
}
| if (ControllerSettings.loggingLevel > 1)
LogHelper.Info("Pressing key " + Keyboard.getKeyName(keycode));
|
15,433 | public static Controller joystick;
public static int joyNo = -1;
public static boolean grabMouse = true;
public static int inGameSensitivity = 20;
public static int inMenuSensitivity = 20;
<BUG>public static int scrollDelay = 50;
private static int requiredMinButtonCount = 4;</BUG>
private static int requiredButtonCount = 12;
private static int requiredAxisCount = 4;
public static Map<String, List<Integer>> validControllers;
| public static int loggingLevel = 1;
private static int requiredMinButtonCount = 4;
|
15,434 | public static Map<String, List<Integer>> inValidControllers;
public static ControllerUtils controllerUtils;
public static boolean modDisabled = false;
private boolean inputEnabled = false;
private static boolean suspendControllerInput = false;
<BUG>private static boolean invertYAxis = false;
</BUG>
private static ConfigFile config = null;
public ControllerSettings(File configFile)
{
| public static boolean invertYAxis = false;
|
15,435 | package com.shiny.joypadmod.helpers;
<BUG>import org.apache.logging.log4j.Level;
import cpw.mods.fml.common.FMLLog;</BUG>
public class LogHelper
{
public static void Debug(String Message)
| import com.shiny.joypadmod.ControllerSettings;
import cpw.mods.fml.common.FMLLog;
|
15,436 | public static void Fatal(String Message)
{
FMLLog.log(Level.FATAL, Message);
}
public static void Info(String Message)
<BUG>{
FMLLog.log(Level.INFO, Message);</BUG>
}
public static void Trace(String Message)
{
| if (ControllerSettings.loggingLevel > 0)
FMLLog.log(Level.INFO, Message);
|
15,437 | import com.shiny.joypadmod.inputevent.ControllerBinding.BindingOptions;
public class ConfigFile
{
public int preferedJoyNo;
public String preferedJoyName;
<BUG>public boolean invertYAxis;
public int inGameSensitivity;
public int inMenuSensitivity;
public boolean grabMouse;</BUG>
private Configuration config;
| [DELETED] |
15,438 | config.addCustomCategoryComment("-BindingOptions-",
"List of valid binding options that can be combined with Controller events");
}
public void addGlobalOptionsComment()
{
<BUG>config.addCustomCategoryComment("-Global-",
"GrabMouse = will grab mouse when in game (generally not good for splitscreen)"
+ "\r\nSharedProfile = Will share joypad settings across all users except for invert");
}</BUG>
public void addComment(String category, String comment)
| config.addCustomCategoryComment(
"GrabMouse = will grab mouse when in game (generally not good for splitscreen)\r\n"
+ "LoggingLevel = 0-4 levels of logging ranging from next to none to very verbose. 1 recommended unless debugging.\r\n"
+ "SharedProfile = Will share joypad settings across all users except for invert");
|
15,439 | package com.shiny.joypadmod.lwjglVirtualInput;
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
<BUG>import org.lwjgl.input.Mouse;
import com.shiny.joypadmod.helpers.LogHelper;</BUG>
public class VirtualMouse
{
private static Field xField;
| import com.shiny.joypadmod.ControllerSettings;
import com.shiny.joypadmod.helpers.LogHelper;
|
15,440 | public static boolean releaseMouseButton(int button, boolean onlyIfHeld)
{
if (!checkCreated() || !checkButtonSupported(button))
return false;
if (onlyIfHeld && buttonsDown[button] != 1)
<BUG>return true;
LogHelper.Info("Releasing mouse button: " + button);</BUG>
setMouseButton(button, false);
addMouseEvent((byte) button, (byte) 0, lastX, lastY, 0, 1000);
buttonsDown[button] = 0;
| if (ControllerSettings.loggingLevel > 1)
LogHelper.Info("Releasing mouse button: " + button);
|
15,441 | return buttonsDown[button] == 1;
}
public static boolean scrollWheel(int event_dwheel)
{
if (!checkCreated())
<BUG>return false;
LogHelper.Info("Setting scroll wheel: " + event_dwheel);</BUG>
addMouseEvent((byte) -1, (byte) 0, 0, 0, event_dwheel, 10000);
return true;
}
| if (ControllerSettings.loggingLevel > 1)
LogHelper.Info("Setting scroll wheel: " + event_dwheel);
|
15,442 | LogHelper.Error("Failed setting x/y value of mouse. " + ex.toString());
}
return false;
}
public static boolean setMouseButton(int button, boolean down)
<BUG>{
LogHelper.Info("Hacking mouse button: " + button);</BUG>
try
{
((ByteBuffer) buttonField.get(null)).put(button, (byte) (down ? 1 : 0));
| if (ControllerSettings.loggingLevel > 3)
LogHelper.Info("Hacking mouse button: " + button);
|
15,443 | public class Relationship {
private static final int ARROWHEAD_LENGTH = 10;</BUG>
private static final int ARROWHEAD_WIDTH = ARROWHEAD_LENGTH / 2;
private Line edge;
private HTML label;
<BUG>private Widget from;
private Widget to;
</BUG>
private Line arrowheadLeft;
| package org.neo4j.server.ext.visualization.gwt.client;
import org.vaadin.gwtgraphics.client.Line;
import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.HTML;
private static final int ARROWHEAD_LENGTH = 10;
private Node from;
private Node to;
|
15,444 | arrowheadRight = new Line(0, 0, 0, 0);
parent.add(arrowheadRight);
updateArrowhead();
}
private void addEdge(VGraphComponent parent) {
<BUG>edge = new Line((int) Math.round(getCenterX(from)),
(int) Math.round(getCenterY(from)),
(int) Math.round(getCenterX(to)),
(int) Math.round(getCenterY(to)));
</BUG>
parent.add(edge);
| [DELETED] |
15,445 | label = new HTML("<div style='text-align:center'>" + type + "</div>");
parent.add(label);
Style style = label.getElement().getStyle();
style.setPosition(Position.ABSOLUTE);
style.setBackgroundColor("white");
<BUG>style.setFontSize(9, Unit.PX);
</BUG>
updateLabel();
}
void update() {
| style.setFontSize(10, Unit.PX);
|
15,446 | void update() {
updateEdge();
updateLabel();
updateArrowhead();
}
<BUG>private void updateArrowhead() {
double originX = getArrowheadOrigin(getCenterX(from), getCenterX(to));
double originY = getArrowheadOrigin(getCenterY(from), getCenterY(to));
double angle = Math.atan2(getCenterY(to) - getCenterY(from),
getCenterX(to) - getCenterX(from));</BUG>
double leftX = originX
| double fromX = from.getCenterX();
double fromY = from.getCenterY();
double toX = to.getCenterX();
double toY = to.getCenterY();
double originX = getArrowheadOrigin(fromX, toX);
double originY = getArrowheadOrigin(fromY, toY);
double angle = Math.atan2(toY - fromY, toX - fromX);
|
15,447 | double rightY = originY
+ rotateY(-ARROWHEAD_LENGTH, ARROWHEAD_WIDTH, angle);
updateLine(arrowheadRight, originX, originY, rightX, rightY);
}
private void updateEdge() {
<BUG>updateLine(edge, getCenterX(from), getCenterY(from), getCenterX(to),
getCenterY(to));
</BUG>
}
| updateLine(edge, from.getCenterX(), from.getCenterY(), to.getCenterX(),
to.getCenterY());
|
15,448 | import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.DigestOutputStream;
import java.security.MessageDigest;
<BUG>import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;</BUG>
public final class PatchUtils {
| import java.text.DateFormat;
import java.util.Date;
import java.util.List;
|
15,449 | package org.jboss.as.patching.runner;
<BUG>import org.jboss.as.boot.DirectoryStructure;
import org.jboss.as.patching.LocalPatchInfo;</BUG>
import org.jboss.as.patching.PatchInfo;
import org.jboss.as.patching.PatchLogger;
import org.jboss.as.patching.PatchMessages;
| import static org.jboss.as.patching.runner.PatchUtils.generateTimestamp;
import org.jboss.as.patching.CommonAttributes;
import org.jboss.as.patching.LocalPatchInfo;
|
15,450 | private static final String PATH_DELIMITER = "/";
public static final byte[] NO_CONTENT = PatchingTask.NO_CONTENT;
enum Element {
ADDED_BUNDLE("added-bundle"),
ADDED_MISC_CONTENT("added-misc-content"),
<BUG>ADDED_MODULE("added-module"),
BUNDLES("bundles"),</BUG>
CUMULATIVE("cumulative"),
DESCRIPTION("description"),
MISC_FILES("misc-files"),
| APPLIES_TO_VERSION("applies-to-version"),
BUNDLES("bundles"),
|
15,451 | final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
<BUG>case APPLIES_TO_VERSION:
builder.addAppliesTo(value);
break;</BUG>
case RESULTING_VERSION:
if(type == Patch.PatchType.CUMULATIVE) {
| [DELETED] |
15,452 | final StringBuilder path = new StringBuilder();
for(final String p : item.getPath()) {
path.append(p).append(PATH_DELIMITER);
}
path.append(item.getName());
<BUG>writer.writeAttribute(Attribute.PATH.name, path.toString());
if(type != ModificationType.REMOVE) {</BUG>
writer.writeAttribute(Attribute.HASH.name, bytesToHexString(item.getContentHash()));
}
if(type != ModificationType.ADD) {
| if (item.isDirectory()) {
writer.writeAttribute(Attribute.DIRECTORY.name, "true");
if(type != ModificationType.REMOVE) {
|
15,453 | package org.jboss.as.patching;
import org.jboss.as.controller.OperationFailedException;
import org.jboss.as.patching.runner.PatchingException;
import org.jboss.logging.Messages;
import org.jboss.logging.annotations.Message;
<BUG>import org.jboss.logging.annotations.MessageBundle;
import java.io.IOException;</BUG>
import java.util.List;
@MessageBundle(projectCode = "JBAS")
public interface PatchMessages {
| import org.jboss.logging.annotations.Cause;
import java.io.IOException;
|
15,454 | LOG.debug( t, t );
}
}
@Override
public void fire( UnassignAddressResponseType reply ) {
<BUG>try {
this.clearVmAddress( );
this.address.clearPending( );</BUG>
} catch ( IllegalStateException t ) {
LOG.debug( t );
| this.address.clearPending( );
|
15,455 | if ( orphanCount > AddressingConfiguration.getInstance( ).getMaxKillOrphans( ) ) {
EventRecord.caller( ClusterState.class, EventType.ADDRESS_STATE,
"Unassigning orphaned public ip address: " + LogUtil.dumpObject( address ) + " count=" + orphanCount ).warn( );
try {
final Address addr = Addresses.getInstance( ).lookup( address.getAddress( ) );
<BUG>try {
if ( addr.isAssigned( ) ) {
AsyncRequests.newRequest( new UnassignAddressCallback( address ) ).sendSync( cluster.getConfiguration( ) );
} else if ( !addr.isAssigned( ) && addr.isAllocated( ) && addr.isSystemOwned( ) ) {</BUG>
addr.release( );
| if ( addr.isAssigned( ) && "0.0.0.0".equals( address.getInstanceIp( ) ) ) {
addr.unassign( ).clearPending( );
if ( addr.isSystemOwned( ) ) {
|
15,456 | public static void transformConfigFile(InputStream sourceStream, String destPath) throws Exception {
try {
Yaml yaml = new Yaml();
final Object loadedObject = yaml.load(sourceStream);
if (loadedObject instanceof Map) {
<BUG>final Map<String, Object> result = (Map<String, Object>) loadedObject;
ByteArrayOutputStream nifiPropertiesOutputStream = new ByteArrayOutputStream();
writeNiFiProperties(result, nifiPropertiesOutputStream);
DOMSource flowXml = createFlowXml(result);
</BUG>
writeNiFiPropertiesFile(nifiPropertiesOutputStream, destPath);
| final Map<String, Object> loadedMap = (Map<String, Object>) loadedObject;
ConfigSchema configSchema = new ConfigSchema(loadedMap);
if (!configSchema.isValid()) {
throw new InvalidConfigurationException("Failed to transform config file due to:" + configSchema.getValidationIssuesAsString());
}
writeNiFiProperties(configSchema, nifiPropertiesOutputStream);
DOMSource flowXml = createFlowXml(configSchema);
|
15,457 | writer.println("nifi.h2.url.append=;LOCK_TIMEOUT=25000;WRITE_DELAY=0;AUTO_SERVER=FALSE");
writer.println();
writer.println("# FlowFile Repository");
writer.println("nifi.flowfile.repository.implementation=org.apache.nifi.controller.repository.WriteAheadFlowFileRepository");
writer.println("nifi.flowfile.repository.directory=./flowfile_repository");
<BUG>writer.println("nifi.flowfile.repository.partitions=" + getValueString(flowfileRepo, PARTITIONS_KEY));
writer.println("nifi.flowfile.repository.checkpoint.interval=" + getValueString(flowfileRepo,CHECKPOINT_INTERVAL_KEY));
writer.println("nifi.flowfile.repository.always.sync=" + getValueString(flowfileRepo,ALWAYS_SYNC_KEY));
</BUG>
writer.println();
| writer.println("nifi.flowfile.repository.partitions=" + flowfileRepoSchema.getPartitions());
writer.println("nifi.flowfile.repository.checkpoint.interval=" + flowfileRepoSchema.getCheckpointInterval());
writer.println("nifi.flowfile.repository.always.sync=" + flowfileRepoSchema.getAlwaysSync());
|
15,458 | writer.println("# cluster manager properties (only configure for cluster manager) #");
writer.println("nifi.cluster.is.manager=false");
} catch (NullPointerException e) {
throw new ConfigurationChangeException("Failed to parse the config YAML while creating the nifi.properties", e);
} finally {
<BUG>if (writer != null){
</BUG>
writer.flush();
writer.close();
}
| if (writer != null) {
|
15,459 | writer.flush();
writer.close();
}
}
}
<BUG>private static DOMSource createFlowXml(Map<String, Object> topLevelYaml) throws IOException, ConfigurationChangeException {
</BUG>
try {
final DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
docFactory.setNamespaceAware(true);
| private static DOMSource createFlowXml(ConfigSchema configSchema) throws IOException, ConfigurationChangeException {
|
15,460 | docFactory.setNamespaceAware(true);
final DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
final Document doc = docBuilder.newDocument();
final Element rootNode = doc.createElement("flowController");
doc.appendChild(rootNode);
<BUG>Map<String, Object> processorConfig = (Map<String, Object>) topLevelYaml.get(PROCESSOR_CONFIG_KEY);
addTextElement(rootNode, "maxTimerDrivenThreadCount", getValueString(processorConfig, MAX_CONCURRENT_TASKS_KEY, "1"));
addTextElement(rootNode, "maxEventDrivenThreadCount", getValueString(processorConfig, MAX_CONCURRENT_TASKS_KEY, "1"));
addProcessGroup(rootNode, topLevelYaml, "rootGroup");
Map<String, Object> securityProps = (Map<String, Object>) topLevelYaml.get(SECURITY_PROPS_KEY);
if (securityProps != null) {
String sslAlgorithm = (String) securityProps.get(SSL_PROTOCOL_KEY);
if (sslAlgorithm != null && !(sslAlgorithm.isEmpty())) {</BUG>
final Element controllerServicesNode = doc.createElement("controllerServices");
| CorePropertiesSchema coreProperties = configSchema.getCoreProperties();
addTextElement(rootNode, "maxTimerDrivenThreadCount", String.valueOf(coreProperties.getMaxConcurrentThreads()));
addTextElement(rootNode, "maxEventDrivenThreadCount", String.valueOf(coreProperties.getMaxConcurrentThreads()));
addProcessGroup(rootNode, configSchema, "rootGroup");
SecurityPropertiesSchema securityProperties = configSchema.getSecurityProperties();
if (securityProperties.useSSL()) {
|
15,461 | throw new ConfigurationChangeException("Failed to parse the config YAML while trying to add the Provenance Reporting Task", e);
}
}
private static void addConfiguration(final Element element, Map<String, Object> elementConfig) {
final Document doc = element.getOwnerDocument();
<BUG>if (elementConfig == null){
</BUG>
return;
}
for (final Map.Entry<String, Object> entry : elementConfig.entrySet()) {
| if (elementConfig == null) {
|
15,462 | if (Validator.isNotNull(userLanguageId)) {
HttpSession session = request.getSession();
Locale locale = (Locale)session.getAttribute(
Globals.LOCALE_KEY);
if (!userLanguageId.equals(LocaleUtil.toLanguageId(locale))) {
<BUG>i18nLanguageId = LocaleUtil.toLanguageId(locale);
PortalUtil.addUserLocaleOptionsMessage(request);
}</BUG>
else {
return null;
| return LocaleUtil.toLanguageId(locale);
}
|
15,463 | else {
return null;
}
}
}
<BUG>return i18nLanguageId;
}</BUG>
@Override
protected void processFilter(
HttpServletRequest request, HttpServletResponse response,
| [DELETED] |
15,464 | Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.tab_qibla, container, false);
final QiblaCompassView qiblaCompassView = (QiblaCompassView)rootView.findViewById(R.id.qibla_compass);
qiblaCompassView.setConstants(((TextView)rootView.findViewById(R.id.bearing_north)), getText(R.string.bearing_north),
((TextView)rootView.findViewById(R.id.bearing_qibla)), getText(R.string.bearing_qibla));
<BUG>sOrientationListener = new SensorListener() {
</BUG>
public void onSensorChanged(int s, float v[]) {
float northDirection = v[SensorManager.DATA_X];
qiblaCompassView.setDirections(northDirection, sQiblaDirection);
| sOrientationListener = new android.hardware.SensorListener() {
|
15,465 | return data.build();
} finally {
dbClient.closeSession(dbSession);
}
}
<BUG>private static Paging paging(Request wsRequest, int total) {
return forPageIndex(wsRequest.mandatoryParamAsInt(PAGE))
.withPageSize(wsRequest.mandatoryParamAsInt(PAGE_SIZE))
.andTotal(total);</BUG>
}
| [DELETED] |
15,466 | package org.sonar.server.permission.ws;
import com.google.common.base.Optional;
import org.sonar.api.i18n.I18n;
import org.sonar.api.server.ws.Request;
import org.sonar.api.server.ws.Response;
<BUG>import org.sonar.api.server.ws.WebService;
import org.sonar.api.utils.Paging;</BUG>
import org.sonar.core.permission.ProjectPermissions;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
| import org.sonar.api.server.ws.WebService.Param;
import org.sonar.api.utils.Paging;
|
15,467 | import org.sonar.db.DbSession;
import org.sonar.db.component.ComponentDto;
import org.sonar.server.user.UserSession;
import org.sonarqube.ws.Common;
import org.sonarqube.ws.WsPermissions.Permission;
<BUG>import org.sonarqube.ws.WsPermissions.WsSearchProjectPermissionsResponse;
import org.sonarqube.ws.WsPermissions.WsSearchProjectPermissionsResponse.Project;
import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdminUser;</BUG>
import static org.sonar.server.permission.PermissionPrivilegeChecker.checkProjectAdminUserByComponentKey;
| import org.sonarqube.ws.WsPermissions.SearchProjectPermissionsWsResponse;
import org.sonarqube.ws.WsPermissions.SearchProjectPermissionsWsResponse.Project;
import org.sonarqube.ws.client.permission.SearchProjectPermissionsWsRequest;
import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdminUser;
|
15,468 | checkProjectAdminUserByComponentKey(userSession, project.get().key());
} else {
checkGlobalAdminUser(userSession);
}
}
<BUG>private WsSearchProjectPermissionsResponse buildResponse(SearchProjectPermissionsData data) {
WsSearchProjectPermissionsResponse.Builder response = WsSearchProjectPermissionsResponse.newBuilder();
</BUG>
Permission.Builder permissionResponse = Permission.newBuilder();
| private SearchProjectPermissionsWsResponse buildResponse(SearchProjectPermissionsData data) {
SearchProjectPermissionsWsResponse.Builder response = SearchProjectPermissionsWsResponse.newBuilder();
|
15,469 | response.addPermissions(
permissionResponse
.clear()
.setKey(permissionKey)
.setName(i18nName(permissionKey))
<BUG>.setDescription(i18nDescriptionMessage(permissionKey))
);</BUG>
}
Paging paging = data.paging();
| .setDescription(i18nDescriptionMessage(permissionKey)));
|
15,470 | Paging paging = data.paging();
response.setPaging(
Common.Paging.newBuilder()
.setPageIndex(paging.pageIndex())
.setPageSize(paging.pageSize())
<BUG>.setTotal(paging.total())
);</BUG>
return response.build();
}
| .setTotal(paging.total()));
|
15,471 | package org.sonarqube.ws.client.permission;
import org.sonarqube.ws.WsPermissions;
<BUG>import org.sonarqube.ws.WsPermissions.CreateTemplateWsResponse;
import org.sonarqube.ws.WsPermissions.WsSearchGlobalPermissionsResponse;</BUG>
import org.sonarqube.ws.client.WsClient;
import static org.sonarqube.ws.client.WsRequest.newGetRequest;
import static org.sonarqube.ws.client.WsRequest.newPostRequest;
| import org.sonarqube.ws.WsPermissions.SearchProjectPermissionsWsResponse;
import org.sonarqube.ws.WsPermissions.WsSearchGlobalPermissionsResponse;
|
15,472 | package org.neo4j.server.web;
<BUG>import com.sun.jersey.spi.container.servlet.ServletContainer;
import org.mortbay.jetty.Handler;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.handler.DefaultHandler;
import org.mortbay.jetty.handler.HandlerList;
import org.mortbay.jetty.servlet.ServletHolder;
import org.mortbay.jetty.webapp.WebAppContext;
import org.mortbay.thread.QueuedThreadPool;</BUG>
import java.net.InetAddress;
| import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.UnknownHostException;
import org.mortbay.jetty.servlet.Context;
|
15,473 | jettyPort = portNo;
}
public int getPort() {
return jettyPort;
}
<BUG>public void addPackages(String packageNames) {
</BUG>
if (packageNames == null) {
return;
}
| public void setPackages(String packageNames) {
|
15,474 | }
public NeoServer() {
StartupHealthCheck healthCheck = new StartupHealthCheck(new ConfigFileMustBePresentRule());
if(!healthCheck.run()) {
throw new StartupHealthCheckFailedException("Startup healthcheck failed, server is not properly configured. Check logs for details.");
<BUG>}
Validator validator = new Validator(new DatabaseLocationMustBeSpecifiedRule());
this.configurator = new Configurator(validator, getConfigFile());</BUG>
this.webServer = new Jetty6WebServer();
this.database = new Database(configurator.configuration().getString(DATABASE_LOCATION));
| this.configurator = new Configurator(new Validator(new DatabaseLocationMustBeSpecifiedRule()), getConfigFile());
|
15,475 | this.database = new Database(configurator.configuration().getString(DATABASE_LOCATION));
}
public Integer start(String[] args) {
try {
webServer.setPort(configurator.configuration().getInt(WEBSERVER_PORT, DEFAULT_WEBSERVER_PORT));
<BUG>webServer.addPackages(convertPropertiesToSingleString(configurator.configuration().getStringArray(WEBSERVICE_PACKAGES)));
</BUG>
webServer.start();
log.info("Started Neo Server on port [%s]", webServer.getPort());
return 0;
| webServer.setPackages(convertPropertiesToSingleString(configurator.configuration().getStringArray(WEBSERVICE_PACKAGES)));
|
15,476 | package org.neo4j.server.web;
import java.net.URI;
import java.net.URISyntaxException;
public interface WebServer {
<BUG>public void addPackages(String packageNames);
</BUG>
public void setPort(int portNo);
public int getPort();
public void start();
| public void setPackages(String packageNames);
|
15,477 | public class NeoServerTest {
@Test
public void whenServerIsStartedItShouldBringUpAWebServerWithWelcomePage() throws Exception {
NeoServer server = server();
server.start(null);
<BUG>ClientResponse response = Client.create().resource("http://localhost:7474/").get(ClientResponse.class);
</BUG>
assertEquals(200, response.getStatus());
assertThat(response.getHeaders().getFirst("Content-Type"), containsString("text/html"));
assertThat(response.getEntity(String.class), containsString("Welcome"));
| ClientResponse response = Client.create().resource(server.webServer().getWelcomeUri()).get(ClientResponse.class);
|
15,478 | WebServer webServer = webServer();
return new NeoServer(configurator, db, webServer);
}
private WebServer webServer() {
WebServer webServer = new Jetty6WebServer();
<BUG>webServer.addPackages("org.neo4j.server.web");
</BUG>
return webServer;
}
private Configurator configurator() throws IOException {
| webServer.setPackages("org.neo4j.server.web");
|
15,479 | Document doc = DOMUtils.createDocument();
readDocElements(doc, reader, true);
return doc;
}
public static Document read(XMLStreamReader reader, boolean recordLoc) throws XMLStreamException {
<BUG>Document doc = DOMUtils.createDocument();
doc.setDocumentURI(new String(reader.getLocation().getSystemId()));
readDocElements(doc, doc, reader, true, recordLoc);</BUG>
return doc;
}
| if (reader.getLocation().getSystemId() != null) {
readDocElements(doc, doc, reader, true, recordLoc);
|
15,480 | catLocator,
bus);
InputSource src = wsdlLocator.getBaseInputSource();
Document doc;
try {
<BUG>doc = StaxUtils.read(StaxUtils.createXMLStreamReader(src), true);
doc.setDocumentURI(new String(src.getSystemId()));
} catch (Exception e) {</BUG>
throw new WSDLException(WSDLException.PARSER_ERROR, e.getMessage(), e);
}
| if (src.getSystemId() != null) {
} catch (Exception e) {
|
15,481 | }
@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)
|
15,482 | 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))
|
15,483 | }
@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);
|
15,484 | 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);
|
15,485 | 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);
|
15,486 | 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);
|
15,487 | public void onStateCreated (TileEntitySmithsCore tileEntitySmithsCore) {
parent = tileEntitySmithsCore;
}
@Override
public void onStateUpdated () {
<BUG>TileEntityDataUpdatedEvent event = new TileEntityDataUpdatedEvent(parent);
event.PostCommon();</BUG>
}
@Override
public void onStateDestroyed () {
| [DELETED] |
15,488 | package com.SmithsModding.Armory.Common.Block;
import com.SmithsModding.Armory.*;
import com.SmithsModding.Armory.Common.Registry.*;
import com.SmithsModding.Armory.Common.TileEntity.State.*;
import com.SmithsModding.Armory.Common.TileEntity.*;
<BUG>import com.SmithsModding.Armory.Util.*;
import com.SmithsModding.SmithsCore.Common.Structures.*;
import net.minecraft.block.*;</BUG>
import net.minecraft.block.material.*;
import net.minecraft.block.properties.*;
| import com.SmithsModding.SmithsCore.Client.Block.*;
import com.SmithsModding.SmithsCore.*;
import net.minecraft.block.*;
|
15,489 | }
private ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[]{OBJModel.OBJProperty.instance});
public BlockFirePit () {
super(References.InternalNames.Blocks.FirePit, Material.iron);
setCreativeTab(CreativeTabs.tabCombat);
<BUG>this.setDefaultState(this.blockState.getBaseState().withProperty(BURNING, false));
</BUG>
}
public static void setBurningState (boolean burning, World worldIn, BlockPos pos) {
IBlockState original = worldIn.getBlockState(pos);
| this.setDefaultState(this.blockState.getBaseState().withProperty(BURNING, false).withProperty(ISMASTER, false));
|
15,490 | if (m.getReturnType() != Void.class && m.getParameterTypes().length == 0) {
final int index = getterIndex(m.getName());
if (index != -1) {
String setterName = "set" + m.getName().substring(index);
Class<?> paramTypes = m.getReturnType();
<BUG>Method setter = getDeclaredMethod(declaringClass, setterName, paramTypes);
if (setter != null && !setter.isAnnotationPresent(XmlTransient.class)) {</BUG>
return true;
}
}
| if (setter == null) {
|
15,491 | setter = method.getDeclaringClass()
.getMethod("set" + method.getName().substring(beginIndex),
new Class[] {method.getReturnType()});
} catch (Exception e) {
}
<BUG>if (setter == null
|| setter.isAnnotationPresent(XmlTransient.class)
|| !Modifier.isPublic(setter.getModifiers())) {
</BUG>
return false;
| [DELETED] |
15,492 | Method m = Utils.getMethod(cls, accessType, "get" + s);
if (m == null) {
m = Utils.getMethod(cls, accessType, "is" + s);
}
Type type = m.getGenericReturnType();
<BUG>Method m2 = Utils.getMethod(cls, accessType, "set" + s, m.getReturnType());
if (JAXBSchemaInitializer.isArray(type)) {</BUG>
Class<?> compType = JAXBSchemaInitializer
.getArrayComponentType(type);
List<Object> ret = unmarshallArray(u, reader,
| Object o = null;
if (JAXBSchemaInitializer.isArray(type)) {
|
15,493 | .getArrayComponentType(type);
List<Object> ret = unmarshallArray(u, reader,
q,
compType,
createList(type));
<BUG>Object o = ret;
if (!isList(type)) {</BUG>
if (compType.isPrimitive()) {
o = java.lang.reflect.Array.newInstance(compType, ret.size());
for (int x = 0; x < ret.size(); x++) {
| if (!isList(type)) {
|
15,494 | import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLDecoder;
<BUG>import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
</BUG>
import java.util.Map.Entry;
| import java.util.*;
|
15,495 | table.getTypeName() + ".delete", // className
sb.toString(), // singleStmt
null, // joinOrder
partitioninfo, // table.column:offset
true); // builtin statement
<BUG>compilerLog.debug("Synthesized built-in DELETE procedure: " +
</BUG>
sb.toString() + " for " + table.getTypeName() + " with partitioning: " +
partitioninfo);
return pd;
| compilerLog.info("Synthesized built-in DELETE procedure: " +
|
15,496 | private ProcedureDescriptor generateCrudSelect(Table table,
Column partitioncolumn, Constraint pkey)
{
StringBuilder sb = new StringBuilder();
sb.append("SELECT * FROM " + table.getTypeName());
<BUG>int partitionoffset =
generateCrudPKeyWhereClause(partitioncolumn, pkey, -1, sb);
String partitioninfo =
table.getTypeName() + "." + partitioncolumn.getName() + ":" + partitionoffset;
</BUG>
ProcedureDescriptor pd =
| int partitionOffset =
generateCrudPKeyWhereClause(partitioncolumn, pkey, sb);
table.getTypeName() + "." + partitioncolumn.getName() + ":" + partitionOffset;
|
15,497 | "CREATE UNIQUE INDEX p3_tree_idx ON p3(a1);"
);
project.addPartitionInfo("p3", "a2");
project.addLiteralSchema(
"CREATE TABLE r1(a1 INTEGER NOT NULL, a2 VARCHAR(10) NOT NULL, PRIMARY KEY (a1));"
<BUG>);
} catch (IOException error) {</BUG>
fail(error.getMessage());
}
config = new LocalSingleProcessServer("sqltypes-onesite.jar", 1, BackendTarget.NATIVE_EE_JNI);
| "CREATE TABLE p4(z INTEGER NOT NULL, x VARCHAR(10) NOT NULL, y INTEGER NOT NULL, PRIMARY KEY(y,x,z));"
project.addPartitionInfo("p4", "y");
} catch (IOException error) {
|
15,498 | boolean isNull = valueMeta.isNull( valueData );
if ( !field.isNullAllowed() && isNull ) {
KettleValidatorException exception =
new KettleValidatorException( this, field, KettleValidatorException.ERROR_NULL_VALUE_NOT_ALLOWED,
BaseMessages.getString( PKG, "Validator.Exception.NullNotAllowed", field.getFieldName(), inputRowMeta
<BUG>.getString( r ) ), field.getFieldName() );
if ( meta.isValidatingAll() ) {
exceptions.add( exception );
} else {
throw exception;
</BUG>
}
| if ( !meta.isValidatingAll() ) {
return exceptions;
|
15,499 | if ( field.isDataTypeVerified() && field.getDataType() != ValueMetaInterface.TYPE_NONE ) {
if ( field.getDataType() != valueMeta.getType() ) {
KettleValidatorException exception =
new KettleValidatorException( this, field, KettleValidatorException.ERROR_UNEXPECTED_DATA_TYPE,
BaseMessages.getString( PKG, "Validator.Exception.UnexpectedDataType", field.getFieldName(),
<BUG>valueMeta.toStringMeta(), validatorMeta.toStringMeta() ), field.getFieldName() );
if ( meta.isValidatingAll() ) {
exceptions.add( exception );
} else {
throw exception;
</BUG>
}
| if ( !meta.isValidatingAll() ) {
return exceptions;
|
15,500 | if ( data.fieldsMinimumLengthAsInt[i] >= 0 && stringLength < data.fieldsMinimumLengthAsInt[i] ) {
KettleValidatorException exception =
new KettleValidatorException( this, field, KettleValidatorException.ERROR_SHORTER_THAN_MINIMUM_LENGTH,
BaseMessages.getString( PKG, "Validator.Exception.ShorterThanMininumLength", field.getFieldName(),
valueMeta.getString( valueData ), Integer.toString( stringValue.length() ), field
<BUG>.getMinimumLength() ), field.getFieldName() );
if ( meta.isValidatingAll() ) {
exceptions.add( exception );
} else {
throw exception;
</BUG>
}
| if ( !meta.isValidatingAll() ) {
return exceptions;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.