id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
26,601
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");
26,602
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");
26,603
} @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);
26,604
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);
26,605
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);
26,606
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);
26,607
IResource resource = (IResource) context; try { if (ClasspathUriUtil.isClasspathUri(classpathUri)) { IProject project = resource.getProject(); IJavaProject javaProject = JavaCore.create(project); <BUG>return findResourceInWorkspace(javaProject, classpathUri); }</BUG> } catch (Exception exc) { throw new ClasspathUriRes...
URI result = findResourceInWorkspace(javaProject, classpathUri); if (classpathUri.fragment() != null) result = result.appendFragment(classpathUri.fragment()); return result; }
26,608
import org.eclipse.jface.text.hyperlink.IHyperlink; import org.eclipse.jface.text.hyperlink.IHyperlinkDetector; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.widgets.Control; <BUG>import org.eclipse.ui.handlers.HandlerUtil; import org.eclipse.xtext.Cro...
import org.eclipse.xtext.Assignment; import org.eclipse.xtext.CrossReference;
26,609
if (crossLinkedEObjects.isEmpty()) return null; List<IHyperlink> links = new ArrayList<IHyperlink>(); for (EObject crossReffed : crossLinkedEObjects) { final String label = labelProvider.getText(crossReffed); <BUG>final URI uri = EcoreUtil.getURI(crossReffed); links.add(new IHyperlink() {</BUG> public IRegion getHyperl...
final URI normalized = crossReffed.eResource().getResourceSet().getURIConverter().normalize(uri); links.add(new IHyperlink() {
26,610
} public String getTypeLabel() { return null; } public void open() { <BUG>new OpenDeclarationAction(uri, locationProvider).run(); </BUG> } }); }
public String getHyperlinkText() { return label; new OpenDeclarationAction(normalized, locationProvider).run();
26,611
throw new IllegalArgumentException("Context must implement Bundle"); } Bundle bundle = (Bundle) context; try { if (ClasspathUriUtil.isClasspathUri(classpathUri)) { <BUG>return findResourceInBundle(bundle, classpathUri); }</BUG> } catch (Exception exc) { throw new ClasspathUriResolutionException(exc);
URI result = findResourceInBundle(bundle, classpathUri); if (classpathUri.fragment() != null) result = result.appendFragment(classpathUri.fragment()); return result;
26,612
} javaElement = (IJavaElement) context; try { if (ClasspathUriUtil.isClasspathUri(classpathUri)) { IJavaProject javaProject = javaElement.getJavaProject(); <BUG>return findResourceInWorkspace(javaProject, classpathUri); }</BUG> } catch (Exception exc) {
URI result = findResourceInWorkspace(javaProject, classpathUri); if (classpathUri.fragment() != null) result = result.appendFragment(classpathUri.fragment()); return result;
26,613
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;
26,614
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();
26,615
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: " +
26,616
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;
26,617
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()...
26,618
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;
26,619
} else { updateMemo(); callback.updateMemo(); } dismiss(); <BUG>}else{ </BUG> Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show(); } }
[DELETED]
26,620
} @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_memo); <BUG>ChinaPhoneHelper.setStatusBar(this,true); </BUG> topicId = getIntent().getLongExtra("topicId", -1); if (topicId == -1) { finish();
ChinaPhoneHelper.setStatusBar(this, true);
26,621
MemoEntry.COLUMN_REF_TOPIC__ID + " = ?" , new String[]{String.valueOf(topicId)}); } public Cursor selectMemo(long topicId) { Cursor c = db.query(MemoEntry.TABLE_NAME, null, MemoEntry.COLUMN_REF_TOPIC__ID + " = ?", new String[]{String.valueOf(topicId)}, null, null, <BUG>MemoEntry._ID + " DESC", null); </BUG> if (c != nu...
MemoEntry.COLUMN_ORDER + " ASC", null);
26,622
MemoEntry._ID + " = ?", new String[]{String.valueOf(memoId)}); } public long updateMemoContent(long memoId, String memoContent) { ContentValues values = new ContentValues(); <BUG>values.put(MemoEntry.COLUMN_CONTENT, memoContent); return db.update(</BUG> MemoEntry.TABLE_NAME, values, MemoEntry._ID + " = ?",
return db.update(
26,623
import android.widget.RelativeLayout; import android.widget.TextView; import com.kiminonawa.mydiary.R; import com.kiminonawa.mydiary.db.DBManager; import com.kiminonawa.mydiary.shared.EditMode; <BUG>import com.kiminonawa.mydiary.shared.ThemeManager; import java.util.List; public class MemoAdapter extends RecyclerView.A...
import com.marshalchen.ultimaterecyclerview.dragsortadapter.DragSortAdapter; public class MemoAdapter extends DragSortAdapter<DragSortAdapter.ViewHolder> implements EditMode {
26,624
private DBManager dbManager; private boolean isEditMode = false; private EditMemoDialogFragment.MemoCallback callback; private static final int TYPE_HEADER = 0; private static final int TYPE_ITEM = 1; <BUG>public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMe...
public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback, RecyclerView recyclerView) { super(recyclerView); this.mActivity = activity;
26,625
this.memoList = memoList; this.dbManager = dbManager; this.callback = callback; } @Override <BUG>public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { </BUG> View view; if (isEditMode) { if (viewType == TYPE_HEADER) {
public DragSortAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
26,626
editMemoDialogFragment.show(mActivity.getSupportFragmentManager(), "editMemoDialogFragment"); } }); } } <BUG>protected class MemoViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private View rootView; private TextView TV_memo_item_content;</BUG> private ImageView IV_memo_item_delete;
protected class MemoViewHolder extends DragSortAdapter.ViewHolder implements View.OnClickListener, View.OnLongClickListener { private ImageView IV_memo_item_dot; private TextView TV_memo_item_content;
26,627
import java.util.HashMap; import javax.swing.tree.TreePath; import jetbrains.mps.ide.ui.MPSTreeNode; import jetbrains.mps.internal.collections.runtime.ListSequence; import java.util.ArrayList; <BUG>import jetbrains.mps.internal.collections.runtime.IMapping; </BUG> import com.intellij.openapi.actionSystem.ToggleAction; ...
import jetbrains.mps.internal.collections.runtime.SetSequence;
26,628
myRightTree.resetDependencies(); myRightTree.rebuildLater(); } public void resetDependencies() { myRightTree.resetDependencies(); <BUG>Map<List<IModule>, List<IModule>> dependencies = MapSequence.fromMap(new HashMap<List<IModule>, List<IModule>>()); TreePath[] paths = myLeftTree.getSelectionPaths();</BUG> if (paths != ...
Map<List<IModule>, List<IModule>> usedlanguages = MapSequence.fromMap(new HashMap<List<IModule>, List<IModule>>()); TreePath[] paths = myLeftTree.getSelectionPaths();
26,629
} } } } <BUG>for (IMapping<List<IModule>, List<IModule>> dep : MapSequence.fromMap(dependencies)) { myRightTree.addDependency(dep.key(), dep.value(), null); }</BUG> myRightTree.rebuildLater(); } public void setShowRuntime(boolean b) {
ListSequence.fromList(MapSequence.fromMap(collection).get(from)).addSequence(ListSequence.fromList(n.getModules())); for (List<IModule> key : SetSequence.fromSet(MapSequence.fromMap(dependencies).keySet()).union(SetSequence.fromSet(MapSequence.fromMap(usedlanguages).keySet()))) { myRightTree.addDependency(key, MapSeque...
26,630
import com.intellij.openapi.actionSystem.ActionManager; import com.intellij.openapi.actionSystem.ActionPlaces; import org.jetbrains.annotations.NonNls; import jetbrains.mps.workbench.MPSDataKeys; public class DependencyPathTree extends MPSTree implements DataProvider { <BUG>private List<Tuples._3<Set<IModule>, Set<IMod...
private List<Tuples._3<Set<IModule>, Set<IModule>, Set<IModule>>> myAllDependencies = ListSequence.fromList(new ArrayList<Tuples._3<Set<IModule>, Set<IModule>, Set<IModule>>>());
26,631
ListSequence.fromList(myAllDependencies).addElement(MultiTuple.<Set<IModule>,Set<IModule>,Set<Language>>from(SetSequence.fromSetWithValues(new HashSet<IModule>(), from), SetSequence.fromSetWithValues(new HashSet<IModule>(), to), SetSequence.fromSetWithValues(new HashSet<Language>(), usedLanguage))); </BUG> } <BUG>priv...
return myShowRuntime; public void resetDependencies() { ListSequence.fromList(myAllDependencies).clear(); public void addDependency(Iterable<IModule> from, Iterable<IModule> to, Iterable<IModule> usedLanguage) { ListSequence.fromList(myAllDependencies).addElement(MultiTuple.<Set<IModule>,Set<IModule>,Set<IModule>>from(...
26,632
if (child != null) { parent.add(child); } } @Nullable <BUG>private MPSTreeNode buildDependency(IModule from, DependencyPathTree.DepType type, String role, Set<IModule> dependency, Set<Language> usedlangauge, Set<DependencyPathTree.Dep> visited) { if (SetSequence.fromSet(dependency).contains(from)) { return new Depende...
private MPSTreeNode buildDependency(IModule from, DependencyPathTree.DepType type, String role, Set<IModule> dependency, Set<IModule> usedlangauge, Set<DependencyPathTree.Dep> visited) { if ((type == DependencyPathTree.DepType.D || type == DependencyPathTree.DepType.R) && SetSequence.fromSet(dependency).contains(from))...
26,633
protected MPSTreeNode rebuild() { MPSTreeNode result = new TextMPSTreeNode((ListSequence.fromList(myAllDependencies).isEmpty() ? "no dependencies selected" : "Dependencies found" ), null); <BUG>for (Tuples._3<Set<IModule>, Set<IModule>, Set<Language>> dep : ListSequence.fromList(myAllDependencies)) { </BUG> for (IModul...
for (Tuples._3<Set<IModule>, Set<IModule>, Set<IModule>> dep : ListSequence.fromList(myAllDependencies)) {
26,634
import jetbrains.mps.project.dependency.DependenciesManager; import jetbrains.mps.internal.collections.runtime.ISelector; import jetbrains.mps.ide.ui.TextMPSTreeNode; public class ModuleDependencyNode extends MPSTreeNode { private List<IModule> myModules; <BUG>private boolean myInitialized; public ModuleDependencyNode(...
private boolean myUsedLanguage; public ModuleDependencyNode(IModule module, boolean isUsedLanguage, boolean isRuntime, IOperationContext context) { myUsedLanguage = isUsedLanguage; if (isRuntime) {
26,635
for (IModule m : SetSequence.fromSet(allModules).sort(new ISelector<IModule, Comparable<?>>() { public Comparable<?> select(IModule it) { return it.getModuleFqName(); } }, true)) { <BUG>add(new ModuleDependencyNode(m, !(SetSequence.fromSet(reqModules).contains(m)), getOperationContext())); </BUG> } if (tree.isShowUsedL...
add(new ModuleDependencyNode(m, false, !(SetSequence.fromSet(reqModules).contains(m)), getOperationContext()));
26,636
for (Language l : SetSequence.fromSet(usedLanguages).sort(new ISelector<Language, Comparable<?>>() { public Comparable<?> select(Language it) { return it.getModuleFqName(); } }, true)) { <BUG>usedlanguages.add(new ModuleDependencyNode(l, false, getOperationContext())); </BUG> } add(usedlanguages); }
usedlanguages.add(new ModuleDependencyNode(l, true, false, getOperationContext()));
26,637
package util; import java.io.BufferedReader; import java.io.IOException; <BUG>import java.io.InputStreamReader; import java.net.ConnectException;</BUG> import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder;
import java.io.OutputStreamWriter; import java.net.ConnectException;
26,638
import com.google.gson.JsonParser; import main.AnimeIndex; public class ConnectionManager { private static final String ANI_BASEURL = "https://anilist.co/api/"; <BUG>private static final String AUTH = "auth/access_token?grant_type=client_credentials&client_id=samu301295-rjxvs&client_secret=PWynCpeBALVf8GnZEJl3RT"; priv...
private static final String AUTH = "auth/access_token"; private static final String SEARCH = "anime/search/";
26,639
private static final String VERIFY_CREDENTIALS_MAL = "account/verify_credentials.xml"; private static final String ADD_ANIME_MAL = "animelist/add/"; private static final String UPDATE_ANIME_MAL = "animelist/update/"; private static final String SEARCH_MAL = "anime/search.xml?q="; private static String token; <BUG>priva...
private static int attempts = 0; public static void ConnectAndGetToken() throws java.net.ConnectException, java.net.UnknownHostException
26,640
url = new URL(ANI_BASEURL + AUTH); conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setRequestMethod("POST"); conn.setRequestProperty("User-Agent", "My Anime Manager"); <BUG>conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); rr = new BufferedReader(new InputStream...
OutputStreamWriter out = new OutputStreamWriter(conn.getOutputStream(), "UTF-8"); out.write("grant_type=client_credentials&client_id=samu301295-rjxvs&client_secret=PWynCpeBALVf8GnZEJl3RT"); out.close(); rr = new BufferedReader(new InputStreamReader(conn.getInputStream()));
26,641
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.security.DigestOutputStream; import java.security.MessageDigest; <BUG>import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collections; import java.util.List;</BUG> public final class ...
import java.text.DateFormat; import java.util.Date; import java.util.List;
26,642
package org.jboss.as.patching.runner; <BUG>import org.jboss.as.boot.DirectoryStructure; import org.jboss.as.patching.LocalPatchInfo;</BUG> import org.jboss.as.patching.PatchInfo; import org.jboss.as.patching.PatchLogger; import org.jboss.as.patching.PatchMessages;
import static org.jboss.as.patching.runner.PatchUtils.generateTimestamp; import org.jboss.as.patching.CommonAttributes; import org.jboss.as.patching.LocalPatchInfo;
26,643
private static final String PATH_DELIMITER = "/"; public static final byte[] NO_CONTENT = PatchingTask.NO_CONTENT; enum Element { ADDED_BUNDLE("added-bundle"), ADDED_MISC_CONTENT("added-misc-content"), <BUG>ADDED_MODULE("added-module"), BUNDLES("bundles"),</BUG> CUMULATIVE("cumulative"), DESCRIPTION("description"), MIS...
APPLIES_TO_VERSION("applies-to-version"), BUNDLES("bundles"),
26,644
final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { <BUG>case APPLIES_TO_VERSION: builder.addAppliesTo(value); break;</BUG> case RESULTING_VE...
[DELETED]
26,645
final StringBuilder path = new StringBuilder(); for(final String p : item.getPath()) { path.append(p).append(PATH_DELIMITER); } path.append(item.getName()); <BUG>writer.writeAttribute(Attribute.PATH.name, path.toString()); if(type != ModificationType.REMOVE) {</BUG> writer.writeAttribute(Attribute.HASH.name, bytesToHex...
if (item.isDirectory()) { writer.writeAttribute(Attribute.DIRECTORY.name, "true"); if(type != ModificationType.REMOVE) {
26,646
package org.jboss.as.patching; import org.jboss.as.controller.OperationFailedException; import org.jboss.as.patching.runner.PatchingException; import org.jboss.logging.Messages; import org.jboss.logging.annotations.Message; <BUG>import org.jboss.logging.annotations.MessageBundle; import java.io.IOException;</BUG> impor...
import org.jboss.logging.annotations.Cause; import java.io.IOException;
26,647
} return new OrientJdbcResultSet(new OrientJdbcStatement(connection), records, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT); } public ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) <BUG>throws SQL...
public String getUserName() throws SQLException { database.activateOnCurrentThread(); return database.getUser().getName();
26,648
doc.field("DATA_TYPE", java.sql.Types.OTHER); doc.field("SPECIFIC_NAME", f.getName()); records.add(doc);</BUG> } <BUG>final ODocument doc = new ODocument(); doc.field("PROCEDURE_CAT", (Object) null); doc.field("PROCEDURE_SCHEM", (Object) null); doc.field("PROCEDURE_NAME", f.getName()); doc.field("COLUMN_NAME", "return"...
final List<ODocument> records = new ArrayList<ODocument>(); for (String fName : database.getMetadata().getFunctionLibrary().getFunctionNames()) { final ODocument doc = new ODocument() .field("PROCEDURE_CAT", (Object) null) .field("PROCEDURE_SCHEM", (Object) null) .field("PROCEDURE_NAME", fName) .field("REMARKS", "") .f...
26,649
final String type; if (OMetadata.SYSTEM_CLUSTER.contains(cls.getName())) type = "SYSTEM TABLE"; else type = "TABLE"; <BUG>if (tableTypes.contains(type) && (tableNamePattern == null || tableNamePattern.equals("%") || tableNamePattern.equalsIgnoreCase(className))) { </BUG> final ODocument doc = new ODocument() .field("TA...
if (tableTypes.contains(type) && (tableNamePattern == null || tableNamePattern.equals("%") || tableNamePattern.equalsIgnoreCase(className))) {
26,650
} return new OrientJdbcResultSet(new OrientJdbcStatement(connection), records, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT); } @Override <BUG>public ResultSet getSchemas() throws SQLException { final List<ODocument> records = new ArrayList<ODocument>(); records.add(new OD...
[DELETED]
26,651
records.add(new ODocument().field("TABLE_SCHEM", database.getName()) .field("TABLE_CATALOG", database.getName()));</BUG> return new OrientJdbcResultSet(new OrientJdbcStatement(connection), records, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT); } <BUG>public ResultSet getC...
@Override public ResultSet getSchemas() throws SQLException { database.activateOnCurrentThread(); final List<ODocument> records = new ArrayList<ODocument>(); records.add(new ODocument() .field("TABLE_CATALOG", database.getName()));
26,652
} final List<ODocument> records = new ArrayList<ODocument>(); for (OIndex<?> unique : uniqueIndexes) { int keyFiledSeq = 1; for (String keyFieldName : unique.getDefinition().getFields()) { <BUG>ODocument doc = new ODocument(); doc.field("TABLE_CAT", catalog); doc.field("TABLE_SCHEM", catalog); doc.field("TABLE_NAME", t...
return new OrientJdbcResultSet(new OrientJdbcStatement(connection), records, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT);
26,653
if (!unique || oIndex.getType().equals(INDEX_TYPE.UNIQUE.name())) indexes.add(oIndex); } final List<ODocument> records = new ArrayList<ODocument>(); for (OIndex<?> idx : indexes) { <BUG>boolean notUniqueIndex = !( idx.getType().equals(INDEX_TYPE.UNIQUE.name())); final String fieldNames = idx.getDefinition().getFields()...
boolean notUniqueIndex = !(idx.getType().equals(INDEX_TYPE.UNIQUE.name())); final String fieldNames = idx.getDefinition().getFields().toString();
26,654
doc.field("DATA_TYPE", java.sql.Types.OTHER); doc.field("SPECIFIC_NAME", f.getName()); records.add(doc);</BUG> } <BUG>final ODocument doc = new ODocument(); doc.field("FUNCTION_CAT", (Object) null); doc.field("FUNCTION_SCHEM", (Object) null); doc.field("FUNCTION_NAME", f.getName()); doc.field("COLUMN_NAME", "return"); ...
final List<ODocument> records = new ArrayList<ODocument>(); for (OClass cls : classes) { final ODocument doc = new ODocument() .field("TYPE_CAT", (Object) null) .field("TYPE_SCHEM", (Object) null) .field("TYPE_NAME", cls.getName()) .field("CLASS_NAME", cls.getName()) .field("DATA_TYPE", java.sql.Types.STRUCT) .field("R...
26,655
package com.orientechnologies.orient.jdbc; import com.orientechnologies.orient.core.id.ORecordId; import org.junit.Test; import java.math.BigDecimal; <BUG>import java.sql.Date; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Statement; import java.sql.Types;</BUG> import java.util.Calenda...
import java.sql.*;
26,656
import java.sql.ResultSetMetaData; import java.sql.Statement; import java.sql.Types;</BUG> import java.util.Calendar; import java.util.TimeZone; <BUG>import static java.sql.Types.*; import static org.assertj.core.api.Assertions.*; </BUG> public class OrientJdbcResultSetMetaDataTest extends OrientJdbcBaseTest {
package com.orientechnologies.orient.jdbc; import com.orientechnologies.orient.core.id.ORecordId; import org.junit.Test; import java.math.BigDecimal; import java.sql.*; import static java.sql.Types.BIGINT; import static org.assertj.core.api.Assertions.assertThat;
26,657
import com.orientechnologies.orient.core.db.record.ORecordLazyMultiValue; import com.orientechnologies.orient.core.metadata.schema.OType; import com.orientechnologies.orient.core.record.impl.OBlob; import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.functions.ODe...
import com.orientechnologies.orient.core.sql.parser.*;
26,658
if (fields.isEmpty()) { fields.addAll(Arrays.asList(document.fieldNames())); } return fields; } <BUG>private void activateDatabaseOnCurrentThread() { statement.database.activateOnCurrentThread();</BUG> } public void close() throws SQLException { cursor = 0;
if (!statement.database.isActiveOnCurrentThread()) statement.database.activateOnCurrentThread();
26,659
else if (rawResult instanceof Collection) return ((Collection) rawResult).size(); return 0; } protected <RET> RET executeCommand(OCommandRequest query) throws SQLException { <BUG>try { return database.command(query).execute();</BUG> } catch (OQueryParsingException e) { throw new SQLSyntaxErrorException("Error while par...
database.activateOnCurrentThread(); return database.command(query).execute();
26,660
import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; <BUG>import static org.assertj.core.api.Assertions.assertThat; public class OrientDataSourceTest extends Orien...
import static org.assertj.core.api.Assertions.fail; public class OrientDataSourceTest extends OrientJdbcBaseTest {
26,661
assertThat(rs.first()).isTrue(); assertThat(rs.getString("stringKey")).isEqualTo("1"); rs.close(); statement.close(); conn.close(); <BUG>assertThat(conn.isClosed()).isTrue(); }</BUG> return Boolean.TRUE; } };
} catch (Exception e) { e.printStackTrace(); fail("WTF:::", e);
26,662
ExecutorService pool = Executors.newCachedThreadPool(); pool.submit(dbClient); pool.submit(dbClient); pool.submit(dbClient); pool.submit(dbClient); <BUG>TimeUnit.SECONDS.sleep(2); </BUG> queryTheDb.set(false); pool.shutdown(); }
TimeUnit.SECONDS.sleep(5);
26,663
import java.util.Map; import java.util.Set;</BUG> import static org.assertj.core.api.Assertions.assertThat; <BUG>import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; </BUG> public class OrientJd...
import org.junit.Test; import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.*; import static org.junit.Assert.*;
26,664
assertEquals("OrientDB", metaData.getDatabaseProductName()); assertEquals(OConstants.ORIENT_VERSION, metaData.getDatabaseProductVersion()); assertEquals(2, metaData.getDatabaseMajorVersion()); assertEquals(2, metaData.getDatabaseMinorVersion()); assertEquals("OrientDB JDBC Driver", metaData.getDriverName()); <BUG>asser...
assertEquals("OrientDB " + OConstants.getVersion() + " JDBC Driver", metaData.getDriverVersion());
26,665
final String keywordsStr = metaData.getSQLKeywords(); assertNotNull(keywordsStr); assertThat(Arrays.asList(keywordsStr.toUpperCase().split(",\\s*"))).contains("TRAVERSE"); } @Test <BUG>public void shouldRetrieveUniqueIndexInfoForTable() throws Exception { ResultSet indexInfo = metaData.getIndexInfo("OrientJdbcDatabaseM...
ResultSet indexInfo = metaData indexInfo.next();
26,666
package org.xwiki.classloader.internal; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; <BUG>import java.net.HttpURLConnection; import java.net.MalformedURLException;</BUG> import java.net.URI; import java.net.URISyntaxException; import java.net.U...
import java.net.JarURLConnection; import java.net.MalformedURLException;
26,667
import java.security.Permission; import java.util.jar.Attributes; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.jar.Manifest; <BUG>public class JarURLConnection extends java.net.URLConnection </BUG> { private URLStreamHandlerFactory handlerFactory; final JarOpener opener;
public class JarURLConnection extends java.net.JarURLConnection
26,668
.content(json(mapper, new UpdateContext())) .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(MockMvcResultMatchers.jsonPath("$.errorCode.code").value(CodeEnum.CODE_471.getLabel())) .andExpect(MockMvcResultMatchers.jsonPath("$.errorCode.reasonPhrase").value(CodeEnum.CODE_471.getShortPhras...
.andExpect(MockMvcResultMatchers.jsonPath("$.errorCode.detail").value("The parameter updateAction of type string is missing in the request"));
26,669
import java.util.List; import static com.orange.ngsi.model.CodeEnum.CODE_200; public class NgsiValidationTest { static NgsiValidation ngsiValidation = new NgsiValidation(); @Rule <BUG>public ExpectedException thrown= ExpectedException.none(); </BUG> @Test public void missingUpdateActionInUpdateContext() throws MissingR...
public ExpectedException thrown = ExpectedException.none();
26,670
package com.orange.ngsi.server; import com.orange.ngsi.exception.MissingRequestParameterException; import com.orange.ngsi.model.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; <BUG>import org.springframework.stereotype.Component; @Component</BUG> public class NgsiValidation { private static Logger logger = ...
import java.net.URI; import java.util.List; @Component
26,671
@Component</BUG> public class NgsiValidation { private static Logger logger = LoggerFactory.getLogger(NgsiValidation.class); public void checkUpdateContext(UpdateContext updateContext) throws MissingRequestParameterException { if (updateContext.getUpdateAction() == null) { <BUG>throw new MissingRequestParameterExceptio...
package com.orange.ngsi.server; import com.orange.ngsi.exception.MissingRequestParameterException; import com.orange.ngsi.model.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import java.net.URI; import java.util.List; @Component throw new MissingRequestPara...
26,672
for (ContextElementResponse contextElementResponse : notifyContext.getContextElementResponseList()) { checkContextElementResponse(contextElementResponse); } } public void checkRegisterContext(RegisterContext registerContext) throws MissingRequestParameterException { <BUG>if ((registerContext.getContextRegistrationList(...
if (nullOrEmpty(registerContext.getContextRegistrationList())) { throw new MissingRequestParameterException("contextRegistrations", "List<ContextRegistration>");
26,673
if (entityId.getIsPattern() == null) { entityId.setIsPattern(false); } } private void checkContextRegistration(ContextRegistration contextRegistration) throws MissingRequestParameterException { <BUG>if ((contextRegistration.getProvidingApplication() == null) || (contextRegistration.getProvidingApplication().toString()...
if (nullOrEmpty(contextRegistration.getProvidingApplication())){ throw new MissingRequestParameterException("providingApplication", "URI");
26,674
updateContext.setUpdateAction(null); mockMvc.perform(post("/ni/updateContext").content(json(jsonConverter, updateContext)).contentType(MediaType.APPLICATION_JSON).header("Host", "localhost").accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(MockMvcResultMatchers.jsonPath("$.errorCode.code").val...
.andExpect(MockMvcResultMatchers.jsonPath("$.errorCode.detail").value("The parameter updateAction of type string is missing in the request"));
26,675
for (LavaFlow lavaFlow : shiftFlows) { lavaFlow.shiftCounter++; } } if (bPlayer.isOnCooldown("LavaFlow")) { <BUG>remove(); </BUG> return; } start();
removeSlowly();
26,676
if (affectedBlocks.size() > 0) { removeOnDelay(); removing = true; bPlayer.addCooldown("LavaFlow", shiftCooldown); } else { <BUG>remove(); </BUG> } return; }
removeSlowly();
26,677
</BUG> } return; } if (!bPlayer.canBendIgnoreCooldowns(this)) { <BUG>remove(); </BUG> return; } else if (origin == null) { origin = player.getLocation().clone().add(0, -1, 0);
if (affectedBlocks.size() > 0) { removeOnDelay(); removing = true; bPlayer.addCooldown("LavaFlow", shiftCooldown); } else { removeSlowly(); removeSlowly();
26,678
double dSquared = distanceSquaredXZ(block.getLocation(), origin); if (dSquared > Math.pow(shiftPlatformRadius, 2)) { if (dSquared < Math.pow(currentRadius, 2) && !GeneralMethods.isRegionProtectedFromBuild(this, block.getLocation())) { if (dSquared < shiftPlatformRadius * 4 || getAdjacentLavaBlocks(block.getLocation())....
if (isPlant(block) || isSnow(block)) { if (isPlant(lower) || isSnow(lower)) { Block lower2 = lower.getRelative(BlockFace.DOWN);
26,679
} else if (makeLava && curTime < delay) { for (double x = -clickLavaRadius; x <= clickLavaRadius; x++) { for (double z = -clickLavaRadius; z <= clickLavaRadius; z++) { Location loc = origin.clone().add(x, 0, z); Block tempBlock = GeneralMethods.getTopBlock(loc, upwardFlow, downwardFlow); <BUG>if (tempBlock != null && !...
if (!isWater(tempBlock)) { if (tempBlock != null && !isLava(tempBlock) && Math.random() < particleDensity && tempBlock ParticleEffect.LAVA.display(loc, (float) Math.random(), (float) Math.random(),(float) Math.random(), 0, 1);
26,680
double dSquared = distanceSquaredXZ(tempBlock.getLocation(), origin); if (dSquared < Math.pow(radius, 2) && !GeneralMethods.isRegionProtectedFromBuild(this, loc)) { if (makeLava && !isLava(tempBlock)) { clickIsFinished = false; if (Math.random() < lavaCreateSpeed) { <BUG>if (!isLava(tempBlock)) { if (isPlant(tempBlock)...
if (!isLava(tempBlock) || isSnow(tempBlock)) { if (isPlant(tempBlock) || isSnow(tempBlock)) { if (isPlant(lower) || isSnow(lower)) { Block lower2 = lower.getRelative(BlockFace.DOWN);
26,681
import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import org.bukkit.Location; import org.bukkit.Material; <BUG>import org.bukkit.block.Block; import org.bukkit.entity.Player;</BUG> import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; import com.pr...
import org.bukkit.block.BlockFace; import org.bukkit.entity.Player;
26,682
time = System.currentTimeMillis(); if (Math.abs(Math.toDegrees(player.getEyeLocation().getDirection().angle(direction))) > 20 || !player.isSneaking()) { remove(); return; } else { <BUG>while (!isEarthbendable(block)) { if (!isTransparent(block)) {</BUG> remove(); return; }
while ((!isEarth(block) && !isSand(block))) { if (!isTransparent(block)) {
26,683
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) { if (event.isCancelled()) { return; } Player player = event.getPlayer(); <BUG>BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); ComboManager.addComboAbility(player, ClickType.RIGHT_CLICK_ENTITY); if (Paralyze.isParalyzed(player) || ChiCo...
if (!GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType()) && GeneralMethods.getElementsWithNoWeaponBending().contains(bPlayer.getBoundAbility().getElement())) { if (Paralyze.isParalyzed(player) || ChiCombo.isParalyzed(player) || Bloodbending.isBloodbent(player)
26,684
this.cooldown = cooldown; } public void setName(String name) { this.name = name; } <BUG>public class Immobilize extends ChiCombo { </BUG> public Immobilize(Player player) { super(player, "Immobilize"); }
public static class Immobilize extends ChiCombo {
26,685
package org.apache.felix.webconsole.internal.compendium; import java.io.IOException; import java.io.PrintWriter; <BUG>import java.util.Arrays; import java.util.Collections; import java.util.Dictionary; import java.util.Iterator; import java.util.TreeMap; import java.util.TreeSet;</BUG> import javax.servlet.http.HttpSe...
import java.util.*; import javax.servlet.ServletException;
26,686
import java.util.Iterator; import java.util.TreeMap; import java.util.TreeSet;</BUG> import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; <BUG>import org.apache.felix.scr.Component; import org.apache.felix.scr.Reference; import org.apache.felix.scr.ScrService;</BUG> import org.a...
package org.apache.felix.webconsole.internal.compendium; import java.io.IOException; import java.io.PrintWriter; import java.util.*; import javax.servlet.ServletException; import org.apache.felix.scr.*;
26,687
import org.apache.felix.scr.Reference; import org.apache.felix.scr.ScrService;</BUG> import org.apache.felix.webconsole.internal.BaseWebConsolePlugin; import org.apache.felix.webconsole.internal.Util; import org.apache.felix.webconsole.internal.servlet.OsgiManager; <BUG>import org.json.JSONException; import org.json.JS...
package org.apache.felix.webconsole.internal.compendium; import java.io.IOException; import java.io.PrintWriter; import java.util.*; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.felix.scr.*; import org.json.*;
26,688
public static final String NAME = "components"; public static final String LABEL = "Components"; public static final String COMPONENT_ID = "componentId"; public static final String OPERATION = "action"; public static final String OPERATION_ENABLE = "enable"; <BUG>public static final String OPERATION_DISABLE = "disable"...
public static final String OPERATION_EDIT = "edit"; private static final String SCR_SERVICE = ScrService.class.getName();
26,689
jw.endObject(); jw.endArray();</BUG> if ( details ) { gatherComponentDetails( jw, component ); <BUG>} jw.endObject();</BUG> } private void gatherComponentDetails( JSONWriter jw, Component component ) throws JSONException {
private void action( JSONWriter jw, boolean enabled, String op, String opLabel, String image ) throws JSONException jw.object(); jw.key( "enabled" ).value( enabled ); jw.key( "name" ).value( opLabel ); jw.key( "link" ).value( op ); jw.key( "image" ).value( image );
26,690
name = ( String ) boundRefs[j].getProperty( Constants.SERVICE_DESCRIPTION ); } } if ( name != null ) { <BUG>buf.append( " (" ); buf.append( name ); buf.append( ")" ); } }</BUG> }
b.append( " (" ); b.append( name ); b.append( ")" ); buf.put(b.toString());
26,691
} @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)
26,692
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))
26,693
} @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);
26,694
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);
26,695
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);
26,696
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);
26,697
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);
26,698
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));
26,699
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;
26,700
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);