output stringlengths 64 73.2k | input stringlengths 208 73.3k | instruction stringclasses 1
value |
|---|---|---|
#fixed code
public void testTarFileSet() throws Exception {
project.executeTarget("tarfileset");
File deb = new File("target/test-classes/test.deb");
assertTrue("package not build", deb.exists());
ArInputStream in = new ArInputStream(new FileInputStream(deb));
ArEntry entry;
w... | #vulnerable code
public void testTarFileSet() throws Exception {
project.executeTarget("tarfileset");
File deb = new File("target/test-classes/test.deb");
assertTrue("package not build", deb.exists());
ArInputStream in = new ArInputStream(new FileInputStream(deb));
ArEntry entr... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void testNoCompression() throws Exception {
project.executeTarget("no-compression");
File deb = new File("target/test-classes/test.deb");
assertTrue("package not build", deb.exists());
final AtomicBoolean found = new AtomicBoolean(fals... | #vulnerable code
public void testNoCompression() throws Exception {
project.executeTarget("no-compression");
File deb = new File("target/test-classes/test.deb");
assertTrue("package not build", deb.exists());
boolean found = false;
ArArchiveInp... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void clearSign(InputStream input, OutputStream output) throws IOException, PGPException, GeneralSecurityException {
int digest = PGPUtil.SHA1;
PGPSignatureGenerator signatureGenerator = new PGPSignatureGenerator(new BcPGPContentSignerBuilder(pr... | #vulnerable code
public void clearSign(InputStream input, OutputStream output) throws IOException, PGPException, GeneralSecurityException {
int digest = PGPUtil.SHA1;
PGPSignatureGenerator signatureGenerator = new PGPSignatureGenerator(new BcPGPContentSignerBuil... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void testNoCompression() throws Exception {
project.executeTarget("no-compression");
File deb = new File("target/test-classes/test.deb");
assertTrue("package not build", deb.exists());
boolean found = false;
ArArchiveInputStre... | #vulnerable code
public void testNoCompression() throws Exception {
project.executeTarget("no-compression");
File deb = new File("target/test-classes/test.deb");
assertTrue("package not build", deb.exists());
boolean found = false;
ArInputStrea... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void makeDeb() throws PackagingException {
if (control == null || !control.isDirectory()) {
throw new PackagingException(
"\"" + control + "\" is not a valid 'control' directory)");
}
if (changesIn != null) {
... | #vulnerable code
public void makeDeb() throws PackagingException {
if (control == null || !control.isDirectory()) {
throw new PackagingException(
"\"" + control + "\" is not a valid 'control' directory)");
}
if (changesIn != null) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private PackageDescriptor buildControl( final File[] pControlFiles, final BigInteger pDataSize, final StringBuffer pChecksums, final File pOutput ) throws FileNotFoundException, IOException, ParseException {
PackageDescriptor packageDescriptor = null;
final TarOutputStream... | #vulnerable code
private PackageDescriptor buildControl( final File[] pControlFiles, final BigInteger pDataSize, final StringBuffer pChecksums, final File pOutput ) throws FileNotFoundException, IOException, ParseException {
PackageDescriptor packageDescriptor = null;
final TarOutput... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void testCreation() throws Exception {
final Processor processor = new Processor(new NullConsole(), null);
final File control = new File(getClass().getResource("deb/control/control").toURI());
final File archive1 = new File(getClass().getResou... | #vulnerable code
public void testCreation() throws Exception {
final Processor processor = new Processor(new NullConsole(), null);
final File control = new File(getClass().getResource("deb/control/control").toURI());
final File archive1 = new File(getClass().ge... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected void parse( final InputStream pInput ) throws IOException, ParseException {
final BufferedReader br = new BufferedReader(new InputStreamReader(pInput, "UTF-8"));
StringBuilder buffer = new StringBuilder();
String key = null;
int linen... | #vulnerable code
protected void parse( final InputStream pInput ) throws IOException, ParseException {
final BufferedReader br = new BufferedReader(new InputStreamReader(pInput));
StringBuilder buffer = new StringBuilder();
String key = null;
int linenr =... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void unpackDependencies() throws MojoExecutionException {
ExecutionEnvironment executionEnvironment = executionEnvironment(mavenProject, mavenSession, buildPluginManager);
// try {
executeMojo(
plugin(
... | #vulnerable code
private void unpackDependencies() throws MojoExecutionException {
try {
// get plugin JAR
String pluginJarPath = getPluginJarPath();
JarFile pluginJar = new JarFile(new File(pluginJarPath));
// extract loader JAR ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void unpackDependencies() throws MojoExecutionException {
getLog().info("Unpacking kumuluzee-loader dependency.");
try {
// get plugin JAR
String pluginJarPath = getPluginJarPath();
Path pluginJarFile = Paths.get... | #vulnerable code
private void unpackDependencies() throws MojoExecutionException {
getLog().info("Unpacking kumuluzee-loader dependency.");
try {
// get plugin JAR
String pluginJarPath = getPluginJarPath();
JarFile pluginJar = new Jar... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void sendError(final int sc, final String msg) throws IOException {
if (exchange.getExchange().isResponseStarted()) {
throw UndertowServletMessages.MESSAGES.responseAlreadyCommited();
}
resetBuffer();
writer = n... | #vulnerable code
@Override
public void sendError(final int sc, final String msg) throws IOException {
if (exchange.getExchange().isResponseStarted()) {
throw UndertowServletMessages.MESSAGES.responseAlreadyCommited();
}
if (servletOutputStream != ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
protected StreamSinkFrameChannel create(StreamSinkChannel channel, WebSocketFrameType type, long payloadSize) {
switch (type) {
case TEXT:
return new WebSocket08TextFrameSinkChannel(channel, this, payloadSize);
cas... | #vulnerable code
@Override
protected StreamSinkFrameChannel create(StreamSinkChannel channel, WebSocketFrameType type, long payloadSize) {
return new WebSocket08FrameSinkChannel(channel, this, type, payloadSize);
}
#location 3
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public HttpSession getSession(final boolean create) {
return servletContext.getSession(exchange.getExchange(), create);
} | #vulnerable code
@Override
public HttpSession getSession(final boolean create) {
if (httpSession == null) {
Session session = exchange.getExchange().getAttachment(Session.ATTACHMENT_KEY);
if (session != null) {
httpSession = new HttpSe... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@GET
@Path("/start")
@Metric(HTTP_STOP_OTA)
public Response startOTA(@QueryParam("fileName") String filename,
@QueryParam("token") String token) {
TokenValue tokenValue = tokenManager.getTokenValueByToken(token);
if (t... | #vulnerable code
@GET
@Path("/start")
@Metric(HTTP_STOP_OTA)
public Response startOTA(@QueryParam("fileName") String filename,
@QueryParam("token") String token) {
TokenValue tokenValue = tokenManager.getTokenValueByToken(token);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testGetWithFakeToken() throws Exception {
String token = "4ae3851817194e2596cf1b7103603ef8";
HttpGet request = new HttpGet(httpsServerUrl + token + "/project");
InputStream is = getClass().getResourceAsStream("/profiles/u_dmitriy... | #vulnerable code
@Test
public void testGetWithFakeToken() throws Exception {
String token = "4ae3851817194e2596cf1b7103603ef8";
HttpGet request = new HttpGet(httpsServerUrl + token + "/project");
InputStream is = getClass().getResourceAsStream("/profiles/u_d... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
protected void channelRead0(ChannelHandlerContext ctx, SaveProfileMessage message) throws Exception {
String userProfileString = message.body;
//expecting message with 2 parts
if (userProfileString == null || userProfileString.equals("")... | #vulnerable code
@Override
protected void channelRead0(ChannelHandlerContext ctx, SaveProfileMessage message) throws Exception {
String userProfileString = message.body;
//expecting message with 2 parts
if (userProfileString == null || userProfileString.equa... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void messageReceived(ChannelHandlerContext ctx, Message message) {
String token = message.body;
User userThatShared = userDao.sharedTokenManager.getUserByToken(token);
if (userThatShared == null) {
throw new InvalidTokenException("... | #vulnerable code
public void messageReceived(ChannelHandlerContext ctx, Message message) {
String token = message.body;
User userThatShared = userDao.sharedTokenManager.getUserByToken(token);
if (userThatShared == null) {
throw new InvalidTokenExcep... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
protected void channelRead0(ChannelHandlerContext ctx, GetTokenMessage message) throws Exception {
String dashBoardIdString = message.body;
Long dashBoardId;
try {
dashBoardId = Long.parseLong(dashBoardIdString);
} ca... | #vulnerable code
@Override
protected void channelRead0(ChannelHandlerContext ctx, GetTokenMessage message) throws Exception {
String dashBoardIdString = message.body;
Long dashBoardId;
try {
dashBoardId = Long.parseLong(dashBoardIdString);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void messageReceived(ChannelHandlerContext ctx, HardwareStateHolder state, StringMessage message) {
Session session = sessionDao.userSession.get(state.user);
String[] bodyParts = message.body.split(StringUtils.BODY_SEPARATOR_STRING);
if (bodyP... | #vulnerable code
public void messageReceived(ChannelHandlerContext ctx, HardwareStateHolder state, StringMessage message) {
Session session = sessionDao.userSession.get(state.user);
String[] bodyParts = message.body.split(StringUtils.BODY_SEPARATOR_STRING);
if ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static void main(String[] args) throws Exception {
TokenManager tokenManager = new TokenManager(new ConcurrentHashMap<>(), null, null, "");
String email = "dmitriy@blynk.cc";
String pass = "b";
String appName = AppName.BLYNK;
Use... | #vulnerable code
public static void main(String[] args) throws Exception {
TokenManager tokenManager = new TokenManager(new ConcurrentHashMap<>(), null, null, "");
String email = "dmitriy@blynk.cc";
String pass = "b";
String appName = AppName.BLYNK;
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private Response singleDeviceOTA(ChannelHandlerContext ctx, String token, String path) {
TokenValue tokenValue = tokenManager.getTokenValueByToken(token);
if (tokenValue == null) {
log.debug("Requested token {} not found.", token);
ret... | #vulnerable code
private Response singleDeviceOTA(ChannelHandlerContext ctx, String token, String path) {
TokenValue tokenValue = tokenManager.getTokenValueByToken(token);
if (tokenValue == null) {
log.debug("Requested token {} not found.", token);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void messageReceived(ChannelHandlerContext ctx, Message message) {
String token = message.body;
User userThatShared = userRegistry.sharedTokenManager.getUserByToken(token);
if (userThatShared == null) {
throw new InvalidTokenExcept... | #vulnerable code
public void messageReceived(ChannelHandlerContext ctx, Message message) {
String token = message.body;
User userThatShared = userRegistry.sharedTokenManager.getUserByToken(token);
if (userThatShared == null) {
throw new InvalidToken... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testDeleteCommand() throws IOException {
StorageWorker storageWorker = new StorageWorker(averageAggregator, reportingFolder, new DBManager());
ConcurrentHashMap<AggregationKey, AggregationValue> map = new ConcurrentHashMap<>();
... | #vulnerable code
@Test
public void testDeleteCommand() throws IOException {
StorageWorker storageWorker = new StorageWorker(averageAggregator, reportingFolder, new DBManager(null));
ConcurrentHashMap<AggregationKey, AggregationValue> map = new ConcurrentHashMap<>();... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
RegularTokenManager(Iterable<User> users) {
this.cache = new ConcurrentHashMap<String, TokenValue>() {{
for (User user : users) {
if (user.profile != null) {
for (DashBoard dashBoard : user.profile.dashBoards) {
... | #vulnerable code
String assignToken(User user, int dashId, int deviceId, String newToken) {
// Clean old token from cache if exists.
DashBoard dash = user.profile.getDashByIdOrThrow(dashId);
Device device = dash.getDeviceById(deviceId);
String oldToken =... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@POST
@Path("{token}/email")
@Consumes(value = MediaType.APPLICATION_JSON)
public Response email(@PathParam("token") String token,
EmailPojo message) {
globalStats.mark(HTTP_EMAIL);
TokenValue tokenValue = ... | #vulnerable code
@POST
@Path("{token}/email")
@Consumes(value = MediaType.APPLICATION_JSON)
public Response email(@PathParam("token") String token,
EmailPojo message) {
globalStats.mark(HTTP_EMAIL);
User user = tokenM... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@GET
@Path("{token}/pin/{pin}")
@Metric(HTTP_GET_PIN_DATA)
public Response getWidgetPinData(@PathParam("token") String token,
@PathParam("pin") String pinString) {
TokenValue tokenValue = tokenManager.getTokenValueByTo... | #vulnerable code
@GET
@Path("{token}/pin/{pin}")
@Metric(HTTP_GET_PIN_DATA)
public Response getWidgetPinData(@PathParam("token") String token,
@PathParam("pin") String pinString) {
TokenValue tokenValue = tokenManager.getTokenVal... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@GET
@Path("{token}/project")
@Metric(HTTP_GET_PROJECT)
public Response getDashboard(@PathParam("token") String token) {
TokenValue tokenValue = tokenManager.getTokenValueByToken(token);
if (tokenValue == null) {
log.debug("Requested t... | #vulnerable code
@GET
@Path("{token}/project")
@Metric(HTTP_GET_PROJECT)
public Response getDashboard(@PathParam("token") String token) {
TokenValue tokenValue = tokenManager.getTokenValueByToken(token);
if (tokenValue == null) {
log.debug("Reque... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void messageReceived(ChannelHandlerContext ctx, User user, StringMessage message) {
String[] split = StringUtils.split2(message.body);
int dashId = ParseUtil.parseInt(split[0]);
DashBoard dash = user.profile.getDashByIdOrThrow(dashId);
... | #vulnerable code
public void messageReceived(ChannelHandlerContext ctx, User user, StringMessage message) {
String[] split = StringUtils.split2(message.body);
int dashId = ParseUtil.parseInt(split[0]);
int deviceId = 0;
//new value for multi devices
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@PUT
@Path("/{token}/widget/{pin}")
@Consumes(value = MediaType.APPLICATION_JSON)
public Response updateWidgetPinData(@PathParam("token") String token,
@PathParam("pin") String pinString,
... | #vulnerable code
@PUT
@Path("/{token}/widget/{pin}")
@Consumes(value = MediaType.APPLICATION_JSON)
public Response updateWidgetPinData(@PathParam("token") String token,
@PathParam("pin") String pinString,
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public Response updateWidgetProperty(String token,
String pinString,
String property,
String... values) {
if (values.length == 0) {
l... | #vulnerable code
public Response updateWidgetProperty(String token,
String pinString,
String property,
String... values) {
if (values.length == 0) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void parseHardwareInfo(ChannelHandlerContext ctx, String[] messageParts, HardwareStateHolder state, int msgId) {
HardwareInfo hardwareInfo = new HardwareInfo(messageParts);
int newHardwareInterval = hardwareInfo.heartbeatInterval;
log.trace("I... | #vulnerable code
private void parseHardwareInfo(ChannelHandlerContext ctx, String[] messageParts, HardwareStateHolder state, int msgId) {
HardwareInfo hardwareInfo = new HardwareInfo(messageParts);
int newHardwareInterval = hardwareInfo.heartbeatInterval;
log.tr... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
@Ignore
public void testGetTestString() {
RedisClient redisClient = new RedisClient("localhost", "123", 6378, false);
String result = redisClient.getServerByToken("test");
assertEquals("It's working!", result);
} | #vulnerable code
@Test
@Ignore
public void testGetTestString() {
RealRedisClient redisClient = new RealRedisClient("localhost", "123", 6378);
String result = redisClient.getServerByToken("test");
assertEquals("It's working!", result);
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testStore2() throws IOException {
StorageWorker storageWorker = new StorageWorker(averageAggregator, reportingFolder, new DBManager());
ConcurrentHashMap<AggregationKey, AggregationValue> map = new ConcurrentHashMap<>();
long ts... | #vulnerable code
@Test
public void testStore2() throws IOException {
StorageWorker storageWorker = new StorageWorker(averageAggregator, reportingFolder, new DBManager(null));
ConcurrentHashMap<AggregationKey, AggregationValue> map = new ConcurrentHashMap<>();
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@GET
@Path("{token}/rtc")
@Metric(HTTP_GET_PIN_DATA)
public Response getWidgetPinData(@PathParam("token") String token) {
TokenValue tokenValue = tokenManager.getTokenValueByToken(token);
if (tokenValue == null) {
log.debug("Requested ... | #vulnerable code
@GET
@Path("{token}/rtc")
@Metric(HTTP_GET_PIN_DATA)
public Response getWidgetPinData(@PathParam("token") String token) {
TokenValue tokenValue = tokenManager.getTokenValueByToken(token);
if (tokenValue == null) {
log.debug("Requ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private static void add(Set<String> doNotRemovePaths, DashBoard dash, EnhancedHistoryGraph graph) {
for (GraphDataStream graphDataStream : graph.dataStreams) {
if (graphDataStream != null && graphDataStream.dataStream != null && graphDataStream.dataStream.... | #vulnerable code
private static void add(Set<String> doNotRemovePaths, DashBoard dash, EnhancedHistoryGraph graph) {
for (GraphDataStream graphDataStream : graph.dataStreams) {
if (graphDataStream != null && graphDataStream.dataStream != null && graphDataStream.dataS... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static List<String> find(String staticResourcesFolder) throws Exception {
CodeSource src = ServerLauncher.class.getProtectionDomain().getCodeSource();
List<String> staticResources = new ArrayList<>();
if (src != null) {
URL jar = sr... | #vulnerable code
public static List<String> find(String staticResourcesFolder) throws Exception {
CodeSource src = ServerLauncher.class.getProtectionDomain().getCodeSource();
List<String> staticResources = new ArrayList<>();
if (src != null) {
URL ja... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static void main(String[] args) throws Exception{
List<FlashedToken> flashedTokens = generateTokens(100, "Grow", 2);
DBManager dbManager = new DBManager("db-test.properties", new BlockingIOProcessor(1, 100, null));
dbManager.insertFlashedTokens... | #vulnerable code
public static void main(String[] args) {
List<FlashedToken> flashedTokens = generateTokens(10, AppName.BLYNK, 1);
DBManager dbManager = new DBManager("db-test.properties", new BlockingIOProcessor(1, 100, null));
dbManager.insertFlashedTokens(flas... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void messageReceived(ChannelHandlerContext ctx, User user, StringMessage message) {
String[] split = split2(message.body);
if (split.length < 2) {
throw new IllegalCommandException("Wrong income message format.");
}
int das... | #vulnerable code
public void messageReceived(ChannelHandlerContext ctx, User user, StringMessage message) {
String[] split = split2(message.body);
if (split.length < 2) {
throw new IllegalCommandException("Wrong income message format.");
}
i... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testStore() throws IOException {
StorageWorker storageWorker = new StorageWorker(averageAggregator, reportingFolder, new DBManager());
ConcurrentHashMap<AggregationKey, AggregationValue> map = new ConcurrentHashMap<>();
long ts ... | #vulnerable code
@Test
public void testStore() throws IOException {
StorageWorker storageWorker = new StorageWorker(averageAggregator, reportingFolder, new DBManager(null));
ConcurrentHashMap<AggregationKey, AggregationValue> map = new ConcurrentHashMap<>();
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
@Ignore
public void testIOS() throws Exception {
GCMWrapper gcmWrapper = new GCMWrapper(props, client);
gcmWrapper.send(new IOSGCMMessage("to", Priority.normal, "yo!!!", 1), null, null);
} | #vulnerable code
@Test
@Ignore
public void testIOS() throws Exception {
GCMWrapper gcmWrapper = new GCMWrapper(null, null);
gcmWrapper.send(new IOSGCMMessage("to", Priority.normal, "yo!!!", 1), null, null);
}
#location 4
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@GET
@Path("/{projectId}")
public Response getProject(@Context User user,
@PathParam("projectId") int projectId) {
DashBoard project = user.profile.getDashById(projectId);
//project.token = user.dashTokens.get(projectId);
... | #vulnerable code
@GET
@Path("/{projectId}")
public Response getProject(@Context User user,
@PathParam("projectId") int projectId) {
DashBoard project = user.profile.getDashById(projectId);
project.token = user.dashTokens.get(projectI... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@GET
@Path("{token}/isAppConnected")
@Metric(HTTP_IS_APP_CONNECTED)
public Response isAppConnected(@PathParam("token") String token) {
TokenValue tokenValue = tokenManager.getTokenValueByToken(token);
if (tokenValue == null) {
log.debu... | #vulnerable code
@GET
@Path("{token}/isAppConnected")
@Metric(HTTP_IS_APP_CONNECTED)
public Response isAppConnected(@PathParam("token") String token) {
TokenValue tokenValue = tokenManager.getTokenValueByToken(token);
if (tokenValue == null) {
lo... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
protected void channelRead0(ChannelHandlerContext ctx, LoadProfileMessage message) throws Exception {
User authUser = Session.findUserByChannel(ctx.channel(), message.id);
String body = authUser.getUserProfile() == null ? "{}" : authUser.getUser... | #vulnerable code
@Override
protected void channelRead0(ChannelHandlerContext ctx, LoadProfileMessage message) throws Exception {
User authUser = Session.findUserByChannel(ctx.channel());
String body = authUser.getUserProfile() == null ? "{}" : authUser.getUserProfil... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@POST
@Path("{token}/notify")
@Consumes(value = MediaType.APPLICATION_JSON)
@Metric(HTTP_NOTIFY)
public Response notify(@PathParam("token") String token,
PushMessagePojo message) {
TokenValue tokenValue = tokenManager.getTok... | #vulnerable code
@POST
@Path("{token}/notify")
@Consumes(value = MediaType.APPLICATION_JSON)
@Metric(HTTP_NOTIFY)
public Response notify(@PathParam("token") String token,
PushMessagePojo message) {
TokenValue tokenValue = tokenManager.... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
@Ignore
public void testAndroid() throws Exception {
when(props.getProperty("gcm.api.key")).thenReturn("");
when(props.getProperty("gcm.server")).thenReturn("");
GCMWrapper gcmWrapper = new GCMWrapper(props, client);
gcmWrapper.se... | #vulnerable code
@Test
@Ignore
public void testAndroid() throws Exception {
GCMWrapper gcmWrapper = new GCMWrapper(null, null);
gcmWrapper.send(new AndroidGCMMessage("", Priority.normal, "yo!!!", 1), null, null);
}
#location 4
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static String unCompress(String str) throws IOException {
if (null == str || str.length() <= 0) {
return str;
}
try (
// 创建一个新的 byte 数组输出流
ByteArrayOutputStream out = new ByteArrayOutputStream();
... | #vulnerable code
public static String unCompress(String str) throws IOException {
if (null == str || str.length() <= 0) {
return str;
}
// 创建一个新的 byte 数组输出流
ByteArrayOutputStream out = new ByteArrayOutputStream();
// 创建一个 ByteArrayInpu... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static String unCompress(String str) throws IOException {
if (null == str || str.length() <= 0) {
return str;
}
try (
// 创建一个新的 byte 数组输出流
ByteArrayOutputStream out = new ByteArrayOutputStream();
... | #vulnerable code
public static String unCompress(String str) throws IOException {
if (null == str || str.length() <= 0) {
return str;
}
// 创建一个新的 byte 数组输出流
ByteArrayOutputStream out = new ByteArrayOutputStream();
// 创建一个 ByteArrayInpu... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
void testThrowsExceptionWithNullTestInstance() throws Exception {
assertThrows(NullPointerException.class, () -> {
annotationsReader.getOptionsFromAnnotatedField(null, Options.class);
});
} | #vulnerable code
@Test
void testThrowsExceptionWithNullTestInstance() throws Exception {
Object optionsFromAnnotatedField = annotationsReader
.getOptionsFromAnnotatedField(null, Options.class);
assertThat(optionsFromAnnotatedField, nullValue());
}... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public String startContainer(DockerContainer dockerContainer)
throws DockerException, InterruptedException {
String imageId = dockerContainer.getImageId();
log.info("Starting Docker container {}", imageId);
com.spotify.docker.client.message... | #vulnerable code
public String startContainer(DockerContainer dockerContainer)
throws DockerException, InterruptedException {
String imageId = dockerContainer.getImageId();
log.info("Starting Docker container {}", imageId);
com.spotify.docker.client.m... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void stopService() {
this.stop = true;
} | #vulnerable code
@Override
public void stopService() {
this.stop = true;
writer.stopService();
}
#location 4
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void run() throws Exception {
TChannel tchannel = new TChannel.Builder("ping-client").build();
Map<String, String> headers = new HashMap<String, String>() {
{
put("some", "header");
}
};
Request<... | #vulnerable code
public void run() throws Exception {
TChannel tchannel = new TChannel.Builder("ping-client").build();
Req<Ping> req = new Req<Ping>(
"ping",
new HashMap<String, String>() {
{
pu... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void run() throws Exception {
TChannel tchannel = new TChannel.Builder("ping-server")
.register("ping", new PingRequestHandler())
.setServerPort(this.port)
.build();
tchannel.listen().channel().closeFutur... | #vulnerable code
public void run() throws Exception {
TChannel tchannel = new TChannel.Builder("ping-server")
.register("ping", new PingRequestHandler())
.setPort(this.port)
.build();
tchannel.listen().channel().closeFutur... | 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 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, 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 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
void resetStatistics()
{
rehashes = 0L;
evictedEntries = 0L;
hitCount = 0L;
missCount = 0L;
putAddCount = 0L;
putReplaceCount = 0L;
removeCount = 0L;
}
#location 5
... | 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
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, long capacity, long cleanUpTriggerFree)
{
this.capacity = capacity;
this.freeCapacity = capacity;
this.cleanUpTriggerFree = cleanUpTriggerFree;
int hts = builder.getHashTableSize();
if (hts <= 0)
... | #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 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 capacity, long cleanUpTriggerFree, long cleanUpTargetFree)
{
this.capacity = capacity;
this.freeCapacity = capacity;
this.cleanUpTriggerFree = cleanUpTriggerFree;
this.cleanUpTargetFree = cleanUpTarge... | #vulnerable code
long cleanUpCount()
{
return cleanUpCount;
}
#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 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, 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, 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, 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, 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
void resetStatistics()
{
rehashes = 0L;
evictedEntries = 0L;
hitCount = 0L;
missCount = 0L;
putAddCount = 0L;
putReplaceCount = 0L;
removeCount = 0L;
}
#location 4
... | 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
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 replaceEntry(long hash, long oldHashEntryAdr, long newHashEntryAdr, long bytes)
{
LongArrayList derefList = null;
lock.lock();
try
{
long prevEntryAdr = 0L;
for (long hashEntryAdr = table.getFirst(hash... | 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
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
void resetStatistics()
{
rehashes = 0L;
evictedEntries = 0L;
hitCount = 0L;
missCount = 0L;
putAddCount = 0L;
putReplaceCount = 0L;
removeCount = 0L;
}
#location 6
... | 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, 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 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 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, 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;
table = Table.create(... | #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, long freeCapacity)
{
this.freeCapacity = freeCapacity;
this.throwOOME = builder.isThrowOOME();
this.lock = builder.isUnlocked() ? null : new ReentrantLock();
int hts = builder.getHashTableSize();
... | #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;
int bl = builder.getB... | #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, 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 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, 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
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, 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 8
... | 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
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
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 hitCount()
{
return hitCount;
}
#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;
int bl = builder.getB... | #vulnerable code
long hitCount()
{
return hitCount;
}
#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 9
... | 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 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, 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 4
... | 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 hitCount()
{
return hitCount;
}
#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 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
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
boolean putEntry(long newHashEntryAdr, long hash, long keyLen, long bytes, boolean ifAbsent, long oldValueAdr, long oldValueLen)
{
long removeHashEntryAdr = 0L;
LongArrayList derefList = null;
lock.lock();
try
{
lo... | 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 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, 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, 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 9
... | 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 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, 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, 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, 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 8
... | 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.