before
stringlengths 12
3.21M
| after
stringlengths 41
3.21M
| repo
stringlengths 1
56
| type
stringclasses 1
value | __index_level_0__
int64 0
442k
|
|---|---|---|---|---|
@Test
public void testRecordUpdated() throws Exception {
Category category = new Category(1, "c1");
Account account = new Account(1, "a1", 100, "NON", 0, 0, false, 0);
if (account == null)
return null;
accountHashMap.put(account.getId(), account);
return account;
Record incomeOld = new Record(1, 1, Record.TYPE_INCOME, "income", category, 10, account, account.getCurrency());
Record incomeNew = new Record(1, 1, Record.TYPE_INCOME, "income", category, 100, account, account.getCurrency());
accountController.recordUpdated(incomeOld, incomeNew);
assertEquals(190, account.getCurSum());
accountController.recordUpdated(incomeNew, incomeOld);
assertEquals(100, account.getCurSum());
Record expenseOld = new Record(1, 1, Record.TYPE_EXPENSE, "expense", category, 10, account, account.getCurrency());
Record expenseNew = new Record(1, 1, Record.TYPE_EXPENSE, "expense", category, 100, account, account.getCurrency());
accountController.recordUpdated(expenseOld, expenseNew);
assertEquals(10, account.getCurSum());
accountController.recordUpdated(expenseNew, expenseOld);
assertEquals(100, account.getCurSum());
accountController.recordUpdated(null, null);
assertEquals(100, account.getCurSum());
Record broken = new Record(1, 1, -1, "expense", category, 10, account, account.getCurrency());
accountController.recordUpdated(broken, broken);
assertEquals(100, account.getCurSum());
}
|
@Test
public void testRecordUpdated() throws Exception {
Category category = new Category(1, "c1");
Account account = new Account(1, "a1", 100, "NON", 0, 0, false, 0);
<DeepExtract>
if (account == null)
return null;
accountHashMap.put(account.getId(), account);
return account;
</DeepExtract>
Record incomeOld = new Record(1, 1, Record.TYPE_INCOME, "income", category, 10, account, account.getCurrency());
Record incomeNew = new Record(1, 1, Record.TYPE_INCOME, "income", category, 100, account, account.getCurrency());
accountController.recordUpdated(incomeOld, incomeNew);
assertEquals(190, account.getCurSum());
accountController.recordUpdated(incomeNew, incomeOld);
assertEquals(100, account.getCurSum());
Record expenseOld = new Record(1, 1, Record.TYPE_EXPENSE, "expense", category, 10, account, account.getCurrency());
Record expenseNew = new Record(1, 1, Record.TYPE_EXPENSE, "expense", category, 100, account, account.getCurrency());
accountController.recordUpdated(expenseOld, expenseNew);
assertEquals(10, account.getCurSum());
accountController.recordUpdated(expenseNew, expenseOld);
assertEquals(100, account.getCurSum());
accountController.recordUpdated(null, null);
assertEquals(100, account.getCurSum());
Record broken = new Record(1, 1, -1, "expense", category, 10, account, account.getCurrency());
accountController.recordUpdated(broken, broken);
assertEquals(100, account.getCurSum());
}
|
open_money_tracker
|
positive
| 440,760
|
@Test
public void testPublicChannelName() {
return new ChannelImpl("my-channel", factory);
}
|
@Test
public void testPublicChannelName() {
<DeepExtract>
return new ChannelImpl("my-channel", factory);
</DeepExtract>
}
|
pusher-websocket-java
|
positive
| 440,761
|
private static Query checkStartDate(Stream stream, Date from, boolean allowChunkScan, Query query) throws InvalidQueryIntervalException {
long fromTime = from.getTime();
long chunkId = TimeUtil.getChunkIdAtTime(stream, fromTime);
long digestId = chunkId;
if (chunkId < 0) {
throw new InvalidQueryIntervalException("Interval starts before the stream starts", true, stream.getStartDate(), stream.getStartDate());
}
if (chunkId > stream.getLastWrittenChunkId()) {
throw new InvalidQueryIntervalException("Interval starts after the last inserted chunk.", true, new Date(TimeUtil.getChunkStartTime(stream, stream.getLastWrittenChunkId())), new Date(TimeUtil.getChunkStartTime(stream, stream.getLastWrittenChunkId())));
}
long delta = fromTime - TimeUtil.getChunkStartTime(stream, chunkId);
if (!allowChunkScan && delta > 0) {
throw new InvalidQueryIntervalException("The requested interval is not aligned with the precision of this" + " stream and chunks scans are disallowed for this query", true, new Date(TimeUtil.getChunkIdAtTime(stream, chunkId)), new Date(TimeUtil.getChunkIdAtTime(stream, chunkId + 1)));
} else if (delta > 0) {
digestId = chunkId + 1;
query.activateSubChunkQuery();
}
this.chunkFrom = chunkId;
this.digestFrom = digestId;
return query;
}
|
private static Query checkStartDate(Stream stream, Date from, boolean allowChunkScan, Query query) throws InvalidQueryIntervalException {
long fromTime = from.getTime();
long chunkId = TimeUtil.getChunkIdAtTime(stream, fromTime);
long digestId = chunkId;
if (chunkId < 0) {
throw new InvalidQueryIntervalException("Interval starts before the stream starts", true, stream.getStartDate(), stream.getStartDate());
}
if (chunkId > stream.getLastWrittenChunkId()) {
throw new InvalidQueryIntervalException("Interval starts after the last inserted chunk.", true, new Date(TimeUtil.getChunkStartTime(stream, stream.getLastWrittenChunkId())), new Date(TimeUtil.getChunkStartTime(stream, stream.getLastWrittenChunkId())));
}
long delta = fromTime - TimeUtil.getChunkStartTime(stream, chunkId);
if (!allowChunkScan && delta > 0) {
throw new InvalidQueryIntervalException("The requested interval is not aligned with the precision of this" + " stream and chunks scans are disallowed for this query", true, new Date(TimeUtil.getChunkIdAtTime(stream, chunkId)), new Date(TimeUtil.getChunkIdAtTime(stream, chunkId + 1)));
} else if (delta > 0) {
digestId = chunkId + 1;
query.activateSubChunkQuery();
}
this.chunkFrom = chunkId;
<DeepExtract>
this.digestFrom = digestId;
</DeepExtract>
return query;
}
|
timecrypt
|
positive
| 440,762
|
public String major() {
rcode.addRCode("major" + " <- " + "version");
rcaller.runAndReturnResultOnline("major");
if (type_String.equals(type_String)) {
result = (rcaller.getParser().getAsStringArray("major"));
} else if (type_String.equals(type_Integer)) {
int[] res = rcaller.getParser().getAsIntArray("major");
Integer[] ints = new Integer[res.length];
for (int i = 0; i < res.length; i++) {
ints[i] = res[i];
}
result = (ints);
} else if (type_String.equals(type_double)) {
double[] res = rcaller.getParser().getAsDoubleArray("major");
Double[] dbls = new Double[res.length];
for (int i = 0; i < res.length; i++) {
dbls[i] = res[i];
}
result = (dbls);
} else {
result = (null);
}
return result[0].toString();
}
|
public String major() {
<DeepExtract>
rcode.addRCode("major" + " <- " + "version");
rcaller.runAndReturnResultOnline("major");
if (type_String.equals(type_String)) {
result = (rcaller.getParser().getAsStringArray("major"));
} else if (type_String.equals(type_Integer)) {
int[] res = rcaller.getParser().getAsIntArray("major");
Integer[] ints = new Integer[res.length];
for (int i = 0; i < res.length; i++) {
ints[i] = res[i];
}
result = (ints);
} else if (type_String.equals(type_double)) {
double[] res = rcaller.getParser().getAsDoubleArray("major");
Double[] dbls = new Double[res.length];
for (int i = 0; i < res.length; i++) {
dbls[i] = res[i];
}
result = (dbls);
} else {
result = (null);
}
</DeepExtract>
return result[0].toString();
}
|
rcaller
|
positive
| 440,763
|
private void glow(World par1World, int par2, int par3, int par4) {
Random random = par1World.rand;
double d0 = 0.0625D;
for (int l = 0; l < 6; ++l) {
double d1 = (double) ((float) par2 + random.nextFloat());
double d2 = (double) ((float) par3 + random.nextFloat());
double d3 = (double) ((float) par4 + random.nextFloat());
if (l == 0 && !par1World.isBlockOpaqueCube(par2, par3 + 1, par4)) {
d2 = (double) (par3 + 1) + d0;
}
if (l == 1 && !par1World.isBlockOpaqueCube(par2, par3 - 1, par4)) {
d2 = (double) (par3 + 0) - d0;
}
if (l == 2 && !par1World.isBlockOpaqueCube(par2, par3, par4 + 1)) {
d3 = (double) (par4 + 1) + d0;
}
if (l == 3 && !par1World.isBlockOpaqueCube(par2, par3, par4 - 1)) {
d3 = (double) (par4 + 0) - d0;
}
if (l == 4 && !par1World.isBlockOpaqueCube(par2 + 1, par3, par4)) {
d1 = (double) (par2 + 1) + d0;
}
if (l == 5 && !par1World.isBlockOpaqueCube(par2 - 1, par3, par4)) {
d1 = (double) (par2 + 0) - d0;
}
if (d1 < (double) par2 || d1 > (double) (par2 + 1) || d2 < 0.0D || d2 > (double) (par3 + 1) || d3 < (double) par4 || d3 > (double) (par4 + 1)) {
par1World.spawnParticle("reddust", d1, d2, d3, 0.0D, 0.0D, 0.0D);
}
}
int meta = par1World.getBlockId(par2, par3, par4);
if (meta != 1) {
par1World.setBlockMetadataWithNotify(par2, par3, par4, 1, 2);
}
}
|
private void glow(World par1World, int par2, int par3, int par4) {
<DeepExtract>
Random random = par1World.rand;
double d0 = 0.0625D;
for (int l = 0; l < 6; ++l) {
double d1 = (double) ((float) par2 + random.nextFloat());
double d2 = (double) ((float) par3 + random.nextFloat());
double d3 = (double) ((float) par4 + random.nextFloat());
if (l == 0 && !par1World.isBlockOpaqueCube(par2, par3 + 1, par4)) {
d2 = (double) (par3 + 1) + d0;
}
if (l == 1 && !par1World.isBlockOpaqueCube(par2, par3 - 1, par4)) {
d2 = (double) (par3 + 0) - d0;
}
if (l == 2 && !par1World.isBlockOpaqueCube(par2, par3, par4 + 1)) {
d3 = (double) (par4 + 1) + d0;
}
if (l == 3 && !par1World.isBlockOpaqueCube(par2, par3, par4 - 1)) {
d3 = (double) (par4 + 0) - d0;
}
if (l == 4 && !par1World.isBlockOpaqueCube(par2 + 1, par3, par4)) {
d1 = (double) (par2 + 1) + d0;
}
if (l == 5 && !par1World.isBlockOpaqueCube(par2 - 1, par3, par4)) {
d1 = (double) (par2 + 0) - d0;
}
if (d1 < (double) par2 || d1 > (double) (par2 + 1) || d2 < 0.0D || d2 > (double) (par3 + 1) || d3 < (double) par4 || d3 > (double) (par4 + 1)) {
par1World.spawnParticle("reddust", d1, d2, d3, 0.0D, 0.0D, 0.0D);
}
}
</DeepExtract>
int meta = par1World.getBlockId(par2, par3, par4);
if (meta != 1) {
par1World.setBlockMetadataWithNotify(par2, par3, par4, 1, 2);
}
}
|
Atum
|
positive
| 440,765
|
public Pattern every(BigFraction fraction, Callable<Void> callable) {
Interval interval = new Interval(BigFraction.ZERO, fraction);
Pattern trigger = new Pattern(null, new LEvent(interval, 1.0));
isLooping = true;
if (getEvents() != null) {
setLoopInterval(getEvents().getTotalInterval());
}
return this;
this.loopInterval = interval;
if (parent != null)
parent.addChild(trigger);
else
trigger.addSelfTo(loom);
this.timeMatch = this;
return onBoundary(EventBoundaryProxy.RELEASE, callable);
return this;
}
|
public Pattern every(BigFraction fraction, Callable<Void> callable) {
Interval interval = new Interval(BigFraction.ZERO, fraction);
Pattern trigger = new Pattern(null, new LEvent(interval, 1.0));
isLooping = true;
if (getEvents() != null) {
setLoopInterval(getEvents().getTotalInterval());
}
return this;
this.loopInterval = interval;
if (parent != null)
parent.addChild(trigger);
else
trigger.addSelfTo(loom);
this.timeMatch = this;
<DeepExtract>
return onBoundary(EventBoundaryProxy.RELEASE, callable);
</DeepExtract>
return this;
}
|
loom
|
positive
| 440,766
|
public void write(org.apache.thrift.protocol.TProtocol oprot, Location struct) throws org.apache.thrift.TException {
oprot.writeStructBegin(STRUCT_DESC);
if (struct.city != null) {
if (struct.is_set_city()) {
oprot.writeFieldBegin(CITY_FIELD_DESC);
oprot.writeString(struct.city);
oprot.writeFieldEnd();
}
}
if (struct.state != null) {
if (struct.is_set_state()) {
oprot.writeFieldBegin(STATE_FIELD_DESC);
oprot.writeString(struct.state);
oprot.writeFieldEnd();
}
}
if (struct.country != null) {
if (struct.is_set_country()) {
oprot.writeFieldBegin(COUNTRY_FIELD_DESC);
oprot.writeString(struct.country);
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
|
public void write(org.apache.thrift.protocol.TProtocol oprot, Location struct) throws org.apache.thrift.TException {
<DeepExtract>
</DeepExtract>
oprot.writeStructBegin(STRUCT_DESC);
<DeepExtract>
</DeepExtract>
if (struct.city != null) {
<DeepExtract>
</DeepExtract>
if (struct.is_set_city()) {
<DeepExtract>
</DeepExtract>
oprot.writeFieldBegin(CITY_FIELD_DESC);
<DeepExtract>
</DeepExtract>
oprot.writeString(struct.city);
<DeepExtract>
</DeepExtract>
oprot.writeFieldEnd();
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
if (struct.state != null) {
<DeepExtract>
</DeepExtract>
if (struct.is_set_state()) {
<DeepExtract>
</DeepExtract>
oprot.writeFieldBegin(STATE_FIELD_DESC);
<DeepExtract>
</DeepExtract>
oprot.writeString(struct.state);
<DeepExtract>
</DeepExtract>
oprot.writeFieldEnd();
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
if (struct.country != null) {
<DeepExtract>
</DeepExtract>
if (struct.is_set_country()) {
<DeepExtract>
</DeepExtract>
oprot.writeFieldBegin(COUNTRY_FIELD_DESC);
<DeepExtract>
</DeepExtract>
oprot.writeString(struct.country);
<DeepExtract>
</DeepExtract>
oprot.writeFieldEnd();
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
oprot.writeFieldStop();
<DeepExtract>
</DeepExtract>
oprot.writeStructEnd();
<DeepExtract>
</DeepExtract>
}
|
big-data-code
|
positive
| 440,767
|
@Override
public Void visitEmpty(EmptyNode node) {
first(node, new LinkedHashSet<>(asList(new HashSet<Integer>())));
last(node, new LinkedHashSet<>(asList(new HashSet<Integer>())));
minLength.put(node, 0);
return null;
}
|
@Override
public Void visitEmpty(EmptyNode node) {
first(node, new LinkedHashSet<>(asList(new HashSet<Integer>())));
last(node, new LinkedHashSet<>(asList(new HashSet<Integer>())));
<DeepExtract>
minLength.put(node, 0);
</DeepExtract>
return null;
}
|
stringsearchalgorithms
|
positive
| 440,770
|
public static void queue(AbstractRestCommandJob job) {
try {
logger.debug("Queueing job {}", job);
executor.submit(job);
} catch (RejectedExecutionException e) {
logger.error("Unable to queue a send-command-job! ", e);
}
checkQueueSize();
}
|
public static void queue(AbstractRestCommandJob job) {
<DeepExtract>
try {
logger.debug("Queueing job {}", job);
executor.submit(job);
} catch (RejectedExecutionException e) {
logger.error("Unable to queue a send-command-job! ", e);
}
checkQueueSize();
</DeepExtract>
}
|
gerrit-events
|
positive
| 440,773
|
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
IconData icon;
if (holder.getAdapterPosition() < 0 || holder.getAdapterPosition() >= icons.size())
icon = null;
else
icon = icons.get(holder.getAdapterPosition());
if (icon == null)
return;
if (isChecked && !StaticUtils.isPermissionsGranted(activity, icon.getPermissions())) {
StaticUtils.requestPermissions(activity, icon.getPermissions());
holder.checkBox.setOnCheckedChangeListener(null);
holder.checkBox.setChecked(false);
holder.checkBox.setOnCheckedChangeListener(this);
} else {
PreferenceData.ICON_VISIBILITY.setValue(activity, isChecked, icon.getIdentifierArgs());
StaticUtils.updateStatusService(activity, false);
notifyItemChanged(holder.getAdapterPosition());
}
}
|
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
<DeepExtract>
IconData icon;
if (holder.getAdapterPosition() < 0 || holder.getAdapterPosition() >= icons.size())
icon = null;
else
icon = icons.get(holder.getAdapterPosition());
</DeepExtract>
if (icon == null)
return;
if (isChecked && !StaticUtils.isPermissionsGranted(activity, icon.getPermissions())) {
StaticUtils.requestPermissions(activity, icon.getPermissions());
holder.checkBox.setOnCheckedChangeListener(null);
holder.checkBox.setChecked(false);
holder.checkBox.setOnCheckedChangeListener(this);
} else {
PreferenceData.ICON_VISIBILITY.setValue(activity, isChecked, icon.getIdentifierArgs());
StaticUtils.updateStatusService(activity, false);
notifyItemChanged(holder.getAdapterPosition());
}
}
|
Status
|
positive
| 440,774
|
public static Rental createRental(EOEditingContext editingContext, NSTimestamp dateOut, webobjectsexamples.businesslogic.rentals.common.Customer customer, webobjectsexamples.businesslogic.rentals.common.Unit unit) {
Rental eo = (Rental) EOUtilities.createAndInsertInstance(editingContext, _Rental.ENTITY_NAME);
if (_Rental.LOG.isDebugEnabled()) {
_Rental.LOG.debug("updating dateOut from " + dateOut() + " to " + dateOut);
}
takeStoredValueForKey(dateOut, "dateOut");
if (_Rental.LOG.isDebugEnabled()) {
_Rental.LOG.debug("updating customer from " + customer() + " to " + customer);
}
if (customer == null) {
webobjectsexamples.businesslogic.rentals.common.Customer oldValue = customer();
if (oldValue != null) {
removeObjectFromBothSidesOfRelationshipWithKey(oldValue, "customer");
}
} else {
addObjectToBothSidesOfRelationshipWithKey(customer, "customer");
}
if (_Rental.LOG.isDebugEnabled()) {
_Rental.LOG.debug("updating unit from " + unit() + " to " + unit);
}
if (unit == null) {
webobjectsexamples.businesslogic.rentals.common.Unit oldValue = unit();
if (oldValue != null) {
removeObjectFromBothSidesOfRelationshipWithKey(oldValue, "unit");
}
} else {
addObjectToBothSidesOfRelationshipWithKey(unit, "unit");
}
return eo;
}
|
public static Rental createRental(EOEditingContext editingContext, NSTimestamp dateOut, webobjectsexamples.businesslogic.rentals.common.Customer customer, webobjectsexamples.businesslogic.rentals.common.Unit unit) {
Rental eo = (Rental) EOUtilities.createAndInsertInstance(editingContext, _Rental.ENTITY_NAME);
if (_Rental.LOG.isDebugEnabled()) {
_Rental.LOG.debug("updating dateOut from " + dateOut() + " to " + dateOut);
}
takeStoredValueForKey(dateOut, "dateOut");
if (_Rental.LOG.isDebugEnabled()) {
_Rental.LOG.debug("updating customer from " + customer() + " to " + customer);
}
if (customer == null) {
webobjectsexamples.businesslogic.rentals.common.Customer oldValue = customer();
if (oldValue != null) {
removeObjectFromBothSidesOfRelationshipWithKey(oldValue, "customer");
}
} else {
addObjectToBothSidesOfRelationshipWithKey(customer, "customer");
}
<DeepExtract>
if (_Rental.LOG.isDebugEnabled()) {
_Rental.LOG.debug("updating unit from " + unit() + " to " + unit);
}
if (unit == null) {
webobjectsexamples.businesslogic.rentals.common.Unit oldValue = unit();
if (oldValue != null) {
removeObjectFromBothSidesOfRelationshipWithKey(oldValue, "unit");
}
} else {
addObjectToBothSidesOfRelationshipWithKey(unit, "unit");
}
</DeepExtract>
return eo;
}
|
WODevGuide
|
positive
| 440,777
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
parent.replaceAll(txtFind.getText(), txtReplace.getText(), chkMatchCase.isSelected(), !chkBackwards.isSelected());
}
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
<DeepExtract>
parent.replaceAll(txtFind.getText(), txtReplace.getText(), chkMatchCase.isSelected(), !chkBackwards.isSelected());
</DeepExtract>
}
|
drmips
|
positive
| 440,778
|
@Override
public void assertFalse(boolean value, String errorMessage) {
assertBool(!value, errorMessage);
}
|
@Override
public void assertFalse(boolean value, String errorMessage) {
<DeepExtract>
assertBool(!value, errorMessage);
</DeepExtract>
}
|
parse4cn1
|
positive
| 440,780
|
public void keyPressed(java.awt.event.KeyEvent evt) {
if (evt.getKeyCode() == evt.VK_ENTER) {
for (int i = 0; i < 20; i++) {
Object y = DataTable.getValueAt(i, 1);
Object x = DataTable.getValueAt(i, 0);
String q = y.toString().toUpperCase();
String p = x.toString();
Pattern ppp;
ppp = Pattern.compile("^[A-Fa-f0-9]{2}$");
Matcher mmm = ppp.matcher(q);
if (!mmm.find()) {
JOptionPane.showMessageDialog(this, q + " is not a 1 Byte Hex digit");
DataTable.setValueAt("00", i, 1);
} else {
simulator.setData(Address.from(p), Data.from(q));
}
}
}
}
|
public void keyPressed(java.awt.event.KeyEvent evt) {
<DeepExtract>
if (evt.getKeyCode() == evt.VK_ENTER) {
for (int i = 0; i < 20; i++) {
Object y = DataTable.getValueAt(i, 1);
Object x = DataTable.getValueAt(i, 0);
String q = y.toString().toUpperCase();
String p = x.toString();
Pattern ppp;
ppp = Pattern.compile("^[A-Fa-f0-9]{2}$");
Matcher mmm = ppp.matcher(q);
if (!mmm.find()) {
JOptionPane.showMessageDialog(this, q + " is not a 1 Byte Hex digit");
DataTable.setValueAt("00", i, 1);
} else {
simulator.setData(Address.from(p), Data.from(q));
}
}
}
</DeepExtract>
}
|
8085
|
positive
| 440,782
|
public WorkerSpider startRequest(List<Request> startRequests) {
if (stat.get() == STAT_RUNNING) {
throw new IllegalStateException("Spider is already running!");
}
this.startRequests = startRequests;
return this;
}
|
public WorkerSpider startRequest(List<Request> startRequests) {
<DeepExtract>
if (stat.get() == STAT_RUNNING) {
throw new IllegalStateException("Spider is already running!");
}
</DeepExtract>
this.startRequests = startRequests;
return this;
}
|
spider-man
|
positive
| 440,783
|
@Test
public void should_Return404_When_IllegalAccessToMethodIsPerformed() {
String accessErrorMessage = "Access error";
VaadinConnectAccessChecker restrictingCheckerMock = mock(VaadinConnectAccessChecker.class);
when(restrictingCheckerMock.check(TEST_METHOD)).thenReturn(accessErrorMessage);
VaadinServiceNameChecker nameCheckerMock = mock(VaadinServiceNameChecker.class);
when(nameCheckerMock.check(TEST_SERVICE_NAME)).thenReturn(null);
ResponseEntity<String> response = createVaadinController(TEST_SERVICE, new ObjectMapper(), restrictingCheckerMock, nameCheckerMock).serveVaadinService(TEST_SERVICE_NAME, TEST_METHOD.getName(), null);
assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode());
String responseBody = response.getBody();
assertTrue(String.format("Response body '%s' should have service information in it", responseBody), responseBody.contains(TEST_SERVICE_NAME));
assertTrue(String.format("Response body '%s' should have service information in it", responseBody), responseBody.contains(TEST_METHOD.getName()));
assertTrue(String.format("Invalid response body: '%s'", responseBody), responseBody.contains(accessErrorMessage));
verify(restrictingCheckerMock, only()).check(TEST_METHOD);
verify(restrictingCheckerMock, times(1)).check(TEST_METHOD);
}
|
@Test
public void should_Return404_When_IllegalAccessToMethodIsPerformed() {
String accessErrorMessage = "Access error";
VaadinConnectAccessChecker restrictingCheckerMock = mock(VaadinConnectAccessChecker.class);
when(restrictingCheckerMock.check(TEST_METHOD)).thenReturn(accessErrorMessage);
VaadinServiceNameChecker nameCheckerMock = mock(VaadinServiceNameChecker.class);
when(nameCheckerMock.check(TEST_SERVICE_NAME)).thenReturn(null);
ResponseEntity<String> response = createVaadinController(TEST_SERVICE, new ObjectMapper(), restrictingCheckerMock, nameCheckerMock).serveVaadinService(TEST_SERVICE_NAME, TEST_METHOD.getName(), null);
assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode());
String responseBody = response.getBody();
<DeepExtract>
assertTrue(String.format("Response body '%s' should have service information in it", responseBody), responseBody.contains(TEST_SERVICE_NAME));
assertTrue(String.format("Response body '%s' should have service information in it", responseBody), responseBody.contains(TEST_METHOD.getName()));
</DeepExtract>
assertTrue(String.format("Invalid response body: '%s'", responseBody), responseBody.contains(accessErrorMessage));
verify(restrictingCheckerMock, only()).check(TEST_METHOD);
verify(restrictingCheckerMock, times(1)).check(TEST_METHOD);
}
|
vaadin-connect
|
positive
| 440,786
|
@Override
public String toString() {
return getFieldValue(Field.FILE);
}
|
@Override
public String toString() {
<DeepExtract>
return getFieldValue(Field.FILE);
</DeepExtract>
}
|
eclipse-instasearch
|
positive
| 440,787
|
@Override
public void usingExecutorService(final ExecutorService executorService) {
logger.debug("usingExecutorService {}", executorService);
final LinkedList<Exception> exceptions = new LinkedList<>();
for (final EmbedderMonitor monitor : this.monitors) {
try {
monitor.usingExecutorService(executorService);
} catch (final Exception suppressed) {
logger.error("exception during calling {}#usingExecutorService", monitor.getClass(), suppressed);
exceptions.add(suppressed);
}
}
if (exceptions.size() > 0) {
StringBuilder builder = new StringBuilder();
for (Exception suppressed : exceptions) {
builder.append("\"").append(suppressed.getMessage()).append("\" ; ");
}
final RuntimeException chained = new RuntimeException("Exceptions thrown with messages:" + builder.toString());
for (Exception suppressed : exceptions) {
chained.addSuppressed(suppressed);
}
throw chained;
}
}
|
@Override
public void usingExecutorService(final ExecutorService executorService) {
logger.debug("usingExecutorService {}", executorService);
final LinkedList<Exception> exceptions = new LinkedList<>();
for (final EmbedderMonitor monitor : this.monitors) {
try {
monitor.usingExecutorService(executorService);
} catch (final Exception suppressed) {
logger.error("exception during calling {}#usingExecutorService", monitor.getClass(), suppressed);
exceptions.add(suppressed);
}
}
<DeepExtract>
if (exceptions.size() > 0) {
StringBuilder builder = new StringBuilder();
for (Exception suppressed : exceptions) {
builder.append("\"").append(suppressed.getMessage()).append("\" ; ");
}
final RuntimeException chained = new RuntimeException("Exceptions thrown with messages:" + builder.toString());
for (Exception suppressed : exceptions) {
chained.addSuppressed(suppressed);
}
throw chained;
}
</DeepExtract>
}
|
serenity-jbehave
|
positive
| 440,788
|
@Override
public void streamFreed() throws ProducerException {
mLog.debug("Stream {} is closed", mStreamInfo.getName());
if (ReadResult.INVALID_UPLOAD_HANDLE_VALUE == ReadResult.INVALID_UPLOAD_HANDLE_VALUE) {
for (final Map.Entry<Long, NativeDataInputStream> stream : mInputStreamMap.entrySet()) {
try {
stream.getValue().close();
if (mStreamCallbacks != null) {
mStreamCallbacks.streamClosed(stream.getKey());
}
} catch (final IOException e) {
mLog.error("stream close failed with exception ", e);
}
}
mStoppedLatch.countDown();
} else {
try {
mInputStreamMap.get(ReadResult.INVALID_UPLOAD_HANDLE_VALUE).close();
} catch (final IOException e) {
mLog.error("stream close failed with exception ", e);
}
mStoppedLatch.countDown();
if (mStreamCallbacks != null) {
mStreamCallbacks.streamClosed(ReadResult.INVALID_UPLOAD_HANDLE_VALUE);
}
}
mStreamHandle = NativeKinesisVideoProducerJni.INVALID_STREAM_HANDLE_VALUE;
}
|
@Override
public void streamFreed() throws ProducerException {
<DeepExtract>
mLog.debug("Stream {} is closed", mStreamInfo.getName());
if (ReadResult.INVALID_UPLOAD_HANDLE_VALUE == ReadResult.INVALID_UPLOAD_HANDLE_VALUE) {
for (final Map.Entry<Long, NativeDataInputStream> stream : mInputStreamMap.entrySet()) {
try {
stream.getValue().close();
if (mStreamCallbacks != null) {
mStreamCallbacks.streamClosed(stream.getKey());
}
} catch (final IOException e) {
mLog.error("stream close failed with exception ", e);
}
}
mStoppedLatch.countDown();
} else {
try {
mInputStreamMap.get(ReadResult.INVALID_UPLOAD_HANDLE_VALUE).close();
} catch (final IOException e) {
mLog.error("stream close failed with exception ", e);
}
mStoppedLatch.countDown();
if (mStreamCallbacks != null) {
mStreamCallbacks.streamClosed(ReadResult.INVALID_UPLOAD_HANDLE_VALUE);
}
}
</DeepExtract>
mStreamHandle = NativeKinesisVideoProducerJni.INVALID_STREAM_HANDLE_VALUE;
}
|
amazon-kinesis-video-streams-producer-sdk-java
|
positive
| 440,789
|
public static JobConfig mergeJobConfigWithMergeConfig(JobConfig mainGlobalConfig, JobConfig mergeGlobalConfig) {
JobConfig.Builder mergedJobConfigBuilder = JobConfig.jobConfigBuilder();
mergedJobConfigBuilder.withBrowser(mainGlobalConfig.browser != DEFAULT_BROWSER ? mainGlobalConfig.browser : mergeGlobalConfig.browser);
mergedJobConfigBuilder.withCheckForErrorsInLog(mainGlobalConfig.checkForErrorsInLog || mergeGlobalConfig.checkForErrorsInLog);
mergedJobConfigBuilder.withDebug(mainGlobalConfig.debug || mergeGlobalConfig.debug);
mergedJobConfigBuilder.withGlobalTimeout(mainGlobalConfig.globalTimeout != DEFAULT_GLOBAL_TIMEOUT ? mainGlobalConfig.globalTimeout : mergeGlobalConfig.globalTimeout);
mergedJobConfigBuilder.withGlobalWaitAfterPageLoad(mainGlobalConfig.globalWaitAfterPageLoad != DEFAULT_GLOBAL_WAIT_AFTER_PAGE_LOAD ? mainGlobalConfig.globalWaitAfterPageLoad : mergeGlobalConfig.globalWaitAfterPageLoad);
mergedJobConfigBuilder.withHttpCheck(!mainGlobalConfig.httpCheck.equals(DEFAULT_HTTP_CHECK_CONFIG) ? mainGlobalConfig.httpCheck : mergeGlobalConfig.httpCheck);
mergedJobConfigBuilder.withLogToFile(mainGlobalConfig.logToFile || mergeGlobalConfig.logToFile);
mergedJobConfigBuilder.withName(mainGlobalConfig.name != null ? mainGlobalConfig.name : mergeGlobalConfig.name);
mergedJobConfigBuilder.withPageLoadTimeout(mainGlobalConfig.pageLoadTimeout != DEFAULT_PAGELOAD_TIMEOUT ? mainGlobalConfig.pageLoadTimeout : mergeGlobalConfig.pageLoadTimeout);
mergedJobConfigBuilder.withReportFormat(mainGlobalConfig.reportFormat != DEFAULT_REPORT_FORMAT ? mainGlobalConfig.reportFormat : mergeGlobalConfig.reportFormat);
mergedJobConfigBuilder.withScreenshotRetries(mainGlobalConfig.screenshotRetries != DEFAULT_SCREENSHOT_RETRIES ? mainGlobalConfig.screenshotRetries : mergeGlobalConfig.screenshotRetries);
mergedJobConfigBuilder.withThreads(mainGlobalConfig.threads != DEFAULT_THREADS ? mainGlobalConfig.threads : mergeGlobalConfig.threads);
mergedJobConfigBuilder.withWindowHeight(mainGlobalConfig.windowHeight != null ? mainGlobalConfig.windowHeight : mergeGlobalConfig.windowHeight);
Map<String, UrlConfig> urls = mainGlobalConfig.urls;
for (Map.Entry<String, UrlConfig> mainUrlConfigEntry : urls.entrySet()) {
UrlConfig mainUrlConfig = mainUrlConfigEntry.getValue();
Map<String, UrlConfig> mergeUrls = mergeGlobalConfig.urls;
for (Map.Entry<String, UrlConfig> mergeUrlConfigEntry : mergeUrls.entrySet()) {
if (mainUrlConfigEntry.getKey().matches(mergeUrlConfigEntry.getKey())) {
LOG.info("Merging merge config for '{}' into '{}'", mergeUrlConfigEntry.getKey(), mainUrlConfigEntry.getKey());
UrlConfig mergeUrlConfig = mergeUrlConfigEntry.getValue();
UrlConfig.Builder urlConfigBuilder = UrlConfig.urlConfigBuilder();
urlConfigBuilder.withUrl(mainUrlConfig.url);
urlConfigBuilder.withAlternatingCookies(merge(mainUrlConfig.alternatingCookies, mergeUrlConfig.alternatingCookies));
urlConfigBuilder.withCleanupPaths(merge(mainUrlConfig.cleanupPaths, mergeUrlConfig.cleanupPaths));
urlConfigBuilder.withCookies(merge(mainUrlConfig.cookies, mergeUrlConfig.cookies));
urlConfigBuilder.withDevices(merge(mainUrlConfig.devices, mergeUrlConfig.devices));
urlConfigBuilder.withEnvMapping(merge(mainUrlConfig.envMapping, mergeUrlConfig.envMapping));
urlConfigBuilder.withFailIfSelectorsNotFound(mainUrlConfig.failIfSelectorsNotFound || mergeUrlConfig.failIfSelectorsNotFound);
urlConfigBuilder.withHideImages(mainUrlConfig.hideImages || mergeUrlConfig.hideImages);
urlConfigBuilder.withHttpCheck(mainUrlConfig.httpCheck != DEFAULT_HTTP_CHECK_CONFIG ? mainUrlConfig.httpCheck : mergeUrlConfig.httpCheck);
urlConfigBuilder.withIgnoreAntiAliasing(mainUrlConfig.ignoreAntiAliasing || mergeUrlConfig.ignoreAntiAliasing);
urlConfigBuilder.withJavaScript(mainUrlConfig.javaScript == null && mergeUrlConfig.javaScript == null ? null : "" + mainUrlConfig.javaScript + ";" + mergeUrlConfig.javaScript);
urlConfigBuilder.withLocalStorage(merge(mainUrlConfig.localStorage, mergeUrlConfig.localStorage));
urlConfigBuilder.withMaxColorDistance(mainUrlConfig.maxColorDistance != DEFAULT_MAX_COLOR_DISTANCE ? mainUrlConfig.maxColorDistance : mergeUrlConfig.maxColorDistance);
urlConfigBuilder.withMaxDiff(mainUrlConfig.maxDiff != DEFAULT_MAX_DIFF ? mainUrlConfig.maxDiff : mergeUrlConfig.maxDiff);
urlConfigBuilder.withMaxScrollHeight(mainUrlConfig.maxScrollHeight != DEFAULT_MAX_SCROLL_HEIGHT ? mainUrlConfig.maxScrollHeight : mergeUrlConfig.maxScrollHeight);
urlConfigBuilder.withPaths(merge(mainUrlConfig.paths, mergeUrlConfig.paths));
urlConfigBuilder.withRemoveSelectors(merge(mainUrlConfig.removeSelectors, mergeUrlConfig.removeSelectors));
urlConfigBuilder.withSessionStorage(merge(mainUrlConfig.sessionStorage, mergeUrlConfig.sessionStorage));
urlConfigBuilder.withSetupPaths(merge(mainUrlConfig.setupPaths, mergeUrlConfig.setupPaths));
urlConfigBuilder.withStrictColorComparison(mainUrlConfig.strictColorComparison || mergeUrlConfig.strictColorComparison);
urlConfigBuilder.withWaitAfterPageLoad(mainUrlConfig.waitAfterPageLoad != DEFAULT_WAIT_AFTER_PAGE_LOAD ? mainUrlConfig.waitAfterPageLoad : mergeUrlConfig.waitAfterPageLoad);
urlConfigBuilder.withWaitAfterScroll(mainUrlConfig.waitAfterScroll != DEFAULT_WAIT_AFTER_SCROLL ? mainUrlConfig.waitAfterScroll : mergeUrlConfig.waitAfterScroll);
urlConfigBuilder.withWaitForFontsTime(mainUrlConfig.waitForFontsTime != DEFAULT_WAIT_FOR_FONTS_TIME ? mainUrlConfig.waitForFontsTime : mergeUrlConfig.waitForFontsTime);
urlConfigBuilder.withWaitForNoAnimationAfterScroll(mainUrlConfig.waitForNoAnimationAfterScroll != DEFAULT_WAIT_FOR_NO_ANIMATION_AFTER_SCROLL ? mainUrlConfig.waitForNoAnimationAfterScroll : mergeUrlConfig.waitForNoAnimationAfterScroll);
urlConfigBuilder.withWaitForSelectors(merge(mainUrlConfig.waitForSelectors, mergeUrlConfig.waitForSelectors));
urlConfigBuilder.withWaitForSelectorsTimeout(mainUrlConfig.waitForSelectorsTimeout != DEFAULT_WAIT_FOR_SELECTORS_TIMEOUT ? mainUrlConfig.waitForSelectorsTimeout : mergeUrlConfig.waitForSelectorsTimeout);
urlConfigBuilder.withWarmupBrowserCacheTime(mainUrlConfig.warmupBrowserCacheTime != DEFAULT_WARMUP_BROWSER_CACHE_TIME ? mainUrlConfig.warmupBrowserCacheTime : mergeUrlConfig.warmupBrowserCacheTime);
urlConfigBuilder.withWindowWidths(merge(mainUrlConfig.windowWidths, mergeUrlConfig.windowWidths));
mainUrlConfig = urlConfigBuilder.build();
}
}
mergedJobConfigBuilder.addUrlConfig(mainUrlConfigEntry.getKey(), mainUrlConfig);
}
return mergedJobConfigBuilder.build();
}
|
public static JobConfig mergeJobConfigWithMergeConfig(JobConfig mainGlobalConfig, JobConfig mergeGlobalConfig) {
JobConfig.Builder mergedJobConfigBuilder = JobConfig.jobConfigBuilder();
<DeepExtract>
mergedJobConfigBuilder.withBrowser(mainGlobalConfig.browser != DEFAULT_BROWSER ? mainGlobalConfig.browser : mergeGlobalConfig.browser);
mergedJobConfigBuilder.withCheckForErrorsInLog(mainGlobalConfig.checkForErrorsInLog || mergeGlobalConfig.checkForErrorsInLog);
mergedJobConfigBuilder.withDebug(mainGlobalConfig.debug || mergeGlobalConfig.debug);
mergedJobConfigBuilder.withGlobalTimeout(mainGlobalConfig.globalTimeout != DEFAULT_GLOBAL_TIMEOUT ? mainGlobalConfig.globalTimeout : mergeGlobalConfig.globalTimeout);
mergedJobConfigBuilder.withGlobalWaitAfterPageLoad(mainGlobalConfig.globalWaitAfterPageLoad != DEFAULT_GLOBAL_WAIT_AFTER_PAGE_LOAD ? mainGlobalConfig.globalWaitAfterPageLoad : mergeGlobalConfig.globalWaitAfterPageLoad);
mergedJobConfigBuilder.withHttpCheck(!mainGlobalConfig.httpCheck.equals(DEFAULT_HTTP_CHECK_CONFIG) ? mainGlobalConfig.httpCheck : mergeGlobalConfig.httpCheck);
mergedJobConfigBuilder.withLogToFile(mainGlobalConfig.logToFile || mergeGlobalConfig.logToFile);
mergedJobConfigBuilder.withName(mainGlobalConfig.name != null ? mainGlobalConfig.name : mergeGlobalConfig.name);
mergedJobConfigBuilder.withPageLoadTimeout(mainGlobalConfig.pageLoadTimeout != DEFAULT_PAGELOAD_TIMEOUT ? mainGlobalConfig.pageLoadTimeout : mergeGlobalConfig.pageLoadTimeout);
mergedJobConfigBuilder.withReportFormat(mainGlobalConfig.reportFormat != DEFAULT_REPORT_FORMAT ? mainGlobalConfig.reportFormat : mergeGlobalConfig.reportFormat);
mergedJobConfigBuilder.withScreenshotRetries(mainGlobalConfig.screenshotRetries != DEFAULT_SCREENSHOT_RETRIES ? mainGlobalConfig.screenshotRetries : mergeGlobalConfig.screenshotRetries);
mergedJobConfigBuilder.withThreads(mainGlobalConfig.threads != DEFAULT_THREADS ? mainGlobalConfig.threads : mergeGlobalConfig.threads);
mergedJobConfigBuilder.withWindowHeight(mainGlobalConfig.windowHeight != null ? mainGlobalConfig.windowHeight : mergeGlobalConfig.windowHeight);
</DeepExtract>
Map<String, UrlConfig> urls = mainGlobalConfig.urls;
for (Map.Entry<String, UrlConfig> mainUrlConfigEntry : urls.entrySet()) {
UrlConfig mainUrlConfig = mainUrlConfigEntry.getValue();
Map<String, UrlConfig> mergeUrls = mergeGlobalConfig.urls;
for (Map.Entry<String, UrlConfig> mergeUrlConfigEntry : mergeUrls.entrySet()) {
if (mainUrlConfigEntry.getKey().matches(mergeUrlConfigEntry.getKey())) {
LOG.info("Merging merge config for '{}' into '{}'", mergeUrlConfigEntry.getKey(), mainUrlConfigEntry.getKey());
UrlConfig mergeUrlConfig = mergeUrlConfigEntry.getValue();
UrlConfig.Builder urlConfigBuilder = UrlConfig.urlConfigBuilder();
urlConfigBuilder.withUrl(mainUrlConfig.url);
urlConfigBuilder.withAlternatingCookies(merge(mainUrlConfig.alternatingCookies, mergeUrlConfig.alternatingCookies));
urlConfigBuilder.withCleanupPaths(merge(mainUrlConfig.cleanupPaths, mergeUrlConfig.cleanupPaths));
urlConfigBuilder.withCookies(merge(mainUrlConfig.cookies, mergeUrlConfig.cookies));
urlConfigBuilder.withDevices(merge(mainUrlConfig.devices, mergeUrlConfig.devices));
urlConfigBuilder.withEnvMapping(merge(mainUrlConfig.envMapping, mergeUrlConfig.envMapping));
urlConfigBuilder.withFailIfSelectorsNotFound(mainUrlConfig.failIfSelectorsNotFound || mergeUrlConfig.failIfSelectorsNotFound);
urlConfigBuilder.withHideImages(mainUrlConfig.hideImages || mergeUrlConfig.hideImages);
urlConfigBuilder.withHttpCheck(mainUrlConfig.httpCheck != DEFAULT_HTTP_CHECK_CONFIG ? mainUrlConfig.httpCheck : mergeUrlConfig.httpCheck);
urlConfigBuilder.withIgnoreAntiAliasing(mainUrlConfig.ignoreAntiAliasing || mergeUrlConfig.ignoreAntiAliasing);
urlConfigBuilder.withJavaScript(mainUrlConfig.javaScript == null && mergeUrlConfig.javaScript == null ? null : "" + mainUrlConfig.javaScript + ";" + mergeUrlConfig.javaScript);
urlConfigBuilder.withLocalStorage(merge(mainUrlConfig.localStorage, mergeUrlConfig.localStorage));
urlConfigBuilder.withMaxColorDistance(mainUrlConfig.maxColorDistance != DEFAULT_MAX_COLOR_DISTANCE ? mainUrlConfig.maxColorDistance : mergeUrlConfig.maxColorDistance);
urlConfigBuilder.withMaxDiff(mainUrlConfig.maxDiff != DEFAULT_MAX_DIFF ? mainUrlConfig.maxDiff : mergeUrlConfig.maxDiff);
urlConfigBuilder.withMaxScrollHeight(mainUrlConfig.maxScrollHeight != DEFAULT_MAX_SCROLL_HEIGHT ? mainUrlConfig.maxScrollHeight : mergeUrlConfig.maxScrollHeight);
urlConfigBuilder.withPaths(merge(mainUrlConfig.paths, mergeUrlConfig.paths));
urlConfigBuilder.withRemoveSelectors(merge(mainUrlConfig.removeSelectors, mergeUrlConfig.removeSelectors));
urlConfigBuilder.withSessionStorage(merge(mainUrlConfig.sessionStorage, mergeUrlConfig.sessionStorage));
urlConfigBuilder.withSetupPaths(merge(mainUrlConfig.setupPaths, mergeUrlConfig.setupPaths));
urlConfigBuilder.withStrictColorComparison(mainUrlConfig.strictColorComparison || mergeUrlConfig.strictColorComparison);
urlConfigBuilder.withWaitAfterPageLoad(mainUrlConfig.waitAfterPageLoad != DEFAULT_WAIT_AFTER_PAGE_LOAD ? mainUrlConfig.waitAfterPageLoad : mergeUrlConfig.waitAfterPageLoad);
urlConfigBuilder.withWaitAfterScroll(mainUrlConfig.waitAfterScroll != DEFAULT_WAIT_AFTER_SCROLL ? mainUrlConfig.waitAfterScroll : mergeUrlConfig.waitAfterScroll);
urlConfigBuilder.withWaitForFontsTime(mainUrlConfig.waitForFontsTime != DEFAULT_WAIT_FOR_FONTS_TIME ? mainUrlConfig.waitForFontsTime : mergeUrlConfig.waitForFontsTime);
urlConfigBuilder.withWaitForNoAnimationAfterScroll(mainUrlConfig.waitForNoAnimationAfterScroll != DEFAULT_WAIT_FOR_NO_ANIMATION_AFTER_SCROLL ? mainUrlConfig.waitForNoAnimationAfterScroll : mergeUrlConfig.waitForNoAnimationAfterScroll);
urlConfigBuilder.withWaitForSelectors(merge(mainUrlConfig.waitForSelectors, mergeUrlConfig.waitForSelectors));
urlConfigBuilder.withWaitForSelectorsTimeout(mainUrlConfig.waitForSelectorsTimeout != DEFAULT_WAIT_FOR_SELECTORS_TIMEOUT ? mainUrlConfig.waitForSelectorsTimeout : mergeUrlConfig.waitForSelectorsTimeout);
urlConfigBuilder.withWarmupBrowserCacheTime(mainUrlConfig.warmupBrowserCacheTime != DEFAULT_WARMUP_BROWSER_CACHE_TIME ? mainUrlConfig.warmupBrowserCacheTime : mergeUrlConfig.warmupBrowserCacheTime);
urlConfigBuilder.withWindowWidths(merge(mainUrlConfig.windowWidths, mergeUrlConfig.windowWidths));
mainUrlConfig = urlConfigBuilder.build();
}
}
mergedJobConfigBuilder.addUrlConfig(mainUrlConfigEntry.getKey(), mainUrlConfig);
}
return mergedJobConfigBuilder.build();
}
|
jlineup
|
positive
| 440,792
|
@Override
public Boolean hSet(String key, String hashKey, Object value, long time) {
redisTemplate.opsForHash().put(key, hashKey, value);
return redisTemplate.expire(key, time, TimeUnit.SECONDS);
}
|
@Override
public Boolean hSet(String key, String hashKey, Object value, long time) {
redisTemplate.opsForHash().put(key, hashKey, value);
<DeepExtract>
return redisTemplate.expire(key, time, TimeUnit.SECONDS);
</DeepExtract>
}
|
PMPanel
|
positive
| 440,793
|
@Deprecated
public AccessRightsSubPage addPermissionForUser(String username, String permission, boolean grant) {
boolean allowNegativeACL = hasElement(By.id("add_rights_form:rights_grant_select"));
if (!allowNegativeACL) {
if (grant) {
log.warn("addPermissionForUser with negative ACL disabled is deprecated.");
return grantPermissionForUser(permission, username);
} else {
throw new UnsupportedOperationException("Negative ACL are currently disabled!");
}
}
WebElement selectGrantElement = driver.findElement(By.id("add_rights_form:rights_grant_select"));
Select2WidgetElement userSelection = new Select2WidgetElement(driver, driver.findElement(By.xpath("//*[@id='s2id_add_rights_form:nxl_user_group_suggestion:nxw_selection_select2']")), true);
userSelection.selectValue(username);
Select selectGrant = new Select(selectGrantElement);
if (grant) {
selectGrant.selectByValue("Grant");
} else {
selectGrant.selectByValue("Deny");
}
Select selectPermission = new Select(selectPermissionElement);
selectPermission.selectByVisibleText(permission);
addButton.click();
waitUntilEnabled(validateButton);
validateButton.click();
return asPage(AccessRightsSubPage.class);
}
|
@Deprecated
public AccessRightsSubPage addPermissionForUser(String username, String permission, boolean grant) {
boolean allowNegativeACL = hasElement(By.id("add_rights_form:rights_grant_select"));
if (!allowNegativeACL) {
if (grant) {
log.warn("addPermissionForUser with negative ACL disabled is deprecated.");
return grantPermissionForUser(permission, username);
} else {
throw new UnsupportedOperationException("Negative ACL are currently disabled!");
}
}
WebElement selectGrantElement = driver.findElement(By.id("add_rights_form:rights_grant_select"));
Select2WidgetElement userSelection = new Select2WidgetElement(driver, driver.findElement(By.xpath("//*[@id='s2id_add_rights_form:nxl_user_group_suggestion:nxw_selection_select2']")), true);
userSelection.selectValue(username);
Select selectGrant = new Select(selectGrantElement);
if (grant) {
selectGrant.selectByValue("Grant");
} else {
selectGrant.selectByValue("Deny");
}
Select selectPermission = new Select(selectPermissionElement);
selectPermission.selectByVisibleText(permission);
addButton.click();
<DeepExtract>
waitUntilEnabled(validateButton);
validateButton.click();
return asPage(AccessRightsSubPage.class);
</DeepExtract>
}
|
nuxeo-distribution
|
positive
| 440,794
|
public InventoryList getHops() {
InventoryList list = new InventoryList();
for (InventoryItem item : this) {
if (item.getIngredient().getClass().equals(Hop.class)) {
list.add(item);
}
}
return list;
}
|
public InventoryList getHops() {
<DeepExtract>
InventoryList list = new InventoryList();
for (InventoryItem item : this) {
if (item.getIngredient().getClass().equals(Hop.class)) {
list.add(item);
}
}
return list;
</DeepExtract>
}
|
BrewShopApp
|
positive
| 440,795
|
public ToStringBuilder appendItem(String propertyName, byte propertyValue) {
insertPropertyName(propertyName, false);
mBuffer.append(String.valueOf(propertyValue));
close(false);
return this;
}
|
public ToStringBuilder appendItem(String propertyName, byte propertyValue) {
<DeepExtract>
insertPropertyName(propertyName, false);
mBuffer.append(String.valueOf(propertyValue));
close(false);
</DeepExtract>
return this;
}
|
rivr
|
positive
| 440,796
|
public int actionCreate(String clustername, ActionCreateArgs createArgs) throws YarnException, IOException {
HoyaUtils.validateClusterName(clustername);
verifyManagerSet();
verifyNoLiveClusters(clustername);
Path clusterDirectory = hoyaFileSystem.buildHoyaClusterDirPath(clustername);
Path snapshotConfPath = new Path(clusterDirectory, HoyaKeys.SNAPSHOT_CONF_DIR_NAME);
Path generatedConfPath = new Path(clusterDirectory, HoyaKeys.GENERATED_CONF_DIR_NAME);
Path clusterSpecPath = new Path(clusterDirectory, HoyaKeys.CLUSTER_SPECIFICATION_FILE);
hoyaFileSystem.verifyClusterDirectoryNonexistent(clustername, clusterDirectory);
Configuration conf = getConfig();
ClusterDescription clusterSpec = new ClusterDescription();
Path appconfdir = createArgs.getConfdir();
requireArgumentSet(Arguments.ARG_CONFDIR, appconfdir);
requireArgumentSet(Arguments.ARG_PROVIDER, createArgs.getProvider());
HoyaAMClientProvider hoyaAM = new HoyaAMClientProvider(conf);
ClientProvider provider;
provider = createClientProvider(createArgs.getProvider());
clusterSpec.type = provider.getName();
clusterSpec.name = clustername;
clusterSpec.state = ClusterDescription.STATE_INCOMPLETE;
long now = System.currentTimeMillis();
clusterSpec.createTime = now;
clusterSpec.setInfoTime(StatusKeys.INFO_CREATE_TIME_HUMAN, StatusKeys.INFO_CREATE_TIME_MILLIS, now);
HoyaUtils.addBuildInfo(clusterSpec, "create");
Map<String, String> options = new HashMap<String, String>();
HoyaUtils.mergeEntries(options, hoyaAM.getDefaultClusterConfiguration());
HoyaUtils.mergeEntries(options, provider.getDefaultClusterConfiguration());
clusterSpec.options = options;
String fsDefaultName = conf.get(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY);
clusterSpec.setOptionifUnset(OptionKeys.SITE_XML_PREFIX + CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, fsDefaultName);
clusterSpec.setOptionifUnset(OptionKeys.SITE_XML_PREFIX + HoyaXmlConfKeys.FS_DEFAULT_NAME_CLASSIC, fsDefaultName);
Path tmp = hoyaFileSystem.getTempPathForCluster(clustername);
Path tempDirPath = new Path(tmp, "am");
clusterSpec.setOption(OptionKeys.HOYA_TMP_DIR, tempDirPath.toUri().toString());
propagatePrincipals(clusterSpec, conf);
HoyaUtils.mergeMap(clusterSpec.options, createArgs.getOptionsMap());
List<ProviderRole> supportedRoles = new ArrayList<ProviderRole>();
supportedRoles.addAll(provider.getRoles());
Map<String, String> argsRoleMap = createArgs.getRoleMap();
Map<String, Map<String, String>> clusterRoleMap = new HashMap<String, Map<String, String>>();
for (ProviderRole role : supportedRoles) {
String roleName = role.name;
Map<String, String> clusterRole = provider.createDefaultClusterRole(roleName);
String instanceCount = argsRoleMap.remove(roleName);
int defInstances = HoyaUtils.getIntValue(clusterRole, RoleKeys.ROLE_INSTANCES, 0, 0, -1);
instanceCount = Integer.toString(HoyaUtils.parseAndValidate("count of role " + roleName, instanceCount, defInstances, 0, -1));
clusterRole.put(RoleKeys.ROLE_INSTANCES, instanceCount);
clusterRoleMap.put(roleName, clusterRole);
}
for (Map.Entry<String, String> roleAndCount : argsRoleMap.entrySet()) {
String name = roleAndCount.getKey();
String count = roleAndCount.getValue();
log.debug("Creating non-standard role {} of size {}", name, count);
HashMap<String, String> newRole = new HashMap<String, String>();
newRole.put(RoleKeys.ROLE_NAME, name);
newRole.put(RoleKeys.ROLE_INSTANCES, count);
clusterRoleMap.put(name, newRole);
}
Collection<ProviderRole> amRoles = hoyaAM.getRoles();
for (ProviderRole role : amRoles) {
String roleName = role.name;
Map<String, String> clusterRole = hoyaAM.createDefaultClusterRole(roleName);
clusterRoleMap.put(roleName, clusterRole);
}
Map<String, Map<String, String>> commandOptions = createArgs.getRoleOptionMap();
HoyaUtils.applyCommandLineOptsToRoleMap(clusterRoleMap, commandOptions);
clusterSpec.roles = clusterRoleMap;
if (createArgs.getImage() != null) {
if (!isUnset(createArgs.getAppHomeDir())) {
throw new BadCommandArgumentsException("Only one of " + Arguments.ARG_IMAGE + " and " + Arguments.ARG_APP_HOME + " can be provided");
}
clusterSpec.setImagePath(createArgs.getImage().toUri().toString());
} else {
if (isUnset(createArgs.getAppHomeDir())) {
throw new BadCommandArgumentsException("Either " + Arguments.ARG_IMAGE + " or " + Arguments.ARG_APP_HOME + " must be provided");
}
clusterSpec.setApplicationHome(createArgs.getAppHomeDir());
}
String zookeeperRoot = createArgs.getAppZKPath();
if (isUnset(zookeeperRoot)) {
zookeeperRoot = "/yarnapps_" + getAppName() + "_" + getUsername() + "_" + clustername;
}
clusterSpec.setZkPath(zookeeperRoot);
clusterSpec.setZkPort(createArgs.getZKport());
clusterSpec.setZkHosts(createArgs.getZKhosts());
FileSystem srcFS = FileSystem.get(appconfdir.toUri(), conf);
if (!srcFS.isDirectory(appconfdir)) {
throw new BadCommandArgumentsException("Configuration directory specified in %s not valid: %s", Arguments.ARG_CONFDIR, appconfdir.toString());
}
clusterSpec.originConfigurationPath = snapshotConfPath.toUri().toASCIIString();
clusterSpec.generatedConfigurationPath = generatedConfPath.toUri().toASCIIString();
hoyaFileSystem.createClusterDirectories(clustername, getConfig());
try {
clusterSpec.save(hoyaFileSystem.getFileSystem(), clusterSpecPath, false);
} catch (FileAlreadyExistsException fae) {
throw new HoyaException(EXIT_CLUSTER_EXISTS, PRINTF_E_ALREADY_EXISTS, clustername, clusterSpecPath);
} catch (IOException e) {
throw new HoyaException(EXIT_CLUSTER_EXISTS, e, PRINTF_E_ALREADY_EXISTS, clustername, clusterSpecPath);
}
FsPermission clusterPerms = getClusterDirectoryPermissions(conf);
HoyaUtils.copyDirectory(conf, appconfdir, snapshotConfPath, clusterPerms);
Path datapath = new Path(clusterDirectory, HoyaKeys.DATA_DIR_NAME);
log.debug("datapath={}", datapath);
clusterSpec.dataPath = datapath.toUri().toString();
provider.reviewAndUpdateClusterSpec(clusterSpec);
clusterSpec.state = ClusterDescription.STATE_CREATED;
clusterSpec.save(hoyaFileSystem.getFileSystem(), clusterSpecPath, true);
return EXIT_SUCCESS;
Path clusterSpecPath = locateClusterSpecification(clustername);
ClusterDescription clusterSpec = hoyaFileSystem.loadAndValidateClusterSpec(clusterSpecPath);
Path clusterDirectory = hoyaFileSystem.buildHoyaClusterDirPath(clustername);
return executeClusterStart(clusterDirectory, clusterSpec, createArgs);
}
|
public int actionCreate(String clustername, ActionCreateArgs createArgs) throws YarnException, IOException {
HoyaUtils.validateClusterName(clustername);
verifyManagerSet();
verifyNoLiveClusters(clustername);
Path clusterDirectory = hoyaFileSystem.buildHoyaClusterDirPath(clustername);
Path snapshotConfPath = new Path(clusterDirectory, HoyaKeys.SNAPSHOT_CONF_DIR_NAME);
Path generatedConfPath = new Path(clusterDirectory, HoyaKeys.GENERATED_CONF_DIR_NAME);
Path clusterSpecPath = new Path(clusterDirectory, HoyaKeys.CLUSTER_SPECIFICATION_FILE);
hoyaFileSystem.verifyClusterDirectoryNonexistent(clustername, clusterDirectory);
Configuration conf = getConfig();
ClusterDescription clusterSpec = new ClusterDescription();
Path appconfdir = createArgs.getConfdir();
requireArgumentSet(Arguments.ARG_CONFDIR, appconfdir);
requireArgumentSet(Arguments.ARG_PROVIDER, createArgs.getProvider());
HoyaAMClientProvider hoyaAM = new HoyaAMClientProvider(conf);
ClientProvider provider;
provider = createClientProvider(createArgs.getProvider());
clusterSpec.type = provider.getName();
clusterSpec.name = clustername;
clusterSpec.state = ClusterDescription.STATE_INCOMPLETE;
long now = System.currentTimeMillis();
clusterSpec.createTime = now;
clusterSpec.setInfoTime(StatusKeys.INFO_CREATE_TIME_HUMAN, StatusKeys.INFO_CREATE_TIME_MILLIS, now);
HoyaUtils.addBuildInfo(clusterSpec, "create");
Map<String, String> options = new HashMap<String, String>();
HoyaUtils.mergeEntries(options, hoyaAM.getDefaultClusterConfiguration());
HoyaUtils.mergeEntries(options, provider.getDefaultClusterConfiguration());
clusterSpec.options = options;
String fsDefaultName = conf.get(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY);
clusterSpec.setOptionifUnset(OptionKeys.SITE_XML_PREFIX + CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, fsDefaultName);
clusterSpec.setOptionifUnset(OptionKeys.SITE_XML_PREFIX + HoyaXmlConfKeys.FS_DEFAULT_NAME_CLASSIC, fsDefaultName);
Path tmp = hoyaFileSystem.getTempPathForCluster(clustername);
Path tempDirPath = new Path(tmp, "am");
clusterSpec.setOption(OptionKeys.HOYA_TMP_DIR, tempDirPath.toUri().toString());
propagatePrincipals(clusterSpec, conf);
HoyaUtils.mergeMap(clusterSpec.options, createArgs.getOptionsMap());
List<ProviderRole> supportedRoles = new ArrayList<ProviderRole>();
supportedRoles.addAll(provider.getRoles());
Map<String, String> argsRoleMap = createArgs.getRoleMap();
Map<String, Map<String, String>> clusterRoleMap = new HashMap<String, Map<String, String>>();
for (ProviderRole role : supportedRoles) {
String roleName = role.name;
Map<String, String> clusterRole = provider.createDefaultClusterRole(roleName);
String instanceCount = argsRoleMap.remove(roleName);
int defInstances = HoyaUtils.getIntValue(clusterRole, RoleKeys.ROLE_INSTANCES, 0, 0, -1);
instanceCount = Integer.toString(HoyaUtils.parseAndValidate("count of role " + roleName, instanceCount, defInstances, 0, -1));
clusterRole.put(RoleKeys.ROLE_INSTANCES, instanceCount);
clusterRoleMap.put(roleName, clusterRole);
}
for (Map.Entry<String, String> roleAndCount : argsRoleMap.entrySet()) {
String name = roleAndCount.getKey();
String count = roleAndCount.getValue();
log.debug("Creating non-standard role {} of size {}", name, count);
HashMap<String, String> newRole = new HashMap<String, String>();
newRole.put(RoleKeys.ROLE_NAME, name);
newRole.put(RoleKeys.ROLE_INSTANCES, count);
clusterRoleMap.put(name, newRole);
}
Collection<ProviderRole> amRoles = hoyaAM.getRoles();
for (ProviderRole role : amRoles) {
String roleName = role.name;
Map<String, String> clusterRole = hoyaAM.createDefaultClusterRole(roleName);
clusterRoleMap.put(roleName, clusterRole);
}
Map<String, Map<String, String>> commandOptions = createArgs.getRoleOptionMap();
HoyaUtils.applyCommandLineOptsToRoleMap(clusterRoleMap, commandOptions);
clusterSpec.roles = clusterRoleMap;
if (createArgs.getImage() != null) {
if (!isUnset(createArgs.getAppHomeDir())) {
throw new BadCommandArgumentsException("Only one of " + Arguments.ARG_IMAGE + " and " + Arguments.ARG_APP_HOME + " can be provided");
}
clusterSpec.setImagePath(createArgs.getImage().toUri().toString());
} else {
if (isUnset(createArgs.getAppHomeDir())) {
throw new BadCommandArgumentsException("Either " + Arguments.ARG_IMAGE + " or " + Arguments.ARG_APP_HOME + " must be provided");
}
clusterSpec.setApplicationHome(createArgs.getAppHomeDir());
}
String zookeeperRoot = createArgs.getAppZKPath();
if (isUnset(zookeeperRoot)) {
zookeeperRoot = "/yarnapps_" + getAppName() + "_" + getUsername() + "_" + clustername;
}
clusterSpec.setZkPath(zookeeperRoot);
clusterSpec.setZkPort(createArgs.getZKport());
clusterSpec.setZkHosts(createArgs.getZKhosts());
FileSystem srcFS = FileSystem.get(appconfdir.toUri(), conf);
if (!srcFS.isDirectory(appconfdir)) {
throw new BadCommandArgumentsException("Configuration directory specified in %s not valid: %s", Arguments.ARG_CONFDIR, appconfdir.toString());
}
clusterSpec.originConfigurationPath = snapshotConfPath.toUri().toASCIIString();
clusterSpec.generatedConfigurationPath = generatedConfPath.toUri().toASCIIString();
hoyaFileSystem.createClusterDirectories(clustername, getConfig());
try {
clusterSpec.save(hoyaFileSystem.getFileSystem(), clusterSpecPath, false);
} catch (FileAlreadyExistsException fae) {
throw new HoyaException(EXIT_CLUSTER_EXISTS, PRINTF_E_ALREADY_EXISTS, clustername, clusterSpecPath);
} catch (IOException e) {
throw new HoyaException(EXIT_CLUSTER_EXISTS, e, PRINTF_E_ALREADY_EXISTS, clustername, clusterSpecPath);
}
FsPermission clusterPerms = getClusterDirectoryPermissions(conf);
HoyaUtils.copyDirectory(conf, appconfdir, snapshotConfPath, clusterPerms);
Path datapath = new Path(clusterDirectory, HoyaKeys.DATA_DIR_NAME);
log.debug("datapath={}", datapath);
clusterSpec.dataPath = datapath.toUri().toString();
provider.reviewAndUpdateClusterSpec(clusterSpec);
clusterSpec.state = ClusterDescription.STATE_CREATED;
clusterSpec.save(hoyaFileSystem.getFileSystem(), clusterSpecPath, true);
return EXIT_SUCCESS;
<DeepExtract>
Path clusterSpecPath = locateClusterSpecification(clustername);
ClusterDescription clusterSpec = hoyaFileSystem.loadAndValidateClusterSpec(clusterSpecPath);
Path clusterDirectory = hoyaFileSystem.buildHoyaClusterDirPath(clustername);
return executeClusterStart(clusterDirectory, clusterSpec, createArgs);
</DeepExtract>
}
|
hoya
|
positive
| 440,797
|
@Test
public void manyBufferBadClientMocked() throws Throwable {
Random rnd = new Random(34598);
AtomicInteger bytesSent = new AtomicInteger(0);
AtomicInteger bytesRecvd = new AtomicInteger(0);
AtomicInteger numRecvd = new AtomicInteger(0);
AtomicInteger pending = new AtomicInteger(0);
ConcurrentHashMap<Long, Object> unreliableSet = new ConcurrentHashMap<>();
ConcurrentHashMap<Long, Object> reliableSet = new ConcurrentHashMap<>();
EventLoop testLoop = childGroup.next();
PromiseCombiner combiner = new PromiseCombiner(testLoop);
MockDatagramPair mockPair = true ? new MockDatagramPair() : null;
Brutalizer brutalizer = new Brutalizer();
Channel server = newServer(null, simpleHandler((ctx, msg) -> {
if (msg instanceof ByteBuf) {
ByteBuf buf = (ByteBuf) msg;
if (buf.readableBytes() == 8) {
long value = buf.readLong();
reliableSet.remove(value);
} else {
numRecvd.incrementAndGet();
bytesRecvd.addAndGet(buf.readableBytes());
}
}
ReferenceCountUtil.safeRelease(msg);
}), mockPair);
Channel client = newClient(null, mockPair);
ChannelPromise donePromise = client.newPromise();
client.pipeline().addAfter(DatagramChannelProxy.LISTENER_HANDLER_NAME, "brutalizer", brutalizer);
brutalizer.rnd = rnd;
brutalizer.brutalizeRead = false;
brutalizer.brutalizeWrite = false;
for (int i = 0; i < 1000; i++) {
int size = rnd.nextInt(5000) + 1;
if (size == 8) {
size = 9;
}
while (!client.isWritable() || pending.get() > 3000) {
Thread.yield();
}
ChannelFuture fut;
switch(rnd.nextInt(2)) {
case 0:
fut = client.pipeline().write(Unpooled.wrappedBuffer(new byte[size]));
break;
default:
FrameData data = FrameData.create(client.alloc(), 0xFE, Unpooled.wrappedBuffer(new byte[size]));
if (rnd.nextBoolean()) {
data.setReliability(FramedPacket.Reliability.RELIABLE_ORDERED);
data.setOrderChannel(rnd.nextInt(4));
}
fut = client.pipeline().write(data);
}
testLoop.execute(() -> combiner.add(fut));
bytesSent.addAndGet(size);
pending.incrementAndGet();
fut.addListener(x -> pending.decrementAndGet());
}
for (int i = 0; i < 200; i++) {
long value = rnd.nextLong();
reliableSet.put(value, true);
ByteBuf buf = Unpooled.wrappedBuffer(new byte[8]);
buf.clear();
buf.writeLong(value);
FrameData packet = FrameData.create(client.alloc(), 0xFE, buf);
packet.setReliability(FramedPacket.Reliability.RELIABLE);
testLoop.execute(() -> combiner.add(client.pipeline().write(packet)));
}
client.pipeline().flush();
client.write(new Ping()).sync();
testLoop.execute(() -> combiner.finish(donePromise));
try {
donePromise.get(90, TimeUnit.SECONDS);
} finally {
server.close().sync();
client.close().sync();
}
System.gc();
System.gc();
System.gc();
Assertions.assertTrue(reliableSet.isEmpty());
Assertions.assertEquals(0, pending.get());
Assertions.assertEquals(1000, numRecvd.get());
Assertions.assertEquals(bytesSent.get(), bytesRecvd.get());
}
|
@Test
public void manyBufferBadClientMocked() throws Throwable {
<DeepExtract>
Random rnd = new Random(34598);
AtomicInteger bytesSent = new AtomicInteger(0);
AtomicInteger bytesRecvd = new AtomicInteger(0);
AtomicInteger numRecvd = new AtomicInteger(0);
AtomicInteger pending = new AtomicInteger(0);
ConcurrentHashMap<Long, Object> unreliableSet = new ConcurrentHashMap<>();
ConcurrentHashMap<Long, Object> reliableSet = new ConcurrentHashMap<>();
EventLoop testLoop = childGroup.next();
PromiseCombiner combiner = new PromiseCombiner(testLoop);
MockDatagramPair mockPair = true ? new MockDatagramPair() : null;
Brutalizer brutalizer = new Brutalizer();
Channel server = newServer(null, simpleHandler((ctx, msg) -> {
if (msg instanceof ByteBuf) {
ByteBuf buf = (ByteBuf) msg;
if (buf.readableBytes() == 8) {
long value = buf.readLong();
reliableSet.remove(value);
} else {
numRecvd.incrementAndGet();
bytesRecvd.addAndGet(buf.readableBytes());
}
}
ReferenceCountUtil.safeRelease(msg);
}), mockPair);
Channel client = newClient(null, mockPair);
ChannelPromise donePromise = client.newPromise();
client.pipeline().addAfter(DatagramChannelProxy.LISTENER_HANDLER_NAME, "brutalizer", brutalizer);
brutalizer.rnd = rnd;
brutalizer.brutalizeRead = false;
brutalizer.brutalizeWrite = false;
for (int i = 0; i < 1000; i++) {
int size = rnd.nextInt(5000) + 1;
if (size == 8) {
size = 9;
}
while (!client.isWritable() || pending.get() > 3000) {
Thread.yield();
}
ChannelFuture fut;
switch(rnd.nextInt(2)) {
case 0:
fut = client.pipeline().write(Unpooled.wrappedBuffer(new byte[size]));
break;
default:
FrameData data = FrameData.create(client.alloc(), 0xFE, Unpooled.wrappedBuffer(new byte[size]));
if (rnd.nextBoolean()) {
data.setReliability(FramedPacket.Reliability.RELIABLE_ORDERED);
data.setOrderChannel(rnd.nextInt(4));
}
fut = client.pipeline().write(data);
}
testLoop.execute(() -> combiner.add(fut));
bytesSent.addAndGet(size);
pending.incrementAndGet();
fut.addListener(x -> pending.decrementAndGet());
}
for (int i = 0; i < 200; i++) {
long value = rnd.nextLong();
reliableSet.put(value, true);
ByteBuf buf = Unpooled.wrappedBuffer(new byte[8]);
buf.clear();
buf.writeLong(value);
FrameData packet = FrameData.create(client.alloc(), 0xFE, buf);
packet.setReliability(FramedPacket.Reliability.RELIABLE);
testLoop.execute(() -> combiner.add(client.pipeline().write(packet)));
}
client.pipeline().flush();
client.write(new Ping()).sync();
testLoop.execute(() -> combiner.finish(donePromise));
try {
donePromise.get(90, TimeUnit.SECONDS);
} finally {
server.close().sync();
client.close().sync();
}
System.gc();
System.gc();
System.gc();
Assertions.assertTrue(reliableSet.isEmpty());
Assertions.assertEquals(0, pending.get());
Assertions.assertEquals(1000, numRecvd.get());
Assertions.assertEquals(bytesSent.get(), bytesRecvd.get());
</DeepExtract>
}
|
netty-raknet
|
positive
| 440,799
|
public void validateUser() {
String sql = String.format("UPDATE user SET valid=%d", 1);
db.execSQL(sql);
}
|
public void validateUser() {
<DeepExtract>
String sql = String.format("UPDATE user SET valid=%d", 1);
db.execSQL(sql);
</DeepExtract>
}
|
TL-android-app
|
positive
| 440,800
|
@RabbitListener(queues = { "#{autoQueue1.name}" })
public void receive1(String inMsg) throws InterruptedException {
StopWatch watch = new StopWatch();
watch.start();
System.out.println("instance " + 1 + " [x] Received '" + inMsg + "'");
doWork(inMsg);
watch.stop();
System.out.println("instance " + 1 + " [x] Done in " + watch.getTotalTimeSeconds() + "s");
}
|
@RabbitListener(queues = { "#{autoQueue1.name}" })
public void receive1(String inMsg) throws InterruptedException {
<DeepExtract>
StopWatch watch = new StopWatch();
watch.start();
System.out.println("instance " + 1 + " [x] Received '" + inMsg + "'");
doWork(inMsg);
watch.stop();
System.out.println("instance " + 1 + " [x] Done in " + watch.getTotalTimeSeconds() + "s");
</DeepExtract>
}
|
java-tutorial
|
positive
| 440,801
|
public void getResult() throws org.apache.thrift7.TException {
if (getState() != org.apache.thrift7.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
org.apache.thrift7.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift7.transport.TMemoryInputTransport(getFrameBuffer().array());
org.apache.thrift7.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
setOption_result result = new setOption_result();
receiveBase(result, "setOption");
return;
}
|
public void getResult() throws org.apache.thrift7.TException {
if (getState() != org.apache.thrift7.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
org.apache.thrift7.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift7.transport.TMemoryInputTransport(getFrameBuffer().array());
org.apache.thrift7.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
<DeepExtract>
setOption_result result = new setOption_result();
receiveBase(result, "setOption");
return;
</DeepExtract>
}
|
storm-scribe
|
positive
| 440,802
|
public void startDocument() throws SAXException {
if (logger.isLoggable(Level.FINER))
logger.entering(className, "startDocument()");
if (logger.isLoggable(Level.FINER))
logger.entering(className, "startJSON()");
this.head = new JSONObject("", null);
this.current = head;
if (logger.isLoggable(Level.FINER))
logger.exiting(className, "startJSON()");
if (logger.isLoggable(Level.FINER))
logger.exiting(className, "startDocument()");
}
|
public void startDocument() throws SAXException {
if (logger.isLoggable(Level.FINER))
logger.entering(className, "startDocument()");
<DeepExtract>
if (logger.isLoggable(Level.FINER))
logger.entering(className, "startJSON()");
this.head = new JSONObject("", null);
this.current = head;
if (logger.isLoggable(Level.FINER))
logger.exiting(className, "startJSON()");
</DeepExtract>
if (logger.isLoggable(Level.FINER))
logger.exiting(className, "startDocument()");
}
|
phonegap-simjs
|
positive
| 440,803
|
public void release() {
if (isCropping) {
Log.e(TAG, "Cropping current bitmap. Can't perform this action right now.");
return;
}
if (isCropping) {
Log.e(TAG, "Cropping current bitmap. Can't set bitmap now");
return;
}
mFirstRender = true;
if (null == null) {
mBitmap = null;
super.setImageBitmap(null);
return;
}
if (null.getHeight() > 1280 || null.getWidth() > 1280 && DEBUG) {
Log.w(TAG, "Bitmap size greater than 1280. This might cause memory issues");
}
mBitmap = null;
super.setImageBitmap(null);
requestLayout();
if (mBitmap != null) {
mBitmap.recycle();
}
}
|
public void release() {
if (isCropping) {
Log.e(TAG, "Cropping current bitmap. Can't perform this action right now.");
return;
}
<DeepExtract>
if (isCropping) {
Log.e(TAG, "Cropping current bitmap. Can't set bitmap now");
return;
}
mFirstRender = true;
if (null == null) {
mBitmap = null;
super.setImageBitmap(null);
return;
}
if (null.getHeight() > 1280 || null.getWidth() > 1280 && DEBUG) {
Log.w(TAG, "Bitmap size greater than 1280. This might cause memory issues");
}
mBitmap = null;
super.setImageBitmap(null);
requestLayout();
</DeepExtract>
if (mBitmap != null) {
mBitmap.recycle();
}
}
|
Kirby-Assistant
|
positive
| 440,806
|
public static String getFitTimeSpanByNow(Date date, int precision) {
return millis2FitTimeSpan(Math.abs(string2Millis(getNowDate(), DEFAULT_FORMAT) - string2Millis(date, DEFAULT_FORMAT)), precision);
}
|
public static String getFitTimeSpanByNow(Date date, int precision) {
<DeepExtract>
return millis2FitTimeSpan(Math.abs(string2Millis(getNowDate(), DEFAULT_FORMAT) - string2Millis(date, DEFAULT_FORMAT)), precision);
</DeepExtract>
}
|
QuickAppFrame
|
positive
| 440,807
|
@Override
public void actionPerformed(ActionEvent e) {
getSettings().minimumBins = (Integer) binsCombo.getSelectedItem();
if (traceLists == null || traceLists[0] == null || traceNames == null || traceNames.size() == 0) {
setMessage("No traces selected.");
} else {
setMessage("");
setupTraces();
}
removeAll();
if (message != null && message.length() > 0) {
add(new JLabel(message), BorderLayout.CENTER);
validate();
repaint();
return;
}
if (getTopToolBar() != null) {
add(getTopToolBar(), BorderLayout.NORTH);
}
if (getToolBar() != null) {
add(getToolBar(), BorderLayout.SOUTH);
}
add(getChartPanel(), BorderLayout.CENTER);
validate();
repaint();
}
|
@Override
public void actionPerformed(ActionEvent e) {
getSettings().minimumBins = (Integer) binsCombo.getSelectedItem();
<DeepExtract>
if (traceLists == null || traceLists[0] == null || traceNames == null || traceNames.size() == 0) {
setMessage("No traces selected.");
} else {
setMessage("");
setupTraces();
}
removeAll();
if (message != null && message.length() > 0) {
add(new JLabel(message), BorderLayout.CENTER);
validate();
repaint();
return;
}
if (getTopToolBar() != null) {
add(getTopToolBar(), BorderLayout.NORTH);
}
if (getToolBar() != null) {
add(getToolBar(), BorderLayout.SOUTH);
}
add(getChartPanel(), BorderLayout.CENTER);
validate();
repaint();
</DeepExtract>
}
|
tracer
|
positive
| 440,808
|
public static void register() {
final DataConverter<MapType<String>, MapType<String>> converter = new DataConverter<>(VERSION) {
@Override
public MapType<String> convert(final MapType<String> data, final long sourceVersion, final long toVersion) {
final int recipesUsedSize = data.getInt("RecipesUsedSize");
data.remove("RecipesUsedSize");
if (recipesUsedSize <= 0) {
return null;
}
final MapType<String> newRecipes = Types.NBT.createEmptyMap();
data.setMap("RecipesUsed", newRecipes);
for (int i = 0; i < recipesUsedSize; ++i) {
final String recipeKey = data.getString("RecipeLocation" + i);
data.remove("RecipeLocation" + i);
final int recipeAmount = data.getInt("RecipeAmount" + i);
data.remove("RecipeAmount" + i);
if (i <= 0 || recipeKey == null) {
continue;
}
newRecipes.setInt(recipeKey, recipeAmount);
}
return null;
}
};
MCTypeRegistry.TILE_ENTITY.addConverterForId("minecraft:furnace", converter);
MCTypeRegistry.TILE_ENTITY.addConverterForId("minecraft:blast_furnace", converter);
MCTypeRegistry.TILE_ENTITY.addConverterForId("minecraft:smoker", converter);
MCTypeRegistry.TILE_ENTITY.addWalker(VERSION, "minecraft:furnace", (data, fromVersion, toVersion) -> {
WalkerUtils.convertList(MCTypeRegistry.ITEM_STACK, data, "Items", fromVersion, toVersion);
WalkerUtils.convertKeys(MCTypeRegistry.RECIPE, data, "RecipesUsed", fromVersion, toVersion);
return null;
});
MCTypeRegistry.TILE_ENTITY.addWalker(VERSION, "minecraft:smoker", (data, fromVersion, toVersion) -> {
WalkerUtils.convertList(MCTypeRegistry.ITEM_STACK, data, "Items", fromVersion, toVersion);
WalkerUtils.convertKeys(MCTypeRegistry.RECIPE, data, "RecipesUsed", fromVersion, toVersion);
return null;
});
MCTypeRegistry.TILE_ENTITY.addWalker(VERSION, "minecraft:blast_furnace", (data, fromVersion, toVersion) -> {
WalkerUtils.convertList(MCTypeRegistry.ITEM_STACK, data, "Items", fromVersion, toVersion);
WalkerUtils.convertKeys(MCTypeRegistry.RECIPE, data, "RecipesUsed", fromVersion, toVersion);
return null;
});
}
|
public static void register() {
final DataConverter<MapType<String>, MapType<String>> converter = new DataConverter<>(VERSION) {
@Override
public MapType<String> convert(final MapType<String> data, final long sourceVersion, final long toVersion) {
final int recipesUsedSize = data.getInt("RecipesUsedSize");
data.remove("RecipesUsedSize");
if (recipesUsedSize <= 0) {
return null;
}
final MapType<String> newRecipes = Types.NBT.createEmptyMap();
data.setMap("RecipesUsed", newRecipes);
for (int i = 0; i < recipesUsedSize; ++i) {
final String recipeKey = data.getString("RecipeLocation" + i);
data.remove("RecipeLocation" + i);
final int recipeAmount = data.getInt("RecipeAmount" + i);
data.remove("RecipeAmount" + i);
if (i <= 0 || recipeKey == null) {
continue;
}
newRecipes.setInt(recipeKey, recipeAmount);
}
return null;
}
};
MCTypeRegistry.TILE_ENTITY.addConverterForId("minecraft:furnace", converter);
MCTypeRegistry.TILE_ENTITY.addConverterForId("minecraft:blast_furnace", converter);
MCTypeRegistry.TILE_ENTITY.addConverterForId("minecraft:smoker", converter);
MCTypeRegistry.TILE_ENTITY.addWalker(VERSION, "minecraft:furnace", (data, fromVersion, toVersion) -> {
WalkerUtils.convertList(MCTypeRegistry.ITEM_STACK, data, "Items", fromVersion, toVersion);
WalkerUtils.convertKeys(MCTypeRegistry.RECIPE, data, "RecipesUsed", fromVersion, toVersion);
return null;
});
MCTypeRegistry.TILE_ENTITY.addWalker(VERSION, "minecraft:smoker", (data, fromVersion, toVersion) -> {
WalkerUtils.convertList(MCTypeRegistry.ITEM_STACK, data, "Items", fromVersion, toVersion);
WalkerUtils.convertKeys(MCTypeRegistry.RECIPE, data, "RecipesUsed", fromVersion, toVersion);
return null;
});
<DeepExtract>
MCTypeRegistry.TILE_ENTITY.addWalker(VERSION, "minecraft:blast_furnace", (data, fromVersion, toVersion) -> {
WalkerUtils.convertList(MCTypeRegistry.ITEM_STACK, data, "Items", fromVersion, toVersion);
WalkerUtils.convertKeys(MCTypeRegistry.RECIPE, data, "RecipesUsed", fromVersion, toVersion);
return null;
});
</DeepExtract>
}
|
DataConverter
|
positive
| 440,809
|
@Override
public void showBigCinemaListInOneRow() {
adapter = new CinemaListAdapter(this);
mRecyclerViewCinemas.setAdapter(adapter);
mMenuItemHowToShowCinemaList.setIcon(R.drawable.ic_small_cinema_in_one_row);
}
|
@Override
public void showBigCinemaListInOneRow() {
<DeepExtract>
adapter = new CinemaListAdapter(this);
mRecyclerViewCinemas.setAdapter(adapter);
mMenuItemHowToShowCinemaList.setIcon(R.drawable.ic_small_cinema_in_one_row);
</DeepExtract>
}
|
Mediateka
|
positive
| 440,810
|
@Override
public void onNoData(String type) {
if (mProgressDialog != null && mProgressDialog.isShowing()) {
mProgressDialog.dismiss();
}
}
|
@Override
public void onNoData(String type) {
<DeepExtract>
if (mProgressDialog != null && mProgressDialog.isShowing()) {
mProgressDialog.dismiss();
}
</DeepExtract>
}
|
BmapLite
|
positive
| 440,811
|
public static boolean createNew(File file) {
File[] flist = null;
if (file == null) {
return false;
}
if (file.isFile()) {
return file.delete();
}
if (!file.isDirectory()) {
return false;
}
flist = file.listFiles();
if (flist != null && flist.length > 0) {
for (File f : flist) {
if (!delete(f)) {
return false;
}
}
}
return file.delete();
return file.mkdirs();
}
|
public static boolean createNew(File file) {
<DeepExtract>
File[] flist = null;
if (file == null) {
return false;
}
if (file.isFile()) {
return file.delete();
}
if (!file.isDirectory()) {
return false;
}
flist = file.listFiles();
if (flist != null && flist.length > 0) {
for (File f : flist) {
if (!delete(f)) {
return false;
}
}
}
return file.delete();
</DeepExtract>
return file.mkdirs();
}
|
OLGA
|
positive
| 440,812
|
public void updateView() {
removeAllViews();
LinearLayout weekView = new LinearLayout(getContext());
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(mViewWidth, mWeekHeight);
weekView.setLayoutParams(params);
weekView.setBackgroundColor(mTopWeekBgColor);
weekView.setGravity(Gravity.CENTER);
setTopWeekView(weekView);
addView(weekView);
View divider = new View(getContext());
LayoutParams params1 = new LayoutParams(mViewWidth, mDividerSize);
divider.setLayoutParams(params1);
divider.setBackgroundColor(mHorizontalDividerColor);
addView(divider);
ViewGroup viewGroup = (ViewGroup) ctView.getParent();
if (viewGroup != null)
viewGroup.removeAllViews();
ScrollView scrollView = new ScrollView(getContext());
scrollView.setVerticalScrollBarEnabled(false);
scrollView.setOverScrollMode(OVER_SCROLL_NEVER);
ctView.setTopWeekHeight(mWeekHeight).setOnItemClickListener(mItemClickListener).setNodeWidth(mMonthWidth);
ctView.setHorizontalFadingEdgeEnabled(false);
scrollView.addView(ctView);
addView(scrollView);
if (!isFirst)
ctView.resetView();
}
|
public void updateView() {
removeAllViews();
LinearLayout weekView = new LinearLayout(getContext());
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(mViewWidth, mWeekHeight);
weekView.setLayoutParams(params);
weekView.setBackgroundColor(mTopWeekBgColor);
weekView.setGravity(Gravity.CENTER);
setTopWeekView(weekView);
addView(weekView);
View divider = new View(getContext());
LayoutParams params1 = new LayoutParams(mViewWidth, mDividerSize);
divider.setLayoutParams(params1);
divider.setBackgroundColor(mHorizontalDividerColor);
addView(divider);
ViewGroup viewGroup = (ViewGroup) ctView.getParent();
if (viewGroup != null)
viewGroup.removeAllViews();
<DeepExtract>
ScrollView scrollView = new ScrollView(getContext());
scrollView.setVerticalScrollBarEnabled(false);
scrollView.setOverScrollMode(OVER_SCROLL_NEVER);
ctView.setTopWeekHeight(mWeekHeight).setOnItemClickListener(mItemClickListener).setNodeWidth(mMonthWidth);
ctView.setHorizontalFadingEdgeEnabled(false);
scrollView.addView(ctView);
addView(scrollView);
</DeepExtract>
if (!isFirst)
ctView.resetView();
}
|
NJU-Class-Shedule-Android
|
positive
| 440,815
|
@Override
public void enableBlending() {
if (!blendingDisabled)
return;
if (idx == 0)
return;
Gdx.gl.glDepthMask(false);
if (customShader != null)
customShader.begin();
else
shader.begin();
setupMatrices();
renderCalls++;
totalRenderCalls++;
int spritesInBatch = idx / 4 / vertexsize;
if (spritesInBatch > maxSpritesInBatch)
maxSpritesInBatch = spritesInBatch;
int count = spritesInBatch * 6;
lastTexture.bind();
Mesh mesh = this.mesh;
mesh.setVertices(vertices, 0, idx);
mesh.getIndicesBuffer().position(0);
mesh.getIndicesBuffer().limit(count);
if (blendingDisabled) {
Gdx.gl.glDisable(GL20.GL_BLEND);
} else {
Gdx.gl.glEnable(GL20.GL_BLEND);
if (blendSrcFunc != -1)
Gdx.gl.glBlendFunc(blendSrcFunc, blendDstFunc);
}
mesh.render(customShader != null ? customShader : shader, GL20.GL_TRIANGLES, 0, count);
idx = 0;
GL20 gl = Gdx.gl;
gl.glDepthMask(true);
if (isBlendingEnabled())
gl.glDisable(GL20.GL_BLEND);
if (customShader != null)
customShader.end();
else
shader.end();
blendingDisabled = false;
}
|
@Override
public void enableBlending() {
if (!blendingDisabled)
return;
<DeepExtract>
if (idx == 0)
return;
Gdx.gl.glDepthMask(false);
if (customShader != null)
customShader.begin();
else
shader.begin();
setupMatrices();
renderCalls++;
totalRenderCalls++;
int spritesInBatch = idx / 4 / vertexsize;
if (spritesInBatch > maxSpritesInBatch)
maxSpritesInBatch = spritesInBatch;
int count = spritesInBatch * 6;
lastTexture.bind();
Mesh mesh = this.mesh;
mesh.setVertices(vertices, 0, idx);
mesh.getIndicesBuffer().position(0);
mesh.getIndicesBuffer().limit(count);
if (blendingDisabled) {
Gdx.gl.glDisable(GL20.GL_BLEND);
} else {
Gdx.gl.glEnable(GL20.GL_BLEND);
if (blendSrcFunc != -1)
Gdx.gl.glBlendFunc(blendSrcFunc, blendDstFunc);
}
mesh.render(customShader != null ? customShader : shader, GL20.GL_TRIANGLES, 0, count);
idx = 0;
GL20 gl = Gdx.gl;
gl.glDepthMask(true);
if (isBlendingEnabled())
gl.glDisable(GL20.GL_BLEND);
if (customShader != null)
customShader.end();
else
shader.end();
</DeepExtract>
blendingDisabled = false;
}
|
exterminate
|
positive
| 440,818
|
public void printAllConstraints() {
if (!Env.flgShowConstraints)
return;
Env.p("-----ReceiveConstarints : ");
Iterator<Set<ReceiveConstraint>> it = receivePassiveConstraintsMap.values().iterator();
while (it.hasNext()) {
Iterator<ReceiveConstraint> it2 = it.next().iterator();
while (it2.hasNext()) {
Env.p(it2.next());
}
}
Env.p("-----UnifyConstraints : ");
Iterator<UnifyConstraint> it = unifyConstraints.iterator();
while (it.hasNext()) Env.p(it.next());
Env.p("----TypeVarConstraints : ");
TreeSet<TypeVarConstraint> tvcs = new TreeSet<>(new TypeVarConstraintComparator());
tvcs.addAll(typeVarConstraints);
for (TypeVarConstraint tvc : tvcs) {
Env.p(tvc);
}
Env.p("---");
}
|
public void printAllConstraints() {
if (!Env.flgShowConstraints)
return;
Env.p("-----ReceiveConstarints : ");
Iterator<Set<ReceiveConstraint>> it = receivePassiveConstraintsMap.values().iterator();
while (it.hasNext()) {
Iterator<ReceiveConstraint> it2 = it.next().iterator();
while (it2.hasNext()) {
Env.p(it2.next());
}
}
<DeepExtract>
Env.p("-----UnifyConstraints : ");
Iterator<UnifyConstraint> it = unifyConstraints.iterator();
while (it.hasNext()) Env.p(it.next());
</DeepExtract>
Env.p("----TypeVarConstraints : ");
TreeSet<TypeVarConstraint> tvcs = new TreeSet<>(new TypeVarConstraintComparator());
tvcs.addAll(typeVarConstraints);
for (TypeVarConstraint tvc : tvcs) {
Env.p(tvc);
}
Env.p("---");
}
|
lmntal-compiler
|
positive
| 440,820
|
public boolean consistent() throws TableauErrorException {
if (d_formulas.isEmpty()) {
return true;
}
if (d_formulas.isEmpty()) {
return d_prover.satisfiable(asFormula());
}
return d_prover.satisfiable(new Conjunction(asFormula(), asFormula()));
}
|
public boolean consistent() throws TableauErrorException {
if (d_formulas.isEmpty()) {
return true;
}
<DeepExtract>
if (d_formulas.isEmpty()) {
return d_prover.satisfiable(asFormula());
}
return d_prover.satisfiable(new Conjunction(asFormula(), asFormula()));
</DeepExtract>
}
|
oops
|
positive
| 440,821
|
@org.junit.Test
public void testSplitAmbiguousTermsWhere() {
doSQLTest(new QueryParts("frm", "a=b group = 1", "", "sel"));
doLINQTest(new QueryParts("frm", "a=b group = 1", "", "sel"));
doSQLTest(new QueryParts("frm", "a=b from = 1", "", "sel"));
doLINQTest(new QueryParts("frm", "a=b from = 1", "", "sel"));
doSQLTest(new QueryParts("frm", "a=b select = 1", "", "sel"));
doLINQTest(new QueryParts("frm", "a=b select = 1", "", "sel"));
doSQLTest(new QueryParts("frm", "a=b select : 1", "", "sel"));
doLINQTest(new QueryParts("frm", "a=b select : 1", "", "sel"));
}
|
@org.junit.Test
public void testSplitAmbiguousTermsWhere() {
doSQLTest(new QueryParts("frm", "a=b group = 1", "", "sel"));
doLINQTest(new QueryParts("frm", "a=b group = 1", "", "sel"));
doSQLTest(new QueryParts("frm", "a=b from = 1", "", "sel"));
doLINQTest(new QueryParts("frm", "a=b from = 1", "", "sel"));
doSQLTest(new QueryParts("frm", "a=b select = 1", "", "sel"));
doLINQTest(new QueryParts("frm", "a=b select = 1", "", "sel"));
<DeepExtract>
doSQLTest(new QueryParts("frm", "a=b select : 1", "", "sel"));
doLINQTest(new QueryParts("frm", "a=b select : 1", "", "sel"));
</DeepExtract>
}
|
iql
|
positive
| 440,822
|
@Override
public boolean setCompatibleProfile(Object skull, CompatibleProfile profile) throws IllegalArgumentException {
if (!(profile instanceof PlayerProfile))
throw new IllegalArgumentException("Argument passed was not a PlayerProfile");
if (skull instanceof SkullMeta) {
SkullMeta skull = (SkullMeta) skull;
skull.setPlayerProfile((PlayerProfile) profile);
return true;
} else {
return false;
}
}
|
@Override
public boolean setCompatibleProfile(Object skull, CompatibleProfile profile) throws IllegalArgumentException {
<DeepExtract>
if (!(profile instanceof PlayerProfile))
throw new IllegalArgumentException("Argument passed was not a PlayerProfile");
if (skull instanceof SkullMeta) {
SkullMeta skull = (SkullMeta) skull;
skull.setPlayerProfile((PlayerProfile) profile);
return true;
} else {
return false;
}
</DeepExtract>
}
|
PlayerHeads
|
positive
| 440,823
|
protected void textEmpty() {
title.setBackground(true ? GOOD_COLOR : BAD_COLOR);
}
|
protected void textEmpty() {
<DeepExtract>
title.setBackground(true ? GOOD_COLOR : BAD_COLOR);
</DeepExtract>
}
|
glance
|
positive
| 440,826
|
public String getIconUrl() {
if (xpiUrl == null) {
this.xpiUrl = webResourceManager.getStaticPluginResource("com.atlassian.labs.speakeasy-plugin:firefox-extension", "speakeasy.xpi", UrlMode.AUTO);
this.iconUrl = webResourceManager.getStaticPluginResource("com.atlassian.labs.speakeasy-plugin:firefox-extension", "icon.png", UrlMode.AUTO);
}
return iconUrl;
}
|
public String getIconUrl() {
<DeepExtract>
if (xpiUrl == null) {
this.xpiUrl = webResourceManager.getStaticPluginResource("com.atlassian.labs.speakeasy-plugin:firefox-extension", "speakeasy.xpi", UrlMode.AUTO);
this.iconUrl = webResourceManager.getStaticPluginResource("com.atlassian.labs.speakeasy-plugin:firefox-extension", "icon.png", UrlMode.AUTO);
}
</DeepExtract>
return iconUrl;
}
|
speakeasy-plugin
|
positive
| 440,827
|
private void btn_DsActionPerformed(java.awt.event.ActionEvent evt) {
lbl.setText(btn_Ds.getText());
X_Z.setText(110 + "");
X_A.removeAllItems();
String[] val = new String[0];
for (int i = 0; i <= val.length; i++) {
val[i] = Integer.toString(i + 0);
X_A.addItem(val[i]);
}
}
|
private void btn_DsActionPerformed(java.awt.event.ActionEvent evt) {
<DeepExtract>
lbl.setText(btn_Ds.getText());
X_Z.setText(110 + "");
X_A.removeAllItems();
String[] val = new String[0];
for (int i = 0; i <= val.length; i++) {
val[i] = Integer.toString(i + 0);
X_A.addItem(val[i]);
}
</DeepExtract>
}
|
ERSN-OpenMC
|
positive
| 440,828
|
private void trainSimilarity() throws IOException, InterruptedException {
Trainer trainer = new Trainer();
System.out.println("======Similarity Training RANDOM===========");
trainer = new Trainer();
trainer.setMonotonic(false);
System.out.println("True True Normal");
System.out.println("Tree");
trainer.trainSimilarity(true, true, oracle, "TREE", treeEps);
trainer = new Trainer();
trainer.setMonotonic(false);
System.out.println("Linear");
System.out.println("False True Normal");
trainer.trainSimilarity(false, true, oracle, "Linear", linearEps);
System.out.println("Dag");
trainer.trainSimilarity(false, true, oracle, "DAG", dagEps);
System.out.println("Tree");
trainer.trainSimilarity(false, true, oracle, "TREE", treeEps);
Trainer trainer = new Trainer();
System.out.println("======Similarity Training MONOTONIC===========");
trainer.setMonotonic(true);
System.out.println("True FALSE Monotonic");
System.out.println("Linear");
linearEps = trainer.trainSimilarity(true, false, oracle, "Linear", monotonicLinearEps);
System.out.println("Dag");
dagEps = trainer.trainSimilarity(true, false, oracle, "DAG", monotonicDagEps);
System.out.println("Tree");
treeEps = trainer.trainSimilarity(true, false, oracle, "TREE", monotonicTreeEps);
trainer = new Trainer();
trainer.setMonotonic(true);
System.out.println("True True Monotonic");
System.out.println("Linear");
trainer.trainSimilarity(true, true, oracle, "Linear", monotonicLinearEps);
System.out.println("Dag");
trainer.trainSimilarity(true, true, oracle, "DAG", monotonicDagEps);
System.out.println("Tree");
trainer.trainSimilarity(true, true, oracle, "TREE", monotonicTreeEps);
trainer = new Trainer();
trainer.setMonotonic(true);
System.out.println("False True Monotonic");
System.out.println("Linear");
trainer.trainSimilarity(false, true, oracle, "Linear", monotonicLinearEps);
System.out.println("Dag");
trainer.trainSimilarity(false, true, oracle, "DAG", monotonicDagEps);
System.out.println("Tree");
trainer.trainSimilarity(false, true, oracle, "TREE", monotonicTreeEps);
}
|
private void trainSimilarity() throws IOException, InterruptedException {
Trainer trainer = new Trainer();
System.out.println("======Similarity Training RANDOM===========");
trainer = new Trainer();
trainer.setMonotonic(false);
System.out.println("True True Normal");
System.out.println("Tree");
trainer.trainSimilarity(true, true, oracle, "TREE", treeEps);
trainer = new Trainer();
trainer.setMonotonic(false);
System.out.println("Linear");
System.out.println("False True Normal");
trainer.trainSimilarity(false, true, oracle, "Linear", linearEps);
System.out.println("Dag");
trainer.trainSimilarity(false, true, oracle, "DAG", dagEps);
System.out.println("Tree");
trainer.trainSimilarity(false, true, oracle, "TREE", treeEps);
<DeepExtract>
Trainer trainer = new Trainer();
System.out.println("======Similarity Training MONOTONIC===========");
trainer.setMonotonic(true);
System.out.println("True FALSE Monotonic");
System.out.println("Linear");
linearEps = trainer.trainSimilarity(true, false, oracle, "Linear", monotonicLinearEps);
System.out.println("Dag");
dagEps = trainer.trainSimilarity(true, false, oracle, "DAG", monotonicDagEps);
System.out.println("Tree");
treeEps = trainer.trainSimilarity(true, false, oracle, "TREE", monotonicTreeEps);
trainer = new Trainer();
trainer.setMonotonic(true);
System.out.println("True True Monotonic");
System.out.println("Linear");
trainer.trainSimilarity(true, true, oracle, "Linear", monotonicLinearEps);
System.out.println("Dag");
trainer.trainSimilarity(true, true, oracle, "DAG", monotonicDagEps);
System.out.println("Tree");
trainer.trainSimilarity(true, true, oracle, "TREE", monotonicTreeEps);
trainer = new Trainer();
trainer.setMonotonic(true);
System.out.println("False True Monotonic");
System.out.println("Linear");
trainer.trainSimilarity(false, true, oracle, "Linear", monotonicLinearEps);
System.out.println("Dag");
trainer.trainSimilarity(false, true, oracle, "DAG", monotonicDagEps);
System.out.println("Tree");
trainer.trainSimilarity(false, true, oracle, "TREE", monotonicTreeEps);
</DeepExtract>
}
|
prov-viewer
|
positive
| 440,829
|
public static void processPageMetaTags(Collection collection, CollectionConfig configuration, Factory factory, Page page) {
if (page.getSource() == null || page.getSource().getMeta() == null) {
return;
}
Map<String, Object> sourceMeta = page.getSource().getMeta();
String collectionName = configuration.getName();
TagConfig[] tags = configuration.getTags();
if (tags == null || tags.length == 0) {
return;
}
for (TagConfig tagConfiguration : tags) {
processPageTag(collection, configuration, factory, page, tagConfiguration, collectionName, sourceMeta);
}
CategoryConfig[] categories = configuration.getCategories();
if (categories == null || categories.length == 0) {
return;
}
for (CategoryConfig categoryConfiguration : categories) {
processPageCategory(collection, configuration, factory, page, categoryConfiguration, collectionName, sourceMeta);
}
}
|
public static void processPageMetaTags(Collection collection, CollectionConfig configuration, Factory factory, Page page) {
if (page.getSource() == null || page.getSource().getMeta() == null) {
return;
}
Map<String, Object> sourceMeta = page.getSource().getMeta();
String collectionName = configuration.getName();
TagConfig[] tags = configuration.getTags();
if (tags == null || tags.length == 0) {
return;
}
for (TagConfig tagConfiguration : tags) {
processPageTag(collection, configuration, factory, page, tagConfiguration, collectionName, sourceMeta);
}
<DeepExtract>
CategoryConfig[] categories = configuration.getCategories();
if (categories == null || categories.length == 0) {
return;
}
for (CategoryConfig categoryConfiguration : categories) {
processPageCategory(collection, configuration, factory, page, categoryConfiguration, collectionName, sourceMeta);
}
</DeepExtract>
}
|
opoopress
|
positive
| 440,830
|
public Subscription withIgnoreError(boolean ignoreError) {
this.ignoreError = ignoreError;
return this;
}
|
public Subscription withIgnoreError(boolean ignoreError) {
<DeepExtract>
this.ignoreError = ignoreError;
</DeepExtract>
return this;
}
|
seyren
|
positive
| 440,831
|
private void initPlayer(int index) throws IllegalArgumentException, SecurityException, IllegalStateException, IOException {
if (mList != null) {
mMediaPlayer = new MediaSegmentPlayer(mContext, mPreferHWDecoder, mList.get(index));
} else {
mMediaPlayer = new MediaPlayer(mContext, mPreferHWDecoder);
}
mOnPreparedListener = mPreparedListener;
mMediaPlayer.setOnVideoSizeChangedListener(mSizeChangedListener);
mOnCompletionListener = mItemCompletionListener;
mOnErrorListener = mErrorListener;
mOnBufferingUpdateListener = mBufferingUpdateListener;
mOnInfoListener = mInfoListener;
mOnSeekCompleteListener = mSeekCompleteListener;
mOnTimedTextListener = mTimedTextListener;
if (mPreferHWDecoder)
mMediaPlayer.setOnHWRenderFailedListener(mOnHWRenderFailedListener);
mMediaPlayer.setDataSource(mContext, mUri, mHeaders);
mMediaPlayer.setDisplay(mSurfaceHolder);
getHolder().setFormat(mVideoChroma == MediaPlayer.VIDEOCHROMA_RGB565 ? MediaPlayer.VIDEOCHROMA_RGB565 : MediaPlayer.VIDEOCHROMA_RGBA == MediaPlayer.VIDEOCHROMA_RGB565 ? PixelFormat.RGB_565 : PixelFormat.RGBA_8888);
mVideoChroma = mVideoChroma == MediaPlayer.VIDEOCHROMA_RGB565 ? MediaPlayer.VIDEOCHROMA_RGB565 : MediaPlayer.VIDEOCHROMA_RGBA;
mMediaPlayer.setScreenOnWhilePlaying(true);
}
|
private void initPlayer(int index) throws IllegalArgumentException, SecurityException, IllegalStateException, IOException {
if (mList != null) {
mMediaPlayer = new MediaSegmentPlayer(mContext, mPreferHWDecoder, mList.get(index));
} else {
mMediaPlayer = new MediaPlayer(mContext, mPreferHWDecoder);
}
mOnPreparedListener = mPreparedListener;
mMediaPlayer.setOnVideoSizeChangedListener(mSizeChangedListener);
mOnCompletionListener = mItemCompletionListener;
mOnErrorListener = mErrorListener;
mOnBufferingUpdateListener = mBufferingUpdateListener;
mOnInfoListener = mInfoListener;
mOnSeekCompleteListener = mSeekCompleteListener;
mOnTimedTextListener = mTimedTextListener;
if (mPreferHWDecoder)
mMediaPlayer.setOnHWRenderFailedListener(mOnHWRenderFailedListener);
mMediaPlayer.setDataSource(mContext, mUri, mHeaders);
mMediaPlayer.setDisplay(mSurfaceHolder);
<DeepExtract>
getHolder().setFormat(mVideoChroma == MediaPlayer.VIDEOCHROMA_RGB565 ? MediaPlayer.VIDEOCHROMA_RGB565 : MediaPlayer.VIDEOCHROMA_RGBA == MediaPlayer.VIDEOCHROMA_RGB565 ? PixelFormat.RGB_565 : PixelFormat.RGBA_8888);
mVideoChroma = mVideoChroma == MediaPlayer.VIDEOCHROMA_RGB565 ? MediaPlayer.VIDEOCHROMA_RGB565 : MediaPlayer.VIDEOCHROMA_RGBA;
</DeepExtract>
mMediaPlayer.setScreenOnWhilePlaying(true);
}
|
acfunm
|
positive
| 440,832
|
@Test
public void loginError() {
loginPage = appium.getApp().loginPage();
appium.enqueue(RestService.PATH_LOGIN, MockJsonResponse.LOGIN_WRONG_LOGIN);
loginPage.setLogin("login");
appium.withNativeDriver(driver -> driver.navigate().back(), driver -> driver.getKeyboard().pressKey(Keys.ENTER));
loginPage.setPassword("pass");
appium.withNativeDriver(driver -> driver.navigate().back(), driver -> driver.getKeyboard().pressKey(Keys.ENTER));
loginPage.login();
assertThat(loginPage.loginError, hasText("Wrong login"));
loginPage.setLogin("newLogin");
appium.withNativeDriver(driver -> driver.navigate().back(), driver -> driver.getKeyboard().pressKey(Keys.ENTER));
assertNotVisible(appium, loginPage.loginError);
}
|
@Test
public void loginError() {
loginPage = appium.getApp().loginPage();
appium.enqueue(RestService.PATH_LOGIN, MockJsonResponse.LOGIN_WRONG_LOGIN);
<DeepExtract>
loginPage.setLogin("login");
appium.withNativeDriver(driver -> driver.navigate().back(), driver -> driver.getKeyboard().pressKey(Keys.ENTER));
loginPage.setPassword("pass");
appium.withNativeDriver(driver -> driver.navigate().back(), driver -> driver.getKeyboard().pressKey(Keys.ENTER));
loginPage.login();
</DeepExtract>
assertThat(loginPage.loginError, hasText("Wrong login"));
loginPage.setLogin("newLogin");
appium.withNativeDriver(driver -> driver.navigate().back(), driver -> driver.getKeyboard().pressKey(Keys.ENTER));
assertNotVisible(appium, loginPage.loginError);
}
|
Flashcards
|
positive
| 440,834
|
public long getSpawningCount() {
return this.spawningReasons.values().stream().mapToLong(v -> v).sum();
}
|
public long getSpawningCount() {
<DeepExtract>
return this.spawningReasons.values().stream().mapToLong(v -> v).sum();
</DeepExtract>
}
|
Carpet-TIS-Addition
|
positive
| 440,835
|
private void notifyClientsStarted(boolean started) {
LOG.info((started) ? getString(R.string.started) : getString(R.string.stopped));
LOG.debug("Sending a custom broadcast");
String event = (started) ? "started" : "stopped";
Intent sendIntent = new Intent();
sendIntent.setAction("com.mendhak.gpslogger.EVENT");
sendIntent.putExtra("gpsloggerevent", event);
sendIntent.putExtra("filename", session.getCurrentFormattedFileName());
sendIntent.putExtra("startedtimestamp", session.getStartTimeStamp());
sendIntent.putExtra("duration", (int) (System.currentTimeMillis() - session.getStartTimeStamp()) / 1000);
sendIntent.putExtra("distance", session.getTotalTravelled());
sendBroadcast(sendIntent);
EventBus.getDefault().post(new ServiceEvents.LoggingStatus(started));
}
|
private void notifyClientsStarted(boolean started) {
LOG.info((started) ? getString(R.string.started) : getString(R.string.stopped));
<DeepExtract>
LOG.debug("Sending a custom broadcast");
String event = (started) ? "started" : "stopped";
Intent sendIntent = new Intent();
sendIntent.setAction("com.mendhak.gpslogger.EVENT");
sendIntent.putExtra("gpsloggerevent", event);
sendIntent.putExtra("filename", session.getCurrentFormattedFileName());
sendIntent.putExtra("startedtimestamp", session.getStartTimeStamp());
sendIntent.putExtra("duration", (int) (System.currentTimeMillis() - session.getStartTimeStamp()) / 1000);
sendIntent.putExtra("distance", session.getTotalTravelled());
sendBroadcast(sendIntent);
</DeepExtract>
EventBus.getDefault().post(new ServiceEvents.LoggingStatus(started));
}
|
gpslogger
|
positive
| 440,836
|
@Override
protected void onPause() {
super.onPause();
isSeeking = false;
if (mMediaPlayer != null && mMediaPlayer.isPlaying()) {
mMediaPlayer.pause();
handler.removeCallbacks(run);
}
Log.d(TAG, "----videoPause----->>>>>>>");
if (mIvPosition.getVisibility() == View.VISIBLE) {
mIvPosition.setVisibility(View.GONE);
}
mIvPosition.clearAnimation();
if (animator != null && animator.isRunning()) {
animator.cancel();
}
}
|
@Override
protected void onPause() {
super.onPause();
<DeepExtract>
isSeeking = false;
if (mMediaPlayer != null && mMediaPlayer.isPlaying()) {
mMediaPlayer.pause();
handler.removeCallbacks(run);
}
Log.d(TAG, "----videoPause----->>>>>>>");
if (mIvPosition.getVisibility() == View.VISIBLE) {
mIvPosition.setVisibility(View.GONE);
}
mIvPosition.clearAnimation();
if (animator != null && animator.isRunning()) {
animator.cancel();
}
</DeepExtract>
}
|
Android-Video-Editor
|
positive
| 440,837
|
@Override
public void setStatus(int statusCode, String reason) {
if (selector.shouldAbortBufferingForHttpStatusCode(statusCode)) {
disableBuffering();
}
super.setStatus(statusCode);
}
|
@Override
public void setStatus(int statusCode, String reason) {
<DeepExtract>
if (selector.shouldAbortBufferingForHttpStatusCode(statusCode)) {
disableBuffering();
}
</DeepExtract>
super.setStatus(statusCode);
}
|
sitemesh3
|
positive
| 440,839
|
@Override
public void textChanged(TextInput TI) {
setupConfig.setCustomLangISO(TI.getText());
assert master != null;
modified = true;
master.setUndo(true);
}
|
@Override
public void textChanged(TextInput TI) {
setupConfig.setCustomLangISO(TI.getText());
<DeepExtract>
assert master != null;
modified = true;
master.setUndo(true);
</DeepExtract>
}
|
setupmaker
|
positive
| 440,842
|
@Override
public void setFetchDirection(int direction) throws SQLException {
if (closed) {
throw new SQLException("Statement is closed");
}
}
|
@Override
public void setFetchDirection(int direction) throws SQLException {
<DeepExtract>
if (closed) {
throw new SQLException("Statement is closed");
}
</DeepExtract>
}
|
HikariCP
|
positive
| 440,844
|
private void putPreun(OutputStreamWriter controlWriter) throws IOException {
controlWriter.write(NEWLINE + "%preun" + NEWLINE);
controlWriter.write(NEWLINE + "if [ $1 -eq 0 ]; then" + NEWLINE);
controlWriter.write(NEWLINE + "echo \"preun step\"" + NEWLINE);
controlWriter.write(rpm.getVariablesTemplate() + NEWLINE);
StringBuilder head = scriptMap.get(Script.PRERMHEAD);
if (head != null) {
controlWriter.write(head.toString() + NEWLINE);
}
for (String body : rpm.getPrerm()) {
controlWriter.write(body + NEWLINE);
}
StringBuilder tail = scriptMap.get(Script.PRERMTAIL);
if (tail != null) {
controlWriter.write(tail.toString() + NEWLINE);
}
List<String> del_files = setup.getDeleteFiles();
for (String file : del_files) {
controlWriter.write("if [ -f \"${RPM_INSTALL_PREFIX}/" + file + "\" ]; then\n rm -f \"${RPM_INSTALL_PREFIX}/" + file + "\"\nfi" + NEWLINE);
}
List<String> del_dirs = setup.getDeleteFolders();
for (String dirs : del_dirs) {
controlWriter.write("rm -R -f \"${RPM_INSTALL_PREFIX}/" + dirs + "\"" + NEWLINE);
}
DesktopStarter starter = setup.getRunBeforeUninstall();
if (starter != null) {
controlWriter.write(NEWLINE);
String executable = starter.getExecutable();
String mainClass = starter.getMainClass();
String workingDir = starter.getWorkDir() != null ? "/" + starter.getWorkDir() : "";
if (executable != null) {
if (rpm.getDaemonUser().equalsIgnoreCase("root")) {
controlWriter.write("( cd \"${RPM_INSTALL_PREFIX}" + workingDir + "\" && " + executable + " " + starter.getStartArguments() + " )" + NEWLINE);
} else {
controlWriter.write("(su " + rpm.getDaemonUser() + " -c 'cd \"${RPM_INSTALL_PREFIX}" + workingDir + "\" && " + executable + " " + starter.getStartArguments() + "' )" + NEWLINE);
}
} else if (mainClass != null) {
if (rpm.getDaemonUser().equalsIgnoreCase("root")) {
controlWriter.write("( cd \"${RPM_INSTALL_PREFIX}" + workingDir + "\" && \"" + javaMainExecutable + "\" " + String.join(" ", starter.getJavaVMArguments()) + " -cp \"" + starter.getMainJar() + "\" " + mainClass + " " + starter.getStartArguments() + " )" + NEWLINE);
} else {
controlWriter.write("(su " + rpm.getDaemonUser() + " -c 'cd \"${RPM_INSTALL_PREFIX}/" + workingDir + "\" && \"" + javaMainExecutable + "\" " + String.join(" ", starter.getJavaVMArguments()) + " -cp \"" + starter.getMainJar() + "\" " + mainClass + " " + starter.getStartArguments() + "' )" + NEWLINE);
}
}
controlWriter.write(NEWLINE);
}
controlWriter.write(NEWLINE + "fi" + NEWLINE);
}
|
private void putPreun(OutputStreamWriter controlWriter) throws IOException {
controlWriter.write(NEWLINE + "%preun" + NEWLINE);
controlWriter.write(NEWLINE + "if [ $1 -eq 0 ]; then" + NEWLINE);
controlWriter.write(NEWLINE + "echo \"preun step\"" + NEWLINE);
controlWriter.write(rpm.getVariablesTemplate() + NEWLINE);
<DeepExtract>
StringBuilder head = scriptMap.get(Script.PRERMHEAD);
if (head != null) {
controlWriter.write(head.toString() + NEWLINE);
}
for (String body : rpm.getPrerm()) {
controlWriter.write(body + NEWLINE);
}
StringBuilder tail = scriptMap.get(Script.PRERMTAIL);
if (tail != null) {
controlWriter.write(tail.toString() + NEWLINE);
}
</DeepExtract>
List<String> del_files = setup.getDeleteFiles();
for (String file : del_files) {
controlWriter.write("if [ -f \"${RPM_INSTALL_PREFIX}/" + file + "\" ]; then\n rm -f \"${RPM_INSTALL_PREFIX}/" + file + "\"\nfi" + NEWLINE);
}
List<String> del_dirs = setup.getDeleteFolders();
for (String dirs : del_dirs) {
controlWriter.write("rm -R -f \"${RPM_INSTALL_PREFIX}/" + dirs + "\"" + NEWLINE);
}
DesktopStarter starter = setup.getRunBeforeUninstall();
if (starter != null) {
controlWriter.write(NEWLINE);
String executable = starter.getExecutable();
String mainClass = starter.getMainClass();
String workingDir = starter.getWorkDir() != null ? "/" + starter.getWorkDir() : "";
if (executable != null) {
if (rpm.getDaemonUser().equalsIgnoreCase("root")) {
controlWriter.write("( cd \"${RPM_INSTALL_PREFIX}" + workingDir + "\" && " + executable + " " + starter.getStartArguments() + " )" + NEWLINE);
} else {
controlWriter.write("(su " + rpm.getDaemonUser() + " -c 'cd \"${RPM_INSTALL_PREFIX}" + workingDir + "\" && " + executable + " " + starter.getStartArguments() + "' )" + NEWLINE);
}
} else if (mainClass != null) {
if (rpm.getDaemonUser().equalsIgnoreCase("root")) {
controlWriter.write("( cd \"${RPM_INSTALL_PREFIX}" + workingDir + "\" && \"" + javaMainExecutable + "\" " + String.join(" ", starter.getJavaVMArguments()) + " -cp \"" + starter.getMainJar() + "\" " + mainClass + " " + starter.getStartArguments() + " )" + NEWLINE);
} else {
controlWriter.write("(su " + rpm.getDaemonUser() + " -c 'cd \"${RPM_INSTALL_PREFIX}/" + workingDir + "\" && \"" + javaMainExecutable + "\" " + String.join(" ", starter.getJavaVMArguments()) + " -cp \"" + starter.getMainJar() + "\" " + mainClass + " " + starter.getStartArguments() + "' )" + NEWLINE);
}
}
controlWriter.write(NEWLINE);
}
controlWriter.write(NEWLINE + "fi" + NEWLINE);
}
|
SetupBuilder
|
positive
| 440,845
|
public void setButtonText(String text) {
suggest.setText(text);
}
|
public void setButtonText(String text) {
<DeepExtract>
suggest.setText(text);
</DeepExtract>
}
|
GF
|
positive
| 440,846
|
@Override
public void handle(HttpServletRequest httpServletRequest, HttpServletResponse response, AccessDeniedException exception) throws IOException, ServletException {
response.addHeader("WWW-Authenticate", String.format("Basic realm=\"%s\"", realmName));
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
}
|
@Override
public void handle(HttpServletRequest httpServletRequest, HttpServletResponse response, AccessDeniedException exception) throws IOException, ServletException {
<DeepExtract>
response.addHeader("WWW-Authenticate", String.format("Basic realm=\"%s\"", realmName));
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
</DeepExtract>
}
|
carldav
|
positive
| 440,848
|
@Override
public void executeOperation(final LdbcQuery9 operation, DbConnectionState dbConnectionState, ResultReporter resultReporter) throws DbException {
try {
List<ObjectOutputStream> oStreams = (TorcDbClientConnectionState) dbConnectionState.getObjectOutputStreams();
List<ObjectInputStream> iStreams = (TorcDbClientConnectionState) dbConnectionState.getObjectInputStreams();
int n = (int) (Math.random() * oStreams.size());
ObjectOutputStream out = oStreams.get(n);
ObjectInputStream in = iStreams.get(n);
if (operation instanceof LdbcQuery1) {
out.writeObject(new LdbcQuery1Serializable((LdbcQuery1) operation));
out.flush();
List<LdbcQuery1ResultSerializable> resp = (List<LdbcQuery1ResultSerializable>) in.readObject();
List<LdbcQuery1Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery2) {
out.writeObject(new LdbcQuery2Serializable((LdbcQuery2) operation));
out.flush();
List<LdbcQuery2ResultSerializable> resp = (List<LdbcQuery2ResultSerializable>) in.readObject();
List<LdbcQuery2Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery3) {
out.writeObject(new LdbcQuery3Serializable((LdbcQuery3) operation));
out.flush();
List<LdbcQuery3ResultSerializable> resp = (List<LdbcQuery3ResultSerializable>) in.readObject();
List<LdbcQuery3Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery4) {
out.writeObject(new LdbcQuery4Serializable((LdbcQuery4) operation));
out.flush();
List<LdbcQuery4ResultSerializable> resp = (List<LdbcQuery4ResultSerializable>) in.readObject();
List<LdbcQuery4Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery5) {
out.writeObject(new LdbcQuery5Serializable((LdbcQuery5) operation));
out.flush();
List<LdbcQuery5ResultSerializable> resp = (List<LdbcQuery5ResultSerializable>) in.readObject();
List<LdbcQuery5Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery6) {
out.writeObject(new LdbcQuery6Serializable((LdbcQuery6) operation));
out.flush();
List<LdbcQuery6ResultSerializable> resp = (List<LdbcQuery6ResultSerializable>) in.readObject();
List<LdbcQuery6Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery7) {
out.writeObject(new LdbcQuery7Serializable((LdbcQuery7) operation));
out.flush();
List<LdbcQuery7ResultSerializable> resp = (List<LdbcQuery7ResultSerializable>) in.readObject();
List<LdbcQuery7Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery8) {
out.writeObject(new LdbcQuery8Serializable((LdbcQuery8) operation));
out.flush();
List<LdbcQuery8ResultSerializable> resp = (List<LdbcQuery8ResultSerializable>) in.readObject();
List<LdbcQuery8Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery9) {
out.writeObject(new LdbcQuery9Serializable((LdbcQuery9) operation));
out.flush();
List<LdbcQuery9ResultSerializable> resp = (List<LdbcQuery9ResultSerializable>) in.readObject();
List<LdbcQuery9Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery10) {
out.writeObject(new LdbcQuery10Serializable((LdbcQuery10) operation));
out.flush();
List<LdbcQuery10ResultSerializable> resp = (List<LdbcQuery10ResultSerializable>) in.readObject();
List<LdbcQuery10Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery11) {
out.writeObject(new LdbcQuery11Serializable((LdbcQuery11) operation));
out.flush();
List<LdbcQuery11ResultSerializable> resp = (List<LdbcQuery11ResultSerializable>) in.readObject();
List<LdbcQuery11Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery12) {
out.writeObject(new LdbcQuery12Serializable((LdbcQuery12) operation));
out.flush();
List<LdbcQuery12ResultSerializable> resp = (List<LdbcQuery12ResultSerializable>) in.readObject();
List<LdbcQuery12Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery13) {
out.writeObject(new LdbcQuery13Serializable((LdbcQuery13) operation));
out.flush();
LdbcQuery13ResultSerializable resp = (LdbcQuery13ResultSerializable) in.readObject();
LdbcQuery13Result result = resp.unpack();
resultReporter.report(1, result, operation);
} else if (operation instanceof LdbcQuery14) {
out.writeObject(new LdbcQuery14Serializable((LdbcQuery14) operation));
out.flush();
List<LdbcQuery14ResultSerializable> resp = (List<LdbcQuery14ResultSerializable>) in.readObject();
List<LdbcQuery14Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcShortQuery1PersonProfile) {
out.writeObject(new LdbcShortQuery1PersonProfileSerializable((LdbcShortQuery1PersonProfile) operation));
out.flush();
LdbcShortQuery1PersonProfileResultSerializable resp = (LdbcShortQuery1PersonProfileResultSerializable) in.readObject();
LdbcShortQuery1PersonProfileResult result = resp.unpack();
resultReporter.report(1, result, operation);
} else if (operation instanceof LdbcShortQuery2PersonPosts) {
out.writeObject(new LdbcShortQuery2PersonPostsSerializable((LdbcShortQuery2PersonPosts) operation));
out.flush();
List<LdbcShortQuery2PersonPostsResultSerializable> resp = (List<LdbcShortQuery2PersonPostsResultSerializable>) in.readObject();
List<LdbcShortQuery2PersonPostsResult> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcShortQuery3PersonFriends) {
out.writeObject(new LdbcShortQuery3PersonFriendsSerializable((LdbcShortQuery3PersonFriends) operation));
out.flush();
List<LdbcShortQuery3PersonFriendsResultSerializable> resp = (List<LdbcShortQuery3PersonFriendsResultSerializable>) in.readObject();
List<LdbcShortQuery3PersonFriendsResult> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcShortQuery4MessageContent) {
out.writeObject(new LdbcShortQuery4MessageContentSerializable((LdbcShortQuery4MessageContent) operation));
out.flush();
LdbcShortQuery4MessageContentResultSerializable resp = (LdbcShortQuery4MessageContentResultSerializable) in.readObject();
LdbcShortQuery4MessageContentResult result = resp.unpack();
resultReporter.report(1, result, operation);
} else if (operation instanceof LdbcShortQuery5MessageCreator) {
out.writeObject(new LdbcShortQuery5MessageCreatorSerializable((LdbcShortQuery5MessageCreator) operation));
out.flush();
LdbcShortQuery5MessageCreatorResultSerializable resp = (LdbcShortQuery5MessageCreatorResultSerializable) in.readObject();
LdbcShortQuery5MessageCreatorResult result = resp.unpack();
resultReporter.report(1, result, operation);
} else if (operation instanceof LdbcShortQuery6MessageForum) {
out.writeObject(new LdbcShortQuery6MessageForumSerializable((LdbcShortQuery6MessageForum) operation));
out.flush();
LdbcShortQuery6MessageForumResultSerializable resp = (LdbcShortQuery6MessageForumResultSerializable) in.readObject();
LdbcShortQuery6MessageForumResult result = resp.unpack();
resultReporter.report(1, result, operation);
} else if (operation instanceof LdbcShortQuery7MessageReplies) {
out.writeObject(new LdbcShortQuery7MessageRepliesSerializable((LdbcShortQuery7MessageReplies) operation));
out.flush();
List<LdbcShortQuery7MessageRepliesResultSerializable> resp = (List<LdbcShortQuery7MessageRepliesResultSerializable>) in.readObject();
List<LdbcShortQuery7MessageRepliesResult> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcUpdate1AddPerson) {
out.writeObject(new LdbcUpdate1AddPersonSerializable((LdbcUpdate1AddPerson) operation));
out.flush();
LdbcNoResultSerializable resp = (LdbcNoResultSerializable) in.readObject();
resultReporter.report(0, LdbcNoResult.INSTANCE, operation);
} else if (operation instanceof LdbcUpdate2AddPostLike) {
out.writeObject(new LdbcUpdate2AddPostLikeSerializable((LdbcUpdate2AddPostLike) operation));
out.flush();
LdbcNoResultSerializable resp = (LdbcNoResultSerializable) in.readObject();
resultReporter.report(0, LdbcNoResult.INSTANCE, operation);
} else if (operation instanceof LdbcUpdate3AddCommentLike) {
out.writeObject(new LdbcUpdate3AddCommentLikeSerializable((LdbcUpdate3AddCommentLike) operation));
out.flush();
LdbcNoResultSerializable resp = (LdbcNoResultSerializable) in.readObject();
resultReporter.report(0, LdbcNoResult.INSTANCE, operation);
} else if (operation instanceof LdbcUpdate4AddForum) {
out.writeObject(new LdbcUpdate4AddForumSerializable((LdbcUpdate4AddForum) operation));
out.flush();
LdbcNoResultSerializable resp = (LdbcNoResultSerializable) in.readObject();
resultReporter.report(0, LdbcNoResult.INSTANCE, operation);
} else if (operation instanceof LdbcUpdate5AddForumMembership) {
out.writeObject(new LdbcUpdate5AddForumMembershipSerializable((LdbcUpdate5AddForumMembership) operation));
out.flush();
LdbcNoResultSerializable resp = (LdbcNoResultSerializable) in.readObject();
resultReporter.report(0, LdbcNoResult.INSTANCE, operation);
} else if (operation instanceof LdbcUpdate6AddPost) {
out.writeObject(new LdbcUpdate6AddPostSerializable((LdbcUpdate6AddPost) operation));
out.flush();
LdbcNoResultSerializable resp = (LdbcNoResultSerializable) in.readObject();
resultReporter.report(0, LdbcNoResult.INSTANCE, operation);
} else if (operation instanceof LdbcUpdate7AddComment) {
out.writeObject(new LdbcUpdate7AddCommentSerializable((LdbcUpdate7AddComment) operation));
out.flush();
LdbcNoResultSerializable resp = (LdbcNoResultSerializable) in.readObject();
resultReporter.report(0, LdbcNoResult.INSTANCE, operation);
} else if (operation instanceof LdbcUpdate8AddFriendship) {
out.writeObject(new LdbcUpdate8AddFriendshipSerializable((LdbcUpdate8AddFriendship) operation));
out.flush();
LdbcNoResultSerializable resp = (LdbcNoResultSerializable) in.readObject();
resultReporter.report(0, LdbcNoResult.INSTANCE, operation);
} else {
throw new RuntimeException("Unrecognized query");
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
|
@Override
public void executeOperation(final LdbcQuery9 operation, DbConnectionState dbConnectionState, ResultReporter resultReporter) throws DbException {
<DeepExtract>
try {
List<ObjectOutputStream> oStreams = (TorcDbClientConnectionState) dbConnectionState.getObjectOutputStreams();
List<ObjectInputStream> iStreams = (TorcDbClientConnectionState) dbConnectionState.getObjectInputStreams();
int n = (int) (Math.random() * oStreams.size());
ObjectOutputStream out = oStreams.get(n);
ObjectInputStream in = iStreams.get(n);
if (operation instanceof LdbcQuery1) {
out.writeObject(new LdbcQuery1Serializable((LdbcQuery1) operation));
out.flush();
List<LdbcQuery1ResultSerializable> resp = (List<LdbcQuery1ResultSerializable>) in.readObject();
List<LdbcQuery1Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery2) {
out.writeObject(new LdbcQuery2Serializable((LdbcQuery2) operation));
out.flush();
List<LdbcQuery2ResultSerializable> resp = (List<LdbcQuery2ResultSerializable>) in.readObject();
List<LdbcQuery2Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery3) {
out.writeObject(new LdbcQuery3Serializable((LdbcQuery3) operation));
out.flush();
List<LdbcQuery3ResultSerializable> resp = (List<LdbcQuery3ResultSerializable>) in.readObject();
List<LdbcQuery3Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery4) {
out.writeObject(new LdbcQuery4Serializable((LdbcQuery4) operation));
out.flush();
List<LdbcQuery4ResultSerializable> resp = (List<LdbcQuery4ResultSerializable>) in.readObject();
List<LdbcQuery4Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery5) {
out.writeObject(new LdbcQuery5Serializable((LdbcQuery5) operation));
out.flush();
List<LdbcQuery5ResultSerializable> resp = (List<LdbcQuery5ResultSerializable>) in.readObject();
List<LdbcQuery5Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery6) {
out.writeObject(new LdbcQuery6Serializable((LdbcQuery6) operation));
out.flush();
List<LdbcQuery6ResultSerializable> resp = (List<LdbcQuery6ResultSerializable>) in.readObject();
List<LdbcQuery6Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery7) {
out.writeObject(new LdbcQuery7Serializable((LdbcQuery7) operation));
out.flush();
List<LdbcQuery7ResultSerializable> resp = (List<LdbcQuery7ResultSerializable>) in.readObject();
List<LdbcQuery7Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery8) {
out.writeObject(new LdbcQuery8Serializable((LdbcQuery8) operation));
out.flush();
List<LdbcQuery8ResultSerializable> resp = (List<LdbcQuery8ResultSerializable>) in.readObject();
List<LdbcQuery8Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery9) {
out.writeObject(new LdbcQuery9Serializable((LdbcQuery9) operation));
out.flush();
List<LdbcQuery9ResultSerializable> resp = (List<LdbcQuery9ResultSerializable>) in.readObject();
List<LdbcQuery9Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery10) {
out.writeObject(new LdbcQuery10Serializable((LdbcQuery10) operation));
out.flush();
List<LdbcQuery10ResultSerializable> resp = (List<LdbcQuery10ResultSerializable>) in.readObject();
List<LdbcQuery10Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery11) {
out.writeObject(new LdbcQuery11Serializable((LdbcQuery11) operation));
out.flush();
List<LdbcQuery11ResultSerializable> resp = (List<LdbcQuery11ResultSerializable>) in.readObject();
List<LdbcQuery11Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery12) {
out.writeObject(new LdbcQuery12Serializable((LdbcQuery12) operation));
out.flush();
List<LdbcQuery12ResultSerializable> resp = (List<LdbcQuery12ResultSerializable>) in.readObject();
List<LdbcQuery12Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcQuery13) {
out.writeObject(new LdbcQuery13Serializable((LdbcQuery13) operation));
out.flush();
LdbcQuery13ResultSerializable resp = (LdbcQuery13ResultSerializable) in.readObject();
LdbcQuery13Result result = resp.unpack();
resultReporter.report(1, result, operation);
} else if (operation instanceof LdbcQuery14) {
out.writeObject(new LdbcQuery14Serializable((LdbcQuery14) operation));
out.flush();
List<LdbcQuery14ResultSerializable> resp = (List<LdbcQuery14ResultSerializable>) in.readObject();
List<LdbcQuery14Result> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcShortQuery1PersonProfile) {
out.writeObject(new LdbcShortQuery1PersonProfileSerializable((LdbcShortQuery1PersonProfile) operation));
out.flush();
LdbcShortQuery1PersonProfileResultSerializable resp = (LdbcShortQuery1PersonProfileResultSerializable) in.readObject();
LdbcShortQuery1PersonProfileResult result = resp.unpack();
resultReporter.report(1, result, operation);
} else if (operation instanceof LdbcShortQuery2PersonPosts) {
out.writeObject(new LdbcShortQuery2PersonPostsSerializable((LdbcShortQuery2PersonPosts) operation));
out.flush();
List<LdbcShortQuery2PersonPostsResultSerializable> resp = (List<LdbcShortQuery2PersonPostsResultSerializable>) in.readObject();
List<LdbcShortQuery2PersonPostsResult> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcShortQuery3PersonFriends) {
out.writeObject(new LdbcShortQuery3PersonFriendsSerializable((LdbcShortQuery3PersonFriends) operation));
out.flush();
List<LdbcShortQuery3PersonFriendsResultSerializable> resp = (List<LdbcShortQuery3PersonFriendsResultSerializable>) in.readObject();
List<LdbcShortQuery3PersonFriendsResult> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcShortQuery4MessageContent) {
out.writeObject(new LdbcShortQuery4MessageContentSerializable((LdbcShortQuery4MessageContent) operation));
out.flush();
LdbcShortQuery4MessageContentResultSerializable resp = (LdbcShortQuery4MessageContentResultSerializable) in.readObject();
LdbcShortQuery4MessageContentResult result = resp.unpack();
resultReporter.report(1, result, operation);
} else if (operation instanceof LdbcShortQuery5MessageCreator) {
out.writeObject(new LdbcShortQuery5MessageCreatorSerializable((LdbcShortQuery5MessageCreator) operation));
out.flush();
LdbcShortQuery5MessageCreatorResultSerializable resp = (LdbcShortQuery5MessageCreatorResultSerializable) in.readObject();
LdbcShortQuery5MessageCreatorResult result = resp.unpack();
resultReporter.report(1, result, operation);
} else if (operation instanceof LdbcShortQuery6MessageForum) {
out.writeObject(new LdbcShortQuery6MessageForumSerializable((LdbcShortQuery6MessageForum) operation));
out.flush();
LdbcShortQuery6MessageForumResultSerializable resp = (LdbcShortQuery6MessageForumResultSerializable) in.readObject();
LdbcShortQuery6MessageForumResult result = resp.unpack();
resultReporter.report(1, result, operation);
} else if (operation instanceof LdbcShortQuery7MessageReplies) {
out.writeObject(new LdbcShortQuery7MessageRepliesSerializable((LdbcShortQuery7MessageReplies) operation));
out.flush();
List<LdbcShortQuery7MessageRepliesResultSerializable> resp = (List<LdbcShortQuery7MessageRepliesResultSerializable>) in.readObject();
List<LdbcShortQuery7MessageRepliesResult> result = new ArrayList<>();
resp.forEach((v) -> {
result.add(v.unpack());
});
resultReporter.report(result.size(), result, operation);
} else if (operation instanceof LdbcUpdate1AddPerson) {
out.writeObject(new LdbcUpdate1AddPersonSerializable((LdbcUpdate1AddPerson) operation));
out.flush();
LdbcNoResultSerializable resp = (LdbcNoResultSerializable) in.readObject();
resultReporter.report(0, LdbcNoResult.INSTANCE, operation);
} else if (operation instanceof LdbcUpdate2AddPostLike) {
out.writeObject(new LdbcUpdate2AddPostLikeSerializable((LdbcUpdate2AddPostLike) operation));
out.flush();
LdbcNoResultSerializable resp = (LdbcNoResultSerializable) in.readObject();
resultReporter.report(0, LdbcNoResult.INSTANCE, operation);
} else if (operation instanceof LdbcUpdate3AddCommentLike) {
out.writeObject(new LdbcUpdate3AddCommentLikeSerializable((LdbcUpdate3AddCommentLike) operation));
out.flush();
LdbcNoResultSerializable resp = (LdbcNoResultSerializable) in.readObject();
resultReporter.report(0, LdbcNoResult.INSTANCE, operation);
} else if (operation instanceof LdbcUpdate4AddForum) {
out.writeObject(new LdbcUpdate4AddForumSerializable((LdbcUpdate4AddForum) operation));
out.flush();
LdbcNoResultSerializable resp = (LdbcNoResultSerializable) in.readObject();
resultReporter.report(0, LdbcNoResult.INSTANCE, operation);
} else if (operation instanceof LdbcUpdate5AddForumMembership) {
out.writeObject(new LdbcUpdate5AddForumMembershipSerializable((LdbcUpdate5AddForumMembership) operation));
out.flush();
LdbcNoResultSerializable resp = (LdbcNoResultSerializable) in.readObject();
resultReporter.report(0, LdbcNoResult.INSTANCE, operation);
} else if (operation instanceof LdbcUpdate6AddPost) {
out.writeObject(new LdbcUpdate6AddPostSerializable((LdbcUpdate6AddPost) operation));
out.flush();
LdbcNoResultSerializable resp = (LdbcNoResultSerializable) in.readObject();
resultReporter.report(0, LdbcNoResult.INSTANCE, operation);
} else if (operation instanceof LdbcUpdate7AddComment) {
out.writeObject(new LdbcUpdate7AddCommentSerializable((LdbcUpdate7AddComment) operation));
out.flush();
LdbcNoResultSerializable resp = (LdbcNoResultSerializable) in.readObject();
resultReporter.report(0, LdbcNoResult.INSTANCE, operation);
} else if (operation instanceof LdbcUpdate8AddFriendship) {
out.writeObject(new LdbcUpdate8AddFriendshipSerializable((LdbcUpdate8AddFriendship) operation));
out.flush();
LdbcNoResultSerializable resp = (LdbcNoResultSerializable) in.readObject();
resultReporter.report(0, LdbcNoResult.INSTANCE, operation);
} else {
throw new RuntimeException("Unrecognized query");
}
} catch (Exception e) {
throw new RuntimeException(e);
}
</DeepExtract>
}
|
ldbc-snb-impls
|
positive
| 440,849
|
protected UUID system_addCell(InternalActorCell cell) {
cell.setParent(SYSTEM_ID);
cells.get(SYSTEM_ID).getChildren().add(cell.getId());
Actor actor = cell.getActor();
if (actor instanceof PseudoActor)
pseudoCells.put(cell.getId(), cell);
else {
actor.setCell(cell);
cells.put(cell.getId(), cell);
if (actor instanceof ResourceActor)
resourceCells.put(cell.getId(), false);
else if (actor instanceof PodActor)
podCells.put(cell.getId(), false);
if (executorService.isStarted()) {
messageDispatcher.registerCell(cell);
internal_preStart(cell);
}
}
return cell.getId();
}
|
protected UUID system_addCell(InternalActorCell cell) {
cell.setParent(SYSTEM_ID);
cells.get(SYSTEM_ID).getChildren().add(cell.getId());
<DeepExtract>
Actor actor = cell.getActor();
if (actor instanceof PseudoActor)
pseudoCells.put(cell.getId(), cell);
else {
actor.setCell(cell);
cells.put(cell.getId(), cell);
if (actor instanceof ResourceActor)
resourceCells.put(cell.getId(), false);
else if (actor instanceof PodActor)
podCells.put(cell.getId(), false);
if (executorService.isStarted()) {
messageDispatcher.registerCell(cell);
internal_preStart(cell);
}
}
return cell.getId();
</DeepExtract>
}
|
actor4j-core
|
positive
| 440,850
|
public void updateGraph() {
if (mHistoryDeviceAdapter == null) {
Log.e(TAG, "updateGraph -> Graph is not initialized yet.");
return;
}
if (isAdded()) {
final HistoryDatabaseManager historyDb = HistoryDatabaseManager.getInstance();
final List<String> connectedDevicesAddresses = historyDb.getConnectedDeviceListInterval(mIntervalSelected);
final List<DeviceModel> deviceModels = new LinkedList<>();
for (final String deviceAddress : connectedDevicesAddresses) {
DeviceModel model = RHTSensorFacade.getInstance().getDeviceModel(deviceAddress);
if (model == null) {
model = obtainDeviceModelDisconnectedDevice(deviceAddress);
}
deviceModels.add(model);
}
final HistoryDeviceAdapter adapter = (HistoryDeviceAdapter) mDeviceListView.getAdapter();
final Handler viewHandler = mDeviceListView.getHandler();
if (viewHandler == null) {
adapter.update(new Handler(Looper.myLooper()), deviceModels);
} else {
Log.d(TAG, String.format("updateDeviceView() -> Added %d devices.", deviceModels.size()));
adapter.update(viewHandler, deviceModels);
}
}
final List<String> selectedItems = mHistoryDeviceAdapter.getListOfSelectedItems();
if (selectedItems.isEmpty()) {
Log.d(TAG, "updateGraph -> No values to display.");
return;
}
if (mPlotHandler == null) {
Log.e(TAG, "updateGraph -> Don't have a plot handler for managing the plot");
return;
}
mPlotHandler.updateSeries(getContext(), obtainPlotSeries(selectedItems), mIntervalSelected, mUnitTypeSelected);
}
|
public void updateGraph() {
if (mHistoryDeviceAdapter == null) {
Log.e(TAG, "updateGraph -> Graph is not initialized yet.");
return;
}
<DeepExtract>
if (isAdded()) {
final HistoryDatabaseManager historyDb = HistoryDatabaseManager.getInstance();
final List<String> connectedDevicesAddresses = historyDb.getConnectedDeviceListInterval(mIntervalSelected);
final List<DeviceModel> deviceModels = new LinkedList<>();
for (final String deviceAddress : connectedDevicesAddresses) {
DeviceModel model = RHTSensorFacade.getInstance().getDeviceModel(deviceAddress);
if (model == null) {
model = obtainDeviceModelDisconnectedDevice(deviceAddress);
}
deviceModels.add(model);
}
final HistoryDeviceAdapter adapter = (HistoryDeviceAdapter) mDeviceListView.getAdapter();
final Handler viewHandler = mDeviceListView.getHandler();
if (viewHandler == null) {
adapter.update(new Handler(Looper.myLooper()), deviceModels);
} else {
Log.d(TAG, String.format("updateDeviceView() -> Added %d devices.", deviceModels.size()));
adapter.update(viewHandler, deviceModels);
}
}
</DeepExtract>
final List<String> selectedItems = mHistoryDeviceAdapter.getListOfSelectedItems();
if (selectedItems.isEmpty()) {
Log.d(TAG, "updateGraph -> No values to display.");
return;
}
if (mPlotHandler == null) {
Log.e(TAG, "updateGraph -> Don't have a plot handler for managing the plot");
return;
}
mPlotHandler.updateSeries(getContext(), obtainPlotSeries(selectedItems), mIntervalSelected, mUnitTypeSelected);
}
|
SmartGadget-Android
|
positive
| 440,852
|
@Test
public void transformString2() throws Exception {
expected = -1;
D = new HashSet<>(Arrays.asList("bat", "cot", "dog", "dag", "dot", "cat"));
s = "cat";
d = "bat";
assertEquals(expected, TransformOneStringToAnother.transformString(D, s, d));
}
|
@Test
public void transformString2() throws Exception {
expected = -1;
D = new HashSet<>(Arrays.asList("bat", "cot", "dog", "dag", "dot", "cat"));
s = "cat";
d = "bat";
<DeepExtract>
assertEquals(expected, TransformOneStringToAnother.transformString(D, s, d));
</DeepExtract>
}
|
elements-of-programming-interviews-solutions
|
positive
| 440,854
|
public void putObstacleRectangle(Point a, Point b) {
int xfrom = (a.x < b.x) ? a.x : b.x;
int xto = (a.x > b.x) ? a.x : b.x;
int yfrom = (a.y < b.y) ? a.y : b.y;
int yto = (a.y > b.y) ? a.y : b.y;
for (int x = xfrom; x <= xto; x++) {
for (int y = yfrom; y <= yto; y++) {
updateLocation(new Point(x, y), Symbol.OCCUPIED);
}
}
}
|
public void putObstacleRectangle(Point a, Point b) {
<DeepExtract>
int xfrom = (a.x < b.x) ? a.x : b.x;
int xto = (a.x > b.x) ? a.x : b.x;
int yfrom = (a.y < b.y) ? a.y : b.y;
int yto = (a.y > b.y) ? a.y : b.y;
for (int x = xfrom; x <= xto; x++) {
for (int y = yfrom; y <= yto; y++) {
updateLocation(new Point(x, y), Symbol.OCCUPIED);
}
}
</DeepExtract>
}
|
hipster
|
positive
| 440,855
|
@Test
public void testEmptyBefore() {
assertTrue(bloomFilter.getTimeToLiveMap().isEmpty());
assertEquals(0.0, bloomFilter.getEstimatedPopulation(), 0.1);
assertEmpty();
}
|
@Test
public void testEmptyBefore() {
<DeepExtract>
assertTrue(bloomFilter.getTimeToLiveMap().isEmpty());
assertEquals(0.0, bloomFilter.getEstimatedPopulation(), 0.1);
assertEmpty();
</DeepExtract>
}
|
Orestes-Bloomfilter
|
positive
| 440,857
|
@Override
public LBRedisProxyPoolEntry<T> borrowEntry(boolean createNew, long timeout, TimeUnit unit) throws InterruptedException, TimeoutException, LBRedisProxyPoolException {
try {
if (config.isWaitUnlimitOnBorrow()) {
borrowingSemaphore.acquire();
} else {
boolean acquireSuccess = borrowingSemaphore.tryAcquire(timeout, unit);
if (!acquireSuccess) {
throw new TimeoutException("borrowEntry timed out.");
}
}
} catch (InterruptedException e) {
throw e;
}
try {
LBRedisProxyPoolEntry<T> entry = idleEntries.poll();
if (entry == null && createNew) {
entry = createIdleEntry();
}
if (entry == null) {
borrowingSemaphore.release();
}
return entry;
} catch (Exception e) {
borrowingSemaphore.release();
throw new LBRedisProxyPoolException(e);
}
}
|
@Override
public LBRedisProxyPoolEntry<T> borrowEntry(boolean createNew, long timeout, TimeUnit unit) throws InterruptedException, TimeoutException, LBRedisProxyPoolException {
try {
if (config.isWaitUnlimitOnBorrow()) {
borrowingSemaphore.acquire();
} else {
boolean acquireSuccess = borrowingSemaphore.tryAcquire(timeout, unit);
if (!acquireSuccess) {
throw new TimeoutException("borrowEntry timed out.");
}
}
} catch (InterruptedException e) {
throw e;
}
<DeepExtract>
try {
LBRedisProxyPoolEntry<T> entry = idleEntries.poll();
if (entry == null && createNew) {
entry = createIdleEntry();
}
if (entry == null) {
borrowingSemaphore.release();
}
return entry;
} catch (Exception e) {
borrowingSemaphore.release();
throw new LBRedisProxyPoolException(e);
}
</DeepExtract>
}
|
nredis-proxy
|
positive
| 440,858
|
public void setStreetView(boolean on) {
mode = on ? Mode.StreetView : Mode.Normal;
getTileProvider().setTileSource(getTileSourceFromAttributes(null));
}
|
public void setStreetView(boolean on) {
mode = on ? Mode.StreetView : Mode.Normal;
<DeepExtract>
getTileProvider().setTileSource(getTileSourceFromAttributes(null));
</DeepExtract>
}
|
MapsAPI
|
positive
| 440,859
|
public static void printSummary(LoadContext context) {
LoadSummary summary = context.summary();
LOG.info(DIVIDE_LINE);
LOG.info("detail metrics");
summary.inputMetricsMap().forEach((id, metrics) -> {
log(EMPTY_LINE);
log(String.format("input-struct '%s'", id));
log("read success", metrics.readSuccess());
log("read failure", metrics.readFailure());
metrics.vertexMetrics().forEach((label, labelMetrics) -> {
log(String.format("vertex '%s'", label));
log("parse success", labelMetrics.parseSuccess());
log("parse failure", labelMetrics.parseFailure());
log("insert success", labelMetrics.insertSuccess());
log("insert failure", labelMetrics.insertFailure());
});
metrics.edgeMetrics().forEach((label, labelMetrics) -> {
log(String.format("edge '%s'", label));
log("parse success", labelMetrics.parseSuccess());
log("parse failure", labelMetrics.parseFailure());
log("insert success", labelMetrics.insertSuccess());
log("insert failure", labelMetrics.insertFailure());
});
});
LOG.info(DIVIDE_LINE);
System.out.println(DIVIDE_LINE);
printAndLog("count metrics");
printAndLog("input read success", LoadReport.collect(summary).readSuccess());
printAndLog("input read failure", LoadReport.collect(summary).readFailure());
printAndLog("vertex parse success", LoadReport.collect(summary).vertexParseSuccess());
printAndLog("vertex parse failure", LoadReport.collect(summary).vertexParseFailure());
printAndLog("vertex insert success", LoadReport.collect(summary).vertexInsertSuccess());
printAndLog("vertex insert failure", LoadReport.collect(summary).vertexInsertFailure());
printAndLog("edge parse success", LoadReport.collect(summary).edgeParseSuccess());
printAndLog("edge parse failure", LoadReport.collect(summary).edgeParseFailure());
printAndLog("edge insert success", LoadReport.collect(summary).edgeInsertSuccess());
printAndLog("edge insert failure", LoadReport.collect(summary).edgeInsertFailure());
LOG.info(DIVIDE_LINE);
System.out.println(DIVIDE_LINE);
long totalTime = summary.totalTime();
long vertexTime = summary.vertexTime();
long edgeTime = summary.edgeTime();
long loadTime = summary.loadTime();
long readTime = totalTime - loadTime;
printAndLog("meter metrics");
printAndLog("total time", TimeUtil.readableTime(totalTime));
printAndLog("read time", TimeUtil.readableTime(readTime));
printAndLog("load time", TimeUtil.readableTime(loadTime));
printAndLog("vertex load time", TimeUtil.readableTime(vertexTime));
printAndLog("vertex load rate(vertices/s)", summary.loadRate(ElemType.VERTEX));
printAndLog("edge load time", TimeUtil.readableTime(edgeTime));
printAndLog("edge load rate(edges/s)", summary.loadRate(ElemType.EDGE));
}
|
public static void printSummary(LoadContext context) {
LoadSummary summary = context.summary();
LOG.info(DIVIDE_LINE);
LOG.info("detail metrics");
summary.inputMetricsMap().forEach((id, metrics) -> {
log(EMPTY_LINE);
log(String.format("input-struct '%s'", id));
log("read success", metrics.readSuccess());
log("read failure", metrics.readFailure());
metrics.vertexMetrics().forEach((label, labelMetrics) -> {
log(String.format("vertex '%s'", label));
log("parse success", labelMetrics.parseSuccess());
log("parse failure", labelMetrics.parseFailure());
log("insert success", labelMetrics.insertSuccess());
log("insert failure", labelMetrics.insertFailure());
});
metrics.edgeMetrics().forEach((label, labelMetrics) -> {
log(String.format("edge '%s'", label));
log("parse success", labelMetrics.parseSuccess());
log("parse failure", labelMetrics.parseFailure());
log("insert success", labelMetrics.insertSuccess());
log("insert failure", labelMetrics.insertFailure());
});
});
LOG.info(DIVIDE_LINE);
System.out.println(DIVIDE_LINE);
printAndLog("count metrics");
printAndLog("input read success", LoadReport.collect(summary).readSuccess());
printAndLog("input read failure", LoadReport.collect(summary).readFailure());
printAndLog("vertex parse success", LoadReport.collect(summary).vertexParseSuccess());
printAndLog("vertex parse failure", LoadReport.collect(summary).vertexParseFailure());
printAndLog("vertex insert success", LoadReport.collect(summary).vertexInsertSuccess());
printAndLog("vertex insert failure", LoadReport.collect(summary).vertexInsertFailure());
printAndLog("edge parse success", LoadReport.collect(summary).edgeParseSuccess());
printAndLog("edge parse failure", LoadReport.collect(summary).edgeParseFailure());
printAndLog("edge insert success", LoadReport.collect(summary).edgeInsertSuccess());
printAndLog("edge insert failure", LoadReport.collect(summary).edgeInsertFailure());
LOG.info(DIVIDE_LINE);
System.out.println(DIVIDE_LINE);
<DeepExtract>
long totalTime = summary.totalTime();
long vertexTime = summary.vertexTime();
long edgeTime = summary.edgeTime();
long loadTime = summary.loadTime();
long readTime = totalTime - loadTime;
printAndLog("meter metrics");
printAndLog("total time", TimeUtil.readableTime(totalTime));
printAndLog("read time", TimeUtil.readableTime(readTime));
printAndLog("load time", TimeUtil.readableTime(loadTime));
printAndLog("vertex load time", TimeUtil.readableTime(vertexTime));
printAndLog("vertex load rate(vertices/s)", summary.loadRate(ElemType.VERTEX));
printAndLog("edge load time", TimeUtil.readableTime(edgeTime));
printAndLog("edge load rate(edges/s)", summary.loadRate(ElemType.EDGE));
</DeepExtract>
}
|
hugegraph-loader
|
positive
| 440,860
|
private void onSelectLevelMaxField() {
int newLevelMax = Integer.parseInt(levelMaxField.getText());
wildPokemon.setLevelmax(newLevelMax);
try {
SqlStatement.update(wildPokemon).where("map").eq(wildPokemon.getMap()).and("number").eq(wildPokemon.getNumber()).execute();
} catch (DataConnectionException e) {
e.printStackTrace();
}
readyToEdit = false;
mapNameTextField.setText(currentMapName);
childContainer.removeAll();
for (WildPokemon wildPokemon : WildPokemon.get(currentMapName)) {
childContainer.add(new WildPokemonPanel(wildPokemon));
}
editorPanel.validate();
readyToEdit = true;
return editorPanel;
}
|
private void onSelectLevelMaxField() {
int newLevelMax = Integer.parseInt(levelMaxField.getText());
wildPokemon.setLevelmax(newLevelMax);
try {
SqlStatement.update(wildPokemon).where("map").eq(wildPokemon.getMap()).and("number").eq(wildPokemon.getNumber()).execute();
} catch (DataConnectionException e) {
e.printStackTrace();
}
<DeepExtract>
readyToEdit = false;
mapNameTextField.setText(currentMapName);
childContainer.removeAll();
for (WildPokemon wildPokemon : WildPokemon.get(currentMapName)) {
childContainer.add(new WildPokemonPanel(wildPokemon));
}
editorPanel.validate();
readyToEdit = true;
return editorPanel;
</DeepExtract>
}
|
JPokemon
|
positive
| 440,862
|
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
System.out.println("Thread rodando" + i);
try {
this.join();
} catch (InterruptedException e) {
System.err.println("Thread interrompida");
}
}
}
|
public static void main(String[] args) {
<DeepExtract>
for (int i = 0; i < 10; i++) {
System.out.println("Thread rodando" + i);
try {
this.join();
} catch (InterruptedException e) {
System.err.println("Thread interrompida");
}
}
</DeepExtract>
}
|
livro
|
positive
| 440,864
|
public String resolve(TwasiInterface twasiInterface, TwasiMessage message) {
List<String> args = new ArrayList<>();
if (!this.args.equals("")) {
int depth = 0;
int start = 0;
for (int i = 0; i < this.args.length(); i++) {
char current = this.args.charAt(i);
if (current == '(')
depth++;
if (current == ')' && depth > 0)
depth--;
if (current == ',' && depth == 0) {
args.add(this.args.substring(start, i));
start = i + 1;
}
}
args.add(this.args.substring(start));
}
List<String> resolvedArgs = new ArrayList<>();
for (String arg : args) {
AtomicReference<String> parsed = new AtomicReference<>(arg);
int i = resolveMaxDepth;
while (parsed.get().contains(String.valueOf(indicator)) && i-- > 0) {
List<ParsedVariable> variables = parseVars(arg);
variables.forEach(var -> parsed.set(parsed.get().replace(var.raw, var.resolve(twasiInterface, message))));
}
resolvedArgs.add(parsed.get());
}
TwasiDependency<?> dependency;
TwasiUserPlugin plugin;
try {
plugin = twasiInterface.getPlugins().stream().filter(pl -> pl.getVariables().stream().anyMatch(var -> var.getNames().stream().anyMatch(name::equalsIgnoreCase))).findAny().orElse(null);
if (plugin != null) {
return reformat(plugin.getVariables().stream().filter(var -> var.getNames().stream().anyMatch(name::equalsIgnoreCase)).findAny().get().process(this.name, twasiInterface, resolvedArgs.toArray(new String[0]), message));
}
PluginManagerService pm = ServiceRegistry.get(PluginManagerService.class);
dependency = pm.getDependencies().stream().filter(dep -> dep.getVariables().stream().anyMatch(var -> var.getNames().stream().anyMatch(name::equalsIgnoreCase))).findAny().orElse(null);
if (dependency != null) {
return reformat(dependency.getVariables().stream().filter(var -> var.getNames().stream().anyMatch(name::equalsIgnoreCase)).findAny().get().process(this.name, twasiInterface, resolvedArgs.toArray(new String[0]), message));
}
} catch (ArrayIndexOutOfBoundsException ignored) {
return "INSUFFICIENT_PARAMETERS";
} catch (Exception ignored) {
return "ERROR";
}
return "UNRESOLVED";
}
|
public String resolve(TwasiInterface twasiInterface, TwasiMessage message) {
List<String> args = new ArrayList<>();
if (!this.args.equals("")) {
int depth = 0;
int start = 0;
for (int i = 0; i < this.args.length(); i++) {
char current = this.args.charAt(i);
if (current == '(')
depth++;
if (current == ')' && depth > 0)
depth--;
if (current == ',' && depth == 0) {
args.add(this.args.substring(start, i));
start = i + 1;
}
}
args.add(this.args.substring(start));
}
List<String> resolvedArgs = new ArrayList<>();
for (String arg : args) {
AtomicReference<String> parsed = new AtomicReference<>(arg);
int i = resolveMaxDepth;
while (parsed.get().contains(String.valueOf(indicator)) && i-- > 0) {
List<ParsedVariable> variables = parseVars(arg);
variables.forEach(var -> parsed.set(parsed.get().replace(var.raw, var.resolve(twasiInterface, message))));
}
resolvedArgs.add(parsed.get());
}
<DeepExtract>
TwasiDependency<?> dependency;
TwasiUserPlugin plugin;
try {
plugin = twasiInterface.getPlugins().stream().filter(pl -> pl.getVariables().stream().anyMatch(var -> var.getNames().stream().anyMatch(name::equalsIgnoreCase))).findAny().orElse(null);
if (plugin != null) {
return reformat(plugin.getVariables().stream().filter(var -> var.getNames().stream().anyMatch(name::equalsIgnoreCase)).findAny().get().process(this.name, twasiInterface, resolvedArgs.toArray(new String[0]), message));
}
PluginManagerService pm = ServiceRegistry.get(PluginManagerService.class);
dependency = pm.getDependencies().stream().filter(dep -> dep.getVariables().stream().anyMatch(var -> var.getNames().stream().anyMatch(name::equalsIgnoreCase))).findAny().orElse(null);
if (dependency != null) {
return reformat(dependency.getVariables().stream().filter(var -> var.getNames().stream().anyMatch(name::equalsIgnoreCase)).findAny().get().process(this.name, twasiInterface, resolvedArgs.toArray(new String[0]), message));
}
} catch (ArrayIndexOutOfBoundsException ignored) {
return "INSUFFICIENT_PARAMETERS";
} catch (Exception ignored) {
return "ERROR";
}
return "UNRESOLVED";
</DeepExtract>
}
|
twasi-core
|
positive
| 440,865
|
public void copyFrom(final LudiiStateWrapper other) {
this.game = other.game;
this.context = new Context(other.context);
return trial;
}
|
public void copyFrom(final LudiiStateWrapper other) {
this.game = other.game;
this.context = new Context(other.context);
<DeepExtract>
return trial;
</DeepExtract>
}
|
LudiiAI
|
positive
| 440,866
|
private static Verdict check(Object actual, String expectedOutput, Class outputClass) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException {
Object expected = MethodSignature.resolve(outputClass, expectedOutput);
if (outputClass == int[].class) {
return verdict(Arrays.equals((int[]) expected, (int[]) actual));
}
if (outputClass == long[].class) {
return verdict(Arrays.equals((long[]) expected, (long[]) actual));
}
if (outputClass == double[].class) {
return verdict(Arrays.equals((double[]) expected, (double[]) actual));
}
if (outputClass == String[].class) {
return verdict(Arrays.deepEquals((String[]) expected, (String[]) actual));
}
if (outputClass == double.class) {
double expectedValue = (Double) expected;
double actualValue = (Double) actual;
double delta = Math.abs(expectedValue - actualValue);
if (delta <= 1e-9 * Math.max(Math.abs(expectedValue), 1)) {
return new Verdict(Verdict.VerdictType.OK, "Absolute difference " + delta);
}
return Verdict.WA;
}
return expected.equals(actual) ? Verdict.OK : Verdict.WA;
}
|
private static Verdict check(Object actual, String expectedOutput, Class outputClass) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException {
Object expected = MethodSignature.resolve(outputClass, expectedOutput);
if (outputClass == int[].class) {
return verdict(Arrays.equals((int[]) expected, (int[]) actual));
}
if (outputClass == long[].class) {
return verdict(Arrays.equals((long[]) expected, (long[]) actual));
}
if (outputClass == double[].class) {
return verdict(Arrays.equals((double[]) expected, (double[]) actual));
}
if (outputClass == String[].class) {
return verdict(Arrays.deepEquals((String[]) expected, (String[]) actual));
}
if (outputClass == double.class) {
double expectedValue = (Double) expected;
double actualValue = (Double) actual;
double delta = Math.abs(expectedValue - actualValue);
if (delta <= 1e-9 * Math.max(Math.abs(expectedValue), 1)) {
return new Verdict(Verdict.VerdictType.OK, "Absolute difference " + delta);
}
return Verdict.WA;
}
<DeepExtract>
return expected.equals(actual) ? Verdict.OK : Verdict.WA;
</DeepExtract>
}
|
idea-chelper
|
positive
| 440,867
|
public Criteria andGoodsnameLessThan(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "goodsname" + " cannot be null");
}
criteria.add(new Criterion("goodsname <", value));
return (Criteria) this;
}
|
public Criteria andGoodsnameLessThan(String value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "goodsname" + " cannot be null");
}
criteria.add(new Criterion("goodsname <", value));
</DeepExtract>
return (Criteria) this;
}
|
SSM_VUE
|
positive
| 440,868
|
@Nullable
public T clear() {
T prev;
mWriteLock.lock();
try {
prev = mRef;
mRef = (T) null;
} finally {
mWriteLock.unlock();
}
return prev;
}
|
@Nullable
public T clear() {
<DeepExtract>
T prev;
mWriteLock.lock();
try {
prev = mRef;
mRef = (T) null;
} finally {
mWriteLock.unlock();
}
return prev;
</DeepExtract>
}
|
AndroidUSBCamera
|
positive
| 440,870
|
private void initializeLayers() {
mNodeLayer.setPickOnBounds(false);
mConnectionLayer.setPickOnBounds(false);
if (STYLE_CLASS_NODE_LAYER != null && !(STYLE_CLASS_NODE_LAYER instanceof VirtualSkin)) {
mNodeLayer.getChildren().add(STYLE_CLASS_NODE_LAYER.getRoot());
}
if (STYLE_CLASS_CONNECTION_LAYER != null && !(STYLE_CLASS_CONNECTION_LAYER instanceof VirtualSkin)) {
mNodeLayer.getChildren().add(STYLE_CLASS_CONNECTION_LAYER.getRoot());
}
getChildren().addAll(mGrid, mConnectionLayer, mNodeLayer, mSelectionBox);
}
|
private void initializeLayers() {
mNodeLayer.setPickOnBounds(false);
mConnectionLayer.setPickOnBounds(false);
if (STYLE_CLASS_NODE_LAYER != null && !(STYLE_CLASS_NODE_LAYER instanceof VirtualSkin)) {
mNodeLayer.getChildren().add(STYLE_CLASS_NODE_LAYER.getRoot());
}
<DeepExtract>
if (STYLE_CLASS_CONNECTION_LAYER != null && !(STYLE_CLASS_CONNECTION_LAYER instanceof VirtualSkin)) {
mNodeLayer.getChildren().add(STYLE_CLASS_CONNECTION_LAYER.getRoot());
}
</DeepExtract>
getChildren().addAll(mGrid, mConnectionLayer, mNodeLayer, mSelectionBox);
}
|
graph-editor
|
positive
| 440,871
|
public synchronized void addnewgame() {
State = 1;
ListElement la = Pos.node().actions();
Action a;
clearsend();
while (la != null) {
a = (Action) la.content();
if (a.type().equals("C")) {
if (GF.getComment().equals(""))
Pos.node().removeaction(la);
else
a.arguments().content(GF.getComment());
return;
}
la = la.next();
}
String s = GF.getComment();
if (!s.equals("")) {
Pos.addaction(new Action("C", s));
}
String s = (String) "Jago:" + GF.version().arguments().content();
int i = Field.i(s);
int j = Field.j(s);
if (!valid(i, j))
return;
"AP".addchange(new Change(i, j, P.color(i, j), P.number(i, j)));
P.color(i, j, true);
P.number(i, j, "AP".number() - 1);
showlast = false;
update(lasti, lastj);
showlast = true;
lasti = i;
lastj = j;
update(i, j);
P.color(-true);
capture(i, j, "AP");
String s = (String) "" + S.arguments().content();
int i = Field.i(s);
int j = Field.j(s);
if (!valid(i, j))
return;
"SZ".addchange(new Change(i, j, P.color(i, j), P.number(i, j)));
P.color(i, j, true);
P.number(i, j, "SZ".number() - 1);
showlast = false;
update(lasti, lastj);
showlast = true;
lasti = i;
lastj = j;
update(i, j);
P.color(-true);
capture(i, j, "SZ");
String s = (String) "1".arguments().content();
int i = Field.i(s);
int j = Field.j(s);
if (!valid(i, j))
return;
"GM".addchange(new Change(i, j, P.color(i, j), P.number(i, j)));
P.color(i, j, true);
P.number(i, j, "GM".number() - 1);
showlast = false;
update(lasti, lastj);
showlast = true;
lasti = i;
lastj = j;
update(i, j);
P.color(-true);
capture(i, j, "GM");
String s = (String) GF.getParameter("puresgf", false) ? "4" : "1".arguments().content();
int i = Field.i(s);
int j = Field.j(s);
if (!valid(i, j))
return;
"FF".addchange(new Change(i, j, P.color(i, j), P.number(i, j)));
P.color(i, j, true);
P.number(i, j, "FF".number() - 1);
showlast = false;
update(lasti, lastj);
showlast = true;
lasti = i;
lastj = j;
update(i, j);
P.color(-true);
capture(i, j, "FF");
Node n = new Node(number);
T = new SGFTree(n);
CurrentTree++;
if (CurrentTree >= Trees.size())
Trees.addElement(T);
else
Trees.insertElementAt(T, CurrentTree);
Pos = T.top();
P = new Position(S);
lasti = lastj = -1;
Pb = Pw = 0;
updateall();
copy();
Node n = Pos.node();
ListElement p = n.actions();
if (p == null)
return;
Action a;
String s;
int i, j;
while (p != null) {
a = (Action) p.content();
if (a.type().equals("SZ")) {
if (Pos.parentPos() == null) {
try {
int ss = Integer.parseInt(a.argument().trim());
if (ss != S) {
S = ss;
P = new Position(S);
updateall();
copy();
}
} catch (NumberFormatException e) {
}
}
}
p = p.next();
}
n.clearchanges();
n.Pw = n.Pb = 0;
p = n.actions();
while (p != null) {
a = (Action) p.content();
if (a.type().equals("B")) {
setaction(n, a, 1);
} else if (a.type().equals("W")) {
setaction(n, a, -1);
}
if (a.type().equals("AB")) {
placeaction(n, a, 1);
}
if (a.type().equals("AW")) {
placeaction(n, a, -1);
} else if (a.type().equals("AE")) {
emptyaction(n, a);
}
p = p.next();
}
Node n = Pos.node();
number = n.number();
NodeName = n.getaction("N");
String ms = "";
if (n.main()) {
if (!Pos.haschildren())
ms = "** ";
else
ms = "* ";
}
switch(State) {
case 3:
LText = ms + GF.resourceString("Set_black_stones");
break;
case 4:
LText = ms + GF.resourceString("Set_white_stones");
break;
case 5:
LText = ms + GF.resourceString("Mark_fields");
break;
case 6:
LText = ms + GF.resourceString("Place_letters");
break;
case 7:
LText = ms + GF.resourceString("Delete_stones");
break;
case 8:
LText = ms + GF.resourceString("Remove_prisoners");
break;
case 9:
LText = ms + GF.resourceString("Set_special_marker");
break;
case 10:
LText = ms + GF.resourceString("Text__") + TextMarker;
break;
default:
if (P.color() > 0) {
String s = lookuptime("BL");
if (!s.equals(""))
LText = ms + GF.resourceString("Next_move__Black_") + number + " (" + s + ")";
else
LText = ms + GF.resourceString("Next_move__Black_") + number;
} else {
String s = lookuptime("WL");
if (!s.equals(""))
LText = ms + GF.resourceString("Next_move__White_") + number + " (" + s + ")";
else
LText = ms + GF.resourceString("Next_move__White_") + number;
}
}
LText = LText + " (" + siblings() + " " + GF.resourceString("Siblings") + ", " + children() + " " + GF.resourceString("Children") + ")";
if (NodeName.equals("")) {
GF.setLabel(LText);
DisplayNodeName = false;
} else {
GF.setLabel(NodeName);
DisplayNodeName = true;
}
GF.setState(3, !n.main());
GF.setState(4, !n.main());
GF.setState(7, !n.main() || Pos.haschildren());
if (State == 1 || State == 2) {
if (P.color() == 1)
State = 1;
else
State = 2;
}
GF.setState(1, Pos.parentPos() != null && Pos.parentPos().firstChild() != Pos);
GF.setState(2, Pos.parentPos() != null && Pos.parentPos().lastChild() != Pos);
GF.setState(5, Pos.haschildren());
GF.setState(6, Pos.parentPos() != null);
if (State != 9)
GF.setState(State);
else
GF.setMarkState(SpecialMarker);
int i, j;
for (i = 0; i < S; i++) for (j = 0; j < S; j++) {
if (P.tree(i, j) != null) {
P.tree(i, j, null);
update(i, j);
}
if (P.marker(i, j) != Field.NONE) {
P.marker(i, j, Field.NONE);
update(i, j);
}
if (P.letter(i, j) != 0) {
P.letter(i, j, 0);
update(i, j);
}
if (P.haslabel(i, j)) {
P.clearlabel(i, j);
update(i, j);
}
}
ListElement la = Pos.node().actions();
Action a;
String s;
String sc = "";
int let = 1;
while (la != null) {
a = (Action) la.content();
if (a.type().equals("C")) {
sc = (String) a.arguments().content();
} else if (a.type().equals("SQ") || a.type().equals("SL")) {
ListElement larg = a.arguments();
while (larg != null) {
s = (String) larg.content();
i = Field.i(s);
j = Field.j(s);
if (valid(i, j)) {
P.marker(i, j, Field.SQUARE);
update(i, j);
}
larg = larg.next();
}
} else if (a.type().equals("MA") || a.type().equals("M") || a.type().equals("TW") || a.type().equals("TB")) {
ListElement larg = a.arguments();
while (larg != null) {
s = (String) larg.content();
i = Field.i(s);
j = Field.j(s);
if (valid(i, j)) {
P.marker(i, j, Field.CROSS);
update(i, j);
}
larg = larg.next();
}
} else if (a.type().equals("TR")) {
ListElement larg = a.arguments();
while (larg != null) {
s = (String) larg.content();
i = Field.i(s);
j = Field.j(s);
if (valid(i, j)) {
P.marker(i, j, Field.TRIANGLE);
update(i, j);
}
larg = larg.next();
}
} else if (a.type().equals("CR")) {
ListElement larg = a.arguments();
while (larg != null) {
s = (String) larg.content();
i = Field.i(s);
j = Field.j(s);
if (valid(i, j)) {
P.marker(i, j, Field.CIRCLE);
update(i, j);
}
larg = larg.next();
}
} else if (a.type().equals("L")) {
ListElement larg = a.arguments();
while (larg != null) {
s = (String) larg.content();
i = Field.i(s);
j = Field.j(s);
if (valid(i, j)) {
P.letter(i, j, let);
let++;
update(i, j);
}
larg = larg.next();
}
} else if (a.type().equals("LB")) {
ListElement larg = a.arguments();
while (larg != null) {
s = (String) larg.content();
i = Field.i(s);
j = Field.j(s);
if (valid(i, j) && s.length() >= 4 && s.charAt(2) == ':') {
P.setlabel(i, j, s.substring(3));
update(i, j);
}
larg = larg.next();
}
}
la = la.next();
}
TreeNode p;
ListElement l = null;
if (VCurrent) {
p = Pos.parentPos();
if (p != null)
l = p.firstChild().listelement();
} else if (Pos.haschildren() && Pos.firstChild() != Pos.lastChild()) {
l = Pos.firstChild().listelement();
}
while (l != null) {
p = (TreeNode) l.content();
if (p != Pos) {
la = p.node().actions();
while (la != null) {
a = (Action) la.content();
if (a.type().equals("W") || a.type().equals("B")) {
s = (String) a.arguments().content();
i = Field.i(s);
j = Field.j(s);
if (valid(i, j)) {
P.tree(i, j, p);
update(i, j);
}
break;
}
la = la.next();
}
}
l = l.next();
}
if (!GF.getComment().equals(sc)) {
GF.setComment(sc);
}
if (Range >= 0 && !KeepRange)
clearrange();
}
|
public synchronized void addnewgame() {
<DeepExtract>
</DeepExtract>
State = 1;
<DeepExtract>
</DeepExtract>
ListElement la = Pos.node().actions();
<DeepExtract>
</DeepExtract>
Action a;
<DeepExtract>
</DeepExtract>
clearsend();
<DeepExtract>
</DeepExtract>
while (la != null) {
<DeepExtract>
</DeepExtract>
a = (Action) la.content();
<DeepExtract>
</DeepExtract>
if (a.type().equals("C")) {
<DeepExtract>
</DeepExtract>
if (GF.getComment().equals(""))
<DeepExtract>
</DeepExtract>
Pos.node().removeaction(la);
<DeepExtract>
</DeepExtract>
else
<DeepExtract>
</DeepExtract>
a.arguments().content(GF.getComment());
<DeepExtract>
</DeepExtract>
return;
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
la = la.next();
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
String s = GF.getComment();
<DeepExtract>
</DeepExtract>
if (!s.equals("")) {
<DeepExtract>
</DeepExtract>
Pos.addaction(new Action("C", s));
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
String s = (String) "Jago:" + GF.version().arguments().content();
<DeepExtract>
</DeepExtract>
int i = Field.i(s);
<DeepExtract>
</DeepExtract>
int j = Field.j(s);
<DeepExtract>
</DeepExtract>
if (!valid(i, j))
<DeepExtract>
</DeepExtract>
return;
<DeepExtract>
</DeepExtract>
"AP".addchange(new Change(i, j, P.color(i, j), P.number(i, j)));
<DeepExtract>
</DeepExtract>
P.color(i, j, true);
<DeepExtract>
</DeepExtract>
P.number(i, j, "AP".number() - 1);
<DeepExtract>
</DeepExtract>
showlast = false;
<DeepExtract>
</DeepExtract>
update(lasti, lastj);
<DeepExtract>
</DeepExtract>
showlast = true;
<DeepExtract>
</DeepExtract>
lasti = i;
<DeepExtract>
</DeepExtract>
lastj = j;
<DeepExtract>
</DeepExtract>
update(i, j);
<DeepExtract>
</DeepExtract>
P.color(-true);
<DeepExtract>
</DeepExtract>
capture(i, j, "AP");
<DeepExtract>
</DeepExtract>
String s = (String) "" + S.arguments().content();
<DeepExtract>
</DeepExtract>
int i = Field.i(s);
<DeepExtract>
</DeepExtract>
int j = Field.j(s);
<DeepExtract>
</DeepExtract>
if (!valid(i, j))
<DeepExtract>
</DeepExtract>
return;
<DeepExtract>
</DeepExtract>
"SZ".addchange(new Change(i, j, P.color(i, j), P.number(i, j)));
<DeepExtract>
</DeepExtract>
P.color(i, j, true);
<DeepExtract>
</DeepExtract>
P.number(i, j, "SZ".number() - 1);
<DeepExtract>
</DeepExtract>
showlast = false;
<DeepExtract>
</DeepExtract>
update(lasti, lastj);
<DeepExtract>
</DeepExtract>
showlast = true;
<DeepExtract>
</DeepExtract>
lasti = i;
<DeepExtract>
</DeepExtract>
lastj = j;
<DeepExtract>
</DeepExtract>
update(i, j);
<DeepExtract>
</DeepExtract>
P.color(-true);
<DeepExtract>
</DeepExtract>
capture(i, j, "SZ");
<DeepExtract>
</DeepExtract>
String s = (String) "1".arguments().content();
<DeepExtract>
</DeepExtract>
int i = Field.i(s);
<DeepExtract>
</DeepExtract>
int j = Field.j(s);
<DeepExtract>
</DeepExtract>
if (!valid(i, j))
<DeepExtract>
</DeepExtract>
return;
<DeepExtract>
</DeepExtract>
"GM".addchange(new Change(i, j, P.color(i, j), P.number(i, j)));
<DeepExtract>
</DeepExtract>
P.color(i, j, true);
<DeepExtract>
</DeepExtract>
P.number(i, j, "GM".number() - 1);
<DeepExtract>
</DeepExtract>
showlast = false;
<DeepExtract>
</DeepExtract>
update(lasti, lastj);
<DeepExtract>
</DeepExtract>
showlast = true;
<DeepExtract>
</DeepExtract>
lasti = i;
<DeepExtract>
</DeepExtract>
lastj = j;
<DeepExtract>
</DeepExtract>
update(i, j);
<DeepExtract>
</DeepExtract>
P.color(-true);
<DeepExtract>
</DeepExtract>
capture(i, j, "GM");
<DeepExtract>
</DeepExtract>
String s = (String) GF.getParameter("puresgf", false) ? "4" : "1".arguments().content();
<DeepExtract>
</DeepExtract>
int i = Field.i(s);
<DeepExtract>
</DeepExtract>
int j = Field.j(s);
<DeepExtract>
</DeepExtract>
if (!valid(i, j))
<DeepExtract>
</DeepExtract>
return;
<DeepExtract>
</DeepExtract>
"FF".addchange(new Change(i, j, P.color(i, j), P.number(i, j)));
<DeepExtract>
</DeepExtract>
P.color(i, j, true);
<DeepExtract>
</DeepExtract>
P.number(i, j, "FF".number() - 1);
<DeepExtract>
</DeepExtract>
showlast = false;
<DeepExtract>
</DeepExtract>
update(lasti, lastj);
<DeepExtract>
</DeepExtract>
showlast = true;
<DeepExtract>
</DeepExtract>
lasti = i;
<DeepExtract>
</DeepExtract>
lastj = j;
<DeepExtract>
</DeepExtract>
update(i, j);
<DeepExtract>
</DeepExtract>
P.color(-true);
<DeepExtract>
</DeepExtract>
capture(i, j, "FF");
<DeepExtract>
</DeepExtract>
Node n = new Node(number);
<DeepExtract>
</DeepExtract>
T = new SGFTree(n);
<DeepExtract>
</DeepExtract>
CurrentTree++;
<DeepExtract>
</DeepExtract>
if (CurrentTree >= Trees.size())
<DeepExtract>
</DeepExtract>
Trees.addElement(T);
<DeepExtract>
</DeepExtract>
else
<DeepExtract>
</DeepExtract>
Trees.insertElementAt(T, CurrentTree);
<DeepExtract>
</DeepExtract>
Pos = T.top();
<DeepExtract>
</DeepExtract>
P = new Position(S);
<DeepExtract>
</DeepExtract>
lasti = lastj = -1;
<DeepExtract>
</DeepExtract>
Pb = Pw = 0;
<DeepExtract>
</DeepExtract>
updateall();
<DeepExtract>
</DeepExtract>
copy();
<DeepExtract>
</DeepExtract>
Node n = Pos.node();
<DeepExtract>
</DeepExtract>
ListElement p = n.actions();
<DeepExtract>
</DeepExtract>
if (p == null)
<DeepExtract>
</DeepExtract>
return;
<DeepExtract>
</DeepExtract>
Action a;
<DeepExtract>
</DeepExtract>
String s;
<DeepExtract>
</DeepExtract>
int i, j;
<DeepExtract>
</DeepExtract>
while (p != null) {
<DeepExtract>
</DeepExtract>
a = (Action) p.content();
<DeepExtract>
</DeepExtract>
if (a.type().equals("SZ")) {
<DeepExtract>
</DeepExtract>
if (Pos.parentPos() == null) {
<DeepExtract>
</DeepExtract>
try {
<DeepExtract>
</DeepExtract>
int ss = Integer.parseInt(a.argument().trim());
<DeepExtract>
</DeepExtract>
if (ss != S) {
<DeepExtract>
</DeepExtract>
S = ss;
<DeepExtract>
</DeepExtract>
P = new Position(S);
<DeepExtract>
</DeepExtract>
updateall();
<DeepExtract>
</DeepExtract>
copy();
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
} catch (NumberFormatException e) {
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
p = p.next();
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
n.clearchanges();
<DeepExtract>
</DeepExtract>
n.Pw = n.Pb = 0;
<DeepExtract>
</DeepExtract>
p = n.actions();
<DeepExtract>
</DeepExtract>
while (p != null) {
<DeepExtract>
</DeepExtract>
a = (Action) p.content();
<DeepExtract>
</DeepExtract>
if (a.type().equals("B")) {
<DeepExtract>
</DeepExtract>
setaction(n, a, 1);
<DeepExtract>
</DeepExtract>
} else if (a.type().equals("W")) {
<DeepExtract>
</DeepExtract>
setaction(n, a, -1);
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
if (a.type().equals("AB")) {
<DeepExtract>
</DeepExtract>
placeaction(n, a, 1);
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
if (a.type().equals("AW")) {
<DeepExtract>
</DeepExtract>
placeaction(n, a, -1);
<DeepExtract>
</DeepExtract>
} else if (a.type().equals("AE")) {
<DeepExtract>
</DeepExtract>
emptyaction(n, a);
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
p = p.next();
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
Node n = Pos.node();
<DeepExtract>
</DeepExtract>
number = n.number();
<DeepExtract>
</DeepExtract>
NodeName = n.getaction("N");
<DeepExtract>
</DeepExtract>
String ms = "";
<DeepExtract>
</DeepExtract>
if (n.main()) {
<DeepExtract>
</DeepExtract>
if (!Pos.haschildren())
<DeepExtract>
</DeepExtract>
ms = "** ";
<DeepExtract>
</DeepExtract>
else
<DeepExtract>
</DeepExtract>
ms = "* ";
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
switch(State) {
<DeepExtract>
</DeepExtract>
case 3:
<DeepExtract>
</DeepExtract>
LText = ms + GF.resourceString("Set_black_stones");
<DeepExtract>
</DeepExtract>
break;
<DeepExtract>
</DeepExtract>
case 4:
<DeepExtract>
</DeepExtract>
LText = ms + GF.resourceString("Set_white_stones");
<DeepExtract>
</DeepExtract>
break;
<DeepExtract>
</DeepExtract>
case 5:
<DeepExtract>
</DeepExtract>
LText = ms + GF.resourceString("Mark_fields");
<DeepExtract>
</DeepExtract>
break;
<DeepExtract>
</DeepExtract>
case 6:
<DeepExtract>
</DeepExtract>
LText = ms + GF.resourceString("Place_letters");
<DeepExtract>
</DeepExtract>
break;
<DeepExtract>
</DeepExtract>
case 7:
<DeepExtract>
</DeepExtract>
LText = ms + GF.resourceString("Delete_stones");
<DeepExtract>
</DeepExtract>
break;
<DeepExtract>
</DeepExtract>
case 8:
<DeepExtract>
</DeepExtract>
LText = ms + GF.resourceString("Remove_prisoners");
<DeepExtract>
</DeepExtract>
break;
<DeepExtract>
</DeepExtract>
case 9:
<DeepExtract>
</DeepExtract>
LText = ms + GF.resourceString("Set_special_marker");
<DeepExtract>
</DeepExtract>
break;
<DeepExtract>
</DeepExtract>
case 10:
<DeepExtract>
</DeepExtract>
LText = ms + GF.resourceString("Text__") + TextMarker;
<DeepExtract>
</DeepExtract>
break;
<DeepExtract>
</DeepExtract>
default:
<DeepExtract>
</DeepExtract>
if (P.color() > 0) {
<DeepExtract>
</DeepExtract>
String s = lookuptime("BL");
<DeepExtract>
</DeepExtract>
if (!s.equals(""))
<DeepExtract>
</DeepExtract>
LText = ms + GF.resourceString("Next_move__Black_") + number + " (" + s + ")";
<DeepExtract>
</DeepExtract>
else
<DeepExtract>
</DeepExtract>
LText = ms + GF.resourceString("Next_move__Black_") + number;
<DeepExtract>
</DeepExtract>
} else {
<DeepExtract>
</DeepExtract>
String s = lookuptime("WL");
<DeepExtract>
</DeepExtract>
if (!s.equals(""))
<DeepExtract>
</DeepExtract>
LText = ms + GF.resourceString("Next_move__White_") + number + " (" + s + ")";
<DeepExtract>
</DeepExtract>
else
<DeepExtract>
</DeepExtract>
LText = ms + GF.resourceString("Next_move__White_") + number;
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
LText = LText + " (" + siblings() + " " + GF.resourceString("Siblings") + ", " + children() + " " + GF.resourceString("Children") + ")";
<DeepExtract>
</DeepExtract>
if (NodeName.equals("")) {
<DeepExtract>
</DeepExtract>
GF.setLabel(LText);
<DeepExtract>
</DeepExtract>
DisplayNodeName = false;
<DeepExtract>
</DeepExtract>
} else {
<DeepExtract>
</DeepExtract>
GF.setLabel(NodeName);
<DeepExtract>
</DeepExtract>
DisplayNodeName = true;
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
GF.setState(3, !n.main());
<DeepExtract>
</DeepExtract>
GF.setState(4, !n.main());
<DeepExtract>
</DeepExtract>
GF.setState(7, !n.main() || Pos.haschildren());
<DeepExtract>
</DeepExtract>
if (State == 1 || State == 2) {
<DeepExtract>
</DeepExtract>
if (P.color() == 1)
<DeepExtract>
</DeepExtract>
State = 1;
<DeepExtract>
</DeepExtract>
else
<DeepExtract>
</DeepExtract>
State = 2;
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
GF.setState(1, Pos.parentPos() != null && Pos.parentPos().firstChild() != Pos);
<DeepExtract>
</DeepExtract>
GF.setState(2, Pos.parentPos() != null && Pos.parentPos().lastChild() != Pos);
<DeepExtract>
</DeepExtract>
GF.setState(5, Pos.haschildren());
<DeepExtract>
</DeepExtract>
GF.setState(6, Pos.parentPos() != null);
<DeepExtract>
</DeepExtract>
if (State != 9)
<DeepExtract>
</DeepExtract>
GF.setState(State);
<DeepExtract>
</DeepExtract>
else
<DeepExtract>
</DeepExtract>
GF.setMarkState(SpecialMarker);
<DeepExtract>
</DeepExtract>
int i, j;
<DeepExtract>
</DeepExtract>
for (i = 0; i < S; i++) for (j = 0; j < S; j++) {
<DeepExtract>
</DeepExtract>
if (P.tree(i, j) != null) {
<DeepExtract>
</DeepExtract>
P.tree(i, j, null);
<DeepExtract>
</DeepExtract>
update(i, j);
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
if (P.marker(i, j) != Field.NONE) {
<DeepExtract>
</DeepExtract>
P.marker(i, j, Field.NONE);
<DeepExtract>
</DeepExtract>
update(i, j);
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
if (P.letter(i, j) != 0) {
<DeepExtract>
</DeepExtract>
P.letter(i, j, 0);
<DeepExtract>
</DeepExtract>
update(i, j);
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
if (P.haslabel(i, j)) {
<DeepExtract>
</DeepExtract>
P.clearlabel(i, j);
<DeepExtract>
</DeepExtract>
update(i, j);
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
ListElement la = Pos.node().actions();
<DeepExtract>
</DeepExtract>
Action a;
<DeepExtract>
</DeepExtract>
String s;
<DeepExtract>
</DeepExtract>
String sc = "";
<DeepExtract>
</DeepExtract>
int let = 1;
<DeepExtract>
</DeepExtract>
while (la != null) {
<DeepExtract>
</DeepExtract>
a = (Action) la.content();
<DeepExtract>
</DeepExtract>
if (a.type().equals("C")) {
<DeepExtract>
</DeepExtract>
sc = (String) a.arguments().content();
<DeepExtract>
</DeepExtract>
} else if (a.type().equals("SQ") || a.type().equals("SL")) {
<DeepExtract>
</DeepExtract>
ListElement larg = a.arguments();
<DeepExtract>
</DeepExtract>
while (larg != null) {
<DeepExtract>
</DeepExtract>
s = (String) larg.content();
<DeepExtract>
</DeepExtract>
i = Field.i(s);
<DeepExtract>
</DeepExtract>
j = Field.j(s);
<DeepExtract>
</DeepExtract>
if (valid(i, j)) {
<DeepExtract>
</DeepExtract>
P.marker(i, j, Field.SQUARE);
<DeepExtract>
</DeepExtract>
update(i, j);
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
larg = larg.next();
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
} else if (a.type().equals("MA") || a.type().equals("M") || a.type().equals("TW") || a.type().equals("TB")) {
<DeepExtract>
</DeepExtract>
ListElement larg = a.arguments();
<DeepExtract>
</DeepExtract>
while (larg != null) {
<DeepExtract>
</DeepExtract>
s = (String) larg.content();
<DeepExtract>
</DeepExtract>
i = Field.i(s);
<DeepExtract>
</DeepExtract>
j = Field.j(s);
<DeepExtract>
</DeepExtract>
if (valid(i, j)) {
<DeepExtract>
</DeepExtract>
P.marker(i, j, Field.CROSS);
<DeepExtract>
</DeepExtract>
update(i, j);
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
larg = larg.next();
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
} else if (a.type().equals("TR")) {
<DeepExtract>
</DeepExtract>
ListElement larg = a.arguments();
<DeepExtract>
</DeepExtract>
while (larg != null) {
<DeepExtract>
</DeepExtract>
s = (String) larg.content();
<DeepExtract>
</DeepExtract>
i = Field.i(s);
<DeepExtract>
</DeepExtract>
j = Field.j(s);
<DeepExtract>
</DeepExtract>
if (valid(i, j)) {
<DeepExtract>
</DeepExtract>
P.marker(i, j, Field.TRIANGLE);
<DeepExtract>
</DeepExtract>
update(i, j);
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
larg = larg.next();
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
} else if (a.type().equals("CR")) {
<DeepExtract>
</DeepExtract>
ListElement larg = a.arguments();
<DeepExtract>
</DeepExtract>
while (larg != null) {
<DeepExtract>
</DeepExtract>
s = (String) larg.content();
<DeepExtract>
</DeepExtract>
i = Field.i(s);
<DeepExtract>
</DeepExtract>
j = Field.j(s);
<DeepExtract>
</DeepExtract>
if (valid(i, j)) {
<DeepExtract>
</DeepExtract>
P.marker(i, j, Field.CIRCLE);
<DeepExtract>
</DeepExtract>
update(i, j);
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
larg = larg.next();
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
} else if (a.type().equals("L")) {
<DeepExtract>
</DeepExtract>
ListElement larg = a.arguments();
<DeepExtract>
</DeepExtract>
while (larg != null) {
<DeepExtract>
</DeepExtract>
s = (String) larg.content();
<DeepExtract>
</DeepExtract>
i = Field.i(s);
<DeepExtract>
</DeepExtract>
j = Field.j(s);
<DeepExtract>
</DeepExtract>
if (valid(i, j)) {
<DeepExtract>
</DeepExtract>
P.letter(i, j, let);
<DeepExtract>
</DeepExtract>
let++;
<DeepExtract>
</DeepExtract>
update(i, j);
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
larg = larg.next();
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
} else if (a.type().equals("LB")) {
<DeepExtract>
</DeepExtract>
ListElement larg = a.arguments();
<DeepExtract>
</DeepExtract>
while (larg != null) {
<DeepExtract>
</DeepExtract>
s = (String) larg.content();
<DeepExtract>
</DeepExtract>
i = Field.i(s);
<DeepExtract>
</DeepExtract>
j = Field.j(s);
<DeepExtract>
</DeepExtract>
if (valid(i, j) && s.length() >= 4 && s.charAt(2) == ':') {
<DeepExtract>
</DeepExtract>
P.setlabel(i, j, s.substring(3));
<DeepExtract>
</DeepExtract>
update(i, j);
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
larg = larg.next();
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
la = la.next();
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
TreeNode p;
<DeepExtract>
</DeepExtract>
ListElement l = null;
<DeepExtract>
</DeepExtract>
if (VCurrent) {
<DeepExtract>
</DeepExtract>
p = Pos.parentPos();
<DeepExtract>
</DeepExtract>
if (p != null)
<DeepExtract>
</DeepExtract>
l = p.firstChild().listelement();
<DeepExtract>
</DeepExtract>
} else if (Pos.haschildren() && Pos.firstChild() != Pos.lastChild()) {
<DeepExtract>
</DeepExtract>
l = Pos.firstChild().listelement();
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
while (l != null) {
<DeepExtract>
</DeepExtract>
p = (TreeNode) l.content();
<DeepExtract>
</DeepExtract>
if (p != Pos) {
<DeepExtract>
</DeepExtract>
la = p.node().actions();
<DeepExtract>
</DeepExtract>
while (la != null) {
<DeepExtract>
</DeepExtract>
a = (Action) la.content();
<DeepExtract>
</DeepExtract>
if (a.type().equals("W") || a.type().equals("B")) {
<DeepExtract>
</DeepExtract>
s = (String) a.arguments().content();
<DeepExtract>
</DeepExtract>
i = Field.i(s);
<DeepExtract>
</DeepExtract>
j = Field.j(s);
<DeepExtract>
</DeepExtract>
if (valid(i, j)) {
<DeepExtract>
</DeepExtract>
P.tree(i, j, p);
<DeepExtract>
</DeepExtract>
update(i, j);
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
break;
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
la = la.next();
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
l = l.next();
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
if (!GF.getComment().equals(sc)) {
<DeepExtract>
</DeepExtract>
GF.setComment(sc);
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
if (Range >= 0 && !KeepRange)
<DeepExtract>
</DeepExtract>
clearrange();
<DeepExtract>
</DeepExtract>
}
|
DragonGoApp
|
positive
| 440,873
|
public static int assertUnsupportedWithLight(Runnable run) {
if (TestUtil.LIGHT) {
return assertUnsupported(run);
}
HotSwapTool.toVersion(clazz, version);
return -1;
}
|
public static int assertUnsupportedWithLight(Runnable run) {
if (TestUtil.LIGHT) {
return assertUnsupported(run);
}
<DeepExtract>
HotSwapTool.toVersion(clazz, version);
</DeepExtract>
return -1;
}
|
dcevm
|
positive
| 440,874
|
public static void simple(Context context, @StringRes int resId) {
if (!built)
build();
toast.show();
if (duration == LENGTH_SEC) {
new Handler().postDelayed(() -> toast.cancel(), D.SECOND);
}
}
|
public static void simple(Context context, @StringRes int resId) {
<DeepExtract>
if (!built)
build();
toast.show();
if (duration == LENGTH_SEC) {
new Handler().postDelayed(() -> toast.cancel(), D.SECOND);
}
</DeepExtract>
}
|
BaldPhone
|
positive
| 440,875
|
public Criteria andTrademarkNotIn(List<String> values) {
if (values == null) {
throw new RuntimeException("Value for " + "trademark" + " cannot be null");
}
criteria.add(new Criterion("trademark not in", values));
return (Criteria) this;
}
|
public Criteria andTrademarkNotIn(List<String> values) {
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "trademark" + " cannot be null");
}
criteria.add(new Criterion("trademark not in", values));
</DeepExtract>
return (Criteria) this;
}
|
uccn
|
positive
| 440,877
|
public static int arrayPairSum2(int[] nums) {
Arrays.sort(nums);
int sum = 0;
for (int i = 0; i < nums.length; i = i + 2) {
sum = sum + nums[i];
}
return sum;
}
|
public static int arrayPairSum2(int[] nums) {
Arrays.sort(nums);
<DeepExtract>
int sum = 0;
for (int i = 0; i < nums.length; i = i + 2) {
sum = sum + nums[i];
}
return sum;
</DeepExtract>
}
|
Java-Note
|
positive
| 440,878
|
public synchronized void removeDrawAction(DrawAction action) {
actions.remove(action);
redoActions.add(action);
valid = false;
fireEvent(null, EVENT_DRAWING_INVALIDATED);
DrawingEvent evt = new DrawingEvent(EVENT_DRAW_ACTION_REMOVED, this, action);
for (DrawingListener listener : listeners) {
listener.eventFired(evt);
}
}
|
public synchronized void removeDrawAction(DrawAction action) {
actions.remove(action);
redoActions.add(action);
valid = false;
fireEvent(null, EVENT_DRAWING_INVALIDATED);
<DeepExtract>
DrawingEvent evt = new DrawingEvent(EVENT_DRAW_ACTION_REMOVED, this, action);
for (DrawingListener listener : listeners) {
listener.eventFired(evt);
}
</DeepExtract>
}
|
Stacks-Flashcards
|
positive
| 440,879
|
@Test
@Deployment(resources = { "org/camunda/bpm/scenario/test/timers/EventSubprocessInterruptingTimerTest.bpmn" })
public void testTakeMuchTooLongForTask() {
when(scenario.waitsAtUserTask("UserTask")).thenReturn(new UserTaskAction() {
@Override
public void execute(final TaskDelegate task) {
task.defer("PT6M", new Deferred() {
@Override
public void execute() {
task.complete();
}
});
}
});
task.complete();
verify(scenario, times(1)).hasStarted("UserTask");
verify(scenario, times(1)).hasFinished("UserTask");
verify(scenario, never()).hasFinished("EndEventCompleted");
verify(scenario, times(1)).hasFinished("EndEventCanceled");
}
|
@Test
@Deployment(resources = { "org/camunda/bpm/scenario/test/timers/EventSubprocessInterruptingTimerTest.bpmn" })
public void testTakeMuchTooLongForTask() {
when(scenario.waitsAtUserTask("UserTask")).thenReturn(new UserTaskAction() {
@Override
public void execute(final TaskDelegate task) {
task.defer("PT6M", new Deferred() {
@Override
public void execute() {
<DeepExtract>
task.complete();
</DeepExtract>
}
});
}
});
<DeepExtract>
task.complete();
</DeepExtract>
verify(scenario, times(1)).hasStarted("UserTask");
verify(scenario, times(1)).hasFinished("UserTask");
verify(scenario, never()).hasFinished("EndEventCompleted");
verify(scenario, times(1)).hasFinished("EndEventCanceled");
}
|
camunda-platform-scenario
|
positive
| 440,881
|
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Bitmap inBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.dog);
Bitmap outBitmap = inBitmap.copy(inBitmap.getConfig(), true);
ImageView normalImage = (ImageView) findViewById(R.id.image_normal);
normalImage.setImageBitmap(outBitmap.copy(outBitmap.getConfig(), false));
final RenderScript rs = RenderScript.create(this);
final Allocation input = Allocation.createFromBitmap(rs, inBitmap, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);
final Allocation output = Allocation.createTyped(rs, input.getType());
final ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
script.setRadius(4f);
script.setInput(input);
script.forEach(output);
output.copyTo(outBitmap);
ImageView normalImage = (ImageView) findViewById(R.id.image_blurred);
normalImage.setImageBitmap(outBitmap.copy(outBitmap.getConfig(), false));
final ScriptIntrinsicColorMatrix scriptColor = ScriptIntrinsicColorMatrix.create(rs, Element.U8_4(rs));
scriptColor.setGreyscale();
scriptColor.forEach(input, output);
output.copyTo(outBitmap);
ImageView normalImage = (ImageView) findViewById(R.id.image_greyscale);
normalImage.setImageBitmap(outBitmap.copy(outBitmap.getConfig(), false));
ScriptIntrinsicConvolve3x3 scriptC = ScriptIntrinsicConvolve3x3.create(rs, Element.U8_4(rs));
scriptC.setCoefficients(getCoefficients(ConvolutionFilter.SHARPEN));
scriptC.setInput(input);
scriptC.forEach(output);
output.copyTo(outBitmap);
ImageView normalImage = (ImageView) findViewById(R.id.image_sharpen);
normalImage.setImageBitmap(outBitmap.copy(outBitmap.getConfig(), false));
scriptC = ScriptIntrinsicConvolve3x3.create(rs, Element.U8_4(rs));
scriptC.setCoefficients(getCoefficients(ConvolutionFilter.EDGE_DETECT));
scriptC.setInput(input);
scriptC.forEach(output);
output.copyTo(outBitmap);
ImageView normalImage = (ImageView) findViewById(R.id.image_edge);
normalImage.setImageBitmap(outBitmap.copy(outBitmap.getConfig(), false));
scriptC = ScriptIntrinsicConvolve3x3.create(rs, Element.U8_4(rs));
scriptC.setCoefficients(getCoefficients(ConvolutionFilter.EMBOSS));
scriptC.setInput(input);
scriptC.forEach(output);
output.copyTo(outBitmap);
ImageView normalImage = (ImageView) findViewById(R.id.image_emboss);
normalImage.setImageBitmap(outBitmap.copy(outBitmap.getConfig(), false));
rs.destroy();
}
|
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Bitmap inBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.dog);
Bitmap outBitmap = inBitmap.copy(inBitmap.getConfig(), true);
ImageView normalImage = (ImageView) findViewById(R.id.image_normal);
normalImage.setImageBitmap(outBitmap.copy(outBitmap.getConfig(), false));
final RenderScript rs = RenderScript.create(this);
final Allocation input = Allocation.createFromBitmap(rs, inBitmap, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);
final Allocation output = Allocation.createTyped(rs, input.getType());
final ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
script.setRadius(4f);
script.setInput(input);
script.forEach(output);
output.copyTo(outBitmap);
ImageView normalImage = (ImageView) findViewById(R.id.image_blurred);
normalImage.setImageBitmap(outBitmap.copy(outBitmap.getConfig(), false));
final ScriptIntrinsicColorMatrix scriptColor = ScriptIntrinsicColorMatrix.create(rs, Element.U8_4(rs));
scriptColor.setGreyscale();
scriptColor.forEach(input, output);
output.copyTo(outBitmap);
ImageView normalImage = (ImageView) findViewById(R.id.image_greyscale);
normalImage.setImageBitmap(outBitmap.copy(outBitmap.getConfig(), false));
ScriptIntrinsicConvolve3x3 scriptC = ScriptIntrinsicConvolve3x3.create(rs, Element.U8_4(rs));
scriptC.setCoefficients(getCoefficients(ConvolutionFilter.SHARPEN));
scriptC.setInput(input);
scriptC.forEach(output);
output.copyTo(outBitmap);
ImageView normalImage = (ImageView) findViewById(R.id.image_sharpen);
normalImage.setImageBitmap(outBitmap.copy(outBitmap.getConfig(), false));
scriptC = ScriptIntrinsicConvolve3x3.create(rs, Element.U8_4(rs));
scriptC.setCoefficients(getCoefficients(ConvolutionFilter.EDGE_DETECT));
scriptC.setInput(input);
scriptC.forEach(output);
output.copyTo(outBitmap);
ImageView normalImage = (ImageView) findViewById(R.id.image_edge);
normalImage.setImageBitmap(outBitmap.copy(outBitmap.getConfig(), false));
scriptC = ScriptIntrinsicConvolve3x3.create(rs, Element.U8_4(rs));
scriptC.setCoefficients(getCoefficients(ConvolutionFilter.EMBOSS));
scriptC.setInput(input);
scriptC.forEach(output);
output.copyTo(outBitmap);
<DeepExtract>
ImageView normalImage = (ImageView) findViewById(R.id.image_emboss);
normalImage.setImageBitmap(outBitmap.copy(outBitmap.getConfig(), false));
</DeepExtract>
rs.destroy();
}
|
android-recipes-5ed
|
positive
| 440,882
|
@Override
public void start() throws Exception {
conn = DriverManager.getConnection("jdbc:hsqldb:mem:test?shutdown=true");
executeStatement("drop table if exists user;");
executeStatement("drop table if exists user_roles;");
executeStatement("drop table if exists roles_perms;");
executeStatement("create table user (username varchar(255), password varchar(255), password_salt varchar(255) );");
executeStatement("create table user_roles (username varchar(255), role varchar(255));");
executeStatement("create table roles_perms (role varchar(255), perm varchar(255));");
executeStatement("insert into user values ('tim', 'EC0D6302E35B7E792DF9DA4A5FE0DB3B90FCAB65A6215215771BF96D498A01DA8234769E1CE8269A105E9112F374FDAB2158E7DA58CDC1348A732351C38E12A0', 'C59EB438D1E24CACA2B1A48BC129348589D49303863E493FBE906A9158B7D5DC');");
executeStatement("insert into user_roles values ('tim', 'dev');");
executeStatement("insert into user_roles values ('tim', 'admin');");
executeStatement("insert into roles_perms values ('dev', 'commit_code');");
executeStatement("insert into roles_perms values ('dev', 'eat_pizza');");
executeStatement("insert into roles_perms values ('admin', 'merge_pr');");
JDBCClient client = JDBCClient.createShared(vertx, new JsonObject().put("url", "jdbc:hsqldb:mem:test?shutdown=true").put("driver_class", "org.hsqldb.jdbcDriver"));
Router router = Router.router(vertx);
router.route().handler(CookieHandler.create());
router.route().handler(BodyHandler.create());
router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx)));
AuthProvider authProvider = JDBCAuth.create(vertx, client);
router.route().handler(UserSessionHandler.create(authProvider));
router.route("/private/*").handler(RedirectAuthHandler.create(authProvider, "/loginpage.html"));
router.route("/private/*").handler(StaticHandler.create().setCachingEnabled(false).setWebRoot("private"));
router.route("/loginhandler").handler(FormLoginHandler.create(authProvider));
router.route("/logout").handler(context -> {
context.clearUser();
context.response().putHeader("location", "/").setStatusCode(302).end();
});
router.route().handler(StaticHandler.create());
vertx.createHttpServer().requestHandler(router).listen(8080);
}
|
@Override
public void start() throws Exception {
<DeepExtract>
conn = DriverManager.getConnection("jdbc:hsqldb:mem:test?shutdown=true");
executeStatement("drop table if exists user;");
executeStatement("drop table if exists user_roles;");
executeStatement("drop table if exists roles_perms;");
executeStatement("create table user (username varchar(255), password varchar(255), password_salt varchar(255) );");
executeStatement("create table user_roles (username varchar(255), role varchar(255));");
executeStatement("create table roles_perms (role varchar(255), perm varchar(255));");
executeStatement("insert into user values ('tim', 'EC0D6302E35B7E792DF9DA4A5FE0DB3B90FCAB65A6215215771BF96D498A01DA8234769E1CE8269A105E9112F374FDAB2158E7DA58CDC1348A732351C38E12A0', 'C59EB438D1E24CACA2B1A48BC129348589D49303863E493FBE906A9158B7D5DC');");
executeStatement("insert into user_roles values ('tim', 'dev');");
executeStatement("insert into user_roles values ('tim', 'admin');");
executeStatement("insert into roles_perms values ('dev', 'commit_code');");
executeStatement("insert into roles_perms values ('dev', 'eat_pizza');");
executeStatement("insert into roles_perms values ('admin', 'merge_pr');");
</DeepExtract>
JDBCClient client = JDBCClient.createShared(vertx, new JsonObject().put("url", "jdbc:hsqldb:mem:test?shutdown=true").put("driver_class", "org.hsqldb.jdbcDriver"));
Router router = Router.router(vertx);
router.route().handler(CookieHandler.create());
router.route().handler(BodyHandler.create());
router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx)));
AuthProvider authProvider = JDBCAuth.create(vertx, client);
router.route().handler(UserSessionHandler.create(authProvider));
router.route("/private/*").handler(RedirectAuthHandler.create(authProvider, "/loginpage.html"));
router.route("/private/*").handler(StaticHandler.create().setCachingEnabled(false).setWebRoot("private"));
router.route("/loginhandler").handler(FormLoginHandler.create(authProvider));
router.route("/logout").handler(context -> {
context.clearUser();
context.response().putHeader("location", "/").setStatusCode(302).end();
});
router.route().handler(StaticHandler.create());
vertx.createHttpServer().requestHandler(router).listen(8080);
}
|
vertx-examples
|
positive
| 440,883
|
public Criteria andScopeBetween(String value1, String value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "scope" + " cannot be null");
}
criteria.add(new Criterion("scope between", value1, value2));
return (Criteria) this;
}
|
public Criteria andScopeBetween(String value1, String value2) {
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "scope" + " cannot be null");
}
criteria.add(new Criterion("scope between", value1, value2));
</DeepExtract>
return (Criteria) this;
}
|
oauth4j
|
positive
| 440,884
|
@Override
protected void run() throws Exception {
Timer timer = new Timer();
int readTime = 0, remapTime = 0, writeTime = 0;
int readTime = 0, remapTime = 0, writeTime = 0;
int readTime = 0, remapTime = 0, writeTime = 0;
System.out.println("Loading MCP configuration");
String mcVer = MappingLoader_MCP.getMCVer(mcpDir);
MappingFactory.registerMCPInstance(mcVer, side, mcpDir, null);
int rv = (int) (System.currentTimeMillis() - start);
start = System.currentTimeMillis();
return rv;
MinecraftNameSet inputNS = new MinecraftNameSet(fromType, side, mcVer);
MinecraftNameSet outputNS = new MinecraftNameSet(toType, side, mcVer);
List<ReferenceDataCollection> refs = new ArrayList<>();
for (RefOption ro : refOptsParsed) {
MinecraftNameSet refNS = new MinecraftNameSet(ro.type, side, mcVer);
System.out.println("Loading " + ro.file);
ClassCollection refCC = ClassCollectionFactory.loadClassCollection(refNS, ro.file, null);
readTime += timer.flip();
if (!refNS.equals(inputNS)) {
System.out.println("Remapping " + ro.file + " (" + refNS + " -> " + inputNS + ")");
refCC = Remapper.remap(refCC, MappingFactory.getMapping((MinecraftNameSet) refCC.getNameSet(), inputNS, null), Collections.<ReferenceDataCollection>emptyList(), null);
remapTime += timer.flip();
}
refs.add(ReferenceDataCollection.fromClassCollection(refCC));
}
System.out.println("Loading " + inFile);
ClassCollection inputCC = ClassCollectionFactory.loadClassCollection(inputNS, inFile, null);
int rv = (int) (System.currentTimeMillis() - start);
start = System.currentTimeMillis();
return rv;
System.out.println("Remapping " + inFile + " (" + inputNS + " -> " + outputNS + ")");
ClassCollection outputCC = Remapper.remap(inputCC, MappingFactory.getMapping((MinecraftNameSet) inputCC.getNameSet(), outputNS, null), refs, null);
int rv = (int) (System.currentTimeMillis() - start);
start = System.currentTimeMillis();
return rv;
System.out.println("Writing " + outFile);
JarWriter.write(outFile, outputCC, null);
int rv = (int) (System.currentTimeMillis() - start);
start = System.currentTimeMillis();
return rv;
System.out.printf("Completed in %d ms\n", readTime + remapTime + writeTime);
}
|
@Override
protected void run() throws Exception {
Timer timer = new Timer();
int readTime = 0, remapTime = 0, writeTime = 0;
int readTime = 0, remapTime = 0, writeTime = 0;
int readTime = 0, remapTime = 0, writeTime = 0;
System.out.println("Loading MCP configuration");
String mcVer = MappingLoader_MCP.getMCVer(mcpDir);
MappingFactory.registerMCPInstance(mcVer, side, mcpDir, null);
<DeepExtract>
int rv = (int) (System.currentTimeMillis() - start);
start = System.currentTimeMillis();
return rv;
</DeepExtract>
MinecraftNameSet inputNS = new MinecraftNameSet(fromType, side, mcVer);
MinecraftNameSet outputNS = new MinecraftNameSet(toType, side, mcVer);
List<ReferenceDataCollection> refs = new ArrayList<>();
for (RefOption ro : refOptsParsed) {
MinecraftNameSet refNS = new MinecraftNameSet(ro.type, side, mcVer);
System.out.println("Loading " + ro.file);
ClassCollection refCC = ClassCollectionFactory.loadClassCollection(refNS, ro.file, null);
readTime += timer.flip();
if (!refNS.equals(inputNS)) {
System.out.println("Remapping " + ro.file + " (" + refNS + " -> " + inputNS + ")");
refCC = Remapper.remap(refCC, MappingFactory.getMapping((MinecraftNameSet) refCC.getNameSet(), inputNS, null), Collections.<ReferenceDataCollection>emptyList(), null);
remapTime += timer.flip();
}
refs.add(ReferenceDataCollection.fromClassCollection(refCC));
}
System.out.println("Loading " + inFile);
ClassCollection inputCC = ClassCollectionFactory.loadClassCollection(inputNS, inFile, null);
<DeepExtract>
int rv = (int) (System.currentTimeMillis() - start);
start = System.currentTimeMillis();
return rv;
</DeepExtract>
System.out.println("Remapping " + inFile + " (" + inputNS + " -> " + outputNS + ")");
ClassCollection outputCC = Remapper.remap(inputCC, MappingFactory.getMapping((MinecraftNameSet) inputCC.getNameSet(), outputNS, null), refs, null);
<DeepExtract>
int rv = (int) (System.currentTimeMillis() - start);
start = System.currentTimeMillis();
return rv;
</DeepExtract>
System.out.println("Writing " + outFile);
JarWriter.write(outFile, outputCC, null);
<DeepExtract>
int rv = (int) (System.currentTimeMillis() - start);
start = System.currentTimeMillis();
return rv;
</DeepExtract>
System.out.printf("Completed in %d ms\n", readTime + remapTime + writeTime);
}
|
bearded-octo-nemesis
|
positive
| 440,885
|
@DebugSetter(ID = "paddingRight", creator = IntegerSpinnerCreator.class)
public CoordSysRenderer setPaddingRight(int padding) {
this.paddingRight = padding;
this.isDirty = true;
return this;
}
|
@DebugSetter(ID = "paddingRight", creator = IntegerSpinnerCreator.class)
public CoordSysRenderer setPaddingRight(int padding) {
this.paddingRight = padding;
<DeepExtract>
this.isDirty = true;
</DeepExtract>
return this;
}
|
JPlotter
|
positive
| 440,886
|
public Map.Entry<K, V> next() {
if (modCount != expectedModCount)
throw new ConcurrentModificationException();
if (nextKey == null && !hasNext())
throw new NoSuchElementException();
lastReturned = entry;
entry = entry.next;
currentKey = nextKey;
nextKey = null;
return lastReturned;
}
|
public Map.Entry<K, V> next() {
<DeepExtract>
if (modCount != expectedModCount)
throw new ConcurrentModificationException();
if (nextKey == null && !hasNext())
throw new NoSuchElementException();
lastReturned = entry;
entry = entry.next;
currentKey = nextKey;
nextKey = null;
return lastReturned;
</DeepExtract>
}
|
xmltool
|
positive
| 440,887
|
@Override
public List<TDBulkImportSession> listBulkImportSessions() {
requireNonNull(buildUrl("/v3/bulk_import/list"), "path is null");
requireNonNull(new TypeReference<List<TDBulkImportSession>>() {
}, "resultTypeClass is null");
TDApiRequest request = TDApiRequest.Builder.GET(buildUrl("/v3/bulk_import/list")).build();
return httpClient.call(request, apiKeyCache, new TypeReference<List<TDBulkImportSession>>() {
});
}
|
@Override
public List<TDBulkImportSession> listBulkImportSessions() {
<DeepExtract>
requireNonNull(buildUrl("/v3/bulk_import/list"), "path is null");
requireNonNull(new TypeReference<List<TDBulkImportSession>>() {
}, "resultTypeClass is null");
TDApiRequest request = TDApiRequest.Builder.GET(buildUrl("/v3/bulk_import/list")).build();
return httpClient.call(request, apiKeyCache, new TypeReference<List<TDBulkImportSession>>() {
});
</DeepExtract>
}
|
td-client-java
|
positive
| 440,888
|
@Override
public void componentSelected(ButtonEvent ce) {
if (validateFields()) {
doUnblockIP(Utils.safeString(ipaddress.getValue()));
}
}
|
@Override
public void componentSelected(ButtonEvent ce) {
<DeepExtract>
if (validateFields()) {
doUnblockIP(Utils.safeString(ipaddress.getValue()));
}
</DeepExtract>
}
|
webpasswordsafe
|
positive
| 440,889
|
@Override
public void setRole(Participant.Role role) throws ConnectionException, NoPermissionException {
if (!(getChat() instanceof GroupChat))
throw new NoPermissionException();
Endpoints.MODIFY_MEMBER_URL.open(getClient(), getChat().getIdentity(), getId()).on(400, (connection) -> {
throw new NoPermissionException();
}).expect(200, "While updating role").put(new JsonObject().add("role", role.name().toLowerCase()));
this.role = role;
}
|
@Override
public void setRole(Participant.Role role) throws ConnectionException, NoPermissionException {
if (!(getChat() instanceof GroupChat))
throw new NoPermissionException();
Endpoints.MODIFY_MEMBER_URL.open(getClient(), getChat().getIdentity(), getId()).on(400, (connection) -> {
throw new NoPermissionException();
}).expect(200, "While updating role").put(new JsonObject().add("role", role.name().toLowerCase()));
<DeepExtract>
this.role = role;
</DeepExtract>
}
|
Skype4J
|
positive
| 440,890
|
@Test
void shouldCreateForceIpV6() {
List<String> command = YoutubeDlCommandBuilder.newInstance().forceIpV6().buildAsList();
assertThat(command).hasSize(2);
assertThat(command).contains("--force-ipv6", atIndex(1));
}
|
@Test
void shouldCreateForceIpV6() {
List<String> command = YoutubeDlCommandBuilder.newInstance().forceIpV6().buildAsList();
<DeepExtract>
assertThat(command).hasSize(2);
assertThat(command).contains("--force-ipv6", atIndex(1));
</DeepExtract>
}
|
vdl
|
positive
| 440,892
|
public void stateChanged(javax.swing.event.ChangeEvent evt) {
JSlider slider = (JSlider) evt.getSource();
if (Math.abs(slider.getValue() - prevValue) >= smallChange) {
prevValue = slider.getValue();
this.firePropertyChange(VALUE_CHANGED, null, slider.getValue());
}
}
|
public void stateChanged(javax.swing.event.ChangeEvent evt) {
<DeepExtract>
JSlider slider = (JSlider) evt.getSource();
if (Math.abs(slider.getValue() - prevValue) >= smallChange) {
prevValue = slider.getValue();
this.firePropertyChange(VALUE_CHANGED, null, slider.getValue());
}
</DeepExtract>
}
|
VietOCR3
|
positive
| 440,893
|
public static Routes options(String endpoint) {
return new Routes(HttpMethod.OPTIONS, endpoint);
}
|
public static Routes options(String endpoint) {
<DeepExtract>
return new Routes(HttpMethod.OPTIONS, endpoint);
</DeepExtract>
}
|
glitch
|
positive
| 440,894
|
public SELF copy(AsmrNode<?> newParent) {
SELF copy = newInstance(newParent);
int length = this.children().size();
for (int i = 0; i < length; i++) {
copyFieldFrom(getThis(), i);
}
return copy;
}
|
public SELF copy(AsmrNode<?> newParent) {
SELF copy = newInstance(newParent);
<DeepExtract>
int length = this.children().size();
for (int i = 0; i < length; i++) {
copyFieldFrom(getThis(), i);
}
</DeepExtract>
return copy;
}
|
asmr-processor-prototype
|
positive
| 440,895
|
public static String white(String value) {
if (Constant.devMode) {
return String.valueOf(Ansi.ansi().eraseScreen().render("@|" + "white" + " " + value + "|@"));
} else {
return value;
}
}
|
public static String white(String value) {
<DeepExtract>
if (Constant.devMode) {
return String.valueOf(Ansi.ansi().eraseScreen().render("@|" + "white" + " " + value + "|@"));
} else {
return value;
}
</DeepExtract>
}
|
ICERest
|
positive
| 440,897
|
private int jjMoveStringLiteralDfa12_0(long old0, long active0) {
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(10, old0);
try {
curChar = input_stream.readChar();
} catch (java.io.IOException e) {
jjStopStringLiteralDfa_0(11, active0);
return 12;
}
switch(curChar) {
case 51:
return jjMoveStringLiteralDfa13_0(active0, 0x8000000000000L);
case 59:
if ((active0 & 0x4000000000000L) != 0L)
return jjStopAtPos(12, 50);
break;
default:
break;
}
return jjMoveNfa_0(jjStopStringLiteralDfa_0(11, active0), 11 + 1);
}
|
private int jjMoveStringLiteralDfa12_0(long old0, long active0) {
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(10, old0);
try {
curChar = input_stream.readChar();
} catch (java.io.IOException e) {
jjStopStringLiteralDfa_0(11, active0);
return 12;
}
switch(curChar) {
case 51:
return jjMoveStringLiteralDfa13_0(active0, 0x8000000000000L);
case 59:
if ((active0 & 0x4000000000000L) != 0L)
return jjStopAtPos(12, 50);
break;
default:
break;
}
<DeepExtract>
return jjMoveNfa_0(jjStopStringLiteralDfa_0(11, active0), 11 + 1);
</DeepExtract>
}
|
BuildingSMARTLibrary
|
positive
| 440,900
|
public static byte[] decryptHexString3DES(String data, byte[] key) {
return desTemplate(ConvertUtils.hexString2Bytes(data), key, TripleDES_Algorithm, TripleDES_Transformation, false);
}
|
public static byte[] decryptHexString3DES(String data, byte[] key) {
<DeepExtract>
return desTemplate(ConvertUtils.hexString2Bytes(data), key, TripleDES_Algorithm, TripleDES_Transformation, false);
</DeepExtract>
}
|
JianshuApp
|
positive
| 440,901
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.