input stringlengths 205 73.3k | output stringlengths 64 73.2k | instruction stringclasses 1
value |
|---|---|---|
#vulnerable code
@Test
public void certificateReadThrowsRuntimeException()
throws ExecutionException, InterruptedException, IOException {
MockTokenServerTransport transport = new MockTokenServerTransport();
transport.addServiceAccount(ServiceAccount.EDITOR.getEmail(), ACCE... | #fixed code
@Test
public void certificateReadThrowsRuntimeException()
throws ExecutionException, InterruptedException {
MockTokenServerTransport transport = new MockTokenServerTransport();
transport.addServiceAccount(ServiceAccount.EDITOR.getEmail(), ACCESS_TOKEN);
Inp... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public ConnectionContext getConnectionContext() {
return new ConnectionContext(
this.getLogger(),
wrapAuthTokenProvider(this.getAuthTokenProvider()),
this.getExecutorService(),
this.isPersistenceEnabled(),
FirebaseDatabase.getSd... | #fixed code
public ConnectionContext getConnectionContext() {
return new ConnectionContext(
this.logger,
wrapAuthTokenProvider(this.getAuthTokenProvider()),
this.getExecutorService(),
this.isPersistenceEnabled(),
FirebaseDatabase.getSdkVersion(),... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static String streamToString(InputStream inputStream) throws IOException {
StringBuilder stringBuilder = new StringBuilder();
Reader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
char[] buffer = new char[256];
int length;
... | #fixed code
private static String streamToString(InputStream inputStream) throws IOException {
InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
return CharStreams.toString(reader);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void refreshTokenReadThrowsRuntimeException()
throws ExecutionException, InterruptedException, IOException {
MockTokenServerTransport transport = new MockTokenServerTransport();
transport.addServiceAccount(ServiceAccount.EDITOR.getEmail(), ACC... | #fixed code
@Test
public void refreshTokenReadThrowsRuntimeException()
throws ExecutionException, InterruptedException {
MockTokenServerTransport transport = new MockTokenServerTransport();
transport.addServiceAccount(ServiceAccount.EDITOR.getEmail(), ACCESS_TOKEN);
In... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void canConvertDoubles() throws IOException {
List<Double> doubles = Arrays.asList(Double.MAX_VALUE, Double.MIN_VALUE, Double.MIN_NORMAL);
for (Double original : doubles) {
String jsonString = JsonMapper.serializeJsonValue(original);
dou... | #fixed code
@Test
public void canConvertDoubles() throws IOException {
List<Double> doubles = Arrays.asList(Double.MAX_VALUE, Double.MIN_VALUE, Double.MIN_NORMAL);
for (Double original : doubles) {
String jsonString = JsonMapper.serializeJson(original);
double convert... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void canConvertLongs() throws IOException {
List<Long> longs = Arrays.asList(Long.MAX_VALUE, Long.MIN_VALUE);
for (Long original : longs) {
String jsonString = JsonMapper.serializeJsonValue(original);
long converted = (Long) JsonMapper.p... | #fixed code
@Test
public void canConvertLongs() throws IOException {
List<Long> longs = Arrays.asList(Long.MAX_VALUE, Long.MIN_VALUE);
for (Long original : longs) {
String jsonString = JsonMapper.serializeJson(original);
long converted = (Long) JsonMapper.parseJsonVal... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testDeleteInstanceIdError() throws Exception {
final MockLowLevelHttpResponse response = new MockLowLevelHttpResponse();
MockHttpTransport transport = new MockHttpTransport.Builder()
.setLowLevelHttpResponse(response)
.build();
... | #fixed code
@Test
public void testDeleteInstanceIdError() throws Exception {
final MockLowLevelHttpResponse response = new MockLowLevelHttpResponse();
MockHttpTransport transport = new MockHttpTransport.Builder()
.setLowLevelHttpResponse(response)
.build();
Fi... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static String streamToString(InputStream inputStream) throws IOException {
StringBuilder stringBuilder = new StringBuilder();
Reader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
char[] buffer = new char[256];
int length;
... | #fixed code
private static String streamToString(InputStream inputStream) throws IOException {
InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
return CharStreams.toString(reader);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void main(String[] args)
{
String source = System.getProperty("source");
String destination = System.getProperty("destination");
if (source == null) {
help();
return;
}
int thread... | #fixed code
public static void main(String[] args) {
Configuration cfg = parseLegacyConfiguration();
if (cfg == null) {
cfg = parseConfiguration(args);
}
if (cfg == null) {
Options options = createOptions();
printHelp(op... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private List<ApiParamDoc> getQueryParamsFromSpringAnnotation(Method method, Class<?> controller) {
List<ApiParamDoc> apiParamDocs = new ArrayList<ApiParamDoc>();
if(controller.isAnnotationPresent(RequestMapping.class)) {
RequestMapping requestMapping = controller... | #fixed code
private List<ApiParamDoc> getQueryParamsFromSpringAnnotation(Method method, Class<?> controller) {
List<ApiParamDoc> apiParamDocs = new ArrayList<ApiParamDoc>();
if(controller.isAnnotationPresent(RequestMapping.class)) {
RequestMapping requestMapping = controller.getAn... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@SuppressWarnings("resource")
@Override
public CBORParser createParser(File f) throws IOException {
return _createParser(new FileInputStream(f), _createContext(f, true));
}
#location 4
#vulner... | #fixed code
@SuppressWarnings("resource")
@Override
public CBORParser createParser(File f) throws IOException {
IOContext ctxt = _createContext(f, true);
return _createParser(_decorate(new FileInputStream(f), ctxt), ctxt);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private JsonToken _handleNestedKey(int tag) throws IOException
{
int wireType = (tag & 0x7);
int id = (tag >> 3);
ProtobufField f;
if ((_currentField == null) || (f = _currentField.nextOrThisIf(id)) == null) {
f = _curren... | #fixed code
private JsonToken _handleNestedKey(int tag) throws IOException
{
int wireType = (tag & 0x7);
int id = (tag >> 3);
ProtobufField f;
if ((_currentField == null) || (f = _currentField.nextOrThisIf(id)) == null) {
f = _currentMessa... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private JsonToken _handleNestedKey(int tag) throws IOException
{
int wireType = (tag & 0x7);
int id = (tag >> 3);
ProtobufField f;
if ((_currentField == null) || (f = _currentField.nextOrThisIf(id)) == null) {
f = _curren... | #fixed code
private JsonToken _handleNestedKey(int tag) throws IOException
{
int wireType = (tag & 0x7);
int id = (tag >> 3);
ProtobufField f;
if (_currentField != null) {
if ((f = _currentField.nextOrThisIf(id)) == null) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testMemoryAreas() {
assertEquals(
500000L,
registry.getSampleValue(
MemoryPoolsExports.MEMORY_USED_METRIC,
new String[]{"area"},
new String[]{"heap"}),
.0000001);
assertEquals(
... | #fixed code
@Test
public void testMemoryAreas() {
assertEquals(
500000L,
registry.getSampleValue(
"jvm_memory_bytes_used",
new String[]{"area"},
new String[]{"heap"}),
.0000001);
assertEquals(
1000000L,
r... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testGarbageCollectorExports() {
assertEquals(
100L,
registry.getSampleValue(
GarbageCollectorExports.COLLECTIONS_COUNT_METRIC,
new String[]{"gc"},
new String[]{"MyGC1"}),
.0000001);
as... | #fixed code
@Test
public void testGarbageCollectorExports() {
assertEquals(
100L,
registry.getSampleValue(
"jvm_gc_collection_seconds_count",
new String[]{"gc"},
new String[]{"MyGC1"}),
.0000001);
assertEquals(
1... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testMemoryPools() {
assertEquals(
500000L,
registry.getSampleValue(
MemoryPoolsExports.POOLS_USED_METRIC,
new String[]{"pool"},
new String[]{"PS-Eden-Space"}),
.0000001);
assertEquals(... | #fixed code
@Test
public void testMemoryPools() {
assertEquals(
500000L,
registry.getSampleValue(
"jvm_memory_pool_bytes_used",
new String[]{"pool"},
new String[]{"PS Eden Space"}),
.0000001);
assertEquals(
10000... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void priceFormat() {
assertEquals("%7.2f ", INSTRUMENTS.get("FOO").getPriceFormat());
}
#location 3
#vulnerability type NULL_DEREFERENCE | #fixed code
@Test
public void priceFormat() {
assertEquals("%7.2f ", FRACTIONS.get("FOO").getPriceFormat());
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static void main(Config config) throws IOException {
MarketData marketData = marketData(config);
MarketReportServer marketReport = marketReport(config);
List<String> instruments = config.getStringList("instruments");
MatchingEn... | #fixed code
private static void main(Config config) throws IOException {
MarketData marketData = marketData(config);
MarketReporting marketReporting = marketReporting(config);
List<String> instruments = config.getStringList("instruments");
MatchingEngin... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static void main(Config config, boolean taq) throws IOException {
NetworkInterface multicastInterface = Configs.getNetworkInterface(config, "market-data.multicast-interface");
InetAddress multicastGroup = Configs.getInetAddress(config, "... | #fixed code
private static void main(Config config, boolean taq) throws IOException {
NetworkInterface multicastInterface = Configs.getNetworkInterface(config, "market-data.multicast-interface");
InetAddress multicastGroup = Configs.getInetAddress(config, "market... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static void main(Config config, boolean taq) throws IOException {
NetworkInterface multicastInterface = Configs.getNetworkInterface(config, "market-data.multicast-interface");
InetAddress multicastGroup = Configs.getInetAddress(config, "... | #fixed code
private static void main(Config config, boolean taq) throws IOException {
NetworkInterface multicastInterface = Configs.getNetworkInterface(config, "market-data.multicast-interface");
InetAddress multicastGroup = Configs.getInetAddress(config, "market... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void priceFractionDigits() {
assertEquals(2, INSTRUMENTS.get("FOO").getPriceFractionDigits());
}
#location 3
#vulnerability type NULL_DEREFERENCE | #fixed code
@Test
public void priceFractionDigits() {
assertEquals(2, FRACTIONS.get("FOO").getPriceFractionDigits());
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static void main(Config config, boolean tsv) throws IOException {
NetworkInterface multicastInterface = Configs.getNetworkInterface(config, "trade-report.multicast-interface");
InetAddress multicastGroup = Configs.getInetAddress(config, ... | #fixed code
private static void main(Config config, boolean tsv) throws IOException {
NetworkInterface multicastInterface = Configs.getNetworkInterface(config, "trade-report.multicast-interface");
InetAddress multicastGroup = Configs.getInetAddress(config, "trade... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static void listen(boolean taq, Config config) throws IOException {
List<String> instruments = config.getStringList("instruments");
MarketDataListener listener = taq ? new TAQFormat() : new DisplayFormat(instruments);
Market market = ne... | #fixed code
private static void listen(boolean taq, Config config) throws IOException {
Instruments instruments = Instruments.fromConfig(config, "instruments");
MarketDataListener listener = taq ? new TAQFormat(instruments) : new DisplayFormat(instruments);
Mark... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void priceFactor() {
assertEquals(100.0, INSTRUMENTS.get("FOO").getPriceFactor(), 0.0);
}
#location 3
#vulnerability type NULL_DEREFERENCE | #fixed code
@Test
public void priceFactor() {
assertEquals(100.0, FRACTIONS.get("FOO").getPriceFactor(), 0.0);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
boolean add(Side side, long price, long quantity) {
Long2LongRBTreeMap levels = getLevels(side);
long size = levels.get(price);
levels.put(price, size + quantity);
return price == levels.firstLongKey();
}
... | #fixed code
OrderBook(long instrument) {
this.instrument = instrument;
this.bids = new Long2LongRBTreeMap(BidComparator.INSTANCE);
this.asks = new Long2LongRBTreeMap(AskComparator.INSTANCE);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void run() throws IOException {
ConsoleReader reader = new ConsoleReader();
reader.addCompleter(new StringsCompleter(Commands.names().castToList()));
printf("Type 'help' for help.\n");
while (!closed) {
String line =... | #fixed code
public void run() throws IOException {
LineReader reader = LineReaderBuilder.builder()
.completer(new StringsCompleter(Commands.names().castToList()))
.build();
printf("Type 'help' for help.\n");
while (!closed) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static void listen(boolean taq, Config config) throws IOException {
List<String> instruments = config.getStringList("instruments");
MarketDataListener listener = taq ? new TAQFormat() : new DisplayFormat(instruments);
Market market = ne... | #fixed code
private static void listen(boolean taq, Config config) throws IOException {
Instruments instruments = Instruments.fromConfig(config, "instruments");
MarketDataListener listener = taq ? new TAQFormat(instruments) : new DisplayFormat(instruments);
Mark... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void add(long instrument, long orderId, Side side, long price, long size) {
if (orders.containsKey(orderId))
return;
OrderBook book = books.get(instrument);
if (book == null)
return;
Order order = book.add... | #fixed code
public void add(long instrument, long orderId, Side side, long price, long size) {
if (orders.containsKey(orderId))
return;
OrderBook book = books.get(instrument);
if (book == null)
return;
Order order = new Order(book... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void run() throws IOException {
ConsoleReader reader = new ConsoleReader();
reader.addCompleter(new StringsCompleter(Commands.names().castToList()));
printf("Type 'help' for help.\n");
while (!closed) {
String line =... | #fixed code
public void run() throws IOException {
LineReader reader = LineReaderBuilder.builder()
.completer(new StringsCompleter(Commands.names().castToList()))
.build();
printf("Type 'help' for help.\n");
while (!closed) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
boolean update(Side side, long price, long quantity) {
Long2LongRBTreeMap levels = getLevels(side);
long oldSize = levels.get(price);
long newSize = oldSize + quantity;
boolean onBestLevel = price == levels.firstLongKey();
if (... | #fixed code
OrderBook(long instrument) {
this.instrument = instrument;
this.bids = new Long2LongRBTreeMap(BidComparator.INSTANCE);
this.asks = new Long2LongRBTreeMap(AskComparator.INSTANCE);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static void main(Config config) throws IOException {
MarketDataServer marketData = marketData(config);
String marketReportSession = config.getString("market-report.session");
InetAddress marketReportMulticastGroup = Configs.g... | #fixed code
private static void main(Config config) throws IOException {
MarketDataServer marketData = marketData(config);
MarketReportServer marketReport = marketReport(config);
List<String> instruments = config.getStringList("instruments");
MatchingEn... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void run(ApplicationArguments args) throws Exception {
try {
// 测试 Redis连接是否正常
redisService.exists("febs_test");
} catch (Exception e) {
log.error(" ____ __ _ _ ");
log.error("| ... | #fixed code
@Override
public void run(ApplicationArguments args) throws Exception {
try {
// 测试 Redis连接是否正常
redisService.exists("febs_test");
} catch (Exception e) {
log.error(" ____ __ _ _ ");
log.error("| |_ /... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private String[] extendArgs(String file, String oldargs[], int offset)
throws ArgumentParserException {
List<String> list = new ArrayList<String>();
BufferedReader reader;
try {
reader = new BufferedReader(new InputStreamR... | #fixed code
private String[] extendArgs(String file, String oldargs[], int offset)
throws ArgumentParserException {
List<String> list = new ArrayList<String>();
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStream... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void saveResource(String resourcePath, boolean replace) {
if (resourcePath == null || resourcePath.equals("")) {
throw new IllegalArgumentException("ResourcePath cannot be null or empty");
}
resourcePath = resourcePath.replace... | #fixed code
public void saveResource(String resourcePath, boolean replace) {
if (resourcePath == null || resourcePath.equals("")) {
throw new IllegalArgumentException("ResourcePath cannot be null or empty");
}
resourcePath = resourcePath.replace('\\',... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void load(File file) throws FileNotFoundException, IOException, InvalidConfigurationException {
Validate.notNull(file, "File cannot be null");
load(new FileInputStream(file));
}
#location 4
... | #fixed code
public void load(File file) throws FileNotFoundException, IOException, InvalidConfigurationException {
Validate.notNull(file, "File cannot be null");
final FileInputStream stream = new FileInputStream(file);
load(new InputStreamReader(stream, UTF8_OV... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public Plugin loadPlugin(File file) throws InvalidPluginException, InvalidDescriptionException, UnknownDependencyException {
JavaPlugin result = null;
PluginDescriptionFile description = null;
if (!file.exists()) {
throw new InvalidP... | #fixed code
public Plugin loadPlugin(File file) throws InvalidPluginException, InvalidDescriptionException, UnknownDependencyException {
return loadPlugin(file, false);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true;
if (args.length < 1 || args.length > 4) {
sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);... | #fixed code
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true;
if (args.length < 1 || args.length > 4) {
sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void recalculatePermissions() {
dirtyPermissions = true;
}
#location 2
#vulnerability type THREAD_SAFETY_VIOLATION | #fixed code
public void recalculatePermissions() {
clearPermissions();
Set<Permission> defaults = Bukkit.getServer().getPluginManager().getDefaultPermissions(isOp());
Bukkit.getServer().getPluginManager().subscribeToDefaultPerms(isOp(), parent);
for (Perm... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static String getArchName() {
String osArch = System.getProperty("os.arch");
if(osArch.startsWith("arm")) {
// Java 1.8 introduces a system property to determine armel or armhf
if(System.getProperty("sun.arch.abi") != null ... | #fixed code
public static String getArchName() {
String osArch = System.getProperty("os.arch");
if(osArch.startsWith("arm")) {
osArch = resolveArmArchType();
}
else {
String lc = osArch.toLowerCase(Locale.US);
if(archMap... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
int enable_load_extension(boolean enable) throws SQLException
{
return call("sqlite3_enable_load_extension", handle, enable ? 1 : 0);
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | #fixed code
int shared_cache(boolean enable) throws SQLException
{
// The shared cache is per-process, so it is useless as
// each nested connection is its own process.
return -1;
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void setMaxRows(int max) throws SQLException {
checkOpen();
if (max < 0)
throw new SQLException("max row count must be >= 0");
rs.maxRows = max;
}
#location 2
#vulne... | #fixed code
public void setMaxRows(int max) throws SQLException {
//checkOpen();
if (max < 0)
throw new SQLException("max row count must be >= 0");
rs.maxRows = max;
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static boolean extractAndLoadLibraryFile(String libFolderForCurrentOS, String libraryFileName,
String targetFolder)
{
String nativeLibraryFilePath = libFolderForCurrentOS + "/" + libraryFileName;
final String prefix = "sqlite-3.6.... | #fixed code
private static boolean extractAndLoadLibraryFile(String libFolderForCurrentOS, String libraryFileName,
String targetFolder)
{
String nativeLibraryFilePath = libFolderForCurrentOS + "/" + libraryFileName;
final String prefix = String.format("sql... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static String getArchName() {
String osArch = System.getProperty("os.arch");
if(osArch.startsWith("arm")) {
// Java 1.8 introduces a system property to determine armel or armhf
if(System.getProperty("sun.arch.abi") != null ... | #fixed code
public static String getArchName() {
String osArch = System.getProperty("os.arch");
if(osArch.startsWith("arm")) {
osArch = resolveArmArchType();
}
else {
String lc = osArch.toLowerCase(Locale.US);
if(archMap... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public int getMaxRows() throws SQLException {
checkOpen();
return rs.maxRows;
}
#location 2
#vulnerability type THREAD_SAFETY_VIOLATION | #fixed code
public int getMaxRows() throws SQLException {
//checkOpen();
return rs.maxRows;
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static String getArchName() {
String osArch = System.getProperty("os.arch");
if(osArch.startsWith("arm")) {
// Java 1.8 introduces a system property to determine armel or armhf
if(System.getProperty("sun.arch.abi") != null ... | #fixed code
public static String getArchName() {
String osArch = System.getProperty("os.arch");
if(osArch.startsWith("arm")) {
osArch = resolveArmArchType();
}
else {
String lc = osArch.toLowerCase(Locale.US);
if(archMap... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static boolean extractAndLoadLibraryFile(String libFolderForCurrentOS, String libraryFileName,
String targetFolder) {
String nativeLibraryFilePath = libFolderForCurrentOS + "/" + libraryFileName;
... | #fixed code
private static boolean extractAndLoadLibraryFile(String libFolderForCurrentOS, String libraryFileName,
String targetFolder) {
String nativeLibraryFilePath = libFolderForCurrentOS + "/" + libraryFileName;
// ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void basicBusyHandler() throws Exception {
final int[] calls = {0};
BusyHandler.setHandler(conn, new BusyHandler() {
@Override
protected int callback(int nbPrevInvok) throws SQLException {
assertEq... | #fixed code
@Test
public void basicBusyHandler() throws Exception {
final int[] calls = {0};
BusyHandler.setHandler(conn, new BusyHandler() {
@Override
protected int callback(int nbPrevInvok) throws SQLException {
assertEquals(n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static boolean extractAndLoadLibraryFile(String libFolderForCurrentOS, String libraryFileName,
String targetFolder) {
String nativeLibraryFilePath = libFolderForCurrentOS + "/" + libraryFileName;
... | #fixed code
private static boolean extractAndLoadLibraryFile(String libFolderForCurrentOS, String libraryFileName,
String targetFolder) {
String nativeLibraryFilePath = libFolderForCurrentOS + "/" + libraryFileName;
// ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public Map<String,Class<?>> getTypeMap() throws SQLException {
synchronized (typeMap) {
if (this.typeMap == null) {
this.typeMap = new HashMap<String, Class<?>>();
}
return this.typeMap;
}
}
... | #fixed code
public Map<String,Class<?>> getTypeMap() throws SQLException {
synchronized (this) {
if (this.typeMap == null) {
this.typeMap = new HashMap<String, Class<?>>();
}
return this.typeMap;
}
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testUnregister() throws Exception {
final int[] calls = {0};
BusyHandler.setHandler(conn, new BusyHandler() {
@Override
protected int callback(int nbPrevInvok) throws SQLException {
assertEqua... | #fixed code
@Test
public void testUnregister() throws Exception {
final int[] calls = {0};
BusyHandler.setHandler(conn, new BusyHandler() {
@Override
protected int callback(int nbPrevInvok) throws SQLException {
assertEquals(nbP... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static String getArchName() {
String osArch = System.getProperty("os.arch");
if(osArch.startsWith("arm")) {
// Java 1.8 introduces a system property to determine armel or armhf
if(System.getProperty("sun.arch.abi") != null ... | #fixed code
public static String getArchName() {
String osArch = System.getProperty("os.arch");
if(osArch.startsWith("arm")) {
osArch = resolveArmArchType();
}
else {
String lc = osArch.toLowerCase(Locale.US);
if(archMap... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public boolean execute(String sql) throws SQLException {
internalClose();
SQLExtension ext = ExtendedCommand.parse(sql);
if (ext != null) {
ext.execute(db);
return false;
}
this.sql = sql;
bool... | #fixed code
public boolean execute(String sql) throws SQLException {
internalClose();
SQLExtension ext = ExtendedCommand.parse(sql);
if (ext != null) {
ext.execute(db);
return false;
}
this.sql = sql;
db.prepare... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void setTypeMap(Map map) throws SQLException {
synchronized (typeMap) {
this.typeMap = map;
}
}
#location 2
#vulnerability type THREAD_SAFETY_VIOLATION | #fixed code
public void setTypeMap(Map map) throws SQLException {
synchronized (this) {
this.typeMap = map;
}
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static boolean extractAndLoadLibraryFile(String libFolderForCurrentOS, String libraryFileName,
String targetFolder) {
String nativeLibraryFilePath = libFolderForCurrentOS + "/" + libraryFileName;
... | #fixed code
private static boolean extractAndLoadLibraryFile(String libFolderForCurrentOS, String libraryFileName,
String targetFolder) {
String nativeLibraryFilePath = libFolderForCurrentOS + "/" + libraryFileName;
// ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static boolean extractAndLoadLibraryFile(String libFolderForCurrentOS, String libraryFileName,
String targetFolder)
{
String nativeLibraryFilePath = libFolderForCurrentOS + "/" + libraryFileName;
final String prefix = "sqlite-3.6.... | #fixed code
private static boolean extractAndLoadLibraryFile(String libFolderForCurrentOS, String libraryFileName,
String targetFolder)
{
String nativeLibraryFilePath = libFolderForCurrentOS + "/" + libraryFileName;
final String prefix = String.format("sql... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@GetMapping()
public String profile(ModelMap mmap)
{
SysUser user = getUser();
user.setSex(dictDataService.selectDictLabel("sys_user_sex", user.getSex()));
mmap.put("user", user);
mmap.put("roleGroup", userService.selectUserRoleGr... | #fixed code
@GetMapping()
public String profile(ModelMap mmap)
{
SysUser user = getSysUser();
user.setSex(dictDataService.selectDictLabel("sys_user_sex", user.getSex()));
mmap.put("user", user);
mmap.put("roleGroup", userService.selectUserRoleGroup... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@GetMapping("/checkPassword")
@ResponseBody
public boolean checkPassword(String password)
{
SysUser user = getUser();
String encrypt = new Md5Hash(user.getLoginName() + password + user.getSalt()).toHex().toString();
if (user.getPasswo... | #fixed code
@GetMapping("/checkPassword")
@ResponseBody
public boolean checkPassword(String password)
{
SysUser user = getSysUser();
String encrypt = new Md5Hash(user.getLoginName() + password + user.getSalt()).toHex().toString();
if (user.getPassword(... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Async
protected void handleLog(final JoinPoint joinPoint, final Exception e)
{
try
{
// 获得注解
Log controllerLog = getAnnotationLog(joinPoint);
if (controllerLog == null)
{
return;
... | #fixed code
@Async
protected void handleLog(final JoinPoint joinPoint, final Exception e)
{
try
{
// 获得注解
Log controllerLog = getAnnotationLog(joinPoint);
if (controllerLog == null)
{
return;
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@GetMapping("/checkPassword")
@ResponseBody
public boolean checkPassword(String password)
{
SysUser user = getUser();
String encrypt = new Md5Hash(user.getLoginName() + password + user.getSalt()).toHex().toString();
if (user.getPasswo... | #fixed code
@GetMapping("/checkPassword")
@ResponseBody
public boolean checkPassword(String password)
{
SysUser user = getSysUser();
String encrypt = new Md5Hash(user.getLoginName() + password + user.getSalt()).toHex().toString();
if (user.getPassword(... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static String getLoginName()
{
return getUser().getLoginName();
}
#location 3
#vulnerability type NULL_DEREFERENCE | #fixed code
public static String getLoginName()
{
return getSysUser().getLoginName();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public String getLoginName()
{
return getUser().getLoginName();
}
#location 3
#vulnerability type NULL_DEREFERENCE | #fixed code
public String getLoginName()
{
return getSysUser().getLoginName();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static Long getUserId()
{
return getUser().getUserId().longValue();
}
#location 3
#vulnerability type NULL_DEREFERENCE | #fixed code
public static Long getUserId()
{
return getSysUser().getUserId().longValue();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public Long getUserId()
{
return getUser().getUserId();
}
#location 3
#vulnerability type NULL_DEREFERENCE | #fixed code
public Long getUserId()
{
return getSysUser().getUserId();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static Long getUserId()
{
return getUser().getUserId().longValue();
}
#location 3
#vulnerability type NULL_DEREFERENCE | #fixed code
public static Long getUserId()
{
return getSysUser().getUserId().longValue();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public List<T> importExcel(String sheetName, InputStream input) throws Exception
{
List<T> list = new ArrayList<T>();
Workbook workbook = WorkbookFactory.create(input);
Sheet sheet = null;
if (StringUtils.isNotEmpty(sheetName))
... | #fixed code
public List<T> importExcel(String sheetName, InputStream input) throws Exception
{
List<T> list = new ArrayList<T>();
Workbook workbook = WorkbookFactory.create(input);
Sheet sheet = null;
if (StringUtils.isNotEmpty(sheetName))
{
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
protected void clearState() {
setConnection(null);
offeredCapabilities = Collections.emptyList();
activeSenders.clear();
activeRequestResponseClients.clear();
failAllCreationRequests();
// make sure we make configured nu... | #fixed code
protected void clearState() {
setConnection(null);
activeSenders.clear();
activeRequestResponseClients.clear();
failAllCreationRequests();
// make sure we make configured number of attempts to re-connect
connectAttempts = new ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
protected void onClose(final MqttEndpoint endpoint) {
metrics.decrementMqttConnections(getCredentials(endpoint.auth()).getTenantId());
}
#location 2
#vulnerability type NULL_DEREFERENCE | #fixed code
protected void onClose(final MqttEndpoint endpoint) {
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testGetOrCreateSenderFailsOnConnectionFailure(final TestContext ctx) {
// GIVEN a client that tries to create a telemetry sender for "tenant"
ProtonConnection con = mock(ProtonConnection.class);
DisconnectHandlerProvidingCo... | #fixed code
@Test
public void testGetOrCreateSenderFailsOnConnectionFailure(final TestContext ctx) {
// GIVEN a client that tries to create a telemetry sender for "tenant"
final Async connected = ctx.async();
final HonoClientImpl client = new HonoClientImpl(v... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private void sendRegistrationData(final ProtonDelivery delivery, final Message msg) {
final ResourceIdentifier messageAddress = ResourceIdentifier.fromString(
MessageHelper.getAnnotation(msg, APP_PROPERTY_RESOURCE_ID));
checkPermission(me... | #fixed code
private void sendRegistrationData(final ProtonDelivery delivery, final Message msg) {
vertx.runOnContext(run -> {
final JsonObject registrationMsg = RegistrationConstants.getRegistrationMsg(msg);
vertx.eventBus().send(EVENT_BUS_ADDRESS_REGISTRA... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static Optional<TimeUntilDisconnectNotification> fromMessage(final Message msg) {
if (MessageHelper.isDeviceCurrentlyConnected(msg)) {
final String tenantId = MessageHelper.getTenantIdAnnotation(msg);
final String deviceId = Messa... | #fixed code
public static Optional<TimeUntilDisconnectNotification> fromMessage(final Message msg) {
final Integer ttd = MessageHelper.getTimeUntilDisconnect(msg);
if (ttd == null) {
return Optional.empty();
} else if (ttd == 0 || MessageHelper.isDev... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testGetOrCreateRequestResponseClientFailsOnConnectionFailure(final TestContext ctx) {
// GIVEN a client that tries to create a registration client for "tenant"
ProtonConnection con = mock(ProtonConnection.class);
Disconnect... | #fixed code
@Test
public void testGetOrCreateRequestResponseClientFailsOnConnectionFailure(final TestContext ctx) {
// GIVEN a client that tries to create a registration client for "tenant"
final Async connected = ctx.async();
final HonoClientImpl client = ne... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private R getRequestResponseResult(final Message message) {
final Integer status = MessageHelper.getApplicationProperty(
message.getApplicationProperties(),
MessageHelper.APP_PROPERTY_STATUS,
Integer.class);
... | #fixed code
private R getRequestResponseResult(final Message message) {
final Integer status = MessageHelper.getApplicationProperty(
message.getApplicationProperties(),
MessageHelper.APP_PROPERTY_STATUS,
Integer.class);
if ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testCreateEventConsumerFailsOnConnectionFailure(final TestContext ctx) {
// GIVEN a client that already tries to create a telemetry sender for "tenant"
ProtonConnection con = mock(ProtonConnection.class);
DisconnectHandlerP... | #fixed code
@Test
public void testCreateEventConsumerFailsOnConnectionFailure(final TestContext ctx) {
// GIVEN a client that already tries to create a telemetry sender for "tenant"
final Async connected = ctx.async();
final HonoClientImpl client = new HonoCl... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testConnectTriesToReconnectOnFailedConnectAttempt(final TestContext ctx) {
// GIVEN a client that cannot connect to the server
ProtonConnection con = mock(ProtonConnection.class);
// expect the connection factory to fail tw... | #fixed code
@Test
public void testConnectTriesToReconnectOnFailedConnectAttempt(final TestContext ctx) {
// GIVEN a client that cannot connect to the server
// expect the connection factory to fail twice and succeed on third connect attempt
connectionFactory ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testCreateTelemetryConsumerFailsOnConnectionFailure(final TestContext ctx) {
// GIVEN a client that already tries to create a telemetry sender for "tenant"
ProtonConnection con = mock(ProtonConnection.class);
DisconnectHand... | #fixed code
@Test
public void testCreateTelemetryConsumerFailsOnConnectionFailure(final TestContext ctx) {
// GIVEN a client that already tries to create a telemetry sender for "tenant"
final Async connected = ctx.async();
final HonoClientImpl client = new Ho... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testDownstreamDisconnectTriggersReconnect(final TestContext ctx) {
final ProtonConnection connectionToCreate = mock(ProtonConnection.class);
when(connectionToCreate.getRemoteContainer()).thenReturn("server");
// expect the ... | #fixed code
@Test
public void testDownstreamDisconnectTriggersReconnect(final TestContext ctx) {
// expect the connection factory to be invoked twice
// first on initial connection
// second on re-connect attempt
connectionFactory = new DisconnectHand... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private void sendTelemetryData(final LinkWrapper link, final ProtonDelivery delivery, final Message msg) {
if (!delivery.remotelySettled()) {
LOG.trace("received un-settled telemetry message on link [{}]", link.getLinkId());
}
final R... | #fixed code
private void sendTelemetryData(final LinkWrapper link, final ProtonDelivery delivery, final Message msg) {
if (!delivery.remotelySettled()) {
LOG.trace("received un-settled telemetry message on link [{}]", link.getLinkId());
}
final Resourc... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEachOnce() throws IOException {
//Each record exactly once - see commit b8f6d6dfaf11cce7d8cba54e6011e8684ade0e85, issue #68
Assert.assertArrayEquals(new int[] { 0, 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-simple.json", 0, 63)))... | #fixed code
@Test
public void TestEachOnce() throws Exception {
//Each record exactly once - see commit b8f6d6dfaf11cce7d8cba54e6011e8684ade0e85, issue #68
Assert.assertArrayEquals(new int[] { 0, 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-simple.json", 0, 63)));
Asse... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestArbitrarySplitLocations() throws IOException {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor... | #fixed code
@Test
public void TestArbitrarySplitLocations() throws Exception {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscCloseLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc4.json", 0, 44)));
Assert.assertArray... | #fixed code
@Test
public void TestEscCloseLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc4.json", 0, 44)));
Assert.assertArrayEquals(n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestIntOnly() throws Exception { // Is this valid for GeoJSON?
Configuration config = new Configuration();
Text value = new Text();
SerDe jserde = new GeoJsonSerDe();
Properties proptab = new Properties();
proptab.setProperty(HiveShims.serdeC... | #fixed code
@Test
public void TestIntOnly() throws Exception { // Is this valid for GeoJSON?
ArrayList<Object> stuff = new ArrayList<Object>();
Properties proptab = new Properties();
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS, "num");
proptab.setProperty(HiveS... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscQuoteLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc1.json", 0, 44)));
Assert.assertArray... | #fixed code
@Test
public void TestEscQuoteLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc1.json", 0, 44)));
Assert.assertArrayEquals(n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestArbitrarySplitLocations() throws Exception {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("... | #fixed code
@Test
public void TestArbitrarySplitLocations() throws Exception {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestArbitrarySplitLocations() throws Exception {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("... | #fixed code
@Test
public void TestArbitrarySplitLocations() throws Exception {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testGeomFromPointShape() throws UDFArgumentException {
final double longitude = 12.224;
final double latitude = 51.829;
Point point = new Point(longitude, latitude);
byte[] esriShape = GeometryEngine.geometryToEsriShape(point);
assertNotNull("T... | #fixed code
@Test
public void testGeomFromPointShape() throws UDFArgumentException {
Point point = createFirstLocation();
byte[] esriShape = GeometryEngine.geometryToEsriShape(point);
assertNotNull("The point writable must not be null!", esriShape);
BytesWritable shapeAsWritable =... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscSlashLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc3.json", 0, 44)));
Assert.assertArray... | #fixed code
@Test
public void TestEscSlashLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc3.json", 0, 44)));
Assert.assertArrayEquals(n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestArbitrarySplitLocations() throws Exception {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("... | #fixed code
@Test
public void TestArbitrarySplitLocations() throws Exception {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestGeomFirst() throws IOException {
Assert.assertArrayEquals(new int[] { 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-geom-first.json", 32, 54)));
Assert.assertArrayEquals(new int[] { 1 }, getRecordIndexesInReader(getReaderFor("unencl... | #fixed code
@Test
public void TestGeomFirst() throws Exception {
Assert.assertArrayEquals(new int[] { 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-geom-first.json", 32, 54)));
Assert.assertArrayEquals(new int[] { 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-jso... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestArbitrarySplitLocations() throws IOException {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor... | #fixed code
@Test
public void TestArbitrarySplitLocations() throws Exception {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Ignore // May not be guaranteed behavior
public void TestComma() throws IOException {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-comma.json", 0, 222), true);
Assert.assertEquals(4, rslt... | #fixed code
@Ignore // May not be guaranteed behavior
public void TestComma() throws Exception {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-comma.json", 0, 222), true);
Assert.assertEquals(4, rslt.length)... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscAposLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc2.json", 0, 44)));
Assert.assertArrayE... | #fixed code
@Test
public void TestEscAposLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc2.json", 0, 44)));
Assert.assertArrayEquals(ne... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Ignore // May not be guaranteed behavior
public void TestComma() throws IOException {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-comma.json", 0, 222), true);
Assert.assertEquals(4, rslt... | #fixed code
@Ignore // May not be guaranteed behavior
public void TestComma() throws Exception {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-comma.json", 0, 222), true);
Assert.assertEquals(4, rslt.length)... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscCloseLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc4.json", 0, 44)));
Assert.assertArray... | #fixed code
@Test
public void TestEscCloseLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc4.json", 0, 44)));
Assert.assertArrayEquals(n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestGeomFirst() throws IOException {
Assert.assertArrayEquals(new int[] { 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-geom-first.json", 32, 54)));
Assert.assertArrayEquals(new int[] { 1 }, getRecordIndexesInReader(getReaderFor("unencl... | #fixed code
@Test
public void TestGeomFirst() throws Exception {
Assert.assertArrayEquals(new int[] { 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-geom-first.json", 32, 54)));
Assert.assertArrayEquals(new int[] { 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-jso... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscQuoteLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc1.json", 0, 44)));
Assert.assertArray... | #fixed code
@Test
public void TestEscQuoteLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc1.json", 0, 44)));
Assert.assertArrayEquals(n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscape() throws IOException { // Issue #68
//int [] recordBreaks = new int[] { 0, 44, 88, 137, 181, 229, 270, 311, 354 }; //length 395
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-escape.json"... | #fixed code
@Test
public void TestEscape() throws Exception { // Issue #68
//int [] recordBreaks = new int[] { 0, 44, 88, 137, 181, 229, 270, 311, 354 }; //length 395
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-escape.json", 0, 44)... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscPoints() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc-points.json", 0, 74), true));
Assert.as... | #fixed code
@Test
public void TestEscPoints() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc-points.json", 0, 74), true));
Assert.assertArra... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscSlashLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc3.json", 0, 44)));
Assert.assertArray... | #fixed code
@Test
public void TestEscSlashLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc3.json", 0, 44)));
Assert.assertArrayEquals(n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestArbitrarySplitLocations() throws Exception {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("... | #fixed code
@Test
public void TestArbitrarySplitLocations() throws Exception {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscQuoteLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc1.json", 0, 44)));
Assert.assertArray... | #fixed code
@Test
public void TestEscQuoteLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc1.json", 0, 44)));
Assert.assertArrayEquals(n... | 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.