output stringlengths 64 73.2k | input stringlengths 208 73.3k | instruction stringclasses 1
value |
|---|---|---|
#fixed code
private String extractLibrary(String sharedLibName) throws IOException {
File nativesPath = new File(System.getProperty("java.io.tmpdir") + "/steamworks4j/" + libraryCrc);
File nativeFile = new File(nativesPath, sharedLibName);
if (!nativesPath.exists()) {
if (!native... | #vulnerable code
private String extractLibrary(String sharedLibName) throws IOException {
File nativesPath = new File(System.getProperty("java.io.tmpdir") + "/steamworks4j/" + libraryCrc);
File nativeFile = new File(nativesPath, sharedLibName);
if (!nativesPath.exists()) {
if (!... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private static void extractLibrary(File librarySystemPath, InputStream input) throws IOException {
if (input != null) {
try (FileOutputStream output = new FileOutputStream(librarySystemPath)) {
byte[] buffer = new byte[4096];
while (true) {
int length = input.r... | #vulnerable code
private static void extractLibrary(File librarySystemPath, InputStream input) throws IOException {
if (input != null) {
try {
FileOutputStream output = new FileOutputStream(librarySystemPath);
byte[] buffer = new byte[4096];
while (true) {
int length ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
protected void processInput(String input) throws SteamException {
if (input.equals("stats request")) {
userStats.requestCurrentStats();
} else if (input.equals("stats store")) {
userStats.storeStats();
} else if (input.startsWith("achievement set ")) {
... | #vulnerable code
@Override
protected void processInput(String input) throws SteamException {
if (input.equals("stats request")) {
userStats.requestCurrentStats();
} else if (input.equals("stats store")) {
userStats.storeStats();
} else if (input.equals("file list")) {
int ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void precompile( Map<String, Set<String>> typeNames )
{
for( ITypeManifold tm: ManifoldHost.instance().getCurrentModule().getTypeManifolds() )
{
for( Map.Entry<String, Set<String>> entry: typeNames.entrySet() )
{
String typeManifoldClassNam... | #vulnerable code
private void precompile( Map<String, Set<String>> typeNames )
{
for( ITypeManifold tm: ManifoldHost.instance().getCurrentModule().getTypeManifolds() )
{
for( Map.Entry<String, Set<String>> entry: typeNames.entrySet() )
{
String typeManifoldCl... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
static SrcClass genClass(String fqn, ProgramNode programNode) {
ClassNode classNode = programNode.getFirstChild(ClassNode.class);
SrcClass clazz = new SrcClass(fqn, SrcClass.Kind.Class);
clazz.addAnnotation(
new SrcAnnotationExpression( Sou... | #vulnerable code
static SrcClass genClass(String fqn, ProgramNode programNode) {
ClassNode classNode = programNode.getFirstChild(ClassNode.class);
SrcClass clazz = new SrcClass(fqn, SrcClass.Kind.Class);
String superClass = classNode.getSuperClass();
i... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void incrementalCompile( Set<Object> drivers )
{
for( Object driver: drivers )
{
//noinspection unchecked
Set<IFile> files = ((Collection<File>)ReflectUtil.method( driver, "getResourceFiles" ).invoke() ).stream().map( (File f) -> ManifoldHost.getFi... | #vulnerable code
private void incrementalCompile( Set<Object> drivers )
{
JavacElements elementUtils = JavacElements.instance( _tp.getContext() );
for( Object driver: drivers )
{
//noinspection unchecked
Set<IFile> files = ((Collection<File>)ReflectUtil.method( d... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@SuppressWarnings("WeakerAccess")
public String findTopLevelFqn( String fqn )
{
FqnCache<LocklessLazyVar<M>> fqnCache = _fqnToModel.get();
if( fqnCache.isEmpty() )
{
return null;
}
while( true )
{
LocklessLazyVar<M> lazyModel = fqnCache.... | #vulnerable code
@SuppressWarnings("WeakerAccess")
public String findTopLevelFqn( String fqn )
{
while( true )
{
LocklessLazyVar<M> lazyModel = _fqnToModel.get().get( fqn );
if( lazyModel != null )
{
return fqn;
}
int iDot = fqn.lastIndexO... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public Collection<String> getAllTypeNames()
{
FqnCache<LocklessLazyVar<M>> fqnCache = _fqnToModel.get();
if( fqnCache.isEmpty() )
{
return Collections.emptySet();
}
return fqnCache.getFqns();
} | #vulnerable code
@Override
public Collection<String> getAllTypeNames()
{
return _fqnToModel.get().getFqns();
}
#location 4
#vulnerability type NULL_DEREFERENCE | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private static boolean hasCallHandlerMethod( Class rootClass )
{
if( ICallHandler.class.isAssignableFrom( rootClass ) )
{
// Nominally implements ICallHandler
return true;
}
if( ReflectUtil.method( rootClass, "call", Class.class, String.class, Stri... | #vulnerable code
private static boolean hasCallHandlerMethod( Class rootClass )
{
String fqn = rootClass.getCanonicalName();
BasicJavacTask javacTask = RuntimeManifoldHost.get().getJavaParser().getJavacTask();
Pair<Symbol.ClassSymbol, JCTree.JCCompilationUnit> classSymbol = ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public boolean isTopLevelType( String fqn )
{
FqnCache<LocklessLazyVar<M>> fqnCache = _fqnToModel.get();
if( fqnCache.isEmpty() )
{
return false;
}
return fqnCache.get( fqn ) != null;
} | #vulnerable code
@Override
public boolean isTopLevelType( String fqn )
{
return _fqnToModel.get().get( fqn ) != null;
}
#location 4
#vulnerability type NULL_DEREFERENCE | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public Tree getParent( Tree node )
{
return _parents.getParent( node );
} | #vulnerable code
public Tree getParent( Tree node )
{
TreePath2 path = TreePath2.getPath( getCompilationUnit(), node );
if( path == null )
{
// null is indiciative of Generation phase where trees are no longer attached to symobls so the comp unit is detached
// u... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public String getResponseBody() {
requireSucceededRequestState();
return responseBody;
} | #vulnerable code
public String getResponseBody() {
if (response == null) {
throw new IllegalStateException("The request must first be executed");
}
if (!response.isSuccessful()) {
throw new IllegalStateException("The request threw an exception");
}
return response.getBody()... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public Rune getDataRune(int id) throws RiotApiException {
return StaticDataMethod.getDataRune(getRegion(), getKey(), id, null, null, (RuneData) null);
} | #vulnerable code
public Rune getDataRune(int id) throws RiotApiException {
return StaticDataMethod.getDataRune(getRegion(), getKey(), id, null, null, null);
}
#location 3
#vulnerability type NULL_DEREFERENCE | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public dto.Static.Champion getDataChampion(Region region, int id) throws RiotApiException {
return StaticDataMethod.getDataChampion(region.getName(), getKey(), id, null, null, false, (ChampData) null);
} | #vulnerable code
public dto.Static.Champion getDataChampion(Region region, int id) throws RiotApiException {
return StaticDataMethod.getDataChampion(region.getName(), getKey(), id, null, null, false, null);
}
#location 3
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public ItemList getDataItemList(Region region) throws RiotApiException {
return StaticDataMethod.getDataItemList(region.getName(), getKey(), null, null, (ItemListData) null);
} | #vulnerable code
public ItemList getDataItemList(Region region) throws RiotApiException {
return StaticDataMethod.getDataItemList(region.getName(), getKey(), null, null, null);
}
#location 3
#vulnerability type NULL_... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public ChampionList getDataChampionList(Region region) throws RiotApiException {
return StaticDataMethod.getDataChampionList(region.getName(), getKey(), null, null, false, (ChampData) null);
} | #vulnerable code
public ChampionList getDataChampionList(Region region) throws RiotApiException {
return StaticDataMethod.getDataChampionList(region.getName(), getKey(), null, null, false, null);
}
#location 3
#vulne... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public Rune getDataRune(Region region, int id) throws RiotApiException {
return StaticDataMethod.getDataRune(region.getName(), getKey(), id, null, null, (RuneData) null);
} | #vulnerable code
public Rune getDataRune(Region region, int id) throws RiotApiException {
return StaticDataMethod.getDataRune(region.getName(), getKey(), id, null, null, null);
}
#location 3
#vulnerability type NULL_... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public boolean cancel() {
synchronized (signal) {
boolean cancelled = super.cancel();
if (!cancelled) {
return false;
}
signal.notifyAll();
// Try to force-quit the connection
if (connection != null) {
setTimeout(1);
connection.disconne... | #vulnerable code
@Override
public boolean cancel() {
boolean cancelled = super.cancel();
if (!cancelled) {
return false;
}
synchronized (signal) {
signal.notifyAll();
}
// Try to force-quit the connection
if (connection != null) {
setTimeout(1);
connection.discon... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void await(long timeout, TimeUnit unit, boolean cancelOnTimeout) throws InterruptedException, TimeoutException {
final long end = System.currentTimeMillis() + unit.toMillis(timeout);
if (!isDone() && System.currentTimeMillis() < end) {
synchronized (signal) {
w... | #vulnerable code
public void await(long timeout, TimeUnit unit, boolean cancelOnTimeout) throws InterruptedException, TimeoutException {
final long end = System.currentTimeMillis() + unit.toMillis(timeout);
while (!isDone() && System.currentTimeMillis() < end) {
synchronized (signal... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public dto.Static.Champion getDataChampion(int id) throws RiotApiException {
return StaticDataMethod.getDataChampion(getRegion(), getKey(), id, null, null, false, (ChampData) null);
} | #vulnerable code
public dto.Static.Champion getDataChampion(int id) throws RiotApiException {
return StaticDataMethod.getDataChampion(getRegion(), getKey(), id, null, null, false, null);
}
#location 3
#vulnerability ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public RuneList getDataRuneList() throws RiotApiException {
return StaticDataMethod.getDataRuneList(getRegion(), getKey(), null, null, (RuneListData) null);
} | #vulnerable code
public RuneList getDataRuneList() throws RiotApiException {
return StaticDataMethod.getDataRuneList(getRegion(), getKey(), null, null, null);
}
#location 3
#vulnerability type NULL_DEREFERENCE | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public SummonerSpellList getDataSummonerSpellList() throws RiotApiException {
return StaticDataMethod.getDataSummonerSpellList(getRegion(), getKey(), null, null, false, (SpellData) null);
} | #vulnerable code
public SummonerSpellList getDataSummonerSpellList() throws RiotApiException {
return StaticDataMethod.getDataSummonerSpellList(getRegion(), getKey(), null, null, false, null);
}
#location 3
#vulnerab... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public boolean cancel() {
synchronized (signal) {
boolean cancelled = super.cancel();
if (!cancelled) {
return false;
}
signal.notifyAll();
// Try to force-quit the connection
if (connection != null) {
setTimeout(1);
connection.disconne... | #vulnerable code
@Override
public boolean cancel() {
boolean cancelled = super.cancel();
if (!cancelled) {
return false;
}
synchronized (signal) {
signal.notifyAll();
}
// Try to force-quit the connection
if (connection != null) {
setTimeout(1);
connection.discon... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public MasteryList getDataMasteryList(Region region) throws RiotApiException {
return StaticDataMethod.getDataMasteryList(region.getName(), getKey(), null, null, (MasteryListData) null);
} | #vulnerable code
public MasteryList getDataMasteryList(Region region) throws RiotApiException {
return StaticDataMethod.getDataMasteryList(region.getName(), getKey(), null, null, null);
}
#location 3
#vulnerability t... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected void init(ApiConfig config, ApiMethod method) {
this.config = config;
this.method = method;
} | #vulnerable code
protected void init(ApiConfig config, ApiMethod method) {
this.config = config;
this.method = method;
setTimeout();
}
#location 4
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public <T> T getDto(Class<T> desiredDto) throws RiotApiException, RateLimitException {
requireSucceededRequestState();
if (responseCode == CODE_SUCCESS_NOCONTENT) {
// The Riot Api is fine with the request, and explicitly sends no content
return null;
}
T dto = nul... | #vulnerable code
public <T> T getDto(Class<T> desiredDto) throws RiotApiException, RateLimitException {
if (!response.isSuccessful()) {
// I think we can never get here. Let's make sure though
throw new RiotApiException(RiotApiException.IOEXCEPTION);
}
if (response.getCode() ==... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public Mastery getDataMastery(int id) throws RiotApiException {
return StaticDataMethod.getDataMastery(getRegion(), getKey(), id, null, null, (MasteryData) null);
} | #vulnerable code
public Mastery getDataMastery(int id) throws RiotApiException {
return StaticDataMethod.getDataMastery(getRegion(), getKey(), id, null, null, null);
}
#location 3
#vulnerability type NULL_DEREFERENCE | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public Item getDataItem(Region region, int id) throws RiotApiException {
return StaticDataMethod.getDataItem(region.getName(), getKey(), id, null, null, (ItemData) null);
} | #vulnerable code
public Item getDataItem(Region region, int id) throws RiotApiException {
return StaticDataMethod.getDataItem(region.getName(), getKey(), id, null, null, null);
}
#location 3
#vulnerability type NULL_... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
protected boolean setState(RequestState state) {
if (isDone()) {
return false;
}
notifyListeners(state);
super.setState(state);
if (isDone()) {
synchronized (signal) {
signal.notifyAll();
}
}
return true;
} | #vulnerable code
@Override
protected boolean setState(RequestState state) {
if (isDone()) {
return false;
}
for (RequestListener listener : listeners) {
if (state == RequestState.Succeeded) {
listener.onRequestSucceeded(this);
} else if (state == RequestState.Failed) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public int getResponseCode() {
requireSucceededRequestState();
return responseCode;
} | #vulnerable code
public int getResponseCode() {
if (response == null) {
throw new IllegalStateException("The request must first be executed");
}
return response.getCode();
}
#location 5
#vulnerability type THREAD_SAFETY_VI... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public MasteryList getDataMasteryList() throws RiotApiException {
return StaticDataMethod.getDataMasteryList(getRegion(), getKey(), null, null, (MasteryListData) null);
} | #vulnerable code
public MasteryList getDataMasteryList() throws RiotApiException {
return StaticDataMethod.getDataMasteryList(getRegion(), getKey(), null, null, null);
}
#location 3
#vulnerability type NULL_DEREFEREN... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testJoinString() throws RiotApiException {
// Valid Usage for Strings
assertEquals("abc", Convert.joinString(",", "abc"));
assertEquals("abc,def,ghi", Convert.joinString(",", "abc", "def", "ghi"));
// Valid Usage for other objects
assertEquals("RANKE... | #vulnerable code
@Test
public void testJoinString() throws RiotApiException {
// Valid Usage
assertEquals("abc", Convert.joinString(",", "abc"));
assertEquals("abc,def,ghi", Convert.joinString(",", "abc", "def", "ghi"));
// NullPointerException
thrown.expect(NullPointerException... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public SummonerSpellList getDataSummonerSpellList(Region region) throws RiotApiException {
return StaticDataMethod.getDataSummonerSpellList(region.getName(), getKey(), null, null, false, (SpellData) null);
} | #vulnerable code
public SummonerSpellList getDataSummonerSpellList(Region region) throws RiotApiException {
return StaticDataMethod.getDataSummonerSpellList(region.getName(), getKey(), null, null, false, null);
}
#location 3
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void await() throws InterruptedException {
if (!isDone()) {
synchronized (signal) {
while (!isDone()) {
signal.wait();
}
}
}
} | #vulnerable code
public void await() throws InterruptedException {
while (!isDone()) {
synchronized (signal) {
signal.wait();
}
}
}
#location 2
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
protected boolean setState(RequestState state) {
boolean success = super.setState(state);
if (!success) {
return false;
}
if (!listeners.isEmpty()) {
if (state == RequestState.Succeeded) {
for (RequestListener listener : listeners) {
listener.on... | #vulnerable code
@Override
protected boolean setState(RequestState state) {
boolean success = super.setState(state);
if (!success) {
return false;
}
if (listener != null) {
if (state == RequestState.Succeeded) {
listener.onRequestSucceeded(this);
} else if (state == R... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public ItemList getDataItemList() throws RiotApiException {
return StaticDataMethod.getDataItemList(getRegion(), getKey(), null, null, (ItemListData) null);
} | #vulnerable code
public ItemList getDataItemList() throws RiotApiException {
return StaticDataMethod.getDataItemList(getRegion(), getKey(), null, null, null);
}
#location 3
#vulnerability type NULL_DEREFERENCE | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public SummonerSpell getDataSummonerSpell(int id) throws RiotApiException {
return StaticDataMethod.getDataSummonerSpell(getRegion(), getKey(), id, null, null, (SpellData) null);
} | #vulnerable code
public SummonerSpell getDataSummonerSpell(int id) throws RiotApiException {
return StaticDataMethod.getDataSummonerSpell(getRegion(), getKey(), id, null, null, null);
}
#location 3
#vulnerability typ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public Mastery getDataMastery(Region region, int id) throws RiotApiException {
return StaticDataMethod.getDataMastery(region.getName(), getKey(), id, null, null, (MasteryData) null);
} | #vulnerable code
public Mastery getDataMastery(Region region, int id) throws RiotApiException {
return StaticDataMethod.getDataMastery(region.getName(), getKey(), id, null, null, null);
}
#location 3
#vulnerability t... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public Item getDataItem(int id) throws RiotApiException {
return StaticDataMethod.getDataItem(getRegion(), getKey(), id, null, null, (ItemData) null);
} | #vulnerable code
public Item getDataItem(int id) throws RiotApiException {
return StaticDataMethod.getDataItem(getRegion(), getKey(), id, null, null, null);
}
#location 3
#vulnerability type NULL_DEREFERENCE | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void await() throws InterruptedException {
while (!isDone()) {
synchronized (signal) {
signal.wait();
}
}
} | #vulnerable code
public void await() throws InterruptedException {
if (!isDone()) {
synchronized (signal) {
while (!isDone()) {
signal.wait();
}
}
}
}
#location 4
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public SummonerSpell getDataSummonerSpell(Region region, int id) throws RiotApiException {
return StaticDataMethod.getDataSummonerSpell(region.getName(), getKey(), id, null, null, (SpellData) null);
} | #vulnerable code
public SummonerSpell getDataSummonerSpell(Region region, int id) throws RiotApiException {
return StaticDataMethod.getDataSummonerSpell(region.getName(), getKey(), id, null, null, null);
}
#location 3
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public <T> T getDto(Type desiredDto) throws RiotApiException, RateLimitException {
requireSucceededRequestState();
if (responseCode == CODE_SUCCESS_NOCONTENT) {
// The Riot Api is fine with the request, and explicitly sends no content
return null;
}
T dto = null;
... | #vulnerable code
public <T> T getDto(Type desiredDto) throws RiotApiException, RateLimitException {
if (!response.isSuccessful()) {
// I think we can never get here. Let's make sure though
throw new RiotApiException(RiotApiException.IOEXCEPTION);
}
if (response.getCode() == Req... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public ChampionList getDataChampionList() throws RiotApiException {
return StaticDataMethod.getDataChampionList(getRegion(), getKey(), null, null, false, (ChampData) null);
} | #vulnerable code
public ChampionList getDataChampionList() throws RiotApiException {
return StaticDataMethod.getDataChampionList(getRegion(), getKey(), null, null, false, null);
}
#location 3
#vulnerability type NULL... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected static CharSequence encodeUriQuery(CharSequence in) {
//Note that I can't simply use URI.java to encode because it will escape pre-existing escaped things.
StringBuilder outBuf = null;
Formatter formatter = null;
for(int i = 0; i < in.length(); i++) {
... | #vulnerable code
protected static CharSequence encodeUriQuery(CharSequence in) {
//Note that I can't simply use URI.java to encode because it will escape pre-existing escaped things.
StringBuilder outBuf = null;
Formatter formatter = null;
for(int i = 0; i < in.length(); i... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void initCommitAndTermFromLog() throws Exception {
DBIterator iterator = db.iterator();
try {
iterator.seekToLast();
byte[] keyBytes = iterator.peekNext().getKey();
commitIndex = new Integer(asString(keyBytes));
... | #vulnerable code
private void initCommitAndTermFromLog() {
DBIterator iterator = db.iterator();
try {
iterator.seekToLast();
byte[] keyBytes = iterator.peekNext().getKey();
commitIndex = new Integer(asString(keyBytes));
//... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected void changeRole(Role new_role) {
final RaftImpl new_impl=new_role == Role.Follower? new Follower(this) : new_role == Role.Candidate? new Candidate(this) : new Leader(this);
withLockDo(impl_lock, new Callable<Void>() {
public Void call() t... | #vulnerable code
protected void changeRole(Role new_role) {
RaftImpl new_impl=null;
switch(new_role) {
case Follower:
new_impl=new Follower(this);
break;
case Candidate:
new_impl=new Follower(this);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected void handleEvent(Message msg, RaftHeader hdr) {
// log.trace("%s: received %s from %s", local_addr, hdr, msg.src());
impl_lock.lock();
try {
if(hdr instanceof AppendEntriesRequest) {
AppendEntriesRequest req=(Appen... | #vulnerable code
protected void handleEvent(Message msg, RaftHeader hdr) {
log.trace("%s: received %s from %s", local_addr, hdr, msg.src());
impl_lock.lock();
try {
if(hdr instanceof AppendEntriesRequest) {
AppendEntriesRequest req=(Ap... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private static String readResource(final String name) {
final StringBuilder ret = new StringBuilder();
InputStream is = null;
InputStreamReader reader = null;
try {
is = UrlRegularExpressions.class.getClassLoader().getResourceAsStre... | #vulnerable code
private static String readResource(final String name) {
final StringBuilder ret = new StringBuilder();
InputStream is = null;
try {
is = UrlRegularExpressions.class.getClassLoader().getResourceAsStream(name);
final InputSt... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static UrlBuilder fromString(final String url, final Charset inputEncoding) {
if (url.isEmpty()) {
return new UrlBuilder();
}
final Matcher m = URI_PATTERN.matcher(url);
String protocol = null, hostName = null, path = null, a... | #vulnerable code
public static UrlBuilder fromString(final String url, final Charset inputEncoding) {
if (url.isEmpty()) {
return new UrlBuilder();
}
final Matcher m = URI_PATTERN.matcher(url);
String protocol = null, hostName = null, path = n... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private static String readResource(final String name) {
final StringBuilder ret = new StringBuilder();
InputStream is = null;
InputStreamReader reader = null;
try {
is = UrlRegularExpressions.class.getClassLoader().getResourceAsStre... | #vulnerable code
private static String readResource(final String name) {
final StringBuilder ret = new StringBuilder();
InputStream is = null;
try {
is = UrlRegularExpressions.class.getClassLoader().getResourceAsStream(name);
final InputSt... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static ClassName get(Class<?> clazz) {
checkNotNull(clazz, "clazz == null");
checkArgument(!clazz.isPrimitive(), "primitive types cannot be represented as a ClassName");
checkArgument(!void.class.equals(clazz), "'void' type cannot be represented as a ClassNam... | #vulnerable code
public static ClassName get(Class<?> clazz) {
checkNotNull(clazz, "clazz == null");
checkArgument(!clazz.isPrimitive(), "primitive types cannot be represented as a ClassName");
checkArgument(!void.class.equals(clazz), "'void' type cannot be represented as a Cl... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected void populateJMeterDirectoryTree() throws MojoExecutionException {
for (Artifact artifact : pluginArtifacts) {
try {
if (artifact.getArtifactId().startsWith("ApacheJMeter_")) {
if (artifact.getArtifactId().startsWith("ApacheJMeter_config")) {
JarFil... | #vulnerable code
protected void populateJMeterDirectoryTree() throws MojoExecutionException {
for (Artifact artifact : pluginArtifacts) {
try {
if (artifact.getArtifactId().startsWith("ApacheJMeter_")) {
if (artifact.getArtifactId().startsWith("ApacheJMeter_config")) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected void populateJMeterDirectoryTree() throws MojoExecutionException {
for (Artifact artifact : pluginArtifacts) {
try {
if (artifact.getArtifactId().startsWith("ApacheJMeter_")) {
if (artifact.getArtifactId().startsWith("ApacheJMeter_config")) {
JarFil... | #vulnerable code
protected void populateJMeterDirectoryTree() throws MojoExecutionException {
for (Artifact artifact : pluginArtifacts) {
try {
if (artifact.getArtifactId().startsWith("ApacheJMeter_")) {
if (artifact.getArtifactId().startsWith("ApacheJMeter_config")) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public int blockSize() {
return blockSize;
} | #vulnerable code
@Override
public int blockSize() {
return BLOCK_SIZE;
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
static void setBlockSize(int blockSize) {
synchronized (BlocksPool.class) { // can be easily changed to lock-free
instance = new BlocksPool(blockSize);
}
} | #vulnerable code
static void setBlockSize(int blockSize) {
BLOCK_SIZE = blockSize;
synchronized (BlocksPool.class) { // can be easily changed to lock-free
instance = new BlocksPool();
}
}
#location 2
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
InternalOakMap(K minKey,
OakSerializer<K> keySerializer,
OakSerializer<V> valueSerializer,
OakComparator<K> oakComparator,
MemoryManager memoryManager,
int chunkMaxItems) {
... | #vulnerable code
Result<V> putIfAbsent(K key, V value, Function<ByteBuffer, V> transformer) {
if (key == null || value == null) {
throw new NullPointerException();
}
Chunk<K, V> c = findChunk(key); // find chunk matching key
Chunk.LookUp look... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testResizeWithZCGetNewBuffer() {
final int blockSize = BlocksPool.getInstance().blockSize();
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.setLength((blockSize / Character.BYTES) / 2);
String longValue ... | #vulnerable code
@Test
public void testResizeWithZCGetNewBuffer() {
String smallValue = "";
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.setLength((BLOCK_SIZE / Character.BYTES) / 2);
String longValue = stringBuilder.toString();
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testUnsafeCopy() {
IntHolder minKey = new IntHolder(0, new int[0]);
OakMapBuilder<IntHolder, IntHolder> builder =
new OakMapBuilder<IntHolder, IntHolder>(
new UnsafeTestComparator(),
new Unsaf... | #vulnerable code
@Test
public void testUnsafeCopy() {
IntHolder minKey = new IntHolder(0, new int[0]);
OakMapBuilder<IntHolder, IntHolder> builder =
new OakMapBuilder<IntHolder, IntHolder>(
new UnsafeTestComparator(),new UnsafeTestSerial... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
XSSFUnmarshaller(PoijiOptions options) {
this.options = options;
} | #vulnerable code
<T> void unmarshal0(Class<T> type, Consumer<? super T> consumer, OPCPackage open) throws IOException, SAXException, OpenXML4JException {
//ISSUE #55
XSSFWorkbook wb = new XSSFWorkbook(open);
Workbook workbook = new SXSSFWorkbook(wb);
//w... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@SuppressWarnings("unchecked")
private static Deserializer deserializer(File file) throws FileNotFoundException {
final PoijiStream poiParser = new PoijiStream(fileInputStream(file));
final PoiWorkbook workbook = PoiWorkbook.workbook(Files.getExtension(fil... | #vulnerable code
@SuppressWarnings("unchecked")
private static Deserializer deserializer(File file) throws FileNotFoundException {
final PoijiStream poiParser = new PoijiStream(fileInputStream(file));
final PoiWorkbook workbook = PoiWorkbook.workbook(Files.getExtensi... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public <T> void unmarshal(Class<T> type, Consumer<? super T> consumer) {
HSSFWorkbook workbook = (HSSFWorkbook) workbook();
Optional<String> maybeSheetName = this.getSheetName(type, options);
baseFormulaEvaluator = HSSFFormulaEvaluator.c... | #vulnerable code
@Override
public <T> void unmarshal(Class<T> type, Consumer<? super T> consumer) {
HSSFWorkbook workbook = (HSSFWorkbook) workbook();
Optional<String> maybeSheetName = this.getSheetName(type, options);
hssfFormulaEvaluator = HSSFFormulaEvalu... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@SuppressWarnings("unchecked")
private static Deserializer deserializer(File file, PoijiOptions options) {
final PoijiStream poiParser = new PoijiStream(file);
final PoiWorkbook workbook = PoiWorkbook.workbook(Files.getExtension(file.getName()), poiParser)... | #vulnerable code
@SuppressWarnings("unchecked")
private static Deserializer deserializer(File file, PoijiOptions options) throws FileNotFoundException {
final PoijiStream poiParser = new PoijiStream(fileInputStream(file));
final PoiWorkbook workbook = PoiWorkbook.wor... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static ZipInputStream createZipInputStream(ZipModel zipModel, FileHeader fileHeader, char[] password)
throws IOException {
SplitInputStream splitInputStream = null;
try {
splitInputStream = new SplitInputStream(zipModel.getZipFile(), zipModel.isSplit... | #vulnerable code
public static ZipInputStream createZipInputStream(ZipModel zipModel, FileHeader fileHeader, char[] password)
throws ZipException {
try {
SplitInputStream splitInputStream = new SplitInputStream(zipModel.getZipFile(), zipModel.isSplitArchive(),
zi... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private ZipInputStream prepareZipInputStream() throws ZipException {
try {
splitInputStream = new SplitInputStream(getZipModel().getZipFile(),
getZipModel().isSplitArchive(), getZipModel().getEndOfCentralDirectoryRecord().getNumberOfThisDisk());
FileH... | #vulnerable code
private ZipInputStream prepareZipInputStream() throws ZipException {
try {
SplitInputStream splitInputStream = new SplitInputStream(getZipModel().getZipFile(),
getZipModel().isSplitArchive(), getZipModel().getEndOfCentralDirectoryRecord().getNumberOfTh... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private ZipInputStream prepareZipInputStream() throws ZipException {
try {
splitInputStream = new SplitInputStream(getZipModel().getZipFile(),
getZipModel().isSplitArchive(), getZipModel().getEndOfCentralDirectoryRecord().getNumberOfThisDisk());
FileH... | #vulnerable code
private ZipInputStream prepareZipInputStream() throws ZipException {
try {
SplitInputStream splitInputStream = new SplitInputStream(getZipModel().getZipFile(),
getZipModel().isSplitArchive(), getZipModel().getEndOfCentralDirectoryRecord().getNumberOfTh... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private ZipInputStream prepareZipInputStream() throws ZipException {
try {
splitInputStream = new SplitInputStream(getZipModel().getZipFile(),
getZipModel().isSplitArchive(), getZipModel().getEndOfCentralDirectoryRecord().getNumberOfThisDisk());
FileH... | #vulnerable code
private ZipInputStream prepareZipInputStream() throws ZipException {
try {
SplitInputStream splitInputStream = new SplitInputStream(getZipModel().getZipFile(),
getZipModel().isSplitArchive(), getZipModel().getEndOfCentralDirectoryRecord().getNumberOfTh... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static ZipInputStream createZipInputStream(ZipModel zipModel, FileHeader fileHeader, char[] password)
throws IOException {
SplitInputStream splitInputStream = null;
try {
splitInputStream = new SplitInputStream(zipModel.getZipFile(), zipModel.isSplit... | #vulnerable code
public static ZipInputStream createZipInputStream(ZipModel zipModel, FileHeader fileHeader, char[] password)
throws ZipException {
try {
SplitInputStream splitInputStream = new SplitInputStream(zipModel.getZipFile(), zipModel.isSplitArchive(),
zi... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private ZipInputStream prepareZipInputStream() throws ZipException {
try {
splitInputStream = new SplitInputStream(getZipModel().getZipFile(),
getZipModel().isSplitArchive(), getZipModel().getEndOfCentralDirectoryRecord().getNumberOfThisDisk());
FileH... | #vulnerable code
private ZipInputStream prepareZipInputStream() throws ZipException {
try {
SplitInputStream splitInputStream = new SplitInputStream(getZipModel().getZipFile(),
getZipModel().isSplitArchive(), getZipModel().getEndOfCentralDirectoryRecord().getNumberOfTh... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static ZipInputStream createZipInputStream(ZipModel zipModel, FileHeader fileHeader, char[] password)
throws IOException {
SplitInputStream splitInputStream = null;
try {
splitInputStream = new SplitInputStream(zipModel.getZipFile(), zipModel.isSplit... | #vulnerable code
public static ZipInputStream createZipInputStream(ZipModel zipModel, FileHeader fileHeader, char[] password)
throws ZipException {
try {
SplitInputStream splitInputStream = new SplitInputStream(zipModel.getZipFile(), zipModel.isSplitArchive(),
zi... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
protected void executeTask(RenameFilesTaskParameters taskParameters, ProgressMonitor progressMonitor) throws IOException {
Map<String, String> fileNamesMap = filterNonExistingEntriesAndAddSeparatorIfNeeded(taskParameters.fileNamesMap);
if (fileNamesMap.size(... | #vulnerable code
@Override
protected void executeTask(RenameFilesTaskParameters taskParameters, ProgressMonitor progressMonitor) throws IOException {
Map<String, String> fileNamesMap = filterNonExistingEntriesAndAddSeparatorIfNeeded(taskParameters.fileNamesMap);
if (fileNamesMap... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static byte[] getFileAttributes(File file) {
try {
if (file == null || (!Files.isSymbolicLink(file.toPath()) && !file.exists())) {
return new byte[4];
}
Path path = file.toPath();
if (isWindows()) {
return getWindowsFileAttri... | #vulnerable code
public static byte[] getFileAttributes(File file) {
try {
if (file == null || (!Files.isSymbolicLink(file.toPath()) && !file.exists())) {
return new byte[4];
}
Path path = file.toPath();
String os = System.getProperty("os.name").toLow... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected ZipInputStream createZipInputStream(FileHeader fileHeader) throws IOException {
splitInputStream = new SplitInputStream(getZipModel().getZipFile(),
getZipModel().isSplitArchive(), getZipModel().getEndOfCentralDirectoryRecord().getNumberOfThisDisk());
s... | #vulnerable code
protected ZipInputStream createZipInputStream(FileHeader fileHeader) throws IOException {
SplitInputStream splitInputStream = new SplitInputStream(getZipModel().getZipFile(),
getZipModel().isSplitArchive(), getZipModel().getEndOfCentralDirectoryRecord().getNum... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static boolean isWindows() {
return (OPERATING_SYSTEM_NAME.contains("win"));
} | #vulnerable code
public static boolean isWindows() {
String os = System.getProperty("os.name").toLowerCase();
return isWindows(os);
}
#location 2
#vulnerability type NULL_DEREFERENCE | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected ZipInputStream createZipInputStream(FileHeader fileHeader) throws IOException {
splitInputStream = new SplitInputStream(getZipModel().getZipFile(),
getZipModel().isSplitArchive(), getZipModel().getEndOfCentralDirectoryRecord().getNumberOfThisDisk());
s... | #vulnerable code
protected ZipInputStream createZipInputStream(FileHeader fileHeader) throws IOException {
SplitInputStream splitInputStream = new SplitInputStream(getZipModel().getZipFile(),
getZipModel().isSplitArchive(), getZipModel().getEndOfCentralDirectoryRecord().getNum... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private DecompressedInputStream initializeEntryInputStream(LocalFileHeader localFileHeader) throws IOException {
ZipEntryInputStream zipEntryInputStream = new ZipEntryInputStream(inputStream, getCompressedSize(localFileHeader));
CipherInputStream cipherInputStream = ini... | #vulnerable code
private DecompressedInputStream initializeEntryInputStream(LocalFileHeader localFileHeader) throws IOException {
ZipEntryInputStream zipEntryInputStream = new ZipEntryInputStream(inputStream);
CipherInputStream cipherInputStream = initializeCipherInputStream(zipEn... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected ZipInputStream createZipInputStream(FileHeader fileHeader) throws IOException {
splitInputStream = new SplitInputStream(getZipModel().getZipFile(),
getZipModel().isSplitArchive(), getZipModel().getEndOfCentralDirectoryRecord().getNumberOfThisDisk());
s... | #vulnerable code
protected ZipInputStream createZipInputStream(FileHeader fileHeader) throws IOException {
SplitInputStream splitInputStream = new SplitInputStream(getZipModel().getZipFile(),
getZipModel().isSplitArchive(), getZipModel().getEndOfCentralDirectoryRecord().getNum... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private ZipInputStream prepareZipInputStream() throws ZipException {
try {
splitInputStream = new SplitInputStream(getZipModel().getZipFile(),
getZipModel().isSplitArchive(), getZipModel().getEndOfCentralDirectoryRecord().getNumberOfThisDisk());
FileH... | #vulnerable code
private ZipInputStream prepareZipInputStream() throws ZipException {
try {
SplitInputStream splitInputStream = new SplitInputStream(getZipModel().getZipFile(),
getZipModel().isSplitArchive(), getZipModel().getEndOfCentralDirectoryRecord().getNumberOfTh... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void bidiBackpressure() throws InterruptedException {
RxNumbersGrpc.RxNumbersStub stub = RxNumbersGrpc.newRxStub(channel);
Flowable<NumberProto.Number> rxRequest = Flowable
.fromIterable(IntStream.range(0, NUMBER_OF_STREAM_ELE... | #vulnerable code
@Test
public void bidiBackpressure() throws InterruptedException {
Object lock = new Object();
BackpressureDetector clientReqBPDetector = new BackpressureDetector(madMultipleCutoff);
BackpressureDetector clientRespBPDetector = new Backpressur... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void serverToClientBackpressure() throws InterruptedException {
ReactorNumbersGrpc.ReactorNumbersStub stub = ReactorNumbersGrpc.newReactorStub(channel);
Mono<Empty> reactorRequest = Mono.just(Empty.getDefaultInstance());
Flux<NumberP... | #vulnerable code
@Test
public void serverToClientBackpressure() throws InterruptedException {
Object lock = new Object();
BackpressureDetector clientBackpressureDetector = new BackpressureDetector(madMultipleCutoff);
ReactorNumbersGrpc.ReactorNumbersStub stu... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void clientToServerBackpressure() throws InterruptedException {
RxNumbersGrpc.RxNumbersStub stub = RxNumbersGrpc.newRxStub(channel);
Flowable<NumberProto.Number> rxRequest = Flowable
.fromIterable(IntStream.range(0, NUMBER_OF_... | #vulnerable code
@Test
public void clientToServerBackpressure() throws InterruptedException {
Object lock = new Object();
RxNumbersGrpc.RxNumbersStub stub = RxNumbersGrpc.newRxStub(channel);
BackpressureDetector clientBackpressureDetector = new BackpressureD... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void clientToServerBackpressure() throws InterruptedException {
ReactorNumbersGrpc.ReactorNumbersStub stub = ReactorNumbersGrpc.newReactorStub(channel);
Flux<NumberProto.Number> reactorRequest = Flux
.fromIterable(IntStream.ra... | #vulnerable code
@Test
public void clientToServerBackpressure() throws InterruptedException {
Object lock = new Object();
ReactorNumbersGrpc.ReactorNumbersStub stub = ReactorNumbersGrpc.newReactorStub(channel);
BackpressureDetector clientBackpressureDetector... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void serverToClientBackpressure() throws InterruptedException {
RxNumbersGrpc.RxNumbersStub stub = RxNumbersGrpc.newRxStub(channel);
Single<Empty> rxRequest = Single.just(Empty.getDefaultInstance());
TestSubscriber<NumberProto.Number... | #vulnerable code
@Test
public void serverToClientBackpressure() throws InterruptedException {
Object lock = new Object();
BackpressureDetector clientBackpressureDetector = new BackpressureDetector(madMultipleCutoff);
RxNumbersGrpc.RxNumbersStub stub = RxNumb... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public String render(ClassModel model, int index, int size, Map<String, Object> session) {
if (isExcludedClass(model.getType().getName())) {
return null;
}
StringWriter sw = new StringWriter();
PrintWriter writer = new PrintWriter(sw);
C... | #vulnerable code
@Override
public String render(ClassModel model, int index, int size, Map<String, Object> session) {
if (isExcludedClass(model.getType().getName())) {
return null;
}
StringWriter sw = new StringWriter();
PrintWriter writer = new PrintWriter(sw);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void run() {
final Set<String> artifacts = new HashSet<>();
installNodeModules(artifacts);
final File base = new File(cwd, "node_modules");
final File libs = new File(base, ".lib");
if (force || libs.exists()) {
final double versio... | #vulnerable code
@Override
public void run() {
final Set<String> artifacts = new HashSet<>();
installNodeModules(artifacts);
final File base = new File(cwd, "node_modules");
final File libs = new File(base, ".lib");
if (force || libs.exists()) {
final double ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public String render(ClassModel model, int index, int size, Map<String, Object> session) {
if (isExcludedClass(model.getType().getName())) {
return null;
}
StringWriter sw = new StringWriter();
PrintWriter writer = new PrintWriter(sw);
C... | #vulnerable code
@Override
public String render(ClassModel model, int index, int size, Map<String, Object> session) {
if (isExcludedClass(model.getType().getName())) {
return null;
}
StringWriter sw = new StringWriter();
PrintWriter writer = new PrintWriter(sw);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void run() {
final Set<String> artifacts = new HashSet<>();
installNodeModules(artifacts);
final File base = new File(cwd, "node_modules");
final File libs = new File(base, ".lib");
if (force || libs.exists()) {
final double versio... | #vulnerable code
@Override
public void run() {
final Set<String> artifacts = new HashSet<>();
installNodeModules(artifacts);
final File base = new File(cwd, "node_modules");
final File libs = new File(base, ".lib");
if (force || libs.exists()) {
final double ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public String injectVersion(String resourcePath) {
String version = getResourceVersion(resourcePath);
if (StringUtils.isNullOrEmpty(version)) {
// unversioned, pass-through resource path
return resourcePath;
}
// check ... | #vulnerable code
public String injectVersion(String resourcePath) {
URL resourceUrl = getResourceUrl(resourcePath);
try {
long lastModified = resourceUrl.openConnection().getLastModified();
// check for extension
int extensionAt = res... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@BeforeClass
public static void setUpClass() throws IOException {
MemcachedStarter runtime = MemcachedStarter.getDefaultInstance();
memcachedExe = runtime.prepare(
new MemcachedConfig(Version.Main.PRODUCTION, PORT));
memcached = mem... | #vulnerable code
@BeforeClass
public static void setUpClass() {
application = new Application();
client = XmemcachedFactory.create(application.getPippoSettings());
}
#location 4
#vulnerability type NULL_DE... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@BeforeClass
public static void setUpClass() throws IOException {
MemcachedStarter runtime = MemcachedStarter.getDefaultInstance();
memcachedExe = runtime.prepare(
new MemcachedConfig(Version.Main.PRODUCTION, PORT));
memcached = mem... | #vulnerable code
@BeforeClass
public static void setUpClass() {
application = new Application();
client = SpymemcachedFactory.create(application.getPippoSettings());
}
#location 4
#vulnerability type NULL_... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void classpathResourceHandlerTest() throws URISyntaxException {
ClasspathResourceHandler handler = new ClasspathResourceHandler("/", "/public");
URL resourceUrl = handler.getResourceUrl("VISIBLE");
assertNotNull(resourceUrl);
... | #vulnerable code
@Test
public void classpathResourceHandlerTest() throws URISyntaxException {
ClasspathResourceHandler handler = new ClasspathResourceHandler("/", "/public");
URL resourceUrl = handler.getResourceUrl("VISIBLE");
assertNotNull(resourceUrl);
... | Below is the vulnerable code, please generate the patch based on the following information. |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 24