id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
24,401
private static class NewItLinesAndConditionsCoverageFormula extends NewLinesAndConditionsFormula { private static final NewCoverageOutputMetricKeys OUTPUT_METRIC_KEYS = new NewCoverageOutputMetricKeys( CoreMetrics.NEW_IT_LINES_TO_COVER_KEY, CoreMetrics.NEW_IT_UNCOVERED_LINES_KEY, CoreMetrics.NEW_IT_CONDITIONS_TO_COVER_...
private NewItLinesAndConditionsCoverageFormula(ScmInfoRepository scmInfoRepository) { super(scmInfoRepository, new NewCoverageInputMetricKeys(
24,402
private static class NewOverallLinesAndConditionsCoverageFormula extends NewLinesAndConditionsFormula { private static final NewCoverageOutputMetricKeys OUTPUT_METRIC_KEYS = new NewCoverageOutputMetricKeys( CoreMetrics.NEW_OVERALL_LINES_TO_COVER_KEY, CoreMetrics.NEW_OVERALL_UNCOVERED_LINES_KEY, CoreMetrics.NEW_OVERALL_...
private NewOverallLinesAndConditionsCoverageFormula(ScmInfoRepository scmInfoRepository) { super(scmInfoRepository, new NewCoverageInputMetricKeys(
24,403
public static final class NewCoverageCounter implements org.sonar.server.computation.formula.Counter<NewCoverageCounter> { private final IntVariationValue.Array newLines = IntVariationValue.newArray(); private final IntVariationValue.Array newCoveredLines = IntVariationValue.newArray(); private final IntVariationValue....
private final ScmInfoRepository scmInfoRepository; public NewCoverageCounter(ScmInfoRepository scmInfoRepository, NewCoverageInputMetricKeys metricKeys) { this.scmInfoRepository = scmInfoRepository; this.metricKeys = metricKeys;
24,404
newCoveredConditions.incrementAll(counter.newCoveredConditions); } @Override public void initialize(CounterInitializationContext context) { Component fileComponent = context.getLeaf(); <BUG>BatchReport.Changesets componentScm = batchReportReader.readChangesets(fileComponent.getReportAttributes().getRef()); if (componen...
Optional<ScmInfo> scmInfoOptional = scmInfoRepository.getScmInfo(fileComponent); if (!scmInfoOptional.isPresent()) { ScmInfo componentScm = scmInfoOptional.get(); Optional<Measure> hitsByLineMeasure = context.getMeasure(metricKeys.getCoverageLineHitsData());
24,405
Map<Integer, Integer> coveredConditionsByLine = parseCountByLine(context.getMeasure(metricKeys.getCoveredConditionsByLine())); for (Map.Entry<Integer, Integer> entry : hitsByLine.entrySet()) { int lineId = entry.getKey(); int hits = entry.getValue(); int conditions = (Integer) ObjectUtils.defaultIfNull(conditionsByLine...
long date = componentScm.getChangesetForLine(lineId).getDate();
24,406
if (object == null) return null; if (adapterType.isInstance(object)) return (T) object; if (object instanceof IAdaptable) <BUG>return (T) ((IAdaptable) object).getAdapter(adapterType); return null;</BUG> } public static Shell getDefaultParentShell() { return PlatformUI.getWorkbench().getModalDialogShellProvider().getSh...
return ((IAdaptable) object).getAdapter(adapterType);
24,407
return baseLocation; if (mirrors == null) mirrors = new MirrorSelector(this, getTransport()); return mirrors.getMirrorLocation(baseLocation, monitor); } <BUG>public Object getAdapter(Class adapter) { </BUG> if (adapter == IFileArtifactRepository.class) if (!isLocal()) return null;
public <T> T getAdapter(Class<T> adapter) {
24,408
import java.util.Collection; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.SubMonitor; import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.ui.*; <BUG>import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadat...
import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.IRequirement;
24,409
package org.eclipse.equinox.internal.p2.ui.model; import java.util.Collection; import org.eclipse.core.runtime.IProgressMonitor; <BUG>import org.eclipse.equinox.internal.p2.ui.*; import org.eclipse.equinox.p2.metadata.*; </BUG> import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription; public cl...
import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.IRequirement;
24,410
import org.eclipse.equinox.p2.repository.IRepository; import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; public class ProvUIAdapterFactory implements IAdapterFactory { private static final Class<?>[] CLASSES = new Class[] {IInsta...
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
24,411
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 FileSyste...
import static org.apache.hadoop.fs.s3a.Constants.*; public class S3AFileSystem extends FileSystem {
24,412
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(...
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));
24,413
} 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()
24,414
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_THR...
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.g...
24,415
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_...
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...
24,416
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 backup...
import static org.apache.hadoop.fs.s3a.Constants.*; public class S3AOutputStream extends OutputStream {
24,417
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) ...
partSize = conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD);
24,418
package nl.jqno.equalsverifier.internal.prefabvalues.factories; import nl.jqno.equalsverifier.internal.prefabvalues.PrefabValues; <BUG>import nl.jqno.equalsverifier.internal.prefabvalues.TypeTag; import java.util.ArrayList;</BUG> import java.util.LinkedHashSet; import java.util.List; public abstract class AbstractRefle...
import nl.jqno.equalsverifier.internal.exceptions.ReflectionException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList;
24,419
Object black = createWith(prefabValues.giveBlack(keyTag), prefabValues.giveBlack(valueTag)); return Tuple.of(red, black); } @SuppressWarnings("rawtypes") private Object createWith(Object key, Object value) { <BUG>Map map = new HashMap(); try { Method add = Map.class.getMethod("put", Object.class, Object.class); add.inv...
invoke(Map.class, map, "put", classes(Object.class, Object.class), objects(key, value));
24,420
protected String pass = null; protected boolean ignoreIMs = false; protected boolean requireApproval = true; protected boolean assignColors = false; protected boolean forceNodeWidth = false; <BUG>protected boolean makeTables = false; protected BosFlapConn bosConn = null;</BUG> protected Set services = new HashSet(); pr...
protected boolean keepAt100 =false; protected BosFlapConn bosConn = null;
24,421
private JButton resetApproveButton = null; private JCheckBox ignoreCheckbox = null; private JCheckBox approveCheckbox = null; private JCheckBox assignColorCheckbox = null; private JCheckBox nodeWidthCheckbox = null; <BUG>private JCheckBox makeTableCheckbox = null; public VueAimPanel() {</BUG> JPanel innerPanel = new JP...
private JCheckBox zoomCheckbox = null; public VueAimPanel() {
24,422
mPasswordEditor = new JPasswordField(); assignColorCheckbox = new JCheckBox(VueResources.getString("im.button.assigncolor")); ignoreCheckbox = new JCheckBox(VueResources.getString("im.button.ignore")); approveCheckbox = new JCheckBox(VueResources.getString("im.button.approve"),true); nodeWidthCheckbox = new JCheckBox(V...
zoomCheckbox = new JCheckBox(VueResources.getString("im.button.zoom"),true); resetApproveButton = new JButton(VueResources.getString("im.approve.reset"));
24,423
resetApproveButton.addActionListener(this); ignoreCheckbox.addItemListener(this); approveCheckbox.addItemListener(this); nodeWidthCheckbox.addItemListener(this); makeTableCheckbox.addItemListener(this); <BUG>assignColorCheckbox.addItemListener(this); mPropPanel = new PropertyPanel();</BUG> mPropPanel.addProperty(VueRe...
zoomCheckbox.addItemListener(this); mPropPanel = new PropertyPanel();
24,424
aim.connect(); aim.ignoreIMs(ignoreCheckbox.isSelected()); aim.requireApprovalToCollaborate(approveCheckbox.isSelected()); aim.assignColorsToContributors(assignColorCheckbox.isSelected()); aim.forceUniformNodeWidth(nodeWidthCheckbox.isSelected()); <BUG>aim.forceNodesIntoTable(makeTableCheckbox.isSelected()); }</BUG> } ...
aim.keepMapAtOneToOne(zoomCheckbox.isSelected());
24,425
import java.net.InetAddress; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; <BUG>import java.util.Calendar; import java.util.Date;</BUG> import java.util.HashMap; import java.util.Iterator; import java.util.List;
import java.util.Collection; import java.util.Date;
24,426
import tufts.vue.VUE; import tufts.vue.VueResources; import tufts.vue.VueUtil; import tufts.vue.NodeTool.NodeModeTool; import edu.tufts.vue.collab.im.security.SecureSession; <BUG>import edu.tufts.vue.collab.im.security.SecureSessionException; import edu.tufts.vue.metadata.MetadataList;</BUG> public abstract class Basic...
import edu.tufts.vue.layout.TabularLayout; import edu.tufts.vue.metadata.MetadataList;
24,427
if (this.approvedSenders !=null) { approvedSenders.clear(); } } <BUG>protected void handleSnacPacket(SnacPacketEvent e) { </BUG> SnacPacket packet = e.getSnacPacket(); System.out.println("got snac packet type " + Integer.toHexString(packet.getFamily()) + "/"
protected synchronized void handleSnacPacket(SnacPacketEvent e) {
24,428
import com.android.vending.billing.IabHelper; import com.android.vending.billing.IabResult; import com.android.vending.billing.Inventory; import com.android.vending.billing.tvbarthel.utils.SupportUtils; import fr.tvbarthel.attempt.googlyzooapp.R; <BUG>public class DonateCheckActivity extends Activity { </BUG> private b...
public class DonateCheckActivity extends FragmentActivity {
24,429
if(worldIn.getTileEntity(pos) != null){ TileEntity te = worldIn.getTileEntity(pos); if(te.hasCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null) && te.getCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null).getTemp() >= -273D + mult){ te.getCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null).addHeat(-mult); } <...
if(te.hasCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null)){ te.getCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null).addHeat(mult);
24,430
public static double betterRound(double numIn, int decPlac){ double opOn = Math.round(numIn * Math.pow(10, decPlac)) / Math.pow(10D, decPlac); return opOn; } public static double centerCeil(double numIn, int tiers){ <BUG>return ((numIn > 0) ? Math.ceil(numIn * tiers) : Math.floor(numIn * tiers)) / tiers; </BUG> } publi...
return ((numIn > 0) ? Math.ceil(numIn * (double) tiers) : Math.floor(numIn * (double) tiers)) / (double) tiers;
24,431
package com.Da_Technomancer.crossroads.API; import com.Da_Technomancer.crossroads.API.DefaultStorageHelper.DefaultStorage; import com.Da_Technomancer.crossroads.API.heat.DefaultHeatHandler; import com.Da_Technomancer.crossroads.API.heat.IHeatHandler; import com.Da_Technomancer.crossroads.API.magic.DefaultMagicHandler; ...
import com.Da_Technomancer.crossroads.API.rotary.DefaultAxleHandler; import com.Da_Technomancer.crossroads.API.rotary.DefaultCogHandler; import com.Da_Technomancer.crossroads.API.rotary.IAxleHandler; import com.Da_Technomancer.crossroads.API.rotary.ICogHandler;
24,432
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityInject; import net.minecraftforge.common.capabilities.CapabilityManager; public class Capabilities{ @CapabilityInject(IHeatHandler.class) <BUG>public static Capability<IHeatHandler> HEAT_HANDLER_CAPABILITY ...
@CapabilityInject(IAxleHandler.class) public static Capability<IAxleHandler> AXLE_HANDLER_CAPABILITY = null; @CapabilityInject(ICogHandler.class) public static Capability<ICogHandler> COG_HANDLER_CAPABILITY = null;
24,433
public IEffect getMixEffect(Color col){ if(col == null){ return effect; } int top = Math.max(col.getBlue(), Math.max(col.getRed(), col.getGreen())); <BUG>if(top < rand.nextInt(128) + 128){ return voidEffect;</BUG> } return effect; }
if(top != 255){ return voidEffect;
24,434
public String keyspace; // cassandra keyspace user is authenticating public boolean batch = false; // enable/disable batch processing mode public String filename = ""; // file to read commands from public int jmxPort = 7199;// JMX service port public boolean verbose = false; // verbose output <BUG>public int...
public TTransportFactory transportFactory = new FramedTransportFactory(); public InputStream in;
24,435
package org.apache.cassandra.cli; <BUG>import org.apache.commons.cli.*; public class CliOptions</BUG> { private static CLIOptions options = null; // Info about command line options private static final String TOOL_NAME = "cassandra-cli";
import org.apache.cassandra.cli.transport.SimpleTransportFactory; import org.apache.thrift.transport.TTransportFactory; public class CliOptions
24,436
{ private static CLIOptions options = null; // Info about command line options private static final String TOOL_NAME = "cassandra-cli"; private static final String HOST_OPTION = "host"; private static final String PORT_OPTION = "port"; <BUG>private static final String UNFRAME_OPTION = "unframed"; private static final S...
private static final String TRANSPORT_FACTORY = "transport-factory"; private static final String DEBUG_OPTION = "debug";
24,437
options.addOption("u", USERNAME_OPTION, "USERNAME", "user name for cassandra authentication"); options.addOption("pw", PASSWORD_OPTION, "PASSWORD", "password for cassandra authentication"); options.addOption("k", KEYSPACE_OPTION, "KEYSPACE", "cassandra keyspace user is authenticated against"); options.addOption("f", ...
options.addOption("tf", TRANSPORT_FACTORY, "TRANSPORT-FACTORY", "Fully-qualified TTransportFactory class name for creating a connection to cassandra"); options.addOption("B", BATCH_OPTION, "enabled batch mode (suppress output; errors are fatal)");
24,438
public ReportElement getBase() { return base; } @Override public float print(PDDocument document, PDPageContentStream stream, int pageNumber, float startX, float startY, float allowedWidth) throws IOException { <BUG>PDPage currPage = (PDPage) document.getDocumentCatalog().getPages().get(pageNo); PDPageContentStream pag...
PDPage currPage = document.getDocumentCatalog().getPages().get(pageNo); PDPageContentStream pageStream = new PDPageContentStream(document, currPage, PDPageContentStream.AppendMode.APPEND, false);
24,439
public PdfTextStyle(String config) { Assert.hasText(config); String[] split = config.split(","); Assert.isTrue(split.length == 3, "config must look like: 10,Times-Roman,#000000"); fontSize = Integer.parseInt(split[0]); <BUG>font = resolveStandard14Name(split[1]); color = new Color(Integer.valueOf(split[2].substring(1),...
font = getFont(split[1]); color = new Color(Integer.valueOf(split[2].substring(1), 16));
24,440
package cc.catalysts.boot.report.pdf.elements; import cc.catalysts.boot.report.pdf.config.PdfTextStyle; import cc.catalysts.boot.report.pdf.utils.ReportAlignType; import org.apache.pdfbox.pdmodel.PDPageContentStream; <BUG>import org.apache.pdfbox.pdmodel.font.PDFont; import org.slf4j.Logger;</BUG> import org.slf4j.Logg...
import org.apache.pdfbox.pdmodel.font.PDType1Font; import org.apache.pdfbox.util.Matrix; import org.slf4j.Logger;
24,441
addTextSimple(stream, textConfig, textX, nextLineY, ""); return nextLineY; } try { <BUG>String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, fixedText); </BUG> float x = calculateAlignPosition(textX, align, textConfig, allowedWidth, split[0]); if (!underline) { addTextSimple(stream, ...
String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, text);
24,442
public static void addTextSimple(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) { try { stream.setFont(textConfig.getFont(), textConfig.getFontSize()); stream.setNonStrokingColor(textConfig.getColor()); stream.beginText(); <BUG>stream.newLineAtOffset(textX, textY); stream.sh...
stream.setTextMatrix(new Matrix(1,0,0,1, textX, textY)); stream.showText(text);
24,443
public static void addTextSimpleUnderlined(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) { addTextSimple(stream, textConfig, textX, textY, text); try { float lineOffset = textConfig.getFontSize() / 8F; stream.setStrokingColor(textConfig.getColor()); <BUG>stream.setLineWidth...
stream.moveTo(textX, textY - lineOffset); stream.lineTo(textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset);
24,444
list.add(text.length()); return list; } public static String[] splitText(PDFont font, int fontSize, float allowedWidth, String text) { String endPart = ""; <BUG>String shortenedText = text; List<String> breakSplitted = Arrays.asList(shortenedText.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList()); ...
List<String> breakSplitted = Arrays.asList(text.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList()); if (breakSplitted.size() > 1) {
24,445
package cc.catalysts.boot.report.pdf.elements; import org.apache.pdfbox.pdmodel.PDDocument; <BUG>import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; import java.io.IOException;</BUG> import java.util.ArrayList; import java.util.Collection; import java.util.LinkedList;
import org.apache.pdfbox.pdmodel.PDPageContentStream; import java.io.IOException;
24,446
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.jetbrains.numpy.documentation.NumPyDocString; import com.jetbrains.numpy.documentation.NumPyDocStringParameter; <BUG>import com.jetbrains.python.psi.*; import com.jetbrains.python.psi.types.PyTyp...
import com.jetbrains.python.psi.impl.PyBuiltinCache; import com.jetbrains.python.psi.impl.PyExpressionCodeFragmentImpl; import com.jetbrains.python.psi.types.PyType;
24,447
import org.opennms.netmgt.utils.RelaxedX509TrustManager; @Distributable final public class NrpeMonitor extends IPv4Monitor { private static final int DEFAULT_RETRY = 0; private static final int DEFAULT_TIMEOUT = 3000; // 3 second timeout on <BUG>private static final boolean DEFAULT_USESSL = false; private boolean m_us...
private static final boolean DEFAULT_USE_SSL = false;
24,448
} TimeoutTracker tracker = new TimeoutTracker(parameters, DEFAULT_RETRY, DEFAULT_TIMEOUT); String command = ParameterMap.getKeyedString(parameters, "command", NrpePacket.HELLO_COMMAND); int port = ParameterMap.getKeyedInteger(parameters, "port", CheckNrpe.DEFAULT_PORT); int padding = ParameterMap.getKeyedInteger(parame...
boolean useSsl = ParameterMap.getKeyedBoolean(parameters, "usessl", DEFAULT_USE_SSL);
24,449
socket = new Socket(); socket.connect(new InetSocketAddress(ipv4Addr, port), tracker.getConnectionTimeout()); socket.setSoTimeout(tracker.getSoTimeout()); log().debug("NrpeMonitor: connected to host: " + ipv4Addr + " on port: " + port); reason = "Perhaps check the value of 'usessl' for this monitor against the NRPE dae...
socket = wrapSocket(socket, useSsl);
24,450
return PollStatus.get(serviceStatus, responseTime); } else { return PollStatus.get(serviceStatus, reason); } } <BUG>protected Socket wrapSocket(Socket socket) throws IOException { if (! m_useSsl) { return socket;</BUG> }
protected Socket wrapSocket(Socket socket, boolean useSsl) throws IOException { if (! useSsl) { return socket;
24,451
private Map<String, AuthenticatorDescription> authenticators = new LinkedHashMap<>(); private List<OnAccountsUpdateListener> listeners = new ArrayList<>(); private Map<Account, Map<String, String>> userData = new HashMap<>(); private Map<Account, String> passwords = new HashMap<>(); private Map<Account, Set<String>> ac...
private BaseRoboAccountManagerFuture<Bundle> pendingAddFuture;
24,452
listener.onAccountsUpdated(accounts); } } public void addAccount(Account account) { accounts.add(account); <BUG>if (pendingAddCallback != null) { pendingAddFuture.resultBundle.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); pendingAddCallback.run(pendingAddFuture);</BUG> }
if (pendingAddFuture != null) { pendingAddFuture.result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);
24,453
@Override public T getResult(long timeout, TimeUnit unit) throws OperationCanceledException, IOException, AuthenticatorException { return getResult(); } public abstract T doWork() throws OperationCanceledException, IOException, AuthenticatorException; <BUG>} private class RoboAccountManagerFuture implements AccountMana...
public boolean cancel(boolean mayInterruptIfRunning) { return false;
24,454
import android.content.Context; import android.os.Bundle; import android.os.Handler; import org.junit.Before; import org.junit.Test; <BUG>import org.junit.runner.RunWith; import org.robolectric.Robolectric;</BUG> import org.robolectric.RuntimeEnvironment; import org.robolectric.TestRunners; import org.robolectric.annot...
import org.mockito.Mock; import org.robolectric.Robolectric;
24,455
import org.robolectric.TestRunners; import org.robolectric.annotation.Config; import java.io.IOException; import static android.os.Build.VERSION_CODES.LOLLIPOP; import static org.assertj.core.api.Assertions.assertThat; <BUG>import static org.assertj.core.api.Assertions.fail; import static org.robolectric.Shadows.shadow...
import static org.mockito.Mockito.mock; import static org.robolectric.Shadows.shadowOf;
24,456
public void addAccount_withOptionsShouldSupportGetNextAddAccountOptions() throws Exception { assertThat(shadowOf(am).getNextAddAccountOptions()).isNull(); shadowOf(am).addAuthenticator("google.com"); Bundle expectedAddAccountOptions = new Bundle(); expectedAddAccountOptions.putString("option", "value"); <BUG>am.addAcco...
AccountManagerFuture<Bundle> future = am.addAccount("google.com", "auth_token_type", null, expectedAddAccountOptions, new Activity(), null, null); future.getResult(); Bundle actualAddAccountOptions = shadowOf(am).getNextAddAccountOptions();
24,457
public void addAccount_withOptionsShouldSupportPeekNextAddAccountOptions() throws Exception { assertThat(shadowOf(am).peekNextAddAccountOptions()).isNull(); shadowOf(am).addAuthenticator("google.com"); Bundle expectedAddAccountOptions = new Bundle(); expectedAddAccountOptions.putString("option", "value"); <BUG>am.addAc...
AccountManagerFuture<Bundle> futureResult = am.addAccount("google.com", "auth_token_type", null, expectedAddAccountOptions, new Activity(), null, null); futureResult.getResult(); Bundle actualAddAccountOptions = shadowOf(am).peekNextAddAccountOptions();
24,458
new Handler()); assertThat(future.isDone()).isFalse(); assertThat(future.getResult().getString(AccountManager.KEY_ACCOUNT_NAME)).isEqualTo(account.name); assertThat(future.getResult().getString(AccountManager.KEY_ACCOUNT_TYPE)).isEqualTo(account.type); assertThat(future.getResult().getString(AccountManager.KEY_AUTHTOKE...
assertThat(callback.accountManagerFuture).isNotNull(); }
24,459
shadowOf(am).setFeatures(account, new String[] { "FEATURE_1", "FEATURE_2" }); TestAccountManagerCallback<Boolean> callback = new TestAccountManagerCallback<>(); AccountManagerFuture<Boolean> future = am.hasFeatures(account, new String[] { "FEATURE_1", "FEATURE_2" }, callback, new Handler()); assertThat(future.isDone())...
assertThat(callback.accountManagerFuture).isNotNull(); }
24,460
shadowOf(am).setFeatures(account, new String[] { "FEATURE_1" }); TestAccountManagerCallback<Boolean> callback = new TestAccountManagerCallback<>(); AccountManagerFuture<Boolean> future = am.hasFeatures(account, new String[] { "FEATURE_1", "FEATURE_2" }, callback, new Handler()); assertThat(future.isDone()).isFalse(); a...
assertThat(callback.accountManagerFuture).isNotNull(); }
24,461
shadowOf(am).setFeatures(accountWithCorrectFeaturesButNotType, new String[] { "FEATURE_1", "FEATURE_2" }); TestAccountManagerCallback<Account[]> callback = new TestAccountManagerCallback<>(); AccountManagerFuture<Account[]> future = am.getAccountsByTypeAndFeatures("google.com", new String[] { "FEATURE_1", "FEATURE_2" }...
assertThat(callback.accountManagerFuture).isNotNull(); }
24,462
public void propertyChanged(VirtualFilePropertyEvent event) { if (event.getPropertyName().equals(VirtualFile.PROP_NAME)) { myCache.clear(); } } <BUG>}, module); } public synchronized List<PsiElement> get(PyQualifiedName qualifiedName) { return myCache.get(qualifiedName); } public synchronized void put(PyQualifiedName q...
[DELETED]
24,463
} @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...
return Task.named("exec", "/bin/sh").ofType(Exec.Result.class) .in(() -> task1)
24,464
return args; } static class MyTask { static final int PLUS = 10; static Task<String> create(String parameter) { <BUG>return Task.ofType(String.class).named("MyTask", parameter) .in(() -> Adder.create(parameter.length(), PLUS))</BUG> .in(() -> Fib.create(parameter.length())) .process((sum, fib) -> something(parameter, s...
return Task.named("MyTask", parameter).ofType(String.class) .in(() -> Adder.create(parameter.length(), PLUS))
24,465
final String instanceField = "from instance"; final TaskContext context = TaskContext.inmem(); final AwaitingConsumer<String> val = new AwaitingConsumer<>(); @Test public void shouldJavaUtilSerialize() throws Exception { <BUG>Task<Long> task1 = Task.ofType(Long.class).named("Foo", "Bar", 39) .process(() -> 9999L); Task...
Task<Long> task1 = Task.named("Foo", "Bar", 39).ofType(Long.class) Task<String> task2 = Task.named("Baz", 40).ofType(String.class) .in(() -> task1)
24,466
assertEquals(des.id().name(), "Baz"); assertEquals(val.awaitAndGet(), "[9999] hello 10004"); } @Test(expected = NotSerializableException.class) public void shouldNotSerializeWithInstanceFieldReference() throws Exception { <BUG>Task<String> task = Task.ofType(String.class).named("WithRef") .process(() -> instanceField +...
Task<String> task = Task.named("WithRef").ofType(String.class) .process(() -> instanceField + " causes an outer reference");
24,467
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.e...
Task<String> task = Task.named("WithLocalRef").ofType(String.class) .process(() -> local + " won't cause an outer reference");
24,468
} @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);
24,469
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);
24,470
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);
24,471
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(() ...
TaskBuilder<Long> fib = Task.named("Fib", n).ofType(Long.class);
24,472
public void measure_with_annotatedFile_should_saveExpectedMeasuresAfterHavingRegroupedThemBySmellType() { Mockito.when(this.inputFile.file()) .thenReturn(new File("src/test/resources/SmellMeasurerTest_3.java")); final SmellMeasurer sut = new SmellMeasurer(this.sensorContext); sut.measure(this.inputFile); <BUG>final Arg...
final Resource resource = Mockito.verify(this.sensorContext, Mockito.times(2)) .getResource(Matchers.eq(this.inputFile)); Mockito.verify(this.sensorContext, Mockito.times(3)) .saveMeasure(Matchers.eq(resource), captor.capture()); Mockito.verifyNoMoreInteractions(this.sensorContext);
24,473
package com.qualinsight.plugins.sonarqube.smell.internal.check; import org.junit.Ignore; import org.junit.Test; import com.qualinsight.libs.sonarqube.test.check.JavaCheckAssertions; import com.qualinsight.plugins.sonarqube.smell.plugin.check.SmellCheck; <BUG>@Ignore("Test need to be rewritten after migration to SQ 5.2"...
@Ignore("Guava version clash due to sslr-squid-bridge dependency") public class SmellCheckTest {
24,474
final String fileContent = getFileAsString(inputFile.file(), Charsets.UTF_8); measureSmellTypes(inputFile, fileContent); measureSmellDebt(inputFile, fileContent); } private void measureSmellTypes(final InputFile inputFile, final String fileContent) { <BUG>final Integer smellCount = 0; final Map<SmellType, Integer> file...
final Map<SmellType, Integer> fileMeasures = parseAnnotations(fileContent);
24,475
MapElement element = map.getElement(row, column); boolean visible = map.isVisible(row, column); int skillPoints = character.getSkills().getSkillPoints(Skill.SKILL_DETECT_VITALITY); int radius = 1 + skillPoints; MapElement characterElement = character.getMapElement(); <BUG>double distance = Math.sqrt(Math.pow(characterE...
int distance = Math.max(Math.abs(characterElement.getRow() - row), Math.abs(characterElement.getColumn() - column));
24,476
Base base2 = new Base(); base2.setId(33L); base2.setName("margarita"); listaBasesRepositorio.add(base2); when(this.baseRepository.findByName("margarita")).thenReturn( <BUG>listaBasesRepositorio); BaseRequest base = new BaseRequest();</BUG> base.setName("margarita"); baseService.saveBase(base); verify(this.baseRepositor...
when(this.baseRepository.save(any(Base.class))).thenReturn( BaseRequest base = new BaseRequest();
24,477
package com.mylab.cromero; import java.util.List; import java.util.Optional; <BUG>import org.junit.Assert; import org.junit.Test;</BUG> import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.SpringApplicationConfiguration;
import java.util.Arrays; import java.util.stream.Collectors; import org.junit.Test;
24,478
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; import com.mylab.cromero.dto.BaseRequest; import com.mylab.cromero.dto.BaseResponse; import com.mylab.cromero.exception.BaseNotFoundException; <BUG>import com.mylab.cromero.service.Ba...
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; @RunWith(SpringJUnit4ClassRunner.class)
24,479
this.geometryDB = geometryDB; this.elementDB = elementDB; this.osmQuestDB = osmQuestDB; this.downloadedTilesDao = downloadedTilesDao; } <BUG>public void setQuestListener(VisibleOsmQuestListener listener) {</BUG> this.questListener = listener; } public int download(final OverpassQuestType questType, Rect tiles,
public void setQuestListener(VisibleQuestListener listener) {
24,480
geometryDB.putAll(geometryRows); elementDB.putAll(elements.values()); int newQuestsByQuestType = osmQuestDB.addAll(quests); if(questListener != null) { <BUG>for (OsmQuest quest : quests) { if(quest.getId() == null) continue; OsmElementKey k = new OsmElementKey(quest.getElementType(), quest.getElementId()); questListene...
Iterator<OsmQuest> it = quests.iterator(); while(it.hasNext()) if(it.next().getId() == null) it.remove();
24,481
import android.widget.ProgressBar; import android.widget.Toast; import com.mapzen.android.lost.api.LocationListener; import com.mapzen.android.lost.api.LocationRequest; import com.mapzen.android.lost.api.LocationServices; <BUG>import com.mapzen.android.lost.api.LostApiClient; import java.util.List;</BUG> import javax.i...
import java.util.Collection; import java.util.List;
24,482
import de.westnordost.streetcomplete.data.download.QuestDownloadProgressListener; import de.westnordost.streetcomplete.data.download.QuestDownloadService; import de.westnordost.streetcomplete.data.QuestGroup; import de.westnordost.streetcomplete.data.VisibleQuestListener; import de.westnordost.streetcomplete.data.downl...
[DELETED]
24,483
import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.graphics.Rect; import android.os.Bundle; <BUG>import android.os.IBinder; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors;</BUG> import javax.i...
import java.util.ArrayList;
24,484
createNote.text = text; createNote.elementType = q.getElementType(); createNote.elementId = q.getElementId(); createNoteDB.add(createNote); List<OsmQuest> quests = osmQuestDB.getAll(null, QuestStatus.NEW, null, <BUG>q.getElementType(), q.getElementId()); for(OsmQuest quest : quests) { osmQuestDB.delete(quest.getId()); ...
List<Long> questIds = new ArrayList<>(quests.size()); questIds.add(quest.getId()); } osmQuestDB.deleteAll(questIds); relay.onQuestsRemoved(questIds, QuestGroup.OSM);
24,485
if(!changes.isEmpty()) { q.setChanges(changes); q.setStatus(QuestStatus.ANSWERED); osmQuestDB.update(q); <BUG>relay.onOsmQuestRemoved(q.getId()); </BUG> } else {
relay.onQuestRemoved(q.getId(), group);
24,486
if(comment != null && !comment.isEmpty()) { q.setComment(comment); q.setStatus(QuestStatus.ANSWERED); osmNoteQuestDB.update(q); <BUG>relay.onNoteQuestRemoved(q.getId()); </BUG> } else {
relay.onQuestRemoved(q.getId(), group);
24,487
if(group == QuestGroup.OSM) { OsmQuest q = osmQuestDB.get(questId); q.setStatus(QuestStatus.HIDDEN); osmQuestDB.update(q); <BUG>relay.onOsmQuestRemoved(q.getId()); </BUG> } else if(group == QuestGroup.OSM_NOTE) {
relay.onQuestRemoved(q.getId(), group);
24,488
else if(group == QuestGroup.OSM_NOTE) { OsmNoteQuest q = osmNoteQuestDB.get(questId); q.setStatus(QuestStatus.HIDDEN); osmNoteQuestDB.update(q); <BUG>relay.onNoteQuestRemoved(q.getId()); </BUG> } }}.start(); }
relay.onQuestRemoved(q.getId(), group);
24,489
package de.westnordost.streetcomplete.data; <BUG>import de.westnordost.streetcomplete.data.osm.OsmQuest; import de.westnordost.streetcomplete.data.osmnotes.OsmNoteQuest; import de.westnordost.osmapi.map.data.Element;</BUG> public class VisibleQuestRelay implements VisibleQuestListener {
import java.util.Collection; import java.util.Collections; import de.westnordost.osmapi.map.data.Element;
24,490
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.TangoC...
import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
24,491
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();
24,492
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: " +
24,493
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....
import org.rajawali3d.math.Quaternion; import org.rajawali3d.math.vector.Vector3;
24,494
translationMoon.setRepeatMode(Animation.RepeatMode.INFINITE); translationMoon.setTransformable3D(moon); getCurrentScene().registerAnimation(translationMoon); translationMoon.play(); } <BUG>public void updateRenderCameraPose(TangoPoseData devicePose, DeviceExtrinsics extrinsics) { Pose cameraPose = ScenePoseCalculator.t...
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()...
24,495
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.tangos...
import com.google.atap.tangoservice.TangoAreaDescriptionMetaData; import com.google.atap.tangoservice.TangoConfig;
24,496
package org.hisp.dhis.android.core.program; import android.database.Cursor; import org.hisp.dhis.android.core.common.Call; import org.hisp.dhis.android.core.common.Payload; <BUG>import org.hisp.dhis.android.core.data.api.Fields; import org.hisp.dhis.android.core.data.database.DatabaseAdapter;</BUG> import org.hisp.dhis...
import org.hisp.dhis.android.core.data.api.Filter; import org.hisp.dhis.android.core.data.database.DatabaseAdapter;
24,497
import org.apache.commons.lang3.math.NumberUtils; import org.json.JSONException; import org.mariotaku.microblog.library.MicroBlog; import org.mariotaku.microblog.library.MicroBlogException; import org.mariotaku.microblog.library.twitter.model.RateLimitStatus; <BUG>import org.mariotaku.microblog.library.twitter.model.St...
import org.mariotaku.pickncrop.library.PNCUtils; import org.mariotaku.sqliteqb.library.AllColumns;
24,498
context.getApplicationContext().sendBroadcast(intent); } } @Nullable public static Location getCachedLocation(Context context) { <BUG>if (BuildConfig.DEBUG) { Log.v(LOGTAG, "Fetching cached location", new Exception()); }</BUG> Location location = null;
DebugLog.v(LOGTAG, "Fetching cached location", new Exception());
24,499
FileBody fileBody = null; try { fileBody = getFileBody(context, imageUri); twitter.updateProfileBannerImage(fileBody); } finally { <BUG>Utils.closeSilently(fileBody); if (deleteImage && "file".equals(imageUri.getScheme())) { final File file = new File(imageUri.getPath()); if (!file.delete()) { Log.w(LOGTAG, String.form...
if (deleteImage) { Utils.deleteMedia(context, imageUri);
24,500
FileBody fileBody = null; try { fileBody = getFileBody(context, imageUri); twitter.updateProfileBackgroundImage(fileBody, tile); } finally { <BUG>Utils.closeSilently(fileBody); if (deleteImage && "file".equals(imageUri.getScheme())) { final File file = new File(imageUri.getPath()); if (!file.delete()) { Log.w(LOGTAG, S...
twitter.updateProfileBannerImage(fileBody); if (deleteImage) { Utils.deleteMedia(context, imageUri);