input stringlengths 205 73.3k | output stringlengths 64 73.2k | instruction stringclasses 1
value |
|---|---|---|
#vulnerable code
@Test
public void acceptRequestAndRedirectOnPost() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
MatcherAssert.assertThat(
new TkApp(farm).act(
new RqWithBody(
new RqWithUser.WithIni... | #fixed code
@Test
public void acceptRequestAndRedirectOnPost() throws Exception {
final Farm farm = FkFarm.props();
MatcherAssert.assertThat(
new TkApp(farm).act(
new RqWithBody(
new RqWithUser.WithInit(
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public boolean hasLink(final String pid, final String rel,
final String href) throws IOException {
if (!this.exists(pid)) {
throw new IllegalArgumentException(
new Par(
"Project %s doesn't exist, can't chec... | #fixed code
public boolean hasLink(final String pid, final String rel,
final String href) throws IOException {
this.checkExist(pid);
try (final Item item = this.item()) {
return !new Xocument(item.path()).nodes(
String.format(
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public Cash fee(final String pid) throws IOException {
if (!this.exists(pid)) {
throw new IllegalArgumentException(
new Par(
"Project %s doesn't exist, can't get fee"
).say(pid)
);
... | #fixed code
public Cash fee(final String pid) throws IOException {
this.checkExist(pid);
try (final Item item = this.item()) {
final Iterator<String> fees = new Xocument(item.path()).xpath(
String.format("/catalog/project[@id='%s']/fee/text()",... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void parsesJson() throws Exception {
MatcherAssert.assertThat(
new TkGithub(
new PropsFarm(),
new Rebound.Fake("nothing")
).act(
new RqWithBody(
new RqFa... | #fixed code
@Test
public void parsesJson() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final Take take = new TkGithub(
farm, (frm, github, event) -> "nothing"
);
MatcherAssert.assertThat(
take.act(
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersHtmlAwardsPageForFirefox() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final String user = "yegor256";
final int points = 1234;
new Awards(farm, user).bootstrap()
.add(new FkP... | #fixed code
@Test
public void rendersHtmlAwardsPageForFirefox() throws Exception {
final Farm farm = FkFarm.props();
final String user = "yegor256";
final int points = 1234;
new Awards(farm, user).bootstrap()
.add(new FkProject(), points, "... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void retrievesProps() throws Exception {
MatcherAssert.assertThat(
new Props(new PropsFarm(new FkFarm())).get("/props/testing"),
Matchers.equalTo("yes")
);
}
#location 3
... | #fixed code
@Test
public void retrievesProps() throws Exception {
MatcherAssert.assertThat(
new Props(FkFarm.props()).get("/props/testing"),
Matchers.equalTo("yes")
);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void fee(final String pid, final Cash fee) throws IOException {
if (!this.exists(pid)) {
throw new IllegalArgumentException(
new Par(
"Project %s doesn't exist, can't set fee"
).say(pid)
... | #fixed code
public void fee(final String pid, final Cash fee) throws IOException {
this.checkExist(pid);
try (final Item item = this.item()) {
new Xocument(item.path()).modify(
new Directives().xpath(
String.format("/catalog... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void givesBonus() throws Exception {
final FkProject project = new FkProject();
final FkFarm farm = new FkFarm(project);
final Speed speed = new Speed(farm, "amihaiemil").bootstrap();
final String job = "gh:bonus/fast#1";... | #fixed code
@Test
public void givesBonus() throws Exception {
final Speed speed = new Speed(
new FkFarm(new FkProject()), "amihaiemil"
).bootstrap();
final String job = "gh:bonus/fast#1";
speed.add("TST100006", job, Duration.ofDays(1).toMin... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void parsesJson() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final Take take = new TkGithub(
farm, (frm, github, event) -> "nothing"
);
MatcherAssert.assertThat(
take.act(
... | #fixed code
@Test
public void parsesJson() throws Exception {
MatcherAssert.assertThat(
new TkGithub(
new PropsFarm(),
new Rebound.Fake("nothing")
).act(
new RqWithBody(
new RqFake("PO... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rejectsIfAlreadyApplied() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final People people = new People(farm).bootstrap();
final String uid = "yegor256";
people.touch(uid);
people.apply(u... | #fixed code
@Test
public void rejectsIfAlreadyApplied() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final People people = new People(farm).bootstrap();
final String uid = "yegor256";
people.touch(uid);
people.apply(uid, In... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void registerImpediment() throws Exception {
final Project project = new FkProject();
final Impediments imp = new Impediments(new PropsFarm(), project)
.bootstrap();
final String job = "gh:test/test#1";
new Wb... | #fixed code
@Test
public void registerImpediment() throws Exception {
final Project project = new FkProject();
final Impediments imp = new Impediments(new PropsFarm(), project)
.bootstrap();
final String job = "gh:test/test#1";
new Wbs(proj... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void setsSpeed() throws Exception {
final FkFarm farm = new FkFarm(new FkProject());
final People people = new People(farm).bootstrap();
final String uid = "speed";
people.invite(uid, uid);
final double speed = 5.... | #fixed code
@Test
public void setsSpeed() throws Exception {
final People people =
new People(new FkFarm(new FkProject())).bootstrap();
final String uid = "speed";
people.invite(uid, uid);
final double speed = 5.5;
people.speed(uid,... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public int reputation(final String uid) throws IOException {
if (!this.exists(uid)) {
throw new IllegalArgumentException(
new Par("Person @%s doesn't exist").say(uid)
);
}
try (final Item item = this.item()... | #fixed code
public int reputation(final String uid) throws IOException {
this.checkExisting(uid);
try (final Item item = this.item()) {
return new NumberOf(
new Xocument(item.path()).xpath(
String.format(
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void estimatesJobs() throws Exception {
final Project project = new FkProject();
final PropsFarm farm = new PropsFarm();
new Ledger(farm, project).bootstrap().add(
new Ledger.Transaction(
new Cash.S("$... | #fixed code
@Test
public void estimatesJobs() throws Exception {
final Project project = new FkProject();
final PropsFarm farm = new PropsFarm();
new Ledger(farm, project).bootstrap().add(
new Ledger.Transaction(
new Cash.S("$500"),... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public String title(final String pid) throws IOException {
if (!this.exists(pid)) {
throw new IllegalArgumentException(
new Par(
"Project %s doesn't exist, can't get title"
).say(pid)
);... | #fixed code
public String title(final String pid) throws IOException {
this.checkExist(pid);
try (final Item item = this.item()) {
final Iterator<String> items = new Xocument(item.path())
.xpath(
String.format(
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void acceptsRelease() throws Exception {
final int id = 1;
final String tag = "0.0.1";
MatcherAssert.assertThat(
new RbRelease().react(
new FkFarm(),
new MkGithub(),
Jso... | #fixed code
@Test
public void acceptsRelease() throws Exception {
final int id = 1;
final String tag = "0.0.1";
final Farm farm = new PropsFarm();
final Github github = new MkGithub().relogin("test");
github.repos().create(new Repos.RepoCreate(... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void recordsChangesToClaims() throws Exception {
final Bucket bucket = new FkBucket(
Files.createTempDirectory("").toFile(),
"the-bucket"
);
try (final FakeMongo mongo = new FakeMongo().start()) {
... | #fixed code
@Test
public void recordsChangesToClaims() throws Exception {
final Bucket bucket = new FkBucket(
Files.createTempDirectory("").toFile(),
"the-bucket"
);
final Farm farm = new SyncFarm(
new FtFarm(new PropsFarm(n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void reactsToMessage() throws Exception {
final Reaction reaction = Mockito.mock(Reaction.class);
new TkViber(new FkFarm(), reaction).act(
new RqWithBody(
new RqFake("POST", "/"),
new TextOf(
... | #fixed code
@Test
public void reactsToMessage() throws Exception {
final Reaction reaction = Mockito.mock(Reaction.class);
final FkFarm farm = new FkFarm();
final VbBot bot = new VbBot();
final String callback = new TextOf(
TkViberTest.clas... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rejectsIfAlreadyApplied() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final People people = new People(farm).bootstrap();
final String uid = "yegor256";
people.touch(uid);
people.apply(u... | #fixed code
@Test
public void rejectsIfAlreadyApplied() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final People people = new People(farm).bootstrap();
final String uid = "yegor256";
people.touch(uid);
people.apply(uid, In... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@SuppressWarnings("unchecked")
public void exec() throws IOException {
final Props props = new Props();
if (props.has("//testing")) {
throw new IllegalStateException(
"Hey, we are in the testing mode!"
);
... | #fixed code
@SuppressWarnings("unchecked")
public void exec() throws IOException {
final Props props = new Props();
if (props.has("//testing")) {
throw new IllegalStateException(
"Hey, we are in the testing mode!"
);
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rejectsIfAlreadyApplied() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final People people = new People(farm).bootstrap();
final String uid = "yegor256";
people.touch(uid);
people.apply(u... | #fixed code
@Test
public void rejectsIfAlreadyApplied() throws Exception {
final Farm farm = FkFarm.props();
final People people = new People(farm).bootstrap();
final String uid = "yegor256";
people.touch(uid);
people.apply(uid, Instant.now());... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rejectsIfAlreadyApplied() throws Exception {
final Farm farm = FkFarm.props();
final People people = new People(farm).bootstrap();
final String uid = "yegor256";
people.touch(uid);
people.apply(uid, Instant.n... | #fixed code
@Test
public void rejectsIfAlreadyApplied() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final People people = new People(farm).bootstrap();
final String uid = "yegor256";
people.touch(uid);
people.apply(uid, In... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersListOfClaims() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final Catalog catalog = new Catalog(new Pmo(farm)).bootstrap();
final String pid = "A1B2C3D4F";
catalog.add(pid, String.format("... | #fixed code
@Test
public void rendersListOfClaims() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
MatcherAssert.assertThat(
XhtmlMatchers.xhtml(
new RsPrint(
new TkApp(farm).act(
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void parsesJson() throws Exception {
MatcherAssert.assertThat(
new TkGithub(
new PropsFarm(),
new Rebound.Fake("nothing")
).act(
new RqWithBody(
new RqFa... | #fixed code
@Test
public void parsesJson() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final Take take = new TkGithub(
farm, (frm, github, event) -> "nothing"
);
MatcherAssert.assertThat(
take.act(
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersAgendaPage() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final String uid = "yegor256";
final People people = new People(farm).bootstrap();
people.touch(uid);
people.invite(uid, "... | #fixed code
@Test
public void rendersAgendaPage() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
MatcherAssert.assertThat(
XhtmlMatchers.xhtml(
new RsPrint(
new TkApp(farm).act(
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void jobs(final String uid, final int jobs)
throws IOException {
if (!this.exists(uid)) {
throw new IllegalArgumentException(
new Par("Person @%s doesn't exist").say(uid)
);
}
try (final Item... | #fixed code
public void jobs(final String uid, final int jobs)
throws IOException {
this.checkExisting(uid);
try (final Item item = this.item()) {
new Xocument(item.path()).modify(
new Directives().xpath(
String.form... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public Response act(final RqRegex req) throws IOException {
final Project project = new RqProject(this.farm, req, "PO");
final RqFormSmart form = new RqFormSmart(new RqGreedy(req));
final String email = form.single("email");
... | #fixed code
@Override
public Response act(final RqRegex req) throws IOException {
final Project project = new RqProject(this.farm, req, "PO");
final RqFormSmart form = new RqFormSmart(new RqGreedy(req));
final String email = form.single("email");
final... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public String pay(final String target, final Cash amount,
final String details) throws IOException {
if (amount.compareTo(new Cash.S("$20")) < 0) {
throw new SoftException(
new Par(
"The amoun... | #fixed code
@Override
public String pay(final String target, final Cash amount,
final String details) throws IOException {
final Props props = new Props(this.farm);
final AdaptivePaymentsService service = new AdaptivePaymentsService(
new SolidMap<S... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void removesOrder() throws Exception {
final Project project = new FkProject();
final Orders orders = new Orders(new PropsFarm(), project).bootstrap();
final String job = "gh:yegor256/0pdd#13";
new Wbs(project).bootstrap(... | #fixed code
@Test
public void removesOrder() throws Exception {
final Project project = new FkProject();
final Orders orders = new Orders(new PropsFarm(), project).bootstrap();
final String job = "gh:yegor256/0pdd#13";
new Wbs(project).bootstrap().add(... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void acceptRequestAndRedirectOnPost() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
MatcherAssert.assertThat(
new TkApp(farm).act(
new RqWithBody(
new RqWithUser(
... | #fixed code
@Test
public void acceptRequestAndRedirectOnPost() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
MatcherAssert.assertThat(
new TkApp(farm).act(
new RqWithBody(
new RqWithUser.WithInit(
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersReport() throws Exception {
final Farm farm = new FtFarm(new PropsFarm(new FkFarm()));
final String uid = "yegor256";
new ClaimOut()
.type("Order was given")
.param("login", uid)
.p... | #fixed code
@Test
public void rendersReport() throws Exception {
final Farm farm = new FtFarm(new PropsFarm(new FkFarm()));
final String uid = "yegor256";
new ClaimOut()
.type("Order was given")
.param("login", uid)
.postTo(... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersProfilePageWithRateInFirefox() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final double rate = 99.99;
final People people = new People(farm).bootstrap();
people.rate(
"yegor25... | #fixed code
@Test
public void rendersProfilePageWithRateInFirefox() throws Exception {
final Farm farm = FkFarm.props();
final double rate = 99.99;
final People people = new People(farm).bootstrap();
people.rate(
"yegor256", new Cash.S(Stri... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public Response act(final Request req) throws IOException {
final JsonObject callback = TkViber.json(
new InputStreamReader(req.body(), StandardCharsets.UTF_8)
);
if (callback.isEmpty()) {
throw new HttpExcep... | #fixed code
@Override
public Response act(final Request req) throws IOException {
final JsonObject callback = TkViber.json(
new TextOf(req.body()).asString()
);
if (callback.isEmpty()) {
throw new HttpException(HttpURLConnection.HTTP_BA... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersHomePage() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final Catalog catalog = new Catalog(new Pmo(farm)).bootstrap();
final String pid = "A1B2C3D4F";
catalog.add(pid, String.format("2017... | #fixed code
@Test
public void rendersHomePage() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
MatcherAssert.assertThat(
XhtmlMatchers.xhtml(
new RsPrint(
new TkApp(farm).act(
n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersXmlAwardsPage() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
MatcherAssert.assertThat(
XhtmlMatchers.xhtml(
XhtmlMatchers.xhtml(
new View(farm, "/u/yegor256... | #fixed code
@Test
public void rendersXmlAwardsPage() throws Exception {
final Farm farm = FkFarm.props();
MatcherAssert.assertThat(
XhtmlMatchers.xhtml(
XhtmlMatchers.xhtml(
new View(farm, "/u/yegor256/awards").html()
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public double vote(final String login, final StringBuilder log)
throws IOException {
final int jobs = new LengthOf(
new Agenda(this.pmo, login).jobs()
).intValue();
log.append(
new Par(
... | #fixed code
@Override
public double vote(final String login, final StringBuilder log)
throws IOException {
final int mine = this.jobs.value().get(login);
final int smaller = new Filtered<>(
speed -> speed < mine,
this.jobs.value().value... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public Response act(final RqRegex req) throws IOException {
final String pid = req.matcher().group(1);
final Project pmo = new Pmo(this.farm);
final Catalog catalog = new Catalog(pmo).bootstrap();
if (!catalog.exists(pid)) {... | #fixed code
@Override
public Response act(final RqRegex req) throws IOException {
final Project project = new RqProject(this.farm, req);
return new RsWithHeaders(
new RsWithType(
new RsWithBody(
this.getClass().getResour... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
@SuppressWarnings("unchecked")
public void showsThatUserAlreadyHasMentor() throws IOException {
final Farm farm = FkFarm.props();
final People people = new People(farm).bootstrap();
final String mentor = "yoda";
final String... | #fixed code
@Test
@SuppressWarnings("unchecked")
public void showsThatUserAlreadyHasMentor() throws IOException {
final Farm farm = new PropsFarm(new FkFarm());
final People people = new People(farm).bootstrap();
final String mentor = "yoda";
final... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public Collection<String> links(final String pid) throws IOException {
if (!this.exists(pid)) {
throw new IllegalArgumentException(
new Par(
"Project %s doesn't exist, can't get links"
).say(pid)
... | #fixed code
public Collection<String> links(final String pid) throws IOException {
this.checkExist(pid);
try (final Item item = this.item()) {
return new SolidList<>(
new Mapped<>(
xml -> String.format(
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void pause(final String pid,
final boolean pause) throws IOException {
if (!this.exists(pid)) {
throw new IllegalArgumentException(
new Par("Project %s doesn't exist, can't pause").say(pid)
);
}
... | #fixed code
public void pause(final String pid,
final boolean pause) throws IOException {
this.checkExist(pid);
try (final Item item = this.item()) {
new Xocument(item.path()).modify(
new Directives().xpath(
String.f... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public String adviser(final String pid) throws IOException {
if (!this.exists(pid)) {
throw new IllegalArgumentException(
new Par(
"Project %s doesn't exist, can't get adviser"
).say(pid)
... | #fixed code
public String adviser(final String pid) throws IOException {
this.checkExist(pid);
try (final Item item = this.item()) {
return new Xocument(item.path()).xpath(
String.format(
"/catalog/project[@id = '%s']/advise... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersHomePage() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final String uid = "yegor";
new Awards(farm, uid).bootstrap().add(
new FkProject(), 1, "gh:test/test#1", "reason"
);
... | #fixed code
@Test
public void rendersHomePage() throws Exception {
final Farm farm = FkFarm.props();
final String uid = "yegor";
new Awards(farm, uid).bootstrap().add(
new FkProject(), 1, "gh:test/test#1", "reason"
);
new Agenda(far... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public double take(final String login, final StringBuilder log)
throws IOException {
final int total = new Agenda(this.pmo, login).bootstrap().jobs().size();
final double rate;
final int max = new Options(this.pmo, login).bo... | #fixed code
@Override
public double take(final String login, final StringBuilder log)
throws IOException {
final int total = new Agenda(this.pmo, login).bootstrap().jobs().size();
final double rate;
final int max = new Options(this.pmo, login).bootstra... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public double speed(final String uid) throws IOException {
if (!this.exists(uid)) {
throw new IllegalArgumentException(
new Par("Person @%s doesn't exist").say(uid)
);
}
try (final Item item = this.item()) ... | #fixed code
public double speed(final String uid) throws IOException {
this.checkExisting(uid);
try (final Item item = this.item()) {
return new NumberOf(
new Xocument(item.path()).xpath(
String.format(
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public Collection<String> links(final String pid, final String rel)
throws IOException {
if (!this.exists(pid)) {
throw new IllegalArgumentException(
new Par(
"Project %s doesn't exist, can't get links"
... | #fixed code
public Collection<String> links(final String pid, final String rel)
throws IOException {
this.checkExist(pid);
try (final Item item = this.item()) {
return new Xocument(item).xpath(
String.format(
"/catal... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersProfilePageWithRateInFirefox() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final double rate = 99.99;
final People people = new People(farm).bootstrap();
people.rate(
"yegor25... | #fixed code
@Test
public void rendersProfilePageWithRateInFirefox() throws Exception {
final Farm farm = FkFarm.props();
final double rate = 99.99;
final People people = new People(farm).bootstrap();
people.rate(
"yegor256", new Cash.S(Stri... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersSingleArtifact() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final Catalog catalog = new Catalog(new Pmo(farm)).bootstrap();
final String pid = "A1B2C3D4F";
catalog.add(pid, String.format... | #fixed code
@Test
public void rendersSingleArtifact() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
MatcherAssert.assertThat(
XhtmlMatchers.xhtml(
new RsPrint(
new TkApp(farm).act(
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public Response act(final Request request) throws IOException {
return new RsWithType(
new RsWithBody(
new BufferedInputStream(
new HeapDump(new ExtBucket().value(), "").load()
)
... | #fixed code
@Override
public Response act(final Request request) throws IOException {
return new RsWithType(
new RsWithBody(
new BufferedInputStream(
new HeapDump(this.bucket.value(), "").load()
)
),
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void registerImpediment() throws Exception {
final Project project = new FkProject();
final Impediments imp = new Impediments(new PropsFarm(), project)
.bootstrap();
final String job = "gh:test/test#1";
new Wb... | #fixed code
@Test
public void registerImpediment() throws Exception {
final Project project = new FkProject();
final Impediments imp = new Impediments(new PropsFarm(), project)
.bootstrap();
final String job = "gh:test/test#1";
new Wbs(proj... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void exec(final Message input) throws Exception {
final Footprint footprint = new Footprint(
this.farm, new SqsProject(this.farm, input)
);
final XML xml = new XMLDocument(input.getBody())
.nodes("/cla... | #fixed code
@Override
public void exec(final Message input) throws Exception {
try (
final Footprint footprint = new Footprint(
this.farm, new SqsProject(this.farm, input)
)
) {
final XML xml = new XMLDocument(input.... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersAgendaPage() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final String uid = "yegor256";
final People people = new People(farm).bootstrap();
people.touch(uid);
people.invite(uid, "... | #fixed code
@Test
public void rendersAgendaPage() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
MatcherAssert.assertThat(
XhtmlMatchers.xhtml(
new RsPrint(
new TkApp(farm).act(
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Loggable
@SuppressWarnings("PMD.AvoidCatchingThrowable")
public static void main(final String... args) throws IOException {
final Props props = new Props();
if (props.has("//testing")) {
throw new IllegalStateException(
... | #fixed code
@Loggable
@SuppressWarnings("PMD.AvoidCatchingThrowable")
public static void main(final String... args) throws IOException {
final Props props = new Props();
if (props.has("//testing")) {
throw new IllegalStateException(
"He... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public Response act(final RqRegex req) throws IOException {
final String pid = req.matcher().group(1);
final Catalog catalog = new Catalog(this.farm).bootstrap();
if (!catalog.exists(pid)) {
throw new RsForward(
... | #fixed code
@Override
public Response act(final RqRegex req) throws IOException {
final Project project = new RqAnonProject(this.farm, req);
final Cash left = new Ledger(project).bootstrap().cash().add(
new Estimates(project).bootstrap().total().mul(-1L)
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Loggable
@SuppressWarnings("PMD.AvoidCatchingThrowable")
public static void main(final String... args) throws IOException {
final Props props = new Props();
if (props.has("//testing")) {
throw new IllegalStateException(
... | #fixed code
@Loggable
@SuppressWarnings("PMD.AvoidCatchingThrowable")
public static void main(final String... args) throws IOException {
final Props props = new Props();
if (props.has("//testing")) {
throw new IllegalStateException(
"He... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void acceptIfNeverApplied() throws Exception {
final Farm farm = FkFarm.props();
final People people = new People(farm).bootstrap();
final String uid = "yegor256";
people.touch(uid);
final Request req = new RqWith... | #fixed code
@Test
public void acceptIfNeverApplied() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final People people = new People(farm).bootstrap();
final String uid = "yegor256";
people.touch(uid);
final Request req = new... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public int jobs(final String uid) throws IOException {
if (!this.exists(uid)) {
throw new IllegalArgumentException(
new Par("Person @%s doesn't exist").say(uid)
);
}
try (final Item item = this.item()) {
... | #fixed code
public int jobs(final String uid) throws IOException {
this.checkExisting(uid);
try (final Item item = this.item()) {
return new NumberOf(
new Xocument(item.path()).xpath(
String.format(
"... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void redirectsWhenAccessingNonexistentUsersAgenda()
throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
new People(farm).bootstrap().touch("yegor256");
MatcherAssert.assertThat(
new RsPrint(
... | #fixed code
@Test
public void redirectsWhenAccessingNonexistentUsersAgenda()
throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
new People(farm).bootstrap().touch("yegor256");
MatcherAssert.assertThat(
new RsPrint(
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void renderJoinPage() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
MatcherAssert.assertThat(
XhtmlMatchers.xhtml(
new RsPrint(
new TkApp(farm).act(
... | #fixed code
@Test
public void renderJoinPage() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
MatcherAssert.assertThat(
XhtmlMatchers.xhtml(
new RsPrint(
new TkApp(farm).act(
ne... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void findsBasicNumbers() throws Exception {
MatcherAssert.assertThat(
new Policy(new PropsFarm(new FkFarm())).get("1.min-rep", "???"),
Matchers.startsWith("??")
);
}
#location 3
... | #fixed code
@Test
public void findsBasicNumbers() throws Exception {
MatcherAssert.assertThat(
new Policy(FkFarm.props()).get("1.min-rep", "???"),
Matchers.startsWith("??")
);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersSingleArtifact() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
MatcherAssert.assertThat(
XhtmlMatchers.xhtml(
new RsPrint(
new TkApp(farm).act(
... | #fixed code
@Test
public void rendersSingleArtifact() throws Exception {
final Farm farm = FkFarm.props();
MatcherAssert.assertThat(
XhtmlMatchers.xhtml(
new RsPrint(
new TkApp(farm).act(
new RqWi... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersListOfClaims() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
MatcherAssert.assertThat(
XhtmlMatchers.xhtml(
new RsPrint(
new TkApp(farm).act(
... | #fixed code
@Test
public void rendersListOfClaims() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
MatcherAssert.assertThat(
XhtmlMatchers.xhtml(
new RsPrint(
new TkApp(farm).act(
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void dontRepostNotifyFailures() throws Exception {
final Stakeholder stk = Mockito.mock(Stakeholder.class);
final Project project = new FkProject();
new ClaimOut()
.type("Notify GitHub")
.token("github;tes... | #fixed code
@Test
public void dontRepostNotifyFailures() throws Exception {
final Project project = new FkProject();
new ClaimOut()
.type("Notify GitHub")
.token("github;test/test#1")
.postTo(project);
final XML claim = new ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void respondsToMilestonedEvent() throws IOException {
final MkGithub github = new MkGithub();
final Repo repo = github.repos()
.create(new Repos.RepoCreate("test", false));
final Issue bug = repo
.issues()... | #fixed code
@Test
public void respondsToMilestonedEvent() throws IOException {
final MkGithub github = new MkGithub();
final Repo repo = github.repos()
.create(new Repos.RepoCreate("test", false));
final Issue bug = repo
.issues().creat... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void acceptIfNeverApplied() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final People people = new People(farm).bootstrap();
final String uid = "yegor256";
people.touch(uid);
final RqWithUser ... | #fixed code
@Test
public void acceptIfNeverApplied() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final People people = new People(farm).bootstrap();
final String uid = "yegor256";
people.touch(uid);
final Request req = new... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void renderClaimXml() throws Exception {
final Farm farm = new FtFarm(new PropsFarm(new FkFarm()));
final Catalog catalog = new Catalog(new Pmo(farm)).bootstrap();
final String pid = "A1B2C3D4F";
catalog.add(pid, String.f... | #fixed code
@Test
public void renderClaimXml() throws Exception {
final Farm farm = new FtFarm(new PropsFarm(new FkFarm()));
final long cid = 42L;
final ClaimOut claim = new ClaimOut().type("test").cid(cid);
claim.postTo(farm.find("@id='C00000000'").it... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void acceptIfNeverApplied() throws Exception {
final Farm farm = FkFarm.props();
final People people = new People(farm).bootstrap();
final String uid = "yegor256";
people.touch(uid);
final Request req = new RqWith... | #fixed code
@Test
public void acceptIfNeverApplied() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final People people = new People(farm).bootstrap();
final String uid = "yegor256";
people.touch(uid);
final Request req = new... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@SuppressWarnings("unchecked")
public void exec() throws IOException {
final Props props = new Props();
if (props.has("//testing")) {
throw new IllegalStateException(
"Hey, we are in the testing mode!"
);
... | #fixed code
@SuppressWarnings("unchecked")
public void exec() throws IOException {
final Props props = new Props();
if (props.has("//testing")) {
throw new IllegalStateException(
"Hey, we are in the testing mode!"
);
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersAllPossibleUrls() throws Exception {
final Take take = new TkApp(FkFarm.props());
MatcherAssert.assertThat(
this.url,
take.act(new RqFake("GET", this.url)),
Matchers.not(
ne... | #fixed code
@Test
public void rendersAllPossibleUrls() throws Exception {
final Take take = new TkApp(new PropsFarm(new FkFarm()));
MatcherAssert.assertThat(
this.url,
take.act(new RqFake("GET", this.url)),
Matchers.not(
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersHomePage() throws Exception {
final Take take = new TkApp(new PropsFarm(new FkFarm()));
MatcherAssert.assertThat(
XhtmlMatchers.xhtml(
new RsPrint(
take.act(
... | #fixed code
@Test
public void rendersHomePage() throws Exception {
final Take take = new TkApp(FkFarm.props());
MatcherAssert.assertThat(
XhtmlMatchers.xhtml(
new RsPrint(
take.act(
new RqWithHead... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void estimatesJobsWithDifferentCurrencies() throws Exception {
final Project project = new FkProject();
final Farm farm = new PropsFarm();
new Ledger(farm, project).bootstrap().add(
new Ledger.Transaction(
... | #fixed code
@Test
public void estimatesJobsWithDifferentCurrencies() throws Exception {
final Project project = new FkProject();
final Farm farm = new PropsFarm();
new Ledger(farm, project).bootstrap().add(
new Ledger.Transaction(
n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
@Ignore
public void showsResumeIfAlreadyApplied() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final People people = new People(farm).bootstrap();
final String uid = "yegor256";
people.touch(uid);
... | #fixed code
@Test
@Ignore
public void showsResumeIfAlreadyApplied() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final People people = new People(farm).bootstrap();
final String uid = "yegor256";
people.touch(uid);
peop... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void acceptIfNeverApplied() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final People people = new People(farm).bootstrap();
final String uid = "yegor256";
people.touch(uid);
final Request req... | #fixed code
@Test
public void acceptIfNeverApplied() throws Exception {
final Farm farm = FkFarm.props();
final People people = new People(farm).bootstrap();
final String uid = "yegor256";
people.touch(uid);
final Request req = new RqWithUser(
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void adviser(final String pid, final String adviser)
throws IOException {
if (!this.exists(pid)) {
throw new IllegalArgumentException(
new Par(
"Project %s doesn't exist, can't get adviser"
... | #fixed code
public void adviser(final String pid, final String adviser)
throws IOException {
this.checkExist(pid);
try (final Item item = this.item()) {
new Xocument(item.path()).modify(
new Directives().xpath(
Strin... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void acceptRequestAndRedirectOnPost() throws Exception {
final Farm farm = FkFarm.props();
MatcherAssert.assertThat(
new TkApp(farm).act(
new RqWithBody(
new RqWithUser.WithInit(
... | #fixed code
@Test
public void acceptRequestAndRedirectOnPost() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
MatcherAssert.assertThat(
new TkApp(farm).act(
new RqWithBody(
new RqWithUser.WithInit(
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@SuppressWarnings("unchecked")
public void exec() throws IOException {
final Path temp = Paths.get("./s3farm").normalize();
if (!temp.toFile().mkdir()) {
throw new IllegalStateException(
String.format(
... | #fixed code
@SuppressWarnings("unchecked")
public void exec() throws IOException {
Logger.info(this, "Farm is ready to start");
final ShutdownFarm.Hook shutdown = new ShutdownFarm.Hook();
final ClaimGuts cgts = new ClaimGuts();
final TestLocks locks = ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void parsesJson() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final Take take = new TkGithub(
farm, (frm, github, event) -> "nothing"
);
MatcherAssert.assertThat(
take.act(
... | #fixed code
@Test
public void parsesJson() throws Exception {
MatcherAssert.assertThat(
new TkGithub(
new PropsFarm(),
new Rebound.Fake("nothing")
).act(
new RqWithBody(
new RqFake("PO... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void handlesPullRequest() throws IOException {
final MkGithub github = new MkGithub("jeff");
final JsonObjectBuilder builder =
RbPingArchitectTest.event(false, github, "smith");
final FkProject pkt = new FkProject();
... | #fixed code
@Test
public void handlesPullRequest() throws IOException {
final MkGithub github = new MkGithub("smith");
final FkProject pkt = new FkProject();
final Roles roles = new Roles(pkt).bootstrap();
roles.assign("jeff", "ARC");
roles.ass... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void delete(final String pid) throws IOException {
if (!this.exists(pid)) {
throw new IllegalArgumentException(
new Par("Project %s doesn't exist, can't delete").say(pid)
);
}
try (final Item item = ... | #fixed code
public void delete(final String pid) throws IOException {
this.checkExist(pid);
try (final Item item = this.item()) {
new Xocument(item.path()).modify(
new Directives().xpath(
String.format("/catalog/project[@id=... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Loggable
@SuppressWarnings("PMD.AvoidCatchingThrowable")
public static void main(final String... args) throws IOException {
final Props props = new Props();
if (props.has("//testing")) {
throw new IllegalStateException(
... | #fixed code
@Loggable
@SuppressWarnings("PMD.AvoidCatchingThrowable")
public static void main(final String... args) throws IOException {
final Props props = new Props();
if (props.has("//testing")) {
throw new IllegalStateException(
"He... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void acceptIfNeverApplied() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final People people = new People(farm).bootstrap();
final String uid = "yegor256";
people.touch(uid);
final Request req... | #fixed code
@Test
public void acceptIfNeverApplied() throws Exception {
final Farm farm = FkFarm.props();
final People people = new People(farm).bootstrap();
final String uid = "yegor256";
people.touch(uid);
final Request req = new RqWithUser(
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersProfilePageWithoutRateInFirefox() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final String uid = "yegor256";
MatcherAssert.assertThat(
new View(farm, String.format("/u/%s", uid)).html... | #fixed code
@Test
public void rendersProfilePageWithoutRateInFirefox() throws Exception {
final Farm farm = FkFarm.props();
final String uid = "yegor256";
MatcherAssert.assertThat(
new View(farm, String.format("/u/%s", uid)).html(),
Mat... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void title(final String pid, final String title)
throws IOException {
if (!this.exists(pid)) {
throw new IllegalArgumentException(
new Par(
"Project %s doesn't exist, can't change title"
... | #fixed code
public void title(final String pid, final String title)
throws IOException {
this.checkExist(pid);
try (final Item item = this.item()) {
new Xocument(item.path()).modify(
new Directives()
.xpath(String.fo... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public Response act(final RqRegex req) throws IOException {
final Project project = new RqProject(this.farm, req, "PO");
final RqFormSmart form = new RqFormSmart(new RqGreedy(req));
final String email = form.single("email");
... | #fixed code
@Override
public Response act(final RqRegex req) throws IOException {
final Project project = new RqProject(this.farm, req, "PO");
final RqFormSmart form = new RqFormSmart(new RqGreedy(req));
final String email = form.single("email");
final... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void reputation(final String uid, final int rep)
throws IOException {
if (!this.exists(uid)) {
throw new IllegalArgumentException(
new Par("Person @%s doesn't exist").say(uid)
);
}
try (final... | #fixed code
public void reputation(final String uid, final int rep)
throws IOException {
this.checkExisting(uid);
try (final Item item = this.item()) {
new Xocument(item.path()).modify(
new Directives().xpath(
String... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void addsClaims() throws Exception {
final Farm farm = new PropsFarm();
final Project project = new Pmo(farm);
new ClaimOut().type("hello").postTo(project);
final XML xml = new Claims(project).iterate().iterator().next();... | #fixed code
@Test
public void addsClaims() throws Exception {
final Farm farm = new PropsFarm();
final Project project = farm.find("@id='FOOTPRNTX'").iterator().next();
new ClaimOut().type("hello").postTo(project);
final XML xml = new Claims(project).i... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@SuppressWarnings("unchecked")
public void exec() throws IOException {
final Path temp = Paths.get("./s3farm").normalize();
if (!temp.toFile().mkdir()) {
throw new IllegalStateException(
String.format(
... | #fixed code
@SuppressWarnings("unchecked")
public void exec() throws IOException {
final Path temp = Paths.get("./s3farm").normalize();
if (!temp.toFile().mkdir()) {
throw new IllegalStateException(
String.format(
"Faile... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersReport() throws Exception {
final Farm farm = new FtFarm(new PropsFarm(new FkFarm()));
final Catalog catalog = new Catalog(new Pmo(farm)).bootstrap();
final String pid = "A1B2C3DXF";
catalog.add(pid, String.fo... | #fixed code
@Test
public void rendersReport() throws Exception {
final Farm farm = new FtFarm(new PropsFarm(new FkFarm()));
final String uid = "yegor256";
new ClaimOut()
.type("Order was given")
.param("login", uid)
.postTo(... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void showsLinkToPolicyForUnknownUser() throws Exception {
final String flash =
// @checkstyle LineLength (1 line)
"@nvseenu is not invited to us yet, see <a href=\"www.zerocracy.com/policy.html#1\">§1</a>";
Matche... | #fixed code
@Test
public void showsLinkToPolicyForUnknownUser() throws Exception {
final String flash =
// @checkstyle LineLength (1 line)
"@nvseenu is not invited to us yet, see <a href=\"www.zerocracy.com/policy.html#1\">§1</a>";
MatcherAsser... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersHomePage() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final String uid = "yegor256";
final People people = new People(farm).bootstrap();
people.touch(uid);
people.invite(uid, "me... | #fixed code
@Test
public void rendersHomePage() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final String uid = "yegor256";
new Awards(farm, uid).bootstrap().add(1, "gh:test/test#1", "reason");
new Agenda(farm, uid).bootstrap().add... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersDebts() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final Debts debts = new Debts(farm).bootstrap();
final String uid = "yegor256";
final String first = "details 1";
final String ... | #fixed code
@Test
public void rendersDebts() throws Exception {
final Farm farm = FkFarm.props();
final Debts debts = new Debts(farm).bootstrap();
final String uid = "yegor256";
final String first = "details 1";
final String second = "details 2... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersWithoutChromeNotice() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final String get = new RsPrint(
new TkApp(farm).act(
new RqWithUser(
farm,
... | #fixed code
@Test
public void rendersWithoutChromeNotice() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final String get = new RsPrint(
new TkApp(farm).act(
new RqWithUser.WithInit(
farm,
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersAllPossibleUrls() throws Exception {
final Take take = new TkApp(new PropsFarm(new FkFarm()));
MatcherAssert.assertThat(
this.url,
take.act(new RqFake("GET", this.url)),
Matchers.not(
... | #fixed code
@Test
public void rendersAllPossibleUrls() throws Exception {
final Take take = new TkApp(FkFarm.props());
MatcherAssert.assertThat(
this.url,
take.act(new RqFake("GET", this.url)),
Matchers.not(
new HmRs... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersProjectPage() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final Catalog catalog = new Catalog(new Pmo(farm)).bootstrap();
final String pid = "A1B2C3D4F";
catalog.add(pid, String.format("2... | #fixed code
@Test
public void rendersProjectPage() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
final Catalog catalog = new Catalog(new Pmo(farm)).bootstrap();
final String pid = "A1B2C3D4F";
catalog.add(pid, String.format("2017/07... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void apply(final String uid, final Date when) throws IOException {
if (!this.exists(uid)) {
throw new IllegalArgumentException(
new Par("Person @%s doesn't exist").say(uid)
);
}
try (final Item item ... | #fixed code
public void apply(final String uid, final Date when) throws IOException {
this.checkExisting(uid);
try (final Item item = this.item()) {
new Xocument(item.path()).modify(
new Directives().xpath(
String.format("//... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void givesNoBonus() throws Exception {
final FkProject project = new FkProject();
final FkFarm farm = new FkFarm(project);
final Speed speed = new Speed(farm, "other").bootstrap();
final String job = "gh:bonus/slow#1";
... | #fixed code
@Test
public void givesNoBonus() throws Exception {
final Speed speed = new Speed(
new FkFarm(new FkProject()), "other"
).bootstrap();
final String job = "gh:bonus/slow#1";
speed.add("TST100009", job, Duration.ofDays(Tv.THREE).t... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void unlink(final String pid, final String rel, final String href)
throws IOException {
if (!this.exists(pid)) {
throw new IllegalArgumentException(
new Par(
"Project %s doesn't exist, can't unlink"
... | #fixed code
public void unlink(final String pid, final String rel, final String href)
throws IOException {
this.checkExist(pid);
try (final Item item = this.item()) {
new Xocument(item.path()).modify(
new Directives()
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public boolean applied(final String uid) throws IOException {
if (!this.exists(uid)) {
throw new IllegalArgumentException(
new Par("Person @%s doesn't exist").say(uid)
);
}
try (final Item item = this.item(... | #fixed code
public boolean applied(final String uid) throws IOException {
this.checkExisting(uid);
try (final Item item = this.item()) {
return !new Xocument(item).nodes(
String.format("//people/person[@id ='%s']/applied", uid)
).i... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rendersVacanciesPage() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
MatcherAssert.assertThat(
XhtmlMatchers.xhtml(
new RsPrint(
new TkApp(farm).act(
... | #fixed code
@Test
public void rendersVacanciesPage() throws Exception {
final Farm farm = new PropsFarm(new FkFarm());
MatcherAssert.assertThat(
XhtmlMatchers.xhtml(
new RsPrint(
new TkApp(farm).act(
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void receiveMessages() throws Exception {
final Project project = new FkProject();
final Farm farm = new PropsFarm(new FkFarm(project));
final AmazonSQS sqs = new ExtSqs(farm).value();
final String queue = new ClaimsQueue... | #fixed code
@Test
public void receiveMessages() throws Exception {
final Project project = new FkProject();
final Farm farm = new PropsFarm(new FkFarm(project));
final AmazonSQS sqs = new ExtSqs(farm).value();
final String queue = new ClaimsQueueUrl(fa... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void dontRepeatErrorClaims() throws Exception {
final FkProject project = new FkProject();
new ClaimOut().type("Error").postTo(project);
final XML claim = new Claims(project).iterate().iterator().next();
new StkSafe(
... | #fixed code
@Test
public void dontRepeatErrorClaims() throws Exception {
final FkProject project = new FkProject();
new ClaimOut().type("Error").postTo(project);
final int before = new LengthOf(new Claims(project).iterate())
.intValue();
ne... | Below is the vulnerable code, please generate the patch based on the following information. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.