output
stringlengths
64
73.2k
input
stringlengths
208
73.3k
instruction
stringclasses
1 value
#fixed code @SuppressWarnings({"unchecked", "rawtypes"}) @Override public void onServiceContextReceived(ServiceContext serviceContext) throws Throwable { FlowMessage flowMessage = serviceContext.getFlowMessage(); if (serviceContext.isSync()) { CacheManager.get(serviceActo...
#vulnerable code @SuppressWarnings({"unchecked", "rawtypes"}) @Override public void onServiceContextReceived(ServiceContext serviceContext) throws Throwable { FlowMessage flowMessage = serviceContext.getFlowMessage(); if (serviceContext.isSync()) { CacheManager.get(servi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void doStartup(String configLocation) throws Throwable { Class<?> applicationContextClazz = Class.forName("org.springframework.context.support.ClassPathXmlApplicationContext", true, getClassLoader()); Object flowerFactory = applicationContextC...
#vulnerable code @Override public void doStartup(String configLocation) { ClassPathXmlApplicationContext applicationContext = null; try { applicationContext = new ClassPathXmlApplicationContext(configLocation); applicationContext.start(); } catch (Exception e) {...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static List<Pair<String, String>> readFlow(String path) throws IOException { InputStreamReader fr = new InputStreamReader(FileUtil.class.getResourceAsStream(path),Constant.ENCODING_UTF_8); BufferedReader br = new BufferedReader(fr); String line; List<Pair...
#vulnerable code public static List<Pair<String, String>> readFlow(String path) throws IOException { InputStreamReader fr = new InputStreamReader(FileUtil.class.getResourceAsStream(path)); BufferedReader br = new BufferedReader(fr); String line = ""; List<Pair<String, Stri...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code FunctionTypeBuilder(String fnName, AbstractCompiler compiler, Node errorRoot, String sourceName, Scope scope) { Preconditions.checkNotNull(errorRoot); this.fnName = fnName == null ? "" : fnName; this.codingConvention = compiler.getCodingConvention(); this...
#vulnerable code FunctionTypeBuilder inferThisType(JSDocInfo info, @Nullable Node owner) { ObjectType maybeThisType = null; if (info != null && info.hasThisType()) { maybeThisType = ObjectType.cast( info.getThisType().evaluate(scope, typeRegistry)); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private EnvTypePair analyzeLooseCallNodeBwd( Node callNode, TypeEnv outEnv, JSType retType) { Preconditions.checkArgument(callNode.isCall()); Preconditions.checkNotNull(retType); Node callee = callNode.getFirstChild(); TypeEnv tmpEnv = outEnv; Function...
#vulnerable code private EnvTypePair analyzeLooseCallNodeBwd( Node callNode, TypeEnv outEnv, JSType retType) { Preconditions.checkArgument(callNode.isCall()); Preconditions.checkNotNull(retType); Node callee = callNode.getFirstChild(); TypeEnv tmpEnv = outEnv; Fu...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private List<JSSourceFile> getDefaultExterns() { try { return CommandLineRunner.getDefaultExterns(); } catch (IOException e) { throw new BuildException(e); } }
#vulnerable code private List<JSSourceFile> getDefaultExterns() { try { InputStream input = Compiler.class.getResourceAsStream( "/externs.zip"); ZipInputStream zip = new ZipInputStream(input); List<JSSourceFile> externs = Lists.newLinkedList(); for (...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private Node tryOptimizeSwitch(Node n) { Preconditions.checkState(n.getType() == Token.SWITCH); Node defaultCase = tryOptimizeDefaultCase(n); // Removing cases when there exists a default case is not safe. if (defaultCase == null) { Node next = null; ...
#vulnerable code private Node tryOptimizeSwitch(Node n) { Preconditions.checkState(n.getType() == Token.SWITCH); Node defaultCase = findDefaultCase(n); if (defaultCase != null && isUselessCase(defaultCase)) { NodeUtil.redeclareVarsInsideBranch(defaultCase); n.remo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void writeResult(String source) { if (this.outputFile.getParentFile().mkdirs()) { log("Created missing parent directory " + this.outputFile.getParentFile(), Project.MSG_DEBUG); } try { OutputStreamWriter out = new OutputStreamWriter( ...
#vulnerable code private void writeResult(String source) { if (this.outputFile.getParentFile().mkdirs()) { log("Created missing parent directory " + this.outputFile.getParentFile(), Project.MSG_DEBUG); } try { FileWriter out = new FileWriter(this.outputF...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private Writer fileNameToOutputWriter(String fileName) throws IOException { if (fileName == null) { return null; } if (testMode) { return new StringWriter(); } return streamToOutputWriter(filenameToOutputStream(fileName)); }
#vulnerable code private Writer fileNameToOutputWriter(String fileName) throws IOException { if (fileName == null) { return null; } if (testMode) { return new StringWriter(); } return streamToOutputWriter(new FileOutputStream(fileName)); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public List<INPUT> getSortedDependenciesOf(List<INPUT> roots) { return getDependenciesOf(roots, true); }
#vulnerable code public List<INPUT> getSortedDependenciesOf(List<INPUT> roots) { Preconditions.checkArgument(inputs.containsAll(roots)); Set<INPUT> included = Sets.newHashSet(); Deque<INPUT> worklist = new ArrayDeque<INPUT>(roots); while (!worklist.isEmpty()) { INPUT...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) { return true; }
#vulnerable code @Override public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) { if (n.isScript()) { this.inExterns = n.getStaticSourceFile().isExtern(); } return true; } #location 4 #vulnerabi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Set<String> getOwnPropertyNames() { return getPropertyMap().getOwnPropertyNames(); }
#vulnerable code public Set<String> getOwnPropertyNames() { return ImmutableSet.of(); } #location 1 #vulnerability type CHECKERS_IMMUTABLE_CAST
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void enterScope(NodeTraversal t) { scopeNeedsInit = true; }
#vulnerable code @Override public void enterScope(NodeTraversal t) { new GraphReachability<Node, ControlFlowGraph.Branch>( t.getControlFlowGraph(), new ReachablePredicate()).compute( t.getControlFlowGraph().getEntry().getValue()); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void initEdgeEnvsFwd() { // TODO(user): Revisit what we throw away after the bwd analysis DiGraphNode<Node, ControlFlowGraph.Branch> entry = cfg.getEntry(); DiGraphEdge<Node, ControlFlowGraph.Branch> entryOutEdge = cfg.getOutEdges(entry.getValue()).g...
#vulnerable code private void initEdgeEnvsFwd() { // TODO(user): Revisit what we throw away after the bwd analysis DiGraphNode<Node, ControlFlowGraph.Branch> entry = cfg.getEntry(); DiGraphEdge<Node, ControlFlowGraph.Branch> entryOutEdge = cfg.getOutEdges(entry.getValu...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void removeUnreferencedVars() { CodingConvention convention = codingConvention; for (Iterator<Var> it = maybeUnreferenced.iterator(); it.hasNext(); ) { Var var = it.next(); // Remove calls to inheritance-defining functions where the unreferenced ...
#vulnerable code private void removeUnreferencedVars() { CodingConvention convention = compiler.getCodingConvention(); for (Iterator<Var> it = maybeUnreferenced.iterator(); it.hasNext(); ) { Var var = it.next(); // Regardless of what happens to the original declarati...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private Node aliasAndInlineArguments( Node fnTemplateRoot, LinkedHashMap<String, Node> argMap, Set<String> namesToAlias) { if (namesToAlias == null || namesToAlias.isEmpty()) { // There are no names to alias, just inline the arguments directly. Node...
#vulnerable code private Node aliasAndInlineArguments( Node fnTemplateRoot, LinkedHashMap<String, Node> argMap, Set<String> namesToAlias) { if (namesToAlias == null || namesToAlias.isEmpty()) { // There are no names to alias, just inline the arguments directly. ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void outputTracerReport() { JvmMetrics.maybeWriteJvmMetrics(this.err, "verbose:pretty:all"); OutputStreamWriter output = new OutputStreamWriter(this.err); try { int runtime = 0; int runs = 0; int changes = 0; int diff = 0; int ...
#vulnerable code private void outputTracerReport() { OutputStreamWriter output = new OutputStreamWriter(this.err); try { int runtime = 0; int runs = 0; int changes = 0; int diff = 0; int gzDiff = 0; // header output.write("Summary:\n"); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void escapeParameters(MustDef output) { for (Iterator<Var> i = jsScope.getVars(); i.hasNext();) { Var v = i.next(); if (isParameter(v)) { // Assume we no longer know where the parameter comes from // anymore. output.reachingDef.pu...
#vulnerable code private void escapeParameters(MustDef output) { for (Iterator<Var> i = jsScope.getVars(); i.hasNext();) { Var v = i.next(); if (v.getParentNode().getType() == Token.LP) { // Assume we no longer know where the parameter comes from // anymore...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void enterScope(NodeTraversal t) {}
#vulnerable code @Override public void enterScope(NodeTraversal t) { Scope scope = t.getScope(); // Computes the control flow graph. ControlFlowAnalysis cfa = new ControlFlowAnalysis(compiler, false, false); cfa.process(null, scope.getRootNode()); cfgStack.push(curC...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private String getFunctionAnnotation(Node fnNode) { Preconditions.checkState(fnNode.getType() == Token.FUNCTION); StringBuilder sb = new StringBuilder("/**\n"); JSType type = fnNode.getJSType(); if (type == null || type.isUnknownType()) { return ""; ...
#vulnerable code private String getFunctionAnnotation(Node fnNode) { Preconditions.checkState(fnNode.getType() == Token.FUNCTION); StringBuilder sb = new StringBuilder("/**\n"); JSType type = fnNode.getJSType(); if (type == null || type.isUnknownType()) { return ""...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private Node inlineReturnValue(Node callNode, Node fnNode) { Node block = fnNode.getLastChild(); Node callParentNode = callNode.getParent(); // NOTE: As the normalize pass guarantees globals aren't being // shadowed and an expression can't introduce new names, ...
#vulnerable code private Node inlineReturnValue(Node callNode, Node fnNode) { Node block = fnNode.getLastChild(); Node callParentNode = callNode.getParent(); // NOTE: As the normalize pass guarantees globals aren't being // shadowed and an expression can't introduce new n...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code FunctionTypeBuilder(String fnName, AbstractCompiler compiler, Node errorRoot, String sourceName, Scope scope) { Preconditions.checkNotNull(errorRoot); this.fnName = fnName == null ? "" : fnName; this.codingConvention = compiler.getCodingConvention(); this...
#vulnerable code FunctionTypeBuilder inferThisType(JSDocInfo info, @Nullable Node owner) { ObjectType maybeThisType = null; if (info != null && info.hasThisType()) { maybeThisType = ObjectType.cast( info.getThisType().evaluate(scope, typeRegistry)); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private FlowScope traverse(Node n, FlowScope scope) { switch (n.getType()) { case Token.ASSIGN: scope = traverseAssign(n, scope); break; case Token.NAME: scope = traverseName(n, scope); break; case Token.GETPROP: s...
#vulnerable code private FlowScope traverse(Node n, FlowScope scope) { switch (n.getType()) { case Token.ASSIGN: scope = traverseAssign(n, scope); break; case Token.NAME: scope = traverseName(n, scope); break; case Token.GETPROP: ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private Node inlineReturnValue(Node callNode, Node fnNode) { Node block = fnNode.getLastChild(); Node callParentNode = callNode.getParent(); // NOTE: As the normalize pass guarantees globals aren't being // shadowed and an expression can't introduce new names, ...
#vulnerable code private Node inlineReturnValue(Node callNode, Node fnNode) { Node block = fnNode.getLastChild(); Node callParentNode = callNode.getParent(); // NOTE: As the normalize pass guarantees globals aren't being // shadowed and an expression can't introduce new n...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private UndiGraph<Var, Void> computeVariableNamesInterferenceGraph( NodeTraversal t, ControlFlowGraph<Node> cfg, Set<Var> escaped) { UndiGraph<Var, Void> interferenceGraph = LinkedUndirectedGraph.create(); // For all variables V not in unsafeCrossRange, ...
#vulnerable code private UndiGraph<Var, Void> computeVariableNamesInterferenceGraph( NodeTraversal t, ControlFlowGraph<Node> cfg, Set<Var> escaped) { UndiGraph<Var, Void> interferenceGraph = LinkedUndirectedGraph.create(); Scope scope = t.getScope(); // First cr...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Symbol getSymbolForInstancesOf(FunctionType fn) { Preconditions.checkState(fn.isConstructor() || fn.isInterface()); ObjectType pType = fn.getPrototype(); return getSymbolForName(fn.getSource(), pType.getReferenceName()); }
#vulnerable code public Symbol getSymbolForInstancesOf(FunctionType fn) { Preconditions.checkState(fn.isConstructor() || fn.isInterface()); ObjectType pType = fn.getPrototype(); String name = pType.getReferenceName(); if (name == null || globalScope == null) { return...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void enterScope(NodeTraversal t) {}
#vulnerable code @Override public void enterScope(NodeTraversal t) { Scope scope = t.getScope(); // Computes the control flow graph. ControlFlowAnalysis cfa = new ControlFlowAnalysis(compiler, false, false); cfa.process(null, scope.getRootNode()); cfgStack.push(curC...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private Node aliasAndInlineArguments( Node fnTemplateRoot, LinkedHashMap<String, Node> argMap, Set<String> namesToAlias) { if (namesToAlias == null || namesToAlias.isEmpty()) { // There are no names to alias, just inline the arguments directly. Node...
#vulnerable code private Node aliasAndInlineArguments( Node fnTemplateRoot, LinkedHashMap<String, Node> argMap, Set<String> namesToAlias) { if (namesToAlias == null || namesToAlias.isEmpty()) { // There are no names to alias, just inline the arguments directly. ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void removeUnreferencedVars() { CodingConvention convention = codingConvention; for (Iterator<Var> it = maybeUnreferenced.iterator(); it.hasNext(); ) { Var var = it.next(); // Remove calls to inheritance-defining functions where the unreferenced ...
#vulnerable code private void removeUnreferencedVars() { CodingConvention convention = compiler.getCodingConvention(); for (Iterator<Var> it = maybeUnreferenced.iterator(); it.hasNext(); ) { Var var = it.next(); // Regardless of what happens to the original declarati...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private Node aliasAndInlineArguments( Node fnTemplateRoot, LinkedHashMap<String, Node> argMap, Set<String> namesToAlias) { if (namesToAlias == null || namesToAlias.isEmpty()) { // There are no names to alias, just inline the arguments directly. Node...
#vulnerable code private Node aliasAndInlineArguments( Node fnTemplateRoot, LinkedHashMap<String, Node> argMap, Set<String> namesToAlias) { if (namesToAlias == null || namesToAlias.isEmpty()) { // There are no names to alias, just inline the arguments directly. ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static List<JSSourceFile> getDefaultExterns() throws IOException { InputStream input = CommandLineRunner.class.getResourceAsStream( "/externs.zip"); ZipInputStream zip = new ZipInputStream(input); Map<String, JSSourceFile> externsMap = Maps.newHashMap...
#vulnerable code public static List<JSSourceFile> getDefaultExterns() throws IOException { InputStream input = CommandLineRunner.class.getResourceAsStream( "/externs.zip"); ZipInputStream zip = new ZipInputStream(input); Map<String, JSSourceFile> externsMap = Maps.newH...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code AbstractCommandLineRunner() { this(System.out, System.err); }
#vulnerable code int processResults(Result result, List<JSModule> modules, B options) throws FlagUsageException, IOException { if (config.computePhaseOrdering) { return 0; } if (config.printPassGraph) { if (compiler.getRoot() == null) { return 1; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code Node tryOptimizeBlock(Node n) { // Remove any useless children for (Node c = n.getFirstChild(); c != null; ) { Node next = c.getNext(); // save c.next, since 'c' may be removed if (!mayHaveSideEffects(c)) { // TODO(johnlenz): determine what this is ...
#vulnerable code Node tryFoldFor(Node n) { Preconditions.checkArgument(n.getType() == Token.FOR); // This is not a FOR-IN loop if (n.getChildCount() != 4) { return n; } // There isn't an initializer if (n.getFirstChild().getType() != Token.EMPTY) { retu...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void outputManifest() throws IOException { List<String> outputManifests = config.outputManifests; if (outputManifests.isEmpty()) { return; } for (String outputManifest : outputManifests) { if (outputManifest.isEmpty()) { continue; ...
#vulnerable code private void outputManifest() throws IOException { String outputManifest = config.outputManifest; if (Strings.isEmpty(outputManifest)) { return; } JSModuleGraph graph = compiler.getModuleGraph(); if (shouldGenerateManifestPerModule()) { //...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private Node inlineReturnValue(Node callNode, Node fnNode) { Node block = fnNode.getLastChild(); Node callParentNode = callNode.getParent(); // NOTE: As the normalize pass guarantees globals aren't being // shadowed and an expression can't introduce new names, ...
#vulnerable code private Node inlineReturnValue(Node callNode, Node fnNode) { Node block = fnNode.getLastChild(); Node callParentNode = callNode.getParent(); // NOTE: As the normalize pass guarantees globals aren't being // shadowed and an expression can't introduce new n...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void process(Node externs, Node root) { CollectTweaksResult result = collectTweaks(root); applyCompilerDefaultValueOverrides(result.tweakInfos); boolean changed = false; if (stripTweaks) { changed = stripAllCalls(result.tweakInfos); ...
#vulnerable code @Override public void process(Node externs, Node root) { Map<String, TweakInfo> tweakInfos = collectTweaks(root); applyCompilerDefaultValueOverrides(tweakInfos); boolean changed = false; if (stripTweaks) { changed = stripAllCalls(tweakInfos); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private Node fuseIntoOneStatement(Node parent, Node first, Node last) { // Nothing to fuse if there is only one statement. if (first.getNext() == last) { return first; } // Step one: Create a comma tree that contains all the statements. Node commaTree...
#vulnerable code private Node fuseIntoOneStatement(Node parent, Node first, Node last) { // Nothing to fuse if there is only one statement. if (first == last) { return first; } // Step one: Create a comma tree that contains all the statements. Node commaTree = f...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code FunctionTypeBuilder(String fnName, AbstractCompiler compiler, Node errorRoot, String sourceName, Scope scope) { Preconditions.checkNotNull(errorRoot); this.fnName = fnName == null ? "" : fnName; this.codingConvention = compiler.getCodingConvention(); this...
#vulnerable code FunctionTypeBuilder inferReturnType(@Nullable JSDocInfo info) { if (info != null && info.hasReturnType()) { returnType = info.getReturnType().evaluate(scope, typeRegistry); returnTypeInferred = false; } return this; } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code AbstractCommandLineRunner() { this(System.out, System.err); }
#vulnerable code int processResults(Result result, List<JSModule> modules, B options) throws FlagUsageException, IOException { if (config.computePhaseOrdering) { return 0; } if (config.printPassGraph) { if (compiler.getRoot() == null) { return 1; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void ensureTyped(NodeTraversal t, Node n, JSType type) { // Make sure FUNCTION nodes always get function type. Preconditions.checkState(!n.isFunction() || type.isFunctionType() || type.isUnknownType()); // TODO(johnlenz): this seems l...
#vulnerable code private void ensureTyped(NodeTraversal t, Node n, JSType type) { // Make sure FUNCTION nodes always get function type. Preconditions.checkState(!n.isFunction() || type.isFunctionType() || type.isUnknownType()); JSDocInfo info = n.getJSD...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void outputManifest() throws IOException { List<String> outputManifests = config.outputManifests; if (outputManifests.isEmpty()) { return; } for (String outputManifest : outputManifests) { if (outputManifest.isEmpty()) { continue; ...
#vulnerable code private void outputManifest() throws IOException { String outputManifest = config.outputManifest; if (Strings.isEmpty(outputManifest)) { return; } JSModuleGraph graph = compiler.getModuleGraph(); if (shouldGenerateManifestPerModule()) { //...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public boolean isEquivalentTo(JSType otherType) { FunctionType that = JSType.toMaybeFunctionType(otherType.toMaybeFunctionType()); if (that == null) { return false; } if (this.isConstructor()) { if (that.isConstructor()) { ...
#vulnerable code @Override public boolean isEquivalentTo(JSType otherType) { if (!(otherType instanceof FunctionType)) { return false; } FunctionType that = (FunctionType) otherType; if (!that.isFunctionType()) { return false; } if (this.isConstructor...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private List<JSSourceFile> getDefaultExterns() { try { return CommandLineRunner.getDefaultExterns(); } catch (IOException e) { throw new BuildException(e); } }
#vulnerable code private List<JSSourceFile> getDefaultExterns() { try { InputStream input = Compiler.class.getResourceAsStream( "/externs.zip"); ZipInputStream zip = new ZipInputStream(input); List<JSSourceFile> externs = Lists.newLinkedList(); for (...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Symbol getSymbolDeclaredBy(FunctionType fn) { Preconditions.checkState(fn.isConstructor() || fn.isInterface()); ObjectType instanceType = fn.getInstanceType(); return getSymbolForName(fn.getSource(), instanceType.getReferenceName()); }
#vulnerable code public Symbol getSymbolDeclaredBy(FunctionType fn) { Preconditions.checkState(fn.isConstructor() || fn.isInterface()); ObjectType instanceType = fn.getInstanceType(); String name = instanceType.getReferenceName(); if (name == null || globalScope == null) {...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void toDebugString(StringBuilder builder, Symbol symbol) { SymbolScope scope = symbol.scope; if (scope.isGlobalScope()) { builder.append( String.format("'%s' : in global scope:\n", symbol.getName())); } else if (scope.getRootNode() != null) {...
#vulnerable code private void toDebugString(StringBuilder builder, Symbol symbol) { SymbolScope scope = symbol.scope; if (scope.isGlobalScope()) { builder.append( String.format("'%s' : in global scope:\n", symbol.getName())); } else { builder.append( ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void setSqlSource(MappedStatement ms) { MapperTemplate mapperTemplate = getMapperTemplate(ms.getId()); try { if (mapperTemplate != null) { mapperTemplate.setSqlSource(ms); } } catch (Exception e) { ...
#vulnerable code public void setSqlSource(MappedStatement ms) { MapperTemplate mapperTemplate = getMapperTemplate(ms.getId()); try { mapperTemplate.setSqlSource(ms); } catch (Exception e) { throw new RuntimeException("调用方法异常:" + e.getMessa...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected String read(InputStream inputStream) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, encoding)); StringBuffer stringBuffer = new StringBuffer(); String line = reader.readLine(); while...
#vulnerable code protected String read(InputStream inputStream) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); StringBuffer stringBuffer = new StringBuffer(); String line = reader.readLine(); while (li...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(String[] args) { example(); }
#vulnerable code public static void main(String[] args) { @SuppressWarnings("resource") ApplicationContext context = new ClassPathXmlApplicationContext("exampleContext.xml"); SpringCacheExample example = context.getBean(SpringCacheExample.class); example.getBook(0); example.getBo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(String[] args) { example(); }
#vulnerable code public static void main(String[] args) { Cache<Integer, Integer> cache = CacheBuilder.transactionalHeapCache() .transactionCommitter(new TransactionCommitter<Integer, Integer>() { int counter = 0; public void doPut(Integer key, Integer value) { if (c...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(String[] args) { example(); }
#vulnerable code public static void main(String[] args) { @SuppressWarnings({ "resource", "unused" }) ApplicationContext context = new ClassPathXmlApplicationContext("exampleContext.xml"); } #location 3 #vulnerability type RESO...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(String[] args) { example(); }
#vulnerable code public static void main(String[] args) { Cache<Integer, Integer> cache = CacheBuilder.transactionalHeapCache() .transactionCommitter(new TransactionCommitter<Integer, Integer>() { int counter = 0; public void doPut(Integer key, Integer value) { if (c...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code static void installDependencies(PrintStream logger, Launcher launcher, AndroidSdk sdk, EmulatorConfig emuConfig) throws IOException, InterruptedException { // Get AVD platform from emulator config String platform = getPlatformForEmulator(launcher, ...
#vulnerable code static void installDependencies(PrintStream logger, Launcher launcher, AndroidSdk sdk, EmulatorConfig emuConfig) throws IOException, InterruptedException { // Get AVD platform from emulator config String platform = getPlatformForEmulator(laun...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void writeAvdConfigFile(File homeDir, Map<String,String> values) throws IOException { final File configFile = getAvdConfigFile(homeDir); ConfigFileUtils.writeConfigFile(configFile, values); }
#vulnerable code private void writeAvdConfigFile(File homeDir, Map<String,String> values) throws FileNotFoundException { StringBuilder sb = new StringBuilder(); for (String key : values.keySet()) { sb.append(key); sb.append("="); sb.a...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testTargetName() { assertEquals("Some:Addon:11", AndroidPlatform.valueOf("Some:Addon:11").getTargetName()); assertEquals("Google Inc.:Google APIs:23", AndroidPlatform.valueOf("Google Inc.:Google APIs:23").getTargetName()); assertE...
#vulnerable code @Test public void testTargetName() { assertEquals("Google Inc.:Google APIs:23", AndroidPlatform.valueOf("Google Inc.:Google APIs:23").getTargetName()); assertEquals("Google Inc.:Google APIs:24", AndroidPlatform.valueOf("Google Inc.:Google APIs:24").g...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSystemImageName() { assertEquals("sys-img-x86-android-23", AndroidPlatform.valueOf("android-23").getSystemImageName("x86")); assertEquals("sys-img-x86-google_apis-23", AndroidPlatform.valueOf("Google Inc.:Google APIs:23").getSystemIma...
#vulnerable code @Test public void testSystemImageName() { assertEquals("sys-img-x86-android-23", AndroidPlatform.valueOf("Google Inc.:Google APIs:23").getSystemImageName("x86")); assertEquals("sys-img-x86-android-24", AndroidPlatform.valueOf("Google Inc.:Google APIs...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void determinesItemBSourceSetter() { Target target = new Target(); target.setKeyOfAllBeings( new KeyOfAllBeings() ); Child source = new Child(); GenericsHierarchyMapper.INSTANCE.updateSourceWithKeyOfAllBeings( target, source ...
#vulnerable code @Test public void determinesItemBSourceSetter() { Target target = new Target(); target.setItemB( new ItemB() ); SourceWithItemB source = new SourceWithItemB(); GenericsHierarchyMapper.INSTANCE.intoSourceWithItemB( target, source ); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public boolean isIterableMapping() { return getSingleSourceParameter().getType().isIterableType() && getResultType().isIterableType(); }
#vulnerable code public boolean isIterableMapping() { return getSingleSourceType().isIterableType() && resultType.isIterableType(); } #location 2 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private Mapping getMapping(MappingPrism mapping) { return new Mapping( mapping.source(), mapping.target() ); }
#vulnerable code private Mapping getMapping(MappingPrism mapping) { Type converterType = typeUtil.retrieveType( mapping.converter() ); return new Mapping( mapping.source(), mapping.target(), converterType.getName().equals( "NoOpConverter" ) ? null : converterType ); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private List<MappedProperty> getMappedProperties(ExecutableElement method, Map<String, Mapping> mappings) { TypeElement returnTypeElement = (TypeElement) typeUtils.asElement( method.getReturnType() ); TypeElement parameterElement = (TypeElement) typeUtils.asEl...
#vulnerable code private List<MappedProperty> getMappedProperties(ExecutableElement method, Map<String, Mapping> mappings) { Element returnTypeElement = typeUtils.asElement( method.getReturnType() ); Element parameterElement = typeUtils.asElement( method.getParameters()....
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public boolean process( final Set<? extends TypeElement> annotations, final RoundEnvironment roundEnvironment) { for ( TypeElement oneAnnotation : annotations ) { //Indicates that the annotation's type isn't on the class path of the compiled //project....
#vulnerable code @Override public boolean process( final Set<? extends TypeElement> annotations, final RoundEnvironment roundEnvironment) { for ( TypeElement oneAnnotation : annotations ) { //Indicates that the annotation's type isn't on the class path of the compiled //pr...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Mapper process(ProcessorContext context, TypeElement mapperTypeElement, Mapper mapper) { String componentModel = MapperPrism.getInstanceOn( mapperTypeElement ).componentModel(); String effectiveComponentModel = OptionsHelper.getEffectiveCo...
#vulnerable code @Override public Mapper process(ProcessorContext context, TypeElement mapperTypeElement, Mapper mapper) { String componentModel = MapperPrism.getInstanceOn( mapperTypeElement ).componentModel(); if ( !componentModel.equals( "cdi" ) ) { r...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private List<MappedProperty> getMappedProperties(ExecutableElement method, Map<String, Mapping> mappings) { TypeElement returnTypeElement = (TypeElement) typeUtils.asElement( method.getReturnType() ); TypeElement parameterElement = (TypeElement) typeUtils.asEl...
#vulnerable code private List<MappedProperty> getMappedProperties(ExecutableElement method, Map<String, Mapping> mappings) { Element returnTypeElement = typeUtils.asElement( method.getReturnType() ); Element parameterElement = typeUtils.asElement( method.getParameters()....
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private List<Method> retrieveMethods(TypeElement element, boolean implementationRequired) { List<Method> methods = new ArrayList<Method>(); MapperPrism mapperPrism = implementationRequired ? MapperPrism.getInstanceOn( element ) : null; for ( Executab...
#vulnerable code private List<Method> retrieveMethods(TypeElement element, boolean implementationRequired) { List<Method> methods = new ArrayList<Method>(); MapperPrism mapperPrism = implementationRequired ? MapperPrism.getInstanceOn( element ) : null; //TODO E...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private PropertyMapping getPropertyMapping(List<MapperReference> mapperReferences, List<Method> methods, Method method, Parameter parameter, ExecutableElement sourceAccessor, Executa...
#vulnerable code private PropertyMapping getPropertyMapping(List<MapperReference> mapperReferences, List<Method> methods, Method method, Parameter parameter, ExecutableElement sourceAccessor, E...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public boolean isMapMapping() { return getSingleSourceParameter().getType().isMapType() && getResultType().isMapType(); }
#vulnerable code public boolean isMapMapping() { return getSingleSourceType().isMapType() && resultType.isMapType(); } #location 2 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void deleteDirectory(File path) { if ( path.exists() ) { File[] files = path.listFiles(); for ( File file : files ) { if ( file.isDirectory() ) { deleteDirectory( file ); } ...
#vulnerable code private void deleteDirectory(File path) { if ( path.exists() ) { File[] files = path.listFiles(); for ( int i = 0; i < files.length; i++ ) { if ( files[i].isDirectory() ) { deleteDirectory( files[i] ); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private List<Method> retrieveMethods(TypeElement element, boolean mapperRequiresImplementation) { List<Method> methods = new ArrayList<Method>(); for ( ExecutableElement executable : methodsIn( element.getEnclosedElements() ) ) { Method method = g...
#vulnerable code private List<Method> retrieveMethods(TypeElement element, boolean mapperRequiresImplementation) { List<Method> methods = new ArrayList<Method>(); MapperPrism mapperPrism = mapperRequiresImplementation ? MapperPrism.getInstanceOn( element ) : null; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private List<MappedProperty> getMappedProperties(ExecutableElement method, Map<String, Mapping> mappings) { TypeElement returnTypeElement = (TypeElement) typeUtils.asElement( method.getReturnType() ); TypeElement parameterElement = (TypeElement) typeUtils.asEl...
#vulnerable code private List<MappedProperty> getMappedProperties(ExecutableElement method, Map<String, Mapping> mappings) { TypeElement returnTypeElement = (TypeElement) typeUtils.asElement( method.getReturnType() ); TypeElement parameterElement = (TypeElement) typeUtil...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void determinesItemCSourceSetter() { Target target = new Target(); target.setAnimalKey( new AnimalKey() ); Elephant source = new Elephant(); GenericsHierarchyMapper.INSTANCE.updateSourceWithAnimalKey( target, source ); ...
#vulnerable code @Test public void determinesItemCSourceSetter() { Target target = new Target(); target.setItemC( new ItemC() ); SourceWithItemC source = new SourceWithItemC(); GenericsHierarchyMapper.INSTANCE.intoSourceWithItemC( target, source ); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private MappingMethod getBeanMappingMethod(List<Method> methods, Method method, ReportingPolicy unmappedTargetPolicy) { List<PropertyMapping> propertyMappings = new ArrayList<PropertyMapping>(); Set<String> mapped...
#vulnerable code private MappingMethod getBeanMappingMethod(List<Method> methods, Method method, ReportingPolicy unmappedTargetPolicy) { List<PropertyMapping> propertyMappings = new ArrayList<PropertyMapping>(); Set<String> ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public boolean matches() { // check & collect generic types. List<? extends VariableElement> candidateParameters = candidateMethod.getExecutable().getParameters(); if ( candidateParameters.size() != 1 ) { typesMatch = false; } ...
#vulnerable code public boolean matches() { // check & collect generic types. List<? extends VariableElement> candidateParameters = candidateMethod.getExecutable().getParameters(); if ( candidateParameters.size() == parameters.length ) { for ( int i ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private PropertyMapping getConstantMapping(List<MapperReference> mapperReferences, List<SourceMethod> methods, SourceMethod method, Str...
#vulnerable code private PropertyMapping getConstantMapping(List<MapperReference> mapperReferences, List<SourceMethod> methods, SourceMethod method, ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void reportErrorIfPropertyCanNotBeMapped(Method method, PropertyMapping property) { if ( property.getSourceType().isAssignableTo( property.getTargetType() ) || property.getMappingMethod() != null || property.getConversion() != null || ...
#vulnerable code private void reportErrorIfPropertyCanNotBeMapped(Method method, PropertyMapping property) { if ( property.getSourceType().equals( property.getTargetType() ) || property.getMappingMethod() != null || property.getConversion() != null || ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private List<MappedProperty> getMappedProperties(ExecutableElement method, Map<String, Mapping> mappings) { TypeElement returnTypeElement = (TypeElement) typeUtils.asElement( method.getReturnType() ); TypeElement parameterElement = (TypeElement) typeUtils.asEl...
#vulnerable code private List<MappedProperty> getMappedProperties(ExecutableElement method, Map<String, Mapping> mappings) { TypeElement returnTypeElement = (TypeElement) typeUtils.asElement( method.getReturnType() ); TypeElement parameterElement = (TypeElement) typeUtil...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private PropertyMapping getPropertyMapping(List<MapperReference> mapperReferences, List<SourceMethod> methods, SourceMethod method, Par...
#vulnerable code private PropertyMapping getPropertyMapping(List<MapperReference> mapperReferences, List<SourceMethod> methods, SourceMethod method, ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private Type getType(TypeMirror mirror, boolean isLiteral) { if ( !canBeProcessed( mirror ) ) { throw new TypeHierarchyErroneousException( mirror ); } ImplementationType implementationType = getImplementationType( mirror ); boolea...
#vulnerable code private Type getType(TypeMirror mirror, boolean isLiteral) { if ( !canBeProcessed( mirror ) ) { throw new TypeHierarchyErroneousException( mirror ); } ImplementationType implementationType = getImplementationType( mirror ); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private List<MappedProperty> getMappedProperties(ExecutableElement method, Map<String, Mapping> mappings) { Element returnTypeElement = typeUtils.asElement( method.getReturnType() ); Element parameterElement = typeUtils.asElement( method.getParameters().get( 0 ).asType() ); ...
#vulnerable code private List<MappedProperty> getMappedProperties(ExecutableElement method, Map<String, Mapping> mappings) { Element returnTypeElement = typeUtils.asElement( method.getReturnType() ); Element parameterElement = typeUtils.asElement( method.getParameters().get( 0 ).asType...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private static Object getValue(final V8Array array, final int index, final V8Map<Object> cache) { int valueType = array.getType(index); switch (valueType) { case V8Value.INTEGER: return array.getInteger(index); case V8Va...
#vulnerable code private static Object getValue(final V8Array array, final int index, final V8Map<Object> cache) { int valueType = array.getType(index); switch (valueType) { case V8Value.INTEGER: return array.getInteger(index); cas...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static V8 createV8Runtime(final String globalAlias, final String tempDirectory) { if (!nativeLibraryLoaded) { synchronized (lock) { if (!nativeLibraryLoaded) { load(tempDirectory); } } ...
#vulnerable code public static V8 createV8Runtime(final String globalAlias, final String tempDirectory) { if (!nativeLibraryLoaded) { synchronized (lock) { if (!nativeLibraryLoaded) { load(tempDirectory); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void release(final boolean reportMemoryLeaks) { if (isReleased()) { return; } checkThread(); releaseResources(); shutdownExecutors(forceTerminateExecutors); if (executors != null) { executors.clear...
#vulnerable code public void release(final boolean reportMemoryLeaks) { if (isReleased()) { return; } checkThread(); if (debugEnabled) { disableDebugSupport(); } releaseResources(); shutdownExecutors(forceTe...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void release(final boolean reportMemoryLeaks) { checkThread(); if (isReleased()) { return; } if (debugEnabled) { disableDebugSupport(); } synchronized (lock) { runtimeCounter--; ...
#vulnerable code public void release(final boolean reportMemoryLeaks) { checkThread(); if (isReleased()) { return; } if (debugEnabled) { disableDebugSupport(); } runtimeCounter--; _releaseRuntime(v8RuntimePt...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private static Object getValue(final V8Object object, final String key, final V8Map<Object> cache) { int valueType = object.getType(key); switch (valueType) { case V8Value.INTEGER: return object.getInteger(key); case V8V...
#vulnerable code private static Object getValue(final V8Object object, final String key, final V8Map<Object> cache) { int valueType = object.getType(key); switch (valueType) { case V8Value.INTEGER: return object.getInteger(key); ca...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static V8 createV8Runtime(final String globalAlias, final String tempDirectory) { if (!nativeLibraryLoaded) { synchronized (lock) { if (!nativeLibraryLoaded) { load(tempDirectory); } } ...
#vulnerable code public static V8 createV8Runtime(final String globalAlias, final String tempDirectory) { if (!nativeLibraryLoaded) { synchronized (lock) { if (!nativeLibraryLoaded) { load(tempDirectory); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private static Object getValue(final V8Array array, final int index, final V8Map<Object> cache) { int valueType = array.getType(index); switch (valueType) { case V8Value.INTEGER: return array.getInteger(index); case V8Va...
#vulnerable code private static Object getValue(final V8Array array, final int index, final V8Map<Object> cache) { int valueType = array.getType(index); switch (valueType) { case V8Value.INTEGER: return array.getInteger(index); cas...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void release(final boolean reportMemoryLeaks) { if (isReleased()) { return; } checkThread(); try { notifyReleaseHandlers(this); } finally { releaseResources(); shutdownExecutors(for...
#vulnerable code public void release(final boolean reportMemoryLeaks) { if (isReleased()) { return; } checkThread(); try { notifyReleaseHandlers(this); } finally { releaseResources(); shutdownExecuto...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private static Object getValue(final V8Array array, final int index, final V8Map<Object> cache) { int valueType = array.getType(index); switch (valueType) { case V8Value.INTEGER: return array.getInteger(index); case V8Va...
#vulnerable code private static Object getValue(final V8Array array, final int index, final V8Map<Object> cache) { int valueType = array.getType(index); switch (valueType) { case V8Value.INTEGER: return array.getInteger(index); cas...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testTypedArrayGetValue_Float32Array() { V8Array floatsArray = v8.executeArrayScript("var buf = new ArrayBuffer(100);\n" + "var floatsArray = new Float32Array(buf);\n" + "floatsArray[0] = 16.2;\n" + ...
#vulnerable code @Test public void testTypedArrayGetValue_Float32Array() { V8Array floatsArray = v8.executeArrayScript("var buf = new ArrayBuffer(100);\n" + "var floatsArray = new Float32Array(buf);\n" + "floatsArray[0] = 16.2;\n" ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private static Object getValue(final V8Object object, final String key, final V8Map<Object> cache) { int valueType = object.getType(key); switch (valueType) { case V8Value.INTEGER: return object.getInteger(key); case V8V...
#vulnerable code private static Object getValue(final V8Object object, final String key, final V8Map<Object> cache) { int valueType = object.getType(key); switch (valueType) { case V8Value.INTEGER: return object.getInteger(key); ca...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void release(final boolean reportMemoryLeaks) { if (isReleased()) { return; } checkThread(); releaseResources(); shutdownExecutors(forceTerminateExecutors); if (executors != null) { executors.clear...
#vulnerable code public void release(final boolean reportMemoryLeaks) { if (isReleased()) { return; } checkThread(); if (debugEnabled) { disableDebugSupport(); } releaseResources(); shutdownExecutors(forceTe...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testTypedArrayGetValue_Float64Array() { V8Array floatsArray = v8.executeArrayScript("var buf = new ArrayBuffer(80);\n" + "var floatsArray = new Float64Array(buf);\n" + "floatsArray[0] = 16.2;\n" + "...
#vulnerable code @Test public void testTypedArrayGetValue_Float64Array() { V8Array floatsArray = v8.executeArrayScript("var buf = new ArrayBuffer(80);\n" + "var floatsArray = new Float64Array(buf);\n" + "floatsArray[0] = 16.2;\n" ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private static Object getValue(final V8Object object, final String key, final V8Map<Object> cache) { int valueType = object.getType(key); switch (valueType) { case V8Value.INTEGER: return object.getInteger(key); case V8V...
#vulnerable code private static Object getValue(final V8Object object, final String key, final V8Map<Object> cache) { int valueType = object.getType(key); switch (valueType) { case V8Value.INTEGER: return object.getInteger(key); ca...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public boolean enableDebugSupport(final int port, final boolean waitForConnection) { V8.checkDebugThread(); debugEnabled = enableDebugSupport(getV8RuntimePtr(), port, waitForConnection); return debugEnabled; }
#vulnerable code public boolean enableDebugSupport(final int port, final boolean waitForConnection) { V8.checkDebugThread(); debugEnabled = enableDebugSupport(getHandle(), port, waitForConnection); return debugEnabled; } #location...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public CommandLine parse(final String[] args) throws ParseException, IllegalArgumentException { final CommandLine cmd = super.parse(args); final String[] files = cmd.getArgs(); if (files.length > 1) { throw new IllegalArgumentException("Only one dump file path may be ...
#vulnerable code public CommandLine parse(final String[] args) throws ParseException, IllegalArgumentException { final CommandLine cmd = super.parse(args); final Report report = ReportFactory.createReport(cmd, ReportType.REDIS); ExtractionResult match = null; if (cmd.hasOption("r...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @SuppressWarnings("unchecked") @Override public void run() { // restart the clock. this.rowMerger = new RowMerger(rowObserver); adapter = new CallToStreamObserverAdapter(); synchronized (callLock) { super.run(); // pre-fetch one more result, for ...
#vulnerable code @SuppressWarnings("unchecked") @Override public void run() { // restart the clock. lastResponseMs = clock.currentTimeMillis(); this.rowMerger = new RowMerger(rowObserver); synchronized (callLock) { super.run(); // pre-fetch one more result,...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @SuppressWarnings("unchecked") @Test public void testMutation() throws IOException, InterruptedException { when(mockClient.mutateRowAsync(any(MutateRowRequest.class))) .thenReturn(mockFuture); BigtableBufferedMutator underTest = createMutator(new Configurati...
#vulnerable code @SuppressWarnings("unchecked") @Test public void testMutation() throws IOException, InterruptedException { final ReentrantLock lock = new ReentrantLock(); final Condition mutateRowAsyncCalled = lock.newCondition(); when(mockClient.mutateRowAsync(any(Mutate...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static Credentials getCredentialFromPrivateKeyServiceAccount( String serviceAccountEmail, String privateKeyFile, List<String> scopes) throws IOException, GeneralSecurityException { PrivateKey privateKey = SecurityUtils.loadPrivateKeyFromKeyStore(...
#vulnerable code public static Credentials getCredentialFromPrivateKeyServiceAccount( String serviceAccountEmail, String privateKeyFile, List<String> scopes) throws IOException, GeneralSecurityException { PrivateKey privateKey = SecurityUtils.loadPrivateKeyFromKey...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testRefresh() throws IOException { Mockito.when(mockCredentials.refreshAccessToken()).thenReturn( new AccessToken("", new Date(HeaderCacheElement.TOKEN_STALENESS_MS + 1))); underTest = new RefreshingOAuth2CredentialsInterceptor(MoreExecutors....
#vulnerable code @Test public void testRefresh() throws IOException { Mockito.when(credentials.refreshAccessToken()).thenReturn( new AccessToken("", new Date(HeaderCacheElement.TOKEN_STALENESS_MS + 1))); underTest = new RefreshingOAuth2CredentialsInterceptor(MoreExecutor...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test /** * Test that checks that concurrent requests to RefreshingOAuth2CredentialsInterceptor refresh * logic doesn't cause hanging behavior. Specifically, when an Expired condition occurs it * triggers a call to syncRefresh() which potentially waits for refresh ...
#vulnerable code @Test /** * Test that checks that concurrent requests to RefreshingOAuth2CredentialsInterceptor refresh * logic doesn't cause hanging behavior. Specifically, when an Expired condition occurs it * triggers a call to syncRefresh() which potentially waits for re...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test /** * Test that checks that concurrent requests to RefreshingOAuth2CredentialsInterceptor refresh * logic doesn't cause hanging behavior. Specifically, when an Expired condition occurs it * triggers a call to syncRefresh() which potentially waits for refresh ...
#vulnerable code @Test /** * Test that checks that concurrent requests to RefreshingOAuth2CredentialsInterceptor refresh * logic doesn't cause hanging behavior. Specifically, when an Expired condition occurs it * triggers a call to syncRefresh() which potentially waits for re...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCBC_UserAgentUsingPlainTextNegotiation() throws Exception{ ServerSocket serverSocket = new ServerSocket(0); final int availablePort = serverSocket.getLocalPort(); serverSocket.close(); //Creates non-ssl server. createServer(available...
#vulnerable code @Test public void testCBC_UserAgentUsingPlainTextNegotiation() throws Exception{ ServerSocket serverSocket = new ServerSocket(0); final int availablePort = serverSocket.getLocalPort(); serverSocket.close(); //Creates non-ssl server. createServer(ava...
Below is the vulnerable code, please generate the patch based on the following information.