id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
2,601
private String token; private static final Gson gson = new GsonBuilder() .disableHtmlEscaping() .registerTypeAdapter(Date.class, new DateAsTimeSinceEpochTypeAdapter(TimeUnit.SECONDS)) .create(); <BUG>public AuthenticationTokenSupplier(final String issuer, final String keyId, final PrivateKey privateKey) throws NoSuchAlgorithmException, InvalidKeyException { </BUG> Objects.requireNonNull(issuer); Objects.requireNonNull(keyId); Objects.requireNonNull(privateKey);
public AuthenticationTokenSupplier(final String issuer, final String keyId, final ECPrivateKey privateKey) throws NoSuchAlgorithmException, InvalidKeyException {
2,602
import java.net.InetSocketAddress; import java.nio.charset.StandardCharsets; import java.security.InvalidKeyException; import java.security.KeyFactory; import java.security.NoSuchAlgorithmException; <BUG>import java.security.PrivateKey; </BUG> import java.security.spec.InvalidKeySpecException; import java.security.spec.PKCS8EncodedKeySpec; import java.util.Collection;
import java.security.interfaces.ECPrivateKey;
2,603
try { final byte[] keyBytes = new byte[decodedPrivateKey.readableBytes()]; decodedPrivateKey.readBytes(keyBytes); final PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes); final KeyFactory keyFactory = KeyFactory.getInstance("EC"); <BUG>signingKey = keyFactory.generatePrivate(keySpec); </BUG> } catch (final InvalidKeySpecException e) { throw new InvalidKeyException(e); } finally {
final ByteBuf decodedPrivateKey = Base64.decode(wrappedEncodedPrivateKey); signingKey = (ECPrivateKey) keyFactory.generatePrivate(keySpec);
2,604
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; }
2,605
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]
2,606
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) {
2,607
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;
2,608
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 {
2,609
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));
2,610
} 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()
2,611
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));
2,612
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));
2,613
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 {
2,614
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);
2,615
if (orders.containsKey(orderId)) return; OrderBook book = books.get(instrument); if (book == null) return; <BUG>Order order = book.add(side, price, size); orders.put(orderId, order);</BUG> if (order.isOnBestLevel()) book.bbo(listener);
Order order = new Order(book, side, price, size); orders.put(orderId, order);
2,616
book.bbo(listener); } public void modify(long orderId, long size) { Order order = orders.get(orderId); if (order == null) <BUG>return; boolean onBestLevel = order.isOnBestLevel(); if (size > 0) { order.setRemainingQuantity(size); } else {</BUG> orders.remove(orderId);
OrderBook book = order.getOrderBook(); long newSize = Math.max(0, size); book.update(order.getSide(), order.getPrice(), newSize - order.getRemainingQuantity()); if (newSize == 0)
2,617
} else {</BUG> orders.remove(orderId); <BUG>order.delete(); } if (onBestLevel) order.getOrderBook().bbo(listener); }</BUG> public void execute(long orderId, long quantity) { Order order = orders.get(orderId); if (order == null)
book.bbo(listener); public void modify(long orderId, long size) {
2,618
package com.paritytrading.parity.top; public class Order { <BUG>private Level parent; private long remainingQuantity; Order(Level parent, long size) { this.parent = parent; </BUG> this.remainingQuantity = size;
private OrderBook book; private Side side; private long price; Order(OrderBook book, Side side, long price, long size) { this.book = book; this.side = side; this.price = price;
2,619
@Override public boolean isValidSdkHome(String path) { if (!checkForJdk(new File(path))) { return false; } <BUG>if (JrtFileSystem.isModularJdk(path) && !JrtFileSystem.isSupported()) { return false; } return true;</BUG> }
public void fileDeleted(@NotNull VirtualFileEvent event) { updateCache(event);
2,620
if (!srcDir.exists() || !srcDir.isDirectory()) return null; String path = srcDir.getAbsolutePath().replace(File.separatorChar, '/'); return LocalFileSystem.getInstance().findFileByPath(path); } } <BUG>@SuppressWarnings({"HardCodedStringLiteral"}) private static void addDocs(File file, SdkModificator rootContainer) {</BUG> VirtualFile vFile = findDocs(file, "docs/api"); if (vFile != null) { rootContainer.addRoot(vFile, JavadocOrderRootType.getInstance());
@SuppressWarnings("HardCodedStringLiteral") private static void addDocs(File file, SdkModificator rootContainer) {
2,621
String url = JarFileSystem.PROTOCOL_PREFIX + jarFile.getAbsolutePath().replace(File.separatorChar, '/') + JarFileSystem.JAR_SEPARATOR + relativePath; return VirtualFileManager.getInstance().findFileByUrl(url); } @Nullable <BUG>public static VirtualFile findDocs(File file, final String relativePath) { </BUG> file = new File(file.getAbsolutePath() + File.separator + relativePath.replace('/', File.separatorChar)); if (!file.exists() || !file.isDirectory()) return null; String path = file.getAbsolutePath().replace(File.separatorChar, '/');
private static VirtualFile findDocs(File file, final String relativePath) {
2,622
timeWarp = new OwnLabel(getFormattedTimeWrap(), skin, "warp"); timeWarp.setName("time warp"); Container wrapWrapper = new Container(timeWarp); wrapWrapper.width(60f * GlobalConf.SCALE_FACTOR); wrapWrapper.align(Align.center); <BUG>VerticalGroup timeGroup = new VerticalGroup().align(Align.left).space(3 * GlobalConf.SCALE_FACTOR).padTop(3 * GlobalConf.SCALE_FACTOR); </BUG> HorizontalGroup dateGroup = new HorizontalGroup(); dateGroup.space(4 * GlobalConf.SCALE_FACTOR); dateGroup.addActor(date);
VerticalGroup timeGroup = new VerticalGroup().align(Align.left).columnAlign(Align.left).space(3 * GlobalConf.SCALE_FACTOR).padTop(3 * GlobalConf.SCALE_FACTOR);
2,623
focusListScrollPane.setFadeScrollBars(false); focusListScrollPane.setScrollingDisabled(true, false); focusListScrollPane.setHeight(tree ? 200 * GlobalConf.SCALE_FACTOR : 100 * GlobalConf.SCALE_FACTOR); focusListScrollPane.setWidth(160); } <BUG>VerticalGroup objectsGroup = new VerticalGroup().align(Align.left).space(3 * GlobalConf.SCALE_FACTOR); </BUG> objectsGroup.addActor(searchBox); if (focusListScrollPane != null) { objectsGroup.addActor(focusListScrollPane);
VerticalGroup objectsGroup = new VerticalGroup().align(Align.left).columnAlign(Align.left).space(3 * GlobalConf.SCALE_FACTOR);
2,624
headerGroup.addActor(expandIcon); headerGroup.addActor(detachIcon); addActor(headerGroup); expandIcon.setChecked(expanded); } <BUG>public void expand() { </BUG> if (!expandIcon.isChecked()) { expandIcon.setChecked(true); }
public void expandPane() {
2,625
</BUG> if (!expandIcon.isChecked()) { expandIcon.setChecked(true); } } <BUG>public void collapse() { </BUG> if (expandIcon.isChecked()) { expandIcon.setChecked(false); }
headerGroup.addActor(expandIcon); headerGroup.addActor(detachIcon); addActor(headerGroup); expandIcon.setChecked(expanded); public void expandPane() { public void collapsePane() {
2,626
}); playstop.addListener(new TextTooltip(txt("gui.tooltip.playstop"), skin)); TimeComponent timeComponent = new TimeComponent(skin, ui); timeComponent.initialize(); CollapsiblePane time = new CollapsiblePane(ui, txt("gui.time"), timeComponent.getActor(), skin, true, playstop); <BUG>time.align(Align.left); mainActors.add(time);</BUG> panes.put(timeComponent.getClass().getSimpleName(), time); if (Constants.desktop) { recCamera = new OwnImageButton(skin, "rec");
time.align(Align.left).columnAlign(Align.left); mainActors.add(time);
2,627
panes.put(visualEffectsComponent.getClass().getSimpleName(), visualEffects); ObjectsComponent objectsComponent = new ObjectsComponent(skin, ui); objectsComponent.setSceneGraph(sg); objectsComponent.initialize(); CollapsiblePane objects = new CollapsiblePane(ui, txt("gui.objects"), objectsComponent.getActor(), skin, false); <BUG>objects.align(Align.left); mainActors.add(objects);</BUG> panes.put(objectsComponent.getClass().getSimpleName(), objects); GaiaComponent gaiaComponent = new GaiaComponent(skin, ui); gaiaComponent.initialize();
objects.align(Align.left).columnAlign(Align.left); mainActors.add(objects);
2,628
if (Constants.desktop) { MusicComponent musicComponent = new MusicComponent(skin, ui); musicComponent.initialize(); Actor[] musicActors = MusicActorsManager.getMusicActors() != null ? MusicActorsManager.getMusicActors().getActors(skin) : null; CollapsiblePane music = new CollapsiblePane(ui, txt("gui.music"), musicComponent.getActor(), skin, true, musicActors); <BUG>music.align(Align.left); mainActors.add(music);</BUG> panes.put(musicComponent.getClass().getSimpleName(), music); } Button switchWebgl = new OwnTextButton(txt("gui.webgl.back"), skin, "link");
music.align(Align.left).columnAlign(Align.left); mainActors.add(music);
2,629
Button rtlDirectionButton, ltrDirectionButton, autoDirectionButton, defaultDirectionButton; static final int IMAGE_SIZE = 12; static final int FOREGROUND_COLOR = 0; static final int BACKGROUND_COLOR = 1; static final int FONT = 2; <BUG>List colorAndFontTable; </BUG> ColorDialog colorDialog; FontDialog fontDialog; Color foregroundColor, backgroundColor;
Table colorAndFontTable;
2,630
void createSetGetGroup() { } void createControlWidgets () { } void createColorAndFontGroup () { <BUG>Group result = new Group (controlGroup, SWT.NONE); result.setLayoutData(new GridData (SWT.FILL, SWT.FILL, false, false)); result.setText(ControlExample.getResourceString ("Colors")); colorGroup = result;</BUG> colorGroup.setLayout (new GridLayout (2, true));
colorGroup = new Group(controlGroup, SWT.NONE);
2,631
visibleButton.setSelection(true); backgroundImageButton.setSelection(false); popupMenuButton.setSelection(false); } void createBackgroundModeGroup () { <BUG>Group result = new Group (controlGroup, SWT.NONE); result.setLayoutData(new GridData (SWT.FILL, SWT.FILL, false, false)); result.setText(ControlExample.getResourceString("Background_Mode")); backgroundModeGroup = result; backgroundModeGroup.setLayout (new GridLayout ()); backgroundModeCombo = new Combo(backgroundModeGroup, SWT.READ_ONLY);</BUG> backgroundModeCombo.setItems("SWT.INHERIT_NONE", "SWT.INHERIT_DEFAULT", "SWT.INHERIT_FORCE");
backgroundModeGroup = new Group (controlGroup, SWT.NONE); backgroundModeGroup.setLayoutData (new GridData (SWT.FILL, SWT.FILL, false, false)); backgroundModeGroup.setText (ControlExample.getResourceString("Background_Mode")); backgroundModeCombo = new Combo(backgroundModeGroup, SWT.READ_ONLY);
2,632
dialog.setDefaultButton(ok); ok.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); ok.addSelectionListener (new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { <BUG>for (int i = 0; i < table.getItemCount(); i++) { eventsFilter[i] = table.isSelected(i); }</BUG> dialog.dispose();
TableItem [] items = table.getItems(); for (int i = 0; i < EVENT_INFO.length; i++) { eventsFilter[i] = items[i].getChecked();
2,633
dialog.setSize(bounds.width, clientArea.height - trim.height); } dialog.setLocation(bounds.x, clientArea.y); dialog.open (); } <BUG>void createListenersGroup () { Group result = new Group (controlGroup, SWT.NONE); result.setLayoutData(new GridData (SWT.FILL, SWT.FILL, true, true, 2, 1)); result.setText(ControlExample.getResourceString ("Listeners")); listenersGroup = result; listenersGroup.setLayout (new GridLayout (4, false)); Button listenersButton = new Button (listenersGroup, SWT.PUSH);</BUG> listenersButton.setText (ControlExample.getResourceString ("Select_Listeners"));
listenersGroup = new Group (tabFolderPage, SWT.NONE); listenersGroup.setLayoutData (new GridData (SWT.FILL, SWT.FILL, true, true, 2, 1)); listenersGroup.setText (ControlExample.getResourceString ("Listeners")); Button listenersButton = new Button (listenersGroup, SWT.PUSH);
2,634
rtlDirectionButton.setText ("SWT.RIGHT_TO_LEFT"); autoDirectionButton = new Button (directionGroup, SWT.RADIO); autoDirectionButton.setText ("AUTO direction"); } void createSizeGroup () { <BUG>Group result = new Group (controlGroup, SWT.NONE); result.setLayoutData(new GridData (SWT.FILL, SWT.FILL, false, false)); result.setText(ControlExample.getResourceString("Size")); sizeGroup = result; sizeGroup.setLayout (new GridLayout()); preferredButton = new Button (sizeGroup, SWT.RADIO);</BUG> preferredButton.setText (ControlExample.getResourceString("Preferred"));
sizeGroup = new Group (controlGroup, SWT.NONE); sizeGroup.setLayoutData (new GridData (SWT.FILL, SWT.FILL, false, false)); sizeGroup.setText (ControlExample.getResourceString("Size")); preferredButton = new Button (sizeGroup, SWT.RADIO);
2,635
fillHButton.addSelectionListener(selectionListener); fillVButton.addSelectionListener(selectionListener); preferredButton.setSelection (true); } void createStyleGroup () { <BUG>Group result = new Group (controlGroup, SWT.NONE); result.setLayoutData(new GridData (SWT.FILL, SWT.FILL, false, false)); result.setText(ControlExample.getResourceString("Styles")); styleGroup = result; styleGroup.setLayout (new GridLayout ()); }</BUG> Composite createTabFolderPage (TabFolder tabFolder) {
styleGroup = new Group (controlGroup, SWT.NONE); styleGroup.setLayoutData (new GridData (SWT.FILL, SWT.FILL, false, false)); styleGroup.setText (ControlExample.getResourceString("Styles"));
2,636
package org.elasticsearch.common.http.client; import org.apache.lucene.util.IOUtils; import org.elasticsearch.ElasticsearchTimeoutException; import org.elasticsearch.Version; import org.elasticsearch.common.Nullable; <BUG>import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.unit.TimeValue;</BUG> import java.io.*; import java.net.HttpURLConnection; import java.net.URL;
import org.elasticsearch.common.cli.Terminal; import org.elasticsearch.common.unit.TimeValue;
2,637
package org.elasticsearch.plugins; import com.google.common.base.Strings; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterators; <BUG>import org.apache.lucene.util.IOUtils; import org.elasticsearch.*; </BUG> import org.elasticsearch.bootstrap.JarHell; import org.elasticsearch.common.SuppressForbidden;
import org.elasticsearch.ElasticsearchTimeoutException; import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.Version;
2,638
boolean downloaded = false; HttpDownloadHelper.DownloadProgress progress; if (outputMode == OutputMode.SILENT) { progress = new HttpDownloadHelper.NullProgress(); } else { <BUG>progress = new HttpDownloadHelper.VerboseProgress(SysOut.getOut()); </BUG> } if (!Files.isWritable(environment.pluginsFile())) { throw new IOException("plugin directory " + environment.pluginsFile() + " is read only");
progress = new HttpDownloadHelper.VerboseProgress(terminal.writer());
2,639
downloadHelper.download(pluginUrl, pluginFile, progress, this.timeout); downloaded = true; } catch (ElasticsearchTimeoutException e) { throw e; } catch (Exception e) { <BUG>log("Failed: " + ExceptionsHelper.detailedMessage(e)); </BUG> } } else { if (PluginHandle.isOfficialPlugin(pluginHandle.repo, pluginHandle.user, pluginHandle.version)) {
terminal.println("Failed: %s", ExceptionsHelper.detailedMessage(e));
2,640
checkForOfficialPlugins(pluginHandle.name); } } if (!downloaded) { for (URL url : pluginHandle.urls()) { <BUG>log("Trying " + url.toExternalForm() + "..."); try {</BUG> downloadHelper.download(url, pluginFile, progress, this.timeout); downloaded = true; break;
terminal.println("Trying %s ...", url.toExternalForm()); try {
2,641
downloaded = true; break; } catch (ElasticsearchTimeoutException e) { throw e; } catch (Exception e) { <BUG>debug("Failed: " + ExceptionsHelper.detailedMessage(e)); </BUG> } } }
terminal.println(VERBOSE, "Failed: %s", ExceptionsHelper.detailedMessage(e));
2,642
throw new IOException("failed to download out of all possible locations..., use --verbose to get detailed information"); } Path tmp = unzipToTemporary(pluginFile); final List<URL> jars = new ArrayList<>(); ClassLoader loader = PluginManager.class.getClassLoader(); <BUG>if (loader instanceof URLClassLoader) { for (URL url : ((URLClassLoader) loader).getURLs()) { jars.add(url); }</BUG> }
Collections.addAll(jars, ((URLClassLoader) loader).getURLs());
2,643
Files.copy(file, target, StandardCopyOption.REPLACE_EXISTING); return FileVisitResult.CONTINUE; } }); } <BUG>log("Installed " + name + " into " + extractLocation.toAbsolutePath()); } catch (Exception e) { log("failed to extract plugin [" + pluginFile + "]: " + ExceptionsHelper.detailedMessage(e)); </BUG> return;
terminal.println("Installed %s into %s", name, extractLocation.toAbsolutePath()); terminal.printError("failed to extract plugin [%s]: %s", pluginFile, ExceptionsHelper.detailedMessage(e));
2,644
Path site = extractLocation.resolve("_site"); Path tmpLocation = environment.pluginsFile().resolve(extractLocation.getFileName() + ".tmp"); Files.move(extractLocation, tmpLocation); Files.createDirectories(extractLocation); Files.move(tmpLocation, site); <BUG>debug("Installed " + name + " into " + site.toAbsolutePath()); </BUG> } } }
terminal.println(VERBOSE, "Installed " + name + " into " + site.toAbsolutePath());
2,645
PluginHandle pluginHandle = PluginHandle.parse(name); boolean removed = false; checkForForbiddenName(pluginHandle.name); Path pluginToDelete = pluginHandle.extractedDir(environment); if (Files.exists(pluginToDelete)) { <BUG>debug("Removing: " + pluginToDelete); try {</BUG> IOUtils.rm(pluginToDelete); } catch (IOException ex){ throw new IOException("Unable to remove " + pluginHandle.name + ". Check file permissions on " +
terminal.println(VERBOSE, "Removing: %s", pluginToDelete); try {
2,646
} @After public void clearPathHome() { System.clearProperty("es.default.path.home"); } <BUG>protected static String[] args(String command) { </BUG> if (!Strings.hasLength(command)) { return Strings.EMPTY_ARRAY; }
public static String[] args(String command) {
2,647
System.out.println(change); } } }; @Override <BUG>protected Callback<VChild, Void> copyChildCallback() </BUG> { return (child) -> {
protected Callback<VChild, Void> copyIntoCallback()
2,648
package jfxtras.labs.icalendarfx.components; import jfxtras.labs.icalendarfx.properties.component.descriptive.Comment; <BUG>import jfxtras.labs.icalendarfx.properties.component.misc.IANAProperty; import jfxtras.labs.icalendarfx.properties.component.misc.UnknownProperty;</BUG> import jfxtras.labs.icalendarfx.properties.component.recurrence.RecurrenceDates; import jfxtras.labs.icalendarfx.properties.component.recurrence.RecurrenceRule;
import jfxtras.labs.icalendarfx.properties.component.misc.NonStandardProperty;
2,649
VEVENT ("VEVENT", Arrays.asList(PropertyType.ATTACHMENT, PropertyType.ATTENDEE, PropertyType.CATEGORIES, PropertyType.CLASSIFICATION, PropertyType.COMMENT, PropertyType.CONTACT, PropertyType.DATE_TIME_CREATED, PropertyType.DATE_TIME_END, PropertyType.DATE_TIME_STAMP, PropertyType.DATE_TIME_START, PropertyType.DESCRIPTION, PropertyType.DURATION, PropertyType.EXCEPTION_DATE_TIMES, <BUG>PropertyType.GEOGRAPHIC_POSITION, PropertyType.IANA_PROPERTY, PropertyType.LAST_MODIFIED, PropertyType.LOCATION, PropertyType.NON_STANDARD, PropertyType.ORGANIZER, PropertyType.PRIORITY,</BUG> PropertyType.RECURRENCE_DATE_TIMES, PropertyType.RECURRENCE_IDENTIFIER, PropertyType.RELATED_TO, PropertyType.RECURRENCE_RULE, PropertyType.REQUEST_STATUS, PropertyType.RESOURCES, PropertyType.SEQUENCE, PropertyType.STATUS, PropertyType.SUMMARY, PropertyType.TIME_TRANSPARENCY, PropertyType.UNIQUE_IDENTIFIER,
PropertyType.GEOGRAPHIC_POSITION, PropertyType.LAST_MODIFIED, PropertyType.LOCATION, PropertyType.NON_STANDARD, PropertyType.ORGANIZER, PropertyType.PRIORITY,
2,650
VTODO ("VTODO", Arrays.asList(PropertyType.ATTACHMENT, PropertyType.ATTENDEE, PropertyType.CATEGORIES, PropertyType.CLASSIFICATION, PropertyType.COMMENT, PropertyType.CONTACT, PropertyType.DATE_TIME_COMPLETED, PropertyType.DATE_TIME_CREATED, PropertyType.DATE_TIME_DUE, PropertyType.DATE_TIME_STAMP, PropertyType.DATE_TIME_START, PropertyType.DESCRIPTION, PropertyType.DURATION, <BUG>PropertyType.EXCEPTION_DATE_TIMES, PropertyType.GEOGRAPHIC_POSITION, PropertyType.IANA_PROPERTY, PropertyType.LAST_MODIFIED, PropertyType.LOCATION, PropertyType.NON_STANDARD, PropertyType.ORGANIZER,</BUG> PropertyType.PERCENT_COMPLETE, PropertyType.PRIORITY, PropertyType.RECURRENCE_DATE_TIMES, PropertyType.RECURRENCE_IDENTIFIER, PropertyType.RELATED_TO, PropertyType.RECURRENCE_RULE, PropertyType.REQUEST_STATUS, PropertyType.RESOURCES, PropertyType.SEQUENCE, PropertyType.STATUS,
PropertyType.EXCEPTION_DATE_TIMES, PropertyType.GEOGRAPHIC_POSITION, PropertyType.LAST_MODIFIED, PropertyType.LOCATION, PropertyType.NON_STANDARD, PropertyType.ORGANIZER,
2,651
throw new RuntimeException("not implemented"); } }, DAYLIGHT_SAVING_TIME ("DAYLIGHT", Arrays.asList(PropertyType.COMMENT, PropertyType.DATE_TIME_START, <BUG>PropertyType.IANA_PROPERTY, PropertyType.NON_STANDARD, PropertyType.RECURRENCE_DATE_TIMES, PropertyType.RECURRENCE_RULE, PropertyType.TIME_ZONE_NAME, PropertyType.TIME_ZONE_OFFSET_FROM,</BUG> PropertyType.TIME_ZONE_OFFSET_TO), DaylightSavingTime.class) {
PropertyType.RECURRENCE_RULE, PropertyType.TIME_ZONE_NAME, PropertyType.TIME_ZONE_OFFSET_FROM,
2,652
throw new RuntimeException("not implemented"); } }, VALARM ("VALARM", Arrays.asList(PropertyType.ACTION, PropertyType.ATTACHMENT, PropertyType.ATTENDEE, PropertyType.DESCRIPTION, <BUG>PropertyType.DURATION, PropertyType.IANA_PROPERTY, PropertyType.NON_STANDARD, PropertyType.REPEAT_COUNT, PropertyType.SUMMARY, PropertyType.TRIGGER),</BUG> VAlarm.class) { @Override
DAYLIGHT_SAVING_TIME ("DAYLIGHT", Arrays.asList(PropertyType.COMMENT, PropertyType.DATE_TIME_START, PropertyType.NON_STANDARD, PropertyType.RECURRENCE_DATE_TIMES, PropertyType.RECURRENCE_RULE, PropertyType.TIME_ZONE_NAME, PropertyType.TIME_ZONE_OFFSET_FROM, PropertyType.TIME_ZONE_OFFSET_TO), DaylightSavingTime.class)
2,653
private ContentLineStrategy contentLineGenerator; protected void setContentLineGenerator(ContentLineStrategy contentLineGenerator) { this.contentLineGenerator = contentLineGenerator; } <BUG>protected Callback<VChild, Void> copyChildCallback() </BUG> { throw new RuntimeException("Can't copy children. copyChildCallback isn't overridden in subclass." + this.getClass()); };
protected Callback<VChild, Void> copyIntoCallback()
2,654
import jfxtras.labs.icalendarfx.properties.calendar.Version; import jfxtras.labs.icalendarfx.properties.component.misc.NonStandardProperty; public enum CalendarProperty { CALENDAR_SCALE ("CALSCALE", <BUG>Arrays.asList(ParameterType.VALUE_DATA_TYPES, ParameterType.NON_STANDARD, ParameterType.IANA_PARAMETER), CalendarScale.class)</BUG> { @Override public VChild parse(VCalendar vCalendar, String contentLine)
Arrays.asList(ParameterType.VALUE_DATA_TYPES, ParameterType.NON_STANDARD), CalendarScale.class)
2,655
CalendarScale calendarScale = (CalendarScale) child; destination.setCalendarScale(calendarScale); } }, METHOD ("METHOD", <BUG>Arrays.asList(ParameterType.VALUE_DATA_TYPES, ParameterType.NON_STANDARD, ParameterType.IANA_PARAMETER), Method.class)</BUG> { @Override public VChild parse(VCalendar vCalendar, String contentLine)
Arrays.asList(ParameterType.VALUE_DATA_TYPES, ParameterType.NON_STANDARD), Method.class)
2,656
} list.add(new NonStandardProperty((NonStandardProperty) child)); } }, PRODUCT_IDENTIFIER ("PRODID", <BUG>Arrays.asList(ParameterType.VALUE_DATA_TYPES, ParameterType.NON_STANDARD, ParameterType.IANA_PARAMETER), ProductIdentifier.class)</BUG> { @Override public VChild parse(VCalendar vCalendar, String contentLine)
public void copyChild(VChild child, VCalendar destination) CalendarScale calendarScale = (CalendarScale) child; destination.setCalendarScale(calendarScale); METHOD ("METHOD", Arrays.asList(ParameterType.VALUE_DATA_TYPES, ParameterType.NON_STANDARD), Method.class)
2,657
ProductIdentifier productIdentifier = (ProductIdentifier) child; destination.setProductIdentifier(productIdentifier); } }, VERSION ("VERSION", <BUG>Arrays.asList(ParameterType.VALUE_DATA_TYPES, ParameterType.NON_STANDARD, ParameterType.IANA_PARAMETER), Version.class)</BUG> { @Override public VChild parse(VCalendar vCalendar, String contentLine)
Arrays.asList(ParameterType.VALUE_DATA_TYPES, ParameterType.NON_STANDARD), Version.class)
2,658
package jfxtras.labs.icalendarfx.components; import jfxtras.labs.icalendarfx.properties.component.descriptive.Comment; <BUG>import jfxtras.labs.icalendarfx.properties.component.misc.IANAProperty; import jfxtras.labs.icalendarfx.properties.component.misc.UnknownProperty;</BUG> import jfxtras.labs.icalendarfx.properties.component.recurrence.RecurrenceDates; import jfxtras.labs.icalendarfx.properties.component.recurrence.RecurrenceRule;
import jfxtras.labs.icalendarfx.properties.component.misc.NonStandardProperty;
2,659
import org.spongepowered.api.world.Locatable; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; import java.util.List; <BUG>import java.util.Optional; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG> public class CommandDelete extends FCCommandBase { private static final FlagMapper MAPPER = map -> key -> value -> { map.put(key, value);
import java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
2,660
.append(Text.of(TextColors.GREEN, "Usage: ")) .append(getUsage(source)) .build()); return CommandResult.empty(); } else if (isIn(REGIONS_ALIASES, parse.args[0])) { <BUG>if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); IRegion region = FGManager.getInstance().getRegion(parse.args[1]); </BUG> boolean isWorldRegion = false; if (region == null) {
String regionName = parse.args[1]; IRegion region = FGManager.getInstance().getRegion(regionName).orElse(null);
2,661
</BUG> isWorldRegion = true; } if (region == null) <BUG>throw new CommandException(Text.of("No region exists with the name \"" + parse.args[1] + "\"!")); if (region instanceof GlobalWorldRegion) { </BUG> throw new CommandException(Text.of("You may not delete the global region!")); }
if (world == null) throw new CommandException(Text.of("No world exists with name \"" + worldName + "\"!")); if (world == null) throw new CommandException(Text.of("Must specify a world!")); region = FGManager.getInstance().getWorldRegion(world, regionName).orElse(null); throw new CommandException(Text.of("No region exists with the name \"" + regionName + "\"!")); if (region instanceof IGlobal) {
2,662
source.getName() + " deleted " + (isWorldRegion ? "world" : "") + "region" ); return CommandResult.success(); } else if (isIn(HANDLERS_ALIASES, parse.args[0])) { if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); <BUG>IHandler handler = FGManager.getInstance().gethandler(parse.args[1]); if (handler == null) throw new ArgumentParseException(Text.of("No handler exists with that name!"), parse.args[1], 1); if (handler instanceof GlobalHandler)</BUG> throw new CommandException(Text.of("You may not delete the global handler!"));
Optional<IHandler> handlerOpt = FGManager.getInstance().gethandler(parse.args[1]); if (!handlerOpt.isPresent()) IHandler handler = handlerOpt.get(); if (handler instanceof GlobalHandler)
2,663
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
2,664
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
2,665
@Dependency(id = "foxcore") }, description = "A world protection plugin built for SpongeAPI. Requires FoxCore.", authors = {"gravityfox"}, url = "https://github.com/FoxDenStudio/FoxGuard") <BUG>public final class FoxGuardMain { public final Cause pluginCause = Cause.builder().named("plugin", this).build(); private static FoxGuardMain instanceField;</BUG> @Inject private Logger logger;
private static FoxGuardMain instanceField;
2,666
private UserStorageService userStorage; private EconomyService economyService = null; private boolean loaded = false; private FCCommandDispatcher fgDispatcher; public static FoxGuardMain instance() { <BUG>return instanceField; }</BUG> @Listener public void construct(GameConstructionEvent event) { instanceField = this;
} public static Cause getCause() { return instance().pluginCause; }
2,667
return configDirectory; } public boolean isLoaded() { return loaded; } <BUG>public static Cause getCause() { return instance().pluginCause; }</BUG> public EconomyService getEconomyService() { return economyService;
[DELETED]
2,668
import org.spongepowered.api.world.Locatable; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; import java.util.*; <BUG>import java.util.stream.Collectors; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG> public class CommandHere extends FCCommandBase { private static final String[] PRIORITY_ALIASES = {"priority", "prio", "p"}; private static final FlagMapper MAPPER = map -> key -> value -> {
import java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
2,669
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index > 0) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
2,670
private static FGStorageManager instance; private final Logger logger = FoxGuardMain.instance().getLogger();</BUG> private final Set<LoadEntry> loaded = new HashSet<>(); private final Path directory = getDirectory(); private final Map<String, Path> worldDirectories; <BUG>private FGStorageManager() { defaultModifiedMap = new CacheMap<>((k, m) -> {</BUG> if (k instanceof IFGObject) { m.put((IFGObject) k, true); return true;
public final HashMap<IFGObject, Boolean> defaultModifiedMap; private final UserStorageService userStorageService; private final Logger logger = FoxGuardMain.instance().getLogger(); userStorageService = FoxGuardMain.instance().getUserStorage(); defaultModifiedMap = new CacheMap<>((k, m) -> {
2,671
String name = fgObject.getName(); Path singleDir = dir.resolve(name.toLowerCase()); </BUG> boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { <BUG>logger.info((shouldSave ? "S" : "Force s") + "aving handler \"" + name + "\" in directory: " + singleDir); </BUG> constructDirectory(singleDir); try { fgObject.save(singleDir);
UUID owner = fgObject.getOwner(); boolean isOwned = !owner.equals(SERVER_UUID); Optional<User> userOwner = userStorageService.get(owner); String logName = (userOwner.isPresent() ? userOwner.get().getName() + ":" : "") + (isOwned ? owner + ":" : "") + name; if (fgObject.autoSave()) { Path singleDir = serverDir.resolve(name.toLowerCase()); logger.info((shouldSave ? "S" : "Force s") + "aving handler " + logName + " in directory: " + singleDir);
2,672
if (fgObject.autoSave()) { Path singleDir = dir.resolve(name.toLowerCase()); </BUG> boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { <BUG>logger.info((shouldSave ? "S" : "Force s") + "aving world region \"" + name + "\" in directory: " + singleDir); </BUG> constructDirectory(singleDir); try { fgObject.save(singleDir);
Path singleDir = serverDir.resolve(name.toLowerCase()); logger.info((shouldSave ? "S" : "Force s") + "aving world region " + logName + " in directory: " + singleDir);
2,673
public synchronized void loadRegionLinks() { logger.info("Loading region links"); try (DB mainDB = DBMaker.fileDB(directory.resolve("regions.foxdb").normalize().toString()).make()) { Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen(); linksMap.entrySet().forEach(entry -> { <BUG>IRegion region = FGManager.getInstance().getRegion(entry.getKey()); if (region != null) { logger.info("Loading links for region \"" + region.getName() + "\"");</BUG> String handlersString = entry.getValue();
Optional<IRegion> regionOpt = FGManager.getInstance().getRegion(entry.getKey()); if (regionOpt.isPresent()) { IRegion region = regionOpt.get(); logger.info("Loading links for region \"" + region.getName() + "\"");
2,674
public synchronized void loadWorldRegionLinks(World world) { logger.info("Loading world region links for world \"" + world.getName() + "\""); try (DB mainDB = DBMaker.fileDB(worldDirectories.get(world.getName()).resolve("wregions.foxdb").normalize().toString()).make()) { Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen(); linksMap.entrySet().forEach(entry -> { <BUG>IRegion region = FGManager.getInstance().getWorldRegion(world, entry.getKey()); if (region != null) { logger.info("Loading links for world region \"" + region.getName() + "\"");</BUG> String handlersString = entry.getValue();
Optional<IWorldRegion> regionOpt = FGManager.getInstance().getWorldRegion(world, entry.getKey()); if (regionOpt.isPresent()) { IWorldRegion region = regionOpt.get(); logger.info("Loading links for world region \"" + region.getName() + "\"");
2,675
StringBuilder builder = new StringBuilder(); for (Iterator<IHandler> it = handlers.iterator(); it.hasNext(); ) { builder.append(it.next().getName()); if (it.hasNext()) builder.append(","); } <BUG>return builder.toString(); }</BUG> private final class LoadEntry { public final String name; public final Type type;
public enum Type { REGION, WREGION, HANDLER
2,676
.autoCloseQuotes(true) .leaveFinalAsIs(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "worldregion", "handler", "controller").stream() </BUG> .filter(new StartsWithPredicate(parse.current.token)) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "worldregion", "handler", "controller")
2,677
qualHistogram[i] = 0L; final NestedIntegerArray<RecalDatum> qualTable = recalibrationTables.getTable(RecalibrationTables.TableType.QUALITY_SCORE_TABLE); // get the quality score table for (final RecalDatum value : qualTable.getAllValues()) { final RecalDatum datum = value; final int empiricalQual = MathUtils.fastRound(datum.getEmpiricalQuality()); // convert the empirical quality to an integer ( it is already capped by MAX_QUAL ) <BUG>qualHistogram[empiricalQual] += datum.getNumObservations(); // add the number of observations for every key </BUG> } empiricalQualCounts = Arrays.asList(qualHistogram); // histogram with the number of observations of the empirical qualities quantizeQualityScores(quantizationLevels);
qualHistogram[empiricalQual] += (long) datum.getNumObservations(); // add the number of observations for every key
2,678
protected Covariate[] covariates; protected RecalibrationTables recalibrationTables; public void initialize(final Covariate[] covariates, final RecalibrationTables recalibrationTables) { this.covariates = covariates.clone(); this.recalibrationTables = recalibrationTables; <BUG>} public synchronized void updateDataForPileupElement(final PileupElement pileupElement, final byte refBase) {</BUG> final int offset = pileupElement.getOffset(); final ReadCovariates readCovariates = covariateKeySetFrom(pileupElement.getRead()); final byte qual = pileupElement.getQual();
@Override public synchronized void updateDataForPileupElement(final PileupElement pileupElement, final byte refBase) {
2,679
final EventType event = EventType.eventFrom(keys[keyIndex]); reportTable.set(rowIndex, columnNames.get(columnIndex++).getFirst(), event.toString()); reportTable.set(rowIndex, columnNames.get(columnIndex++).getFirst(), datum.getEmpiricalQuality()); if (tableIndex == RecalibrationTables.TableType.READ_GROUP_TABLE.index) reportTable.set(rowIndex, columnNames.get(columnIndex++).getFirst(), datum.getEstimatedQReported()); // we only add the estimated Q reported in the RG table <BUG>reportTable.set(rowIndex, columnNames.get(columnIndex++).getFirst(), datum.getNumObservations()); reportTable.set(rowIndex, columnNames.get(columnIndex).getFirst(), datum.getNumMismatches()); </BUG> rowIndex++;
reportTable.set(rowIndex, columnNames.get(columnIndex++).getFirst(), Math.round(datum.getNumObservations())); reportTable.set(rowIndex, columnNames.get(columnIndex).getFirst(), Math.round(datum.getNumMismatches()));
2,680
@Ensures("result >= 0.0") public double getEmpiricalErrorRate() { if ( numObservations == 0 ) return 0.0; else { <BUG>final double doubleMismatches = (double) (numMismatches + SMOOTHING_CONSTANT); final double doubleObservations = (double) (numObservations + SMOOTHING_CONSTANT + SMOOTHING_CONSTANT); return doubleMismatches / doubleObservations;</BUG> } }
final double doubleMismatches = numMismatches + SMOOTHING_CONSTANT; final double doubleObservations = numObservations + SMOOTHING_CONSTANT + SMOOTHING_CONSTANT; return doubleMismatches / doubleObservations;
2,681
public final byte getEmpiricalQualityAsByte() { return (byte)(Math.round(getEmpiricalQuality())); } @Override public String toString() { <BUG>return String.format("%d,%d,%d", getNumObservations(), getNumMismatches(), (byte) Math.floor(getEmpiricalQuality())); </BUG> } public String stringForCSV() { return String.format("%s,%d,%.2f", toString(), (byte) Math.floor(getEstimatedQReported()), getEmpiricalQuality() - getEstimatedQReported());
return String.format("%d,%d,%d", Math.round(getNumObservations()), Math.round(getNumMismatches()), (byte) Math.floor(getEmpiricalQuality()));
2,682
if ( numMismatches < 0 ) throw new IllegalArgumentException("numMismatches < 0"); this.numMismatches = numMismatches; empiricalQuality = UNINITIALIZED; } @Requires({"by >= 0"}) <BUG>public synchronized void incrementNumObservations(final long by) { </BUG> numObservations += by; empiricalQuality = UNINITIALIZED; }
[DELETED]
2,683
</BUG> numObservations += by; empiricalQuality = UNINITIALIZED; } @Requires({"by >= 0"}) <BUG>public synchronized void incrementNumMismatches(final long by) { </BUG> numMismatches += by; empiricalQuality = UNINITIALIZED; }
if ( numMismatches < 0 ) throw new IllegalArgumentException("numMismatches < 0"); this.numMismatches = numMismatches; public synchronized void incrementNumObservations(final double by) { public synchronized void incrementNumMismatches(final double by) {
2,684
numMismatches += by; empiricalQuality = UNINITIALIZED; } @Requires({"incObservations >= 0", "incMismatches >= 0"}) @Ensures({"numObservations == old(numObservations) + incObservations", "numMismatches == old(numMismatches) + incMismatches"}) <BUG>public synchronized void increment(final long incObservations, final long incMismatches) { </BUG> incrementNumObservations(incObservations); incrementNumMismatches(incMismatches); }
public synchronized void increment(final double incObservations, final double incMismatches) {
2,685
return 0.0; else { final long[][] counts = new long[subnodes.size()][2]; int i = 0; for ( final RecalDatumNode<T> subnode : subnodes ) { <BUG>counts[i][0] = subnode.getRecalDatum().getNumMismatches() + 1; counts[i][1] = subnode.getRecalDatum().getNumObservations() + 2; </BUG> i++;
else if ( subnodes.size() == 1 ) counts[i][0] = Math.round(subnode.getRecalDatum().getNumMismatches()) + 1L; counts[i][1] = Math.round(subnode.getRecalDatum().getNumObservations()) + 2L;
2,686
package com.projecttango.examples.java.augmentedreality; import com.google.atap.tangoservice.Tango; import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoCameraIntrinsics; import com.google.atap.tangoservice.TangoConfig; <BUG>import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoEvent;</BUG> import com.google.atap.tangoservice.TangoOutOfDateException; import com.google.atap.tangoservice.TangoPoseData; import com.google.atap.tangoservice.TangoXyzIjData;
import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
2,687
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();
2,688
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: " +
2,689
import org.rajawali3d.materials.Material; import org.rajawali3d.materials.methods.DiffuseMethod; import org.rajawali3d.materials.textures.ATexture; import org.rajawali3d.materials.textures.StreamingTexture; import org.rajawali3d.materials.textures.Texture; <BUG>import org.rajawali3d.math.Matrix4; import org.rajawali3d.math.vector.Vector3;</BUG> import org.rajawali3d.primitives.ScreenQuad; import org.rajawali3d.primitives.Sphere; import org.rajawali3d.renderer.RajawaliRenderer;
import org.rajawali3d.math.Quaternion; import org.rajawali3d.math.vector.Vector3;
2,690
translationMoon.setRepeatMode(Animation.RepeatMode.INFINITE); translationMoon.setTransformable3D(moon); getCurrentScene().registerAnimation(translationMoon); translationMoon.play(); } <BUG>public void updateRenderCameraPose(TangoPoseData devicePose, DeviceExtrinsics extrinsics) { Pose cameraPose = ScenePoseCalculator.toOpenGlCameraPose(devicePose, extrinsics); getCurrentCamera().setRotation(cameraPose.getOrientation()); getCurrentCamera().setPosition(cameraPose.getPosition()); }</BUG> public int getTextureId() {
public void updateRenderCameraPose(TangoPoseData cameraPose) { float[] rotation = cameraPose.getRotationAsFloats(); float[] translation = cameraPose.getTranslationAsFloats(); Quaternion quaternion = new Quaternion(rotation[3], rotation[0], rotation[1], rotation[2]); getCurrentCamera().setRotation(quaternion.conjugate()); getCurrentCamera().setPosition(translation[0], translation[1], translation[2]);
2,691
package com.projecttango.examples.java.helloareadescription; import com.google.atap.tangoservice.Tango; <BUG>import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoConfig;</BUG> import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
import com.google.atap.tangoservice.TangoAreaDescriptionMetaData; import com.google.atap.tangoservice.TangoConfig;
2,692
OnViewChangedNotifier previousNotifier = OnViewChangedNotifier.replaceNotifier(onViewChangedNotifier_); init_(savedInstanceState); super.onCreate(savedInstanceState); OnViewChangedNotifier.replaceNotifier(previousNotifier); setContentView(layout.new_request); <BUG>} @Override</BUG> public void setContentView(int layoutResID) { super.setContentView(layoutResID); onViewChangedNotifier_.notifyViewChanged(this);
private void init_(Bundle savedInstanceState) { OnViewChangedNotifier.registerOnViewChangedListener(this); injectExtras_(); @Override
2,693
if (((SdkVersionHelper.getSdkInt()< 5)&&(keyCode == KeyEvent.KEYCODE_BACK))&&(event.getRepeatCount() == 0)) { onBackPressed(); } return super.onKeyDown(keyCode, event); } <BUG>public static EditRequestActivity_.IntentBuilder_ intent(Context context) { return new EditRequestActivity_.IntentBuilder_(context); } public static EditRequestActivity_.IntentBuilder_ intent(Fragment supportFragment) { return new EditRequestActivity_.IntentBuilder_(supportFragment); }</BUG> @Override
[DELETED]
2,694
public void onClick(View view) { EditRequestActivity_.this.addressChange(); } } ); <BUG>} if (hasViews.findViewById(id.requestSend)!= null) { hasViews.findViewById(id.requestSend).setOnClickListener(new OnClickListener() { @Override</BUG> public void onClick(View view) {
View view = hasViews.findViewById(id.requestSend); if (view!= null) { view.setOnClickListener(new OnClickListener() { @Override
2,695
import org.apache.commons.io.FileUtils; public class BetterFpsHelper { public static final String MC_VERSION = "1.9"; public static final String VERSION = "1.2.1"; public static final String URL = "http://guichaguri.github.io/BetterFps/"; <BUG>public static final String UPDATE_URL = "https://raw.githubusercontent.com/Guichaguri/BetterFps/1.8/lastest-version.properties"; public static final LinkedHashMap<String, String> helpers = new LinkedHashMap<String, String>();</BUG> public static final LinkedHashMap<String, String> displayHelpers = new LinkedHashMap<String, String>(); static { helpers.put("vanilla", "VanillaMath");
public static final String UPDATE_URL = "http://widget.mcf.li/mc-mods/minecraft/229876-betterfps.json"; public static final LinkedHashMap<String, String> helpers = new LinkedHashMap<String, String>();
2,696
<BUG>package guichaguri.betterfps; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.Properties;</BUG> import net.minecraft.client.Minecraft;
import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import java.io.InputStreamReader;
2,697
import net.minecraft.util.text.event.ClickEvent; import net.minecraft.util.text.event.HoverEvent; public class UpdateChecker implements Runnable { private static boolean updateCheck = false; private static boolean done = false; <BUG>private static Properties prop = null; public static void check() {</BUG> if(!BetterFpsConfig.getConfig().updateChecker) { done = true; return;
private static String updateVersion = null; private static String updateDownload = null; public static void check() {
2,698
thread.setDaemon(true); thread.start(); } } public static void showChat() { <BUG>if(!done) return; if(prop == null) return; if(BetterFpsHelper.VERSION.equals(prop.getProperty("version"))) { prop = null; return; }</BUG> if(!BetterFps.isClient) return;
if(updateVersion == null && updateDownload == null) return;
2,699
@CopyMode(Mode.IGNORE) // Ignore the constructor to prevent an infinite loop public HopperBlock() { } @Override @CopyMode(Mode.APPEND) <BUG>public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) { </BUG> TileEntity te = worldIn.getTileEntity(pos); if(te != null) { TileEntityHopper hopper = (TileEntityHopper)te;
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block neighborBlock) {
2,700
assertThat(entry.getPortfolioTransaction().getDate(), is(LocalDate.parse("2015-12-23"))); assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(43))); assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.FEE), is(Money.of(CurrencyUnit.EUR, 10_09 + 45_88 + 2_52 + 4_12))); } <BUG>@Test public void testDividend() throws IOException</BUG> { DABPDFExctractor extractor = new DABPDFExctractor(new Client()) {
public void testWertpapierVerkauf2() throws IOException