output stringlengths 64 73.2k | input stringlengths 208 73.3k | instruction stringclasses 1
value |
|---|---|---|
#fixed code
OffHeapMap(OHCacheBuilder builder, AtomicLong freeCapacity)
{
this.freeCapacity = freeCapacity;
int hts = builder.getHashTableSize();
if (hts <= 0)
hts = 8192;
if (hts < 256)
hts = 256;
int bl = builder.getB... | #vulnerable code
void resetStatistics()
{
rehashes = 0L;
evictedEntries = 0L;
hitCount = 0L;
missCount = 0L;
putAddCount = 0L;
putReplaceCount = 0L;
removeCount = 0L;
lruCompactions = 0L;
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OffHeapMap(OHCacheBuilder builder, AtomicLong freeCapacity)
{
this.freeCapacity = freeCapacity;
int hts = builder.getHashTableSize();
if (hts <= 0)
hts = 8192;
if (hts < 256)
hts = 256;
int bl = builder.getB... | #vulnerable code
long lruCompactions()
{
return lruCompactions;
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OffHeapMap(OHCacheBuilder builder, AtomicLong freeCapacity)
{
this.freeCapacity = freeCapacity;
int hts = builder.getHashTableSize();
if (hts <= 0)
hts = 8192;
if (hts < 256)
hts = 256;
int bl = builder.getB... | #vulnerable code
long size()
{
return size;
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OffHeapMap(OHCacheBuilder builder, AtomicLong freeCapacity)
{
this.freeCapacity = freeCapacity;
int hts = builder.getHashTableSize();
if (hts <= 0)
hts = 8192;
if (hts < 256)
hts = 256;
table = Table.create(... | #vulnerable code
void resetStatistics()
{
rehashes = 0L;
evictedEntries = 0L;
hitCount = 0L;
missCount = 0L;
putAddCount = 0L;
putReplaceCount = 0L;
removeCount = 0L;
}
#location 7
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OffHeapMap(OHCacheBuilder builder, long freeCapacity)
{
this.freeCapacity = freeCapacity;
this.throwOOME = builder.isThrowOOME();
this.lock = builder.isUnlocked() ? null : new ReentrantLock();
int hts = builder.getHashTableSize();
... | #vulnerable code
long lruCompactions()
{
return lruCompactions;
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OffHeapMap(OHCacheBuilder builder, long capacity, long cleanUpTriggerFree)
{
this.capacity = capacity;
this.freeCapacity = capacity;
this.cleanUpTriggerFree = cleanUpTriggerFree;
int hts = builder.getHashTableSize();
if (hts <= 0)
... | #vulnerable code
int hashTableSize()
{
return table.size();
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OffHeapMap(OHCacheBuilder builder, long freeCapacity)
{
this.freeCapacity = freeCapacity;
this.throwOOME = builder.isThrowOOME();
this.lock = builder.isUnlocked() ? null : new ReentrantLock();
int hts = builder.getHashTableSize();
... | #vulnerable code
boolean putEntry(long newHashEntryAdr, long hash, long keyLen, long bytes, boolean ifAbsent, long oldValueAddr, long oldValueOffset, long oldValueLen)
{
long removeHashEntryAdr = 0L;
LongArrayList derefList = null;
lock.lock();
try
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OffHeapMap(OHCacheBuilder builder, long freeCapacity)
{
this.freeCapacity = freeCapacity;
this.throwOOME = builder.isThrowOOME();
this.lock = builder.isUnlocked() ? null : new ReentrantLock();
int hts = builder.getHashTableSize();
... | #vulnerable code
long removeCount()
{
return removeCount;
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OffHeapMap(OHCacheBuilder builder, long freeCapacity)
{
this.freeCapacity = freeCapacity;
this.throwOOME = builder.isThrowOOME();
this.lock = builder.isUnlocked() ? null : new ReentrantLock();
int hts = builder.getHashTableSize();
... | #vulnerable code
void resetStatistics()
{
rehashes = 0L;
evictedEntries = 0L;
hitCount = 0L;
missCount = 0L;
putAddCount = 0L;
putReplaceCount = 0L;
removeCount = 0L;
lruCompactions = 0L;
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OffHeapMap(OHCacheBuilder builder, long freeCapacity)
{
this.freeCapacity = freeCapacity;
this.throwOOME = builder.isThrowOOME();
this.lock = builder.isUnlocked() ? null : new ReentrantLock();
int hts = builder.getHashTableSize();
... | #vulnerable code
long removeCount()
{
return removeCount;
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OffHeapMap(OHCacheBuilder builder, long freeCapacity)
{
this.freeCapacity = freeCapacity;
this.throwOOME = builder.isThrowOOME();
this.lock = builder.isUnlocked() ? null : new ReentrantLock();
int hts = builder.getHashTableSize();
... | #vulnerable code
long freeCapacity()
{
return freeCapacity;
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OffHeapMap(OHCacheBuilder builder, long freeCapacity)
{
this.freeCapacity = freeCapacity;
this.throwOOME = builder.isThrowOOME();
this.lock = builder.isUnlocked() ? null : new ReentrantLock();
int hts = builder.getHashTableSize();
... | #vulnerable code
int hashTableSize()
{
return table.size();
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OffHeapMap(OHCacheBuilder builder, long freeCapacity)
{
this.freeCapacity = freeCapacity;
this.throwOOME = builder.isThrowOOME();
this.lock = builder.isUnlocked() ? null : new ReentrantLock();
int hts = builder.getHashTableSize();
... | #vulnerable code
void resetStatistics()
{
rehashes = 0L;
evictedEntries = 0L;
hitCount = 0L;
missCount = 0L;
putAddCount = 0L;
putReplaceCount = 0L;
removeCount = 0L;
}
#location 3
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OffHeapMap(OHCacheBuilder builder, AtomicLong freeCapacity)
{
this.freeCapacity = freeCapacity;
int hts = builder.getHashTableSize();
if (hts <= 0)
hts = 8192;
if (hts < 256)
hts = 256;
int bl = builder.getB... | #vulnerable code
long rehashes()
{
return rehashes;
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OffHeapMap(OHCacheBuilder builder, long freeCapacity)
{
this.freeCapacity = freeCapacity;
this.throwOOME = builder.isThrowOOME();
this.lock = builder.isUnlocked() ? null : new ReentrantLock();
int hts = builder.getHashTableSize();
... | #vulnerable code
long evictedEntries()
{
return evictedEntries;
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OffHeapMap(OHCacheBuilder builder, long freeCapacity)
{
this.freeCapacity = freeCapacity;
this.throwOOME = builder.isThrowOOME();
this.lock = builder.isUnlocked() ? null : new ReentrantLock();
int hts = builder.getHashTableSize();
... | #vulnerable code
long missCount()
{
return missCount;
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OffHeapMap(OHCacheBuilder builder, long freeCapacity)
{
this.freeCapacity = freeCapacity;
this.throwOOME = builder.isThrowOOME();
this.lock = builder.isUnlocked() ? null : new ReentrantLock();
int hts = builder.getHashTableSize();
... | #vulnerable code
long putAddCount()
{
return putAddCount;
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OffHeapMap(OHCacheBuilder builder, AtomicLong freeCapacity)
{
this.freeCapacity = freeCapacity;
int hts = builder.getHashTableSize();
if (hts <= 0)
hts = 8192;
if (hts < 256)
hts = 256;
table = Table.create(... | #vulnerable code
long evictedEntries()
{
return evictedEntries;
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OffHeapMap(OHCacheBuilder builder, AtomicLong freeCapacity)
{
this.freeCapacity = freeCapacity;
int hts = builder.getHashTableSize();
if (hts <= 0)
hts = 8192;
if (hts < 256)
hts = 256;
int bl = builder.getB... | #vulnerable code
long putReplaceCount()
{
return putReplaceCount;
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OffHeapMap(OHCacheBuilder builder, long capacity, long cleanUpTriggerFree)
{
this.capacity = capacity;
this.freeCapacity = capacity;
this.cleanUpTriggerFree = cleanUpTriggerFree;
int hts = builder.getHashTableSize();
if (hts <= 0)
... | #vulnerable code
void release()
{
table.release();
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OffHeapMap(OHCacheBuilder builder, AtomicLong freeCapacity)
{
this.freeCapacity = freeCapacity;
int hts = builder.getHashTableSize();
if (hts <= 0)
hts = 8192;
if (hts < 256)
hts = 256;
int bl = builder.getB... | #vulnerable code
void resetStatistics()
{
rehashes = 0L;
evictedEntries = 0L;
hitCount = 0L;
missCount = 0L;
putAddCount = 0L;
putReplaceCount = 0L;
removeCount = 0L;
lruCompactions = 0L;
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OffHeapMap(OHCacheBuilder builder, AtomicLong freeCapacity)
{
this.freeCapacity = freeCapacity;
int hts = builder.getHashTableSize();
if (hts <= 0)
hts = 8192;
if (hts < 256)
hts = 256;
int bl = builder.getB... | #vulnerable code
long evictedEntries()
{
return evictedEntries;
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OffHeapMap(OHCacheBuilder builder, long freeCapacity)
{
this.freeCapacity = freeCapacity;
this.throwOOME = builder.isThrowOOME();
this.lock = builder.isUnlocked() ? null : new ReentrantLock();
int hts = builder.getHashTableSize();
... | #vulnerable code
long freeCapacity()
{
return freeCapacity;
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public List<JadbDevice> getDevices() throws IOException, JadbException {
try (Transport transport = createTransport()) {
transport.send("host:devices");
transport.verifyResponse();
String body = transport.readString();
r... | #vulnerable code
public List<JadbDevice> getDevices() throws IOException, JadbException {
Transport devices = createTransport();
devices.send("host:devices");
devices.verifyResponse();
String body = devices.readString();
devices.close();
r... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void launch() throws IOException, InterruptedException {
Process p = subprocess.execute(new String[]{executable, "start-server"});
p.waitFor();
int exitValue = p.exitValue();
if (exitValue != 0) throw new IOException("adb exited with exi... | #vulnerable code
public void launch() throws IOException, InterruptedException {
Process p = runtime.exec(new String[]{findAdbExecutable(), "start-server"});
p.waitFor();
int exitValue = p.exitValue();
if (exitValue != 0) throw new IOException("adb exited... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void launch(Package name) throws IOException, JadbException {
InputStream s = device.executeShell("monkey", "-p", name.toString(), "-c", "android.intent.category.LAUNCHER", "1");
s.close();
} | #vulnerable code
public void launch(Package name) throws IOException, JadbException {
InputStream s = device.executeShell("monkey", "-p", name.toString(), "-c", "android.intent.category.LAUNCHER", "1");
}
#location 2
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void start() throws InterruptedException {
thread = new Thread(this, "Fake Adb Server");
thread.setDaemon(true);
thread.start();
serverReady();
} | #vulnerable code
public void start() throws InterruptedException {
thread = new Thread(this, "Fake Adb Server");
thread.setDaemon(true);
thread.start();
synchronized (lockObject) {
if (!isStarted) {
lockObject.wait();
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public String getHostVersion() throws IOException, JadbException {
try (Transport transport = createTransport()) {
transport.send("host:version");
transport.verifyResponse();
return transport.readString();
}
} | #vulnerable code
public String getHostVersion() throws IOException, JadbException {
Transport main = createTransport();
main.send("host:version");
main.verifyResponse();
String version = main.readString();
main.close();
return version;
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Deprecated
public void executeShell(OutputStream output, String command, String... args) throws IOException, JadbException {
Transport transport = getTransport();
StringBuilder shellLine = new StringBuilder(command);
for (String arg : args) {
... | #vulnerable code
@Deprecated
public void executeShell(OutputStream output, String command, String... args) throws IOException, JadbException {
Transport transport = getTransport();
StringBuilder shellLine = new StringBuilder(command);
for (String arg : args) ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void pull(RemoteFile remote, File local) throws IOException, JadbException {
try (FileOutputStream fileStream = new FileOutputStream(local)) {
pull(remote, fileStream);
}
} | #vulnerable code
public void pull(RemoteFile remote, File local) throws IOException, JadbException {
FileOutputStream fileStream = new FileOutputStream(local);
pull(remote, fileStream);
fileStream.close();
}
#location 5
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public List<RemoteFile> list(String remotePath) throws IOException, JadbException {
try (Transport transport = getTransport()) {
SyncTransport sync = transport.startSync();
sync.send("LIST", remotePath);
List<RemoteFile> result = n... | #vulnerable code
public List<RemoteFile> list(String remotePath) throws IOException, JadbException {
Transport transport = getTransport();
SyncTransport sync = transport.startSync();
sync.send("LIST", remotePath);
List<RemoteFile> result = new ArrayList<... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public Map<String, String> getprop() throws IOException, JadbException {
BufferedReader bufferedReader = null;
try {
bufferedReader = new BufferedReader(new InputStreamReader(device.executeShell("getprop")));
return parseProp(bufferedRe... | #vulnerable code
public Map<String, String> getprop() throws IOException, JadbException {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(device.executeShell("getprop")));
return parseProp(bufferedReader);
}
#loca... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public String readString(int length) throws IOException {
byte[] responseBuffer = new byte[length];
dataInput.readFully(responseBuffer);
return new String(responseBuffer, StandardCharsets.UTF_8);
} | #vulnerable code
public String readString(int length) throws IOException {
DataInput reader = new DataInputStream(inputStream);
byte[] responseBuffer = new byte[length];
reader.readFully(responseBuffer);
return new String(responseBuffer, StandardCharsets.... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void push(File local, RemoteFile remote) throws IOException, JadbException {
try (FileInputStream fileStream = new FileInputStream(local)) {
push(fileStream, local.lastModified(), getMode(local), remote);
}
} | #vulnerable code
public void push(File local, RemoteFile remote) throws IOException, JadbException {
FileInputStream fileStream = new FileInputStream(local);
push(fileStream, local.lastModified(), getMode(local), remote);
fileStream.close();
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private byte[] passthrough(byte[] input) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
OutputStream sut = new AdbFilterOutputStream(output);
try {
sut.write(input);
sut.flush();
} finally {
... | #vulnerable code
private byte[] passthrough(byte[] input) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
OutputStream sut = new AdbFilterOutputStream(output);
sut.write(input);
sut.flush();
return output.toByteArr... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void runServer() throws IOException {
DataInput input = new DataInputStream(socket.getInputStream());
DataOutputStream output = new DataOutputStream(socket.getOutputStream());
while (processCommand(input, output)) {
// nothing ... | #vulnerable code
private void runServer() throws IOException {
DataInput input = new DataInputStream(socket.getInputStream());
DataOutputStream output = new DataOutputStream(socket.getOutputStream());
while (true) {
byte[] buffer = new byte[4];
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void start() throws InterruptedException {
thread = new Thread(this, "Fake Adb Server");
thread.setDaemon(true);
thread.start();
serverReady();
} | #vulnerable code
public void start() throws InterruptedException {
thread = new Thread(this, "Fake Adb Server");
thread.setDaemon(true);
thread.start();
synchronized (lockObject) {
if (!isStarted) {
lockObject.wait();
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void vanilla() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
TestConfiguration.class);
Service service = context.getBean(Service.class);
Foo foo = context.getBean(Foo.class);
assertFalse(AopUtils.isAopProxy(foo))... | #vulnerable code
@Test
public void vanilla() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
TestConfiguration.class);
Service service = context.getBean(Service.class);
service.service();
assertEquals(3, service.getCount());
context.clo... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testEmpytObjectCRC() {
String key = "empty-object-crc";
try {
// put
PutObjectResult putObjectResult = ossClient.putObject(bucketName, key,
new ByteArrayInputStream(new String("").getBytes()));... | #vulnerable code
@Test
public void testEmpytObjectCRC() {
String key = "empty-object-crc";
try {
// put
PutObjectResult putObjectResult = ossClient.putObject(bucketName, key,
new ByteArrayInputStream(new String("").getByte... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void load(File file) throws IOException {
InputStream in = null;
try {
in = new FileInputStream(file);
load(in);
} finally {
if (in != null) {
in.close();
}
}
} | #vulnerable code
public void load(File file) throws IOException {
InputStream in = new FileInputStream(file);
load(in);
in.close();
}
#location 5
#vulnerability type RESOURCE_LEAK | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
String token = request.getHeader(Constant.TOKEN);
if(StrUtil.isNotBlank(token) && !StrUtil.equals(... | #vulnerable code
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
String token = request.getHeader(Constant.TOKEN);
if(StrUtil.isNotBlank(token)){
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@SneakyThrows
@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication){
String token;
Long userId = 0l;
if(authentication.getPrincipal() instanceof CustomUserDetailsU... | #vulnerable code
@SneakyThrows
@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication){
String token;
if(authentication.getPrincipal() instanceof CustomUserDetailsUser){
Cu... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@SneakyThrows
@Override
public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
String token = request.getHeader(Constant.TOKEN);
redisTemplate.delete(Constant.AUTHENTICATION_TOKEN);
redisTe... | #vulnerable code
@SneakyThrows
@Override
public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
String token = request.getHeader(Constant.TOKEN);
redisTemplate.delete(Constant.AUTHENTICATION_TOKEN);
b... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private List<BOBRequestDetail> getRequestBOBDetails() {
if (requestBOBDetails == null) {
List<String> detailLines = getDetailLines();
if (detailLines == null) return null;
BOBRequestDetail detail;
requestBOBDetails = n... | #vulnerable code
private List<BOBRequestDetail> getRequestBOBDetails() {
if (requestBOBDetails == null) {
List<String> detailLines = getDetailLines();
if (detailLines == null) return null;
BOBRequestDetail detail;
requestBOBDetai... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public String getResponseBody() throws IOException {
String contentType = getContentType();
String charset = "UTF-8";
if (contentType != null) {
for (String part : contentType.split(";")) {
if (part.startsWith(... | #vulnerable code
@Override
public String getResponseBody() throws IOException {
String contentType = getContentType();
String charset = "UTF-8";
if (contentType != null) {
for (String part : contentType.split(";")) {
if (part.start... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public String getResponseBodyExcerpt(int maxLength) throws IOException {
String contentType = getContentType();
String charset = "UTF-8";
if (contentType != null) {
for (String part : contentType.split(";")) {
... | #vulnerable code
@Override
public String getResponseBodyExcerpt(int maxLength) throws IOException {
String contentType = getContentType();
String charset = "UTF-8";
if (contentType != null) {
for (String part : contentType.split(";")) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
Results run(String tomlString) {
if (tomlString.isEmpty()) {
return results;
}
String[] lines = tomlString.split("[\\n\\r]");
StringBuilder multilineBuilder = new StringBuilder();
Multiline multiline = Multiline.NONE;
String key = null;
S... | #vulnerable code
Results run(String tomlString) {
if (tomlString.isEmpty()) {
return results;
}
String[] lines = tomlString.split("[\\n\\r]");
StringBuilder multilineBuilder = new StringBuilder();
Multiline multiline = Multiline.NONE;
String key = null;... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private String readFile(File input) throws IOException {
BufferedReader bufferedReader = new BufferedReader(new FileReader(input));
try {
StringBuilder w = new StringBuilder();
String line = bufferedReader.readLine();
while (line != null) {
w.... | #vulnerable code
private String readFile(File input) throws IOException {
BufferedReader bufferedReader = new BufferedReader(new FileReader(input));
StringBuilder w = new StringBuilder();
String line = bufferedReader.readLine();
while (line != null) {
w.append(line)... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void write(Object from, File target) throws IOException {
FileWriter writer = new FileWriter(target);
write(from, writer);
writer.close();
} | #vulnerable code
public void write(Object from, File target) throws IOException {
FileWriter writer = new FileWriter(target);
writer.write(write(from));
writer.close();
}
#location 5
#vulnerability type RESOURCE_LEAK | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void write(Object from, OutputStream target) throws IOException {
OutputStreamWriter writer = new OutputStreamWriter(target, "UTF-8");
write(from, writer);
writer.flush();
} | #vulnerable code
public void write(Object from, OutputStream target) throws IOException {
OutputStreamWriter writer = new OutputStreamWriter(target);
write(from, writer);
writer.flush();
}
#location 5
#vulnerability t... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void write(Object from, OutputStream target) throws IOException {
OutputStreamWriter writer = new OutputStreamWriter(target, "UTF-8");
write(from, writer);
writer.flush();
} | #vulnerable code
public void write(Object from, OutputStream target) throws IOException {
OutputStreamWriter writer = new OutputStreamWriter(target);
write(from, writer);
writer.flush();
}
#location 4
#vulnerability t... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public Toml parse(File file) {
Scanner scanner = null;
try {
scanner = new Scanner(file);
return parse(scanner.useDelimiter("\\Z").next());
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} finally {
if (scanner != nul... | #vulnerable code
public Toml parse(File file) {
try {
return parse(new Scanner(file).useDelimiter("\\Z").next());
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
}
}
#location 3
#vulnera... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public boolean filmlisteIstAelter(int sekunden) {
int ret = alterFilmlisteSek();
// Date jetzt = new Date(System.currentTimeMillis());
// SimpleDateFormat sdf = new SimpleDateFormat(DATUM_ZEIT_FORMAT);
// String date = metaDaten[ListeFilme.FILMLIS... | #vulnerable code
public boolean filmlisteIstAelter(int sekunden) {
// Filmliste ist älter als: FilmeLaden.ALTER_FILMLISTE_SEKUNDEN_FUER_AUTOUPDATE
int ret = -1;
Date jetzt = new Date(System.currentTimeMillis());
SimpleDateFormat sdf = new SimpleDateFormat... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
void meldungThreadUndFertig() {
//wird erst ausgeführt wenn alle Threads beendet sind
if (threads <= 0) { // sonst läuft noch was
lSchon = false;
}
super.meldungThreadUndFertig();
} | #vulnerable code
@Override
void meldungThreadUndFertig() {
//wird erst ausgeführt wenn alle Threads beendet sind
if (threads <= 0) { // sonst läuft noch was
laufeSchon = false;
}
super.meldungThreadUndFertig();
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void starten() {
daten = new Daten(pfad);
Daten.nogui = true;
if (!userAgent.equals("")) {
Daten.setUserAgentManuel(userAgent);
}
// Infos schreiben
Log.startMeldungen(this.getClass().getName());
if (s... | #vulnerable code
public void starten() {
daten = new Daten(pfad);
Daten.nogui = true;
if (!userAgent.equals("")) {
Daten.setUserAgentManuel(userAgent);
}
// Infos schreiben
Log.startMeldungen(this.getClass().getName());
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static String getPfadVlc() {
if (Daten.system[Konstanten.SYSTEM_PFAD_VLC_NR].equals("")) {
new DialogOk(null, true, new PanelProgrammPfade(), "Pfade Standardprogramme").setVisible(true);
}
return Daten.system[Konstanten.SYSTEM_PFAD_V... | #vulnerable code
public static String getPfadVlc() {
///////////////////////
if (!Daten.system[Konstanten.SYSTEM_PFAD_VLC_NR].equals("")) {
return Daten.system[Konstanten.SYSTEM_PFAD_VLC_NR];
}
final String PFAD_LINUX_VLC = "/usr/bin/vlc";
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void listeBauen() {
//LinkedList mit den URLs aus dem Logfile bauen
Path downloadAboFilePath = Daten.getDownloadAboFilePath();
//use Automatic Resource Management
try (LineNumberReader in = new LineNumberReader(new InputStreamReader(Fil... | #vulnerable code
private void listeBauen() {
//LinkedList mit den URLs aus dem Logfile bauen
LineNumberReader in = null;
File datei = null;
try {
datei = new File(Daten.getBasisVerzeichnis(false) + Konstanten.LOG_DATEI_DOWNLOAD_ABOS);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static String getPfadVlc() {
if (Daten.system[Konstanten.SYSTEM_PFAD_VLC_NR].equals("")) {
new DialogOk(null, true, new PanelProgrammPfade(), "Pfade Standardprogramme").setVisible(true);
}
return Daten.system[Konstanten.SYSTEM_PFAD_V... | #vulnerable code
public static String getPfadVlc() {
///////////////////////
if (!Daten.system[Konstanten.SYSTEM_PFAD_VLC_NR].equals("")) {
return Daten.system[Konstanten.SYSTEM_PFAD_VLC_NR];
}
final String PFAD_LINUX_VLC = "/usr/bin/vlc";
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void metaDatenSchreiben() {
// FilmlisteMetaDaten
listeFilmeNeu.metaDaten = ListeFilme.newMetaDaten();
if (!Daten.filmeLaden.getStop() /* löschen */) {
listeFilmeNeu.metaDaten[ListeFilme.FILMLISTE_DATUM_NR] = DatumZeit.getJetzt_ddMM... | #vulnerable code
private void metaDatenSchreiben() {
// FilmlisteMetaDaten
listeFilmeNeu.metaDaten = ListeFilme.newMetaDaten();
if (!Daten.filmeLaden.getStop() /* löschen */) {
listeFilmeNeu.metaDaten[ListeFilme.FILMLISTE_DATUM_NR] = DatumZeit.getJetz... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static String getMusterPfadMplayer() {
final String PFAD_LINUX = "/usr/bin/mplayer";
final String PFAD_MAC = "/opt/local/bin/mplayer";
final String PFAD_WIN_DEFAULT = "C:\\Program Files\\SMPlayer\\mplayer\\mplayer.exe";
final String PFAD... | #vulnerable code
public static String getMusterPfadMplayer() {
final String PFAD_LINUX = "/usr/bin/mplayer";
final String PFAD_MAC = "/opt/local/bin/mplayer";
String pfad = "";
if (System.getProperty("os.name").toLowerCase().contains("windows")) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
void addToListNormal() {
//<strong style="margin-left:10px;">Sesamstraße präsentiert: Eine Möhre für Zwei</strong><br />
//<a style="margin-left:20px;" href="?programm=168&id=14487&ag=5" title="Sendung vom 10.10.2012" class="overlay_link">42. Ordnung i... | #vulnerable code
void ladenHttp(String filmWebsite, String thema, String alter) {
// erst die Nummer suchen
// >25420<4<165<23. Die b
// <http://www.kikaplus.net/clients/kika/mediathek/previewpic/1355302530-f80b463888fd4602d925b2ef2c861928 9.jpg<
final St... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static String getMusterPfadMplayer() {
final String PFAD_LINUX = "/usr/bin/mplayer";
final String PFAD_MAC = "/opt/local/bin/mplayer";
final String PFAD_WIN_DEFAULT = "C:\\Program Files\\SMPlayer\\mplayer\\mplayer.exe";
final String PFAD... | #vulnerable code
public static String getMusterPfadMplayer() {
final String PFAD_LINUX = "/usr/bin/mplayer";
final String PFAD_MAC = "/opt/local/bin/mplayer";
String pfad = "";
if (System.getProperty("os.name").toLowerCase().contains("windows")) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void starten() {
daten = new Daten(pfad);
Daten.nogui = true;
if (!userAgent.equals("")) {
Daten.setUserAgentManuel(userAgent);
}
// Infos schreiben
Log.startMeldungen(this.getClass().getName());
if (s... | #vulnerable code
public void starten() {
daten = new Daten(pfad);
Daten.nogui = true;
if (!userAgent.equals("")) {
Daten.setUserAgentManuel(userAgent);
}
// Infos schreiben
Log.startMeldungen(this.getClass().getName());
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public Component getTableCellRendererComponent(
JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column) {
try {
setBackground(null);
... | #vulnerable code
@Override
public Component getTableCellRendererComponent(
JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column) {
try {
setBackground(null);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
void addToListNormal() {
//<strong style="margin-left:10px;">Sesamstraße präsentiert: Eine Möhre für Zwei</strong><br />
//<a style="margin-left:20px;" href="?programm=168&id=14487&ag=5" title="Sendung vom 10.10.2012" class="overlay_link">42. Ordnung i... | #vulnerable code
void ladenHttp(String filmWebsite, String thema, String alter) {
// erst die Nummer suchen
// >25420<4<165<23. Die b
// <http://www.kikaplus.net/clients/kika/mediathek/previewpic/1355302530-f80b463888fd4602d925b2ef2c861928 9.jpg<
final St... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static String getPfadFlv() {
if (Daten.system[Konstanten.SYSTEM_PFAD_FLVSTREAMER_NR].equals("")) {
new DialogOk(null, true, new PanelProgrammPfade(), "Pfade Standardprogramme").setVisible(true);
}
return Daten.system[Konstanten.SYSTE... | #vulnerable code
public static String getPfadFlv() {
/////////////////////
if (!Daten.system[Konstanten.SYSTEM_PFAD_FLVSTREAMER_NR].equals("")) {
return Daten.system[Konstanten.SYSTEM_PFAD_FLVSTREAMER_NR];
}
final String PFAD_LINUX_FLV = "/usr... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void starten() {
daten = new Daten(pfad);
Daten.nogui = true;
if (!userAgent.equals("")) {
Daten.setUserAgentManuel(userAgent);
}
// Infos schreiben
Log.startMeldungen(this.getClass().getName());
if (s... | #vulnerable code
public void starten() {
daten = new Daten(pfad);
Daten.nogui = true;
if (!userAgent.equals("")) {
Daten.setUserAgentManuel(userAgent);
}
// Infos schreiben
Log.startMeldungen(this.getClass().getName());
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void downloadLoeschen(boolean dauerhaft) {
int rows[] = tabelle.getSelectedRows();
if (rows.length > 0) {
String[] urls = new String[rows.length];
for (int i = 0; i < rows.length; ++i) {
urls[i] = tabelle.getMode... | #vulnerable code
private void downloadLoeschen(boolean dauerhaft) {
int rows[] = tabelle.getSelectedRows();
if (rows.length > 0) {
for (int i = rows.length - 1; i >= 0; --i) {
int delRow = tabelle.convertRowIndexToModel(rows[i]);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static String getMusterPfadVlc() {
final String PFAD_LINUX_VLC = "/usr/bin/vlc";
final String PFAD_MAC_VLC = "/Applications/VLC.app/Contents/MacOS/VLC";
final String PFAD_WIN_DEFAULT = "C:\\Programme\\VideoLAN\\VLC\\vlc.exe";
final Strin... | #vulnerable code
public static String getMusterPfadVlc() {
final String PFAD_LINUX_VLC = "/usr/bin/vlc";
final String PFAD_MAC_VLC = "/Applications/VLC.app/Contents/MacOS/VLC";
String pfad = "";
if (System.getProperty("os.name").toLowerCase().contains("wi... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void meldenFertig(String sender) {
//wird ausgeführt wenn Sender beendet ist
int MAX_SENDER = 15, MAX1 = 24, MAX2 = 30;
Log.systemMeldung("Fertig " + sender + ": " + DatumZeit.getJetzt_HH_MM_SS());
RunSender run = listeSenderLaufen.sende... | #vulnerable code
public void meldenFertig(String sender) {
//wird ausgeführt wenn Sender beendet ist
int MAX_SENDER = 25, MAX1 = 22, MAX2 = 15, MAX3 = 20, MAX4 = 30;
Log.systemMeldung("Fertig " + sender + ": " + DatumZeit.getJetzt_HH_MM_SS());
RunSender r... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static String getMusterPfadFlv() {
final String PFAD_LINUX_FLV = "/usr/bin/flvstreamer";
final String PFAD_WINDOWS_FLV = "bin\\flvstreamer_win32_latest.exe";
final String PFAD_MAC_FLV = "bin\\flvstreamer_macosx_intel_32bit_latest";
Strin... | #vulnerable code
public static String getMusterPfadFlv() {
final String PFAD_LINUX_FLV = "/usr/bin/flvstreamer";
final String PFAD_WINDOWS_FLV = "bin\\flvstreamer_win32_latest.exe";
final String PFAD_MAC_FLV = "bin\\flvstreamer_macosx_intel_32bit_latest";
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static String getMusterPfadFlv() {
final String PFAD_LINUX_FLV = "/usr/bin/flvstreamer";
final String PFAD_WINDOWS_FLV = "bin\\flvstreamer_win32_latest.exe";
final String PFAD_MAC_FLV = "bin\\flvstreamer_macosx_intel_32bit_latest";
Strin... | #vulnerable code
public static String getMusterPfadFlv() {
final String PFAD_LINUX_FLV = "/usr/bin/flvstreamer";
final String PFAD_WINDOWS_FLV = "bin\\flvstreamer_win32_latest.exe";
final String PFAD_MAC_FLV = "bin\\flvstreamer_macosx_intel_32bit_latest";
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
void addToListNormal() {
//<strong style="margin-left:10px;">Sesamstraße präsentiert: Eine Möhre für Zwei</strong><br />
//<a style="margin-left:20px;" href="?programm=168&id=14487&ag=5" title="Sendung vom 10.10.2012" class="overlay_link">42. Ordnung i... | #vulnerable code
void ladenHttp(String filmWebsite, String thema, String alter) {
// erst die Nummer suchen
// >25420<4<165<23. Die b
// <http://www.kikaplus.net/clients/kika/mediathek/previewpic/1355302530-f80b463888fd4602d925b2ef2c861928 9.jpg<
final St... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void starten() {
daten = new Daten(pfad);
Daten.nogui = true;
if (!userAgent.equals("")) {
Daten.setUserAgentManuel(userAgent);
}
// Infos schreiben
Log.startMeldungen(this.getClass().getName());
if (s... | #vulnerable code
public void starten() {
daten = new Daten(pfad);
Daten.nogui = true;
if (!userAgent.equals("")) {
Daten.setUserAgentManuel(userAgent);
}
// Infos schreiben
Log.startMeldungen(this.getClass().getName());
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void downloadLoeschen(boolean dauerhaft) {
int rows[] = tabelle.getSelectedRows();
if (rows.length > 0) {
for (int i = rows.length - 1; i >= 0; --i) {
int delRow = tabelle.convertRowIndexToModel(rows[i]);
Str... | #vulnerable code
private void downloadLoeschen(boolean dauerhaft) {
int rows[] = jTable1.getSelectedRows();
if (rows.length > 0) {
for (int i = rows.length - 1; i >= 0; --i) {
int delRow = jTable1.convertRowIndexToModel(rows[i]);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static synchronized void startMeldungen(String classname) {
versionsMeldungen(classname);
Log.systemMeldung("Programmpfad: " + GuiFunktionenProgramme.getPathJar());
Log.systemMeldung("Verzeichnis Einstellungen: " + Daten.getBasisVerzeichnis());
... | #vulnerable code
public static synchronized void startMeldungen(String classname) {
Log.systemMeldung("###########################################################");
try {
//Version
Log.systemMeldung(Konstanten.PROGRAMMNAME + " " + Konstanten.VERS... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static String getPfadScript() {
String pfadScript;
final String PFAD_LINUX_SCRIPT = "bin/flv.sh";
final String PFAD_WINDOWS_SCRIPT = "bin\\flv.bat";
switch (getOs()) {
case OS_LINUX:
pfadScript = Funktionen.ge... | #vulnerable code
public static String getPfadScript() {
String pfadScript;
final String PFAD_LINUX_SCRIPT = "bin/flv.sh";
final String PFAD_WINDOWS_SCRIPT = "bin\\flv.bat";
if (System.getProperty("os.name").toLowerCase().contains("linux")) {
p... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public synchronized boolean zeileSchreiben(ArrayList<String[]> list) {
boolean ret = false;
String text;
String zeit = DatumZeit.getHeute_dd_MM_yyyy();
String thema, titel, url;
try (OutputStreamWriter writer = new OutputStreamWriter(F... | #vulnerable code
public synchronized boolean zeileSchreiben(ArrayList<String[]> list) {
boolean ret = false;
String text;
String zeit = DatumZeit.getHeute_dd_MM_yyyy();
String thema, titel, url;
OutputStreamWriter writer = null;
File f = n... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static String getCompileDate() {
// String ret = "";
// try {
// Date d = new Date(Main.class.getResource("Main.class").openConnection().getLastModified());
// ret = Konstanten.PROGRAMMNAME + " " + Konstanten.VERSION + " [Buildnumme... | #vulnerable code
public static String getCompileDate() {
String ret = "";
try {
Date d = new Date(Main.class.getResource("Main.class").openConnection().getLastModified());
ret = Konstanten.PROGRAMMNAME + " " + Konstanten.VERSION + " [Buildnummer:... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
void addToListNormal() {
//<strong style="margin-left:10px;">Sesamstraße präsentiert: Eine Möhre für Zwei</strong><br />
//<a style="margin-left:20px;" href="?programm=168&id=14487&ag=5" title="Sendung vom 10.10.2012" class="overlay_link">42. Ordnung i... | #vulnerable code
void ladenHttp(String filmWebsite, String thema, String alter) {
// erst die Nummer suchen
// >25420<4<165<23. Die b
// <http://www.kikaplus.net/clients/kika/mediathek/previewpic/1355302530-f80b463888fd4602d925b2ef2c861928 9.jpg<
final St... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void updateSender(String nameSenderFilmliste, ListeFilme alteListe) {
// nur für den Mauskontext "Sender aktualisieren"
// allesLaden = false;
initStart(alteListe);
MediathekReader reader = getMReaderNameSenderFilmliste(nameSenderFilmlist... | #vulnerable code
public void updateSender(String nameSenderFilmliste, ListeFilme alteListe) {
// nur für den Mauskontext "Sender aktualisieren"
allesLaden = false;
initStart(alteListe);
MediathekReader reader = getMReaderNameSenderFilmliste(nameSenderFilm... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static ListePset getStandardprogramme(DDaten ddaten) {
ListePset pSet;
InputStream datei;
switch (getOs()) {
case OS_LINUX:
datei = new GetFile().getPsetVorlageLinux();
break;
case OS_MAC:
... | #vulnerable code
public static ListePset getStandardprogramme(DDaten ddaten) {
ListePset pSet;
InputStream datei;
if (System.getProperty("os.name").toLowerCase().contains("linux")) {
datei = new GetFile().getPsetVorlageLinux();
} else if (Syst... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static boolean isLeopard() {
return SystemInfo.isMacOSX() && SystemInfo.getOSVersion().startsWith("10.5");
} | #vulnerable code
public static boolean isLeopard() {
return isMac() && getOsVersion().startsWith("10.5");
}
#location 2
#vulnerability type NULL_DEREFERENCE | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
void addToListNormal() {
//<strong style="margin-left:10px;">Sesamstraße präsentiert: Eine Möhre für Zwei</strong><br />
//<a style="margin-left:20px;" href="?programm=168&id=14487&ag=5" title="Sendung vom 10.10.2012" class="overlay_link">42. Ordnung i... | #vulnerable code
void ladenHttp(String filmWebsite, String thema, String alter) {
// erst die Nummer suchen
// >25420<4<165<23. Die b
// <http://www.kikaplus.net/clients/kika/mediathek/previewpic/1355302530-f80b463888fd4602d925b2ef2c861928 9.jpg<
final St... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public synchronized boolean zeileSchreiben(String thema, String titel, String url) {
boolean ret = false;
String text;
listeErledigteAbos.add(url);
//Automatic Resource Management
try (OutputStreamWriter writer = new OutputStreamWriter... | #vulnerable code
public synchronized boolean zeileSchreiben(String thema, String titel, String url) {
boolean ret = false;
String text;
listeErledigteAbos.add(url);
File f = new File(Daten.getBasisVerzeichnis(true) + Konstanten.LOG_DATEI_DOWNLOAD_ABOS);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void downloadLoeschen(boolean dauerhaft) {
int rows[] = tabelle.getSelectedRows();
if (rows.length > 0) {
for (int i = rows.length - 1; i >= 0; --i) {
int delRow = tabelle.convertRowIndexToModel(rows[i]);
Str... | #vulnerable code
private void downloadLoeschen(boolean dauerhaft) {
int rows[] = jTable1.getSelectedRows();
if (rows.length > 0) {
for (int i = rows.length - 1; i >= 0; --i) {
int delRow = jTable1.convertRowIndexToModel(rows[i]);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static synchronized void versionsMeldungen(String classname) {
Log.systemMeldung("###########################################################");
long totalMem = Runtime.getRuntime().totalMemory();
Log.systemMeldung("totalMemory: " + totalMem / (... | #vulnerable code
public static synchronized void versionsMeldungen(String classname) {
Log.systemMeldung("###########################################################");
long totalMem = Runtime.getRuntime().totalMemory();
Log.systemMeldung("totalMemory: " + totalM... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static String getMusterPfadMplayer() {
final String PFAD_LINUX = "/usr/bin/mplayer";
final String PFAD_MAC = "/opt/local/bin/mplayer";
final String PFAD_WIN_DEFAULT = "C:\\Program Files\\SMPlayer\\mplayer\\mplayer.exe";
final String PFAD... | #vulnerable code
public static String getMusterPfadMplayer() {
final String PFAD_LINUX = "/usr/bin/mplayer";
final String PFAD_MAC = "/opt/local/bin/mplayer";
String pfad = "";
if (System.getProperty("os.name").toLowerCase().contains("windows")) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static String getPfadScript() {
String pfadScript;
final String PFAD_LINUX_SCRIPT = "bin/flv.sh";
final String PFAD_WINDOWS_SCRIPT = "bin\\flv.bat";
switch (getOs()) {
case OS_LINUX:
pfadScript = Funktionen.ge... | #vulnerable code
public static String getPfadScript() {
String pfadScript;
final String PFAD_LINUX_SCRIPT = "bin/flv.sh";
final String PFAD_WINDOWS_SCRIPT = "bin\\flv.bat";
if (System.getProperty("os.name").toLowerCase().contains("linux")) {
p... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void filmStartenWiederholenStoppen(boolean alle, boolean starten /* starten/wiederstarten oder stoppen */) {
// bezieht sich immer auf "alle" oder nur die markierten
// Film der noch keinen Starts hat wird gestartet
// Film dessen Start schon a... | #vulnerable code
private void filmStartenWiederholenStoppen(boolean alle, boolean starten /* starten/wiederstarten oder stoppen */) {
// bezieht sich immer auf "alle" oder nur die markierten
// Film der noch keinen Starts hat wird gestartet
// Film dessen Start s... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static synchronized void startMeldungen(String classname) {
versionsMeldungen(classname);
Log.systemMeldung("Programmpfad: " + GuiFunktionenProgramme.getPathJar());
Log.systemMeldung("Verzeichnis Einstellungen: " + Daten.getBasisVerzeichnis());
... | #vulnerable code
public static synchronized void startMeldungen(String classname) {
Log.systemMeldung("###########################################################");
try {
//Version
Log.systemMeldung(Konstanten.PROGRAMMNAME + " " + Konstanten.VERS... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static String getCompileDate() {
// String ret = "";
// try {
// Date d = new Date(Main.class.getResource("Main.class").openConnection().getLastModified());
// ret = Konstanten.PROGRAMMNAME + " " + Konstanten.VERSION + " [Buildnumme... | #vulnerable code
public static String getCompileDate() {
String ret = "";
try {
Date d = new Date(Main.class.getResource("Main.class").openConnection().getLastModified());
ret = Konstanten.PROGRAMMNAME + " " + Konstanten.VERSION + " [Buildnummer:... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public synchronized void abosSuchen() {
// in der Filmliste nach passenden Filmen suchen und
// in die Liste der Downloads eintragen
boolean gefunden = false;
DatenFilm film;
DatenAbo abo;
boolean checkBlack = !Boolean.parseBoo... | #vulnerable code
public synchronized void abosSuchen() {
// in der Filmliste nach passenden Filmen suchen und
// in die Liste der Downloads eintragen
boolean gefunden = false;
DatenFilm film;
DatenAbo abo;
boolean checkBlack = !Boolean.pa... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void speichern() {
try (BufferedWriter br = new BufferedWriter(new OutputStreamWriter(new DataOutputStream(Files.newOutputStream(historyFilePath)))))
{
for (String h : this)
br.write(h + "\n");
br.flush();
... | #vulnerable code
public void speichern() {
try {
FileOutputStream fstream = new FileOutputStream(datei);
DataOutputStream out = new DataOutputStream(fstream);
BufferedWriter br = new BufferedWriter(new OutputStreamWriter(out));
for... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
void addToListNormal() {
//<strong style="margin-left:10px;">Sesamstraße präsentiert: Eine Möhre für Zwei</strong><br />
//<a style="margin-left:20px;" href="?programm=168&id=14487&ag=5" title="Sendung vom 10.10.2012" class="overlay_link">42. Ordnung i... | #vulnerable code
void ladenHttp(String filmWebsite, String thema, String alter) {
// erst die Nummer suchen
// >25420<4<165<23. Die b
// <http://www.kikaplus.net/clients/kika/mediathek/previewpic/1355302530-f80b463888fd4602d925b2ef2c861928 9.jpg<
final St... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void aktFilmSetzen() {
if (this.isShowing()) {
DatenFilm aktFilm = null;
int selectedTableRow = tabelle.getSelectedRow();
if (selectedTableRow >= 0) {
int selectedModelRow = tabelle.convertRowIndexToModel(sel... | #vulnerable code
private void aktFilmSetzen() {
if (this.isShowing()) {
DatenFilm aktFilm = null;
int selectedTableRow = tabelle.getSelectedRow();
if (selectedTableRow >= 0) {
int selectedModelRow = tabelle.convertRowIndexToMod... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static String getMusterPfadVlc() {
final String PFAD_LINUX_VLC = "/usr/bin/vlc";
final String PFAD_MAC_VLC = "/Applications/VLC.app/Contents/MacOS/VLC";
final String PFAD_WIN_DEFAULT = "C:\\Programme\\VideoLAN\\VLC\\vlc.exe";
final Strin... | #vulnerable code
public static String getMusterPfadVlc() {
final String PFAD_LINUX_VLC = "/usr/bin/vlc";
final String PFAD_MAC_VLC = "/Applications/VLC.app/Contents/MacOS/VLC";
String pfad = "";
if (System.getProperty("os.name").toLowerCase().contains("wi... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void playerStarten(DatenPset pSet) {
// Url mit Prognr. starten
if (tabelle.getSelectedRow() == -1) {
new HinweisKeineAuswahl().zeigen(parentComponent);
} else if (pSet.istSpeichern()) {
// wenn das pSet zum Speichern (ü... | #vulnerable code
private void playerStarten(DatenPset pSet) {
// Url mit Prognr. starten
if (tabelle.getSelectedRow() == -1) {
new HinweisKeineAuswahl().zeigen(parentComponent);
} else if (pSet.istSpeichern()) {
// wenn das pSet zum Speich... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void laden() {
clear();
if (Files.notExists(historyFilePath))
return;
try (BufferedReader br = new BufferedReader(new InputStreamReader(new DataInputStream(Files.newInputStream(historyFilePath))))) {
String strLine;
... | #vulnerable code
public void laden() {
clear();
File file = new File(datei);
if (!file.exists()) {
return;
}
try {
FileInputStream fstream = new FileInputStream(datei);
DataInputStream in = new DataInputStream(f... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public boolean filmlisteIstAelter() {
return filmlisteIstAelter(FilmeLaden.ALTER_FILMLISTE_SEKUNDEN_FUER_AUTOUPDATE);
} | #vulnerable code
public boolean filmlisteIstAelter() {
// Filmliste ist älter als: FilmeLaden.ALTER_FILMLISTE_SEKUNDEN_FUER_AUTOUPDATE
int ret = -1;
Date jetzt = new Date(System.currentTimeMillis());
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy... | 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.