output
stringlengths
64
73.2k
input
stringlengths
208
73.3k
instruction
stringclasses
1 value
#fixed code @Override public <T> void deleteAll(Class<T> type) { ClassInfo classInfo = session.metaData().classInfo(type.getName()); if (classInfo != null) { Transaction tx = session.ensureTransaction(); ParameterisedStatement request = getDel...
#vulnerable code @Override public <T> void deleteAll(Class<T> type) { ClassInfo classInfo = session.metaData().classInfo(type.getName()); if (classInfo != null) { String url = session.ensureTransaction().url(); ParameterisedStatement request =...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Result query(String cypher, Map<String, ?> parameters, boolean readOnly) { validateQuery(cypher, parameters, readOnly); //If readOnly=true, just execute the query. If false, execute the query and return stats as well if(readOnly) ...
#vulnerable code @Override public Result query(String cypher, Map<String, ?> parameters, boolean readOnly) { validateQuery(cypher, parameters, readOnly); //If readOnly=true, just execute the query. If false, execute the query and return stats as well if(read...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public <T> Collection<T> loadAll(Class<T> type, Filters filters, SortOrder sortOrder, Pagination pagination, int depth) { Transaction tx = session.ensureTransaction(); String entityType = session.entityType(type.getName()); QueryStatemen...
#vulnerable code @Override public <T> Collection<T> loadAll(Class<T> type, Filters filters, SortOrder sortOrder, Pagination pagination, int depth) { String url = session.ensureTransaction().url(); String entityType = session.entityType(type.getName()); Query...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void configure(Configuration configuration) { destroy(); Components.configuration = configuration; }
#vulnerable code public static void configure(Configuration configuration) { driver = null; Components.configuration = configuration; } #location 2 #vulnerability type THREAD_SAFETY_VIOLATION
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void shouldParseDataInRowResponseCorrectly() { try (Response<DefaultRestModel> rsp = new TestRestHttpResponse((rowResultsAndNoErrors()))) { DefaultRestModel restModel = rsp.next(); assertNotNull(restModel); Map<Str...
#vulnerable code @Test public void shouldParseDataInRowResponseCorrectly() { try (Response<DefaultRestModel> rsp = new TestRestHttpResponse((rowResultsAndNoErrors()))) { DefaultRestModel restModel = rsp.next(); assertNotNull(restModel); O...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testIndexesAreSuccessfullyAsserted() { createLoginConstraint(); baseConfiguration.setAutoIndex("assert"); AutoIndexManager indexManager = new AutoIndexManager(metaData, Components.driver(), baseConfiguration); assertEquals(AutoIndexMode.ASSERT.getNa...
#vulnerable code @Test public void testIndexesAreSuccessfullyAsserted() { createLoginConstraint(); Components.getConfiguration().setAutoIndex("assert"); AutoIndexManager indexManager = new AutoIndexManager(metaData, Components.driver()); assertEquals(AutoIndexMode.ASSERT.getNam...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public RelationalWriter getIterableWriter(ClassInfo classInfo, Class<?> parameterType, String relationshipType, String relationshipDirection) { if(!iterableWriterCache.containsKey(classInfo)) { iterableWriterCache.put(classInfo, new HashMap<D...
#vulnerable code @Override public RelationalWriter getIterableWriter(ClassInfo classInfo, Class<?> parameterType, String relationshipType, String relationshipDirection) { if(iterableWriterCache.get(classInfo) == null) { iterableWriterCache.put(classInfo, new Hash...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void setProperties(List<Property<String, Object>> propertyList, Object instance) { ClassInfo classInfo = metadata.classInfo(instance); getCompositeProperties(propertyList, classInfo).forEach( (field, v) -> field.write(instance, v)); for (Prop...
#vulnerable code private void setProperties(List<Property<String, Object>> propertyList, Object instance) { ClassInfo classInfo = metadata.classInfo(instance); Collection<FieldInfo> compositeFields = classInfo.fieldsInfo().compositeFields(); if (compositeFields....
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void purgeDatabase() { Transaction tx = session.ensureTransaction(); session.requestHandler().execute(new DeleteNodeStatements().purge(), tx).close(); session.context().clear(); }
#vulnerable code @Override public void purgeDatabase() { String url = session.ensureTransaction().url(); session.requestHandler().execute(new DeleteNodeStatements().purge(), url).close(); session.context().clear(); } #location...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public <T, ID extends Serializable> T load(Class<T> type, ID id, int depth) { ClassInfo classInfo = session.metaData().classInfo(type.getName()); if (classInfo == null) { throw new IllegalArgumentException(type + " is not a managed entity."); ...
#vulnerable code public <T, ID extends Serializable> T load(Class<T> type, ID id, int depth) { final FieldInfo primaryIndexField = session.metaData().classInfo(type.getName()).primaryIndexField(); if (primaryIndexField != null && !primaryIndexField.isTypeOf(id.getClass(...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public <T> Collection<T> loadAll(Class<T> type, Collection<Long> ids, SortOrder sortOrder, Pagination pagination, int depth) { Transaction tx = session.ensureTransaction(); String entityType = session.entityType(type.getName()); QuerySt...
#vulnerable code @Override public <T> Collection<T> loadAll(Class<T> type, Collection<Long> ids, SortOrder sortOrder, Pagination pagination, int depth) { String url = session.ensureTransaction().url(); String entityType = session.entityType(type.getName()); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public long countEntitiesOfType(Class<?> entity) { ClassInfo classInfo = session.metaData().classInfo(entity.getName()); if (classInfo == null) { return 0; } RowModelQuery countStatement = new AggregateStatements().co...
#vulnerable code @Override public long countEntitiesOfType(Class<?> entity) { ClassInfo classInfo = session.metaData().classInfo(entity.getName()); if (classInfo == null) { return 0; } RowModelQuery countStatement = new AggregateStatement...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public FieldInfo propertyField(String propertyName) { if (propertyFields == null) { Collection<FieldInfo> fieldInfos = propertyFields(); propertyFields = new HashMap<>(fieldInfos.size()); for (FieldInfo fieldInfo : fieldInfos) { ...
#vulnerable code public FieldInfo propertyField(String propertyName) { for (FieldInfo fieldInfo : propertyFields()) { if (fieldInfo.property().equalsIgnoreCase(propertyName)) { return fieldInfo; } } return null; } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public <T> void delete(T object) { if (object.getClass().isArray() || Iterable.class.isAssignableFrom(object.getClass())) { deleteAll(object); } else { ClassInfo classInfo = session.metaData().classInfo(object); ...
#vulnerable code @Override public <T> void delete(T object) { if (object.getClass().isArray() || Iterable.class.isAssignableFrom(object.getClass())) { deleteAll(object); } else { ClassInfo classInfo = session.metaData().classInfo(object); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testChangedPropertyDetected() { Teacher teacher = new Teacher("Miss White"); teacher.setId(115L); // the id field must not be part of the memoised property list mappingContext.remember(teacher); teacher.setName("Mrs Jone...
#vulnerable code @Test public void testChangedPropertyDetected() { ClassInfo classInfo = metaData.classInfo(Teacher.class.getName()); Teacher teacher = new Teacher("Miss White"); objectMemo.remember(teacher, classInfo); teacher.setId(115L); // the ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public <T> T load(Class<T> type, Long id, int depth) { Transaction tx = session.ensureTransaction(); QueryStatements queryStatements = session.queryStatementsFor(type); Query qry = queryStatements.findOne(id,depth); try (Neo4jResp...
#vulnerable code @Override public <T> T load(Class<T> type, Long id, int depth) { String url = session.ensureTransaction().url(); QueryStatements queryStatements = session.queryStatementsFor(type); Query qry = queryStatements.findOne(id,depth); try (N...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Long nativeId(Object entity) { ClassInfo classInfo = metaData.classInfo(entity); if (classInfo == null) { throw new IllegalArgumentException("Class " + entity.getClass() + " is not a valid entity class. " + "Please check the...
#vulnerable code public Long nativeId(Object entity) { ClassInfo classInfo = metaData.classInfo(entity); generateIdIfNecessary(entity, classInfo); if (classInfo.hasIdentityField()) { return EntityUtils.identity(entity, metaData); } else { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void mapOneToMany(Collection<Edge> oneToManyRelationships) { EntityCollector entityCollector = new EntityCollector(); List<MappedRelationship> relationshipsToRegister = new ArrayList<>(); // first, build the full set of related entities of ea...
#vulnerable code private void mapOneToMany(Collection<Edge> oneToManyRelationships) { EntityCollector entityCollector = new EntityCollector(); List<MappedRelationship> relationshipsToRegister = new ArrayList<>(); Set<Edge> registeredEdges = new HashSet<>(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Result query(String cypher, Map<String, ?> parameters, boolean readOnly) { validateQuery(cypher, parameters, readOnly); //If readOnly=true, just execute the query. If false, execute the query and return stats as well if(readOnly) ...
#vulnerable code @Override public Result query(String cypher, Map<String, ?> parameters, boolean readOnly) { validateQuery(cypher, parameters, readOnly); //If readOnly=true, just execute the query. If false, execute the query and return stats as well if(read...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public long countEntitiesOfType(Class<?> entity) { ClassInfo classInfo = session.metaData().classInfo(entity.getName()); if (classInfo == null) { return 0; } RowModelQuery countStatement = new AggregateStatements().co...
#vulnerable code @Override public long countEntitiesOfType(Class<?> entity) { ClassInfo classInfo = session.metaData().classInfo(entity.getName()); if (classInfo == null) { return 0; } RowModelQuery countStatement = new AggregateStatement...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void close() { if (graphDatabaseService != null) { logger.debug(" *** Now shutting down embedded database instance: " + this); graphDatabaseService.shutdown(); // graphDatabaseService = null; ...
#vulnerable code @Override public void close() { if (graphDatabaseService != null) { graphDatabaseService.shutdown(); } } #location 4 #vulnerability type THREAD_SAFETY_VIOLATION
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private Object createRelationshipEntity(Edge edge, Object startEntity, Object endEntity) { ClassInfo relationClassInfo = getRelationshipEntity(edge); if (relationClassInfo == null) { throw new MappingException("Could not find a class to map for re...
#vulnerable code private Object createRelationshipEntity(Edge edge, Object startEntity, Object endEntity) { // create and hydrate the new RE Object relationshipEntity = entityFactory.newObject(getRelationshipEntity(edge)); EntityUtils.setIdentity(relationshipEnt...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void mapOneToMany(Object instance, Class<?> valueType, Object values, String relationshipType, String relationshipDirection) { ClassInfo classInfo = metadata.classInfo(instance); RelationalWriter writer = EntityAccessManager.getIterableWriter(classInfo, valueType, ...
#vulnerable code private void mapOneToMany(Object instance, Class<?> valueType, Object values, String relationshipType, String relationshipDirection) { ClassInfo classInfo = metadata.classInfo(instance); RelationalWriter writer = entityAccessStrategy.getIterableWriter(classInfo, valu...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public <T> Collection<T> loadAll(Class<T> type, Collection<Long> ids, SortOrder sortOrder, Pagination pagination, int depth) { Transaction tx = session.ensureTransaction(); String entityType = session.entityType(type.getName()); QuerySt...
#vulnerable code @Override public <T> Collection<T> loadAll(Class<T> type, Collection<Long> ids, SortOrder sortOrder, Pagination pagination, int depth) { String url = session.ensureTransaction().url(); String entityType = session.entityType(type.getName()); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Before public void setUp() throws Exception { TestOgmPluginLifecycle.shouldInitialize = true; }
#vulnerable code @Before public void setUp() throws Exception { new File("target/test-classes/META-INF/services/").mkdirs(); FileWriter out = new FileWriter(PLUGIN_LIFECYCLE); out.write(TestOgmPluginLifecycle.class.getName()); out.close(); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void hydrateCourses(Collection<Teacher> teachers) { session.loadAll(Course.class); }
#vulnerable code private void hydrateCourses(Collection<Teacher> teachers) { session.setDriver(new TeacherRequest()); session.setDriver(new CoursesRequest()); session.loadAll(Course.class); } #location 4 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public <T> void deleteAll(Class<T> type) { ClassInfo classInfo = session.metaData().classInfo(type.getName()); if (classInfo != null) { Transaction tx = session.ensureTransaction(); ParameterisedStatement request = getDel...
#vulnerable code @Override public <T> void deleteAll(Class<T> type) { ClassInfo classInfo = session.metaData().classInfo(type.getName()); if (classInfo != null) { String url = session.ensureTransaction().url(); ParameterisedStatement request =...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public <T> Iterable<T> map(Class<T> type, Response<RestModel> response) { RestStatisticsModel restStatisticsModel = new RestStatisticsModel(); RestModel model = response.next(); Collection<Map<String, Object>> result = new ArrayList<>(); Map<Long, String> rela...
#vulnerable code @Override public <T> Iterable<T> map(Class<T> type, Response<RestModel> response) { //TODO refactor to decouple from the REST response format RestStatisticsModel restStatisticsModel = new RestStatisticsModel(); RestModel model; Collection<Map<String, Object>> resu...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private String newTransactionUrl() { String url = transactionEndpoint(driverConfig.getURI()); LOGGER.debug( "Thread: {}, POST {}", Thread.currentThread().getId(), url ); HttpPost request = new HttpPost(url); try (CloseableHttpResponse respon...
#vulnerable code private String newTransactionUrl() { String url = transactionEndpoint(driverConfig.getURI()); LOGGER.debug( "Thread {}: POST {}", Thread.currentThread().getId(), url ); try (CloseableHttpResponse response = executeHttpRequest(new HttpPost(url))...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private RelationshipBuilder getRelationshipBuilder(Compiler cypherBuilder, Object entity, DirectedRelationship directedRelationship, boolean mapBothDirections) { RelationshipBuilder relationshipBuilder; if (isRelationshipEntity(entity)) { Long re...
#vulnerable code private RelationshipBuilder getRelationshipBuilder(Compiler cypherBuilder, Object entity, DirectedRelationship directedRelationship, boolean mapBothDirections) { RelationshipBuilder relationshipBuilder; if (isRelationshipEntity(entity)) { L...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private Object createRelationshipEntity(Edge edge, Object startEntity, Object endEntity) { ClassInfo relationClassInfo = getRelationshipEntity(edge); if (relationClassInfo == null) { throw new MappingException("Could not find a class to map for re...
#vulnerable code private Object createRelationshipEntity(Edge edge, Object startEntity, Object endEntity) { // create and hydrate the new RE Object relationshipEntity = entityFactory.newObject(getRelationshipEntity(edge)); EntityUtils.setIdentity(relationshipEnt...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private <T> Iterable<T> executeAndMap(Class<T> type, String cypher, Map<String, ?> parameters, RowModelMapper<T> rowModelMapper) { if (StringUtils.isEmpty(cypher)) { throw new RuntimeException("Supplied cypher statement must not be null or empty."); ...
#vulnerable code private <T> Iterable<T> executeAndMap(Class<T> type, String cypher, Map<String, ?> parameters, RowModelMapper<T> rowModelMapper) { if (StringUtils.isEmpty(cypher)) { throw new RuntimeException("Supplied cypher statement must not be null or empty."); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public QueryStatistics execute(String statement) { if (StringUtils.isEmpty(statement)) { throw new RuntimeException("Supplied cypher statement must not be null or empty."); } assertNothingReturned(statement); RowModelQ...
#vulnerable code @Override public QueryStatistics execute(String statement) { if (StringUtils.isEmpty(statement)) { throw new RuntimeException("Supplied cypher statement must not be null or empty."); } assertNothingReturned(statement); Row...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void shouldParseDataInRowResponseCorrectly() { try (Response<DefaultRestModel> rsp = new TestRestHttpResponse((rowResultsAndNoErrors()))) { DefaultRestModel restModel = rsp.next(); assertNotNull(restModel); Map<Str...
#vulnerable code @Test public void shouldParseDataInRowResponseCorrectly() { try (Response<DefaultRestModel> rsp = new TestRestHttpResponse((rowResultsAndNoErrors()))) { DefaultRestModel restModel = rsp.next(); assertNotNull(restModel); O...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void mapOneToMany(Collection<Edge> oneToManyRelationships) { EntityCollector entityCollector = new EntityCollector(); List<MappedRelationship> relationshipsToRegister = new ArrayList<>(); // first, build the full set of related entities of ea...
#vulnerable code private void mapOneToMany(Collection<Edge> oneToManyRelationships) { EntityCollector entityCollector = new EntityCollector(); List<MappedRelationship> relationshipsToRegister = new ArrayList<>(); Set<Edge> registeredEdges = new HashSet<>(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testRelatedObjectChangeDoesNotAffectNodeMemoisation() { Teacher teacher = new Teacher("Miss White"); teacher.setId(115L); // the id field must not be part of the memoised property list mappingContext.remember(teacher); ...
#vulnerable code @Test public void testRelatedObjectChangeDoesNotAffectNodeMemoisation() { ClassInfo classInfo = metaData.classInfo(Teacher.class.getName()); Teacher teacher = new Teacher("Miss White"); objectMemo.remember(teacher, classInfo); teac...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public RelationalReader getRelationalReader(ClassInfo classInfo, String relationshipType, String relationshipDirection) { if(!relationalReaderCache.containsKey(classInfo)) { relationalReaderCache.put(classInfo, new HashMap<DirectedRelationshi...
#vulnerable code @Override public RelationalReader getRelationalReader(ClassInfo classInfo, String relationshipType, String relationshipDirection) { if(relationalReaderCache.get(classInfo) == null) { relationalReaderCache.put(classInfo, new HashMap<DirectedRelati...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private <T> Iterable<T> executeAndMap(Class<T> type, String cypher, Map<String, ?> parameters, RowModelMapper<T> rowModelMapper) { if (StringUtils.isEmpty(cypher)) { throw new RuntimeException("Supplied cypher statement must not be null or empty."); ...
#vulnerable code private <T> Iterable<T> executeAndMap(Class<T> type, String cypher, Map<String, ?> parameters, RowModelMapper<T> rowModelMapper) { if (StringUtils.isEmpty(cypher)) { throw new RuntimeException("Supplied cypher statement must not be null or empty."); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public QueryStatistics execute(String statement) { if (StringUtils.isEmpty(statement)) { throw new RuntimeException("Supplied cypher statement must not be null or empty."); } assertNothingReturned(statement); RowModelQ...
#vulnerable code @Override public QueryStatistics execute(String statement) { if (StringUtils.isEmpty(statement)) { throw new RuntimeException("Supplied cypher statement must not be null or empty."); } assertNothingReturned(statement); Row...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void purgeDatabase() { Transaction tx = session.ensureTransaction(); session.requestHandler().execute(new DeleteNodeStatements().purge(), tx).close(); session.context().clear(); }
#vulnerable code @Override public void purgeDatabase() { String url = session.ensureTransaction().url(); session.requestHandler().execute(new DeleteNodeStatements().purge(), url).close(); session.context().clear(); } #location...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public QueryStatistics execute(String cypher, Map<String, Object> parameters) { if (StringUtils.isEmpty(cypher)) { throw new RuntimeException("Supplied cypher statement must not be null or empty."); } if (parameters == null) ...
#vulnerable code @Override public QueryStatistics execute(String cypher, Map<String, Object> parameters) { if (StringUtils.isEmpty(cypher)) { throw new RuntimeException("Supplied cypher statement must not be null or empty."); } if (parameters == ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void configure(String configurationFileName) { try (InputStream is = toInputStream(configurationFileName)) { configure(is); } catch (Exception e) { logger.warn("Could not configure OGM from {}", configurationFileName); ...
#vulnerable code public static void configure(String configurationFileName) { try (InputStream is = classPathResource(configurationFileName)) { configure(is); } catch (Exception e) { logger.warn("Could not configure OGM from {}", configurationFile...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public FieldInfo propertyField(String propertyName) { if (propertyFields == null) { initPropertyFields(); } return propertyFields.get(propertyName.toLowerCase()); }
#vulnerable code public FieldInfo propertyField(String propertyName) { if (propertyFields == null) { if (propertyFields == null) { Collection<FieldInfo> fieldInfos = propertyFields(); propertyFields = new HashMap<>(fieldInfos.size());...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testIndexesAreSuccessfullyValidated() { createLoginConstraint(); baseConfiguration.setAutoIndex("validate"); AutoIndexManager indexManager = new AutoIndexManager(metaData, Components.driver(), baseConfiguration); assertEquals(AutoIndexMode.VALIDATE.g...
#vulnerable code @Test public void testIndexesAreSuccessfullyValidated() { createLoginConstraint(); Components.getConfiguration().setAutoIndex("validate"); AutoIndexManager indexManager = new AutoIndexManager(metaData, Components.driver()); assertEquals(AutoIndexMode.VALIDATE.ge...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code boolean removeRelationship(MappedRelationship mappedRelationship) { return relationshipRegister.remove(mappedRelationship); }
#vulnerable code void removeEntity(Object entity) { Class<?> type = entity.getClass(); ClassInfo classInfo = metaData.classInfo(type.getName()); FieldInfo identityReader = classInfo.identityField(); Long id = (Long) identityReader.readProperty(entity); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testIndexDumpMatchesDatabaseIndexes() throws IOException { createLoginConstraint(); baseConfiguration.setAutoIndex("dump"); baseConfiguration.setDumpDir("."); baseConfiguration.setDumpFilename("test.cql"); File file = new File("./test.cql"); tr...
#vulnerable code @Test public void testIndexDumpMatchesDatabaseIndexes() throws IOException { createLoginConstraint(); Components.getConfiguration().setAutoIndex("dump"); Components.getConfiguration().setDumpDir("."); Components.getConfiguration().setDumpFilename("test.cql"); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public EntityAccess getPropertyWriter(final ClassInfo classInfo, String propertyName) { if(!propertyWriterCache.containsKey(classInfo)) { propertyWriterCache.put(classInfo,new HashMap<String, EntityAccess>()); } if(propertyWri...
#vulnerable code @Override public EntityAccess getPropertyWriter(final ClassInfo classInfo, String propertyName) { if(propertyWriterCache.get(classInfo) == null) { propertyWriterCache.put(classInfo,new HashMap<String, EntityAccess>()); } EntityAcc...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private Object createRelationshipEntity(Edge edge, Object startEntity, Object endEntity) { // create and hydrate the new RE Object relationshipEntity = entityFactory.newObject(getRelationshipEntity(edge)); setIdentity(relationshipEntity, edge.getId()); // REs also have...
#vulnerable code private Object createRelationshipEntity(Edge edge, Object startEntity, Object endEntity) { // create and hydrate the new RE Object relationshipEntity = entityFactory.newObject(getRelationshipEntity(edge)); setIdentity(relationshipEntity, edge.getId()); // REs als...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code boolean removeRelationship(MappedRelationship mappedRelationship) { return relationshipRegister.remove(mappedRelationship); }
#vulnerable code void removeNodeEntity(Object entity, boolean deregisterDependentRelationshipEntity) { Long id = nativeId(entity); nodeEntityRegister.remove(id); final ClassInfo primaryIndexClassInfo = metaData.classInfo(entity); final FieldInfo primary...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public QueryStatistics execute(String cypher, Map<String, Object> parameters) { if (StringUtils.isEmpty(cypher)) { throw new RuntimeException("Supplied cypher statement must not be null or empty."); } if (parameters == null) ...
#vulnerable code @Override public QueryStatistics execute(String cypher, Map<String, Object> parameters) { if (StringUtils.isEmpty(cypher)) { throw new RuntimeException("Supplied cypher statement must not be null or empty."); } if (parameters == ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testUnchangedObjectDetected() { Teacher mrsJones = new Teacher(); mrsJones.setId(115L); // the id field must not be part of the memoised property list mappingContext.remember(mrsJones); assertFalse(mappingContext.isDirty...
#vulnerable code @Test public void testUnchangedObjectDetected() { ClassInfo classInfo = metaData.classInfo(Teacher.class.getName()); Teacher mrsJones = new Teacher(); objectMemo.remember(mrsJones, classInfo); mrsJones.setId(115L); // the id field ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public <T> void delete(T object) { if (object.getClass().isArray() || Iterable.class.isAssignableFrom(object.getClass())) { deleteAll(object); } else { ClassInfo classInfo = session.metaData().classInfo(object); ...
#vulnerable code @Override public <T> void delete(T object) { if (object.getClass().isArray() || Iterable.class.isAssignableFrom(object.getClass())) { deleteAll(object); } else { ClassInfo classInfo = session.metaData().classInfo(object); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private String createTemporaryEphemeralFileStore() { try { Path path = Files.createTempDirectory("neo4j.db"); File f = path.toFile(); f.deleteOnExit(); URI uri = f.toURI(); String fileStoreUri = uri.toString...
#vulnerable code private String createTemporaryEphemeralFileStore() { try { System.out.format("java tmpdir root: %s\n", System.getProperty("java.io.tmpdir")); Path path = Files.createTempDirectory("neo4j.db"); System.out.format("Check tempor...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public PropertyReader getPropertyReader(final ClassInfo classInfo, String propertyName) { if(!propertyReaderCache.containsKey(classInfo)) { propertyReaderCache.put(classInfo, new HashMap<String, PropertyReader>()); } if(proper...
#vulnerable code @Override public PropertyReader getPropertyReader(final ClassInfo classInfo, String propertyName) { if(propertyReaderCache.get(classInfo) == null) { propertyReaderCache.put(classInfo, new HashMap<String, PropertyReader>()); } Prop...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected boolean processEvent(WatchedEvent event) { boolean foundEvent = false; if (event.getPath().startsWith(MASTER_JOB_STATE_PATH) && (event.getType() == EventType.NodeChildrenChanged)) { if (LOG.isInfoEnabled()) {...
#vulnerable code @Override protected boolean processEvent(WatchedEvent event) { boolean foundEvent = false; if (event.getPath().startsWith(MASTER_JOB_STATE_PATH) && (event.getType() == EventType.NodeChildrenChanged)) { if (LOG.isInfoEnable...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void onlineZooKeeperServers() { Integer taskId = zkServerPortMap.get(myHostname); if ((taskId != null) && (taskId.intValue() == taskPartition)) { File zkDirFile = new File(this.zkDir); try { if (LOG.isInfoEnabled(...
#vulnerable code public void onlineZooKeeperServers() { Integer taskId = zkServerPortMap.get(myHostname); if ((taskId != null) && (taskId.intValue() == taskPartition)) { File zkDirFile = new File(this.zkDir); try { if (LOG.isInfoEn...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public SuperstepState coordinateSuperstep() throws KeeperException, InterruptedException { // 1. Get chosen workers and set up watches on them. // 2. Assign partitions to the workers // or possibly reload from a superstep ...
#vulnerable code @Override public SuperstepState coordinateSuperstep() throws KeeperException, InterruptedException { // 1. Get chosen workers and set up watches on them. // 2. Assign partitions to the workers // or possibly reload from a super...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void onlineZooKeeperServers() { Integer taskId = zkServerPortMap.get(myHostname); if ((taskId != null) && (taskId.intValue() == taskPartition)) { File zkDirFile = new File(this.zkDir); try { if (LOG.isInfoEnabled(...
#vulnerable code public void onlineZooKeeperServers() { Integer taskId = zkServerPortMap.get(myHostname); if ((taskId != null) && (taskId.intValue() == taskPartition)) { File zkDirFile = new File(this.zkDir); try { if (LOG.isInfoEn...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private Map<String, Object> doUpdate(EntityManager entityManager, int ciTypeId, Map<String, Object> ci, boolean enableStateTransition) { DynamicEntityMeta entityMeta = getDynamicEntityMetaMap().get(ciTypeId); String guid = ci.get(GUID).toString(); Obj...
#vulnerable code private Map<String, Object> doUpdate(EntityManager entityManager, int ciTypeId, Map<String, Object> ci, boolean enableStateTransition) { DynamicEntityMeta entityMeta = getDynamicEntityMetaMap().get(ciTypeId); Map<String, Object> convertedCi = MultiValueF...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Result<Integer> save(RcRole role, List<Integer> permissionIds) { Result<Integer> result=new Result<>(); result.setStatus(false); result.setCode(MsgCode.FAILED); if (selectByRoleName(role.getName()) != null){ res...
#vulnerable code @Override public Result<Integer> save(RcRole role, List<Integer> permissionIds) { Result<Integer> result=new Result<>(); result.setStatus(false); result.setCode(MsgCode.FAILED); if (selectByRoleName(role.getName()) != null){ ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void load(String name, List<String> col) throws IOException { BufferedReader r = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(name),"US-ASCII")); try { String line; while ((line=r.readLine())!=null) ...
#vulnerable code private void load(String name, List<String> col) throws IOException { BufferedReader r = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(name),"US-ASCII")); String line; while ((line=r.readLine())!=null) col.ad...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void setPlatform(String platform) throws FileNotFoundException, IOException { if(!platformPattern.matcher(platform).matches()) throw new IllegalArgumentException("Platform must match " + platformPattern.pattern()); this.platform = platform;...
#vulnerable code public void setPlatform(String platform) throws FileNotFoundException, IOException { if(!platformPattern.matcher(platform).matches()) throw new IllegalArgumentException("Platform must match " + platformPattern.pattern()); File tempFile = new...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void addSendJob(Frame f, int sec, int usec) { StringBuilder sb = new StringBuilder(40); sb.append("< add "); sb.append(Integer.toString(sec)); sb.append(' '); sb.append(Integer.toString(usec)); sb.append(' '); sb....
#vulnerable code public void addSendJob(Frame f, int sec, int usec) { synchronized(output) { output.print("< add " + Integer.toString(sec) + " " + Integer.toString(usec) + " " + Integer.toHexString(f.getIden...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code void writeProperties(java.util.Properties p) { p.setProperty("version", "1.0"); p.setProperty("busName", bus.getName()); ProjectManager manager = ProjectManager.getGlobalProjectManager(); p.setProperty("projectName", manager.getOpenedProject()...
#vulnerable code Object readProperties(java.util.Properties p) { if (instance == null) { instance = this; } instance.readPropertiesImpl(p); return instance; } #location 3 #vulnerabi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void readDirectory() { logger.log(Level.INFO, "Opening folder {0}", logFolder.getPath()); logFileDir.clear(); platforms.clear(); if (logFolder.isFolder()) { Enumeration<? extends FileObject> children = logFolder.getChildren(...
#vulnerable code public void readDirectory() { logger.log(Level.INFO, "Opening folder {0}", logFolder.getPath()); logFileDir.clear(); platforms.clear(); if (logFolder.isFolder()) { Enumeration<? extends FileObject> children = logFolder.getChi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void unsubscribeFrom(int id) { StringBuilder sb = new StringBuilder(30); sb.append("< unsubscribe "); sb.append(Integer.toHexString(id)); sb.append(" >"); send(sb.toString()); }
#vulnerable code public void unsubscribeFrom(int id) { synchronized(output) { output.print("< unsubscribe " + Integer.toHexString(id) + " >"); output.flush(); } } #location 2 #vulnerabi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected Node[] createNodesForKey(BusDescription key) { Bus bus = null; for(Bus b : project.getBusses()) { if(b.getDescription() == key) bus = b; } return new Node[] { new BusNode(key, bus) };...
#vulnerable code @Override protected Node[] createNodesForKey(BusDescription key) { Bus bus = null; for(Bus b : project.getBusses()) { if(b.getDescription() == key) bus = b; } AbstractNode node = new AbstractNode(Children....
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void setDescription(String description) throws FileNotFoundException, IOException { if(!descriptionPattern.matcher(description).matches()) throw new IllegalArgumentException("Description must match " + descriptionPattern.pattern()); this.de...
#vulnerable code public void setDescription(String description) throws FileNotFoundException, IOException { if(!descriptionPattern.matcher(description).matches()) throw new IllegalArgumentException("Description must match " + descriptionPattern.pattern()); F...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Boolean checkConnection() { Socket socket = new Socket(); InetSocketAddress address = new InetSocketAddress(host, port); InputStreamReader input = null; try { socket.setSoTimeout(10); socket.connect(address, 50); ...
#vulnerable code public Boolean checkConnection() { Socket socket = new Socket(); InetSocketAddress address = new InetSocketAddress(host, port); try { socket.setSoTimeout(10); socket.connect(address, 50); InputStreamReader in...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void subscriptionAllChanged(boolean all, Subscription s) { /* BCM subscription switched to RAW subscription */ if (all == true) { subscriptionsBCM.remove(s); if(!subscriptionsRAW.contains(s)) subscri...
#vulnerable code @Override public void subscriptionAllChanged(boolean all, Subscription s) { /* BCM subscription switched to RAW subscription */ if (all == true) { subscriptionsBCM.remove(s); if(!subscriptionsRAW.contains(s)) s...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Boolean checkConnection() { Socket socket = new Socket(); InetSocketAddress address = new InetSocketAddress(host, port); InputStreamReader input = null; OutputStreamWriter output = null; try { socket.setSoTimeout(10);...
#vulnerable code public Boolean checkConnection() { Socket socket = new Socket(); InetSocketAddress address = new InetSocketAddress(host, port); InputStreamReader input = null; try { socket.setSoTimeout(10); socket.connect(address,...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void unsubscribed(int id, Subscription s) { if(subscriptionsBCM.contains(s)) { safeUnsubscribe(id); } else { logger.log(Level.WARNING, "Unregistered subscription tried to unsubscribe!"); } }
#vulnerable code @Override public void unsubscribed(int id, Subscription s) { if(subscriptionsBCM.contains(s)) { safeUnsubscribe(id); } } #location 4 #vulnerability type THREAD_SAFETY_VIOLATION
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void setConnection(BusURL url) { disconnect(); this.url = url; rawConnection = new RAWConnection(url); bcmConnection = new BCMConnection(url); rawConnection.setReceiver(rawReceiver); bcmConnection.setReceiver(bcmReceiv...
#vulnerable code public void setConnection(BusURL url) { disconnect(); this.url = url; rawConnection = new RAWConnection(url); bcmConnection = new BCMConnection(url); rawConnection.setReceiver(rawReceiver); bcmConnection.setRece...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void unsubscribeRange(int from, int to) { synchronized(ids) { for (int i = from; i <= to; i++) { if(ids.contains(i)) { ids.remove(i); changeReceiver.unsubscribed(i, this); } ...
#vulnerable code public void unsubscribeRange(int from, int to) { synchronized(this) { for (int i = from; i <= to; i++) { if(ids.contains(i)) { ids.remove(i); changeReceiver.unsubscribed(i, this); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void sendFrame(Frame f) { StringBuilder sb = new StringBuilder(50); sb.append("< send "); sb.append(Integer.toHexString(f.getIdentifier())); sb.append(' '); sb.append(Integer.toString(f.getLength())); sb.append(' '); ...
#vulnerable code public void sendFrame(Frame f) { StringBuilder sb = new StringBuilder(); sb.append("< send "); sb.append(Integer.toHexString(f.getIdentifier())); sb.append(' '); sb.append(Integer.toString(f.getLength())); sb.append(' '); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void subscriptionAllChanged(boolean all, Subscription s) { /* BCM subscription switched to RAW subscription */ if (all == true) { subscriptionsBCM.remove(s); if(!subscriptionsRAW.contains(s)) subscri...
#vulnerable code @Override public void subscriptionAllChanged(boolean all, Subscription s) { /* BCM subscription switched to RAW subscription */ if (all == true) { subscriptionsBCM.remove(s); if(!subscriptionsRAW.contains(s)) s...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void sendFrame(Frame frame) { /* Try to open BCM connection if not present */ if(url != null) { openBCMConnection(); if (bcmConnection != null) { bcmConnection.sendFrame(frame); } /* If no BCM...
#vulnerable code public void sendFrame(Frame frame) { /* Try to open BCM connection if not present */ if(url != null) { openBCMConnection(); if (bcmConnection != null) { bcmConnection.sendFrame(frame); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void setDescription(String description) throws FileNotFoundException, IOException { if(!descriptionPattern.matcher(description).matches()) throw new IllegalArgumentException("Description must match " + descriptionPattern.pattern()); this.de...
#vulnerable code public void setDescription(String description) throws FileNotFoundException, IOException { if(!descriptionPattern.matcher(description).matches()) throw new IllegalArgumentException("Description must match " + descriptionPattern.pattern()); F...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void setPlatform(String platform) throws FileNotFoundException, IOException { if(!platformPattern.matcher(platform).matches()) throw new IllegalArgumentException("Platform must match " + platformPattern.pattern()); this.platform = platform;...
#vulnerable code public void setPlatform(String platform) throws FileNotFoundException, IOException { if(!platformPattern.matcher(platform).matches()) throw new IllegalArgumentException("Platform must match " + platformPattern.pattern()); File tempFile = new...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code void writeProperties(java.util.Properties p) { p.setProperty("version", "1.0"); p.setProperty("busName", bus.getName()); ProjectManager manager = ProjectManager.getGlobalProjectManager(); p.setProperty("projectName", manager.getOpenedProject()...
#vulnerable code Object readProperties(java.util.Properties p) { if (instance == null) { instance = this; } instance.readPropertiesImpl(p); return instance; } #location 6 #vulnerabi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void clear() { Integer[] identifiers = null; synchronized(ids) { identifiers = ids.toArray(new Integer[ids.size()]); ids.clear(); } for (int i=0;i<identifiers.length;i++) { changeReceiver.unsubscribed...
#vulnerable code public void clear() { Integer[] identifiers = new Integer[0]; synchronized(this) { identifiers = ids.toArray(new Integer[ids.size()]); } for (int i=0;i<identifiers.length;i++) { unsubscribe(identifiers[i]); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void subscribed(int id, Subscription s) { if (subscriptionsBCM.contains(s)) { /* Check if the ID was already subscribed in any subscription */ synchronized(subscribedIDs) { if(!subscribedIDs.contains(id)) { ...
#vulnerable code @Override public void subscribed(int id, Subscription s) { if (subscriptionsBCM.contains(s)) { /* Check if the ID was already subscribed in any subscription */ if(!subscribedIDs.contains(id)) { subscribedIDs.add(id); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void disconnect() { if (rawConnection != null && rawConnection.isConnected()) { rawConnection.close(); } if (bcmConnection != null && bcmConnection.isConnected()) { bcmConnection.close(); } notifyListene...
#vulnerable code public void disconnect() { if (rawConnection != null && rawConnection.isConnected()) { rawConnection.close(); } if (bcmConnection != null && bcmConnection.isConnected()) { bcmConnection.close(); } url = n...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void print(EventFrame ef) { createOutput(); synchronized(io) { OutputWriter out = io.getOut(); Date date = new Date(); out.write("["); out.write(dateFormat.format(date)); out.write("] EV...
#vulnerable code public static void print(EventFrame ef) { synchronized(io) { createOutput(); OutputWriter out = io.getOut(); Date date = new Date(); out.write("["); out.write(dateFormat.format(date)); out....
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void subscriptionAllChanged(boolean all, Subscription s) { /* BCM subscription switched to RAW subscription */ if (all == true) { subscriptionsBCM.remove(s); if(!subscriptionsRAW.contains(s)) subscri...
#vulnerable code @Override public void subscriptionAllChanged(boolean all, Subscription s) { /* BCM subscription switched to RAW subscription */ if (all == true) { subscriptionsBCM.remove(s); if(!subscriptionsRAW.contains(s)) s...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void setPlatform(String platform) throws FileNotFoundException, IOException { if(!platformPattern.matcher(platform).matches()) throw new IllegalArgumentException("Platform must match " + platformPattern.pattern()); this.platform = platform;...
#vulnerable code public void setPlatform(String platform) throws FileNotFoundException, IOException { if(!platformPattern.matcher(platform).matches()) throw new IllegalArgumentException("Platform must match " + platformPattern.pattern()); File tempFile = new...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code void writeProperties(java.util.Properties p) { // better to version settings since initial version as advocated at // http://wiki.apidesign.org/wiki/PropertyFiles p.setProperty("version", "1.0"); }
#vulnerable code Object readProperties(java.util.Properties p) { if (instance == null) { instance = this; } instance.readPropertiesImpl(p); return instance; } #location 3 #vulnerabi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void setDescription(String description) throws FileNotFoundException, IOException { if(!descriptionPattern.matcher(description).matches()) throw new IllegalArgumentException("Description must match " + descriptionPattern.pattern()); this.de...
#vulnerable code public void setDescription(String description) throws FileNotFoundException, IOException { if(!descriptionPattern.matcher(description).matches()) throw new IllegalArgumentException("Description must match " + descriptionPattern.pattern()); F...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void waitForReady() throws MalformedURLException { LOGGER.info("Waiting for SonarQube to be available at {}", getUrl()); Awaitility .await("SonarQube is ready") .atMost(3, TimeUnit.MINUTES) .pollInterval(5, TimeUnit.SECONDS) .ignor...
#vulnerable code public void waitForReady() { while (true) { System.out.println("Waiting for SonarQube to be available at " + getUrl()); try { HttpURLConnection conn = (HttpURLConnection)getUrl("/api/settings/values.protobuf").openConnection(); conn.connect...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public int run(String[] args) throws Exception { final FileSystem fs = FileSystem.get(getConf()); Options options = new Options(); // automatically generate the help statement HelpFormatter formatter = new HelpFormatter(); // create the parser CommandLineParser par...
#vulnerable code public int run(String[] args) throws Exception { final FileSystem fs = FileSystem.get(getConf()); Options options = new Options(); // automatically generate the help statement HelpFormatter formatter = new HelpFormatter(); // create the parser CommandLinePars...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void map(IntWritable key, WeightedVectorWritable value, OutputCollector<Text, Text> output, Reporter reporter) throws IOException { Vector v = value.getVector(); if (v instanceof NamedVector) { String name = ((NamedVe...
#vulnerable code public void map(IntWritable key, WeightedVectorWritable value, OutputCollector<Text, Text> output, Reporter reporter) throws IOException { Vector v = value.getVector(); if (v instanceof NamedVector) { String name = ((N...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Response getNonOAuth(String path, Map<String, String> parameters) { InputStream in = null; try { URL url = UrlUtilities.buildUrl(getScheme(), getHost(), getPort(), path, parameters); if (Flickr.debugRequest) { ...
#vulnerable code @Override public Response getNonOAuth(String path, Map<String, String> parameters) { InputStream in = null; try { URL url = UrlUtilities.buildUrl(getScheme(), getHost(), getPort(), path, parameters); if (Flickr.debugRequest) {...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public com.flickr4java.flickr.Response get(String path, Map<String, Object> parameters, String apiKey, String sharedSecret) throws FlickrException { OAuthRequest request = new OAuthRequest(Verb.GET, getScheme() + "://" + getHost() + path); for (...
#vulnerable code @Override public com.flickr4java.flickr.Response get(String path, Map<String, Object> parameters, String apiKey, String sharedSecret) throws FlickrException { OAuthRequest request = new OAuthRequest(Verb.GET, getScheme() + "://" + getHost() + path); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Response getNonOAuth(String path, Map<String, String> parameters) { InputStream in = null; try { URL url = UrlUtilities.buildUrl(getScheme(), getHost(), getPort(), path, parameters); if (Flickr.debugRequest) { ...
#vulnerable code @Override public Response getNonOAuth(String path, Map<String, String> parameters) { InputStream in = null; try { URL url = UrlUtilities.buildUrl(getScheme(), getHost(), getPort(), path, parameters); if (Flickr.debugRequest) {...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Response getNonOAuth(String path, Map<String, String> parameters) { InputStream in = null; try { URL url = UrlUtilities.buildUrl(getScheme(), getHost(), getPort(), path, parameters); if (Flickr.debugRequest) { ...
#vulnerable code @Override public Response getNonOAuth(String path, Map<String, String> parameters) { InputStream in = null; try { URL url = UrlUtilities.buildUrl(getScheme(), getHost(), getPort(), path, parameters); if (Flickr.debugRequest) {...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void refreshIndex(Map<String, Pair<DimensionRow, DimensionRow>> changedRows) { // Make a single Document instance to hold field data being updated to Lucene // Creating documents is costly and so Document will be reused for each record bei...
#vulnerable code @Override public void refreshIndex(Map<String, Pair<DimensionRow, DimensionRow>> changedRows) { // Make a single Document instance to hold field data being updated to Lucene // Creating documents is costly and so Document will be reused for each reco...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override @JsonIgnore public Set<Aggregation> getAggregations() { return getInnerQueryUnchecked().getAggregations(); }
#vulnerable code @Override @JsonIgnore public Set<Aggregation> getAggregations() { return getInnerQuery().getAggregations(); } #location 4 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override @JsonIgnore public List<Interval> getIntervals() { return getInnerQueryUnchecked().getIntervals(); }
#vulnerable code @Override @JsonIgnore public List<Interval> getIntervals() { return getInnerQuery().getIntervals(); } #location 4 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void refreshIndex(Map<String, Pair<DimensionRow, DimensionRow>> changedRows) { // Make a single Document instance to hold field data being updated to Lucene // Creating documents is costly and so Document will be reused for each record bei...
#vulnerable code @Override public void refreshIndex(Map<String, Pair<DimensionRow, DimensionRow>> changedRows) { // Make a single Document instance to hold field data being updated to Lucene // Creating documents is costly and so Document will be reused for each reco...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public LookbackQuery withIntervals(Collection<Interval> intervals) { return withDataSource(new QueryDataSource(getInnerQueryUnchecked().withIntervals(intervals))); }
#vulnerable code @Override public LookbackQuery withIntervals(Collection<Interval> intervals) { return withDataSource(new QueryDataSource(getInnerQuery().withIntervals(intervals))); } #location 3 #vulnerability ty...
Below is the vulnerable code, please generate the patch based on the following information.