output stringlengths 64 73.2k | input stringlengths 208 73.3k | instruction stringclasses 1
value |
|---|---|---|
#fixed code
@Test
public void testSingleFrame() throws Exception {
final ZMTPMessageDecoder decoder = new ZMTPMessageDecoder();
final ByteBuf content = Unpooled.copiedBuffer("hello", UTF_8);
final List<Object> out = Lists.newArrayList();
decoder.header(content.readableB... | #vulnerable code
@Test
public void testSingleFrame() throws Exception {
final ZMTPMessageDecoder decoder = new ZMTPMessageDecoder();
final ByteBuf content = Unpooled.copiedBuffer("hello", UTF_8);
final List<Object> out = Lists.newArrayList();
decoder.header(content.rea... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testOneFrame() throws Exception {
final ZMTPWriter writer = ZMTPWriter.create(ZMTP10);
final ByteBuf buf = Unpooled.buffer();
writer.reset(buf);
ByteBuf frame = writer.frame(11, false);
assertThat(frame, is(sameInstance(buf)));
fina... | #vulnerable code
@Test
public void testOneFrame() throws Exception {
final ZMTPWriter writer = ZMTPWriter.create(ZMTP10);
final ByteBuf buf = Unpooled.buffer();
writer.reset(buf);
ByteBuf frame = writer.frame(11, false);
assertThat(frame, is(sameInstance(buf)));
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testReframe() throws Exception {
final ZMTPFramingDecoder decoder = new ZMTPFramingDecoder(wireFormat(ZMTP10), new RawDecoder());
final ZMTPWriter writer = ZMTPWriter.create(ZMTP10);
final ByteBuf buf = Unpooled.buffer();
writer.reset(buf);
... | #vulnerable code
@Test
public void testReframe() throws Exception {
final ZMTPParser parser = ZMTPParser.create(ZMTP10, new RawDecoder());
final ZMTPWriter writer = ZMTPWriter.create(ZMTP10);
final ByteBuf buf = Unpooled.buffer();
writer.reset(buf);
// Request a fr... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testTwoFrames() throws Exception {
final ZMTPMessageDecoder decoder = new ZMTPMessageDecoder();
final ByteBuf f0 = Unpooled.copiedBuffer("hello", UTF_8);
final ByteBuf f1 = Unpooled.copiedBuffer("world", UTF_8);
final List<Object> out = Lis... | #vulnerable code
@Test
public void testTwoFrames() throws Exception {
final ZMTPMessageDecoder decoder = new ZMTPMessageDecoder();
final ByteBuf f0 = Unpooled.copiedBuffer("hello", UTF_8);
final ByteBuf f1 = Unpooled.copiedBuffer("world", UTF_8);
final List<Object> out... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testTwoFrames() throws Exception {
final ZMTPWriter writer = ZMTPWriter.create(ZMTP10);
final ByteBuf buf = Unpooled.buffer();
writer.reset(buf);
final ByteBuf f0 = copiedBuffer("hello ", UTF_8);
final ByteBuf f1 = copiedBuffer("hello ",... | #vulnerable code
@Test
public void testTwoFrames() throws Exception {
final ZMTPWriter writer = ZMTPWriter.create(ZMTP10);
final ByteBuf buf = Unpooled.buffer();
writer.reset(buf);
final ByteBuf f0 = copiedBuffer("hello ", UTF_8);
final ByteBuf f1 = copiedBuffer("he... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public final Cache buildCache(String name) throws CacheException {
if (log.isDebugEnabled()) {
log.debug("Loading a new EhCache cache named [" + name + "]");
}
try {
net.sf.ehcache.Cache cache = getCacheManager().getCache(name... | #vulnerable code
public final Cache buildCache(String name) throws CacheException {
if (log.isDebugEnabled()) {
log.debug("Loading a new EhCache cache named [" + name + "]");
}
try {
net.sf.ehcache.Cache cache = getCacheManager().getCach... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static void bindPrincipalsToSessionIfNecessary( HttpServletRequest request ) {
SecurityContext ctx = (SecurityContext) ThreadContext.get( ThreadContext.SECURITY_CONTEXT_KEY );
if ( ctx != null ) {
Session session = ThreadLocalSecurityContex... | #vulnerable code
public static void bindPrincipalsToSessionIfNecessary( HttpServletRequest request ) {
SecurityContext ctx = (SecurityContext) ThreadContext.get( ThreadContext.SECURITY_CONTEXT_KEY );
if ( ctx != null ) {
Session session = ThreadLocalSecurity... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public int onDoStartTag() throws JspException {
if ( getSecurityContext() != null && getSecurityContext().isAuthenticated() ) {
return TagSupport.EVAL_BODY_INCLUDE;
} else {
return TagSupport.SKIP_BODY;
}
} | #vulnerable code
public int onDoStartTag() throws JspException {
if ( getSecurityContext().isAuthenticated() ) {
return TagSupport.EVAL_BODY_INCLUDE;
} else {
return TagSupport.SKIP_BODY;
}
}
#location 2
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void create( Session session ) {
Serializable id = session.getSessionId();
if ( id == null ) {
String msg = "session must be assigned an id. Please check assignId( Session s ) " +
"implementation.";
thr... | #vulnerable code
public void create( Session session ) {
assignId( session );
Serializable id = session.getSessionId();
if ( id == null ) {
String msg = "session must be assigned an id. Please check assignId( Session s ) " +
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public int onDoStartTag() throws JspException {
String strValue = null;
if( getSecurityContext() != null && getSecurityContext().isAuthenticated() ) {
// Get the principal to print out
Principal principal;
if( type == null... | #vulnerable code
public int onDoStartTag() throws JspException {
String strValue = null;
if( getSecurityContext().isAuthenticated() ) {
// Get the principal to print out
Principal principal;
if( type == null ) {
princ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) {
Session session = (Session) ThreadContext.get( ThreadContext.SESSION_KEY );
Serializable sessionId;
if( session != null ) {
sessionId = session.getSessionI... | #vulnerable code
public RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) {
Session session = ThreadLocalSecurityContext.current().getSession( false );
Serializable sessionId;
if( session != null ) {
sessionId = session.getSe... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected boolean showTagBody( Permission p ) {
boolean permitted = getSecurityContext() != null && getSecurityContext().implies( p );
return !permitted;
} | #vulnerable code
protected boolean showTagBody( Permission p ) {
boolean permitted = getSecurityContext().implies( p );
return !permitted;
}
#location 2
#vulnerability type NULL_DEREFERENCE | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected boolean executeLogin(ServletRequest request, ServletResponse response) {
if (log.isDebugEnabled()) {
log.debug("Attempting to authenticate Subject based on Http BASIC Authentication request...");
}
String authorizationHeader = ge... | #vulnerable code
protected boolean executeLogin(ServletRequest request, ServletResponse response) {
if (log.isDebugEnabled()) {
log.debug("Attempting to authenticate Subject based on Http BASIC Authentication request...");
}
HttpServletRequest httpRe... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void send( AuthenticationEvent event ) {
if ( listeners != null && !listeners.isEmpty() ) {
for ( AuthenticationEventListener ael : listeners ) {
ael.onEvent( event );
}
} else {
if ( log.isWarnEnabled... | #vulnerable code
public void send( AuthenticationEvent event ) {
if ( listeners != null && !listeners.isEmpty() ) {
synchronized ( listeners ) {
for ( AuthenticationEventListener ael : listeners ) {
if ( event instanceof Successful... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@SuppressWarnings({"unchecked"})
public boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) throws IOException {
Subject subject = getSubject(request, response);
String[] rolesArray = (String[]) mappedValue;
... | #vulnerable code
@SuppressWarnings({"unchecked"})
public boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) throws IOException {
Subject subject = getSubject(request, response);
Set<String> roles = (Set<String>) mappedValue... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected boolean showTagBody( Permission p ) {
return getSecurityContext() != null && getSecurityContext().implies( p );
} | #vulnerable code
protected boolean showTagBody( Permission p ) {
return getSecurityContext().implies( p );
}
#location 2
#vulnerability type NULL_DEREFERENCE | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void send( SessionEvent event ) {
if ( listeners != null && !listeners.isEmpty() ) {
for( SessionEventListener sel : listeners ) {
sel.onEvent( event );
}
}
} | #vulnerable code
public void send( SessionEvent event ) {
synchronized( listeners ) {
for( SessionEventListener sel : listeners ) {
if ( event instanceof StartedSessionEvent) {
sel.sessionStarted( event );
} else if... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@SuppressWarnings({"unchecked"})
public boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) throws IOException {
Subject subject = getSubject(request, response);
String[] rolesArray = (String[]) mappedValue;
... | #vulnerable code
@SuppressWarnings({"unchecked"})
public boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) throws IOException {
Subject subject = getSubject(request, response);
Set<String> roles = (Set<String>) mappedValue... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public int onDoStartTag() throws JspException {
if ( getSecurityContext() == null || !getSecurityContext().isAuthenticated() ) {
return TagSupport.EVAL_BODY_INCLUDE;
} else {
return TagSupport.SKIP_BODY;
}
} | #vulnerable code
public int onDoStartTag() throws JspException {
if ( !getSecurityContext().isAuthenticated() ) {
return TagSupport.EVAL_BODY_INCLUDE;
} else {
return TagSupport.SKIP_BODY;
}
}
#location 2
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected boolean showTagBody( String roleName ) {
return getSecurityContext() != null && getSecurityContext().hasRole( roleName );
} | #vulnerable code
protected boolean showTagBody( String roleName ) {
return getSecurityContext().hasRole( roleName );
}
#location 2
#vulnerability type NULL_DEREFERENCE | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected boolean bindInHttpSessionForSubsequentRequests( HttpServletRequest request, HttpServletResponse response,
SecurityContext securityContext ) {
HttpSession httpSession = request.getSession();
... | #vulnerable code
protected boolean bindInHttpSessionForSubsequentRequests( HttpServletRequest request, HttpServletResponse response,
SecurityContext securityContext ) {
HttpSession httpSession = request.getSession();
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected boolean showTagBody( String roleName ) {
boolean hasRole = getSecurityContext() != null && getSecurityContext().hasRole( roleName );
return !hasRole;
} | #vulnerable code
protected boolean showTagBody( String roleName ) {
boolean hasRole = getSecurityContext().hasRole( roleName );
return !hasRole;
}
#location 2
#vulnerability type NULL_DEREFERENCE | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@SuppressWarnings( "unchecked" )
private static List<Principal> getPrincipals(HttpServletRequest request) {
List<Principal> principals = null;
Session session = (Session) ThreadContext.get( ThreadContext.SESSION_KEY );
if( session != null ) {
... | #vulnerable code
@SuppressWarnings( "unchecked" )
private static List<Principal> getPrincipals(HttpServletRequest request) {
List<Principal> principals = null;
Session session = ThreadLocalSecurityContext.current().getSession( false );
if( session != null ) ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
DbAction.Insert<?> createInsert(String propertyName, Object value, @Nullable Object key) {
DbAction.Insert<Object> insert = new DbAction.Insert<>(value,
context.getPersistentPropertyPath(propertyName, DummyEntity.class), rootInsert);
insert.getQualifiers().put(toPath(pr... | #vulnerable code
DbAction.Insert<?> createDeepInsert(String propertyName, Object value, Object key,
@Nullable DbAction.Insert<?> parentInsert) {
PersistentPropertyPath<RelationalPersistentProperty> propertyPath = toPath(parentInsert.getPropertyPath().toDotPath() + "." + propertyName)... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public Class<?> getQualifierColumnType() {
Assert.isTrue(isQualified(), "The qualifier column type is only defined for properties that are qualified");
if (isMap()) {
return getTypeInformation().getRequiredComponentType().getType();
}
// for lists and ar... | #vulnerable code
@Override
public Class<?> getQualifierColumnType() {
Assert.isTrue(isQualified(), "The qualifier column type is only defined for properties that are qualified");
if (isMap()) {
return getTypeInformation().getComponentType().getType();
}
// for lists and arra... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void test() {
Flowable.just("hi there".getBytes())
.compose(Transformers.outputStream(new Function<OutputStream, OutputStream>() {
@Override
public OutputStream apply(OutputStream os) throws Exce... | #vulnerable code
@Test
public void test() throws IOException {
final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
Flowable.just("hi there".getBytes())
.compose(Transformers.outputStream(new Function<OutputStream, OutputStream>() {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void load() {
Optional<String> region = loadRegion();
if (region.isPresent()) {
this.region = region.get();
} else {
this.region = DEFAULT_REGION;
LOG.warn("Could not load region configuration. Please ensure ... | #vulnerable code
public void load() {
String home = System.getProperty("user.home");
Properties awsConfigProperties = new Properties();
try {
// todo: use default profile
awsConfigProperties.load(new FileInputStream(home + "/.aws/config"... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
SegmentView getActiveSegmentView() { return segmentlist.get(segmentlist.size()-1); } | #vulnerable code
EntryLocation getLocationForOffset(long offset)
{
EntryLocation ret = new EntryLocation();
SegmentView sv = this.getSegmentForOffset(offset);
long reloff = offset - sv.startoff;
//select the group using a simple modulo mapping function
int gnum = (int)(rel... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void run() {
try {
observer.stopCheck();
} catch (IOException e) {
observer.downloadErrored(url, "Download interrupted");
return;
}
if (saveAs.exists()) {
if (Utils.getConfigBoolean("file.o... | #vulnerable code
public void run() {
try {
observer.stopCheck();
} catch (IOException e) {
observer.downloadErrored(url, "Download interrupted");
return;
}
if (saveAs.exists()) {
if (Utils.getConfigBoolean("... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void testTwitterAlbums() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
//contentURLs.add(new URL("https://twitter.com/danngamber01/media"));
contentURLs.add(new ... | #vulnerable code
public void testTwitterAlbums() throws IOException {
List<URL> contentURLs = new ArrayList<URL>();
//contentURLs.add(new URL("https://twitter.com/danngamber01/media"));
contentURLs.add(new URL("https://twitter.com/search?q=from%3Apurrbunny%20filt... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void testTumblrAlbums() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://wrouinr.tumblr.com/archive"));
contentURLs.add(new URL("htt... | #vulnerable code
public void testTumblrAlbums() throws IOException {
if (false && !DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://wrouinr.tumblr.com/archive"));
//contentURLs... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private static List<Constructor<?>> getRipperConstructors() throws Exception {
List<Constructor<?>> constructors = new ArrayList<Constructor<?>>();
for (Class<?> clazz : getClassesForPackage("com.rarchives.ripme.ripper.rippers")) {
if (AbstractRipp... | #vulnerable code
private static List<Constructor<?>> getRipperConstructors() throws Exception {
List<Constructor<?>> constructors = new ArrayList<Constructor<?>>();
String rippersPackage = "com.rarchives.ripme.ripper.rippers";
ClassLoader cl = Thread.currentThrea... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void testXvideosRipper() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://www.xvideos.com/video1428195/stephanie_first_time_anal"));
... | #vulnerable code
public void testXvideosRipper() throws IOException {
if (false && !DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://www.xvideos.com/video1428195/stephanie_first_time_a... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void downloadProblem(URL url, String message) {
if (observer == null) {
return;
}
synchronized(observer) {
itemsPending.remove(url);
itemsErrored.put(url, message);
observer.update(this, new RipSta... | #vulnerable code
public void downloadProblem(URL url, String message) {
if (observer == null) {
return;
}
synchronized(observer) {
itemsPending.remove(url);
itemsErrored.put(url, message);
observer.update(this, new ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void testRedditAlbums() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
//contentURLs.add(new URL("http://www.reddit.com/r/nsfw_oc"));
//contentURLs.add(new URL("h... | #vulnerable code
public void testRedditAlbums() throws IOException {
if (false && !DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
//contentURLs.add(new URL("http://www.reddit.com/r/nsfw_oc"));
//contentURLs... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void login() throws IOException {
try {
String dACookies = Utils.getConfigString(utilsKey, null);
this.cookies = dACookies != null ? deserialize(dACookies) : null;
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
if (this.cookies == null) {
... | #vulnerable code
private void login() throws IOException {
File f = new File("DACookie.toDelete");
if (!f.exists()) {
f.createNewFile();
f.deleteOnExit();
// Load login page
Response res = Http.url("https://www.deviantart.com/users/login").connection().method(Method.GET)
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public List<String> getURLsFromPage(Document doc) {
List<String> result = new ArrayList<String>();
for (Element el : doc.select("a.image-container > img")) {
String imageSource = el.attr("src");
... | #vulnerable code
@Override
public List<String> getURLsFromPage(Document doc) {
List<String> result = new ArrayList<String>();
Document userpage_doc;
// We check for the following string to see if this is a user page or not
if (... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void run() {
long fileSize = 0;
int bytesTotal = 0;
int bytesDownloaded = 0;
if (saveAs.exists() && observer.tryResumeDownload()) {
fileSize = saveAs.length();
}
try {
observer.stopCheck();
... | #vulnerable code
public void run() {
long fileSize = 0;
int bytesTotal = 0;
int bytesDownloaded = 0;
if (saveAs.exists() && observer.tryResumeDownload()) {
fileSize = saveAs.length();
}
try {
observer.stopCheck();
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void downloadErrored(URL url, String reason) {
if (observer == null) {
return;
}
itemsPending.remove(url);
itemsErrored.put(url, reason);
observer.update(this, new RipStatusMessage(STATUS.DOWNLOAD_ERRORED, url + " : "... | #vulnerable code
public void downloadErrored(URL url, String reason) {
if (observer == null) {
return;
}
synchronized(observer) {
itemsPending.remove(url);
itemsErrored.put(url, reason);
observer.update(this, new Ri... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
void testKeyCount() {
ResourceBundle defaultBundle = Utils.getResourceBundle(null);
HashMap<String, ArrayList<String>> dictionary = new HashMap<>();
for (String lang : Utils.getSupportedLanguages()) {
ResourceBundle.clearCache();
... | #vulnerable code
@Test
void testKeyCount() {
((ConsoleAppender) Logger.getRootLogger().getAppender("stdout")).setThreshold(Level.DEBUG);
File f = new File("E:\\Downloads\\_Isaaku\\dev\\ripme-1.7.86-jar-with-dependencies.jar");
File[] files = f.listFiles(new F... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public String[] getDescription(String url,Document page) {
if (isThisATest()) {
return null;
}
try {
// Fetch the image page
Response resp = Http.url(url)
.referrer(this.... | #vulnerable code
@Override
public String[] getDescription(String url,Document page) {
if (isThisATest()) {
return null;
}
try {
// Fetch the image page
Response resp = Http.url(url)
.referrer... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void sendUpdate(STATUS status, Object message) {
if (observer == null) {
return;
}
observer.update(this, new RipStatusMessage(status, message));
} | #vulnerable code
public void sendUpdate(STATUS status, Object message) {
if (observer == null) {
return;
}
synchronized (observer) {
observer.update(this, new RipStatusMessage(status, message));
observer.notifyAll();
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void downloadCompleted(URL url, File saveAs) {
if (observer == null) {
return;
}
try {
String path = Utils.removeCWD(saveAs);
RipStatusMessage msg = new RipStatusMessage(STATUS.DOWNLOAD_COMPLETE, path);
... | #vulnerable code
public void downloadCompleted(URL url, File saveAs) {
if (observer == null) {
return;
}
try {
String path = Utils.removeCWD(saveAs);
RipStatusMessage msg = new RipStatusMessage(STATUS.DOWNLOAD_COMPLETE, path);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private static File getJarDirectory() {
return Utils.class.getResource("/rip.properties").toString().contains("jar:") ? new File(System.getProperty("java.class.path")).getParentFile() : new File(System.getProperty("user.dir"));
} | #vulnerable code
private static File getJarDirectory() {
String[] classPath = System.getProperty("java.class.path").split(";");
return classPath.length > 1 ? new File(System.getProperty("user.dir")) : new File(classPath[0]).getParentFile();
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public List<String> getURLsFromPage(Document doc) {
List<String> result = new ArrayList<>();
if (theme1.contains(getHost())) {
Element elem = doc.select("div.comic-table > div#comic > a > img").first();
// If doc is the la... | #vulnerable code
@Override
public List<String> getURLsFromPage(Document doc) {
List<String> result = new ArrayList<>();
if (getHost().contains("www.totempole666.com")
|| getHost().contains("buttsmithy.com")
|| getHost().contains("themo... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void downloadProblem(URL url, String message) {
if (observer == null) {
return;
}
itemsPending.remove(url);
itemsErrored.put(url, message);
observer.update(this, new RipStatusMessage(STATUS.DOWNLOAD_WARN, url... | #vulnerable code
public void downloadProblem(URL url, String message) {
if (observer == null) {
return;
}
synchronized(observer) {
itemsPending.remove(url);
itemsErrored.put(url, message);
observer.update(this, new ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void login() throws IOException {
String customUsername = Utils.getConfigString("DeviantartCustomLoginUsername", this.username);
String customPassword = Utils.getConfigString("DeviantartCustomLoginPassword", this.password);
try {
String dACookies = Utils.getCon... | #vulnerable code
private void login() throws IOException {
try {
String dACookies = Utils.getConfigString(utilsKey, null);
updateCookie(dACookies != null ? deserialize(dACookies) : null);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
if (getDACookie() == nul... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void replyToStatus(String content, String replyTo) throws ArchivedGroupException, ReplyStatusException {
AbstractStatus abstractStatus = statusRepository.findStatusById(replyTo);
if (abstractStatus != null &&
!abstractStatus.getType().eq... | #vulnerable code
public void replyToStatus(String content, String replyTo) throws ArchivedGroupException, ReplyStatusException {
AbstractStatus abstractOriginalStatus = statusRepository.findStatusById(replyTo);
if (abstractOriginalStatus != null &&
!abstr... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
@Cacheable("attachment-cache")
public Attachment findAttachmentById(String attachmentId) {
if (attachmentId == null) {
return null;
}
if (log.isDebugEnabled()) {
log.debug("Finding attachment : " + attachmentId... | #vulnerable code
@Override
@Cacheable("attachment-cache")
public Attachment findAttachmentById(String attachmentId) {
if (attachmentId == null) {
return null;
}
if (log.isDebugEnabled()) {
log.debug("Finding attachment : " + attach... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@RequestMapping(value = "/rest/statuses/{statusId}",
method = RequestMethod.PATCH)
@ResponseBody
public StatusDTO updateStatusV3(@RequestBody ActionStatus action, @PathVariable("statusId") String statusId) {
try {
StatusDTO status = tim... | #vulnerable code
@RequestMapping(value = "/rest/statuses/{statusId}",
method = RequestMethod.PATCH)
@ResponseBody
public StatusDTO updateStatusV3(@RequestBody ActionStatus action, @PathVariable("statusId") String statusId) {
try {
StatusDTO status... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void replyToStatus(String content, String replyTo) throws ArchivedGroupException {
Status originalStatus = statusRepository.findStatusById(replyTo);
Group group = null;
if (originalStatus.getGroupId() != null) {
group = groupService.... | #vulnerable code
public void replyToStatus(String content, String replyTo) throws ArchivedGroupException {
Status originalStatus = statusRepository.findStatusById(replyTo);
Group group = null;
if (originalStatus.getGroupId() != null) {
group = groupSe... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public T borrowObject(K key, long borrowMaxWait) throws Exception {
assertOpen();
PooledObject<T> p = null;
// Get local copy of current config so it is consistent for entire
// method execution
boolean blockWhenExhausted = getBlockW... | #vulnerable code
public T borrowObject(K key, long borrowMaxWait) throws Exception {
assertOpen();
PooledObject<T> p = null;
// Get local copy of current config so it is consistent for entire
// method execution
boolean blockWhenExhausted = thi... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void setFactory(KeyedPoolableObjectFactory factory) throws IllegalStateException {
Map toDestroy = new HashMap();
final KeyedPoolableObjectFactory oldFactory = _factory;
synchronized (this) {
assertOpen();
if (0 < getNumA... | #vulnerable code
public void setFactory(KeyedPoolableObjectFactory factory) throws IllegalStateException {
Map toDestroy = new HashMap();
synchronized (this) {
assertOpen();
if (0 < getNumActive()) {
throw new IllegalStateException... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public Object borrowObject() throws Exception {
long starttime = System.currentTimeMillis();
Latch latch = new Latch();
byte whenExhaustedAction;
long maxWait;
synchronized (this) {
// Get local copy of current config. Can't... | #vulnerable code
public Object borrowObject() throws Exception {
long starttime = System.currentTimeMillis();
Latch latch = new Latch();
synchronized (this) {
_allocationQueue.add(latch);
allocate();
}
for(;;) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public Object borrowObject(Object key) throws Exception {
long starttime = System.currentTimeMillis();
Latch latch = new Latch(key);
byte whenExhaustedAction;
long maxWait;
synchronized (this) {
// Get local copy of current ... | #vulnerable code
public Object borrowObject(Object key) throws Exception {
long starttime = System.currentTimeMillis();
Latch latch = new Latch(key);
synchronized (this) {
_allocationQueue.add(latch);
allocate();
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void addObject(Object key) throws Exception {
assertOpen();
if (_factory == null) {
throw new IllegalStateException("Cannot add objects without a factory.");
}
Object obj = _factory.makeObject(key);
try {
... | #vulnerable code
public void addObject(Object key) throws Exception {
assertOpen();
if (_factory == null) {
throw new IllegalStateException("Cannot add objects without a factory.");
}
Object obj = _factory.makeObject(key);
synchronized... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void clear(Object key) {
Map toDestroy = new HashMap();
final ObjectQueue pool;
synchronized (this) {
pool = (ObjectQueue)(_poolMap.remove(key));
if (pool == null) {
return;
} else {
... | #vulnerable code
public void clear(Object key) {
Map toDestroy = new HashMap();
final ObjectQueue pool;
synchronized (this) {
pool = (ObjectQueue)(_poolMap.remove(key));
if (pool == null) {
return;
} else {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public Object borrowObject(Object key) throws Exception {
long starttime = System.currentTimeMillis();
Latch latch = new Latch(key);
byte whenExhaustedAction;
long maxWait;
synchronized (this) {
// Get local copy of current ... | #vulnerable code
public Object borrowObject(Object key) throws Exception {
long starttime = System.currentTimeMillis();
Latch latch = new Latch(key);
synchronized (this) {
_allocationQueue.add(latch);
allocate();
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void clearOldest() {
// Map of objects to destroy my key
final Map toDestroy = new HashMap();
// build sorted map of idle objects
final Map map = new TreeMap();
synchronized (this) {
for (Iterator keyiter = _poolMap.... | #vulnerable code
public void clearOldest() {
// Map of objects to destroy my key
final Map toDestroy = new HashMap();
// build sorted map of idle objects
final Map map = new TreeMap();
synchronized (this) {
for (Iterator keyiter = _po... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void clear() {
List toDestroy = new ArrayList();
synchronized(this) {
toDestroy.addAll(_pool);
_numInternalProcessing = _numInternalProcessing + _pool._size;
_pool.clear();
}
destroy(toDestroy, _facto... | #vulnerable code
public void clear() {
List toDestroy = new ArrayList();
synchronized(this) {
toDestroy.addAll(_pool);
_numInternalProcessing = _numInternalProcessing + _pool._size;
_pool.clear();
}
destroy(toDestroy);... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void evict() throws Exception {
assertOpen();
if (getNumIdle() == 0) {
return;
}
synchronized (evictionLock) {
boolean testWhileIdle = getTestWhileIdle();
long idleEvictTime = Long.MAX_VALUE;
... | #vulnerable code
public void evict() throws Exception {
assertOpen();
if (getNumIdle() == 0) {
return;
}
boolean testWhileIdle = getTestWhileIdle();
long idleEvictTime = Long.MAX_VALUE;
if (getMinEvictableIdleTimeMi... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public T borrowObject(K key, long borrowMaxWait) throws Exception {
assertOpen();
PooledObject<T> p = null;
// Get local copy of current config so it is consistent for entire
// method execution
boolean blockWhenExhausted = getBlockW... | #vulnerable code
public T borrowObject(K key, long borrowMaxWait) throws Exception {
assertOpen();
PooledObject<T> p = null;
// Get local copy of current config so it is consistent for entire
// method execution
boolean blockWhenExhausted = get... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void evict() throws Exception {
assertOpen();
if (_pool.size() == 0) {
return;
}
PooledObject<T> underTest = null;
for (int i = 0, m = getNumTests(); i < m; i++) {
if (_evictionIterator ... | #vulnerable code
public void evict() throws Exception {
assertOpen();
synchronized (this) {
if(_pool.isEmpty()) {
return;
}
if (null == _evictionCursor) {
_evictionCursor = (_pool.cursor(_lifo ? _pool.si... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void evict() throws Exception {
Object key = null;
boolean testWhileIdle;
long minEvictableIdleTimeMillis;
synchronized (this) {
// Get local copy of current config. Can't sync when used later as
// it ca... | #vulnerable code
public void evict() throws Exception {
// Initialize key to last key value
Object key = null;
synchronized (this) {
if (_evictionKeyCursor != null &&
_evictionKeyCursor._lastReturned != null) {
key... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void evict() throws Exception {
assertOpen();
if (getNumIdle() == 0) {
return;
}
synchronized (evictionLock) {
boolean testWhileIdle = getTestWhileIdle();
long idleEvictTime = Long.MAX_VALUE;
... | #vulnerable code
public void evict() throws Exception {
assertOpen();
if (getNumIdle() == 0) {
return;
}
boolean testWhileIdle = getTestWhileIdle();
long idleEvictTime = Long.MAX_VALUE;
if (getMinEvictableIdleTimeMi... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public long getActiveTimeMillis() {
// Take copies to avoid threading issues
long rTime = lastReturnTime;
long bTime = lastBorrowTime;
if (rTime > bTime) {
return rTime - bTime;
} else {
return System.cu... | #vulnerable code
public long getActiveTimeMillis() {
if (lastReturnTime > lastBorrowTime) {
return lastReturnTime - lastBorrowTime;
} else {
return System.currentTimeMillis() - lastBorrowTime;
}
}
#location... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void setFactory(PoolableObjectFactory factory) throws IllegalStateException {
List toDestroy = new ArrayList();
final PoolableObjectFactory oldFactory = _factory;
synchronized (this) {
assertOpen();
if(0 < getNumActive())... | #vulnerable code
public void setFactory(PoolableObjectFactory factory) throws IllegalStateException {
List toDestroy = new ArrayList();
synchronized (this) {
assertOpen();
if(0 < getNumActive()) {
throw new IllegalStateException("O... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public T borrowObject(K key, long borrowMaxWait) throws Exception {
assertOpen();
PooledObject<T> p = null;
// Get local copy of current config so it is consistent for entire
// method execution
boolean blockWhenExhausted = getBlockWh... | #vulnerable code
public T borrowObject(K key, long borrowMaxWait) throws Exception {
assertOpen();
PooledObject<T> p = null;
// Get local copy of current config so it is consistent for entire
// method execution
boolean blockWhenExhausted = getB... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void evict() throws Exception {
assertOpen();
if (_pool.size() == 0) {
return;
}
PooledObject<T> underTest = null;
for (int i = 0, m = getNumTests(); i < m; i++) {
if (_evictionIterator ... | #vulnerable code
public void evict() throws Exception {
assertOpen();
synchronized (this) {
if(_pool.isEmpty()) {
return;
}
if (null == _evictionCursor) {
_evictionCursor = (_pool.cursor(_lifo ? _pool.si... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void clear() {
Map toDestroy = new HashMap();
synchronized (this) {
for (Iterator it = _poolMap.keySet().iterator(); it.hasNext();) {
Object key = it.next();
ObjectQueue pool = (ObjectQueue)_poolMap.get(key);
... | #vulnerable code
public void clear() {
Map toDestroy = new HashMap();
synchronized (this) {
for (Iterator it = _poolMap.keySet().iterator(); it.hasNext();) {
Object key = it.next();
ObjectQueue pool = (ObjectQueue)_poolMap.get(... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void printStackTrace(PrintWriter writer) {
Exception borrowedBy = this.borrowedBy;
if (borrowedBy != null) {
borrowedBy.printStackTrace(writer);
}
Exception usedBy = this.usedBy;
if (usedBy != null) {
... | #vulnerable code
@Override
public void printStackTrace(PrintWriter writer) {
if (borrowedBy != null) {
borrowedBy.printStackTrace(writer);
}
if (usedBy != null) {
usedBy.printStackTrace(writer);
}
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void evict() throws Exception {
assertOpen();
if (getNumIdle() == 0) {
return;
}
synchronized (evictionLock) {
boolean testWhileIdle = getTestWhileIdle();
long idleEvictTime = Long.MAX_VALUE;
... | #vulnerable code
public void evict() throws Exception {
assertOpen();
if (getNumIdle() == 0) {
return;
}
boolean testWhileIdle = getTestWhileIdle();
long idleEvictTime = Long.MAX_VALUE;
if (getMinEvictableIdleTimeMi... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void evict() throws Exception {
Object key = null;
boolean testWhileIdle;
long minEvictableIdleTimeMillis;
synchronized (this) {
// Get local copy of current config. Can't sync when used later as
// it ca... | #vulnerable code
public void evict() throws Exception {
// Initialize key to last key value
Object key = null;
synchronized (this) {
if (_evictionKeyCursor != null &&
_evictionKeyCursor._lastReturned != null) {
key... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void destroy(Map m, KeyedPoolableObjectFactory factory) {
for (Iterator entries = m.entrySet().iterator(); entries.hasNext();) {
Map.Entry entry = (Entry) entries.next();
Object key = entry.getKey();
Collection c = (Collecti... | #vulnerable code
private void destroy(Map m, KeyedPoolableObjectFactory factory) {
for (Iterator keys = m.keySet().iterator(); keys.hasNext();) {
Object key = keys.next();
Collection c = (Collection) m.get(key);
for (Iterator it = c.iterator()... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void evict() throws Exception {
Object key = null;
boolean testWhileIdle;
long minEvictableIdleTimeMillis;
synchronized (this) {
// Get local copy of current config. Can't sync when used later as
// it ca... | #vulnerable code
public void evict() throws Exception {
// Initialize key to last key value
Object key = null;
synchronized (this) {
if (_evictionKeyCursor != null &&
_evictionKeyCursor._lastReturned != null) {
key... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public int compareTo(PooledObject<T> other) {
final long lastActiveDiff =
this.getLastReturnTime() - other.getLastReturnTime();
if (lastActiveDiff == 0) {
// make sure the natural ordering is consistent with equals
// se... | #vulnerable code
public int compareTo(PooledObject<T> other) {
final long lastActiveDiff =
this.getLastActiveTime() - other.getLastActiveTime();
if (lastActiveDiff == 0) {
// make sure the natural ordering is consistent with equals
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public T borrowObject(K key, long borrowMaxWait) throws Exception {
assertOpen();
PooledObject<T> p = null;
// Get local copy of current config so it is consistent for entire
// method execution
boolean blockWhenExhausted = getBlockW... | #vulnerable code
public T borrowObject(K key, long borrowMaxWait) throws Exception {
assertOpen();
PooledObject<T> p = null;
// Get local copy of current config so it is consistent for entire
// method execution
boolean blockWhenExhausted = get... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public Object borrowObject() throws Exception {
long starttime = System.currentTimeMillis();
Latch latch = new Latch();
byte whenExhaustedAction;
long maxWait;
synchronized (this) {
// Get local copy of current config. Can't... | #vulnerable code
public Object borrowObject() throws Exception {
long starttime = System.currentTimeMillis();
Latch latch = new Latch();
synchronized (this) {
_allocationQueue.add(latch);
allocate();
}
for(;;) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void evict() throws Exception {
assertOpen();
if (getNumIdle() == 0) {
return;
}
synchronized (evictionLock) {
boolean testWhileIdle = getTestWhileIdle();
long idleEvictTime = Long.MAX_VALUE;
... | #vulnerable code
public void evict() throws Exception {
assertOpen();
if (getNumIdle() == 0) {
return;
}
boolean testWhileIdle = getTestWhileIdle();
long idleEvictTime = Long.MAX_VALUE;
if (getMinEvictableIdleTimeMi... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public boolean process(Set<? extends TypeElement> type, RoundEnvironment env) {
Elements elementUtils = processingEnv.getElementUtils();
Types typeUtils = processingEnv.getTypeUtils();
Filer filer = processingEnv.getFiler();
//
// Processor opt... | #vulnerable code
@Override
public boolean process(Set<? extends TypeElement> type, RoundEnvironment env) {
Elements elementUtils = processingEnv.getElementUtils();
Types typeUtils = processingEnv.getTypeUtils();
Filer filer = processingEnv.getFiler();
//
// Process... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public boolean process(Set<? extends TypeElement> type, RoundEnvironment env) {
Types typeUtils = processingEnv.getTypeUtils();
Filer filer = processingEnv.getFiler();
//
// Processor options
//
boolean isLibrary... | #vulnerable code
@Override
public boolean process(Set<? extends TypeElement> type, RoundEnvironment env) {
Types typeUtils = processingEnv.getTypeUtils();
Filer filer = processingEnv.getFiler();
//
// Processor options
//
boolean isL... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testMissingSlotMillis() throws IOException {
final String JOB_HISTORY_FILE_NAME =
"src/test/resources/job_1329348432999_0003-1329348443227-user-Sleep+job-1329348468601-10-1-SUCCEEDED-default.jhist";
File jobHistoryfile = new File(JOB_HISTORY... | #vulnerable code
@Test
public void testMissingSlotMillis() throws IOException {
final String JOB_HISTORY_FILE_NAME =
"src/test/resources/job_1329348432999_0003-1329348443227-user-Sleep+job-1329348468601-10-1-SUCCEEDED-default.jhist";
File jobHistoryfile = new File(JOB_H... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testFlowQueueReadWrite() throws Exception {
FlowQueueService service = new FlowQueueService(UTIL.getConfiguration());
// add a couple of test flows
Flow flow1 = createFlow(service, TEST_USER, 1);
FlowQueueKey key1 = flow1.getQueueKey();
... | #vulnerable code
@Test
public void testFlowQueueReadWrite() throws Exception {
FlowQueueService service = new FlowQueueService(UTIL.getConfiguration());
// add a couple of test flows
FlowQueueKey key1 = new FlowQueueKey(TEST_CLUSTER, Flow.Status.RUNNING,
System.curr... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static String getCluster(Configuration jobConf) {
String jobtracker = jobConf.get(JOBTRACKER_KEY);
if (jobtracker == null) {
jobtracker = jobConf.get(RESOURCE_MANAGER_KEY);
}
String cluster = null;
if (jobtracker != null) {
// strip any po... | #vulnerable code
public static String getCluster(Configuration jobConf) {
String jobtracker = jobConf.get(JOBTRACKER_KEY);
if (jobtracker == null) {
jobtracker = jobConf.get(RESOURCE_MANAGER_KEY);
}
// strip any port number
int portIdx = jobtracker.indexOf(':');
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public int getQSize() {
int res = 0;
final Actor actors[] = this.actors;
for (int i = 0; i < actors.length; i++) {
Actor a = actors[i];
res+=a.__mailbox.size();
res+=a.__cbQueue.size();
}
return res;
... | #vulnerable code
public int getQSize() {
int res = 0;
for (int i = 0; i < queues.length; i++) {
Queue queue = queues[i];
res+=queue.size();
}
for (int i = 0; i < queues.length; i++) {
Queue queue = cbQueues[i];
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void rebalance(DispatcherThread dispatcherThread) {
synchronized (balanceLock) {
long load = dispatcherThread.getLoadNanos();
DispatcherThread minLoadThread = createNewThreadIfPossible();
if (minLoadThread != nu... | #vulnerable code
@Override
public void rebalance(DispatcherThread dispatcherThread) {
int load = dispatcherThread.getLoad();
DispatcherThread minLoadThread = createNewThreadIfPossible();
if ( minLoadThread != null ) {
// split
dispatch... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void run() {
int emptyCount = 0;
boolean isShutDown = false;
while( ! isShutDown ) {
if ( pollQs() ) {
emptyCount = 0;
}
else {
emptyCount++;
scheduler.yield(em... | #vulnerable code
public void run() {
int emptyCount = 0;
boolean isShutDown = false;
while( ! isShutDown ) {
if ( pollQs() ) {
emptyCount = 0;
}
else {
emptyCount++;
scheduler.yi... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public int getQSize() {
int res = 0;
final Actor actors[] = this.actors;
for (int i = 0; i < actors.length; i++) {
Actor a = actors[i];
res+=a.__mailbox.size();
res+=a.__cbQueue.size();
}
return res;
... | #vulnerable code
public int getQSize() {
int res = 0;
for (int i = 0; i < queues.length; i++) {
Queue queue = queues[i];
res+=queue.size();
}
for (int i = 0; i < queues.length; i++) {
Queue queue = cbQueues[i];
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public boolean pollQs() {
CallEntry poll = pollQueues(cbQueues, queues); // first callback queues
if (poll != null) {
try {
Actor.sender.set(poll.getTargetActor());
Object invoke = null;
profileCounte... | #vulnerable code
public boolean pollQs() {
CallEntry poll = pollQueues(cbQueues, queues); // first callback queues
if (poll != null) {
try {
Actor.sender.set(poll.getTargetActor());
Object invoke = null;
profile... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public int getLoad() {
int res = 0;
final Actor actors[] = this.actors;
for (int i = 0; i < actors.length; i++) {
MpscConcurrentQueue queue = (MpscConcurrentQueue) actors[i].__mailbox;
int load = queue.size() * 100 / queue.getCa... | #vulnerable code
public int getLoad() {
int res = 0;
for (int i = 0; i < queues.length; i++) {
MpscConcurrentQueue queue = (MpscConcurrentQueue) queues[i];
int load = queue.size() * 100 / queue.getCapacity();
if ( load > res )
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public boolean isEmpty() {
for (int i = 0; i < actors.length; i++) {
Actor act = actors[i];
if ( ! act.__mailbox.isEmpty() || ! act.__cbQueue.isEmpty() )
return false;
}
return true;
} | #vulnerable code
public boolean isEmpty() {
for (int i = 0; i < queues.length; i++) {
Queue queue = queues[i];
if ( ! queue.isEmpty() )
return false;
}
for (int i = 0; i < cbQueues.length; i++) {
Queue queue = c... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void run() {
int emptyCount = 0;
int scheduleNewActorCount = 0;
boolean isShutDown = false;
while( ! isShutDown ) {
if ( pollQs() ) {
emptyCount = 0;
scheduleNewActorCount++;
if... | #vulnerable code
public void run() {
int emptyCount = 0;
boolean isShutDown = false;
while( ! isShutDown ) {
if ( pollQs() ) {
emptyCount = 0;
}
else {
emptyCount++;
scheduler.yi... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public boolean isEmpty() {
for (int i = 0; i < actors.length; i++) {
Actor act = actors[i];
if ( ! act.__mailbox.isEmpty() || ! act.__cbQueue.isEmpty() )
return false;
}
return true;
} | #vulnerable code
public boolean isEmpty() {
for (int i = 0; i < queues.length; i++) {
Queue queue = queues[i];
if ( ! queue.isEmpty() )
return false;
}
for (int i = 0; i < cbQueues.length; i++) {
Queue queue = c... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public boolean pollQs() {
CallEntry poll = pollQueues(actors); // first callback actors
if (poll != null) {
try {
Actor.sender.set(poll.getTargetActor());
Object invoke = null;
profileCounter++;
... | #vulnerable code
public boolean pollQs() {
CallEntry poll = pollQueues(cbQueues, queues); // first callback queues
if (poll != null) {
try {
Actor.sender.set(poll.getTargetActor());
Object invoke = null;
profile... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void run() {
int emptyCount = 0;
int scheduleNewActorCount = 0;
boolean isShutDown = false;
while( ! isShutDown ) {
if ( pollQs() ) {
emptyCount = 0;
scheduleNewActorCount++;
if... | #vulnerable code
public void run() {
int emptyCount = 0;
boolean isShutDown = false;
while( ! isShutDown ) {
if ( pollQs() ) {
emptyCount = 0;
}
else {
emptyCount++;
scheduler.yi... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public boolean pollQs() {
CallEntry poll = pollQueues(actors); // first callback actors
if (poll != null) {
try {
Actor.sender.set(poll.getTargetActor());
Object invoke = null;
profileCounter++;
... | #vulnerable code
public boolean pollQs() {
CallEntry poll = pollQueues(cbQueues, queues); // first callback queues
if (poll != null) {
try {
Actor.sender.set(poll.getTargetActor());
Object invoke = null;
profile... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void run() {
int emptyCount = 0;
boolean isShutDown = false;
while( ! isShutDown ) {
if ( pollQs() ) {
emptyCount = 0;
}
else {
emptyCount++;
scheduler.yield(em... | #vulnerable code
public void run() {
int emptyCount = 0;
boolean isShutDown = false;
while( ! isShutDown ) {
if ( pollQs() ) {
emptyCount = 0;
}
else {
emptyCount++;
scheduler.yi... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public Collection<?> getSortableContainerPropertyIds() {
if (backingList instanceof SortableLazyList) {
// Assume SortableLazyList can sort by any Comparable property
} else if (backingList instanceof LazyList) {
// When u... | #vulnerable code
@Override
public Collection<?> getSortableContainerPropertyIds() {
if (backingList instanceof SortableLazyList) {
// Assume SortableLazyList can sort by any Comparable property
} else if (backingList instanceof LazyList) {
// ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public Property getContainerProperty(Object itemId, Object propertyId) {
Item i = getItem(itemId);
return (i != null) ? i.getItemProperty(propertyId) : null;
} | #vulnerable code
@Override
public Property getContainerProperty(Object itemId, Object propertyId) {
return getItem(itemId).getItemProperty(propertyId);
}
#location 3
#vulnerability type NULL_DEREFERENCE | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void visitIincInsn(int var, int increment) {
super.visitIincInsn(var, increment);
// Track variable state at variable increases (e.g. i++).
LocalVariableScope lvs = getLocalVariableScope(var);
instrumentToTrackVariableState(lvs, lineNumber);
} | #vulnerable code
@Override
public void visitIincInsn(int var, int increment) {
super.visitIincInsn(var, increment);
// Track variable state and name at variable stores. (At variable increases.)
LocalVariableScope lvs = getLocalVariableScope(var);
instrumentToTrackVariableName(l... | 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.