output stringlengths 64 73.2k | input stringlengths 208 73.3k | instruction stringclasses 1
value |
|---|---|---|
#fixed code
public void shutdown() throws InterruptedException {
//remove all webServices
WebService[] services;
synchronized (this){
services = new WebService[registeredServices.values().size()];
registeredServices.values().toArray(servic... | #vulnerable code
public void shutdown(){
//remove all webServices
WebService[] services;
synchronized (this){
services = new WebService[registeredServices.values().size()];
registeredServices.values().toArray(services);
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent me) throws Exception {
super.messageReceived(ctx, me);
} | #vulnerable code
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent me){
if(!(me.getMessage() instanceof CoapMessage)){
ctx.sendUpstream(me);
return;
}
CoapMessage coapMessage = (CoapMessage) me.getMessage()... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void receiveResponse(CoapResponse coapResponse) {
receivedResponses.put(System.currentTimeMillis(), coapResponse);
} | #vulnerable code
@Override
public void receiveResponse(CoapResponse coapResponse) {
if (receiveEnabled) {
receivedResponses.put(System.currentTimeMillis(), coapResponse);
}
}
#location 3
#vuln... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent me) throws Exception {
super.messageReceived(ctx, me);
} | #vulnerable code
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent me){
if(!(me.getMessage() instanceof CoapMessage)){
ctx.sendUpstream(me);
return;
}
CoapMessage coapMessage = (CoapMessage) me.getMessage()... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent me) throws Exception {
super.messageReceived(ctx, me);
} | #vulnerable code
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent me){
if(!(me.getMessage() instanceof CoapMessage)){
ctx.sendUpstream(me);
return;
}
CoapMessage coapMessage = (CoapMessage) me.getMessage()... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void writeRequested(ChannelHandlerContext ctx, MessageEvent me) throws Exception{
if(!(me.getMessage() instanceof CoapMessage)){
ctx.sendDownstream(me);
return;
}
CoapMessage coapMessage = (CoapMessage) me... | #vulnerable code
@Override
public void writeRequested(ChannelHandlerContext ctx, MessageEvent me) throws Exception{
if(!(me.getMessage() instanceof CoapMessage)){
ctx.sendDownstream(me);
return;
}
CoapMessage coapMessage = (CoapMessa... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void getChannelNameFromMessageTest() throws IOException, InvocationTargetException, IllegalAccessException {
Method method = MethodUtils.getMatchingMethod(HitbtcStreamingService.class, "getChannelNameFromMessage", JsonNode.class);
method.set... | #vulnerable code
@Test
public void getChannelNameFromMessageTest() throws IOException, InvocationTargetException, IllegalAccessException {
Method method = MethodUtils.getMatchingMethod(HitbtcStreamingService.class, "getChannelNameFromMessage", JsonNode.class);
meth... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void dup2Test() throws Throwable {
File tmp = File.createTempFile("dupTest", "tmp");
int oldFd = posix.open(tmp.getAbsolutePath(), OpenFlags.O_RDWR.intValue(), 0666);
int newFd = 1000;
byte[] outContent = "foo".getBytes();
... | #vulnerable code
@Test
public void dup2Test() throws Throwable {
File tmp = File.createTempFile("dupTest", "tmp");
RandomAccessFile raf = new RandomAccessFile(tmp, "rw");
int oldFd = getFdFromDescriptor(JavaLibCHelper.getDescriptorFromChannel(new RandomAccess... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void fcntlDupfdWithArgTest() throws Throwable {
File tmp = File.createTempFile("dupTest", "tmp");
int oldFd = JavaLibCHelper.getfdFromDescriptor(JavaLibCHelper.getDescriptorFromChannel(
new RandomAccessFile(tmp, "rw").getChanne... | #vulnerable code
@Test
public void fcntlDupfdWithArgTest() throws Throwable {
File tmp = File.createTempFile("dupTest", "tmp");
RandomAccessFile raf = new RandomAccessFile(tmp, "rw");
int oldFd = JavaLibCHelper.getfdFromDescriptor(JavaLibCHelper.getDescriptor... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void getgroups() throws Throwable {
if (jnr.ffi.Platform.getNativePlatform().isUnix()) {
String[] groupIdsAsStrings = exec("id -G").split(" ");
long[] expectedGroupIds = new long[groupIdsAsStrings.length];
for (int... | #vulnerable code
@Test
public void getgroups() throws Throwable {
if (jnr.ffi.Platform.getNativePlatform().isUnix()) {
InputStreamReader isr = null;
BufferedReader reader = null;
try {
isr = new InputStreamReader(Runtime.g... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public int fpathconf(int fd, Pathconf name) {
return posix().fpathconf(fd, name);
} | #vulnerable code
public int fpathconf(int fd, Pathconf name) {
return libc().fpathconf(fd, name);
}
#location 2
#vulnerability type NULL_DEREFERENCE | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void fcntlDupfdTest() throws Throwable {
if (!Platform.IS_WINDOWS) {
File tmp = File.createTempFile("fcntlTest", "tmp");
int fd = posix.open(tmp.getPath(), OpenFlags.O_RDWR.intValue(), 0444);
byte[] outContent = "f... | #vulnerable code
@Test
public void fcntlDupfdTest() throws Throwable {
if (!Platform.IS_WINDOWS) {
File tmp = File.createTempFile("fcntlTest", "tmp");
RandomAccessFile raf = new RandomAccessFile(tmp, "rw");
int fd = JavaLibCHelper.getfdFro... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public int confstr(Confstr name, ByteBuffer buf, int len) {
return posix().confstr(name, buf, len);
} | #vulnerable code
public int confstr(Confstr name, ByteBuffer buf, int len) {
return libc().confstr(name, buf, len);
}
#location 2
#vulnerability type NULL_DEREFERENCE | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void fcntlDupfdTest() throws Throwable {
if (!Platform.IS_WINDOWS) {
File tmp = File.createTempFile("fcntlTest", "tmp");
int fd = posix.open(tmp.getPath(), OpenFlags.O_RDWR.intValue(), 0444);
byte[] outContent = "f... | #vulnerable code
@Test
public void fcntlDupfdTest() throws Throwable {
if (!Platform.IS_WINDOWS) {
File tmp = File.createTempFile("fcntlTest", "tmp");
RandomAccessFile raf = new RandomAccessFile(tmp, "rw");
int fd = JavaLibCHelper.getfdFro... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public FileStat allocateStat() {
if (freebsdVersion >= 12) {
return new FreeBSDFileStat12(this);
} else {
return new FreeBSDFileStat(this);
}
} | #vulnerable code
public FileStat allocateStat() {
if (System.getProperty("os.version").compareTo("12.0") > 0) {
return new FreeBSDFileStat12(this);
} else {
return new FreeBSDFileStat(this);
}
}
#location 2... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void fcntlDupfdWithArgTest() throws Throwable {
File tmp = File.createTempFile("dupTest", "tmp");
int oldFd = JavaLibCHelper.getfdFromDescriptor(JavaLibCHelper.getDescriptorFromChannel(
new RandomAccessFile(tmp, "rw").getChanne... | #vulnerable code
@Test
public void fcntlDupfdWithArgTest() throws Throwable {
File tmp = File.createTempFile("dupTest", "tmp");
RandomAccessFile raf = new RandomAccessFile(tmp, "rw");
int oldFd = JavaLibCHelper.getfdFromDescriptor(JavaLibCHelper.getDescriptor... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void stopRecording() throws IOException {
Integer processId = androidScreenRecordProcess.get(Thread.currentThread().getId());
if (processId != -1) {
String process =
"pgrep -P " + processId;
System.out.println(pro... | #vulnerable code
public void stopRecording() throws IOException {
if (androidScreenRecordProcess.get(Thread.currentThread().getId()) != -1) {
String process =
"pgrep -P " + androidScreenRecordProcess.get(Thread.currentThread().getId());
Sy... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void triggerTest(String pack, List<String> tests) throws Exception {
parallelExecution(pack, tests);
} | #vulnerable code
public void triggerTest(String pack, List<String> tests) throws Exception {
String operSys = System.getProperty("os.name").toLowerCase();
File f = new File(System.getProperty("user.dir") + "/target/appiumlogs/");
if (!f.exists()) {
S... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void startAppiumServer(String host) throws Exception {
System.out.println(
"**************************************************************************\n");
System.out.println("Starting Appium Server on host " + host);
... | #vulnerable code
@Override
public void startAppiumServer(String host) throws Exception {
System.out.println(
"**************************************************************************\n");
System.out.println("Starting Appium Server on host " + host);... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public DesiredCapabilities buildDesiredCapability(String platform,
String jsonPath) throws Exception {
final boolean[] flag = {false};
System.out.println("DeviceMappy-----" + DeviceAllocationManager.getInst... | #vulnerable code
public DesiredCapabilities buildDesiredCapability(String platform,
String jsonPath) throws Exception {
final boolean[] flag = {false};
DesiredCapabilities desiredCapabilities = new DesiredCapabilities... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@SuppressWarnings({ "rawtypes" })
public void runner(String pack) throws Exception {
File f = new File(System.getProperty("user.dir") + "/target/appiumlogs/");
if (!f.exists()) {
System.out.println("creating directory: " + "Logs");
boolean result = false;
try {
... | #vulnerable code
@SuppressWarnings({ "rawtypes" })
public void runner(String pack) throws Exception {
File f = new File(System.getProperty("user.dir") + "/target/appiumlogs/");
if (!f.exists()) {
System.out.println("creating directory: " + "Logs");
boolean result = false;
try... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void captureScreenShot(String screenShotName) throws IOException, InterruptedException {
File framePath = new File(System.getProperty("user.dir")+"/src/main/resources/");
File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
... | #vulnerable code
public void captureScreenShot(String screenShotName) throws IOException, InterruptedException {
File framePath = new File(System.getProperty("user.dir")+"/src/main/resources/");
File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public List<Device> getDevices(String machineIP, String platform) throws Exception {
ObjectMapper mapper = new ObjectMapper()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
List<Device> devices = new ArrayLi... | #vulnerable code
@Override
public List<Device> getDevices(String machineIP, String platform) throws Exception {
ObjectMapper mapper = new ObjectMapper()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
List<Device> devices = null;... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@SuppressWarnings("unused")
public void convertXmlToJSon() throws IOException{
String fileName = "report.json";
BufferedWriter bufferedWriter = null;
try {
int i = 1;
FileWriter fileWriter;
int dir_1 = new File(System.getProperty("user.dir") + "/test-output/junit... | #vulnerable code
@SuppressWarnings("unused")
public void convertXmlToJSon() throws IOException{
String fileName = "report.json";
BufferedWriter bufferedWriter = null;
try {
FileWriter fileWriter;
List textFiles = new ArrayList();
File dir = new File(System.getPro... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public XmlSuite constructXmlSuiteForDistribution(String pack, List<String> tests,
Map<String, List<Method>> methods, int deviceCount) {
ArrayList<String> listeners = new ArrayList<>();
try {
prop.load(new FileInputStream("config.properties"... | #vulnerable code
public XmlSuite constructXmlSuiteForDistribution(String pack, List<String> tests,
Map<String, List<Method>> methods, int deviceCount) {
ArrayList<String> items = new ArrayList<>();
try {
prop.load(new FileInputStream("config.propertie... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public XmlSuite constructXmlSuiteDistributeCucumber(
int deviceCount, ArrayList<String> deviceSerail) {
XmlSuite suite = new XmlSuite();
suite.setName("TestNG Forum");
suite.setThreadCount(deviceCount);
suite.setParallel(ParallelMod... | #vulnerable code
public XmlSuite constructXmlSuiteDistributeCucumber(
int deviceCount, ArrayList<String> deviceSerail) {
try {
prop.load(new FileInputStream("config.properties"));
} catch (IOException e) {
e.printStackTrace();
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private boolean parallelExecution(String pack, List<String> tests) throws Exception {
String os = System.getProperty("os.name").toLowerCase();
String platform = System.getenv("Platform");
HostMachineDeviceManager hostMachineDeviceManager = HostMachineD... | #vulnerable code
private boolean parallelExecution(String pack, List<String> tests) throws Exception {
String os = System.getProperty("os.name").toLowerCase();
String platform = System.getProperty("Platform");
HostMachineDeviceManager hostMachineDeviceManager = H... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public XmlSuite constructXmlSuiteForParallelCucumber(
int deviceCount, ArrayList<String> deviceSerail) {
XmlSuite suite = new XmlSuite();
suite.setName("TestNG Forum");
suite.setThreadCount(deviceCount);
suite.setParallel(ParallelMode.T... | #vulnerable code
public XmlSuite constructXmlSuiteForParallelCucumber(
int deviceCount, ArrayList<String> deviceSerail) {
try {
prop.load(new FileInputStream("config.properties"));
} catch (IOException e) {
e.printStackTrace();
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public ArrayList<String> getDeviceSerial() throws Exception {
startADB(); // start adb service
String output = cmd.runCommand("adb devices");
String[] lines = output.split("\n");
if (lines.length <= 1) {
System.out.println("No And... | #vulnerable code
public ArrayList<String> getDeviceSerial() throws Exception {
startADB(); // start adb service
String output = cmd.runCommand("adb devices");
String[] lines = output.split("\n");
if (lines.length <= 1) {
System.out.println("... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public AppiumServiceBuilder getAppiumServiceBuilder(String methodName) throws Exception {
String webKitPort = iosDevice.startIOSWebKit(device_udid);
return appiumMan.appiumServerForIOS(device_udid, methodName, webKitPort);
} | #vulnerable code
public AppiumServiceBuilder getAppiumServiceBuilder(String methodName) throws Exception {
if (iosDevice.checkiOSDevice(device_udid)) {
String webKitPort = iosDevice.startIOSWebKit(device_udid);
return appiumMan.appiumServerForIOS(device_u... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public synchronized static ExtentReports getExtent() {
if (extent == null) {
try {
configFileManager = ConfigFileManager.getInstance();
extent = new ExtentReports();
extent.attachReporter(getHtmlReporter());
... | #vulnerable code
public synchronized static ExtentReports getExtent() {
if (extent == null) {
try {
configFileManager = ConfigFileManager.getInstance();
extent = new ExtentReports();
extent.attachReporter(getHtmlReporte... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public String getIOSDeviceProductTypeAndVersion(String udid) throws InterruptedException, IOException {
return commandPrompt.runCommandThruProcessBuilder("ideviceinfo --udid "+udid+" | grep ProductType");
} | #vulnerable code
public String getIOSDeviceProductTypeAndVersion(String udid) throws InterruptedException, IOException {
System.out.println("ideviceinfo --udid " + udid + " | grep ProductType");
System.out.println("ideviceinfo --udid " + udid + " | grep ProductVersion");
String produ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void stopRecording() throws IOException {
Integer processId = androidScreenRecordProcess.get(Thread.currentThread().getId());
stopRunningProcess(processId);
} | #vulnerable code
public void stopRecording() throws IOException {
Integer processId = androidScreenRecordProcess.get(Thread.currentThread().getId());
if (processId != -1) {
String process = "pgrep -P " + processId;
System.out.println(process);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public synchronized AppiumServiceBuilder startAppiumServer(String methodName) throws Exception {
device_udid = getNextAvailableDeviceId();
if (device_udid == null) {
System.out.println("No devices are free to run test or Failed to run test");
... | #vulnerable code
public synchronized AppiumServiceBuilder startAppiumServer(String methodName) throws Exception {
device_udid = getNextAvailableDeviceId();
if (device_udid == null) {
System.out.println("No devices are free to run test or Failed to run test");... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public boolean parallelExecution(String pack, List<String> tests) throws Exception {
String operSys = System.getProperty("os.name").toLowerCase();
File f = new File(System.getProperty("user.dir") + "/target/appiumlogs/");
if (!f.exists()) {
... | #vulnerable code
public boolean parallelExecution(String pack, List<String> tests) throws Exception {
String operSys = System.getProperty("os.name").toLowerCase();
File f = new File(System.getProperty("user.dir") + "/target/appiumlogs/");
if (!f.exists()) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public synchronized AppiumDriver<MobileElement> startAppiumServerInParallel(String methodName)
throws Exception {
ExtentTestManager.loadConfig();
if (prop.getProperty("FRAMEWORK").equalsIgnoreCase("testng")) {
child = ExtentTestManager.star... | #vulnerable code
public synchronized AppiumDriver<MobileElement> startAppiumServerInParallel(String methodName)
throws Exception {
ExtentTestManager.loadConfig();
if (prop.getProperty("FRAMEWORK").equalsIgnoreCase("testng")) {
child = ExtentTestManage... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public AppiumServiceBuilder getAppiumServiceBuilder(String methodName) throws Exception {
String webKitPort = iosDevice.startIOSWebKit(device_udid);
return appiumMan.appiumServerForIOS(device_udid, methodName, webKitPort);
} | #vulnerable code
public AppiumServiceBuilder getAppiumServiceBuilder(String methodName) throws Exception {
if (iosDevice.checkiOSDevice(device_udid)) {
String webKitPort = iosDevice.startIOSWebKit(device_udid);
return appiumMan.appiumServerForIOS(device_u... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void startingServerInstance() throws Exception {
startingServerInstance(null, null);
} | #vulnerable code
public void startingServerInstance() throws Exception {
if (prop.getProperty("APP_TYPE").equalsIgnoreCase("web")) {
driver = new AndroidDriver<>(appiumMan.getAppiumUrl(), androidWeb());
} else {
if (System.getProperty("os.name").t... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void stopRecording() throws IOException {
Integer processId = androidScreenRecordProcess.get(Thread.currentThread().getId());
if (processId != -1) {
String process = "pgrep -P " + processId;
System.out.println(process);
... | #vulnerable code
public void stopRecording() throws IOException {
Integer processId = androidScreenRecordProcess.get(Thread.currentThread().getId());
if (processId != -1) {
String process = "pgrep -P " + processId;
System.out.println(process);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public String runCommandThruProcessBuilder(String command)
throws InterruptedException, IOException {
BufferedReader br = getBufferedReader(command);
String line;
String allLine = "";
while ((line = br.readLine()) != null) {
... | #vulnerable code
public String runCommandThruProcessBuilder(String command)
throws InterruptedException, IOException {
List<String> commands = new ArrayList<String>();
commands.add("/bin/sh");
commands.add("-c");
commands.add(command);
Pro... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@SuppressWarnings({ "rawtypes" })
public void runner(String pack) throws Exception {
File f = new File(System.getProperty("user.dir") + "/target/appiumlogs/");
if (!f.exists()) {
System.out.println("creating directory: " + "Logs");
boolean result = false;
try {
... | #vulnerable code
@SuppressWarnings({ "rawtypes" })
public void runner(String pack) throws Exception {
File f = new File(System.getProperty("user.dir") + "/target/appiumlogs/");
if (!f.exists()) {
System.out.println("creating directory: " + "Logs");
boolean result = false;
try... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void startingServerInstance() throws Exception {
startingServerInstance(null, null);
} | #vulnerable code
public void startingServerInstance() throws Exception {
if (prop.getProperty("APP_TYPE").equalsIgnoreCase("web")) {
driver = new AndroidDriver<>(appiumMan.getAppiumUrl(), androidWeb());
} else {
if (System.getProperty("os.name").t... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public String getAppiumServerPath(String host) throws Exception {
return appiumServerProp(host, "appiumServerPath");
} | #vulnerable code
public String getAppiumServerPath(String host) throws Exception {
JSONArray hostMachineObject = CapabilityManager.getInstance().getHostMachineObject();
List<Object> objects = hostMachineObject.toList();
Object o = objects.stream().filter(object -... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public Map<String, String> getDevices() throws Exception {
startADB(); // start adb service
String output = cmd.runCommand("adb devices");
String[] lines = output.split("\n");
if (lines.length <= 1) {
System.out.println("No Androi... | #vulnerable code
public Map<String, String> getDevices() throws Exception {
startADB(); // start adb service
String output = cmd.runCommand("adb devices");
String[] lines = output.split("\n");
if (lines.length <= 1) {
System.out.println("No ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void startAppiumDriverInstance(Optional<DesiredCapabilities> iosCaps,
Optional<DesiredCapabilities> androidCaps)
throws Exception {
AppiumDriver<MobileElement> currentDriverSession;
if (System.getP... | #vulnerable code
private void startAppiumDriverInstance(Optional<DesiredCapabilities> iosCaps,
Optional<DesiredCapabilities> androidCaps)
throws Exception {
AppiumDriver<MobileElement> currentDriverSession;
if (Syste... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public String getRemoteWDHubIP(String host) throws Exception {
String hostIP = "http://" + host;
String appiumRunningPort = new JSONObject(new Api().getResponse(hostIP
+ ":" + getRemoteAppiumManagerPort(host)
+ "/a... | #vulnerable code
@Override
public String getRemoteWDHubIP(String host) throws IOException {
String hostIP = "http://" + host;
String appiumRunningPort = new JSONObject(new Api().getResponse(hostIP + ":4567"
+ "/appium/isRunning").body().string()).get(... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public synchronized AppiumDriver<MobileElement> startAppiumServerInParallel(String methodName)
throws Exception {
ExtentTestManager.loadConfig();
if (prop.getProperty("FRAMEWORK").equalsIgnoreCase("testng")) {
child = ExtentTestManager.star... | #vulnerable code
public synchronized AppiumDriver<MobileElement> startAppiumServerInParallel(String methodName)
throws Exception {
ExtentTestManager.loadConfig();
if (prop.getProperty("FRAMEWORK").equalsIgnoreCase("testng")) {
child = ExtentTestManage... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void startingServerInstance() throws Exception {
startingServerInstance(null, null);
} | #vulnerable code
public void startingServerInstance() throws Exception {
if (prop.getProperty("APP_TYPE").equalsIgnoreCase("web")) {
driver = new AndroidDriver<>(appiumMan.getAppiumUrl(), androidWeb());
} else {
if (System.getProperty("os.name").t... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public AppiumServiceBuilder getAppiumServiceBuilder(String methodName) throws Exception {
String webKitPort = iosDevice.startIOSWebKit(device_udid);
return appiumMan.appiumServerForIOS(device_udid, methodName, webKitPort);
} | #vulnerable code
public AppiumServiceBuilder getAppiumServiceBuilder(String methodName) throws Exception {
if (iosDevice.checkiOSDevice(device_udid)) {
String webKitPort = iosDevice.startIOSWebKit(device_udid);
return appiumMan.appiumServerForIOS(device_u... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private HashMap<String, String> getArtifactForHost(String hostMachine) throws IOException {
String platform = System.getenv("Platform");
String app = "app";
HashMap<String, String> artifactPaths = new HashMap<>();
JSONObject android = capabilit... | #vulnerable code
private HashMap<String, String> getArtifactForHost(String hostMachine) throws IOException {
String platform = System.getProperty("Platform");
String app = "app";
HashMap<String, String> artifactPaths = new HashMap<>();
JSONObject android ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void startAppiumServer(String host) throws Exception {
System.out.println(
"**************************************************************************\n");
System.out.println("Starting Appium Server on host " + host);
... | #vulnerable code
@Override
public void startAppiumServer(String host) throws Exception {
System.out.println(
"**************************************************************************\n");
System.out.println("Starting Appium Server on host " + host);... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public synchronized AppiumServiceBuilder startAppiumServer(String methodName) throws Exception {
device_udid = getNextAvailableDeviceId();
if (device_udid == null) {
System.out.println("No devices are free to run test or Failed to run test");
... | #vulnerable code
public synchronized AppiumServiceBuilder startAppiumServer(String methodName) throws Exception {
device_udid = getNextAvailableDeviceId();
if (device_udid == null) {
System.out.println("No devices are free to run test or Failed to run test");... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public synchronized AppiumDriver<MobileElement> startAppiumServerInParallel(String methodName) throws Exception {
child = ExtentTestManager
.startTest(methodName).assignCategory(category + device_udid.replaceAll("\\W", "_"));
if (prop.getProper... | #vulnerable code
public synchronized AppiumDriver<MobileElement> startAppiumServerInParallel(String methodName) throws Exception {
child = ExtentTestManager
.startTest(methodName).assignCategory(category + device_udid.replaceAll("\\W", "_"));
if (prop.get... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public XmlSuite constructXmlSuiteForDistribution(String pack, List<String> tests,
Map<String, List<Method>> methods, int deviceCount) {
include(listeners, "LISTENERS");
include(groupsInclude, "INCLUDE_GROUPS");
XmlSuite suite = new XmlSuite();
... | #vulnerable code
public XmlSuite constructXmlSuiteForDistribution(String pack, List<String> tests,
Map<String, List<Method>> methods, int deviceCount) {
try {
prop.load(new FileInputStream("config.properties"));
} catch (IOException e) {
e... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void startingServerInstance() throws Exception {
startingServerInstance(null, null);
} | #vulnerable code
public void startingServerInstance() throws Exception {
if (prop.getProperty("APP_TYPE").equalsIgnoreCase("web")) {
driver = new AndroidDriver<>(appiumMan.getAppiumUrl(), androidWeb());
} else {
if (System.getProperty("os.name").t... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public AppiumServiceBuilder getAppiumServiceBuilder(String methodName) throws Exception {
String webKitPort = iosDevice.startIOSWebKit(device_udid);
return appiumMan.appiumServerForIOS(device_udid, methodName, webKitPort);
} | #vulnerable code
public AppiumServiceBuilder getAppiumServiceBuilder(String methodName) throws Exception {
if (iosDevice.checkiOSDevice(device_udid)) {
String webKitPort = iosDevice.startIOSWebKit(device_udid);
return appiumMan.appiumServerForIOS(device_u... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void captureScreenShot(String screenShotName) throws IOException, InterruptedException {
File framePath = new File(System.getProperty("user.dir")+"/src/main/resources/");
File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
... | #vulnerable code
public void captureScreenShot(String screenShotName) throws IOException, InterruptedException {
File framePath = new File(System.getProperty("user.dir")+"/src/main/resources/");
File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void endLogTestResults(ITestResult result) throws IOException, InterruptedException {
final String classNameCur = result.getName().split(" ")[2].substring(1);
final Package[] packages = Package.getPackages();
String className = null;
fo... | #vulnerable code
public void endLogTestResults(ITestResult result) throws IOException, InterruptedException {
final String classNameCur = result.getName().split(" ")[2].substring(1);
final Package[] packages = Package.getPackages();
String className = null;
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public synchronized AppiumDriver<MobileElement> startAppiumServerInParallel(String methodName)
throws Exception {
ExtentTestManager.loadConfig();
if (prop.getProperty("FRAMEWORK").equalsIgnoreCase("testng")) {
child = ExtentTestManager.star... | #vulnerable code
public synchronized AppiumDriver<MobileElement> startAppiumServerInParallel(String methodName)
throws Exception {
ExtentTestManager.loadConfig();
if (prop.getProperty("FRAMEWORK").equalsIgnoreCase("testng")) {
child = ExtentTestManage... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public synchronized AppiumServiceBuilder startAppiumServer(String methodName) throws Exception {
device_udid = getNextAvailableDeviceId();
if (device_udid == null) {
System.out.println("No devices are free to run test or Failed to run test");
... | #vulnerable code
public synchronized AppiumServiceBuilder startAppiumServer(String methodName) throws Exception {
device_udid = getNextAvailableDeviceId();
if (device_udid == null) {
System.out.println("No devices are free to run test or Failed to run test");... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public Map<String, String> getDevices() throws Exception {
startADB(); // start adb service
String output = cmd.runCommand("adb devices");
String[] lines = output.split("\n");
if (lines.length <= 1) {
System.out.println("No Androi... | #vulnerable code
public Map<String, String> getDevices() throws Exception {
startADB(); // start adb service
String output = cmd.runCommand("adb devices");
String[] lines = output.split("\n");
if (lines.length <= 1) {
System.out.println("No ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private Map<String, List<AppiumDevice>> filterByDevicePlatform(Map<String, List<AppiumDevice>> devicesByHost) {
String platform = System.getenv(PLATFORM);
if (platform.equalsIgnoreCase(OSType.BOTH.name())) {
return devicesByHost;
} else {
... | #vulnerable code
private Map<String, List<AppiumDevice>> filterByDevicePlatform(Map<String, List<AppiumDevice>> devicesByHost) {
String platform = System.getProperty(PLATFORM);
if (platform.equalsIgnoreCase(OSType.BOTH.name())) {
return devicesByHost;
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void startAppiumServer(String host) throws Exception {
System.out.println(
"**************************************************************************\n");
System.out.println("Starting Appium Server on host " + host);
... | #vulnerable code
@Override
public void startAppiumServer(String host) throws Exception {
System.out.println(
"**************************************************************************\n");
System.out.println("Starting Appium Server on host " + host);... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private HashMap<String, String> getArtifactForHost(String hostMachine) throws IOException {
String platform = System.getenv("Platform");
String app = "app";
HashMap<String, String> artifactPaths = new HashMap<>();
JSONObject android = capabilit... | #vulnerable code
private HashMap<String, String> getArtifactForHost(String hostMachine) throws IOException {
String platform = System.getProperty("Platform");
String app = "app";
HashMap<String, String> artifactPaths = new HashMap<>();
JSONObject android ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public Map<String, String> getDevices() throws Exception {
startADB(); // start adb service
String output = cmd.runCommand("adb devices");
String[] lines = output.split("\n");
if (lines.length <= 1) {
System.out.println("No Androi... | #vulnerable code
public Map<String, String> getDevices() throws Exception {
startADB(); // start adb service
String output = cmd.runCommand("adb devices");
String[] lines = output.split("\n");
if (lines.length <= 1) {
System.out.println("No ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public static void testApp() throws Exception {
ParallelThread parallelThread = new ParallelThread();
List<String> tests = new ArrayList<>();
tests.add("HomePageTest3");
tests.add("HomePageTest2");
boolean hasFailures = paral... | #vulnerable code
@Test
public static void testApp() throws Exception {
ParallelThread parallelThread = new ParallelThread();
List<String> tests = new ArrayList<>();
//tests.add("HomePageTest1");
//tests.add("HomePageTest2");
boolean hasFailur... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public Map<String, String> getDevices() throws Exception {
startADB(); // start adb service
String output = cmd.runCommand("adb devices");
String[] lines = output.split("\n");
if (lines.length <= 1) {
System.out.println("No Androi... | #vulnerable code
public Map<String, String> getDevices() throws Exception {
startADB(); // start adb service
String output = cmd.runCommand("adb devices");
String[] lines = output.split("\n");
if (lines.length <= 1) {
System.out.println("No ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void destroyAppiumNode(String host) throws Exception {
new Api().getResponse("http://" + host + ":" + getRemoteAppiumManagerPort(host)
+ "/appium/stop").body().string();
} | #vulnerable code
@Override
public void destroyAppiumNode(String host) throws IOException {
new Api().getResponse("http://" + host + ":4567"
+ "/appium/stop").body().string();
}
#location 4
#vulner... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public synchronized AppiumServiceBuilder startAppiumServer(String methodName) throws Exception {
device_udid = getNextAvailableDeviceId();
if (device_udid == null) {
System.out.println("No devices are free to run test or Failed to run test");
... | #vulnerable code
public synchronized AppiumServiceBuilder startAppiumServer(String methodName) throws Exception {
device_udid = getNextAvailableDeviceId();
if (device_udid == null) {
System.out.println("No devices are free to run test or Failed to run test");... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void startingServerInstance() throws Exception {
startingServerInstance(null, null);
} | #vulnerable code
public void startingServerInstance() throws Exception {
if (prop.getProperty("APP_TYPE").equalsIgnoreCase("web")) {
driver = new AndroidDriver<>(appiumMan.getAppiumUrl(), androidWeb());
} else {
if (System.getProperty("os.name").t... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static void main(String[] args) throws IOException {
String logo = "http://sauceio.com/wp-content/uploads/2014/04/appium_logo_final.png";
StringBuilder sb = new StringBuilder();
String a = "testcasepassed";
sb.append("<html>");
sb.append("<head>");
sb.append(... | #vulnerable code
public static void main(String[] args) {
// TODO Auto-generated method stub
// List<Class> testCases = new ArrayList<Class>();
// testCases.add(HomePageTest1.class);
// testCases.add(HomePageTest2.class);
// testCases.add(HomePageTest3.class);
// testCases.add(Ho... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void startingServerInstance() throws Exception {
startingServerInstance(null, null);
} | #vulnerable code
public void startingServerInstance() throws Exception {
if (prop.getProperty("APP_TYPE").equalsIgnoreCase("web")) {
driver = new AndroidDriver<>(appiumMan.getAppiumUrl(), androidWeb());
} else {
if (System.getProperty("os.name").t... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public static void testApp() throws Exception {
ParallelThread parallelThread = new ParallelThread();
List<String> tests = new ArrayList<>();
tests.add("HomePageTest3");
tests.add("HomePageTest2");
boolean hasFailures = paral... | #vulnerable code
@Test
public static void testApp() throws Exception {
ParallelThread parallelThread = new ParallelThread();
List<String> tests = new ArrayList<>();
//tests.add("HomePageTest1");
//tests.add("HomePageTest2");
boolean hasFailur... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected void processIsInJarAndlastModified() {
if ("file".equalsIgnoreCase(url.getProtocol())) {
isInJar = false;
lastModified = new File(url.getFile()).lastModified();
} else {
isInJar = true;
lastModified = -1;
}
} | #vulnerable code
protected void processIsInJarAndlastModified() {
try {
URLConnection conn = url.openConnection();
if ("jar".equals(url.getProtocol()) || conn instanceof JarURLConnection) {
isInJar = true;
lastModified = -1;
} else {
isInJar = false;
lastModified... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected long getLastModified() {
return new File(url.getFile()).lastModified();
} | #vulnerable code
protected long getLastModified() {
try {
URLConnection conn = url.openConnection();
return conn.getLastModified();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
#location 4
#vulnerabil... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected long getLastModified() {
return new File(url.getFile()).lastModified();
} | #vulnerable code
protected long getLastModified() {
try {
URLConnection conn = url.openConnection();
return conn.getLastModified();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
#location 4
#vulnerabil... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private boolean hookExist() throws IOException {
GHRepository ghRepository = getGitHubRepo();
if (ghRepository == null) {
throw new IOException("Unable to get repo [ " + reponame + " ]");
}
for (GHHook h : ghRepository.getHooks()) {... | #vulnerable code
private boolean hookExist() throws IOException {
GHRepository ghRepository = getGitHubRepo();
for (GHHook h : ghRepository.getHooks()) {
if (!"web".equals(h.getName())) {
continue;
}
if (!getHookUrl().e... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public Environment setUpEnvironment(@SuppressWarnings("rawtypes") AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException, Run.RunnerAbortedException {
GhprbTrigger trigger = Ghprb.extractTrigger(build);
... | #vulnerable code
@Override
public Environment setUpEnvironment(@SuppressWarnings("rawtypes") AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException, Run.RunnerAbortedException {
GhprbTrigger trigger = Ghprb.extractTrigger(bui... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void check(Map<Integer,GhprbPullRequest> pulls){
if(repo == null) try {
repo = gh.getRepository(reponame);
if(repo == null){
Logger.getLogger(GhprbRepo.class.getName()).log(Level.SEVERE, "Could not retrieve repo named {0} (Do you have properly set 'GitHub p... | #vulnerable code
public void check(Map<Integer,GhprbPullRequest> pulls){
if(repo == null) try {
repo = gh.getRepository(reponame);
if(repo == null){
Logger.getLogger(GhprbRepo.class.getName()).log(Level.SEVERE, "Could not retrieve repo named {0} (Do you have properly set 'Gi... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, final BuildListener listener) throws InterruptedException, IOException {
AbstractProject<?, ?> project = build.getProject();
if (build.getResult().isWorseThan(Result.SUCCESS)) {
logger.log(Lev... | #vulnerable code
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, final BuildListener listener) throws InterruptedException, IOException {
AbstractProject<?, ?> project = build.getProject();
if (build.getResult().isWorseThan(Result.SUCCESS)) {
logger.l... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public boolean cancelBuild(int id) {
Iterator<GhprbBuild> it = builds.iterator();
while(it.hasNext()){
GhprbBuild build = it.next();
if (build.getPullID() == id) {
if (build.cancel()) {
it.remove();
return true;
}
}
}
return false;
} | #vulnerable code
public boolean cancelBuild(int id) {
if(queuedBuilds.containsKey(id)){
try {
Run<?,?> build = (Run) queuedBuilds.get(id).waitForStart();
if(build.getExecutor() == null) return false;
build.getExecutor().interrupt();
queuedBuilds.remove(id);
return ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void onCompleted(AbstractBuild<?, ?> build, TaskListener listener) {
GhprbTrigger trigger = Ghprb.extractTrigger(build);
if (trigger != null && trigger.getBuilds() != null) {
trigger.getBuilds().onCompleted(build, listener);
... | #vulnerable code
@Override
public void onCompleted(AbstractBuild<?, ?> build, TaskListener listener) {
GhprbTrigger trigger = Ghprb.extractTrigger(build);
if (trigger != null) {
trigger.getBuilds().onCompleted(build, listener);
}
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void onStarted(AbstractBuild<?, ?> build, TaskListener listener) {
GhprbTrigger trigger = Ghprb.extractTrigger(build);
if (trigger != null && trigger.getBuilds() != null) {
trigger.getBuilds().onStarted(build, listener);
... | #vulnerable code
@Override
public void onStarted(AbstractBuild<?, ?> build, TaskListener listener) {
GhprbTrigger trigger = Ghprb.extractTrigger(build);
if (trigger != null) {
trigger.getBuilds().onStarted(build, listener);
}
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void check(GHIssueComment comment) {
if (helper.isProjectDisabled()) {
logger.log(Level.FINE, "Project is disabled, ignoring comment");
return;
}
synchronized (this) {
try {
checkComment(comme... | #vulnerable code
public void check(GHIssueComment comment) {
if (helper.isProjectDisabled()) {
logger.log(Level.FINE, "Project is disabled, ignoring comment");
return;
}
synchronized (this) {
try {
checkComment... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void check(GHPullRequest ghpr) {
setPullRequest(ghpr);
if (helper.isProjectDisabled()) {
logger.log(Level.FINE, "Project is disabled, ignoring pull request");
return;
}
try {
getPullRequest(false);
... | #vulnerable code
public void check(GHPullRequest ghpr) {
setPullRequest(ghpr);
if (helper.isProjectDisabled()) {
logger.log(Level.FINE, "Project is disabled, ignoring pull request");
return;
}
try {
getPullRequest(fals... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void check(GHPullRequest ghpr) {
setPullRequest(ghpr);
if (helper.isProjectDisabled()) {
logger.log(Level.FINE, "Project is disabled, ignoring pull request");
return;
}
try {
getPullRequest(false);
... | #vulnerable code
public void check(GHPullRequest ghpr) {
setPullRequest(ghpr);
if (helper.isProjectDisabled()) {
logger.log(Level.FINE, "Project is disabled, ignoring pull request");
return;
}
try {
getPullRequest(fals... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private boolean initGhRepository() {
GitHub gitHub = null;
try {
GhprbGitHub repo = helper.getGitHub();
if (repo == null) {
return false;
}
gitHub = repo.get();
if (gitHub == null) {
... | #vulnerable code
private boolean initGhRepository() {
GitHub gitHub = null;
try {
GhprbGitHub repo = helper.getGitHub();
if (repo == null) {
return false;
}
gitHub = repo.get();
if (gitHub.getRat... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public QueueTaskFuture<?> startJob(GhprbCause cause, GhprbRepository repo) {
for (GhprbExtension ext : Ghprb.getJobExtensions(this, GhprbBuildStep.class)) {
if (ext instanceof GhprbBuildStep) {
((GhprbBuildStep)ext).onStartBuild(s... | #vulnerable code
public QueueTaskFuture<?> startJob(GhprbCause cause, GhprbRepository repo) {
ArrayList<ParameterValue> values = getDefaultParameters();
final String commitSha = cause.isMerged() ? "origin/pr/" + cause.getPullID() + "/merge" : cause.getCommit();
v... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void check(GHPullRequest ghpr) {
setPullRequest(ghpr);
if (helper.isProjectDisabled()) {
logger.log(Level.FINE, "Project is disabled, ignoring pull request");
return;
}
try {
getPullRequest(false);
... | #vulnerable code
public void check(GHPullRequest ghpr) {
setPullRequest(ghpr);
if (helper.isProjectDisabled()) {
logger.log(Level.FINE, "Project is disabled, ignoring pull request");
return;
}
try {
getPullRequest(fals... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void makeBuildVariables(@SuppressWarnings("rawtypes") AbstractBuild build, Map<String,String> variables){
variables.put("ghprbUpstreamStatus", "true");
variables.put("ghprbCommitStatusContext", commitStatusContext);
variables.put("... | #vulnerable code
@Override
public void makeBuildVariables(@SuppressWarnings("rawtypes") AbstractBuild build, Map<String,String> variables){
variables.put("ghprbUpstreamStatus", "true");
variables.put("ghprbCommitStatusContext", commitStatusContext);
variables... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void onStarted(AbstractBuild<?, ?> build, TaskListener listener) {
PrintStream logger = listener.getLogger();
GhprbCause c = Ghprb.getCause(build);
if (c == null) {
return;
}
GhprbTrigger trigger = Ghprb.extractTrigg... | #vulnerable code
public void onStarted(AbstractBuild<?, ?> build, TaskListener listener) {
PrintStream logger = listener.getLogger();
GhprbCause c = Ghprb.getCause(build);
if (c == null) {
return;
}
GhprbTrigger trigger = Ghprb.extrac... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void check(GHIssueComment comment) {
if (helper.isProjectDisabled()) {
logger.log(Level.FINE, "Project is disabled, ignoring comment");
return;
}
synchronized (this) {
try {
checkComment(comme... | #vulnerable code
public void check(GHIssueComment comment) {
if (helper.isProjectDisabled()) {
logger.log(Level.FINE, "Project is disabled, ignoring comment");
return;
}
synchronized (this) {
try {
checkComment... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void check(GHPullRequest ghpr) {
setPullRequest(ghpr);
if (helper.isProjectDisabled()) {
logger.log(Level.FINE, "Project is disabled, ignoring pull request");
return;
}
try {
getPullRequest(false);
... | #vulnerable code
public void check(GHPullRequest ghpr) {
setPullRequest(ghpr);
if (helper.isProjectDisabled()) {
logger.log(Level.FINE, "Project is disabled, ignoring pull request");
return;
}
try {
getPullRequest(fals... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void handleWebHook(String event, String payload, String body, String signature) {
GhprbRepository repo = trigger.getRepository();
String repoName = repo.getName();
logger.log(Level.INFO, "Got payload event: {0}", event);
try {
... | #vulnerable code
public void handleWebHook(String event, String payload, String body, String signature) {
if (!checkSignature(body, signature, trigger.getGitHubApiAuth().getSecret())){
return;
}
GhprbRepository repo = trigger.getRepository();
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void check(GHIssueComment comment) {
if (helper.isProjectDisabled()) {
logger.log(Level.FINE, "Project is disabled, ignoring comment");
return;
}
synchronized (this) {
try {
checkComment(comme... | #vulnerable code
public void check(GHIssueComment comment) {
if (helper.isProjectDisabled()) {
logger.log(Level.FINE, "Project is disabled, ignoring comment");
return;
}
synchronized (this) {
try {
checkComment... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void findAllByIdReferenceConsistencyTest() {
when(this.objectToKeyFactory.getKeyFromObject(eq(this.childEntity1), any())).thenReturn(this.childEntity1.id);
when(this.datastore.fetch(eq(this.key1)))
.thenReturn(Arrays.asList(this.e1));
verifyBeforeAndAft... | #vulnerable code
@Test
public void findAllByIdReferenceConsistencyTest() {
when(this.objectToKeyFactory.getKeyFromObject(eq(this.childEntity1), any())).thenReturn(this.childEntity1.id);
when(this.datastore.fetch(eq(this.key1)))
.thenReturn(Arrays.asList(this.e1));
TestEntity p... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@SuppressWarnings("unchecked")
private static Map<Class<?>, BiConsumer<ValueBinder<?>, Iterable>> createIterableTypeMapping() {
Map<Class<?>, BiConsumer<ValueBinder<?>, Iterable>> map = new LinkedHashMap<>();
map.put(com.google.cloud.Date.class, ValueBinder::toDateArray);
... | #vulnerable code
@SuppressWarnings("unchecked")
private static Map<Class<?>, BiConsumer<ValueBinder<?>, Iterable>> createIterableTypeMapping() {
// Java 8 has compile errors when using the builder extension methods
// @formatter:off
ImmutableMap.Builder<Class<?>, BiConsumer<ValueBin... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void findAllByIdReferenceConsistencyTest() {
when(this.objectToKeyFactory.getKeyFromObject(eq(this.childEntity1), any())).thenReturn(this.childEntity1.id);
when(this.datastore.fetch(eq(this.key1)))
.thenReturn(Arrays.asList(this.e1));
verifyBeforeAndAft... | #vulnerable code
@Test
public void findAllByIdReferenceConsistencyTest() {
when(this.objectToKeyFactory.getKeyFromObject(eq(this.childEntity1), any())).thenReturn(this.childEntity1.id);
when(this.datastore.fetch(eq(this.key1)))
.thenReturn(Arrays.asList(this.e1));
TestEntity p... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private <T> String buildResourceName(T entity) {
FirestorePersistentEntity<?> persistentEntity =
this.mappingContext.getPersistentEntity(entity.getClass());
FirestorePersistentProperty idProperty = persistentEntity.getIdPropertyOrFail();
Object idVal = persistentEntity... | #vulnerable code
private <T> String buildResourceName(T entity) {
FirestorePersistentEntity<?> persistentEntity =
this.mappingContext.getPersistentEntity(entity.getClass());
FirestorePersistentProperty idProperty = persistentEntity.getIdPropertyOrFail();
Object idVal = persistent... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private boolean isDiscriminationFieldMatch(DatastorePersistentEntity entity,
EntityPropertyValueProvider propertyValueProvider) {
return ((String[]) propertyValueProvider.getPropertyValue(entity.getDiscriminationFieldName(),
EmbeddedType.NOT_EMBEDDED,
ClassTypeInfor... | #vulnerable code
private boolean isDiscriminationFieldMatch(DatastorePersistentEntity entity,
EntityPropertyValueProvider propertyValueProvider) {
return propertyValueProvider.getPropertyValue(entity.getDiscriminationFieldName(), EmbeddedType.NOT_EMBEDDED,
ClassTypeInformation.fro... | Below is the vulnerable code, please generate the patch based on the following information. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.