id int64 1 49k | buggy stringlengths 34 37.5k | fixed stringlengths 2 37k |
|---|---|---|
7,001 | serialize(task);
}
@Test
public void shouldSerializeWithLocalReference() throws Exception {
String local = instanceField;
<BUG>Task<String> task = Task.ofType(String.class).named("WithLocalRef")
.process(() -> local + " won't cause an outer reference");</BUG>
serialize(task);
Task<String> des = deserialize();
context.evaluate(des).consume(val);
| Task<String> task = Task.named("WithLocalRef").ofType(String.class)
.process(() -> local + " won't cause an outer reference");
|
7,002 | }
@RootTask
public static Task<String> standardArgs(int first, String second) {
firstInt = first;
secondString = second;
<BUG>return Task.ofType(String.class).named("StandardArgs", first, second)
.process(() -> second + " " + first * 100);</BUG>
}
@Test
public void shouldParseFlags() throws Exception {
| return Task.named("StandardArgs", first, second).ofType(String.class)
.process(() -> second + " " + first * 100);
|
7,003 | assertThat(parsedEnum, is(CustomEnum.BAR));
}
@RootTask
public static Task<String> enums(CustomEnum enm) {
parsedEnum = enm;
<BUG>return Task.ofType(String.class).named("Enums", enm)
.process(enm::toString);</BUG>
}
@Test
public void shouldParseCustomTypes() throws Exception {
| return Task.named("Enums", enm).ofType(String.class)
.process(enm::toString);
|
7,004 | assertThat(parsedType.content, is("blarg parsed for you!"));
}
@RootTask
public static Task<String> customType(CustomType myType) {
parsedType = myType;
<BUG>return Task.ofType(String.class).named("Types", myType.content)
.process(() -> myType.content);</BUG>
}
public enum CustomEnum {
BAR
| return Task.named("Types", myType.content).ofType(String.class)
.process(() -> myType.content);
|
7,005 | TaskContext taskContext = TaskContext.inmem();
TaskContext.Value<Long> value = taskContext.evaluate(fib92);
value.consume(f92 -> System.out.println("fib(92) = " + f92));
}
static Task<Long> create(long n) {
<BUG>TaskBuilder<Long> fib = Task.ofType(Long.class).named("Fib", n);
</BUG>
if (n < 2) {
return fib
.process(() -> n);
| TaskBuilder<Long> fib = Task.named("Fib", n).ofType(Long.class);
|
7,006 | if (i != 0) toInsert += ", ";
toInsert += parameter.getType().getCanonicalText();
}
toInsert += ")";
}
<BUG>else if (targetElement == null ||
PsiTreeUtil.getNonStrictParentOfType(elementAtCaret, PsiLiteralExpression.class, PsiComment.class) != null ||
</BUG>
PsiTreeUtil.getNonStrictParentOfType(elementAtCaret, PsiJavaFile.class) == null) {
toInsert = fqn;
| else if (PsiTreeUtil.getNonStrictParentOfType(elementAtCaret, PsiLiteralExpression.class, PsiComment.class) != null ||
|
7,007 | ? (PsiReferenceExpression)expression
: null;
if (referenceExpression == null) {
toInsert = fqn;
}
<BUG>else if (referenceExpression.advancedResolve(true).getElement() != targetElement) {
try {</BUG>
referenceExpression.bindToElement(targetElement);
}
catch (IncorrectOperationException e) {
| else if (!isReferencedTo(referenceExpression, targetElement)) {
try {
|
7,008 | ve.verifyVEToolBarPresent();
ve.verifyEditorSurfacePresent();
ve.typeTextInAllFormat(text);
ve.typeTextInAllStyle(text);
ve.typeTextInAllList(text);
<BUG>ve.clickPublishButton();
ArticlePageObject article = new ArticlePageObject();
</BUG>
article.verifyVEPublishComplete();
article.verifyContent("Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
| VisualEditorSaveChangesDialog saveDialog = ve.clickPublishButton();
VisualEditorReviewChangesDialog reviewDialog = saveDialog.clickReviewYourChanges();
reviewDialog.verifyAddedDiffs(wikiTexts);
saveDialog = reviewDialog.clickReturnToSaveFormButton();
ArticlePageObject article = saveDialog.savePage();
|
7,009 | veLinkDialog.typeInLinkInput(PageContent.EXTERNAL_LINK);
veLinkDialog.verifyExternalLinkIsTop();
veLinkDialog.clickLinkResult();
ve = veLinkDialog.clickDoneButton();
ve.typeReturn();
<BUG>ve.clickPublishButton();
ArticlePageObject article = new ArticlePageObject();
</BUG>
article.verifyVEPublishComplete();
article.verifyElementInContent(By.cssSelector("a[href*='" + PageContent.INTERNAL_LINK + "']"));
| VisualEditorSaveChangesDialog saveDialog = ve.clickPublishButton();
VisualEditorReviewChangesDialog reviewDialog = saveDialog.clickReviewYourChanges();
reviewDialog.verifyAddedDiffs(linkWikiTexts);
saveDialog = reviewDialog.clickReturnToSaveFormButton();
ArticlePageObject article = saveDialog.savePage();
|
7,010 | showSelectiontJS =
"ve.init.target.getSurface().getModel().change(" +
"null, new ve.dm.LinearSelection(" +
"ve.init.target.getSurface().getModel().getDocument(),new ve.Range(" +
from + "," + to + " )));";
<BUG>((JavascriptExecutor) driver).executeScript(showSelectiontJS);
}</BUG>
public void selectText(String text) {
wait.forElementVisible(editArea);
String textDump = editArea.getText();
| driver.executeScript(showSelectiontJS);
}
|
7,011 | public static boolean debugMode = false;
@ModConfigProperty(category = "Debug", name = "debugModeGOTG", comment = "Enable/Disable Debug Mode for the Gift Of The Gods")
public static boolean debugModeGOTG = false;
@ModConfigProperty(category = "Debug", name = "debugModeEnchantments", comment = "Enable/Disable Debug Mode for the Enchantments")
public static boolean debugModeEnchantments = false;
<BUG>@ModConfigProperty(category = "Weapons", name = "enableSwordsRecipes", comment = "Enable/Disable The ArmorPlus Sword's Recipes")
public static boolean enableSwordsRecipes = true;
@ModConfigProperty(category = "Weapons", name = "enableBattleAxesRecipes", comment = "Enable/Disable The ArmorPlus Battle Axes's Recipes")
public static boolean enableBattleAxesRecipes = true;
@ModConfigProperty(category = "Weapons", name = "enableBowsRecipes", comment = "Enable/Disable The ArmorPlus Bows's Recipes")
public static boolean enableBowsRecipes = true;
@ModConfigProperty(category = "Armors.SuperStarArmor.Effects", name = "enableSuperStarHRegen", comment = "Enable/Disable The Super Star Helmet Regeneration")
</BUG>
public static boolean enableSuperStarHRegen = true;
| @ModConfigProperty(category = "Weapons", name = "enableSwordsRecipes", comment = "Enable/Disable ArmorPlus Sword's Recipes")
@ModConfigProperty(category = "Weapons", name = "enableBattleAxesRecipes", comment = "Enable/Disable ArmorPlus Battle Axes's Recipes")
@ModConfigProperty(category = "Weapons", name = "enableBowsRecipes", comment = "Enable/Disable ArmorPlus Bows's Recipes")
|
7,012 | import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.DigestOutputStream;
import java.security.MessageDigest;
<BUG>import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;</BUG>
public final class PatchUtils {
| import java.text.DateFormat;
import java.util.Date;
import java.util.List;
|
7,013 | package org.jboss.as.patching.runner;
<BUG>import org.jboss.as.boot.DirectoryStructure;
import org.jboss.as.patching.LocalPatchInfo;</BUG>
import org.jboss.as.patching.PatchInfo;
import org.jboss.as.patching.PatchLogger;
import org.jboss.as.patching.PatchMessages;
| import static org.jboss.as.patching.runner.PatchUtils.generateTimestamp;
import org.jboss.as.patching.CommonAttributes;
import org.jboss.as.patching.LocalPatchInfo;
|
7,014 | private static final String PATH_DELIMITER = "/";
public static final byte[] NO_CONTENT = PatchingTask.NO_CONTENT;
enum Element {
ADDED_BUNDLE("added-bundle"),
ADDED_MISC_CONTENT("added-misc-content"),
<BUG>ADDED_MODULE("added-module"),
BUNDLES("bundles"),</BUG>
CUMULATIVE("cumulative"),
DESCRIPTION("description"),
MISC_FILES("misc-files"),
| APPLIES_TO_VERSION("applies-to-version"),
BUNDLES("bundles"),
|
7,015 | final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
<BUG>case APPLIES_TO_VERSION:
builder.addAppliesTo(value);
break;</BUG>
case RESULTING_VERSION:
if(type == Patch.PatchType.CUMULATIVE) {
| [DELETED] |
7,016 | final StringBuilder path = new StringBuilder();
for(final String p : item.getPath()) {
path.append(p).append(PATH_DELIMITER);
}
path.append(item.getName());
<BUG>writer.writeAttribute(Attribute.PATH.name, path.toString());
if(type != ModificationType.REMOVE) {</BUG>
writer.writeAttribute(Attribute.HASH.name, bytesToHexString(item.getContentHash()));
}
if(type != ModificationType.ADD) {
| if (item.isDirectory()) {
writer.writeAttribute(Attribute.DIRECTORY.name, "true");
if(type != ModificationType.REMOVE) {
|
7,017 | package org.jboss.as.patching;
import org.jboss.as.controller.OperationFailedException;
import org.jboss.as.patching.runner.PatchingException;
import org.jboss.logging.Messages;
import org.jboss.logging.annotations.Message;
<BUG>import org.jboss.logging.annotations.MessageBundle;
import java.io.IOException;</BUG>
import java.util.List;
@MessageBundle(projectCode = "JBAS")
public interface PatchMessages {
| import org.jboss.logging.annotations.Cause;
import java.io.IOException;
|
7,018 | package org.apache.maven.plugin.ant;
import java.io.File;
<BUG>import java.io.StringWriter;
import org.apache.maven.embedder.MavenEmbedder;</BUG>
import org.apache.maven.embedder.MavenEmbedderConsoleLogger;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.PlexusTestCase;
| import java.util.Map;
import org.apache.maven.embedder.MavenEmbedder;
|
7,019 | this.buf = buf;
this.host = host;
}
public void sendPing()
{
<BUG>new Thread()
{
public void run()
{</BUG>
try
| [DELETED] |
7,020 | private static final Random r = new Random( System.currentTimeMillis() );
private long sessionId = -1;
private void sendUdpPingStarted()
{
sessionId = r.nextLong();
<BUG>sendUdpPing( NEO_STARTED, sessionId );
timer.schedule( new TimerTask()</BUG>
{
@Override
public void run()
| final ByteBuffer buf = setupUdpPing( NEO_STARTED, sessionId );
timer.schedule( new TimerTask()
|
7,021 | timer.schedule( new TimerTask()</BUG>
{
@Override
public void run()
{
<BUG>sendUdpPingRunning();
}
}, UDP_PING_DELAY );
}
private void sendUdpPingRunning()
{
sendUdpPing( NEO_RUNNING, 3 );</BUG>
timer.schedule( new TimerTask()
| private static final Random r = new Random( System.currentTimeMillis() );
private long sessionId = -1;
private void sendUdpPingStarted()
sessionId = r.nextLong();
final ByteBuffer buf = setupUdpPing( NEO_STARTED, sessionId );
|
7,022 | buf.putLong( xaDs.getNumberOfIdsInUse( Node.class ) );
buf.putLong( xaDs.getNumberOfIdsInUse( Relationship.class ) );
buf.putLong( xaDs.getNumberOfIdsInUse( PropertyStore.class ) );
buf.putLong( xaDs.getNumberOfIdsInUse( RelationshipType.class ) );
buf.putLong( xaDs.getNumberOfIdsInUse( PropertyIndex.class ) );
<BUG>buf.flip();
SocketAddress host = new InetSocketAddress( UDP_HOST, UDP_PORT );
new UdpPinger( buf, host ).sendPing();</BUG>
}
private void cleanWriteLocksInLuceneDirectory( String luceneDir )
| return buf;
|
7,023 | public static final String DELETE_ACTION_HISTORY_RESULT;
public static final String DELETE_ACTION_PLUGIN;
public static final String DELETE_ALERT;
public static final String DELETE_ALERT_CTIME;
public static final String DELETE_ALERT_LIFECYCLE;
<BUG>public static final String DELETE_ALERT_SEVERITY;
public static final String DELETE_ALERT_STATUS;</BUG>
public static final String DELETE_ALERT_TRIGGER;
public static final String DELETE_CONDITIONS;
public static final String DELETE_CONDITIONS_MODE;
| [DELETED] |
7,024 | public static final String INSERT_ACTION_PLUGIN;
public static final String INSERT_ACTION_PLUGIN_DEFAULT_PROPERTIES;
public static final String INSERT_ALERT;
public static final String INSERT_ALERT_CTIME;
public static final String INSERT_ALERT_LIFECYCLE;
<BUG>public static final String INSERT_ALERT_SEVERITY;
public static final String INSERT_ALERT_STATUS;</BUG>
public static final String INSERT_ALERT_TRIGGER;
public static final String INSERT_CONDITION_AVAILABILITY;
public static final String INSERT_CONDITION_COMPARE;
| [DELETED] |
7,025 | public static final String SELECT_ALERT_CTIME_START;
public static final String SELECT_ALERT_CTIME_START_END;
public static final String SELECT_ALERT_LIFECYCLE_END;
public static final String SELECT_ALERT_LIFECYCLE_START;
public static final String SELECT_ALERT_LIFECYCLE_START_END;
<BUG>public static final String SELECT_ALERT_STATUS;
public static final String SELECT_ALERT_SEVERITY;</BUG>
public static final String SELECT_ALERT_TRIGGER;
public static final String SELECT_ALERTS_BY_TENANT;
public static final String SELECT_CONDITION_ID;
| [DELETED] |
7,026 | DELETE_ALERT = "DELETE FROM " + keyspace + ".alerts " + "WHERE tenantId = ? AND alertId = ? ";
DELETE_ALERT_CTIME = "DELETE FROM " + keyspace + ".alerts_ctimes "
+ "WHERE tenantId = ? AND ctime = ? AND alertId = ? ";
DELETE_ALERT_LIFECYCLE = "DELETE FROM " + keyspace + ".alerts_lifecycle "
+ "WHERE tenantId = ? AND status = ? AND stime = ? AND alertId = ? ";
<BUG>DELETE_ALERT_SEVERITY = "DELETE FROM " + keyspace + ".alerts_severities "
+ "WHERE tenantId = ? AND severity = ? AND alertId = ? ";
DELETE_ALERT_STATUS = "DELETE FROM " + keyspace + ".alerts_statuses "
+ "WHERE tenantId = ? AND status = ? AND alertId = ? ";</BUG>
DELETE_ALERT_TRIGGER = "DELETE FROM " + keyspace + ".alerts_triggers "
| [DELETED] |
7,027 | INSERT_ALERT = "INSERT INTO " + keyspace + ".alerts " + "(tenantId, alertId, payload) VALUES (?, ?, ?) ";
INSERT_ALERT_CTIME = "INSERT INTO " + keyspace + ".alerts_ctimes "
+ "(tenantId, alertId, ctime) VALUES (?, ?, ?) ";
INSERT_ALERT_LIFECYCLE = "INSERT INTO " + keyspace + ".alerts_lifecycle "
+ "(tenantId, alertId, status, stime) VALUES (?, ?, ?, ?) ";
<BUG>INSERT_ALERT_SEVERITY = "INSERT INTO " + keyspace + ".alerts_severities "
+ "(tenantId, alertId, severity) VALUES (?, ?, ?) ";
INSERT_ALERT_STATUS = "INSERT INTO " + keyspace + ".alerts_statuses "
+ "(tenantId, alertId, status) VALUES (?, ?, ?) ";</BUG>
INSERT_ALERT_TRIGGER = "INSERT INTO " + keyspace + ".alerts_triggers "
| [DELETED] |
7,028 | + "WHERE tenantId = ? AND status = ? AND stime <= ? ";
SELECT_ALERT_LIFECYCLE_START = "SELECT alertId FROM " + keyspace + ".alerts_lifecycle "
+ "WHERE tenantId = ? AND status = ? AND stime >= ? ";
SELECT_ALERT_LIFECYCLE_START_END = "SELECT alertId FROM " + keyspace + ".alerts_lifecycle "
+ "WHERE tenantId = ? AND status = ? AND stime >= ? AND stime <= ? ";
<BUG>SELECT_ALERT_SEVERITY = "SELECT alertId FROM " + keyspace + ".alerts_severities "
+ "WHERE tenantId = ? AND severity = ? ";
SELECT_ALERT_STATUS = "SELECT alertId FROM " + keyspace + ".alerts_statuses "
+ "WHERE tenantId = ? AND status = ? ";</BUG>
SELECT_ALERTS_BY_TENANT = "SELECT payload FROM " + keyspace + ".alerts " + "WHERE tenantId = ? ";
| [DELETED] |
7,029 | import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
<BUG>import java.util.stream.Collectors;
import javax.ejb.EJB;</BUG>
import javax.ejb.Local;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
| import javax.annotation.PostConstruct;
import javax.ejb.EJB;
|
7,030 | import org.hawkular.alerts.api.model.trigger.Trigger;
import org.hawkular.alerts.api.services.ActionsService;
import org.hawkular.alerts.api.services.AlertsCriteria;
import org.hawkular.alerts.api.services.AlertsService;
import org.hawkular.alerts.api.services.DefinitionsService;
<BUG>import org.hawkular.alerts.api.services.EventsCriteria;
import org.hawkular.alerts.engine.impl.IncomingDataManagerImpl.IncomingData;</BUG>
import org.hawkular.alerts.engine.impl.IncomingDataManagerImpl.IncomingEvents;
import org.hawkular.alerts.engine.log.MsgLogger;
import org.hawkular.alerts.engine.service.AlertsEngine;
| import org.hawkular.alerts.api.services.PropertiesService;
import org.hawkular.alerts.engine.impl.IncomingDataManagerImpl.IncomingData;
|
7,031 | import com.datastax.driver.core.Session;
import com.google.common.util.concurrent.Futures;
@Local(AlertsService.class)
@Stateless
@TransactionAttribute(value = TransactionAttributeType.NOT_SUPPORTED)
<BUG>public class CassAlertsServiceImpl implements AlertsService {
private final MsgLogger msgLog = MsgLogger.LOGGER;
private final Logger log = Logger.getLogger(CassAlertsServiceImpl.class);
@EJB</BUG>
AlertsEngine alertsEngine;
| private static final String CRITERIA_NO_QUERY_SIZE = "hawkular-alerts.criteria-no-query-size";
private static final String CRITERIA_NO_QUERY_SIZE_ENV = "CRITERIA_NO_QUERY_SIZE";
private static final String CRITERIA_NO_QUERY_SIZE_DEFAULT = "200";
private int criteriaNoQuerySize;
|
7,032 | log.debug("Adding " + alerts.size() + " alerts");
}
PreparedStatement insertAlert = CassStatement.get(session, CassStatement.INSERT_ALERT);
PreparedStatement insertAlertTrigger = CassStatement.get(session, CassStatement.INSERT_ALERT_TRIGGER);
PreparedStatement insertAlertCtime = CassStatement.get(session, CassStatement.INSERT_ALERT_CTIME);
<BUG>PreparedStatement insertAlertStatus = CassStatement.get(session, CassStatement.INSERT_ALERT_STATUS);
PreparedStatement insertAlertSeverity = CassStatement.get(session, CassStatement.INSERT_ALERT_SEVERITY);</BUG>
PreparedStatement insertTag = CassStatement.get(session, CassStatement.INSERT_TAG);
try {
List<ResultSetFuture> futures = new ArrayList<>();
| [DELETED] |
7,033 | futures.add(session.executeAsync(insertAlertTrigger.bind(a.getTenantId(),
a.getAlertId(),
a.getTriggerId())));
futures.add(session.executeAsync(insertAlertCtime.bind(a.getTenantId(),
a.getAlertId(), a.getCtime())));
<BUG>futures.add(session.executeAsync(insertAlertStatus.bind(a.getTenantId(),
a.getAlertId(),
a.getStatus().name())));
futures.add(session.executeAsync(insertAlertSeverity.bind(a.getTenantId(),
a.getAlertId(),
a.getSeverity().name())));</BUG>
a.getTags().entrySet().stream().forEach(tag -> {
| [DELETED] |
7,034 | for (Row row : rsAlerts) {
String payload = row.getString("payload");
Alert alert = JsonUtil.fromJson(payload, Alert.class, thin);
alerts.add(alert);
}
<BUG>}
} catch (Exception e) {
msgLog.errorDatabaseException(e.getMessage());
throw e;
}
return preparePage(alerts, pager);</BUG>
}
| [DELETED] |
7,035 | for (Alert a : alertsToDelete) {
String id = a.getAlertId();
List<ResultSetFuture> futures = new ArrayList<>();
futures.add(session.executeAsync(deleteAlert.bind(tenantId, id)));
futures.add(session.executeAsync(deleteAlertCtime.bind(tenantId, a.getCtime(), id)));
<BUG>futures.add(session.executeAsync(deleteAlertSeverity.bind(tenantId, a.getSeverity().name(), id)));
futures.add(session.executeAsync(deleteAlertStatus.bind(tenantId, a.getStatus().name(), id)));</BUG>
futures.add(session.executeAsync(deleteAlertTrigger.bind(tenantId, a.getTriggerId(), id)));
a.getLifecycle().stream().forEach(l -> {
futures.add(
| [DELETED] |
7,036 | private Alert updateAlertStatus(Alert alert) throws Exception {
if (alert == null || alert.getAlertId() == null || alert.getAlertId().isEmpty()) {
throw new IllegalArgumentException("AlertId must be not null");
}
try {
<BUG>PreparedStatement deleteAlertStatus = CassStatement.get(session,
CassStatement.DELETE_ALERT_STATUS);
PreparedStatement insertAlertStatus = CassStatement.get(session,
CassStatement.INSERT_ALERT_STATUS);</BUG>
PreparedStatement insertAlertLifecycle = CassStatement.get(session,
| [DELETED] |
7,037 | PreparedStatement insertAlertLifecycle = CassStatement.get(session,
CassStatement.INSERT_ALERT_LIFECYCLE);
PreparedStatement updateAlert = CassStatement.get(session,
CassStatement.UPDATE_ALERT);
List<ResultSetFuture> futures = new ArrayList<>();
<BUG>for (Status statusToDelete : EnumSet.complementOf(EnumSet.of(alert.getStatus()))) {
futures.add(session.executeAsync(deleteAlertStatus.bind(alert.getTenantId(), statusToDelete.name(),
alert.getAlertId())));
}
futures.add(session.executeAsync(insertAlertStatus.bind(alert.getTenantId(), alert.getAlertId(), alert
.getStatus().name())));</BUG>
Alert.LifeCycle lifecycle = alert.getCurrentLifecycle();
| [DELETED] |
7,038 | String category = null;
Collection<String> categories = null;
String triggerId = null;
Collection<String> triggerIds = null;
Map<String, String> tags = null;
<BUG>boolean thin = false;
public EventsCriteria() {</BUG>
super();
}
public Long getStartTime() {
| Integer criteriaNoQuerySize = null;
public EventsCriteria() {
|
7,039 | }
@Override
public String toString() {
return "EventsCriteria [startTime=" + startTime + ", endTime=" + endTime + ", eventId=" + eventId
+ ", eventIds=" + eventIds + ", category=" + category + ", categories=" + categories + ", triggerId="
<BUG>+ triggerId + ", triggerIds=" + triggerIds + ", tags=" + tags + ", thin=" + thin + "]";
}</BUG>
}
| public void addTag(String name, String value) {
if (null == tags) {
tags = new HashMap<>();
|
7,040 | Intent intent = new Intent(ChatActivity.this, LocationActivity.class);
startActivityForResult(intent, PICK_LOCATION);
dismissOption();
}
}
<BUG>private void startListeningToMessages(){
}</BUG>
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEND)
| [DELETED] |
7,041 | return toRet;
}
public List<String> getKeyNames() { return Arrays.asList("TDT"); }
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("TDT", 1, VCFHeaderLineType.Float, "Test statistic from Wittkowski transmission disequilibrium test.")); }
private double calculateTDT( final VariantContext vc, final Set<Sample> triosToTest ) {
<BUG>final double nABGivenABandBB = calculateNChildren(vc, triosToTest, HET, HET, HOM);
final double nBBGivenABandBB = calculateNChildren(vc, triosToTest, HOM, HET, HOM);
</BUG>
final double nAAGivenABandAB = calculateNChildren(vc, triosToTest, REF, HET, HET);
| final double nABGivenABandBB = calculateNChildren(vc, triosToTest, HET, HET, HOM) + calculateNChildren(vc, triosToTest, HET, HOM, HET);
final double nBBGivenABandBB = calculateNChildren(vc, triosToTest, HOM, HET, HOM) + calculateNChildren(vc, triosToTest, HOM, HOM, HET);
|
7,042 |
final double nBBGivenABandBB = calculateNChildren(vc, triosToTest, HOM, HET, HOM);
</BUG>
final double nAAGivenABandAB = calculateNChildren(vc, triosToTest, REF, HET, HET);
final double nBBGivenABandAB = calculateNChildren(vc, triosToTest, HOM, HET, HET);
<BUG>final double nAAGivenAAandAB = calculateNChildren(vc, triosToTest, REF, REF, HET);
final double nABGivenAAandAB = calculateNChildren(vc, triosToTest, HET, REF, HET);
</BUG>
final double numer = (nABGivenABandBB - nBBGivenABandBB) + 2.0 * (nAAGivenABandAB - nBBGivenABandAB) + (nAAGivenAAandAB - nABGivenAAandAB);
| return toRet;
}
public List<String> getKeyNames() { return Arrays.asList("TDT"); }
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("TDT", 1, VCFHeaderLineType.Float, "Test statistic from Wittkowski transmission disequilibrium test.")); }
private double calculateTDT( final VariantContext vc, final Set<Sample> triosToTest ) {
final double nABGivenABandBB = calculateNChildren(vc, triosToTest, HET, HET, HOM) + calculateNChildren(vc, triosToTest, HET, HOM, HET);
final double nBBGivenABandBB = calculateNChildren(vc, triosToTest, HOM, HET, HOM) + calculateNChildren(vc, triosToTest, HOM, HOM, HET);
final double nAAGivenAAandAB = calculateNChildren(vc, triosToTest, REF, REF, HET) + calculateNChildren(vc, triosToTest, REF, HET, REF);
final double nABGivenAAandAB = calculateNChildren(vc, triosToTest, HET, REF, HET) + calculateNChildren(vc, triosToTest, HET, HET, REF);
|
7,043 | } else {
updateMemo();
callback.updateMemo();
}
dismiss();
<BUG>}else{
</BUG>
Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show();
}
}
| [DELETED] |
7,044 | }
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_memo);
<BUG>ChinaPhoneHelper.setStatusBar(this,true);
</BUG>
topicId = getIntent().getLongExtra("topicId", -1);
if (topicId == -1) {
finish();
| ChinaPhoneHelper.setStatusBar(this, true);
|
7,045 | MemoEntry.COLUMN_REF_TOPIC__ID + " = ?"
, new String[]{String.valueOf(topicId)});
}
public Cursor selectMemo(long topicId) {
Cursor c = db.query(MemoEntry.TABLE_NAME, null, MemoEntry.COLUMN_REF_TOPIC__ID + " = ?", new String[]{String.valueOf(topicId)}, null, null,
<BUG>MemoEntry._ID + " DESC", null);
</BUG>
if (c != null) {
c.moveToFirst();
}
| MemoEntry.COLUMN_ORDER + " ASC", null);
|
7,046 | MemoEntry._ID + " = ?",
new String[]{String.valueOf(memoId)});
}
public long updateMemoContent(long memoId, String memoContent) {
ContentValues values = new ContentValues();
<BUG>values.put(MemoEntry.COLUMN_CONTENT, memoContent);
return db.update(</BUG>
MemoEntry.TABLE_NAME,
values,
MemoEntry._ID + " = ?",
| return db.update(
|
7,047 | import android.widget.RelativeLayout;
import android.widget.TextView;
import com.kiminonawa.mydiary.R;
import com.kiminonawa.mydiary.db.DBManager;
import com.kiminonawa.mydiary.shared.EditMode;
<BUG>import com.kiminonawa.mydiary.shared.ThemeManager;
import java.util.List;
public class MemoAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements EditMode {
</BUG>
private List<MemoEntity> memoList;
| import com.marshalchen.ultimaterecyclerview.dragsortadapter.DragSortAdapter;
public class MemoAdapter extends DragSortAdapter<DragSortAdapter.ViewHolder> implements EditMode {
|
7,048 | private DBManager dbManager;
private boolean isEditMode = false;
private EditMemoDialogFragment.MemoCallback callback;
private static final int TYPE_HEADER = 0;
private static final int TYPE_ITEM = 1;
<BUG>public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback) {
this.mActivity = activity;</BUG>
this.topicId = topicId;
this.memoList = memoList;
| public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback, RecyclerView recyclerView) {
super(recyclerView);
this.mActivity = activity;
|
7,049 | this.memoList = memoList;
this.dbManager = dbManager;
this.callback = callback;
}
@Override
<BUG>public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
</BUG>
View view;
if (isEditMode) {
if (viewType == TYPE_HEADER) {
| public DragSortAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
7,050 | editMemoDialogFragment.show(mActivity.getSupportFragmentManager(), "editMemoDialogFragment");
}
});
}
}
<BUG>protected class MemoViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
private View rootView;
private TextView TV_memo_item_content;</BUG>
private ImageView IV_memo_item_delete;
| protected class MemoViewHolder extends DragSortAdapter.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
private ImageView IV_memo_item_dot;
private TextView TV_memo_item_content;
|
7,051 | freenet.support.Logger.OSThread.logPID(this);
if(!goon){
Logger.normal(this, "Goon is false ; killing MemoryChecker");
return;
}
<BUG>Runtime r = Runtime.getRuntime();
Logger.normal(this, "Memory in use: "+SizeUtil.formatSize((r.totalMemory()-r.freeMemory())));
if (r.freeMemory() < 8 * 1024 * 1024) { // free memory < 8 MB
Logger.error(this, "memory too low, trying to free some");</BUG>
OOMHandler.lowMemory();
| [DELETED] |
7,052 | if(logMINOR) Logger.minor(this, "Memory in use before GC: "+beforeGCUsedMemory);
long beforeGCTime = System.currentTimeMillis();
System.gc();
System.runFinalization();
long afterGCTime = System.currentTimeMillis();
<BUG>long afterGCUsedMemory = (r.totalMemory()-r.freeMemory());
</BUG>
if(logMINOR) {
Logger.minor(this, "Memory in use after GC: "+afterGCUsedMemory);
Logger.minor(this, "GC completed after "+(afterGCTime - beforeGCTime)+"ms and \"recovered\" "+(beforeGCUsedMemory - afterGCUsedMemory)+" bytes, leaving "+afterGCUsedMemory+" bytes used");
| long afterGCUsedMemory = (r.totalMemory() - r.freeMemory());
|
7,053 | import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.ContentVisitor;
import org.sleuthkit.datamodel.FileSystem;
import org.sleuthkit.datamodel.Image;
import org.sleuthkit.datamodel.Volume;
<BUG>class ShowDetailActionVisitor extends ContentVisitor.Default<List<? extends Action>> {
private static ShowDetailActionVisitor instance = new ShowDetailActionVisitor();
</BUG>
public static List<Action> getActions(Content c) {
| class ExplorerNodeActionVisitor extends ContentVisitor.Default<List<? extends Action>> {
private static ExplorerNodeActionVisitor instance = new ExplorerNodeActionVisitor();
|
7,054 | });
popUpWindow.pack();
popUpWindow.setResizable(false);
popUpWindow.setVisible(true);
}
<BUG>});
}</BUG>
@Override
public List<? extends Action> visit(final FileSystem fs) {
final String title = "File System Details";
| return lst;
|
7,055 | final String title = "File System Details";
return Collections.singletonList(new AbstractAction(title) {
@Override
public void actionPerformed(ActionEvent e) {
Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
<BUG>Logger.noteAction(ShowDetailActionVisitor.class);
</BUG>
final JFrame frame = new JFrame(title);
final JDialog popUpWindow = new JDialog(frame, title, true); // to make the popUp Window to be modal
popUpWindow.setSize(1000, 500);
| Logger.noteAction(ExplorerNodeActionVisitor.class);
|
7,056 | fsdPanel.setRootInumValue(table.getValueAt(0, 6).toString());
fsdPanel.setFirstInumValue(table.getValueAt(0, 7).toString());
fsdPanel.setLastInumValue(table.getValueAt(0, 8).toString());
popUpWindow.add(fsdPanel);
} catch (Exception ex) {
<BUG>Logger.getLogger(ShowDetailActionVisitor.class.getName()).log(Level.WARNING, "Error setting up File System Details panel.", ex);
</BUG>
}
popUpWindow.pack();
popUpWindow.setResizable(false);
| Logger.getLogger(ExplorerNodeActionVisitor.class.getName()).log(Level.WARNING, "Error setting up File System Details panel.", ex);
|
7,057 | import jetbrains.jetpad.mapper.Synchronizers;
public abstract class PropertyMapperCell<T> extends AbstractJetpadCell {
private WritableModelProperty<T> myModelProperty;
public PropertyMapperCell(EditorContext editorContext, SNode node) {
super(editorContext, node);
<BUG>myModelProperty = new WritableModelProperty<T>(getCellId() + "_" + node.getNodeId().toString(), getContext().getOperationContext().getProject()) {
</BUG>
protected T getModelPropertyValue() {
return getModelPropertyValueImpl();
}
| myModelProperty = new WritableModelProperty<T>(getCellId() + "_" + node.getNodeId().toString(), getContext().getRepository()) {
|
7,058 | safeSetModelPropertyValue(event.getNewValue());
}
});
}
protected void safeSetModelPropertyValue(final T t) {
<BUG>myProject.getModelAccess().executeCommand(new UndoRunnable.Base(null, myCommandId) {
</BUG>
public void run() {
setModelPropertyValue(t);
}
| myRepo.getModelAccess().executeCommand(new UndoRunnable.Base(null, myCommandId) {
|
7,059 | package com.projecttango.examples.java.augmentedreality;
import com.google.atap.tangoservice.Tango;
import com.google.atap.tangoservice.Tango.OnTangoUpdateListener;
import com.google.atap.tangoservice.TangoCameraIntrinsics;
import com.google.atap.tangoservice.TangoConfig;
<BUG>import com.google.atap.tangoservice.TangoCoordinateFramePair;
import com.google.atap.tangoservice.TangoEvent;</BUG>
import com.google.atap.tangoservice.TangoOutOfDateException;
import com.google.atap.tangoservice.TangoPoseData;
import com.google.atap.tangoservice.TangoXyzIjData;
| import com.google.atap.tangoservice.TangoErrorException;
import com.google.atap.tangoservice.TangoEvent;
|
7,060 | super.onResume();
if (!mIsConnected) {
mTango = new Tango(AugmentedRealityActivity.this, new Runnable() {
@Override
public void run() {
<BUG>try {
connectTango();</BUG>
setupRenderer();
mIsConnected = true;
} catch (TangoOutOfDateException e) {
| TangoSupport.initialize();
connectTango();
|
7,061 | if (lastFramePose.statusCode == TangoPoseData.POSE_VALID) {
mRenderer.updateRenderCameraPose(lastFramePose, mExtrinsics);
mCameraPoseTimestamp = lastFramePose.timestamp;</BUG>
} else {
<BUG>Log.w(TAG, "Can't get device pose at time: " + mRgbTimestampGlThread);
}</BUG>
}
}
}
@Override
| mRenderer.updateRenderCameraPose(lastFramePose);
mCameraPoseTimestamp = lastFramePose.timestamp;
Log.w(TAG, "Can't get device pose at time: " +
|
7,062 | import org.rajawali3d.materials.Material;
import org.rajawali3d.materials.methods.DiffuseMethod;
import org.rajawali3d.materials.textures.ATexture;
import org.rajawali3d.materials.textures.StreamingTexture;
import org.rajawali3d.materials.textures.Texture;
<BUG>import org.rajawali3d.math.Matrix4;
import org.rajawali3d.math.vector.Vector3;</BUG>
import org.rajawali3d.primitives.ScreenQuad;
import org.rajawali3d.primitives.Sphere;
import org.rajawali3d.renderer.RajawaliRenderer;
| import org.rajawali3d.math.Quaternion;
import org.rajawali3d.math.vector.Vector3;
|
7,063 | translationMoon.setRepeatMode(Animation.RepeatMode.INFINITE);
translationMoon.setTransformable3D(moon);
getCurrentScene().registerAnimation(translationMoon);
translationMoon.play();
}
<BUG>public void updateRenderCameraPose(TangoPoseData devicePose, DeviceExtrinsics extrinsics) {
Pose cameraPose = ScenePoseCalculator.toOpenGlCameraPose(devicePose, extrinsics);
getCurrentCamera().setRotation(cameraPose.getOrientation());
getCurrentCamera().setPosition(cameraPose.getPosition());
}</BUG>
public int getTextureId() {
| public void updateRenderCameraPose(TangoPoseData cameraPose) {
float[] rotation = cameraPose.getRotationAsFloats();
float[] translation = cameraPose.getTranslationAsFloats();
Quaternion quaternion = new Quaternion(rotation[3], rotation[0], rotation[1], rotation[2]);
getCurrentCamera().setRotation(quaternion.conjugate());
getCurrentCamera().setPosition(translation[0], translation[1], translation[2]);
|
7,064 | package com.projecttango.examples.java.helloareadescription;
import com.google.atap.tangoservice.Tango;
<BUG>import com.google.atap.tangoservice.Tango.OnTangoUpdateListener;
import com.google.atap.tangoservice.TangoConfig;</BUG>
import com.google.atap.tangoservice.TangoCoordinateFramePair;
import com.google.atap.tangoservice.TangoErrorException;
import com.google.atap.tangoservice.TangoEvent;
| import com.google.atap.tangoservice.TangoAreaDescriptionMetaData;
import com.google.atap.tangoservice.TangoConfig;
|
7,065 | return intern(new StringIdItem(new CstString(string)));
}
public StringIdItem intern(CstString string) {
return intern(new StringIdItem(string));
}
<BUG>public StringIdItem intern(StringIdItem string) {
</BUG>
if (string == null) {
throw new NullPointerException("string == null");
}
| public synchronized StringIdItem intern(StringIdItem string) {
|
7,066 | return already;
}
strings.put(value, string);
return string;
}
<BUG>public void intern(CstNat nat) {
</BUG>
intern(nat.getName());
intern(nat.getDescriptor());
}
| public synchronized void intern(CstNat nat) {
|
7,067 | out.annotate(4, "proto_ids_off: " + Hex.u4(offset));
}
out.writeInt(sz);
out.writeInt(offset);
}
<BUG>public ProtoIdItem intern(Prototype prototype) {
</BUG>
if (prototype == null) {
throw new NullPointerException("prototype == null");
}
| public synchronized ProtoIdItem intern(Prototype prototype) {
|
7,068 | } catch (NullPointerException ex) {
throw new NullPointerException("item == null");
}
items.add(item);
}
<BUG>public <T extends OffsettedItem> T intern(T item) {
</BUG>
throwIfPrepared();
OffsettedItem result = interns.get(item);
if (result != null) {
| public synchronized <T extends OffsettedItem> T intern(T item) {
|
7,069 | out.annotate(4, "type_ids_off: " + Hex.u4(offset));
}
out.writeInt(sz);
out.writeInt(offset);
}
<BUG>public TypeIdItem intern(Type type) {
</BUG>
if (type == null) {
throw new NullPointerException("type == null");
}
| public synchronized TypeIdItem intern(Type type) {
|
7,070 | import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
<BUG>import java.util.TreeMap;
import java.util.concurrent.Callable;</BUG>
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
| import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Callable;
|
7,071 | if (args.incremental && !anyFilesProcessed) {
return 0; // this was a no-op incremental build
}
byte[] outArray = null;
if (!outputDex.isEmpty() || (args.humanOutName != null)) {
<BUG>outArray = writeDex();
</BUG>
if (outArray == null) {
return 2;
}
| outArray = writeDex(outputDex);
|
7,072 | DxConsole.err.println("\ntrouble processing \"" + name + "\":\n\n" +
IN_RE_CORE_CLASSES);
errors.incrementAndGet();
throw new StopProcessing();
}
<BUG>private static byte[] writeDex() {
</BUG>
byte[] outArray = null;
try {
try {
| private static byte[] writeDex(DexFile outputDex) {
|
7,073 | if (minimalMainDex && (mainDexListFile == null || !multiDex)) {
System.err.println(MINIMAL_MAIN_DEX_OPTION + " is only supported in combination with "
+ MULTI_DEX_OPTION + " and " + MAIN_DEX_LIST_OPTION);
throw new UsageException();
}
<BUG>if (multiDex && numThreads != 1) {
System.out.println(NUM_THREADS_OPTION + " is ignored when used with "
+ MULTI_DEX_OPTION);
numThreads = 1;
}</BUG>
if (multiDex && incremental) {
| [DELETED] |
7,074 | public static boolean debugMode = false;
@ModConfigProperty(category = "Debug", name = "debugModeGOTG", comment = "Enable/Disable Debug Mode for the Gift Of The Gods")
public static boolean debugModeGOTG = false;
@ModConfigProperty(category = "Debug", name = "debugModeEnchantments", comment = "Enable/Disable Debug Mode for the Enchantments")
public static boolean debugModeEnchantments = false;
<BUG>@ModConfigProperty(category = "Weapons", name = "enableSwordsRecipes", comment = "Enable/Disable The ArmorPlus Sword's Recipes")
public static boolean enableSwordsRecipes = true;
@ModConfigProperty(category = "Weapons", name = "enableBattleAxesRecipes", comment = "Enable/Disable The ArmorPlus Battle Axes's Recipes")
public static boolean enableBattleAxesRecipes = true;
@ModConfigProperty(category = "Weapons", name = "enableBowsRecipes", comment = "Enable/Disable The ArmorPlus Bows's Recipes")
public static boolean enableBowsRecipes = true;
@ModConfigProperty(category = "Armors.SuperStarArmor.Effects", name = "enableSuperStarHRegen", comment = "Enable/Disable The Super Star Helmet Regeneration")
</BUG>
public static boolean enableSuperStarHRegen = true;
| @ModConfigProperty(category = "Weapons", name = "enableSwordsRecipes", comment = "Enable/Disable ArmorPlus Sword's Recipes")
@ModConfigProperty(category = "Weapons", name = "enableBattleAxesRecipes", comment = "Enable/Disable ArmorPlus Battle Axes's Recipes")
@ModConfigProperty(category = "Weapons", name = "enableBowsRecipes", comment = "Enable/Disable ArmorPlus Bows's Recipes")
|
7,075 | import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import java.io.IOException;
import java.util.List;
import static com.google.common.base.Preconditions.checkArgument;
<BUG>import static java.util.Objects.requireNonNull;
@Singleton</BUG>
public class JpaMemberDao extends AbstractJpaPermissionsDao<MemberImpl> implements MemberDao {
@Inject
public JpaMemberDao(AbstractPermissionsDomain<MemberImpl> supportedDomain) throws IOException {
| import static java.util.stream.Collectors.toList;
@Singleton
|
7,076 | final EntityManager manager = managerProvider.get();
final List<MemberImpl> members = manager.createNamedQuery("Member.getByOrganization", MemberImpl.class)
.setParameter("organizationId", organizationId)
.setMaxResults(maxItems)
.setFirstResult((int)skipCount)
<BUG>.getResultList();
final Long membersCount = manager.createNamedQuery("Member.getCountByOrganizationId", Long.class)</BUG>
.setParameter("organizationId", organizationId)
.getSingleResult();
return new Page<>(members, skipCount, maxItems, membersCount);
| .getResultList()
.stream()
.map(MemberImpl::new)
.collect(toList());
final Long membersCount = manager.createNamedQuery("Member.getCountByOrganizationId", Long.class)
|
7,077 | requireNonNull(userId, "Required non-null user id");
try {
final EntityManager manager = managerProvider.get();
return manager.createNamedQuery("Member.getByUser", MemberImpl.class)
.setParameter("userId", userId)
<BUG>.getResultList();
} catch (RuntimeException e) {</BUG>
throw new ServerException(e.getLocalizedMessage(), e);
}
}
| .getResultList()
.stream()
.map(MemberImpl::new)
.collect(toList());
} catch (RuntimeException e) {
|
7,078 | public MemberImpl() {
}
public MemberImpl(String userId, String organizationId, List<String> actions) {
super(userId, actions);
this.organizationId = organizationId;
<BUG>}
@Override</BUG>
public String getInstanceId() {
return organizationId;
}
| public MemberImpl(Member member) {
this(member.getUserId(), member.getOrganizationId(), member.getActions());
@Override
|
7,079 | import javax.persistence.EntityManager;
import java.util.List;
import java.util.Set;
import static com.google.common.base.Preconditions.checkArgument;
import static java.lang.String.format;
<BUG>import static java.util.Objects.requireNonNull;
@Singleton</BUG>
public class JpaSystemPermissionsDao extends AbstractJpaPermissionsDao<SystemPermissionsImpl> {
@Inject
public JpaSystemPermissionsDao(@Named(SystemDomain.SYSTEM_DOMAIN_ACTIONS) Set<String> allowedActions) {
| import static java.util.stream.Collectors.toList;
@Singleton
|
7,080 | final EntityManager entityManager = managerProvider.get();
final List<SystemPermissionsImpl> permissions = entityManager.createNamedQuery("SystemPermissions.getAll",
SystemPermissionsImpl.class)
.setMaxResults(maxItems)
.setFirstResult((int)skipCount)
<BUG>.getResultList();
final Long totalCount = entityManager.createNamedQuery("SystemPermissions.getTotalCount", Long.class)</BUG>
.getSingleResult();
return new Page<>(permissions, skipCount, maxItems, totalCount);
} catch (RuntimeException e) {
| .getResultList()
.stream()
.map(SystemPermissionsImpl::new)
.collect(toList());
final Long totalCount = entityManager.createNamedQuery("SystemPermissions.getTotalCount", Long.class)
|
7,081 | } catch (RuntimeException e) {
throw new ServerException(e.getLocalizedMessage(), e);
}
}
@Override
<BUG>public void remove(String userId, String instanceId) throws ServerException, NotFoundException {
requireNonNull(userId, "User identifier required");
doRemove(userId, instanceId);
}
@Override
@Transactional</BUG>
public List<SystemPermissionsImpl> getByUser(String userId) throws ServerException {
| [DELETED] |
7,082 | import javax.persistence.NoResultException;
import java.io.IOException;
import java.util.List;
import static com.google.common.base.Preconditions.checkArgument;
import static java.lang.String.format;
<BUG>import static java.util.Objects.requireNonNull;
@Singleton</BUG>
public class JpaRecipePermissionsDao extends AbstractJpaPermissionsDao<RecipePermissionsImpl> {
@Inject
public JpaRecipePermissionsDao(AbstractPermissionsDomain<RecipePermissionsImpl> domain) throws IOException {
| import static java.util.stream.Collectors.toList;
@Singleton
|
7,083 | final List<RecipePermissionsImpl> recipePermissionsList = entityManager.createNamedQuery("RecipePermissions.getByRecipeId",
RecipePermissionsImpl.class)
.setParameter("recipeId", instanceId)
.setMaxResults(maxItems)
.setFirstResult((int)skipCount)
<BUG>.getResultList();
final Long permissionsCount = entityManager.createNamedQuery("RecipePermissions.getCountByRecipeId", Long.class)</BUG>
.setParameter("recipeId", instanceId)
.getSingleResult();
return new Page<>(recipePermissionsList, skipCount, maxItems, permissionsCount);
| .getResultList()
.stream()
.map(RecipePermissionsImpl::new)
.collect(toList());
final Long permissionsCount = entityManager.createNamedQuery("RecipePermissions.getCountByRecipeId", Long.class)
|
7,084 | .createNamedQuery("RecipePermissions.getByUserAndRecipeId", RecipePermissionsImpl.class)
.setParameter("recipeId", instanceId)
.setParameter("userId", userId)
.getSingleResult();
}
<BUG>} catch (NoResultException e) {
throw new NotFoundException(format("Permissions on recipe '%s' of user '%s' was not found.", instanceId, userId));
} catch (RuntimeException e) {</BUG>
throw new ServerException(e.getLocalizedMessage(), e);
}
| [DELETED] |
7,085 | return permissions.getActions().contains(action);
}
@Override
public void remove(String userId, String instanceId) throws ServerException, NotFoundException {
requireNonNull(instanceId, "Instance identifier required");
<BUG>requireNonNull(userId, "User identifier required");
doRemove(userId, instanceId);
}</BUG>
@Override
public abstract T get(String userId, String instanceId) throws ServerException, NotFoundException;
| try {
} catch (RuntimeException x) {
throw new ServerException(x.getLocalizedMessage(), x);
|
7,086 | "recipe1",
asList("read", "use", "run"));
dao.store(publicPermission);
assertTrue(dao.getByInstance(publicPermission.getInstanceId(), 3, 0)
.getItems()
<BUG>.contains(publicPermission));
}</BUG>
@Test
public void shouldUpdateExistingRecipePublicPermissions() throws Exception {
final RecipePermissionsImpl publicPermission = new RecipePermissionsImpl("*",
| .contains(new RecipePermissionsImpl(publicPermission)));
}
|
7,087 | import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import javax.inject.Inject;
<BUG>import java.util.List;
import static java.util.Arrays.asList;</BUG>
import static java.util.Collections.singletonList;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
| import java.util.stream.Collectors;
import java.util.stream.Stream;
import static java.util.Arrays.asList;
|
7,088 | userRepository.createAll(asList(users));
recipeRepository.createAll(
asList(new RecipeImpl("recipe1", "rc1", null, null, null, null, null),
new RecipeImpl("recipe2", "rc2", null, null, null, null, null)
));
<BUG>permissionsRepository.createAll(asList(permissions));
}</BUG>
@AfterMethod
public void cleanUp() throws TckRepositoryException {
| permissionsRepository.createAll(Stream.of(permissions)
.map(RecipePermissionsImpl::new)
.collect(Collectors.toList()));
}
|
7,089 | import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import javax.inject.Inject;
<BUG>import java.util.List;
import static java.util.Arrays.asList;</BUG>
import static java.util.Collections.singletonList;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
| import java.util.stream.Collectors;
import java.util.stream.Stream;
import static java.util.Arrays.asList;
|
7,090 | members[0] = new MemberImpl(users[0].getId(), orgs[0].getId(), asList("read", "update"));
members[1] = new MemberImpl(users[1].getId(), orgs[0].getId(), asList("read", "update"));
members[2] = new MemberImpl(users[2].getId(), orgs[0].getId(), asList("read", "update"));
members[3] = new MemberImpl(users[1].getId(), orgs[1].getId(), asList("read", "update"));
members[4] = new MemberImpl(users[1].getId(), orgs[2].getId(), asList("read", "update"));
<BUG>memberRepo.createAll(asList(members));
}</BUG>
@AfterMethod
private void cleanup() throws TckRepositoryException {
| memberRepo.createAll(Stream.of(members)
.map(MemberImpl::new)
.collect(Collectors.toList()));
}
|
7,091 | organizationRepo.removeAll();
}
@Test(dependsOnMethods = {"shouldGetMember", "shouldRemoveMember"})
public void shouldCreateNewMemberOnMemberStoring() throws Exception {
final MemberImpl member = members[0];
<BUG>memberDao.remove(member.getOrganizationId(), member.getUserId());
memberDao.store(member);
assertEquals(member, memberDao.getMember(member.getOrganizationId(), member.getUserId()));
</BUG>
}
| memberDao.remove(member.getUserId(), member.getOrganizationId());
assertEquals(memberDao.getMember(member.getOrganizationId(), member.getUserId()), new MemberImpl(member));
|
7,092 | };
};
}
return autoEditStrategy;
}
<BUG>protected DocumentCommand createDocumentCommand(int start, int length, String text) {
DocumentCommand documentCommand = new DocumentCommand() {};
</BUG>
documentCommand.doit = true;
| protected DocumentCommand2 createDocumentCommand(int start, int length, String text) {
DocumentCommand2 documentCommand = new DocumentCommand2() {};
|
7,093 | String srcPre3 = srcPre + srcIndent.substring(0, nlSize);
String srcAfter3 = srcIndent.substring(nlSize, srcIndent.length()) + sourceAfter;
testDeleteCommandWithNoEffect(srcPre3, srcAfter3);
}
protected void testDeleteDeindent(String srcPre, String srcIndent, String sourceAfter) {
<BUG>DocumentCommand delCommand = applyDelCommand(srcPre, srcIndent + sourceAfter);
</BUG>
getAutoEditStrategy().customizeDocumentCommand(getDocument(), delCommand);
checkCommand(delCommand, "", srcPre.length(), srcIndent.length());
}
| DocumentCommand2 delCommand = applyDelCommand(srcPre, srcIndent + sourceAfter);
|
7,094 | protected boolean keyWasEnter() {
return getLastPressedKey() == KeyCommand.ENTER;
}
protected String docContents;
@Override
<BUG>public void customizeDocumentCommand(IDocument doc, DocumentCommand cmd) {
</BUG>
if (cmd.doit == false)
return;
docContents = doc.get();
| public void customizeDocumentCommand(IDocument doc, DocumentCommand2 cmd) {
|
7,095 | this.contentType = contentType;
}
protected boolean parenthesesAsBlocks;
protected String indentUnit;
@Override
<BUG>protected void doCustomizeDocumentCommand(IDocument doc, DocumentCommand cmd) throws BadLocationException {
</BUG>
parenthesesAsBlocks = preferences.parenthesesAsBlocks();
indentUnit = preferences.getIndentUnit();
boolean isSmartIndent = preferences.isSmartIndent();
| protected void doCustomizeDocumentCommand(IDocument doc, DocumentCommand2 cmd) throws BadLocationException {
|
7,096 | return BLOCK_RULES_BracesAndParenthesis;
} else {
return BLOCK_RULES_Braces;
}
}
<BUG>protected void smartIndentAfterNewLine(IDocument doc, DocumentCommand cmd) throws BadLocationException {
</BUG>
if(cmd.length > 0 || cmd.text == null)
return;
IRegion lineRegion = doc.getLineInformationOfOffset(cmd.offset);
| protected void smartIndentAfterNewLine(IDocument doc, DocumentCommand2 cmd) throws BadLocationException {
|
7,097 | return !partition.getType().equals(IDocument.DEFAULT_CONTENT_TYPE);
}
protected String addIndent(String indentStr, int indentDelta) {
return indentStr + TextSourceUtils.stringNTimes(indentUnit, indentDelta);
}
<BUG>protected boolean smartDeIndentAfterDeletion(IDocument doc, DocumentCommand cmd) throws BadLocationException {
</BUG>
if(!preferences.isSmartDeIndent())
return false;
if(!cmd.text.isEmpty())
| protected boolean smartDeIndentAfterDeletion(IDocument doc, DocumentCommand2 cmd) throws BadLocationException {
|
7,098 | BlockHeuristicsScannner bhscanner = createBlockHeuristicsScanner(doc);
LineIndentResult nli = determineIndent(doc, bhscanner, line);
String expectedIndentStr = nli.nextLineIndent;
return expectedIndentStr;
}
<BUG>protected void smartIndentOnKeypress(IDocument doc, DocumentCommand cmd) {
</BUG>
assertTrue(cmd.text.length() == 1);
int offset = cmd.offset;
int lineStart = TextSourceUtils.findLineStartForOffset(docContents, offset);
| protected void smartIndentOnKeypress(IDocument doc, DocumentCommand2 cmd) {
|
7,099 | private final I18n i18n;
private Filter filter;
ApplicationElement(TodoItemRepository repository, I18n i18n) {
this.repository = repository;
this.i18n = i18n;
<BUG>Elements.Builder builder = new Elements.Builder()
.section().css("todoapp")</BUG>
.header().css("header")
.h(1).innerText(i18n.constants().todos()).end()
.input(text)
| TodoBuilder builder = new TodoBuilder()
.section().css("todoapp")
|
7,100 | import static org.junit.Assert.assertNotNull;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class ElementsBuilderTest {
<BUG>private Elements.Builder builder;
</BUG>
@Before
public void setUp() {
Document document = mock(Document.class);
| private TestableBuilder builder;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.