output
stringlengths
64
73.2k
input
stringlengths
208
73.3k
instruction
stringclasses
1 value
#fixed code private InstanceSet buildInstanceList(String file) throws IOException { System.out.print("生成训练数据 ..."); FNLPReader reader = new FNLPReader(file); FNLPReader preReader = new FNLPReader(file); InstanceSet instset = new InstanceSet(); LabelAlphabet la = factory.Defau...
#vulnerable code private InstanceSet buildInstanceList(String file) throws IOException { System.out.print("生成训练数据 ..."); FNLPReader reader = new FNLPReader(file); InstanceSet instset = new InstanceSet(); LabelAlphabet la = factory.DefaultLabelAlphabet(); int count = 0; whi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(String[] args) { try { String ls_1; Process process =null; // File handle = new File("../tmp/ctb_v1/data"); File handle = new File("../tmp/ctb_v6/data/bracketed"); BufferedWriter bout = new BufferedWriter(new OutputStreamWriter( ...
#vulnerable code public static void main(String[] args) { try { String ls_1; Process process =null; File handle = new File("./tmpdata/ctb/data3"); BufferedWriter bout = new BufferedWriter(new OutputStreamWriter( new FileOutputStream("./tmpdata/malt.train"), "UTF-8"));...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void train(String dataFile, int maxite, float c) throws IOException { InstanceSet instset = buildInstanceList(dataFile); SFGenerator generator = new SFGenerator(); LabelAlphabet la = factory.DefaultLabelAlphabet(); int ysize = la.size(); System.out.print...
#vulnerable code public void train(String dataFile, int maxite, float c) throws IOException { InstanceSet instset = buildInstanceList(dataFile); IFeatureAlphabet features = factory.DefaultFeatureAlphabet(); SFGenerator generator = new SFGenerator(); int fsize = features.size()...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testStartNewSpanSampleNullNotPartOfExistingSpan() { final ServerSpan mockServerSpan = mock(ServerSpan.class); when(mockServerSpan.getSpan()).thenReturn(null); when(mockState.sample()).thenReturn(null); when(mockState.getC...
#vulnerable code @Test public void testStartNewSpanSampleNullNotPartOfExistingSpan() { final ServerSpan mockServerSpan = mock(ServerSpan.class); when(mockServerSpan.getSpan()).thenReturn(null); when(mockState.sample()).thenReturn(null); when(mockStat...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void finishSpan() { Span finished = new Span().setName("foo").setTimestamp(1000L); // set in start span finished.startTick = 500000L; // set in start span state.setCurrentLocalSpan(finished); PowerMockito.when(System.nanoTime(...
#vulnerable code @Test public void finishSpan() { Span finished = new Span().setTimestamp(1000L); // set in start span finished.startTick = 500000L; // set in start span state.setCurrentLocalSpan(finished); PowerMockito.when(System.nanoTime()).thenRe...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public T call() throws Exception { serverSpanThreadBinder().setCurrentSpan(currentServerSpan()); return wrappedCallable().call(); }
#vulnerable code @Override public T call() throws Exception { serverSpanThreadBinder().setCurrentSpan(currentServerSpan()); final long start = System.currentTimeMillis(); try { return wrappedCallable().call(); } finally { final...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void recordClientSentAnnotations(Endpoint serverAddress) { if (serverAddress == null) { clientTracer.setClientSent(); } else { clientTracer.setClientSent(serverAddress); } }
#vulnerable code private void recordClientSentAnnotations(Endpoint serverAddress) { if (serverAddress == null) { clientTracer.setClientSent(); } else { clientTracer.setClientSent(serverAddress.ipv4, serverAddress.port, serverAddress.service_name);...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void finishSpan_userSuppliedTimestamp() { Span finished = new Span().setName("foo").setTimestamp(1000L); // Set by user state.setCurrentLocalSpan(finished); PowerMockito.when(System.currentTimeMillis()).thenReturn(2L); localT...
#vulnerable code @Test public void finishSpan_userSuppliedTimestamp() { Span finished = new Span().setTimestamp(1000L); // Set by user state.setCurrentLocalSpan(finished); PowerMockito.when(System.currentTimeMillis()).thenReturn(2L); localTracer.fin...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void finishSpan_userSuppliedTimestampAndDuration() { Span finished = new Span().setName("foo").setTimestamp(1000L); // Set by user state.setCurrentLocalSpan(finished); localTracer.finishSpan(500L); verify(mockReporter).report...
#vulnerable code @Test public void finishSpan_userSuppliedTimestampAndDuration() { Span finished = new Span().setTimestamp(1000L); // Set by user state.setCurrentLocalSpan(finished); localTracer.finishSpan(500L); verify(mockCollector).collect(finish...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void finishSpan_lessThanMicrosRoundUp() { Span finished = new Span().setName("foo").setTimestamp(1000L); // set in start span finished.startTick = 500L; // set in start span state.setCurrentLocalSpan(finished); PowerMockito.wh...
#vulnerable code @Test public void finishSpan_lessThanMicrosRoundUp() { Span finished = new Span().setTimestamp(1000L); // set in start span finished.startTick = 500L; // set in start span state.setCurrentLocalSpan(finished); PowerMockito.when(System...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void finishSpan_userSuppliedDuration() { Span finished = new Span().setName("foo").setTimestamp(1000L); // set in start span finished.startTick = 500L; // set in start span state.setCurrentLocalSpan(finished); localTracer.fini...
#vulnerable code @Test public void finishSpan_userSuppliedDuration() { Span finished = new Span().setTimestamp(1000L); // set in start span finished.startTick = 500L; // set in start span state.setCurrentLocalSpan(finished); localTracer.finishSpan(50...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void run() { serverSpanThreadBinder().setCurrentSpan(currentServerSpan()); wrappedRunnable().run(); }
#vulnerable code @Override public void run() { serverSpanThreadBinder().setCurrentSpan(currentServerSpan()); final long start = System.currentTimeMillis(); try { wrappedRunnable().run(); } finally { final long duration = System...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected boolean checkQuiesceLock() { final String methodName = "checkQuiesceLock"; // if (quiescing && actualInFlight == 0 && pendingFlows.size() == 0 && // inFlightPubRels == 0 && callback.isQuiesced()) { int tokC = tokenStore.count(); if (quiescing && tokC == 0 && ...
#vulnerable code protected boolean checkQuiesceLock() { final String methodName = "checkQuiesceLock"; // if (quiescing && actualInFlight == 0 && pendingFlows.size() == 0 && // inFlightPubRels == 0 && callback.isQuiesced()) { int tokC = tokenStore.count(); if (quiescing && tokC ==...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testGetStructure() { try { long now = System.currentTimeMillis(); long bytes = Long.MAX_VALUE; SimpleFormatter sf = new SimpleFormatter(); log.info(sf.getSize(bytes)); log.info(sf.getRate(now, bytes)); log.info(sf.getTime(now)); String d...
#vulnerable code @Test public void testGetStructure() { try { SimpleFormatter sf = new SimpleFormatter(); String delimiter = "/"; String bucket = "maven.kuali.org"; AmazonS3Client client = getClient(); KualiMavenBucketBaseCase baseCase1 = new KualiMavenBucketBaseCase(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void transitionInto(RunState state) { switch (state.state()) { case SUBMITTING: try { final String executionId = dockerRunnerStart(state); // this is racy final Event submitted = Event.submitted(state.workflowIn...
#vulnerable code @Override public void transitionInto(RunState state) { switch (state.state()) { case SUBMITTING: try { final String executionId = dockerRunnerStart(state); // this is racy final Event submitted = Event.submitted(state.work...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Map<WorkflowInstance, RunState> activeStates() { return states.entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, (entry) -> entry.getValue().runState)); }
#vulnerable code @Override public Map<WorkflowInstance, RunState> activeStates() { final ImmutableMap.Builder<WorkflowInstance, RunState> builder = ImmutableMap.builder(); states.entrySet().forEach(entry -> builder.put(entry.getKey(), entry.getValue().runState)); return buil...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code BigtableStorage(Connection connection, Duration retryBaseDelay) { this.connection = Objects.requireNonNull(connection); this.retryBaseDelay = Objects.requireNonNull(retryBaseDelay); }
#vulnerable code Map<WorkflowInstance, Long> readActiveWorkflowInstances() throws IOException { final Table activeStatesTable = connection.getTable(ACTIVE_STATES_TABLE_NAME); final ImmutableMap.Builder<WorkflowInstance, Long> map = ImmutableMap.builder(); for (Result result :...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private static KubernetesClient getKubernetesClient(Config config, String id) { try { final HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport(); final JsonFactory jsonFactory = Utils.getDefaultJsonFactory(); final GoogleCredential cr...
#vulnerable code private static KubernetesClient getKubernetesClient(Config config, String id) { try { final HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport(); final JsonFactory jsonFactory = Utils.getDefaultJsonFactory(); final GoogleCredent...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code DatastoreStorage(Datastore datastore, Duration retryBaseDelay) { this.datastore = Objects.requireNonNull(datastore); this.retryBaseDelay = Objects.requireNonNull(retryBaseDelay); this.componentKeyFactory = datastore.newKeyFactory().kind(KIND_COMPONENT); this.gl...
#vulnerable code List<Backfill> getBackfills() { final EntityQuery query = Query.entityQueryBuilder().kind(KIND_BACKFILL).build(); final QueryResults<Entity> results = datastore.run(query); final ImmutableList.Builder<Backfill> resources = ImmutableList.builder(); while (r...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void transitionInto(RunState state) { switch (state.state()) { case SUBMITTING: // Perform rate limited submission on a separate thread pool to avoid blocking the caller. executor.submit(() -> { rateLimiter.acquire(); ...
#vulnerable code @Override public void transitionInto(RunState state) { switch (state.state()) { case SUBMITTING: try { final String executionId = dockerRunnerStart(state); // this is racy final Event submitted = Event.submitted(state.work...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code DatastoreStorage(Datastore datastore, Duration retryBaseDelay) { this.datastore = Objects.requireNonNull(datastore); this.retryBaseDelay = Objects.requireNonNull(retryBaseDelay); this.componentKeyFactory = datastore.newKeyFactory().kind(KIND_COMPONENT); this.gl...
#vulnerable code Map<WorkflowInstance, Long> allActiveStates() throws IOException { final EntityQuery activeStatesQuery = Query.entityQueryBuilder() .kind(KIND_ACTIVE_STATE) .build(); final ImmutableMap.Builder<WorkflowInstance, Long> mapBuilder = ImmutableMap.bui...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected void doRequest(ServletTransaction transaction) throws ServletException { try { HttpServletRequest request = transaction.getServletRequest(); Client client = ClientCatalog .getClient(request.getParameter("use")); String report = request.get...
#vulnerable code @Override protected void doRequest(ServletTransaction transaction) throws ServletException { try { HttpServletRequest request = transaction.getServletRequest(); Client client = ClientCatalog .getClient(request.getParameter("use")); String report = reque...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void deleteUrl(String sUrl) throws SearchLibException { try { targetClient.deleteDocument(sUrl); urlDbClient.deleteDocument(sUrl); } catch (CorruptIndexException e) { throw new SearchLibException(e); } catch (LockObtainFailedException e) { throw new Sear...
#vulnerable code public void deleteUrl(String sUrl) throws SearchLibException { try { client.deleteDocument(sUrl); } catch (CorruptIndexException e) { throw new SearchLibException(e); } catch (LockObtainFailedException e) { throw new SearchLibException(e); } catch (IOExcep...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected void reloadPage() { synchronized (this) { fieldLeft = null; selectedFacet = null; super.reloadPage(); } }
#vulnerable code @Override protected void reloadPage() { fieldLeft = null; selectedFacet = null; super.reloadPage(); } #location 3 #vulnerability type THREAD_SAFETY_VIOLATION
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal(in); fragmenter = External.readObject(in); tag = External.readUTF(in); maxDocChar = in.readInt(); separator = External.readUTF(in); maxSnippetSize = in.readInt...
#vulnerable code public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal(in); fragmenter = External.readObject(in); tag = External.readUTF(in); maxDocChar = in.readInt(); separator = External.readUTF(in); maxSnippetSize = in.r...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void onUpload() throws InterruptedException, XPathExpressionException, NoSuchAlgorithmException, ParserConfigurationException, SAXException, IOException, URISyntaxException, SearchLibException, InstantiationException, IllegalAccessException, ClassNotFoundExcep...
#vulnerable code public void onUpload() throws InterruptedException, XPathExpressionException, NoSuchAlgorithmException, ParserConfigurationException, SAXException, IOException, URISyntaxException, SearchLibException, InstantiationException, IllegalAccessException, ClassNotFoun...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected void reloadPage() { synchronized (this) { fieldLeft = null; selectedFacet = null; super.reloadPage(); } }
#vulnerable code @Override protected void reloadPage() { fieldLeft = null; selectedFacet = null; super.reloadPage(); } #location 4 #vulnerability type THREAD_SAFETY_VIOLATION
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected void doRequest(ServletTransaction transaction) throws ServletException { try { Client client = Client.getWebAppInstance(); HttpServletRequest request = transaction.getServletRequest(); String indexName = request.getParameter("index"); String...
#vulnerable code @Override protected void doRequest(ServletTransaction transaction) throws ServletException { try { Client client = Client.getWebAppInstance(); HttpServletRequest request = transaction.getServletRequest(); String indexName = request.getParameter("index"); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void reload(boolean optimize) throws IOException, URISyntaxException, SearchLibException, InstantiationException, IllegalAccessException, ClassNotFoundException { if (optimize) { urlDbClient.reload(null); urlDbClient.getIndex().optimize(null); targetClien...
#vulnerable code public void reload(boolean optimize) throws IOException, URISyntaxException, SearchLibException, InstantiationException, IllegalAccessException, ClassNotFoundException { if (optimize) { client.reload(null); client.getIndex().optimize(null); } client.reloa...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void deleteUrls(Collection<String> workDeleteUrlList) throws SearchLibException { try { targetClient.deleteDocuments(workDeleteUrlList); urlDbClient.deleteDocuments(workDeleteUrlList); } catch (CorruptIndexException e) { throw new SearchLibException(e); ...
#vulnerable code public void deleteUrls(Collection<String> workDeleteUrlList) throws SearchLibException { try { client.deleteDocuments(workDeleteUrlList); } catch (CorruptIndexException e) { throw new SearchLibException(e); } catch (LockObtainFailedException e) { throw ne...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void writeXmlConfig(XmlWriter xmlWriter) throws SAXException, SearchLibException, SecurityException, IOException { xmlWriter.startElement("system"); xmlWriter.startElement("availableProcessors", "value", Integer .toString(getAvailableProcessors())); xmlWrite...
#vulnerable code public void writeXmlConfig(XmlWriter xmlWriter) throws SAXException, SearchLibException { xmlWriter.startElement("system"); xmlWriter.startElement("availableProcessors", "value", Integer .toString(getAvailableProcessors())); xmlWriter.endElement(); xmlWrit...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void onAdd() throws SearchLibException, UnsupportedEncodingException, ParseException, InterruptedException { synchronized (this) { if (getSelectedFile() != null) { // Already In if (getClient().getFilePathManager().getFilePaths( getSelectedFile().get...
#vulnerable code public void onAdd() throws SearchLibException, UnsupportedEncodingException, ParseException, InterruptedException { synchronized (this) { if (getSelectedFile() != null) { // Already In if (getClient().getFilePathManager().getStrictPaths( getSelectedFi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void getNewUrlToFetch(NamedItem host, long limit, List<UrlItem> urlList) throws SearchLibException, ParseException, IOException, SyntaxError, URISyntaxException, ClassNotFoundException, InterruptedException, InstantiationException, IllegalAccessException { S...
#vulnerable code public void getNewUrlToFetch(NamedItem host, long limit, List<UrlItem> urlList) throws SearchLibException, ParseException, IOException, SyntaxError, URISyntaxException, ClassNotFoundException, InterruptedException, InstantiationException, IllegalAccessException...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void updateUrlItems(List<UrlItem> urlItems) throws SearchLibException { try { List<IndexDocument> documents = new ArrayList<IndexDocument>( urlItems.size()); for (UrlItem urlItem : urlItems) { IndexDocument indexDocument = new IndexDocument(); urlI...
#vulnerable code public void updateUrlItems(List<UrlItem> urlItems) throws SearchLibException { try { List<IndexDocument> documents = new ArrayList<IndexDocument>( urlItems.size()); for (UrlItem urlItem : urlItems) { IndexDocument indexDocument = new IndexDocument(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void getStartingWith(String queryString, Field field, String start, int limit, List<NamedItem> list) throws ParseException, IOException, SyntaxError, URISyntaxException, ClassNotFoundException, InterruptedException, SearchLibException, InstantiationException, ...
#vulnerable code public void getStartingWith(String queryString, Field field, String start, int limit, List<NamedItem> list) throws ParseException, IOException, SyntaxError, URISyntaxException, ClassNotFoundException, InterruptedException, SearchLibException, InstantiationExcep...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public long getUrls(SearchRequest searchRequest, Field orderBy, boolean orderAsc, long start, long rows, List<UrlItem> list) throws SearchLibException { searchRequest.setStart((int) start); searchRequest.setRows((int) rows); try { if (orderBy != null) searchRe...
#vulnerable code public long getUrls(SearchRequest searchRequest, Field orderBy, boolean orderAsc, long start, long rows, List<UrlItem> list) throws SearchLibException { searchRequest.setStart((int) start); searchRequest.setRows((int) rows); try { if (orderBy != null) se...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void renderDocument(int pos) throws CorruptIndexException, IOException, ParseException, SyntaxError { writer.print("\t<doc score=\""); writer.print(result.getScore(pos)); writer.print("\" pos=\""); writer.print(pos); writer.println("\">"); ResultDocument d...
#vulnerable code private void renderDocument(int pos) throws CorruptIndexException, IOException, ParseException, SyntaxError { writer.print("\t<doc score=\""); writer.print(result.getDocs()[pos].score); writer.print("\" pos=\""); writer.print(pos); writer.println("\">"); Res...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected void reloadPage() { synchronized (this) { highlightFieldLeft = null; selectedHighlight = null; super.reloadPage(); } }
#vulnerable code @Override protected void reloadPage() { highlightFieldLeft = null; selectedHighlight = null; super.reloadPage(); } #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 getOldUrlToFetch(NamedItem host, Date fetchIntervalDate, long limit, List<UrlItem> urlList) throws SearchLibException, ParseException, IOException, SyntaxError, URISyntaxException, ClassNotFoundException, InterruptedException, InstantiationException, Ille...
#vulnerable code public void getOldUrlToFetch(NamedItem host, Date fetchIntervalDate, long limit, List<UrlItem> urlList) throws SearchLibException, ParseException, IOException, SyntaxError, URISyntaxException, ClassNotFoundException, InterruptedException, InstantiationException...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected void reloadPage() { synchronized (this) { selectedSort = null; sortFieldLeft = null; super.reloadPage(); } }
#vulnerable code @Override protected void reloadPage() { selectedSort = null; sortFieldLeft = null; super.reloadPage(); } #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 reload(boolean optimize) throws IOException, URISyntaxException, SearchLibException, InstantiationException, IllegalAccessException, ClassNotFoundException { if (optimize) { urlDbClient.reload(null); urlDbClient.getIndex().optimize(null); targetClien...
#vulnerable code public void reload(boolean optimize) throws IOException, URISyntaxException, SearchLibException, InstantiationException, IllegalAccessException, ClassNotFoundException { if (optimize) { client.reload(null); client.getIndex().optimize(null); } client.reloa...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void run(ResultScoreDoc[] fetchedDocs, int fetchLength) throws IOException { collapsedDoc = null; if (fetchedDocs == null) return; if (fetchLength > fetchedDocs.length) fetchLength = fetchedDocs.length; collapse(fetchedDocs, fetchLength); }
#vulnerable code public void run(ResultScoreDoc[] fetchedDocs, int fetchLength) throws IOException { collapsedDoc = null; if (fetchedDocs == null) return; if (fetchLength > fetchedDocs.length) fetchLength = fetchedDocs.length; OpenBitSet collapsedSet = new OpenBitSet(f...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code final protected void getFragments(String originalText, FragmentList fragments, int vectorOffset) { originalTextLength = originalText.length(); if (splitPos == null) splitPos = new TreeSet<Integer>(); splitPos.clear(); check(originalText); Iterator<Integer> splitI...
#vulnerable code final protected void getFragments(String originalText, FragmentList fragments, int vectorOffset) { originalTextLength = originalText.length(); if (splitPos == null) splitPos = new TreeSet<Integer>(); splitPos.clear(); check(originalText); Iterator<Integer> ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static HTMLDocument fetch(final URL url) throws IOException { final URLConnection conn = url.openConnection(); final String ct = conn.getContentType(); Charset cs = Charset.forName("Cp1252"); if (ct != null) { Matcher m = PAT_CHARSET.matcher(ct); if(m.find(...
#vulnerable code public static HTMLDocument fetch(final URL url) throws IOException { final URLConnection conn = url.openConnection(); final String charset = conn.getContentEncoding(); Charset cs = Charset.forName("Cp1252"); if (charset != null) { try { cs = Charset.forName...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public String getText(final URL url) throws BoilerpipeProcessingException { try { return getText(HTMLFetcher.fetch(url).toInputSource()); } catch (IOException e) { throw new BoilerpipeProcessingException(e); } }
#vulnerable code public String getText(final URL url) throws BoilerpipeProcessingException { try { final URLConnection conn = url.openConnection(); final String encoding = conn.getContentEncoding(); Charset cs = Charset.forName("Cp1252"); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static HTMLDocument fetch(final URL url) throws IOException { final URLConnection conn = url.openConnection(); final String ct = conn.getContentType(); Charset cs = Charset.forName("Cp1252"); if (ct != null) { Matcher m = PAT_CHARSET.matcher(ct); if(m.find(...
#vulnerable code public static HTMLDocument fetch(final URL url) throws IOException { final URLConnection conn = url.openConnection(); final String charset = conn.getContentEncoding(); Charset cs = Charset.forName("Cp1252"); if (charset != null) { try { cs = Charset.forName...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void insertLoginLog(String username) { UmsAdmin admin = getAdminByUsername(username); if(admin==null) return; UmsAdminLoginLog loginLog = new UmsAdminLoginLog(); loginLog.setAdminId(admin.getId()); loginLog.setCreateTime(new Dat...
#vulnerable code private void insertLoginLog(String username) { UmsAdmin admin = getAdminByUsername(username); UmsAdminLoginLog loginLog = new UmsAdminLoginLog(); loginLog.setAdminId(admin.getId()); loginLog.setCreateTime(new Date()); ServletReque...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public String getUserNameFromToken(String token) { String username; try { Claims claims = getClaimsFromToken(token); username = claims.getSubject(); } catch (Exception e) { username = null; } return ...
#vulnerable code public String getUserNameFromToken(String token) { String username; try { Claims claims = getClaimsFromToken(token); username = claims.getSubject(); } catch (Exception e) { e.printStackTrace(); user...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private Date getExpiredDateFromToken(String token) { Claims claims = getClaimsFromToken(token); return claims.getExpiration(); }
#vulnerable code private Date getExpiredDateFromToken(String token) { Date expiredDate = null; try { Claims claims = getClaimsFromToken(token); expiredDate = claims.getExpiration(); } catch (Exception e) { e.printStackTrace(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void onHttpFinish(QQHttpResponse response) { try { LOG.debug(response.getContentType()); String type = response.getContentType(); if(type!=null && (type.startsWith("application/x-javascript") || type.startsWith("application/json") || type.i...
#vulnerable code @Override public void onHttpFinish(QQHttpResponse response) { try { LOG.debug(response.getContentType()); String type = response.getContentType(); if((type.startsWith("application/x-javascript") || type.startsWith("application/json") || type.indexOf("...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void progressCallbackSend() throws Exception { final AtomicReference<String> body = new AtomicReference<String>(); handler = new RequestHandler() { @Override public void handle(Request request, HttpServletResponse response) { body.set...
#vulnerable code @Test public void progressCallbackSend() throws Exception { final AtomicReference<String> body = new AtomicReference<String>(); handler = new RequestHandler() { @Override public void handle(Request request, HttpServletResponse response) { bo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void progressCallbackSendInputStream() throws Exception { final AtomicReference<String> body = new AtomicReference<String>(); handler = new RequestHandler() { @Override public void handle(Request request, HttpServletResponse response) { ...
#vulnerable code @Test public void progressCallbackSendInputStream() throws Exception { final AtomicReference<String> body = new AtomicReference<String>(); handler = new RequestHandler() { @Override public void handle(Request request, HttpServletResponse response) {...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @org.junit.Test public void test() throws InterruptedException, IOException { Node node = new StandbyNode(); node.join(); new BufferedReader(new InputStreamReader(System.in)).readLine(); }
#vulnerable code @org.junit.Test public void test() throws InterruptedException, IOException { Node node = new StandbyNode(new Configuration("com.zuoxiaolong.niubi.job.jobs"), "localhost:2181,localhost:3181,localhost:4181"); node.join(); new BufferedReader(ne...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @org.junit.Test public void test() throws InterruptedException, IOException { Node node = new StandbyNode("localhost:2181,localhost:3181,localhost:4181", "http://localhost:8080/job", StringHelper.emptyArray()); node.join(); new BufferedReader(new I...
#vulnerable code @org.junit.Test public void test() throws InterruptedException, IOException { Node node = new StandbyNode("localhost:2181,localhost:3181,localhost:4181", "http://localhost:8080/job"); node.join(); new BufferedReader(new InputStreamReader(Syst...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @org.junit.Test public void test() throws InterruptedException, IOException { Node node = new MasterSlaveNode(); node.join(); new BufferedReader(new InputStreamReader(System.in)).readLine(); }
#vulnerable code @org.junit.Test public void test() throws InterruptedException, IOException { Node node = new MasterSlaveNode(new Configuration("com.zuoxiaolong.niubi.job.jobs"), "localhost:2181,localhost:3181,localhost:4181"); node.join(); new BufferedReade...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @org.junit.Test public void test() throws InterruptedException, IOException { Node node = new StandbyNode(); node.join(); new BufferedReader(new InputStreamReader(System.in)).readLine(); }
#vulnerable code @org.junit.Test public void test() throws InterruptedException, IOException { Node node = new StandbyNode(new Configuration("com.zuoxiaolong.niubi.job.jobs"), "localhost:2181,localhost:3181,localhost:4181"); node.join(); new BufferedReader(ne...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public List<MasterSlaveNodeData> getAllNodes() { List<ChildData> childDataList = getChildren(PathHelper.getParentPath(getMasterSlavePathApi().getNodePath())); if (ListHelper.isEmpty(childDataList)) { return null; } Lis...
#vulnerable code @Override public List<MasterSlaveNodeData> getAllNodes() { List<ChildData> childDataList = getChildren(PathHelper.getParentPath(getMasterSlavePathApi().getNodePath())); List<MasterSlaveNodeData> masterSlaveNodeDataList = childDataList.stream().map(Ma...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @org.junit.Test public void test() throws InterruptedException, IOException { Node node = new StandbyNode("localhost:2181,localhost:3181,localhost:4181", "http://localhost:8080/job", StringHelper.emptyArray()); node.join(); new BufferedReader(new I...
#vulnerable code @org.junit.Test public void test() throws InterruptedException, IOException { Node node = new StandbyNode("localhost:2181,localhost:3181,localhost:4181", "http://localhost:8080/job"); node.join(); new BufferedReader(new InputStreamReader(Syst...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public List<StandbyNodeData> getAllNodes() { List<ChildData> childDataList = getChildren(PathHelper.getParentPath(getStandbyPathApi().getNodePath())); if (ListHelper.isEmpty(childDataList)) { return null; } List<Standb...
#vulnerable code @Override public List<StandbyNodeData> getAllNodes() { List<ChildData> childDataList = getChildren(PathHelper.getParentPath(getStandbyPathApi().getNodePath())); List<StandbyNodeData> standbyNodeDataList = childDataList.stream().map(StandbyNodeData::n...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @org.junit.Test public void test() throws InterruptedException, IOException { Node node = new MasterSlaveNode(); node.join(); new BufferedReader(new InputStreamReader(System.in)).readLine(); }
#vulnerable code @org.junit.Test public void test() throws InterruptedException, IOException { Node node = new MasterSlaveNode(new Configuration("com.zuoxiaolong.niubi.job.jobs"), "localhost:2181,localhost:3181,localhost:4181"); node.join(); new BufferedReade...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public List<Pair<String, String>> getColumns(String schema, String table) throws VerdictDBDbmsException { List<Pair<String, String>> columns = new ArrayList<>(); DbmsQueryResult queryResult = execute(syntax.getColumnsCommand(schema, table)); while (query...
#vulnerable code @Override public List<Pair<String, String>> getColumns(String schema, String table) throws VerdictDBDbmsException { List<Pair<String, String>> columns = new ArrayList<>(); DbmsQueryResult queryResult = execute(syntax.getColumnsCommand(schema, table)); JdbcRe...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public List<String> getSchemas() throws SQLException { if (!schemaCache.isEmpty()){ return schemaCache; } schemaCache.addAll(connection.getSchemas()); return schemaCache; }
#vulnerable code public List<String> getSchemas() throws SQLException { if (!schemaCache.isEmpty()){ return schemaCache; } DbmsQueryResult queryResult = connection.executeQuery(syntax.getSchemaCommand()); JdbcResultSet jdbcQueryResult = new JdbcResultSet(queryResult)...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public ExactRelation rewriteWithSubsampledErrorBounds() { ExactRelation r = rewriteWithPartition(true); // construct a new list of select elements. the last element is __vpart, which should be omitted. // newElems and newAggs hold almost the same info; just r...
#vulnerable code @Override public ExactRelation rewriteWithSubsampledErrorBounds() { ExactRelation newSource = source.rewriteWithSubsampledErrorBounds(); List<SelectElem> sourceElems = null; // newSource.getSelectList(); Set<String> colAliases = new HashSet<String>(); for (SelectE...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public String visitQuery_specification(VerdictSQLParser.Query_specificationContext ctx) { StringBuilder sql = new StringBuilder(2000); // this statement computes the mean value AnalyticSelectStatementRewriter meanRewriter = new AnalyticSelectStatementRewriter...
#vulnerable code @Override public String visitQuery_specification(VerdictSQLParser.Query_specificationContext ctx) { List<Pair<String, String>> subqueryColName2Aliases = null; BootstrapSelectStatementRewriter singleRewriter = null; StringBuilder unionedFrom = new StringBuilder(20...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public List<String> getPartitionColumns(String schema, String table) throws SQLException { if (!syntax.doesSupportTablePartitioning()) { throw new SQLException("Database does not support table partitioning"); } if (!partitionCache.isEmpty()){ return part...
#vulnerable code public List<String> getPartitionColumns(String schema, String table) throws SQLException { if (!syntax.doesSupportTablePartitioning()) { throw new SQLException("Database does not support table partitioning"); } if (!partitionCache.isEmpty()){ retur...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public ExactRelation rewriteWithSubsampledErrorBounds() { ExactRelation r = rewriteWithPartition(); // List<SelectElem> selectElems = r.selectElemsWithAggregateSource(); List<SelectElem> selectElems = ((AggregatedRelation) r).getAggList(); // another wrapper...
#vulnerable code @Override public ExactRelation rewriteWithSubsampledErrorBounds() { ExactRelation r = rewriteWithPartition(); // List<SelectElem> selectElems = r.selectElemsWithAggregateSource(); List<SelectElem> selectElems = ((AggregatedRelation) r).getAggList(); // another w...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public List<Pair<String, Integer>> getColumns(String schema, String table) throws SQLException { if (!columnsCache.isEmpty()){ return columnsCache; } columnsCache.addAll(connection.getColumns(schema, table)); return columnsCache; }
#vulnerable code public List<Pair<String, Integer>> getColumns(String schema, String table) throws SQLException { if (!columnsCache.isEmpty()){ return columnsCache; } DbmsQueryResult queryResult = connection.executeQuery(syntax.getColumnsCommand(schema, table)); Jdbc...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code void addParent(QueryExecutionNode parent) { parents.add(parent); }
#vulnerable code void print(int indentSpace) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < indentSpace; i++) { builder.append(" "); } builder.append(this.toString()); System.out.println(builder.toString()); for (QueryExecutionNode de...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public List<String> getTables(String schema) throws SQLException { if (!tablesCache.isEmpty()){ return tablesCache; } tablesCache.addAll(connection.getTables(schema)); return tablesCache; }
#vulnerable code public List<String> getTables(String schema) throws SQLException { if (!tablesCache.isEmpty()){ return tablesCache; } DbmsQueryResult queryResult = connection.executeQuery(syntax.getTableCommand(schema)); JdbcResultSet jdbcQueryResult = new JdbcResul...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testConvertFlatToProgressiveAgg() throws VerdictDBValueException { SelectQuery aggQuery = SelectQuery.create( new AliasedColumn(ColumnOp.count(), "agg"), new BaseTable(newSchema, newTable, "t")); AggExecutionNode aggnode = AggExecutio...
#vulnerable code @Test public void testConvertFlatToProgressiveAgg() throws VerdictDBValueException { SelectQuery aggQuery = SelectQuery.create( ColumnOp.count(), new BaseTable("myschema", "mytable", "t")); AggExecutionNode aggnode = AggExecutionNode.create(aggQu...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public ExactRelation rewriteWithSubsampledErrorBounds() { // if this is not an approximate relation effectively, we don't need any special rewriting. if (!doesIncludeSample()) { return getOriginalRelation(); } ...
#vulnerable code @Override public ExactRelation rewriteWithSubsampledErrorBounds() { // if this is not an approximate relation effectively, we don't need any special rewriting. if (!doesIncludeSample()) { return getOriginalRelation(); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public List<String> getTables(String schema) throws VerdictDBDbmsException { List<String> tables = new ArrayList<>(); DbmsQueryResult queryResult = execute(syntax.getTableCommand(schema)); while (queryResult.next()) { tables.add((String) queryResul...
#vulnerable code @Override public List<String> getTables(String schema) throws VerdictDBDbmsException { List<String> tables = new ArrayList<>(); DbmsQueryResult queryResult = execute(syntax.getTableCommand(schema)); JdbcResultSet jdbcResultSet = new JdbcResultSet(queryResult...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public List<Pair<String, Integer>> getColumns(String schema, String table) throws SQLException { if (!columnsCache.isEmpty()){ return columnsCache; } columnsCache.addAll(connection.getColumns(schema, table)); return columnsCache; }
#vulnerable code public List<Pair<String, Integer>> getColumns(String schema, String table) throws SQLException { if (!columnsCache.isEmpty()){ return columnsCache; } DbmsQueryResult queryResult = connection.executeQuery(syntax.getColumnsCommand(schema, table)); Jdbc...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testExecuteNode() throws VerdictDBException { BaseTable base = new BaseTable(originalSchema, originalTable, "t"); SelectQuery query = SelectQuery.create(Arrays.<SelectItem>asList(new AsteriskColumn()), base); QueryExecutionNode root = CreateTable...
#vulnerable code @Test public void testExecuteNode() throws VerdictDBException { BaseTable base = new BaseTable(originalSchema, originalTable, "t"); SelectQuery query = SelectQuery.create(Arrays.<SelectItem>asList(new AsteriskColumn()), base); QueryExecutionNode root = Creat...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public List<String> getTables(String schema) throws SQLException { if (!tablesCache.isEmpty()){ return tablesCache; } tablesCache.addAll(connection.getTables(schema)); return tablesCache; }
#vulnerable code public List<String> getTables(String schema) throws SQLException { if (!tablesCache.isEmpty()){ return tablesCache; } DbmsQueryResult queryResult = connection.executeQuery(syntax.getTableCommand(schema)); JdbcResultSet jdbcQueryResult = new JdbcResul...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected Map<TableUniqueName, String> tableSubstitution() { return source.tableSubstitution(); }
#vulnerable code @Override protected Map<TableUniqueName, String> tableSubstitution() { return ImmutableMap.of(); } #location 2 #vulnerability type CHECKERS_IMMUTABLE_CAST
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public List<String> getSchemas() throws VerdictDBDbmsException { List<String> schemas = new ArrayList<>(); DbmsQueryResult queryResult = execute(syntax.getSchemaCommand()); while (queryResult.next()) { schemas.add((String) queryResult.getValue(synt...
#vulnerable code @Override public List<String> getSchemas() throws VerdictDBDbmsException { List<String> schemas = new ArrayList<>(); DbmsQueryResult queryResult = execute(syntax.getSchemaCommand()); JdbcResultSet jdbcResultSet = new JdbcResultSet(queryResult); try { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public List<String> getPartitionColumns(String schema, String table) throws SQLException { if (!syntax.doesSupportTablePartitioning()) { throw new SQLException("Database does not support table partitioning"); } if (!partitionCache.isEmpty()){ return part...
#vulnerable code public List<String> getPartitionColumns(String schema, String table) throws SQLException { if (!syntax.doesSupportTablePartitioning()) { throw new SQLException("Database does not support table partitioning"); } if (!partitionCache.isEmpty()){ retur...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public List<String> getSchemas() throws SQLException { if (!schemaCache.isEmpty()){ return schemaCache; } schemaCache.addAll(connection.getSchemas()); return schemaCache; }
#vulnerable code public List<String> getSchemas() throws SQLException { if (!schemaCache.isEmpty()){ return schemaCache; } DbmsQueryResult queryResult = connection.executeQuery(syntax.getSchemaCommand()); JdbcResultSet jdbcQueryResult = new JdbcResultSet(queryResult)...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSingleAggCombiningWithH2() throws VerdictDBDbmsException, VerdictDBException { QueryExecutionPlan plan = new QueryExecutionPlan("newschema"); BaseTable base = new BaseTable(originalSchema, originalTable, "t"); SelectQuery leftQuery = Sel...
#vulnerable code @Test public void testSingleAggCombiningWithH2() throws VerdictDBDbmsException, VerdictDBException { QueryExecutionPlan plan = new QueryExecutionPlan("newschema"); BaseTable base = new BaseTable(originalSchema, originalTable, "t"); SelectQuery leftQuery...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public String visitSelect_list_elem(VerdictSQLParser.Select_list_elemContext ctx) { select_list_elem_num++; String newSelectListElem = null; Pair<String, Alias> colName2Alias = null; if (ctx.getText().equals("*")) { // TODO: replace * with all columns in...
#vulnerable code @Override public String visitSelect_list_elem(VerdictSQLParser.Select_list_elemContext ctx) { select_list_elem_num++; String newSelectListElem = null; Pair<String, Alias> colName2Alias = null; if (ctx.getText().equals("*")) { // TODO: replace * with all colu...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(String[] a) throws Exception { PropertyConfigurator.configure(FoxCfg.LOG_FILE); String in = "University of Leipzig in Leipzig.."; String query = "select * from search.termextract where context="; URIBuilder builder = ...
#vulnerable code public static void main(String[] a) throws Exception { PropertyConfigurator.configure(FoxCfg.LOG_FILE); String in = "University of Leipzig in Leipzig.."; String query = "select * from search.termextract where context="; URIBuilder buil...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Swagger read(Set<Class<?>> classes) throws GenerateException { //relate all methods to one base request mapping if multiple controllers exist for that mapping //get all methods from each controller & find their request mapping //cr...
#vulnerable code @Override public Swagger read(Set<Class<?>> classes) throws GenerateException { //relate all methods to one base request mapping if multiple controllers exist for that mapping //get all methods from each controller & find their request mapping ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected List<Parameter> getParameters(Type type, List<Annotation> annotations) { Iterator<SwaggerExtension> chain = SwaggerExtensions.chain(); List<Parameter> parameters = new ArrayList<Parameter>(); LOG.info("Looking for path/query/header/form/cook...
#vulnerable code protected List<Parameter> getParameters(Type type, List<Annotation> annotations) { // look for path, query Iterator<SwaggerExtension> chain = SwaggerExtensions.chain(); List<Parameter> parameters = null; LOG.info("getParameters for " + t...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void toDocuments() throws GenerateException { if (outputTemplate == null) { prepareMustacheTemplate(); } if (outputTemplate.getApiDocuments().isEmpty()) { LOG.warn("nothing to write."); return; } ...
#vulnerable code public void toDocuments() throws GenerateException { if (outputTemplate == null) { prepareMustacheTemplate(); } if (outputTemplate.getApiDocuments().isEmpty()) { LOG.warn("nothing to write."); return; }...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Swagger read(SpringResource resource) { if (swagger == null) { swagger = new Swagger(); } String description; List<Method> methods = resource.getMethods(); Map<String, Tag> tags = new HashMap<String, Tag>(); ...
#vulnerable code public Swagger read(SpringResource resource) { if (swagger == null) { swagger = new Swagger(); } List<Method> methods = resource.getMethods(); Map<String, Tag> tags = new HashMap<String, Tag>(); List<SecurityRequireme...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private Map<String, List<Method>> collectApisByRequestMapping(List<Method> methods) { Map<String, List<Method>> apiMethodMap = new HashMap<String, List<Method>>(); for (Method method : methods) { if (method.isAnnotationPresent(RequestMapping.class)...
#vulnerable code private Map<String, List<Method>> collectApisByRequestMapping(List<Method> methods) { Map<String, List<Method>> apiMethodMap = new HashMap<String, List<Method>>(); for (Method method : methods) { if (method.isAnnotationPresent(RequestMapping....
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Operation parseMethod(String httpMethod, Method method) { int responseCode = 200; Operation operation = new Operation(); ApiOperation apiOperation = AnnotationUtils.findAnnotation(method, ApiOperation.class); String operationId = getOpe...
#vulnerable code public Operation parseMethod(String httpMethod, Method method) { int responseCode = 200; Operation operation = new Operation(); ApiOperation apiOperation = AnnotationUtils.findAnnotation(method, ApiOperation.class); String operationId = ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private Operation parseMethod(Method method) { Operation operation = new Operation(); RequestMapping requestMapping = AnnotationUtils.findAnnotation(method, RequestMapping.class); Class<?> responseClass = null; List<String> produces = new Arra...
#vulnerable code private Operation parseMethod(Method method) { Operation operation = new Operation(); RequestMapping requestMapping = Annotations.get(method, RequestMapping.class); Class<?> responseClass = null; List<String> produces = new ArrayList<Str...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testGeneratedDoc() throws Exception { mojo.execute(); FileInputStream swaggerJson = null; BufferedReader swaggerReader = null; try { File actual = docOutput; File expected = new File(this.getClass...
#vulnerable code @Test public void testGeneratedDoc() throws Exception { mojo.execute(); BufferedReader actualReader = null; BufferedReader expectReader = null; FileInputStream swaggerJson = null; BufferedReader swaggerReader = null; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void toDocuments() throws GenerateException { if (outputTemplate == null) { prepareMustacheTemplate(); } if (outputTemplate.getApiDocuments().isEmpty()) { LOG.warn("nothing to write."); return; } ...
#vulnerable code public void toDocuments() throws GenerateException { if (outputTemplate == null) { prepareMustacheTemplate(); } if (outputTemplate.getApiDocuments().isEmpty()) { LOG.warn("nothing to write."); return; }...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private boolean stopUsingMysqldadmin() { boolean retValue = false; Reader stdOut = null; Reader stdErr = null; LogFileProcessor processor = null; Set<String> successPatterns = Sets.newHashSet( "'Can't connect to MySQL s...
#vulnerable code private boolean stopUsingMysqldadmin() { boolean retValue = false; Reader stdOut = null; Reader stdErr = null; LogFileProcessor processor = null; Set<String> successPatterns = Sets.newHashSet( "'Can't connect to M...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void execute(final String sql) { String command = (Platform.detect() == Windows) ? format("\"%s\"", sql) : sql; try { Process p = new ProcessBuilder(new String[]{ Paths.get(executable.getBaseDir().getAbsolutePath(), "bin...
#vulnerable code private void execute(final String sql) { String command = (Platform.detect() == Windows) ? format("\"%s\"", sql) : sql; try { Process p = Runtime.getRuntime().exec(new String[]{ Paths.get(executable.getBaseDir().getAbsolut...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private boolean stopUsingMysqldadmin() { ResultMatchingListener shutdownListener = outputWatch.addListener(new ResultMatchingListener(": Shutdown complete")); boolean retValue = false; Reader stdErr = null; try { String cmd = Paths...
#vulnerable code private boolean stopUsingMysqldadmin() { boolean retValue = false; Reader stdOut = null; Reader stdErr = null; LogFileProcessor processor = null; Set<String> successPatterns = Sets.newHashSet( "'Can't connect to M...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void execute(final String sql) { String command = (Platform.detect() == Windows) ? format("\"%s\"", sql) : sql; try { Process p = new ProcessBuilder(new String[]{ Paths.get(executable.getBaseDir().getAbsolutePath(), "bin...
#vulnerable code private void execute(final String sql) { String command = (Platform.detect() == Windows) ? format("\"%s\"", sql) : sql; try { Process p = Runtime.getRuntime().exec(new String[]{ Paths.get(executable.getBaseDir().getAbsolut...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void execute(final String sql) { String command = (Platform.detect() == Windows) ? format("\"%s\"", sql) : sql; try { Process p = new ProcessBuilder(new String[]{ Paths.get(executable.getBaseDir().getAbsolutePath(), "bin...
#vulnerable code private void execute(final String sql) { String command = (Platform.detect() == Windows) ? format("\"%s\"", sql) : sql; try { Process p = Runtime.getRuntime().exec(new String[]{ Paths.get(executable.getBaseDir().getAbsolut...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private boolean stopUsingMysqldadmin() { boolean retValue = false; Reader stdOut = null; Reader stdErr = null; LogFileProcessor processor = null; Set<String> successPatterns = Sets.newHashSet( "'Can't connect to MySQL s...
#vulnerable code private boolean stopUsingMysqldadmin() { boolean retValue = false; Reader stdOut = null; Reader stdErr = null; LogFileProcessor processor = null; Set<String> successPatterns = Sets.newHashSet("'Can't connect to MySQL server on 'l...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected SettableBeanProperty _resolvedObjectIdProperty(DeserializationContext ctxt, SettableBeanProperty prop) throws JsonMappingException { ObjectIdInfo objectIdInfo = prop.getObjectIdInfo(); JsonDeserializer<Object> valueDeser = prop.getVal...
#vulnerable code protected SettableBeanProperty _resolvedObjectIdProperty(DeserializationContext ctxt, SettableBeanProperty prop) throws JsonMappingException { ObjectIdInfo objectIdInfo = prop.getObjectIdInfo(); JsonDeserializer<Object> valueDeser = prop....
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code void runOnce(int round, int max) throws Exception { final ObjectMapper mapper = getObjectMapper(); Callable<String> writeJson = new Callable<String>() { @Override public String call() throws Exception { Wrapper wrapper =...
#vulnerable code void runOnce() throws Exception { final ObjectMapper mapper = getObjectMapper(); Callable<String> writeJson = new Callable<String>() { @Override public String call() throws Exception { Wrapper wrapper = new Wrapper...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testDeepPrefixedUnwrappingDeserialize() throws Exception { DeepPrefixUnwrap bean = MAPPER.readValue("{\"u.name\":\"Bubba\",\"u._x\":2,\"u._y\":3}", DeepPrefixUnwrap.class); assertNotNull(bean.unwrapped); assertNotNull(be...
#vulnerable code public void testDeepPrefixedUnwrappingDeserialize() throws Exception { DeepPrefixUnwrap bean = mapper.readValue("{\"u.name\":\"Bubba\",\"u._x\":2,\"u._y\":3}", DeepPrefixUnwrap.class); assertNotNull(bean.unwrapped); assertNotN...
Below is the vulnerable code, please generate the patch based on the following information.