output
stringlengths
64
73.2k
input
stringlengths
208
73.3k
instruction
stringclasses
1 value
#fixed code @Test public void whenDesiredStateIsAdmin_serverStartupAddsToJavaOptionsEnvironment() { configureServer("wls1") .withDesiredState(ADMIN_STATE) .withEnvironmentVariable("JAVA_OPTIONS", "value1"); addWlsServer("wls1"); invokeStep(); assertThat(...
#vulnerable code @Test public void whenDesiredStateIsAdmin_serverStartupAddsToJavaOptionsEnvironment() { configureServer("ms1") .withDesiredState(ADMIN_STATE) .withEnvironmentVariable("JAVA_OPTIONS", "value1"); addWlsServer("ms1"); invokeStep(); assertT...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private String readEntityAsString(ContainerRequestContext req) throws Exception { LOGGER.entering(); // Read the entire input stream into a String // This should be OK since JSON input shouldn't be monstrously big try (BufferedReader ir = new BufferedReader(new ...
#vulnerable code private String readEntityAsString(ContainerRequestContext req) throws Exception { LOGGER.entering(); // Read the entire input stream into a String // This should be OK since JSON input shouldn't be monstrously big BufferedReader ir = new BufferedReader(new...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void verifyValidateClusterStartupWarnsIfNoServersInCluster() { WlsClusterConfig wlsClusterConfig = new WlsClusterConfig("cluster1"); wlsClusterConfig.validateCluster(1, null); assertThat(logRecords, containsWarning(NO_WLS_SERVER_IN_CLUSTER, "cluster...
#vulnerable code @Test public void verifyValidateClusterStartupWarnsIfNoServersInCluster() { WlsClusterConfig wlsClusterConfig = new WlsClusterConfig("cluster1"); ClusterStartup cs = new ClusterStartup().withClusterName("cluster1").withReplicas(1); wlsClusterConfig.validateC...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void whenDesiredStateIsAdmin_serverStartupCreatesJavaOptionsEnvironment() { configureServer("wls1").withDesiredState(ADMIN_STATE); addWlsServer("wls1"); invokeStep(); assertThat( getServerStartupInfo("wls1").getEnvironment(), has...
#vulnerable code @Test public void whenDesiredStateIsAdmin_serverStartupCreatesJavaOptionsEnvironment() { configureServer("ms1").withDesiredState(ADMIN_STATE); addWlsServer("ms1"); invokeStep(); assertThat( getServerStartupInfo("ms1").getEnvironment(), ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testTwoDomainsManagedByTwoOperators() throws Exception { Assume.assumeFalse(QUICKTEST); String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName(); logTestBegin(testMethodName); logger.info("Creating Domain domain4 & ve...
#vulnerable code @Test public void testTwoDomainsManagedByTwoOperators() throws Exception { Assume.assumeFalse(QUICKTEST); String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName(); logTestBegin(testMethodName); logger.info("Creating Domain domain...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testNamespaceWatch() throws Exception { Assume.assumeTrue(TestUtils.isKubernetesAvailable()); ClientHolder client = ClientHelper.getInstance().take(); Watch<V1Namespace> watch = Watch.createWatch( client.getApiClient(), cl...
#vulnerable code @Test public void testNamespaceWatch() { Assume.assumeTrue(System.getProperty("os.name").toLowerCase().contains("nix")); ClientHolder client = ClientHelper.getInstance().take(); try { Watch<V1Namespace> watch = Watch.createWatch( client.get...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void stop() throws IOException { final List<Channel> channels; synchronized (managedChannelSet) { channels = new ArrayList<Channel>(managedChannelSet); managedChannelSet.clear(); } for (Channel channel : channels)...
#vulnerable code public void stop() throws IOException { final List<Channel> channels; synchronized (managedChannelSet) { channels = new ArrayList<Channel>(managedChannelSet); managedChannelSet.clear(); } for (Channel channel : cha...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public MulticastMessageChannel createUdpServer(final InetSocketAddress bindAddress, final ReadChannelThread readThread, final WriteChannelThread writeThread, final ChannelListener<? super MulticastMessageChannel> bindListener, final OptionMap optionMap) throws IOException { ...
#vulnerable code public MulticastMessageChannel createUdpServer(final InetSocketAddress bindAddress, final ReadChannelThread readThread, final WriteChannelThread writeThread, final ChannelListener<? super MulticastMessageChannel> bindListener, final OptionMap optionMap) throws IOExcepti...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void start() throws IOException { if (selectorThreadFactory == null) { selectorThreadFactory = Executors.defaultThreadFactory(); } if (executor == null) { executor = IoUtils.directExecutor(); } for (int i ...
#vulnerable code public void start() throws IOException { if (selectorThreadFactory == null) { selectorThreadFactory = Executors.defaultThreadFactory(); } if (executor == null) { executor = executorService = Executors.newCachedThreadPool()...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public MulticastMessageChannel createUdpServer(final InetSocketAddress bindAddress, final ReadChannelThread readThread, final WriteChannelThread writeThread, final ChannelListener<? super MulticastMessageChannel> bindListener, final OptionMap optionMap) throws IOException { ...
#vulnerable code public MulticastMessageChannel createUdpServer(final InetSocketAddress bindAddress, final ReadChannelThread readThread, final WriteChannelThread writeThread, final ChannelListener<? super MulticastMessageChannel> bindListener, final OptionMap optionMap) throws IOExcepti...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public NioSocketStreamConnection accept() throws IOException { final WorkerThread current = WorkerThread.getCurrent(); if (current == null) { return null; } final NioTcpServerHandle handle = handles[current.getNumber()]; if ...
#vulnerable code public NioSocketStreamConnection accept() throws IOException { final WorkerThread current = WorkerThread.getCurrent(); final NioTcpServerHandle handle = handles[current.getNumber()]; if (! handle.getConnection()) { return null; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public NioSocketStreamConnection accept() throws IOException { final WorkerThread current = WorkerThread.getCurrent(); if (current == null) { return null; } final NioTcpServerHandle handle = handles[current.getNumber()]; if ...
#vulnerable code public NioSocketStreamConnection accept() throws IOException { final WorkerThread current = WorkerThread.getCurrent(); final NioTcpServerHandle handle = handles[current.getNumber()]; if (! handle.getConnection()) { return null; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void stop() throws IOException { final List<Channel> channels; synchronized (managedChannelSet) { channels = new ArrayList<Channel>(managedChannelSet); managedChannelSet.clear(); } for (Channel channel : channels)...
#vulnerable code public void stop() throws IOException { final List<Channel> channels; synchronized (managedChannelSet) { channels = new ArrayList<Channel>(managedChannelSet); managedChannelSet.clear(); } for (Channel channel : cha...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Schema encodeSchema(SparkMLEncoder encoder){ T model = getTransformer(); Label label = null; if(model instanceof HasLabelCol){ HasLabelCol hasLabelCol = (HasLabelCol)model; String labelCol = hasLabelCol.getLabelCol(); Feature feature = encoder.getOnlyFe...
#vulnerable code public Schema encodeSchema(SparkMLEncoder encoder){ T model = getTransformer(); Label label = null; if(model instanceof HasLabelCol){ HasLabelCol hasLabelCol = (HasLabelCol)model; String labelCol = hasLabelCol.getLabelCol(); Feature feature = encoder.get...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code static private MapValues createMapValues(FieldName name, String identifier, List<Feature> features, List<Double> coefficients){ ListIterator<Feature> featureIt = features.listIterator(); ListIterator<Double> coefficientIt = coefficients.listIterator(); PMMLEncoder encode...
#vulnerable code static private MapValues createMapValues(FieldName name, String identifier, List<Feature> features, List<Double> coefficients){ DocumentBuilder documentBuilder = DOMUtil.createDocumentBuilder(); InlineTable inlineTable = new InlineTable(); List<String> columns = A...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Schema encodeSchema(SparkMLEncoder encoder){ T model = getTransformer(); Label label = null; if(model instanceof HasLabelCol){ HasLabelCol hasLabelCol = (HasLabelCol)model; String labelCol = hasLabelCol.getLabelCol(); Feature feature = encoder.getOnlyFe...
#vulnerable code public Schema encodeSchema(SparkMLEncoder encoder){ T model = getTransformer(); Label label = null; if(model instanceof HasLabelCol){ HasLabelCol hasLabelCol = (HasLabelCol)model; String labelCol = hasLabelCol.getLabelCol(); Feature feature = encoder.get...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code SortedMap<Long, Long> getOffsets(MovieFragmentBox moof, long trackId) { isoBufferWrapper = moof.getIsoFile().getOriginalIso(); SortedMap<Long, Long> offsets2Sizes = new TreeMap<Long, Long>(); List<TrackFragmentBox> traf = moof.getBoxes(TrackFragmentBox...
#vulnerable code SortedMap<Long, Long> getOffsets(MovieFragmentBox moof, long trackId) { isoBufferWrapper = moof.getIsoFile().getOriginalIso(); SortedMap<Long, Long> offsets2Sizes = new TreeMap<Long, Long>(); List<TrackFragmentBox> traf = moof.getBoxes(TrackFragm...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testRoundTrip_1(String resource) throws Exception { File originalFile = File.createTempFile("pdcf", "original"); FileOutputStream fos = new FileOutputStream(originalFile); byte[] content = read(getClass().getResourceAsStream(resource)); ...
#vulnerable code public void testRoundTrip_1(String resource) throws Exception { File originalFile = File.createTempFile("pdcf", "original"); FileOutputStream fos = new FileOutputStream(originalFile); byte[] content = read(getClass().getResourceAsStream(resource...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void parseMdat(MediaDataBox<TrackBox> mdat) { mdat.getTrackMap().clear(); TreeMap<Long, Track<TrackBox>> trackIdsToTracksWithChunks = new TreeMap<Long, Track<TrackBox>>(); long[] trackNumbers = getTrackNumbers(); Map<Long, Long> trackT...
#vulnerable code public void parseMdat(MediaDataBox<TrackBox> mdat) { mdat.getTrackMap().clear(); TreeMap<Long, Track<TrackBox>> trackIdsToTracksWithChunks = new TreeMap<Long, Track<TrackBox>>(); long[] trackNumbers = getTrackNumbers(); Map<Long, Long> ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static boolean setDependencyVersion( final ModifiedPomXMLEventReader pom, final String groupId, final String artifactId, final String oldVersion, final String newVersion ) ...
#vulnerable code public static boolean setDependencyVersion( final ModifiedPomXMLEventReader pom, final String groupId, final String artifactId, final String oldVersion, final String newVersi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void useLatestReleases( ModifiedPomXMLEventReader pom, Collection dependencies ) throws XMLStreamException, MojoExecutionException { Iterator i = dependencies.iterator(); while ( i.hasNext() ) { Dependency dep = (Depend...
#vulnerable code private void useLatestReleases( ModifiedPomXMLEventReader pom, Collection dependencies ) throws XMLStreamException, MojoExecutionException { Iterator i = dependencies.iterator(); while ( i.hasNext() ) { Dependency dep = (...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void useReleases( ModifiedPomXMLEventReader pom, Collection dependencies ) throws XMLStreamException, MojoExecutionException { Iterator i = dependencies.iterator(); while ( i.hasNext() ) { Dependency dep = (Dependency) ...
#vulnerable code private void useReleases( ModifiedPomXMLEventReader pom, Collection dependencies ) throws XMLStreamException, MojoExecutionException { Iterator i = dependencies.iterator(); while ( i.hasNext() ) { Dependency dep = (Depend...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void execute() throws MojoExecutionException, MojoFailureException { Set childModules = PomHelper.getAllChildModules( getProject(), getLog() ); PomHelper.removeMissingChildModules( getLog(), getProject(), childModules ); Iterator ...
#vulnerable code public void execute() throws MojoExecutionException, MojoFailureException { Set childModules = getAllChildModules( getProject() ); removeMissingChildModules( getProject(), childModules ); Iterator i = childModules.iterator(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public boolean isDependencyUpdateAvailable() { for ( Iterator i = dependencyVersions.values().iterator(); i.hasNext(); ) { ArtifactVersions versions = (ArtifactVersions) i.next(); ArtifactVersion[] dependencyUpdates = versions.getAl...
#vulnerable code public boolean isDependencyUpdateAvailable() { for ( Iterator i = dependencyVersions.values().iterator(); i.hasNext(); ) { ArtifactVersions versions = (ArtifactVersions) i.next(); if ( versions.getAllUpdates( UpdateScope.ANY, ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void useNextReleases( ModifiedPomXMLEventReader pom, Collection dependencies ) throws XMLStreamException, MojoExecutionException { Iterator i = dependencies.iterator(); while ( i.hasNext() ) { Dependency dep = (Dependen...
#vulnerable code private void useNextReleases( ModifiedPomXMLEventReader pom, Collection dependencies ) throws XMLStreamException, MojoExecutionException { Iterator i = dependencies.iterator(); while ( i.hasNext() ) { Dependency dep = (De...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void useNextSnapshots( ModifiedPomXMLEventReader pom, Collection dependencies ) throws XMLStreamException, MojoExecutionException, ArtifactMetadataRetrievalException { int segment = determineUnchangedSegment(allowMajorUpdates, allowMinorUpdates, ...
#vulnerable code private void useNextSnapshots( ModifiedPomXMLEventReader pom, Collection dependencies ) throws XMLStreamException, MojoExecutionException, ArtifactMetadataRetrievalException { int segment = determineUnchangedSegment(allowMajorUpdates, allowMinorUpdat...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected final void writeFile( File outFile, StringBuffer input ) throws IOException { Writer writer = WriterFactory.newXmlWriter( outFile ); try { IOUtil.copy( input.toString(), writer ); } finally { ...
#vulnerable code protected final void writeFile( File outFile, StringBuffer input ) throws IOException { OutputStream out = new BufferedOutputStream( new FileOutputStream( outFile ) ); out.write( input.toString().getBytes( PomHelper.POM_ENCODING ) ); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void update( ModifiedPomXMLEventReader pom ) throws MojoExecutionException, MojoFailureException, XMLStreamException { getLog().debug( "Updating parent to " + getProject().getVersion() ); if ( PomHelper.setProjectParentVersion( pom, getP...
#vulnerable code protected void update( ModifiedPomXMLEventReader pom ) throws MojoExecutionException, MojoFailureException, XMLStreamException { getLog().debug( "Updating parent to " + getProject().getVersion() ); Stack stack = new Stack(); String p...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void writeObjectData(ObjectOutputStream out) throws IOException { try (ObjectOutputStream outputStream = new ObjectOutputStream(out)) { outputStream.writeObject(this); outputStream.flush(); } }
#vulnerable code public void writeObjectData(ObjectOutputStream out) throws IOException { try (ObjectOutputStream outputStream = new ObjectOutputStream(out)) { if (this.principal instanceof Serializable) { outputStream.writeBoolean(true); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void runExperiment(MultilabelClassifier h, String options[]) throws Exception { // Help if(Utils.getOptionPos('h',options) >= 0) { System.out.println("\nHelp requested"); Evaluation.printOptions(h.listOptions()); return; } h.setOptions(options); ...
#vulnerable code public static void runExperiment(MultilabelClassifier h, String options[]) throws Exception { // Help if(Utils.getOptionPos('h',options) >= 0) { System.out.println("\nHelp requested"); Evaluation.printOptions(h.listOptions()); return; } h.setOptions(opti...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected boolean save(int index) { boolean result; int retVal; Result res; File file; retVal = m_FileChooser.showSaveDialog(this); if (retVal != JFileChooser.APPROVE_OPTION) return false; file = m_FileChooser.getSelectedFile(); res = getResultAt(index)...
#vulnerable code protected boolean save(int index) { boolean result; int retVal; Result res; File file; BufferedWriter writer; retVal = m_FileChooser.showSaveDialog(this); if (retVal != JFileChooser.APPROVE_OPTION) return false; file = m_FileChooser.getSelectedFile...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public JsonParser createParser(File f) throws IOException { IOContext ctxt = _createContext(f, true); return _createParser(_decorate(new FileInputStream(f), ctxt), ctxt); }
#vulnerable code @Override public JsonParser createParser(File f) throws IOException { return _createParser(new FileInputStream(f), _createContext(f, true)); } #location 3 #vulnerability type RESOURCE_LEAK
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void run() { CodeGenerator codegenerator = GeneratorFactory.getGenerator(CodeGenerator.class, "default"); if (codegenerator == null) { LOGGER.warn("Not CodeGenerator found"); return; } CodegenConfigurator configurator = new Code...
#vulnerable code @Override public void run() { CodegenConfigurator configurator = new CodegenConfigurator(); CodeGenerator codegenerator = GeneratorFactory.getGenerator(CodeGenerator.class, "default"); // add additional property Optional.ofNullable(properties).ifPrese...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public final void doHandle(HttpServletRequest baseRequest, HttpServletRequest request, HttpServletResponse response, InputStream is) throws IOException, S3Exception { String method = request.getMethod(); String uri = request.getRequestU...
#vulnerable code public final void doHandle(HttpServletRequest baseRequest, HttpServletRequest request, HttpServletResponse response, InputStream is) throws IOException, S3Exception { String method = request.getMethod(); String uri = request.getRe...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public final void doHandle(HttpServletRequest baseRequest, HttpServletRequest request, HttpServletResponse response, InputStream is) throws IOException, S3Exception { String method = request.getMethod(); String uri = request.getRequestU...
#vulnerable code public final void doHandle(HttpServletRequest baseRequest, HttpServletRequest request, HttpServletResponse response, InputStream is) throws IOException, S3Exception { String method = request.getMethod(); String uri = request.getRe...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private ModelAttr getAndPutModelAttr(Map<String, Map<String, Object>> swaggerMap, Map<String, ModelAttr> resMap, String modeName) { ModelAttr modeAttr; if ((modeAttr = resMap.get("#/definitions/" + modeName)) == null) { modeAttr = new ModelAttr(); ...
#vulnerable code private ModelAttr getAndPutModelAttr(Map<String, Map<String, Object>> swaggerMap, Map<String, ModelAttr> resMap, String modeName) { if (resMap.get(modeName) != null) { return resMap.get("#/definitions/" + modeName); } Map<String, Obje...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public SynonymMap reloadSynonymMap() { try { logger.info("start reload remote synonym from {}.", location); Reader rulesReader = getReader(); SynonymMap.Builder parser = null; if ("wordnet".equalsIgnoreCase(format)) { parser = new WordnetSynonymPars...
#vulnerable code @Override public SynonymMap reloadSynonymMap() { try { Reader rulesReader = getReader(); SynonymMap.Builder parser = null; if ("wordnet".equalsIgnoreCase(format)) { parser = new WordnetSynonymParser(true, expand, analyzer); ((WordnetSynonymParser) pars...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public SynonymMap reloadSynonymMap() { try { logger.info("start reload remote synonym from {}.", location); Reader rulesReader = getReader(); SynonymMap.Builder parser = null; if ("wordnet".equalsIgnoreCase(format)) { parser = new WordnetSynonymPars...
#vulnerable code @Override public SynonymMap reloadSynonymMap() { try { Reader rulesReader = getReader(); SynonymMap.Builder parser = null; if ("wordnet".equalsIgnoreCase(format)) { parser = new WordnetSynonymParser(true, expand, analyzer); ((WordnetSynonymParser) pars...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected Rectangle computeBoundingBox(Collection<? extends Shape> shapes, SpatialContext ctx) { if (shapes.isEmpty()) return ctx.makeRectangle(Double.NaN, Double.NaN, Double.NaN, Double.NaN); BBoxCalculator bboxCalc = new BBoxCalculator(ctx); for (Shape geom ...
#vulnerable code protected Rectangle computeBoundingBox(Collection<? extends Shape> shapes, SpatialContext ctx) { if (shapes.isEmpty()) return ctx.makeRectangle(Double.NaN, Double.NaN, Double.NaN, Double.NaN); Range xRange = null; double minY = Double.POSITIVE_INFINITY; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void doGenerate(String excludeTables) { System.out.println("start generate..."); List<TableMeta> tableMetaList = CodeGenHelpler.createMetaBuilder().build(); CodeGenHelpler.excludeTables(tableMetaList, excludeTables); new JbootServiceIn...
#vulnerable code public void doGenerate(String excludeTables) { System.out.println("start generate..."); DataSource dataSource = CodeGenHelpler.getDatasource(); List<TableMeta> tableMetaList = new MetaBuilder(dataSource).build(); CodeGenHelpler.excludeTa...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void set(String key, String value) { Jboot.getCache().put(cache_name, key, value); }
#vulnerable code @Override public void set(String key, String value) { Jboot.getJbootCache().put(cache_name, key, value); } #location 3 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected <T> T doGet(Class<T> targetClass, int injectDepth) throws ReflectiveOperationException { return doGet(targetClass); }
#vulnerable code @Override protected <T> T doGet(Class<T> targetClass, int injectDepth) throws ReflectiveOperationException { // Aop.get(obj.getClass()) 可以用 Aop.inject(obj),所以注掉下一行代码 // targetClass = (Class<T>)getUsefulClass(targetClass); targetClass = (Clas...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public M getCache(Object key) { return Jboot.getCache().get(tableName(), key); }
#vulnerable code public M getCache(Object key) { return Jboot.getJbootCache().get(tableName(), key); } #location 2 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public List<M> getListCache(Object key, IDataLoader dataloader) { return Jboot.getCache().get(tableName(), key, dataloader); }
#vulnerable code public List<M> getListCache(Object key, IDataLoader dataloader) { return Jboot.getJbootCache().get(tableName(), key, dataloader); } #location 2 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void copyConnStreamToResponse(HttpURLConnection conn, HttpServletResponse resp) throws IOException { if (resp.isCommitted()) { return; } InputStream inStream = null; OutputStream outStream = null; try { ...
#vulnerable code private void copyConnStreamToResponse(HttpURLConnection conn, HttpServletResponse resp) throws IOException { InputStream inStream = null; InputStreamReader reader = null; try { if (!resp.isCommitted()) { PrintWriter wr...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void removeCache(Object key) { if (key == null) return; Jboot.getCache().remove(tableName(), key); }
#vulnerable code public void removeCache(Object key) { if (key == null) return; Jboot.getJbootCache().remove(tableName(), key); } #location 3 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public String get(String key) { return Jboot.getCache().get(cache_name, key); }
#vulnerable code @Override public String get(String key) { return Jboot.getJbootCache().get(cache_name, key); } #location 3 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void handle(String target, HttpServletRequest request, HttpServletResponse response, boolean[] isHandled) { if (target.indexOf('.') != -1 || JbootWebsocketManager.me().isWebsokcetEndPoint(target)) { return; } /** ...
#vulnerable code @Override public void handle(String target, HttpServletRequest request, HttpServletResponse response, boolean[] isHandled) { if (target.indexOf('.') != -1 || JbootWebsocketManager.me().containsEndPoint(target)) { return; } /** ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code static void putDataToCache(int liveSeconds, String cacheName, String cacheKey, Object data) { liveSeconds = liveSeconds > 0 ? liveSeconds : CONFIG.getAopCacheLiveSeconds(); if (liveSeconds > 0) { AopCache.put(cacheN...
#vulnerable code static void putDataToCache(int liveSeconds, String cacheName, String cacheKey, Object data) { liveSeconds = liveSeconds > 0 ? liveSeconds : CONFIG.getAopCacheLiveSeconds(); if (liveSeconds > 0) { getAopCache()...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void run() { if (redis == null) { return; } Long result = null; for (int i = 0; i < 5; i++) { Long setTimeMillis = System.currentTimeMillis(); result = redis.setnx(key, setTimeMillis)...
#vulnerable code @Override public void run() { Long result = null; for (int i = 0; i < 6; i++) { result = redis.setnx(key, "locked"); //error if (result == null) { quietSleep(); } //setnx...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected <T> T doGet(Class<T> targetClass, int injectDepth) throws ReflectiveOperationException { return doGet(targetClass); }
#vulnerable code @Override protected <T> T doGet(Class<T> targetClass, int injectDepth) throws ReflectiveOperationException { // Aop.get(obj.getClass()) 可以用 Aop.inject(obj),所以注掉下一行代码 // targetClass = (Class<T>)getUsefulClass(targetClass); targetClass = (Clas...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void intercept(FixedInvocation inv) { if (!config.isConfigOK()) { inv.invoke(); return; } SsoShiroBridge ssoShiroBridge = JbootShiroManager.me().getSsoShiroBridge(); if (ssoShiroBridge != null && ss...
#vulnerable code @Override public void intercept(FixedInvocation inv) { if (!config.isConfigOK()) { inv.invoke(); return; } SsoShiroBridge ssoShiroBridge = JbootShiroManager.me().getSsoShiroBridge(); if (ssoShiroBridge != null...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private static void copyStreamToResponse(HttpURLConnection connection, HttpServletResponse response) throws IOException { InputStream inStream = null; InputStreamReader reader = null; try { if (!response.isCommitted()) { Pri...
#vulnerable code private static void copyStreamToResponse(HttpURLConnection connection, HttpServletResponse response) throws IOException { InputStream inStream = null; try { if (!response.isCommitted()) { PrintWriter writer = response.getWrite...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public M getCache(Object key, IDataLoader dataloader) { return Jboot.getCache().get(tableName(), key, dataloader); }
#vulnerable code public M getCache(Object key, IDataLoader dataloader) { return Jboot.getJbootCache().get(tableName(), key, dataloader); } #location 2 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected <T> T doGet(Class<T> targetClass, int injectDepth) throws ReflectiveOperationException { return doGet(targetClass); }
#vulnerable code @Override protected <T> T doGet(Class<T> targetClass, int injectDepth) throws ReflectiveOperationException { // Aop.get(obj.getClass()) 可以用 Aop.inject(obj),所以注掉下一行代码 // targetClass = (Class<T>)getUsefulClass(targetClass); targetClass = (Clas...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void removeAttribute(String name) { Jboot.getCache().remove(SESSION_CACHE_NAME, buildKey(name)); }
#vulnerable code @Override public void removeAttribute(String name) { Jboot.getJbootCache().remove(SESSION_CACHE_NAME, buildKey(name)); } #location 3 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public byte[] serialize(Object obj) throws IOException { return SerializerManager.me().getSerializer(config.getSerializer()).serialize(obj); }
#vulnerable code @Override public byte[] serialize(Object obj) throws IOException { return Jboot.me().getSerializer().serialize(obj); } #location 3 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void remove(String key) { Jboot.getCache().remove(cache_name, key); }
#vulnerable code @Override public void remove(String key) { Jboot.getJbootCache().remove(cache_name, key); } #location 3 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public int getErrorCode() { return errorCode; }
#vulnerable code public int getErrorCode() { return (int) get("errorCode"); } #location 2 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void doProcess(JbootHttpRequest request, JbootHttpResponse response) { HttpURLConnection connection = null; InputStream stream = null; try { connection = getConnection(request); configConnection(connection, request); ...
#vulnerable code private void doProcess(JbootHttpRequest request, JbootHttpResponse response) { HttpURLConnection connection = null; InputStream stream = null; try { connection = getConnection(request); configConnection(connection, reques...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void doGenerate(String excludeTables) { System.out.println("start generate..."); List<TableMeta> tableMetaList = CodeGenHelpler.createMetaBuilder().build(); CodeGenHelpler.excludeTables(tableMetaList, excludeTables); generate(tableMeta...
#vulnerable code public void doGenerate(String excludeTables) { System.out.println("start generate..."); DataSource dataSource = CodeGenHelpler.getDatasource(); List<TableMeta> tableMetaList = new MetaBuilder(dataSource).build(); CodeGenHelpler.excludeTa...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private static void copyStreamToResponse(HttpURLConnection connection, HttpServletResponse response) throws IOException { InputStream inStream = null; InputStreamReader reader = null; try { if (!response.isCommitted()) { Pri...
#vulnerable code private static void copyStreamToResponse(HttpURLConnection connection, HttpServletResponse response) throws IOException { InputStream inStream = null; try { if (!response.isCommitted()) { PrintWriter writer = response.getWrite...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void unzip(String zipFilePath, String targetPath) throws IOException { unzip(zipFilePath, targetPath, true); }
#vulnerable code public static void unzip(String zipFilePath, String targetPath) throws IOException { ZipFile zipFile = new ZipFile(zipFilePath); try{ Enumeration<?> entryEnum = zipFile.entries(); if (null != entryEnum) { while (entryEnum.hasMoreElements()) { OutputStrea...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void doGenerate(String excludeTables) { System.out.println("start generate..."); DataSource dataSource = CodeGenHelpler.getDatasource(); List<TableMeta> tableMetaList = new MetaBuilder(dataSource).build(); CodeGenHelpler.excludeTables(t...
#vulnerable code public void doGenerate(String excludeTables) { System.out.println("start generate..."); DatasourceConfig datasourceConfig = JbootProperties.get("jboot.datasource", DatasourceConfig.class); HikariConfig config = new HikariConfig(); confi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Object getValue(String name) { return Jboot.getCache().get(SESSION_CACHE_NAME, buildKey(name)); }
#vulnerable code @Override public Object getValue(String name) { return Jboot.getJbootCache().get(SESSION_CACHE_NAME, buildKey(name)); } #location 3 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void put(String cacheName, Object key, Object value) { try { ehcache.put(cacheName, key, value); redisCache.put(cacheName, key, value); } finally { publishMessage(JbootEhredisMessage.ACTION_PUT, cacheNam...
#vulnerable code @Override public void put(String cacheName, Object key, Object value) { try { ehcache.put(cacheName, key, value); redisCache.put(cacheName, key, value); } finally { Jboot.me().getMq().publish(new JbootEhredisMessag...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public boolean isConfigOk() { if (configOk != null) { return configOk; } synchronized (this) { if (configOk == null) { configOk = uri != null && uri.length > 0; if (configOk) { ...
#vulnerable code public boolean isConfigOk() { if (configOk != null) { return configOk; } synchronized (this) { if (configOk == null) { configOk = StrUtil.isNotBlank(uri); if (configOk) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void doGenerate(String excludeTables) { String modelPackage = basePackage; String baseModelPackage = basePackage + ".base"; String modelDir = PathKit.getWebRootPath() + "/src/main/java/" + modelPackage.replace(".", "/"); String baseMod...
#vulnerable code public void doGenerate(String excludeTables) { String modelPackage = basePackage; String baseModelPackage = basePackage + ".base"; String modelDir = PathKit.getWebRootPath() + "/src/main/java/" + modelPackage.replace(".", "/"); String b...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code static void doCacheEvict(Object[] arguments, Class targetClass, Method method, CacheEvict evict) { String unless = AnnotationUtil.get(evict.unless()); if (Utils.isUnless(unless, method, arguments)) { return; } String cacheName = An...
#vulnerable code static void doCacheEvict(Object[] arguments, Class targetClass, Method method, CacheEvict evict) { String unless = AnnotationUtil.get(evict.unless()); if (Utils.isUnless(unless, method, arguments)) { return; } String cacheNam...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void index() { renderText("hello " + serviceTest.getName("aaa")); }
#vulnerable code public void index() { List<Record> records = Db.find("select * from `user`"); System.out.println("index .... "); LogKit.error("xxxxxxx"); Jboot.getCache().put("test","test","valueeeeeeeeee"); String value = Jboot.getCache()....
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void remove(String cacheName, Object key) { try { ehcache.remove(cacheName, key); redisCache.remove(cacheName, key); } finally { publishMessage(JbootEhredisMessage.ACTION_REMOVE, cacheName, key); ...
#vulnerable code @Override public void remove(String cacheName, Object key) { try { ehcache.remove(cacheName, key); redisCache.remove(cacheName, key); } finally { Jboot.me().getMq().publish(new JbootEhredisMessage(clientId, JbootEh...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void inject(Class<?> targetClass, Object targetObject, int injectDepth) throws ReflectiveOperationException { if ((injectDepth--) <= 0) { return; } targetClass = getUsefulClass(targetClass); Field[] fields = ta...
#vulnerable code @Override public void inject(Class<?> targetClass, Object targetObject, int injectDepth) throws ReflectiveOperationException { if ((injectDepth--) <= 0) { return; } targetClass = getUsefulClass(targetClass); Field[] field...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private static void findClassPathsAndJarsByClassPath(Set<String> jarPaths, Set<String> classPaths) { String classPath = System.getProperty("java.class.path"); if (classPath == null || classPath.trim().length() == 0) { return; } Stri...
#vulnerable code private static void findClassPathsAndJarsByClassPath(Set<String> jarPaths, Set<String> classPaths) { String[] classPathArray = System.getProperty("java.class.path").split(File.pathSeparator); for (String path : classPathArray) { path = path.t...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void doGenerate(String excludeTables) { System.out.println("start generate..."); DataSource dataSource = CodeGenHelpler.getDatasource(); List<TableMeta> tableMetaList = new MetaBuilder(dataSource).build(); CodeGenHelpler.excludeTables(t...
#vulnerable code public void doGenerate(String excludeTables) { System.out.println("start generate..."); DatasourceConfig datasourceConfig = JbootProperties.get("jboot.datasource", DatasourceConfig.class); HikariConfig config = new HikariConfig(); confi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void putValue(String name, Object value) { Jboot.getCache().put(SESSION_CACHE_NAME, buildKey(name), value); }
#vulnerable code @Override public void putValue(String name, Object value) { Jboot.getJbootCache().put(SESSION_CACHE_NAME, buildKey(name), value); } #location 3 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void removeAll(String cacheName) { try { ehcache.removeAll(cacheName); redisCache.removeAll(cacheName); } finally { publishMessage(JbootEhredisMessage.ACTION_REMOVE_ALL, cacheName, null); } }
#vulnerable code @Override public void removeAll(String cacheName) { try { ehcache.removeAll(cacheName); redisCache.removeAll(cacheName); } finally { Jboot.me().getMq().publish(new JbootEhredisMessage(clientId, JbootEhredisMessage....
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code static void doCacheEvict(Object[] arguments, Class targetClass, Method method, CacheEvict evict) { String unless = AnnotationUtil.get(evict.unless()); if (Utils.isUnless(unless, method, arguments)) { return; } String cacheName = An...
#vulnerable code static void doCacheEvict(Object[] arguments, Class targetClass, Method method, CacheEvict evict) { String unless = AnnotationUtil.get(evict.unless()); if (Utils.isUnless(unless, method, arguments)) { return; } String cacheNam...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public boolean acquire() { long timeout = timeoutMsecs; do { long expires = System.currentTimeMillis() + expireMsecs + 1; Long result = redis.setnx(lockName, expires); if (result != null && result == 1) { /...
#vulnerable code public boolean acquire() { long timeout = timeoutMsecs; do { long expires = System.currentTimeMillis() + expireMsecs + 1; Long result = Jboot.me().getRedis().setnx(lockName, expires); if (result != null && result == ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void publishMessage(int action, String cacheName, Object key) { JbootEhredisMessage message = new JbootEhredisMessage(clientId, action, cacheName, key); redis.publish(serializer.serialize(channel), serializer.serialize(message)); }
#vulnerable code private void publishMessage(int action, String cacheName, Object key) { Jboot.me().getMq().publish(new JbootEhredisMessage(clientId, action, cacheName, key), channel); } #location 2 #vulnerability typ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Object getAttribute(String name) { return Jboot.getCache().get(SESSION_CACHE_NAME, buildKey(name)); }
#vulnerable code @Override public Object getAttribute(String name) { return Jboot.getJbootCache().get(SESSION_CACHE_NAME, buildKey(name)); } #location 3 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static <T> T service(Class<T> clazz, String group, String version) { return jboot.getRpc().serviceObtain(clazz, group, version); }
#vulnerable code public static <T> T service(Class<T> clazz, String group, String version) { return me().getRpc().serviceObtain(clazz, group, version); } #location 2 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void doGenerate(String excludeTables) { String modelPackage = basePackage; String baseModelPackage = basePackage + ".base"; String modelDir = PathKit.getWebRootPath() + "/src/main/java/" + modelPackage.replace(".", "/"); String baseMod...
#vulnerable code public void doGenerate(String excludeTables) { String modelPackage = basePackage ; String baseModelPackage = basePackage + ".base"; String modelDir = PathKit.getWebRootPath() + "/src/main/java/" + modelPackage.replace(".", "/"); String ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void setAttribute(String name, Object value) { Jboot.getCache().put(SESSION_CACHE_NAME, buildKey(name), value); }
#vulnerable code @Override public void setAttribute(String name, Object value) { Jboot.getJbootCache().put(SESSION_CACHE_NAME, buildKey(name), value); } #location 3 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public <T> T get(Class<T> clazz, String prefix, String file) { /** * 开发模式下,热加载会导致由于Config是不同的 ClassLoader, * 如果走缓存会Class转化异常 */ if (isDevMode()) { return createConfigObject(clazz, prefix, file); } Object...
#vulnerable code public <T> T get(Class<T> clazz, String prefix, String file) { /** * 开发模式下,热加载会导致由于Config是不同的 ClassLoader, * 如果走缓存会Class转化异常 */ if (JbootApplication.isDevMode()) { return createConfigObject(clazz, prefix, file); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected void doInject(Class<?> targetClass, Object targetObject, int injectDepth) throws ReflectiveOperationException { if ((injectDepth--) <= 0) { return; } targetClass = getUsefulClass(targetClass); Field[] fields...
#vulnerable code @Override protected void doInject(Class<?> targetClass, Object targetObject, int injectDepth) throws ReflectiveOperationException { if ((injectDepth--) <= 0) { return; } targetClass = getUsefulClass(targetClass); Field[] ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code static void doCacheEvict(Object[] arguments, Class targetClass, Method method, CacheEvict evict) { String unless = AnnotationUtil.get(evict.unless()); if (Utils.isUnless(unless, method, arguments)) { return; } String cacheName = An...
#vulnerable code static void doCacheEvict(Object[] arguments, Class targetClass, Method method, CacheEvict evict) { String unless = AnnotationUtil.get(evict.unless()); if (Utils.isUnless(unless, method, arguments)) { return; } String cacheNam...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testRedis() { // Jboot.setBootArg("jboot.redis.host", "127.0.0.1"); //// Jboot.setBootArg("jboot.redis.password", "123456"); // // JbootRedis redis = Jboot.me().getRedis(); // redis.set("mykey", "myvalue"); // // redis...
#vulnerable code @Test public void testRedis() { Jboot.setBootArg("jboot.redis.host", "127.0.0.1"); // Jboot.setBootArg("jboot.redis.password", "123456"); JbootRedis redis = Jboot.me().getRedis(); redis.set("mykey", "myvalue"); redis.lpush("...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public <T> T deserialize(byte[] bytes, Class<T> clz) throws IOException { return (T) SerializerManager.me().getSerializer(config.getSerializer()).deserialize(bytes); }
#vulnerable code @Override public <T> T deserialize(byte[] bytes, Class<T> clz) throws IOException { return (T) Jboot.me().getSerializer().deserialize(bytes); } #location 3 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testHttpDownload() { // String url = "http://www.xxx.com/abc.zip"; // // File downloadToFile = new File("/xxx/abc.zip"); // // // JbootHttpRequest request = JbootHttpRequest.create(url, null, JbootHttpRequest.METHOD_GET); // ...
#vulnerable code @Test public void testHttpDownload() { String url = "http://www.xxx.com/abc.zip"; File downloadToFile = new File("/xxx/abc.zip"); JbootHttpRequest request = JbootHttpRequest.create(url, null, JbootHttpRequest.METHOD_GET); request....
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void putCache(Object key, Object value) { Jboot.getCache().put(tableName(), key, value); }
#vulnerable code public void putCache(Object key, Object value) { Jboot.getJbootCache().put(tableName(), key, value); } #location 2 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public boolean save() { if (hasColumn(COLUMN_CREATED) && get(COLUMN_CREATED) == null) { set(COLUMN_CREATED, new Date()); } if (null == get(getPrimaryKey()) && String.class == getPrimaryType()) { set(getPrimaryKey()...
#vulnerable code @Override public boolean save() { if (hasColumn(COLUMN_CREATED) && get(COLUMN_CREATED) == null) { set(COLUMN_CREATED, new Date()); } if (null == get(getPrimaryKey()) && String.class == getPrimaryType()) { set(getPrimar...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @RequiresPermissions("adminSystemVariable") @RequestMapping(value="variableSave${url.suffix}", method = RequestMethod.POST) @ResponseBody public BaseVO variableSave(System sys, Model model, HttpServletRequest request){ System system = sqlService.findAloneByProperty(System.c...
#vulnerable code @RequiresPermissions("adminSystemVariable") @RequestMapping(value="variableSave${url.suffix}", method = RequestMethod.POST) @ResponseBody public BaseVO variableSave(System sys, Model model, HttpServletRequest request){ System system; if(Global.system.get(sys.getN...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @RequestMapping(value="saveTemplateName${url.suffix}", method = RequestMethod.POST) @ResponseBody public BaseVO saveTemplateName(HttpServletRequest request, @RequestParam(value = "templateName", required = false, defaultValue="") String templateName){ if(!haveSiteAuth())...
#vulnerable code @RequestMapping(value="saveTemplateName${url.suffix}", method = RequestMethod.POST) @ResponseBody public BaseVO saveTemplateName(HttpServletRequest request, @RequestParam(value = "templateName", required = false, defaultValue="") String templateName){ if(!haveSiteA...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public TemplatePageVO saveTemplatePageText(String fileName, String html, HttpServletRequest request) { TemplatePageVO vo = new TemplatePageVO(); fileName = Safety.filter(fileName); if(fileName == null || fileName.length() == 0){ vo.setBaseVO(BaseVO.FAILURE, "出错,你要修改的...
#vulnerable code public TemplatePageVO saveTemplatePageText(String fileName, String html, HttpServletRequest request) { TemplatePageVO vo = new TemplatePageVO(); fileName = Safety.filter(fileName); if(fileName == null || fileName.length() == 0){ vo.setBaseVO(BaseVO.FAILURE, "出错...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @RequestMapping(value="uploadImportTemplate${url.suffix}", method = RequestMethod.POST) @ResponseBody public void uploadImportTemplate(HttpServletResponse response, HttpServletRequest request, @RequestParam("templateFile") MultipartFile multipartFile){ if(multipartFile =...
#vulnerable code @RequestMapping(value="uploadImportTemplate${url.suffix}", method = RequestMethod.POST) @ResponseBody public void uploadImportTemplate(HttpServletResponse response, HttpServletRequest request, @RequestParam("templateFile") MultipartFile multipartFile){ if(multipart...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static UploadFileVO put(String path,InputStream inputStream){ UploadFileVO vo = new UploadFileVO(); //判断文件大小是否超出最大限制的大小 int lengthKB = 0; try { lengthKB = (int) Math.ceil(inputStream.available()/1024); } catch (IOException e) { e.printStackTrace(); } ...
#vulnerable code public static UploadFileVO put(String path,InputStream inputStream){ UploadFileVO vo = new UploadFileVO(); if(isMode(MODE_ALIYUN_OSS)){ PutResult pr = OSSUtil.put(path, inputStream); vo = PutResultToUploadFileVO(pr); }else if(isMode(MODE_LOCAL_FILE)){ dir...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void connect() throws IOException, InterruptedException, ServiceLocatorException { try { synchronized (this) { if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "Start connect session"); } blockedByRunUpOperation = true; connect(false); ...
#vulnerable code public void connect() throws IOException, InterruptedException, ServiceLocatorException { connect(false); } #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 disconnect() throws InterruptedException, ServiceLocatorException { try { synchronized (this) { if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "Start disconnect session"); } blockedByRunUpOperation = true; disconnect(false); ...
#vulnerable code public void disconnect() throws InterruptedException, ServiceLocatorException { disconnect(true, false); } #location 3 #vulnerability type THREAD_SAFETY_VIOLATION
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Keyspace keyspace() { if (keyspace != null) return keyspace; synchronized (AstyanaxConnection.class) { // double check... if (keyspace != null) return keyspace; try ...
#vulnerable code public Keyspace keyspace() { if (keyspace != null) return keyspace; synchronized (AstyanaxConnection.class) { // double check... if (keyspace != null) return keyspace; try ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testReframe() throws Exception { final ZMTPFramingDecoder decoder = new ZMTPFramingDecoder(wireFormat(ZMTP10), new RawDecoder()); final ZMTPWriter writer = ZMTPWriter.create(ZMTP10); final ByteBuf buf = Unpooled.buffer(); writer.reset(buf); ...
#vulnerable code @Test public void testReframe() throws Exception { final ZMTPParser parser = ZMTPParser.create(ZMTP10, new RawDecoder()); final ZMTPWriter writer = ZMTPWriter.create(ZMTP10); final ByteBuf buf = Unpooled.buffer(); writer.reset(buf); // Request a fr...
Below is the vulnerable code, please generate the patch based on the following information.