id int64 1 49k | buggy stringlengths 34 37.5k | fixed stringlengths 2 37k |
|---|---|---|
42,901 | import java.util.Map;
import java.util.Set;
public interface TreeParser {
void parseAllSymbols();
Map<URI, Set<SymbolInformation>> getFileSymbols();
<BUG>Map<String, Set<SymbolInformation>> getTypeReferences();
Set<SymbolInformation> findReferences(ReferenceParams params);
Set<SymbolInformation> getFilteredSymbols(String query);</BUG>
}
| Map<Location, Set<Location>> getReferences();
Set<Location> findReferences(ReferenceParams params);
Optional<Location> gotoDefinition(URI uri, Position position);
Set<SymbolInformation> getFilteredSymbols(String query);
|
42,902 | .workspaceSymbolProvider(true)
.referencesProvider(true)
.completionProvider(new CompletionOptionsBuilder()
.resolveProvider(false)
.triggerCharacter(".")
<BUG>.build())
.build();</BUG>
InitializeResult result = new InitializeResultBuilder()
.capabilities(capabilities)
.build();
| .definitionProvider(true)
|
42,903 | package com.palantir.ls.server;
import com.palantir.ls.server.api.CompilerWrapper;
import com.palantir.ls.server.api.TreeParser;
import com.palantir.ls.server.api.WorkspaceCompiler;
<BUG>import io.typefox.lsapi.FileEvent;
import io.typefox.lsapi.PublishDiagnosticsParams;</BUG>
import io.typefox.lsapi.ReferenceParams;
import io.typefox.lsapi.SymbolInformation;
import io.typefox.lsapi.TextDocumentContentChangeEvent;
| import com.google.common.base.Optional;
import io.typefox.lsapi.Location;
import io.typefox.lsapi.Position;
import io.typefox.lsapi.PublishDiagnosticsParams;
|
42,904 | chart.addYAxisLabels(AxisLabelsFactory.newAxisLabels(labels));
chart.addXAxisLabels(AxisLabelsFactory.newNumericRangeAxisLabels(0, max));
chart.setBarWidth(BarChart.AUTO_RESIZE);
chart.setSize(600, 500);
chart.setHorizontal(true);
<BUG>chart.setTitle("Total Evaluations by User");
showChartImg(resp, chart.toURLString());
}</BUG>
private List<Entry<String, Integer>> sortEntries(Collection<Entry<String, Integer>> entries) {
List<Entry<String, Integer>> result = new ArrayList<Entry<String, Integer>>(entries);
| chart.setDataEncoding(DataEncoding.TEXT);
return chart;
}
|
42,905 | checkEvaluationsEqual(eval4, foundissueProto.getEvaluations(0));
checkEvaluationsEqual(eval5, foundissueProto.getEvaluations(1));
}
public void testGetRecentEvaluationsNoneFound() throws Exception {
DbIssue issue = createDbIssue("fad", persistenceHelper);
<BUG>DbEvaluation eval1 = createEvaluation(issue, "someone", 100);
DbEvaluation eval2 = createEvaluation(issue, "someone", 200);
DbEvaluation eval3 = createEvaluation(issue, "someone", 300);
issue.addEvaluations(eval1, eval2, eval3);</BUG>
getPersistenceManager().makePersistent(issue);
| [DELETED] |
42,906 | public int read() throws IOException {
return inputStream.read();
}
});
}
<BUG>}
protected DbEvaluation createEvaluation(DbIssue issue, String who, long when) {</BUG>
DbUser user;
Query query = getPersistenceManager().newQuery("select from " + persistenceHelper.getDbUserClass().getName()
+ " where openid == :myopenid");
| @SuppressWarnings({"unchecked"})
protected DbEvaluation createEvaluation(DbIssue issue, String who, long when) {
|
42,907 | eval.setComment("my comment");
eval.setDesignation("MUST_FIX");
eval.setIssue(issue);
eval.setWhen(when);
eval.setWho(user.createKeyObject());
<BUG>eval.setEmail(who);
return eval;</BUG>
}
protected PersistenceManager getPersistenceManager() {
return testHelper.getPersistenceManager();
| issue.addEvaluation(eval);
return eval;
|
42,908 | package com.easytoolsoft.easyreport.web.controller.common;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping(value = "/error")
<BUG>public class ErrorController extends AbstractController {
@RequestMapping(value = {"/404"})</BUG>
public String error404() {
return "/error/404";
}
| public class ErrorController {
@RequestMapping(value = {"/404"})
|
42,909 | e.printStackTrace();
}
filePlayback=null;
}
@Override
<BUG>public void stop() { if ( filePlayback!=null ) filePlayback.stop(); }
void initFiles() throws FileNotFoundException {</BUG>
if ((dataDir.length() != 0) && !dataDir.endsWith("/")) { dataDir = dataDir + "/"; } // guard path if needed
String samples_str = dataDir + "samples";
String events_str = dataDir + "events";
| @Override public boolean isrunning(){ if ( filePlayback!=null ) return filePlayback.isrunning(); return false; }
void initFiles() throws FileNotFoundException {
|
42,910 | public class BufferMonitor extends Thread implements FieldtripBufferMonitor {
public static final String TAG = BufferMonitor.class.toString();
private final Context context;
private final SparseArray<BufferConnectionInfo> clients = new SparseArray<BufferConnectionInfo>();
private final BufferInfo info;
<BUG>private final BroadcastReceiver mMessageReceiver = new BroadcastReceiver() {
@Override
public void onReceive(final Context context, final Intent intent) {
if (intent.getIntExtra(C.MESSAGE_TYPE, -1) == C.UPDATE_REQUEST) {
Log.i(TAG, "Received update request.");
sendAllInfo();
}
}
};</BUG>
private boolean run = true;
| [DELETED] |
42,911 | public static final String CLIENT_INFO_TIME = "c_time";
public static final String CLIENT_INFO_WAITTIMEOUT = "c_waitTimeout";
public static final String CLIENT_INFO_CONNECTED = "c_connected";
public static final String CLIENT_INFO_CHANGED = "c_changed";
public static final String CLIENT_INFO_DIFF = "c_diff";
<BUG>public static final int UPDATE_REQUEST = 0;
</BUG>
public static final int UPDATE = 1;
public static final int REQUEST_PUT_HEADER = 2;
public static final int REQUEST_FLUSH_HEADER = 3;
| public static final int THREAD_INFO_TYPE = 0;
|
42,912 | package nl.dcc.buffer_bci.bufferclientsservice;
import android.os.Parcel;
import android.os.Parcelable;
<BUG>import nl.dcc.buffer_bci.bufferservicecontroller.C;
public class ThreadInfo implements Parcelable {</BUG>
public static final Creator<ThreadInfo> CREATOR = new Creator<ThreadInfo>() {
@Override
public ThreadInfo createFromParcel(final Parcel in) {
| import nl.dcc.buffer_bci.C;
public class ThreadInfo implements Parcelable {
|
42,913 | package com.liferay.socialnetworking.wall.social;
<BUG>import com.liferay.portal.kernel.util.HtmlUtil;
import com.liferay.portal.kernel.util.StringBundler;</BUG>
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.User;
import com.liferay.portal.security.permission.PermissionChecker;
| [DELETED] |
42,914 | import com.liferay.portlet.social.model.BaseSocialActivityInterpreter;
import com.liferay.portlet.social.model.SocialActivity;
import com.liferay.portlet.social.model.SocialRelationConstants;
import com.liferay.portlet.social.service.SocialRelationLocalServiceUtil;
import com.liferay.socialnetworking.model.WallEntry;
<BUG>import com.liferay.socialnetworking.service.WallEntryLocalServiceUtil;
public class WallActivityInterpreter extends BaseSocialActivityInterpreter {</BUG>
public String[] getClassNames() {
return _CLASS_NAMES;
}
| import com.liferay.socialnetworking.util.WallUtil;
public class WallActivityInterpreter extends BaseSocialActivityInterpreter {
|
42,915 | public class DirectiveNameToken extends Token {
@Nonnull public final DirectiveNameSubtype subtype;
public DirectiveNameToken(@Nonnull String value) {
super(value);
DirectiveNameSubtype subtype = DirectiveNameSubtype.fromString(value);
<BUG>if (subtype == null) {
throw new IllegalArgumentException("Unrecognised directive name: " + value);
}</BUG>
this.subtype = subtype;
}
| [DELETED] |
42,916 | StyleSrc,
Referrer, // in draft at http://www.w3.org/TR/2014/WD-referrer-policy-20140807/#referrer-policy-delivery as of 2015-08-27
UpgradeInsecureRequests, // in draft at http://www.w3.org/TR/2015/WD-upgrade-insecure-requests-20150424/#delivery as of 2015-08-27
BlockAllMixedContent, // W3C Candidate Recommendation at http://www.w3.org/TR/mixed-content/#strict-opt-in as of 2015-09-22
Allow, // never included in an official CSP specification
<BUG>Options; // never included in an official CSP specification
@Nullable static DirectiveNameSubtype fromString(@Nonnull String directiveName) {
</BUG>
switch (directiveName.toLowerCase()) {
| Options, // never included in an official CSP specification
Unrecognised;
@Nonnull static DirectiveNameSubtype fromString(@Nonnull String directiveName) {
|
42,917 | @Nonnull public static Policy parse(@Nonnull String sourceText, @Nonnull Origin origin)
throws ParseException, TokeniserException {</BUG>
return new Parser(Tokeniser.tokenise(sourceText), origin, null).parsePolicyAndAssertEOF();
}
<BUG>@Nonnull public static Policy parse(@Nonnull String sourceText, @Nonnull String origin)
throws ParseException, TokeniserException {</BUG>
return new Parser(Tokeniser.tokenise(sourceText), URI.parse(origin), null)
.parsePolicyAndAssertEOF();
| protected Parser(@Nonnull Token[] tokens, @Nonnull Origin origin,
@Nullable Collection<Notice> noticesOut) {
this.origin = origin;
this.tokens = tokens;
this.noticesOut = noticesOut;
@Nonnull public static Policy parse(@Nonnull String sourceText, @Nonnull Origin origin) {
@Nonnull public static Policy parse(@Nonnull String sourceText, @Nonnull String origin) {
|
42,918 | }
@Nonnull private Set<MediaType> parseMediaTypeList() throws ParseException {
</BUG>
Set<MediaType> mediaTypes = new LinkedHashSet<>();
if (!this.hasNext(DirectiveValueToken.class)) {
<BUG>throw this.createError("media-type-list must contain at least one media-type");
}
mediaTypes.add(this.parseMediaType());
while (this.hasNext(DirectiveValueToken.class)) {
mediaTypes.add(this.parseMediaType());
}</BUG>
return mediaTypes;
| this.error("Unrecognised directive-name: " + token.value);
throw new DirectiveParseException("Invalid directive-name");
@Nonnull private Set<MediaType> parseMediaTypeList() throws DirectiveParseException {
this.error("media-type-list must contain at least one media-type");
throw new DirectiveParseException("Invalid media-type-list");
|
42,919 | return KeywordSource.UnsafeRedirect;
case "self":
case "unsafe-inline":
case "unsafe-eval":
case "unsafe-redirect":
<BUG>case "none":
this.warn("This host name is unusual, and likely meant to be a keyword that is missing the required quotes: \'" + token.value.toLowerCase() + "\'");
default:
if (token.value.startsWith("'nonce-")) {
String nonce = token.value.substring(7, token.value.length() - 1);
NonceSource nonceSource = new NonceSource(nonce);</BUG>
nonceSource.validationErrors().forEach(this::warn);
| this.warn(
"This host name is unusual, and likely meant to be a keyword that is missing the required quotes: \'"
+ sourceExpression.toLowerCase() + "\'");
if (sourceExpression.startsWith("'nonce-")) {
String nonce = sourceExpression.substring(7, sourceExpression.length() - 1);
NonceSource nonceSource = new NonceSource(nonce);
|
42,920 | hashSource.validationErrors();
} catch (IllegalArgumentException e) {
throw this.createError(e.getMessage());
}
return hashSource;
<BUG>} else if (token.value.matches("^" + Constants.schemePart + ":$")) {
return new SchemeSource(token.value.substring(0, token.value.length() - 1));
} else {
Matcher matcher = Constants.hostSourcePattern.matcher(token.value);
</BUG>
if (matcher.find()) {
| } else if (sourceExpression.matches("^" + Constants.schemePart + ":$")) {
return new SchemeSource(
sourceExpression.substring(0, sourceExpression.length() - 1));
Matcher matcher = Constants.hostSourcePattern.matcher(sourceExpression);
|
42,921 | </BUG>
super(tokens, origin, warningsOut);
EOF = new Location(1, sourceText.length() + 1, sourceText.length());
}
<BUG>@Nonnull public static Policy parse(@Nonnull String sourceText, @Nonnull Origin origin)
throws ParseException, Tokeniser.TokeniserException {</BUG>
return new ParserWithLocation(sourceText, TokeniserWithLocation.tokenise(sourceText),
origin, null).parsePolicyAndAssertEOF();
}
| import java.util.Collection;
import java.util.List;
public class ParserWithLocation extends Parser {
private final Location EOF;
private ParserWithLocation(@Nonnull String sourceText, @Nonnull Token[] tokens,
@Nonnull Origin origin, @Nullable Collection<Notice> warningsOut) {
@Nonnull public static Policy parse(@Nonnull String sourceText, @Nonnull Origin origin) {
|
42,922 | return new TokeniserWithLocation(sourceText).tokenise();</BUG>
}
@Nonnull private Location getLocation() {
return new Location(1, this.index + 1, this.index);
<BUG>}
@Override @Nonnull protected TokeniserException createError(@Nonnull String message) {
TokeniserException e = super.createError(message);
e.location = this.getLocation();
return e;</BUG>
}
| import java.util.regex.Pattern;
public class TokeniserWithLocation extends Tokeniser {
private TokeniserWithLocation(@Nonnull String sourceText) {
super(sourceText);
@Nonnull public static Token[] tokenise(@Nonnull String sourceText) {
return new TokeniserWithLocation(sourceText).tokenise();
|
42,923 | import java.util.regex.Pattern;
public class Tokeniser {
private static final Pattern directiveSeparator = Pattern.compile(";");
private static final Pattern policySeparator = Pattern.compile(",");
private static final Pattern directiveNamePattern = Pattern.compile("[a-zA-Z0-9-]+");
<BUG>private static final Pattern directiveValuePattern = Pattern.compile("[!-+--:<-~]+");
@Nonnull protected final ArrayList<Token> tokens;</BUG>
@Nonnull protected final String sourceText;
protected final int length;
| private static final Pattern directiveValuePattern = Pattern.compile("[ \\t!-+--:<-~]+");
private static final Pattern notSeparator = Pattern.compile("[^;,]");
@Nonnull protected final ArrayList<Token> tokens;
|
42,924 | return new Tokeniser(sourceText).tokenise();</BUG>
}
private static boolean isWhitespace(char ch) {
return ch == ' ' || ch == '\t';
<BUG>}
@Nonnull protected TokeniserException createError(@Nonnull String message) {
return new TokeniserException(message);</BUG>
}
protected boolean eat(@Nonnull Function<String, Token> ctor, @Nonnull Pattern pattern) {
if (this.index >= this.length)
| this.tokens = new ArrayList<>();
this.sourceText = sourceText;
this.length = sourceText.length();
this.eatWhitespace();
@Nonnull public static Token[] tokenise(@Nonnull String sourceText) {
return new Tokeniser(sourceText).tokenise();
|
42,925 | private boolean eatDirectiveName() {
return this.eat(DirectiveNameToken::new, Tokeniser.directiveNamePattern);
}
private boolean eatDirectiveValue() {
return this.eat(DirectiveValueToken::new, Tokeniser.directiveValuePattern);
<BUG>}
private void eatWhitespace() {</BUG>
while (this.hasNext() && Tokeniser.isWhitespace(this.sourceText.charAt(this.index))) {
++this.index;
}
| private boolean eatUntilSeparator() {
return this.eat(UnknownToken::new, Tokeniser.notSeparator);
private void eatWhitespace() {
|
42,926 | }
}
});
}
} else {
<BUG>if (n <= m) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {</BUG>
a[i][j] = operator.applyAsBoolean(a[i][j]);
}
| public boolean[] row(final int rowIndex) {
N.checkArgument(rowIndex >= 0 && rowIndex < n, "Invalid row Index: %s", rowIndex);
return a[rowIndex];
|
42,927 | }
}
});
}
} else {
<BUG>if (n <= m) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {</BUG>
result[i][j] = zipFunction.apply(a[i][j], b[i][j]);
}
| public boolean get(final int i, final int j) {
return a[i][j];
|
42,928 | }
}
});
}
} else {
<BUG>if (n <= m) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {</BUG>
result[i][j] = zipFunction.apply(a[i][j], b[i][j], c[i][j]);
}
| return new BooleanMatrix(c);
|
42,929 | }
public AsyncExecutor(int maxConcurrentThreadNumber, long keepAliveTime, TimeUnit unit) {
this.maxConcurrentThreadNumber = maxConcurrentThreadNumber;
this.keepAliveTime = keepAliveTime;
this.unit = unit;
<BUG>}
public AsyncExecutor(final ExecutorService executorService) {
this(8, 300, TimeUnit.SECONDS);
this.executorService = executorService;</BUG>
Runtime.getRuntime().addShutdownHook(new Thread() {
| [DELETED] |
42,930 | results.add(execute(cmd));
}
return results;
}
public <T> CompletableFuture<T> execute(final Callable<T> command) {
<BUG>final CompletableFuture<T> future = new CompletableFuture<T>(this, command);
getExecutorService().execute(future);</BUG>
return future;
}
public <T> List<CompletableFuture<T>> execute(final Callable<T>... commands) {
| final CompletableFuture<T> future = new CompletableFuture<>(this, command);
getExecutorService().execute(future);
|
42,931 | private void addBuffer() {
try {
if (!isClosed && bufferQueue.size() <= BUFFER_QUEUE_SIZE)
bufferQueue.put(new byte[size]);
} catch (InterruptedException e) {
<BUG>LOGGER.log(LogLevel.INFO, "Unable to add buffer to buffer queue", e);
}</BUG>
}
}
public AsyncBufferWriter(OutputStream outputStream, int size, ThreadFactory threadFactory, byte[] newline) {
| LOGGER.log(LogLevel.INFO, Messages.getString("HDFS_ASYNC_UNABLE_ADD_TO_QUEUE"), e);
|
42,932 | isClosed = true;
exService.shutdown();
try {
exService.awaitTermination(Integer.MAX_VALUE, TimeUnit.SECONDS);
} catch (InterruptedException e) {
<BUG>LOGGER.log(LogLevel.WARN, "Execution Service shutdown is interrupted.", e);
}finally {</BUG>
flushNow();
out.close();
bufferQueue.clear();
| LOGGER.log(LogLevel.WARN, Messages.getString("HDFS_ASYNC_SERVICE_SHUTDOWN_INTERRUPTED"), e);
}finally {
|
42,933 | static JetType computeType(JetTypeElement alternativeTypeElement, final JetType autoType) {
return alternativeTypeElement.accept(new JetVisitor<JetType, Void>() {
@Override
public JetType visitNullableType(JetNullableType nullableType, Void data) {
if (!autoType.isNullable()) {
<BUG>throw new AlternativeSignatureMismatchException(String.format(
"Auto type '%s' is not-null, while type in alternative signature is nullable: '%s'",
DescriptorRenderer.TEXT.renderType(autoType), nullableType.getText()));
}</BUG>
return TypeUtils.makeNullable(computeType(nullableType.getInnerType(), autoType));
| fail("Auto type '%s' is not-null, while type in alternative signature is nullable: '%s'",
DescriptorRenderer.TEXT.renderType(autoType), nullableType.getText());
}
|
42,934 | return visitCommonType(DescriptorUtils.getFQName(classDescriptor).toSafe().getFqName(), type);
}
private JetType visitCommonType(@NotNull String expectedFqNamePostfix, @NotNull JetTypeElement type) {
String fqName = DescriptorUtils.getFQName(autoType.getConstructor().getDeclarationDescriptor()).toSafe().getFqName();
if (!fqName.endsWith(expectedFqNamePostfix)) {
<BUG>throw new AlternativeSignatureMismatchException(String.format(
"Alternative signature type mismatch, expected: %s, actual: %s", expectedFqNamePostfix, fqName));
</BUG>
}
List<TypeProjection> arguments = autoType.getArguments();
| fail("Alternative signature type mismatch, expected: %s, actual: %s", expectedFqNamePostfix, fqName);
|
42,935 | "Alternative signature type mismatch, expected: %s, actual: %s", expectedFqNamePostfix, fqName));
</BUG>
}
List<TypeProjection> arguments = autoType.getArguments();
if (arguments.size() != type.getTypeArgumentsAsTypes().size()) {
<BUG>throw new AlternativeSignatureMismatchException(String.format(
"'%s' type in method signature has %d type arguments, while '%s' in alternative signature has %d of them",
DescriptorRenderer.TEXT.renderType(autoType), arguments.size(),
type.getText(), type.getTypeArgumentsAsTypes().size()));</BUG>
}
| return visitCommonType(DescriptorUtils.getFQName(classDescriptor).toSafe().getFqName(), type);
private JetType visitCommonType(@NotNull String expectedFqNamePostfix, @NotNull JetTypeElement type) {
String fqName = DescriptorUtils.getFQName(autoType.getConstructor().getDeclarationDescriptor()).toSafe().getFqName();
if (!fqName.endsWith(expectedFqNamePostfix)) {
fail("Alternative signature type mismatch, expected: %s, actual: %s", expectedFqNamePostfix, fqName);
fail("'%s' type in method signature has %d type arguments, while '%s' in alternative signature has %d of them",
DescriptorRenderer.TEXT.renderType(autoType), arguments.size(), type.getText(), type.getTypeArgumentsAsTypes().size());
|
42,936 | break;
case OUT:
altVariance = Variance.OUT_VARIANCE;
break;
case STAR:
<BUG>throw new AlternativeSignatureMismatchException(
"Star projection is not available in alternative signatures");
</BUG>
default:
}
| fail("Star projection is not available in alternative signatures");
|
42,937 | "Star projection is not available in alternative signatures");
</BUG>
default:
}
if (altVariance != variance) {
<BUG>throw new AlternativeSignatureMismatchException(String.format(
"Variance mismatch, actual: %s, in alternative signature: %s", variance, altVariance));
</BUG>
}
}
| break;
case OUT:
altVariance = Variance.OUT_VARIANCE;
break;
case STAR:
fail("Star projection is not available in alternative signatures");
fail("Variance mismatch, actual: %s, in alternative signature: %s", variance, altVariance);
|
42,938 | if (altReturnTypeRef == null) {
if (JetStandardClasses.isUnit(autoType)) {
altReturnType = autoType;
}
else {
<BUG>throw new AlternativeSignatureMismatchException(String.format(
"Return type in alternative signature is missing, while in real signature it is '%s'",
DescriptorRenderer.TEXT.renderType(autoType)));
}</BUG>
}
| [DELETED] |
42,939 | JetTypeElement alternativeTypeElement = valueParameter.getTypeReference().getTypeElement();
JetType alternativeType;
JetType alternativeVarargElementType;
if (pd.getVarargElementType() == null) {
if (valueParameter.isVarArg()) {
<BUG>throw new AlternativeSignatureMismatchException(
"Parameter in method signature is not vararg, but in alternative signature it is vararg");
</BUG>
}
alternativeType = computeType(alternativeTypeElement, pd.getType());
| fail("Parameter in method signature is not vararg, but in alternative signature it is vararg");
|
42,940 | alternativeType = computeType(alternativeTypeElement, pd.getType());
alternativeVarargElementType = null;
}
else {
if (!valueParameter.isVarArg()) {
<BUG>throw new AlternativeSignatureMismatchException(
"Parameter in method signature is vararg, but in alternative signature it is not");
</BUG>
}
alternativeVarargElementType = computeType(alternativeTypeElement, pd.getVarargElementType());
| fail("Parameter in method signature is vararg, but in alternative signature it is not");
|
42,941 | import co.cask.cdap.data2.dataset2.lib.table.MetricsTable;
import co.cask.cdap.data2.dataset2.lib.table.hbase.MetricHBaseTableUtil;
import co.cask.cdap.metrics.MetricsConstants;
import co.cask.cdap.metrics.process.KafkaConsumerMetaTable;
import co.cask.cdap.metrics.store.timeseries.EntityTable;
<BUG>import co.cask.cdap.metrics.store.timeseries.FactTable;
import co.cask.cdap.metrics.store.upgrade.MetricsDataMigrator;</BUG>
import co.cask.cdap.proto.Id;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
| import co.cask.cdap.metrics.store.upgrade.DataMigrationException;
import co.cask.cdap.metrics.store.upgrade.MetricsDataMigrator;
|
42,942 | import co.cask.cdap.data2.transaction.queue.QueueAdmin;
import co.cask.cdap.data2.transaction.queue.hbase.HBaseQueueAdmin;
import co.cask.cdap.data2.util.hbase.HBaseTableUtil;
import co.cask.cdap.data2.util.hbase.HBaseTableUtilFactory;
import co.cask.cdap.metrics.MetricsConstants;
<BUG>import co.cask.cdap.metrics.store.DefaultMetricDatasetFactory;
import co.cask.cdap.metrics.store.upgrade.UpgradeMetricsConstants;</BUG>
import co.cask.cdap.proto.Id;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
| import co.cask.cdap.metrics.store.upgrade.DataMigrationException;
import co.cask.cdap.metrics.store.upgrade.UpgradeMetricsConstants;
|
42,943 | import com.google.inject.assistedinject.FactoryModuleBuilder;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.client.HBaseAdmin;
<BUG>import org.slf4j.Logger;
import org.slf4j.LoggerFactory;</BUG>
import java.io.IOException;
import javax.annotation.Nullable;
public class DataMigration {
| [DELETED] |
42,944 | return Action.valueOf(action.toUpperCase());
} catch (IllegalArgumentException e) {
return null;
}
}
<BUG>private void migrateMetricsData(Injector injector, boolean keepOldTables) throws Exception {
CConfiguration cConf = injector.getInstance(CConfiguration.class);</BUG>
Configuration hConf = injector.getInstance(Configuration.class);
System.out.println("Starting metrics data migration");
MetricHBaseTableUtil metricHBaseTableUtil = new MetricHBaseTableUtil(injector.getInstance(HBaseTableUtil.class));
| private void migrateMetricsData(Injector injector, boolean keepOldTables) {
CConfiguration cConf = injector.getInstance(CConfiguration.class);
|
42,945 | package co.cask.cdap.data.tools;
<BUG>import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.AppenderBase;</BUG>
import com.google.common.collect.ImmutableList;
import org.junit.Assert;
| [DELETED] |
42,946 | new String[] {"help"});
List<String[]> invalidArgumentList = ImmutableList.of(new String[] {"metrics", "--keep-all-data"},
new String[] {"metrics", "-1", "-2", "-3"}
);
for (String[] arguments : validArgumentList) {
<BUG>logs = resetLogging();
DataMigration.testMigrationParse(arguments);
Assert.assertFalse(logs.get());</BUG>
}
| Assert.assertTrue(DataMigration.testMigrationParse(arguments));
|
42,947 | DataMigration.testMigrationParse(arguments);
Assert.assertFalse(logs.get());</BUG>
}
for (String[] arguments : invalidArgumentList) {
<BUG>logs = resetLogging();
DataMigration.testMigrationParse(arguments);
Assert.assertTrue(logs.get());</BUG>
}
| new String[] {"help"});
List<String[]> invalidArgumentList = ImmutableList.of(new String[] {"metrics", "--keep-all-data"},
new String[] {"metrics", "-1", "-2", "-3"}
for (String[] arguments : validArgumentList) {
Assert.assertTrue(DataMigration.testMigrationParse(arguments));
Assert.assertFalse(DataMigration.testMigrationParse(arguments));
|
42,948 | @Override
protected void append(ILoggingEvent eventObject) {
logMessageReceived.set(true);</BUG>
}
<BUG>};
loggerContext.getLogger(DataMigration.class).addAppender(appender);
appender.setContext(loggerContext);
appender.start();
}
return logMessageReceived;
}
}</BUG>
| new String[] {"help"});
List<String[]> invalidArgumentList = ImmutableList.of(new String[] {"metrics", "--keep-all-data"},
new String[] {"metrics", "-1", "-2", "-3"}
for (String[] arguments : validArgumentList) {
Assert.assertTrue(DataMigration.testMigrationParse(arguments));
|
42,949 | package com.cronutils.model.time.generator;
import java.util.Collections;
<BUG>import java.util.List;
import org.apache.commons.lang3.Validate;</BUG>
import com.cronutils.model.field.CronField;
import com.cronutils.model.field.expression.FieldExpression;
public abstract class FieldValueGenerator {
| import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.Validate;
|
42,950 | import java.util.ResourceBundle;
import java.util.function.Function;</BUG>
class DescriptionStrategyFactory {
private DescriptionStrategyFactory() {}
public static DescriptionStrategy daysOfWeekInstance(final ResourceBundle bundle, final FieldExpression expression) {
<BUG>final Function<Integer, String> nominal = integer -> new DateTime().withDayOfWeek(integer).dayOfWeek().getAsText(bundle.getLocale());
</BUG>
NominalDescriptionStrategy dow = new NominalDescriptionStrategy(bundle, nominal, expression);
dow.addDescription(fieldExpression -> {
if (fieldExpression instanceof On) {
| import java.util.function.Function;
import com.cronutils.model.field.expression.FieldExpression;
import com.cronutils.model.field.expression.On;
final Function<Integer, String> nominal = integer -> DayOfWeek.of(integer).getDisplayName(TextStyle.FULL, bundle.getLocale());
|
42,951 | return dom;
}
public static DescriptionStrategy monthsInstance(final ResourceBundle bundle, final FieldExpression expression) {
return new NominalDescriptionStrategy(
bundle,
<BUG>integer -> new DateTime().withMonthOfYear(integer).monthOfYear().getAsText(bundle.getLocale()),
expression</BUG>
);
}
public static DescriptionStrategy plainInstance(ResourceBundle bundle, final FieldExpression expression) {
| integer -> Month.of(integer).getDisplayName(TextStyle.FULL, bundle.getLocale()),
expression
|
42,952 | <BUG>package com.cronutils.model.time.generator;
import com.cronutils.mapper.WeekDay;</BUG>
import com.cronutils.model.field.CronField;
import com.cronutils.model.field.CronFieldName;
import com.cronutils.model.field.constraint.FieldConstraintsBuilder;
| import java.time.LocalDate;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import org.apache.commons.lang3.Validate;
import com.cronutils.mapper.WeekDay;
|
42,953 | import com.cronutils.model.field.expression.Between;
import com.cronutils.model.field.expression.FieldExpression;
import com.cronutils.parser.CronParserField;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
<BUG>import org.apache.commons.lang3.Validate;
import org.joda.time.DateTime;
import java.util.Collections;
import java.util.List;
import java.util.Set;</BUG>
class BetweenDayOfWeekValueGenerator extends FieldValueGenerator {
| [DELETED] |
42,954 | <BUG>package com.cronutils.model.time.generator;
import com.cronutils.model.field.CronField;</BUG>
import com.cronutils.model.field.CronFieldName;
import com.cronutils.model.field.expression.FieldExpression;
import com.cronutils.model.field.expression.On;
| import java.time.DayOfWeek;
import java.time.LocalDate;
import java.util.List;
import org.apache.commons.lang3.Validate;
import com.cronutils.model.field.CronField;
|
42,955 | import com.cronutils.model.field.CronField;</BUG>
import com.cronutils.model.field.CronFieldName;
import com.cronutils.model.field.expression.FieldExpression;
import com.cronutils.model.field.expression.On;
import com.google.common.collect.Lists;
<BUG>import org.apache.commons.lang3.Validate;
import org.joda.time.DateTime;
import java.util.List;</BUG>
class OnDayOfMonthValueGenerator extends FieldValueGenerator {
private int year;
| package com.cronutils.model.time.generator;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.util.List;
import com.cronutils.model.field.CronField;
|
42,956 | class OnDayOfMonthValueGenerator extends FieldValueGenerator {
private int year;
private int month;
public OnDayOfMonthValueGenerator(CronField cronField, int year, int month) {
super(cronField);
<BUG>Validate.isTrue(CronFieldName.DAY_OF_MONTH.equals(cronField.getField()), "CronField does not belong to day of month");
this.year = year;</BUG>
this.month = month;
}
| Validate.isTrue(CronFieldName.DAY_OF_MONTH.equals(cronField.getField()), "CronField does not belong to day of" +
" month");
this.year = year;
|
42,957 | package com.cronutils.mapper;
public class ConstantsMapper {
private ConstantsMapper() {}
public static final WeekDay QUARTZ_WEEK_DAY = new WeekDay(2, false);
<BUG>public static final WeekDay JODATIME_WEEK_DAY = new WeekDay(1, false);
</BUG>
public static final WeekDay CRONTAB_WEEK_DAY = new WeekDay(1, true);
public static int weekDayMapping(WeekDay source, WeekDay target, int weekday){
return source.mapTo(weekday, target);
| public static final WeekDay JAVA8 = new WeekDay(1, false);
|
42,958 | return nextMatch;
} catch (NoSuchValueException e) {
throw new IllegalArgumentException(e);
}
}
<BUG>DateTime nextClosestMatch(DateTime date) throws NoSuchValueException {
</BUG>
List<Integer> year = yearsValueGenerator.generateCandidates(date.getYear(), date.getYear());
TimeNode days = null;
int lowestMonth = months.getValues().get(0);
| ZonedDateTime nextClosestMatch(ZonedDateTime date) throws NoSuchValueException {
|
42,959 | boolean questionMarkSupported =
cronDefinition.getFieldDefinition(DAY_OF_WEEK).getConstraints().getSpecialChars().contains(QUESTION_MARK);
if(questionMarkSupported){
return new TimeNode(
generateDayCandidatesQuestionMarkSupported(
<BUG>date.getYear(), date.getMonthOfYear(),
</BUG>
((DayOfWeekFieldDefinition)
cronDefinition.getFieldDefinition(DAY_OF_WEEK)
).getMondayDoWValue()
| date.getYear(), date.getMonthValue(),
|
42,960 | )
);
}else{
return new TimeNode(
generateDayCandidatesQuestionMarkNotSupported(
<BUG>date.getYear(), date.getMonthOfYear(),
</BUG>
((DayOfWeekFieldDefinition)
cronDefinition.getFieldDefinition(DAY_OF_WEEK)
).getMondayDoWValue()
| date.getYear(), date.getMonthValue(),
|
42,961 | }
public DateTime lastExecution(DateTime date){
</BUG>
Validate.notNull(date);
try {
<BUG>DateTime previousMatch = previousClosestMatch(date);
</BUG>
if(previousMatch.equals(date)){
previousMatch = previousClosestMatch(date.minusSeconds(1));
}
| public java.time.Duration timeToNextExecution(ZonedDateTime date){
return java.time.Duration.between(date, nextExecution(date));
public ZonedDateTime lastExecution(ZonedDateTime date){
ZonedDateTime previousMatch = previousClosestMatch(date);
|
42,962 | return previousMatch;
} catch (NoSuchValueException e) {
throw new IllegalArgumentException(e);
}
}
<BUG>public Duration timeFromLastExecution(DateTime date){
return new Interval(lastExecution(date), date).toDuration();
}
public boolean isMatch(DateTime date){
</BUG>
return nextExecution(lastExecution(date)).equals(date);
| [DELETED] |
42,963 | <BUG>package com.cronutils.model.time.generator;
import com.cronutils.model.field.CronField;</BUG>
import com.cronutils.model.field.expression.Every;
import com.cronutils.model.field.expression.FieldExpression;
import com.google.common.annotations.VisibleForTesting;
| import java.time.ZonedDateTime;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.cronutils.model.field.CronField;
|
42,964 | import com.cronutils.model.field.CronField;</BUG>
import com.cronutils.model.field.expression.Every;
import com.cronutils.model.field.expression.FieldExpression;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
<BUG>import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;</BUG>
class EveryFieldValueGenerator extends FieldValueGenerator {
| package com.cronutils.model.time.generator;
import java.time.ZonedDateTime;
import java.util.List;
import com.cronutils.model.field.CronField;
|
42,965 | private static final Logger log = LoggerFactory.getLogger(EveryFieldValueGenerator.class);
public EveryFieldValueGenerator(CronField cronField) {
super(cronField);
log.trace(String.format(
"processing \"%s\" at %s",
<BUG>cronField.getExpression().asString(), DateTime.now()
</BUG>
));
}
@Override
| cronField.getExpression().asString(), ZonedDateTime.now()
|
42,966 | import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;
import com.android.volley.Response;
<BUG>import com.android.volley.VolleyError;
import com.joanzapata.iconify.IconDrawable;</BUG>
import com.joanzapata.iconify.fonts.FontAwesomeIcons;
import com.joanzapata.iconify.fonts.MaterialIcons;
import com.williamcomartin.plexpyremote.Helpers.Exceptions.NoServerException;
| import com.joanzapata.iconify.Icon;
import com.joanzapata.iconify.IconDrawable;
|
42,967 | import com.williamcomartin.plexpyremote.Models.ServerFriendlyNameModels;
import com.williamcomartin.plexpyremote.Services.NavService;
public class NavBaseActivity extends AppBaseActivity {
private ActionBarDrawerToggle mDrawerToggle;
protected DrawerLayout mainDrawerLayout;
<BUG>private NavigationView navigationView;
</BUG>
private TextView drawerText1;
private TextView drawerText2;
private SharedPreferences SP;
| protected NavigationView navigationView;
|
42,968 | SpannableString s = new SpannableString(NavBaseActivity.activeMenuItem.getTitle());
int color = getResources().getColor(R.color.colorAccent);</BUG>
s.setSpan(new ForegroundColorSpan(color), 0, s.length(), 0);
NavBaseActivity.activeMenuItem.setTitle(s);
IconDrawable activeIcon = (IconDrawable) NavBaseActivity.activeMenuItem.getIcon();
<BUG>activeIcon.colorRes(R.color.colorAccent);
}</BUG>
@Override
protected void onStart() {
super.onStart();
| activeIcon.color(color);
}
|
42,969 | container.addView(child);
decor.addView(drawer);
}
private void onNavItemClick(int itemId) {
Intent launchIntent = null;
<BUG>switch(itemId){
</BUG>
case R.id.navigation_item_activity:
setActive(R.id.navigation_item_activity);
launchIntent = new Intent(this, ActivityActivity.class);
| switch (itemId) {
|
42,970 | import com.williamcomartin.plexpyremote.Helpers.EmptyRecyclerView;
import com.williamcomartin.plexpyremote.Helpers.ErrorListener;
import com.williamcomartin.plexpyremote.Helpers.Exceptions.NoServerException;
import com.williamcomartin.plexpyremote.Helpers.GsonRequest;
import com.williamcomartin.plexpyremote.Helpers.UrlHelpers;
<BUG>import com.williamcomartin.plexpyremote.Models.ActivityModels;
import java.util.Timer;</BUG>
import java.util.TimerTask;
import java.util.ArrayList;
public class ActivityActivity extends NavBaseActivity {
| import com.williamcomartin.plexpyremote.Services.NavService;
import java.util.Timer;
|
42,971 | }
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
<BUG>setContentView(R.layout.activity_activity);
setupActionBar();</BUG>
mDrawerLayout = (DrawerLayout) findViewById(R.id.activity_drawer);
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
mDrawerLayout.addDrawerListener(new DrawerLayout.DrawerListener() {
| NavService.getInstance().currentNav = R.id.navigation_item_activity;
setIcons();
setupActionBar();
|
42,972 | } else {
updateMemo();
callback.updateMemo();
}
dismiss();
<BUG>}else{
</BUG>
Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show();
}
}
| [DELETED] |
42,973 | }
@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);
|
42,974 | 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);
|
42,975 | 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(
|
42,976 | 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 {
|
42,977 | 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;
|
42,978 | 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) {
|
42,979 | 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;
|
42,980 | <BUG>package sk.henrichg.phoneprofilesplus;
import android.graphics.Typeface;</BUG>
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
| import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Rect;
import android.graphics.Typeface;
|
42,981 | import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.RelativeLayout;
<BUG>import android.widget.TextView;
import java.util.List;</BUG>
class EditorProfileListAdapter extends BaseAdapter
{
private EditorProfileListFragment fragment;
| import com.getkeepsafe.taptargetview.TapTarget;
import com.getkeepsafe.taptargetview.TapTargetSequence;
import java.util.List;
|
42,982 | class EditorProfileListAdapter extends BaseAdapter
{
private EditorProfileListFragment fragment;
private DataWrapper dataWrapper;
private int filterType;
<BUG>List<Profile> profileList;
EditorProfileListAdapter(EditorProfileListFragment f, DataWrapper pdw, int filterType)</BUG>
{
fragment = f;
dataWrapper = pdw;
| static final String PREF_START_TARGET_HELPS = "editor_profile_list_adapter_start_target_helps";
static final String PREF_START_TARGET_HELPS_ORDER = "editor_profile_list_adapter_start_target_helps_order";
EditorProfileListAdapter(EditorProfileListFragment f, DataWrapper pdw, int filterType)
|
42,983 | listView.setItemChecked(eventPos, true);
int last = listView.getLastVisiblePosition();
int first = listView.getFirstVisiblePosition();
if ((eventPos <= first) || (eventPos >= last)) {
listView.setSelection(eventPos);
<BUG>}
showAdapterTargetHelps();</BUG>
editMode = EDIT_MODE_EDIT;
}
else
| boolean startTargetHelps = getArguments() != null && getArguments().getBoolean(START_TARGET_HELPS_ARGUMENT, false);
if (startTargetHelps)
showAdapterTargetHelps();
|
42,984 | package sk.henrichg.phoneprofilesplus;
<BUG>import android.annotation.SuppressLint;
import android.graphics.Color;
import android.graphics.Typeface;</BUG>
import android.view.LayoutInflater;
import android.view.View;
| import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Rect;
import android.graphics.Typeface;
|
42,985 | import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.RelativeLayout;
<BUG>import android.widget.TextView;
import com.labo.kaji.relativepopupwindow.RelativePopupWindow;</BUG>
import java.util.List;
class EditorEventListAdapter extends BaseAdapter
{
| import com.getkeepsafe.taptargetview.TapTarget;
import com.getkeepsafe.taptargetview.TapTargetSequence;
import com.labo.kaji.relativepopupwindow.RelativePopupWindow;
|
42,986 | private EditorEventListFragment fragment;
private DataWrapper dataWrapper;
private int filterType;
private List<Event> eventList;
boolean released = false;
<BUG>private int defaultColor;
EditorEventListAdapter(EditorEventListFragment f, DataWrapper pdw, int filterType)</BUG>
{
fragment = f;
dataWrapper = pdw;
| static final String PREF_START_TARGET_HELPS = "editor_event_list_adapter_start_target_helps";
static final String PREF_START_TARGET_HELPS_ORDER = "editor_event_list_adapter_start_target_helps_order";
EditorEventListAdapter(EditorEventListFragment f, DataWrapper pdw, int filterType)
|
42,987 | DescribeSnapshotAttributeResponseType reply = request.getReply( );
reply.setSnapshotId(request.getSnapshotId());
final Context ctx = Contexts.lookup( );
final String snapshotId = normalizeSnapshotIdentifier( request.getSnapshotId( ) );
try (TransactionResource db = Entities.transactionFor(Snapshot.class)) {
<BUG>Snapshot result = Entities.uniqueResult(Snapshot.named( ctx.getUserFullName( ).asAccountFullName( ), snapshotId));
if( !RestrictedTypes.filterPrivileged( ).apply( result ) ) {</BUG>
throw new EucalyptusCloudException("Not authorized to describe attributes for snapshot " + request.getSnapshotId());
}
ArrayList<CreateVolumePermissionItemType> permissions = Lists.newArrayList();
| Snapshot result = Entities.uniqueResult( Snapshot.named(
ctx.isAdministrator( ) ? null : ctx.getUserFullName( ).asAccountFullName( ),
snapshotId ) );
if( !RestrictedTypes.filterPrivileged( ).apply( result ) ) {
|
42,988 | import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.LocalFileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.util.Progressable;
<BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*;
public class S3AFileSystem extends FileSystem {</BUG>
private URI uri;
private Path workingDir;
private AmazonS3Client s3;
| import static org.apache.hadoop.fs.s3a.Constants.*;
public class S3AFileSystem extends FileSystem {
|
42,989 | public void initialize(URI name, Configuration conf) throws IOException {
super.initialize(name, conf);
uri = URI.create(name.getScheme() + "://" + name.getAuthority());
workingDir = new Path("/user", System.getProperty("user.name")).makeQualified(this.uri,
this.getWorkingDirectory());
<BUG>String accessKey = conf.get(ACCESS_KEY, null);
String secretKey = conf.get(SECRET_KEY, null);
</BUG>
String userInfo = name.getUserInfo();
| String accessKey = conf.get(NEW_ACCESS_KEY, conf.get(OLD_ACCESS_KEY, null));
String secretKey = conf.get(NEW_SECRET_KEY, conf.get(OLD_SECRET_KEY, null));
|
42,990 | } else {
accessKey = userInfo;
}
}
AWSCredentialsProviderChain credentials = new AWSCredentialsProviderChain(
<BUG>new S3ABasicAWSCredentialsProvider(accessKey, secretKey),
new InstanceProfileCredentialsProvider(),
new S3AAnonymousAWSCredentialsProvider()
);</BUG>
bucket = name.getHost();
| new BasicAWSCredentialsProvider(accessKey, secretKey),
new AnonymousAWSCredentialsProvider()
|
42,991 |
awsConf.setSocketTimeout(conf.getInt(SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT));
</BUG>
s3 = new AmazonS3Client(credentials, awsConf);
<BUG>maxKeys = conf.getInt(MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS);
partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE);
partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD);
</BUG>
if (partSize < 5 * 1024 * 1024) {
| new InstanceProfileCredentialsProvider(),
new AnonymousAWSCredentialsProvider()
bucket = name.getHost();
ClientConfiguration awsConf = new ClientConfiguration();
awsConf.setMaxConnections(conf.getInt(NEW_MAXIMUM_CONNECTIONS, conf.getInt(OLD_MAXIMUM_CONNECTIONS, DEFAULT_MAXIMUM_CONNECTIONS)));
awsConf.setProtocol(conf.getBoolean(NEW_SECURE_CONNECTIONS, conf.getBoolean(OLD_SECURE_CONNECTIONS, DEFAULT_SECURE_CONNECTIONS)) ? Protocol.HTTPS : Protocol.HTTP);
awsConf.setMaxErrorRetry(conf.getInt(NEW_MAX_ERROR_RETRIES, conf.getInt(OLD_MAX_ERROR_RETRIES, DEFAULT_MAX_ERROR_RETRIES)));
awsConf.setSocketTimeout(conf.getInt(NEW_SOCKET_TIMEOUT, conf.getInt(OLD_SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT)));
maxKeys = conf.getInt(NEW_MAX_PAGING_KEYS, conf.getInt(OLD_MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS));
partSize = conf.getLong(NEW_MULTIPART_SIZE, conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE));
partSizeThreshold = conf.getInt(NEW_MIN_MULTIPART_THRESHOLD, conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD));
|
42,992 | cannedACL = null;
}
if (!s3.doesBucketExist(bucket)) {
throw new IOException("Bucket " + bucket + " does not exist");
}
<BUG>boolean purgeExistingMultipart = conf.getBoolean(PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART);
long purgeExistingMultipartAge = conf.getLong(PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE);
</BUG>
if (purgeExistingMultipart) {
| boolean purgeExistingMultipart = conf.getBoolean(NEW_PURGE_EXISTING_MULTIPART, conf.getBoolean(OLD_PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART));
long purgeExistingMultipartAge = conf.getLong(NEW_PURGE_EXISTING_MULTIPART_AGE, conf.getLong(OLD_PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE));
|
42,993 | import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
<BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*;
public class S3AOutputStream extends OutputStream {</BUG>
private OutputStream backupStream;
private File backupFile;
private boolean closed;
| import static org.apache.hadoop.fs.s3a.Constants.*;
public class S3AOutputStream extends OutputStream {
|
42,994 | this.client = client;
this.progress = progress;
this.fs = fs;
this.cannedACL = cannedACL;
this.statistics = statistics;
<BUG>partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE);
partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD);
</BUG>
if (conf.get(BUFFER_DIR, null) != null) {
| partSize = conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE);
partSizeThreshold = conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD);
|
42,995 | <BUG>package dr.evolution.tree;
import java.util.ArrayList;</BUG>
public class KCPathDifferenceMetric {
public KCPathDifferenceMetric() {
}
| import dr.evolution.io.Importer;
import dr.evolution.io.NewickImporter;
import java.io.IOException;
import java.util.ArrayList;
|
42,996 | import java.util.ArrayList;</BUG>
public class KCPathDifferenceMetric {
public KCPathDifferenceMetric() {
}
public ArrayList<Double> getMetric(Tree tree1, Tree tree2, ArrayList<Double> lambda) {
<BUG>int dim = tree1.getExternalNodeCount()*tree1.getExternalNodeCount();
</BUG>
double[] smallMOne = new double[dim];
double[] largeMOne = new double[dim];
double[] smallMTwo = new double[dim];
| package dr.evolution.tree;
import dr.evolution.io.Importer;
import dr.evolution.io.NewickImporter;
import java.io.IOException;
import java.util.ArrayList;
int dim = (tree1.getExternalNodeCount()-2)*(tree1.getExternalNodeCount()-1)+tree1.getExternalNodeCount();
|
42,997 | double[] largeMTwo = new double[dim];
if (tree1.getExternalNodeCount() != tree2.getExternalNodeCount()) {
throw new RuntimeException("Different number of taxa in both trees.");
} else {
for (int i = 0; i < tree1.getExternalNodeCount(); i++) {
<BUG>if (tree1.getNodeTaxon(tree1.getExternalNode(i)) != tree2.getNodeTaxon(tree2.getExternalNode(i))) {
throw new RuntimeException("Mismatch between taxa in both trees: " + tree1.getNodeTaxon(tree1.getExternalNode(i)) + " vs. " + tree2.getNodeTaxon(tree2.getExternalNode(i)));
</BUG>
}
| if (!tree1.getNodeTaxon(tree1.getExternalNode(i)).getId().equals(tree2.getNodeTaxon(tree2.getExternalNode(i)).getId())) {
throw new RuntimeException("Mismatch between taxa in both trees: " + tree1.getNodeTaxon(tree1.getExternalNode(i)).getId() + " vs. " + tree2.getNodeTaxon(tree2.getExternalNode(i)).getId());
|
42,998 | NodeRef MRCA = Tree.Utils.getCommonAncestor(tree1, nodeOne, nodeTwo);
int edges = 0;
double branchLengths = 0.0;
while (MRCA != tree1.getRoot()) {
edges++;
<BUG>branchLengths += tree1.getNodeHeight(tree1.getRoot()) - tree1.getNodeHeight(MRCA);
</BUG>
MRCA = tree1.getParent(MRCA);
}
smallMOne[index] = edges;
| branchLengths += tree1.getNodeHeight(tree1.getParent(MRCA)) - tree1.getNodeHeight(MRCA);
|
42,999 | NodeRef MRCA = Tree.Utils.getCommonAncestor(tree2, nodeOne, nodeTwo);
int edges = 0;
double branchLengths = 0.0;
while (MRCA != tree2.getRoot()) {
edges++;
<BUG>branchLengths += tree2.getNodeHeight(tree2.getRoot()) - tree2.getNodeHeight(MRCA);
</BUG>
MRCA = tree2.getParent(MRCA);
}
smallMTwo[index] = edges;
| branchLengths += tree2.getNodeHeight(tree2.getParent(MRCA)) - tree2.getNodeHeight(MRCA);
|
43,000 | }
@RootTask
static Task<Exec.Result> exec(String parameter, int number) {
Task<String> task1 = MyTask.create(parameter);
Task<Integer> task2 = Adder.create(number, number + 2);
<BUG>return Task.ofType(Exec.Result.class).named("exec", "/bin/sh")
.in(() -> task1)</BUG>
.in(() -> task2)
.process(Exec.exec((str, i) -> args("/bin/sh", "-c", "\"echo " + i + "\"")));
}
| return Task.named("exec", "/bin/sh").ofType(Exec.Result.class)
.in(() -> task1)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.