id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
9,301
if (lineWidth>margin && isLine()) margin = lineWidth; if (ic!=null) { double mag = ic.getMagnification(); if (mag<1.0) margin = (int)(margin/mag); <BUG>} imp.draw(xmin-margin, ymin-margin, (xmax-xmin)+margin*2, (ymax-ymin)+margin*2);</BUG> } protected void handleMouseUp(int screenX, int screenY) { if (state==CONSTRUCTING) {
if (IJ.altKeyDown()) margin += 20; // for wipeBack imp.draw(xmin-margin, ymin-margin, (xmax-xmin)+margin*2, (ymax-ymin)+margin*2);
9,302
import java.net.*; import java.awt.image.*; import javax.swing.ImageIcon; public class ImageJ extends Frame implements ActionListener, MouseListener, KeyListener, WindowListener, ItemListener, Runnable { <BUG>public static final String VERSION = "1.49h"; </BUG> public static final String BUILD = ""; public static Color backgroundColor = new Color(237,237,237); public static final Font SansSerif12 = new Font("SansSerif", Font.PLAIN, 12);
public static final String VERSION = "1.49i";
9,303
import java.util.Locale; import java.util.Map; import java.util.TreeMap; public class DependencyConvergenceReport extends AbstractProjectInfoReport <BUG>{ private List reactorProjects; private static final int PERCENTAGE = 100;</BUG> public String getOutputName() {
private static final int PERCENTAGE = 100; private static final List SUPPORTED_FONT_FAMILY_NAMES = Arrays.asList( GraphicsEnvironment .getLocalGraphicsEnvironment().getAvailableFontFamilyNames() );
9,304
sink.section1(); sink.sectionTitle1(); sink.text( getI18nString( locale, "title" ) ); sink.sectionTitle1_(); Map dependencyMap = getDependencyMap(); <BUG>generateLegend( locale, sink ); generateStats( locale, sink, dependencyMap ); generateConvergence( locale, sink, dependencyMap ); sink.section1_();</BUG> sink.body_();
sink.lineBreak(); sink.section1_();
9,305
Iterator it = artifactMap.keySet().iterator(); while ( it.hasNext() ) { String version = (String) it.next(); sink.tableRow(); <BUG>sink.tableCell(); sink.text( version );</BUG> sink.tableCell_(); sink.tableCell(); generateVersionDetails( sink, artifactMap, version );
sink.tableCell( String.valueOf( cellWidth ) + "px" ); sink.text( version );
9,306
sink.tableCell(); sink.text( getI18nString( locale, "legend.shared" ) ); sink.tableCell_(); sink.tableRow_(); sink.tableRow(); <BUG>sink.tableCell(); iconError( sink );</BUG> sink.tableCell_(); sink.tableCell(); sink.text( getI18nString( locale, "legend.different" ) );
sink.tableCell( "15px" ); // according /images/icon_error_sml.gif iconError( sink );
9,307
sink.tableCaption(); sink.text( getI18nString( locale, "stats.caption" ) ); sink.tableCaption_();</BUG> sink.tableRow(); <BUG>sink.tableHeaderCell(); sink.text( getI18nString( locale, "stats.subprojects" ) + ":" ); sink.tableHeaderCell_();</BUG> sink.tableCell(); sink.text( String.valueOf( reactorProjects.size() ) ); sink.tableCell_();
sink.bold(); sink.bold_(); sink.tableCaption_(); sink.tableHeaderCell( headerCellWidth ); sink.text( getI18nString( locale, "stats.subprojects" ) ); sink.tableHeaderCell_();
9,308
sink.tableCell(); sink.text( String.valueOf( reactorProjects.size() ) ); sink.tableCell_(); sink.tableRow_(); sink.tableRow(); <BUG>sink.tableHeaderCell(); sink.text( getI18nString( locale, "stats.dependencies" ) + ":" ); sink.tableHeaderCell_();</BUG> sink.tableCell(); sink.text( String.valueOf( depCount ) );
sink.tableHeaderCell( headerCellWidth ); sink.text( getI18nString( locale, "stats.dependencies" ) ); sink.tableHeaderCell_();
9,309
sink.text( String.valueOf( convergence ) + "%" ); sink.bold_(); sink.tableCell_(); sink.tableRow_(); sink.tableRow(); <BUG>sink.tableHeaderCell(); sink.text( getI18nString( locale, "stats.readyrelease" ) + ":" ); sink.tableHeaderCell_();</BUG> sink.tableCell(); if ( convergence >= PERCENTAGE && snapshotCount <= 0 )
sink.tableHeaderCell( headerCellWidth ); sink.text( getI18nString( locale, "stats.readyrelease" ) ); sink.tableHeaderCell_();
9,310
{ ReverseDependencyLink p1 = (ReverseDependencyLink) o1; ReverseDependencyLink p2 = (ReverseDependencyLink) o2; return p1.getProject().getId().compareTo( p2.getProject().getId() ); } <BUG>else {</BUG> return 0; } }
iconError( sink );
9,311
import org.neo4j.kernel.impl.api.store.CursorRelationshipIterator; import org.neo4j.kernel.impl.api.store.RelationshipIterator; import org.neo4j.kernel.impl.proc.Procedures; import org.neo4j.kernel.impl.query.clientconnection.ClientConnectionInfo; import org.neo4j.register.Register.DoubleLongRegister; <BUG>import org.neo4j.storageengine.api.NodeItem; import org.neo4j.storageengine.api.RelationshipItem;</BUG> import org.neo4j.storageengine.api.Token; import org.neo4j.storageengine.api.lock.ResourceType; import org.neo4j.storageengine.api.schema.PopulationProgress;
import org.neo4j.storageengine.api.PropertyItem; import org.neo4j.storageengine.api.RelationshipItem;
9,312
import org.neo4j.kernel.api.schema_new.constaints.ConstraintDescriptor; import org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor; import org.neo4j.kernel.impl.api.RelationshipVisitor; import org.neo4j.kernel.impl.api.store.RelationshipIterator; import org.neo4j.register.Register.DoubleLongRegister; <BUG>import org.neo4j.storageengine.api.NodeItem; import org.neo4j.storageengine.api.RelationshipItem;</BUG> import org.neo4j.storageengine.api.Token; import org.neo4j.storageengine.api.lock.ResourceType; import org.neo4j.storageengine.api.schema.PopulationProgress;
import org.neo4j.storageengine.api.PropertyItem; import org.neo4j.storageengine.api.RelationshipItem;
9,313
<EXCEPTION extends Exception> void relationshipVisit( long relId, RelationshipVisitor<EXCEPTION> visitor ) throws EntityNotFoundException, EXCEPTION; long nodesGetCount(); long relationshipsGetCount(); Cursor<NodeItem> nodeCursorById( long nodeId ) throws EntityNotFoundException; <BUG>Cursor<RelationshipItem> relationshipCursorById( long relId ) throws EntityNotFoundException; NewIndexDescriptor indexGetForLabelAndPropertyKey( NodePropertyDescriptor descriptor )</BUG> throws SchemaRuleNotFoundException; Iterator<NewIndexDescriptor> indexesGetForLabel( int labelId ); Iterator<NewIndexDescriptor> indexesGetAll();
Cursor<PropertyItem> nodeGetProperties( NodeItem node ); NewIndexDescriptor indexGetForLabelAndPropertyKey( NodePropertyDescriptor descriptor )
9,314
import org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor; import org.neo4j.kernel.guard.Guard; import org.neo4j.kernel.impl.api.operations.EntityReadOperations; import org.neo4j.kernel.impl.api.operations.EntityWriteOperations; import org.neo4j.storageengine.api.Direction; <BUG>import org.neo4j.storageengine.api.NodeItem; import org.neo4j.storageengine.api.RelationshipItem;</BUG> public class GuardingStatementOperations implements EntityWriteOperations, EntityReadOperations
import org.neo4j.storageengine.api.PropertyItem; import org.neo4j.storageengine.api.RelationshipItem;
9,315
package org.neo4j.kernel.impl.api; <BUG>import java.util.Iterator; import org.neo4j.collection.primitive.PrimitiveIntIterator;</BUG> import org.neo4j.collection.primitive.PrimitiveIntSet; import org.neo4j.collection.primitive.PrimitiveLongIterator; import org.neo4j.cursor.Cursor;
import org.neo4j.collection.primitive.PrimitiveIntCollection; import org.neo4j.collection.primitive.PrimitiveIntIterator;
9,316
import org.neo4j.collection.primitive.PrimitiveIntIterator;</BUG> import org.neo4j.collection.primitive.PrimitiveIntSet; import org.neo4j.collection.primitive.PrimitiveLongIterator; import org.neo4j.cursor.Cursor; import org.neo4j.helpers.Strings; <BUG>import org.neo4j.helpers.collection.CastingIterator; import org.neo4j.kernel.api.constraints.NodePropertyConstraint; import org.neo4j.kernel.api.constraints.UniquenessConstraint;</BUG> import org.neo4j.kernel.api.exceptions.EntityNotFoundException; import org.neo4j.kernel.api.exceptions.InvalidTransactionTypeKernelException;
package org.neo4j.kernel.impl.api; import java.util.Iterator; import org.neo4j.collection.primitive.PrimitiveIntCollection; import org.neo4j.collection.primitive.PrimitiveIntIterator;
9,317
import org.neo4j.kernel.impl.api.operations.EntityOperations; import org.neo4j.kernel.impl.api.operations.EntityReadOperations; import org.neo4j.kernel.impl.api.operations.EntityWriteOperations; import org.neo4j.kernel.impl.api.operations.SchemaReadOperations; import org.neo4j.kernel.impl.api.operations.SchemaWriteOperations; <BUG>import org.neo4j.kernel.impl.api.store.EntityLoadingIterator; </BUG> import org.neo4j.kernel.impl.constraints.ConstraintSemantics; import org.neo4j.kernel.impl.locking.LockTracer; import org.neo4j.kernel.impl.locking.Locks;
import org.neo4j.kernel.impl.api.store.NodeLoadingIterator;
9,318
package org.neo4j.kernel.impl.api; import java.util.Arrays; import java.util.Iterator; import java.util.Map; <BUG>import org.neo4j.collection.primitive.Primitive; import org.neo4j.collection.primitive.PrimitiveIntIterator; import org.neo4j.collection.primitive.PrimitiveIntSet; import org.neo4j.collection.primitive.PrimitiveLongCollections;</BUG> import org.neo4j.collection.primitive.PrimitiveLongIterator;
import org.neo4j.collection.primitive.PrimitiveIntCollection; import org.neo4j.collection.primitive.PrimitiveIntStack; import org.neo4j.collection.primitive.PrimitiveLongCollections;
9,319
import org.neo4j.collection.primitive.PrimitiveIntIterator; import org.neo4j.collection.primitive.PrimitiveIntSet; import org.neo4j.collection.primitive.PrimitiveLongCollections;</BUG> import org.neo4j.collection.primitive.PrimitiveLongIterator; import org.neo4j.collection.primitive.PrimitiveLongResourceIterator; <BUG>import org.neo4j.cursor.Cursor; import org.neo4j.kernel.api.DataWriteOperations;</BUG> import org.neo4j.kernel.api.LegacyIndex; import org.neo4j.kernel.api.LegacyIndexHits; import org.neo4j.kernel.api.Statement;
import org.neo4j.collection.primitive.PrimitiveIntStack; import org.neo4j.collection.primitive.PrimitiveLongCollections; import org.neo4j.graphdb.NotFoundException; import org.neo4j.kernel.api.DataWriteOperations;
9,320
if ( node.hasLabel( labelId ) ) { return false; } state.txState().nodeDoAddLabel( labelId, node.id() ); <BUG>try ( Cursor<PropertyItem> properties = node.properties() ) </BUG> { while ( properties.next() ) {
try ( Cursor<PropertyItem> properties = nodeGetProperties( state, node ) )
9,321
if ( !node.hasLabel( labelId ) ) { return false; } state.txState().nodeDoRemoveLabel( labelId, node.id() ); <BUG>try ( Cursor<PropertyItem> properties = node.properties() ) </BUG> { while ( properties.next() ) {
try ( Cursor<PropertyItem> properties = nodeGetProperties( state, node ) )
9,322
DataWriteOperations ops = state.dataWriteOperations(); try ( Cursor<NodeItem> cursor = nodeCursorById( state, nodeId ) ) { NodeItem node = cursor.get(); Property existingProperty; <BUG>try ( Cursor<PropertyItem> properties = node.property( property.propertyKeyId() ) ) </BUG> { if ( !properties.next() ) {
try ( Cursor<PropertyItem> properties = nodeGetPropertyCursor( state, node, property.propertyKeyId() ) )
9,323
@Override public boolean test( long nodeId ) { try ( Cursor<NodeItem> node = readOperations.nodeCursorById( state, nodeId ) ) { <BUG>return inRange( node.get().getProperty( propertyKeyId ) ); }</BUG> catch ( EntityNotFoundException e ) { return false;
try return nodeProperty( nodeId, propertyKeyId ).valueEquals( value ); } catch ( EntityNotFoundException ignored )
9,324
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.security.DigestOutputStream; import java.security.MessageDigest; <BUG>import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collections; import java.util.List;</BUG> public final class PatchUtils {
import java.text.DateFormat; import java.util.Date; import java.util.List;
9,325
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;
9,326
private static final String PATH_DELIMITER = "/"; public static final byte[] NO_CONTENT = PatchingTask.NO_CONTENT; enum Element { ADDED_BUNDLE("added-bundle"), ADDED_MISC_CONTENT("added-misc-content"), <BUG>ADDED_MODULE("added-module"), BUNDLES("bundles"),</BUG> CUMULATIVE("cumulative"), DESCRIPTION("description"), MISC_FILES("misc-files"),
APPLIES_TO_VERSION("applies-to-version"), BUNDLES("bundles"),
9,327
final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { <BUG>case APPLIES_TO_VERSION: builder.addAppliesTo(value); break;</BUG> case RESULTING_VERSION: if(type == Patch.PatchType.CUMULATIVE) {
[DELETED]
9,328
final StringBuilder path = new StringBuilder(); for(final String p : item.getPath()) { path.append(p).append(PATH_DELIMITER); } path.append(item.getName()); <BUG>writer.writeAttribute(Attribute.PATH.name, path.toString()); if(type != ModificationType.REMOVE) {</BUG> writer.writeAttribute(Attribute.HASH.name, bytesToHexString(item.getContentHash())); } if(type != ModificationType.ADD) {
if (item.isDirectory()) { writer.writeAttribute(Attribute.DIRECTORY.name, "true"); if(type != ModificationType.REMOVE) {
9,329
package org.jboss.as.patching; import org.jboss.as.controller.OperationFailedException; import org.jboss.as.patching.runner.PatchingException; import org.jboss.logging.Messages; import org.jboss.logging.annotations.Message; <BUG>import org.jboss.logging.annotations.MessageBundle; import java.io.IOException;</BUG> import java.util.List; @MessageBundle(projectCode = "JBAS") public interface PatchMessages {
import org.jboss.logging.annotations.Cause; import java.io.IOException;
9,330
return runningProgramCountMatches(program, runId, expected); }</BUG> }, 10, TimeUnit.SECONDS, 50, TimeUnit.MILLISECONDS); } <BUG>private boolean runningProgramCountMatches(Id.Program program, String runId, int expectedCount) throws Exception { </BUG> String path = String.format("apps/%s/workflows/%s/%s/current", program.getApplicationId(), program.getId(), runId); HttpResponse response = doGet(getVersionedAPIPath(path, program.getNamespaceId())); if (response.getStatusLine().getStatusCode() == 200) { String json = EntityUtils.toString(response.getEntity());
private void verifyRunningProgramCount(final Id.Program program, final String runId, final int expected) Tasks.waitFor(expected, new Callable<Integer>() { @Override public Integer call() throws Exception { return runningProgramCount(program, runId); private Integer runningProgramCount(Id.Program program, String runId) throws Exception {
9,331
String path = String.format("apps/%s/workflows/%s/%s/current", program.getApplicationId(), program.getId(), runId); HttpResponse response = doGet(getVersionedAPIPath(path, program.getNamespaceId())); if (response.getStatusLine().getStatusCode() == 200) { String json = EntityUtils.toString(response.getEntity()); List<WorkflowActionNode> output = GSON.fromJson(json, LIST_WORKFLOWACTIONNODE_TYPE); <BUG>if (output.size() == expectedCount) { return true; } } return false;</BUG> }
return output.size(); return null;
9,332
</BUG> Assert.assertTrue(historyRuns.size() == 1); String runId = historyRuns.get(0).get("runid"); while (!firstSimpleActionFile.exists()) { <BUG>TimeUnit.SECONDS.sleep(1); </BUG> } verifyRunningProgramCount(programId, runId, 1); suspendWorkflow(programId, runId, 200); waitState(programId, "SUSPENDED");
runtimeArguments.put("last.simple.action.file", lastSimpleActionFile.getAbsolutePath()); runtimeArguments.put("last.simple.action.donefile", lastSimpleActionDoneFile.getAbsolutePath()); setAndTestRuntimeArgs(programId, runtimeArguments); startProgram(programId, 200); waitState(programId, "RUNNING"); List<Map<String, String>> historyRuns = getWorkflowRuns(programId, "running"); TimeUnit.MILLISECONDS.sleep(50);
9,333
verifyAndGetWorkflowRuns(programId, "suspended"); resumeWorkflow(programId, runId, 200); waitState(programId, "RUNNING"); verifyAndGetWorkflowRuns(programId, "running"); resumeWorkflow(programId, runId, 409); <BUG>while (!forkedSimpleActionFile.exists() && !anotherForkedSimpleActionFile.exists()) { TimeUnit.SECONDS.sleep(1); </BUG> }
suspendWorkflow(programId, runId, 409); firstSimpleActionDoneFile.createNewFile(); verifyRunningProgramCount(programId, runId, 0); while (!(forkedSimpleActionFile.exists() && anotherForkedSimpleActionFile.exists())) { TimeUnit.MILLISECONDS.sleep(50);
9,334
response = getWorkflowCurrentStatus(programId, historyRuns.get(0).get("runid")); Assert.assertEquals(200, response.getStatusLine().getStatusCode()); String json = EntityUtils.toString(response.getEntity()); List<WorkflowActionNode> nodes = GSON.fromJson(json, LIST_WORKFLOWACTIONNODE_TYPE); Assert.assertEquals(1, nodes.size()); <BUG>Assert.assertEquals("SleepAction", nodes.get(0).getProgram().getProgramName()); </BUG> response = getWorkflowCurrentStatus(programId, historyRuns.get(1).get("runid")); Assert.assertEquals(200, response.getStatusLine().getStatusCode()); json = EntityUtils.toString(response.getEntity());
Assert.assertEquals("SimpleAction", nodes.get(0).getProgram().getProgramName());
9,335
response = getWorkflowCurrentStatus(programId, historyRuns.get(1).get("runid")); Assert.assertEquals(200, response.getStatusLine().getStatusCode()); json = EntityUtils.toString(response.getEntity()); nodes = GSON.fromJson(json, LIST_WORKFLOWACTIONNODE_TYPE); Assert.assertEquals(1, nodes.size()); <BUG>Assert.assertEquals("SleepAction", nodes.get(0).getProgram().getProgramName()); String deleteURL = getVersionedAPIPath("apps/" + appWithConcurrentWorkflow, Constants.Gateway</BUG> .API_VERSION_3_TOKEN, defaultNamespace); deleteApplication(60, deleteURL, 200);
Assert.assertEquals("SimpleAction", nodes.get(0).getProgram().getProgramName()); simpleActionDoneFile.createNewFile(); String deleteURL = getVersionedAPIPath("apps/" + appWithConcurrentWorkflow, Constants.Gateway
9,336
List<Map<String, String>> historyRuns = verifyAndGetWorkflowRuns(programId, "running"); </BUG> Assert.assertTrue(historyRuns.size() == 1); String runId = historyRuns.get(0).get("runid"); <BUG>while (!oneActionFile.exists() && !anotherActionFile.exists()) { TimeUnit.SECONDS.sleep(1); </BUG> } verifyRunningProgramCount(programId, runId, 2);
workflowWithFork); Map<String, String> runtimeArguments = ImmutableMap.of("done.file", doneFile.getAbsolutePath(), "oneaction.file", oneActionFile.getAbsolutePath(), "anotheraction.file", anotherActionFile.getAbsolutePath()); setAndTestRuntimeArgs(programId, runtimeArguments); startProgram(programId, 200); waitState(programId, "RUNNING"); List<Map<String, String>> historyRuns = getWorkflowRuns(programId, "running"); while (!(oneActionFile.exists() && anotherActionFile.exists())) { TimeUnit.MILLISECONDS.sleep(50);
9,337
historyRuns = verifyAndGetWorkflowRuns(programId, "running"); </BUG> Assert.assertTrue(historyRuns.size() == 1); runId = historyRuns.get(0).get("runid"); <BUG>while (!oneActionFile.exists() && !anotherActionFile.exists()) { TimeUnit.SECONDS.sleep(1); </BUG> } verifyRunningProgramCount(programId, runId, 2);
response = getWorkflowCurrentStatus(programId, runId); Assert.assertEquals(404, response.getStatusLine().getStatusCode()); verifyAndGetWorkflowRuns(programId, "killed"); oneActionFile.delete(); anotherActionFile.delete(); startProgram(programId, 200); waitState(programId, "RUNNING"); historyRuns = getWorkflowRuns(programId, "running"); while (!(oneActionFile.exists() && anotherActionFile.exists())) { TimeUnit.MILLISECONDS.sleep(50);
9,338
package co.cask.cdap; import co.cask.cdap.api.app.AbstractApplication; import co.cask.cdap.api.schedule.Schedules; import co.cask.cdap.api.workflow.AbstractWorkflow; import co.cask.cdap.api.workflow.AbstractWorkflowAction; <BUG>import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.TimeUnit;</BUG> public class ConcurrentWorkflowApp extends AbstractApplication { @Override
import com.google.common.collect.Maps; import java.io.File; import java.util.Map; import java.util.concurrent.TimeUnit;
9,339
package org.jboss.forge.furnace.proxy; import java.lang.ref.WeakReference; import java.lang.reflect.Method; import java.util.Collection; import java.util.Map; <BUG>import java.util.concurrent.ConcurrentHashMap; import org.jboss.forge.furnace.proxy.javassist.util.proxy.MethodFilter;</BUG> import org.jboss.forge.furnace.proxy.javassist.util.proxy.Proxy; import org.jboss.forge.furnace.proxy.javassist.util.proxy.ProxyFactory; import org.jboss.forge.furnace.proxy.javassist.util.proxy.ProxyObject;
import java.util.regex.Pattern; import org.jboss.forge.furnace.proxy.javassist.util.proxy.MethodFilter;
9,340
import org.jboss.forge.furnace.proxy.javassist.util.proxy.Proxy; import org.jboss.forge.furnace.proxy.javassist.util.proxy.ProxyFactory; import org.jboss.forge.furnace.proxy.javassist.util.proxy.ProxyObject; import org.jboss.forge.furnace.util.Assert; public class Proxies <BUG>{ private static MethodFilter filter = new ForgeProxyMethodFilter();</BUG> private static Map<String, Map<String, WeakReference<Class<?>>>> classCache = new ConcurrentHashMap<>(); @SuppressWarnings("unchecked") public static <T> T enhance(final ClassLoader loader, Object instance, ForgeProxy handler)
private static final Pattern JAVA_PACKAGE_REGEXP = Pattern.compile("^(java\\.).*"); private static final Pattern JAVA_LANG_PACKAGE_REGEXP = Pattern.compile("^(java\\.lang).*"); private static final Pattern JAVA_IO_PACKAGE_REGEXP = Pattern.compile("^(java\\.io).*"); private static final Pattern JAVA_NET_PACKAGE_REGEXP = Pattern.compile("^(java\\.net).*"); private static MethodFilter filter = new ForgeProxyMethodFilter();
9,341
catch (InstantiationException e) { throw new IllegalStateException( "Could not instantiate proxy for object [" + instance + "] of type [" + type + "]. For optimal proxy compatibility, ensure " + <BUG>"that this type is an interface, or a class with a default constructor.", e); }</BUG> catch (IllegalAccessException e) { throw new IllegalStateException(e);
"that this type is an interface, or a class with a default constructor.", }
9,342
catch (InstantiationException e) { throw new IllegalStateException( "Could not instantiate proxy for type [" + type + "]. For optimal proxy compatibility, ensure " + <BUG>"that this type is an interface, or a class with a default constructor.", e); }</BUG> catch (IllegalAccessException e) { throw new IllegalStateException(e);
"Could not instantiate proxy for object [" + instance + "] of type [" + type "that this type is an interface, or a class with a default constructor.", }
9,343
} else { updateMemo(); callback.updateMemo(); } dismiss(); <BUG>}else{ </BUG> Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show(); } }
[DELETED]
9,344
} @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);
9,345
MemoEntry.COLUMN_REF_TOPIC__ID + " = ?" , new String[]{String.valueOf(topicId)}); } public Cursor selectMemo(long topicId) { Cursor c = db.query(MemoEntry.TABLE_NAME, null, MemoEntry.COLUMN_REF_TOPIC__ID + " = ?", new String[]{String.valueOf(topicId)}, null, null, <BUG>MemoEntry._ID + " DESC", null); </BUG> if (c != null) { c.moveToFirst(); }
MemoEntry.COLUMN_ORDER + " ASC", null);
9,346
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(
9,347
import android.widget.RelativeLayout; import android.widget.TextView; import com.kiminonawa.mydiary.R; import com.kiminonawa.mydiary.db.DBManager; import com.kiminonawa.mydiary.shared.EditMode; <BUG>import com.kiminonawa.mydiary.shared.ThemeManager; import java.util.List; public class MemoAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements EditMode { </BUG> private List<MemoEntity> memoList;
import com.marshalchen.ultimaterecyclerview.dragsortadapter.DragSortAdapter; public class MemoAdapter extends DragSortAdapter<DragSortAdapter.ViewHolder> implements EditMode {
9,348
private DBManager dbManager; private boolean isEditMode = false; private EditMemoDialogFragment.MemoCallback callback; private static final int TYPE_HEADER = 0; private static final int TYPE_ITEM = 1; <BUG>public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback) { this.mActivity = activity;</BUG> this.topicId = topicId; this.memoList = memoList;
public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback, RecyclerView recyclerView) { super(recyclerView); this.mActivity = activity;
9,349
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) {
9,350
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;
9,351
package org.glowroot.agent.config; import com.google.common.collect.ImmutableList; <BUG>import org.immutables.value.Value; import org.glowroot.wire.api.model.AgentConfigOuterClass.AgentConfig;</BUG> @Value.Immutable public abstract class UiConfig { @Value.Default
import org.glowroot.common.config.ConfigDefaults; import org.glowroot.wire.api.model.AgentConfigOuterClass.AgentConfig;
9,352
class RepoAdminImpl implements RepoAdmin { private final DataSource dataSource; private final List<CappedDatabase> rollupCappedDatabases; private final CappedDatabase traceCappedDatabase; private final ConfigRepository configRepository; <BUG>private final AgentDao agentDao; </BUG> private final GaugeValueDao gaugeValueDao; private final GaugeNameDao gaugeNameDao; private final TransactionTypeDao transactionTypeDao;
private final EnvironmentDao agentDao;
9,353
private final TransactionTypeDao transactionTypeDao; private final FullQueryTextDao fullQueryTextDao; private final TraceAttributeNameDao traceAttributeNameDao; RepoAdminImpl(DataSource dataSource, List<CappedDatabase> rollupCappedDatabases, CappedDatabase traceCappedDatabase, ConfigRepository configRepository, <BUG>AgentDao agentDao, GaugeValueDao gaugeValueDao, GaugeNameDao gaugeNameDao, </BUG> TransactionTypeDao transactionTypeDao, FullQueryTextDao fullQueryTextDao, TraceAttributeNameDao traceAttributeNameDao) { this.dataSource = dataSource;
EnvironmentDao agentDao, GaugeValueDao gaugeValueDao, GaugeNameDao gaugeNameDao,
9,354
this.fullQueryTextDao = fullQueryTextDao; this.traceAttributeNameDao = traceAttributeNameDao; } @Override public void deleteAllData() throws Exception { <BUG>Environment environment = agentDao.readEnvironment(""); dataSource.deleteAll();</BUG> agentDao.reinitAfterDeletingDatabase(); gaugeValueDao.reinitAfterDeletingDatabase(); gaugeNameDao.invalidateCache();
Environment environment = agentDao.read(""); dataSource.deleteAll();
9,355
public class SimpleRepoModule { private static final long SNAPSHOT_REAPER_PERIOD_MINUTES = 5; private final DataSource dataSource; private final ImmutableList<CappedDatabase> rollupCappedDatabases; private final CappedDatabase traceCappedDatabase; <BUG>private final AgentDao agentDao; private final TransactionTypeDao transactionTypeDao;</BUG> private final AggregateDao aggregateDao; private final TraceAttributeNameDao traceAttributeNameDao; private final TraceDao traceDao;
private final EnvironmentDao environmentDao; private final TransactionTypeDao transactionTypeDao;
9,356
rollupCappedDatabases.add(new CappedDatabase(file, sizeKb, ticker)); } this.rollupCappedDatabases = ImmutableList.copyOf(rollupCappedDatabases); traceCappedDatabase = new CappedDatabase(new File(dataDir, "trace-detail.capped.db"), storageConfig.traceCappedDatabaseSizeMb() * 1024, ticker); <BUG>agentDao = new AgentDao(dataSource); </BUG> transactionTypeDao = new TransactionTypeDao(dataSource); rollupLevelService = new RollupLevelService(configRepository, clock); FullQueryTextDao fullQueryTextDao = new FullQueryTextDao(dataSource);
environmentDao = new EnvironmentDao(dataSource);
9,357
traceDao = new TraceDao(dataSource, traceCappedDatabase, transactionTypeDao, fullQueryTextDao, traceAttributeNameDao); GaugeNameDao gaugeNameDao = new GaugeNameDao(dataSource); gaugeValueDao = new GaugeValueDao(dataSource, gaugeNameDao, clock); repoAdmin = new RepoAdminImpl(dataSource, rollupCappedDatabases, traceCappedDatabase, <BUG>configRepository, agentDao, gaugeValueDao, gaugeNameDao, transactionTypeDao, </BUG> fullQueryTextDao, traceAttributeNameDao); if (backgroundExecutor == null) { reaperRunnable = null;
configRepository, environmentDao, gaugeValueDao, gaugeNameDao, transactionTypeDao,
9,358
new TraceCappedDatabaseStats(traceCappedDatabase), "org.glowroot:type=TraceCappedDatabase"); platformMBeanServerLifecycle.lazyRegisterMBean(new H2DatabaseStats(dataSource), "org.glowroot:type=H2Database"); } <BUG>public AgentDao getAgentDao() { return agentDao; </BUG> } public TransactionTypeRepository getTransactionTypeRepository() {
public EnvironmentDao getEnvironmentDao() { return environmentDao;
9,359
package org.glowroot.agent.embedded.init; import java.io.Closeable; import java.io.File; <BUG>import java.lang.instrument.Instrumentation; import java.util.Map;</BUG> import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService;
import java.util.List; import java.util.Map;
9,360
import java.util.concurrent.ScheduledExecutorService; import javax.annotation.Nullable; import com.google.common.base.MoreObjects; import com.google.common.base.Stopwatch; import com.google.common.base.Supplier; <BUG>import com.google.common.base.Ticker; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;</BUG> import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.glowroot.agent.collector.Collector.AgentConfigUpdater;
import com.google.common.collect.ImmutableList; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
9,361
import org.glowroot.agent.init.EnvironmentCreator; import org.glowroot.agent.init.GlowrootThinAgentInit; import org.glowroot.agent.init.JRebelWorkaround; import org.glowroot.agent.util.LazyPlatformMBeanServer; import org.glowroot.common.live.LiveAggregateRepository.LiveAggregateRepositoryNop; <BUG>import org.glowroot.common.live.LiveTraceRepository.LiveTraceRepositoryNop; import org.glowroot.common.repo.ConfigRepository; import org.glowroot.common.util.Clock;</BUG> import org.glowroot.common.util.OnlyUsedByTests; import org.glowroot.ui.CreateUiModuleBuilder;
import org.glowroot.common.repo.AgentRepository; import org.glowroot.common.repo.ImmutableAgentRollup; import org.glowroot.common.util.Clock;
9,362
SimpleRepoModule simpleRepoModule = new SimpleRepoModule(dataSource, dataDir, clock, ticker, configRepository, backgroundExecutor); simpleRepoModule.registerMBeans(new PlatformMBeanServerLifecycleImpl( agentModule.getLazyPlatformMBeanServer())); CollectorImpl collectorImpl = new CollectorImpl( <BUG>simpleRepoModule.getAgentDao(), simpleRepoModule.getAggregateDao(), simpleRepoModule.getTraceDao(),</BUG> simpleRepoModule.getGaugeValueDao()); collectorProxy.setInstance(collectorImpl); collectorImpl.init(baseDir, EnvironmentCreator.create(glowrootVersion),
simpleRepoModule.getEnvironmentDao(), simpleRepoModule.getTraceDao(),
9,363
.baseDir(baseDir) .glowrootDir(glowrootDir) .ticker(ticker) .clock(clock) .liveJvmService(agentModule.getLiveJvmService()) <BUG>.configRepository(simpleRepoModule.getConfigRepository()) .agentRepository(simpleRepoModule.getAgentDao()) </BUG> .transactionTypeRepository(simpleRepoModule.getTransactionTypeRepository()) .traceAttributeNameRepository(
.agentRepository(new AgentRepositoryImpl()) .environmentRepository(simpleRepoModule.getEnvironmentDao())
9,364
.baseDir(baseDir) .glowrootDir(glowrootDir) .ticker(ticker) .clock(clock) .liveJvmService(null) <BUG>.configRepository(simpleRepoModule.getConfigRepository()) .agentRepository(simpleRepoModule.getAgentDao()) </BUG> .transactionTypeRepository(simpleRepoModule.getTransactionTypeRepository()) .traceAttributeNameRepository(
.liveJvmService(agentModule.getLiveJvmService()) .agentRepository(new AgentRepositoryImpl()) .environmentRepository(simpleRepoModule.getEnvironmentDao())
9,365
} @Override public void lazyRegisterMBean(Object object, String name) { lazyPlatformMBeanServer.lazyRegisterMBean(object, name); } <BUG>} } </BUG>
void initEmbeddedServer() throws Exception { if (simpleRepoModule == null) { return;
9,366
List<GaugeConfig> configs = Lists.newArrayList(configService.getGaugeConfigs()); for (GaugeConfig loopConfig : configs) { if (loopConfig.mbeanObjectName().equals(gaugeConfig.getMbeanObjectName())) { throw new DuplicateMBeanObjectNameException(); } <BUG>} String version = Versions.getVersion(gaugeConfig); for (GaugeConfig loopConfig : configs) { if (Versions.getVersion(loopConfig.toProto()).equals(version)) { throw new IllegalStateException("This exact gauge already exists"); } } configs.add(GaugeConfig.create(gaugeConfig));</BUG> configService.updateGaugeConfigs(configs);
[DELETED]
9,367
configService.updateGaugeConfigs(configs); } } @Override public void updateGaugeConfig(String agentId, AgentConfig.GaugeConfig gaugeConfig, <BUG>String priorVersion) throws Exception { synchronized (writeLock) {</BUG> List<GaugeConfig> configs = Lists.newArrayList(configService.getGaugeConfigs()); boolean found = false; for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) {
GaugeConfig config = GaugeConfig.create(gaugeConfig); synchronized (writeLock) {
9,368
boolean found = false; for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) { GaugeConfig loopConfig = i.next(); String loopVersion = Versions.getVersion(loopConfig.toProto()); if (loopVersion.equals(priorVersion)) { <BUG>i.set(GaugeConfig.create(gaugeConfig)); found = true; break;</BUG> } else if (loopConfig.mbeanObjectName().equals(gaugeConfig.getMbeanObjectName())) { throw new DuplicateMBeanObjectNameException();
i.set(config);
9,369
boolean found = false; for (ListIterator<PluginConfig> i = configs.listIterator(); i.hasNext();) { PluginConfig loopPluginConfig = i.next(); if (pluginId.equals(loopPluginConfig.id())) { String loopVersion = Versions.getVersion(loopPluginConfig.toProto()); <BUG>checkVersionsEqual(loopVersion, priorVersion); PluginDescriptor pluginDescriptor = getPluginDescriptor(pluginId); i.set(PluginConfig.create(pluginDescriptor, properties));</BUG> found = true; break;
for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) { GaugeConfig loopConfig = i.next(); String loopVersion = Versions.getVersion(loopConfig.toProto()); if (loopVersion.equals(version)) { i.remove();
9,370
boolean found = false; for (ListIterator<InstrumentationConfig> i = configs.listIterator(); i.hasNext();) { InstrumentationConfig loopConfig = i.next(); String loopVersion = Versions.getVersion(loopConfig.toProto()); if (loopVersion.equals(priorVersion)) { <BUG>i.set(InstrumentationConfig.create(instrumentationConfig)); found = true; break; }</BUG> }
i.set(config); } else if (loopConfig.equals(config)) { throw new IllegalStateException("This exact instrumentation already exists");
9,371
package org.glowroot.agent.embedded.init; import java.io.File; import java.util.List; import org.glowroot.agent.collector.Collector; <BUG>import org.glowroot.agent.embedded.repo.AgentDao; import org.glowroot.agent.embedded.repo.AggregateDao; import org.glowroot.agent.embedded.repo.GaugeValueDao;</BUG> import org.glowroot.agent.embedded.repo.TraceDao; import org.glowroot.wire.api.model.AgentConfigOuterClass.AgentConfig;
import org.glowroot.agent.embedded.repo.EnvironmentDao; import org.glowroot.agent.embedded.repo.GaugeValueDao;
9,372
</BUG> private final AggregateDao aggregateDao; private final TraceDao traceDao; private final GaugeValueDao gaugeValueDao; <BUG>CollectorImpl(AgentDao agentDao, AggregateDao aggregateRepository, TraceDao traceRepository, GaugeValueDao gaugeValueRepository) { this.agentDao = agentDao;</BUG> this.aggregateDao = aggregateRepository; this.traceDao = traceRepository;
import org.glowroot.wire.api.model.CollectorServiceOuterClass.Environment; import org.glowroot.wire.api.model.CollectorServiceOuterClass.GaugeValue; import org.glowroot.wire.api.model.CollectorServiceOuterClass.LogEvent; import org.glowroot.wire.api.model.TraceOuterClass.Trace; class CollectorImpl implements Collector { private final EnvironmentDao agentDao; CollectorImpl(EnvironmentDao agentDao, AggregateDao aggregateRepository, TraceDao traceRepository, GaugeValueDao gaugeValueRepository) { this.agentDao = agentDao;
9,373
import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; <BUG>import java.util.List; import me.guichaguri.betterfps.BetterFpsHelper;</BUG> import me.guichaguri.betterfps.gui.GuiCycleButton.GuiBooleanButton; import me.guichaguri.betterfps.tweaker.BetterFpsTweaker; import net.minecraft.client.Minecraft;
import me.guichaguri.betterfps.BetterFpsConfig; import me.guichaguri.betterfps.BetterFpsHelper;
9,374
} public GuiBetterFpsConfig(GuiScreen parent) { this.parent = parent; } private List<GuiButton> initButtons() { <BUG>List<GuiButton> buttons = new ArrayList<GuiButton>(); buttons.add(new AlgorithmButton(2, "Algorithm", BetterFpsHelper.displayHelpers, BetterFpsHelper.ALGORITHM_NAME, new String[] { "The algorithm of sine & cosine methods",</BUG> "§cRequires restarting to take effect",
BetterFpsConfig config = BetterFpsConfig.getConfig(); config.algorithm, new String[] { "The algorithm of sine & cosine methods",
9,375
public class UpdateChecker implements Runnable { private static boolean updateCheck = false; private static boolean done = false; private static Properties prop = null; public static void check() { <BUG>if(!BetterFpsHelper.CHECK_UPDATES) { done = true;</BUG> return; } if(!updateCheck) {
if(!BetterFpsConfig.instance.updateChecker) { done = true;
9,376
JOptionPane.showMessageDialog(this, "The install location is invalid.", "Oops!", JOptionPane.WARNING_MESSAGE); return; } BetterFpsHelper.MCDIR = mcDir; <BUG>BetterFpsHelper.loadConfig(); BetterFpsHelper.CONFIG.setProperty("algorithm", bestAlgorithm); BetterFpsHelper.saveConfig();</BUG> setVisible(false); System.out.println(bestAlgorithm);
[DELETED]
9,377
package me.guichaguri.betterfps; <BUG>import net.minecraft.block.BlockRedstoneDiode; import net.minecraft.block.BlockRedstoneWire;</BUG> import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class BetterFps {
[DELETED]
9,378
package me.guichaguri.betterfps.transformers; <BUG>import java.util.Iterator; import me.guichaguri.betterfps.BetterFpsHelper;</BUG> import me.guichaguri.betterfps.tweaker.Naming; import net.minecraft.launchwrapper.IClassTransformer; import org.objectweb.asm.ClassReader;
import me.guichaguri.betterfps.BetterFpsConfig; import me.guichaguri.betterfps.BetterFpsHelper;
9,379
return patchMinecraft(bytes); } return bytes; } public byte[] patchMinecraft(byte[] bytes) { <BUG>if(BetterFpsHelper.CONFIG == null) BetterFpsHelper.loadConfig(); ClassNode classNode = new ClassNode();</BUG> ClassReader classReader = new ClassReader(bytes); classReader.accept(classNode, ClassReader.SKIP_FRAMES); boolean patch = false;
BetterFpsConfig config = BetterFpsConfig.getConfig(); if(config == null) config = BetterFpsHelper.loadConfig(); ClassNode classNode = new ClassNode();
9,380
classReader.accept(classNode, ClassReader.SKIP_FRAMES); boolean patch = false; Iterator<FieldNode> i = classNode.fields.iterator(); while(i.hasNext()) { FieldNode field = i.next(); <BUG>if((!BetterFpsHelper.PREALLOCATE_MEMORY) && (Naming.F_memoryReserve.is(field.name, field.desc))) { i.remove();</BUG> patch = true; } }
if((!config.preallocateMemory) && (Naming.F_memoryReserve.is(field.name, field.desc))) { i.remove();
9,381
package me.guichaguri.betterfps.transformers; import java.util.Iterator; import java.util.jar.JarFile; import java.util.zip.ZipEntry; <BUG>import me.guichaguri.betterfps.BetterFps; import me.guichaguri.betterfps.BetterFpsHelper;</BUG> import me.guichaguri.betterfps.tweaker.Naming; import net.minecraft.launchwrapper.IClassTransformer; import org.objectweb.asm.ClassReader;
import me.guichaguri.betterfps.BetterFpsConfig; import me.guichaguri.betterfps.BetterFpsHelper;
9,382
protected static Minecraft mc; private static KeyBinding MENU_KEY = new KeyBinding("BetterFps", Keyboard.KEY_F12, "key.categories.misc"); public static void start(Minecraft minecraft) { mc = minecraft; BetterFps.isClient = true; <BUG>if(BetterFpsHelper.CONFIG == null) { BetterFpsHelper.loadConfig();</BUG> } BetterFpsHelper.init(); mc.gameSettings.keyBindings = ArrayUtils.add(mc.gameSettings.keyBindings, MENU_KEY);
if(BetterFpsConfig.instance == null) { BetterFpsHelper.loadConfig();
9,383
ReorderingTypes.discontinuousWithPrevious, ReorderingTypes.discontinuous2WithPrevious, ReorderingTypes.monotoneWithNext, ReorderingTypes.swapWithNext, ReorderingTypes.discontinuousWithNext, ReorderingTypes.discontinuous2WithNext }; <BUG>static final ReorderingTypes[] msd2cBidirectionalPositionMapping = { </BUG> ReorderingTypes.monotoneWithPrevious, ReorderingTypes.swapWithPrevious, ReorderingTypes.discontinuousWithPrevious, ReorderingTypes.discontinuous2WithPrevious,
ReorderingTypes.discontinuousWithNext }; public static final ReorderingTypes[] msd2BidirectionalPositionMapping = { public static final ReorderingTypes[] msd2cBidirectionalPositionMapping = {
9,384
final int srcLen = sentencePair.sourceLength(); for (j_p = fj; j_p < srcLen; ++j_p) { // look for first aligned source (vertical axis) if ( ! sentencePair.isSourceUnaligned(j_p)) break; } if (i_p < 0 && j_p == srcLen) return false; <BUG>int[] a_i_p = sentencePair.e2f(i_p); int[] a_j_p = sentencePair.f2e(j_p); if (ArrayMath.max(a_j_p) > ei || ArrayMath.min(a_i_p) < fj) return false; int max_j = Math.max(j_p, ArrayMath.max(a_i_p)); int min_i = Math.min(i_p, ArrayMath.min(a_j_p)); while (min_i < i_p || max_j > j_p) { </BUG> for (; j_p <= max_j; ++j_p) {
int[] a_i_p = e2f(sentencePair, i_p); int[] a_j_p = f2e(sentencePair, j_p); if (max(a_j_p) > ei || min(a_i_p) < fj) return false; int max_j = Math.max(j_p, max(a_i_p)); int min_i = Math.min(i_p, min(a_j_p)); while (min_i < i_p || max_j >= j_p) {
9,385
final int srcLen = sentencePair.sourceLength(); for (j_p = fj; j_p < srcLen; ++j_p) { // look for first aligned source (vertical axis) if ( ! sentencePair.isSourceUnaligned(j_p)) break; } if (i_p == tgtLen && j_p == srcLen) return false; <BUG>int[] a_i_p = sentencePair.e2f(i_p); int[] a_j_p = sentencePair.f2e(j_p); if (ArrayMath.min(a_j_p) < ei || ArrayMath.min(a_i_p) < fj) return false; int max_j = Math.max(j_p, ArrayMath.max(a_i_p)); int max_i = Math.max(i_p, ArrayMath.max(a_j_p)); while (max_i > i_p || max_j > j_p) { </BUG> for (; j_p <= max_j; ++j_p) {
if (i_p < 0 && j_p == srcLen) return false; int[] a_i_p = e2f(sentencePair, i_p); int[] a_j_p = f2e(sentencePair, j_p); if (max(a_j_p) > ei || min(a_i_p) < fj) return false; int max_j = Math.max(j_p, max(a_i_p)); int min_i = Math.min(i_p, min(a_j_p)); while (min_i < i_p || max_j >= j_p) {
9,386
<BUG>package edu.stanford.nlp.mt.decoder.feat.base; import java.util.*; import java.io.*;</BUG> import edu.stanford.nlp.mt.decoder.feat.DerivationFeaturizer;
import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet; import java.util.Deque; import java.util.LinkedList; import java.util.List;
9,387
+ has2Disc); System.err.println("Use containment orientation: " + hasContainment); System.err.printf("Forward orientation: %s\n", forwardOrientationComputation); System.err.printf("Backward orientation: %s\n", <BUG>backwardOrientationComputation); featureTags = new String[mlrt.positionalMapping.length];</BUG> for (int i = 0; i < mlrt.positionalMapping.length; i++) featureTags[i] = String.format("%s:%s", FEATURE_PREFIX, mlrt.positionalMapping[i]);
this.positionalMapping = mlrt.positionalMapping; featureTags = new String[mlrt.positionalMapping.length];
9,388
if (forwardOrientation == ReorderingTypes.discontinuousWithPrevious) forwardOrientation = ReorderingTypes.discontinuous2WithPrevious; if (backwardOrientation == ReorderingTypes.discontinuousWithNext) backwardOrientation = ReorderingTypes.discontinuous2WithNext; } <BUG>for (int i = 0; i < mlrt.positionalMapping.length; i++) { ReorderingTypes type = mlrt.positionalMapping[i]; if (type == forwardOrientation || type == backwardOrientation) { if (!usePrior(mlrt.positionalMapping[i])) { boolean firstInDTU = f.getSegmentIdx() == 0;</BUG> if (scores != null && firstInDTU) {
for (int i = 0; i < positionalMapping.length; i++) { ReorderingTypes type = positionalMapping[i]; if (!usePrior(positionalMapping[i])) { boolean firstInDTU = f.getSegmentIdx() == 0;
9,389
int fEndPos = f.derivation.rule.sourceCoverage.length(); int fLen = f.sourceSentence.size(); assert (fEndPos <= fLen); ReorderingTypes finalBackwardOrientation = (fEndPos == fLen) ? ReorderingTypes.monotoneWithNext : ReorderingTypes.discontinuousWithNext; <BUG>float[] finalScores = mlrt .getReorderingScores(f.derivation.rule.abstractRule); for (int i = 0; i < mlrt.positionalMapping.length; ++i) { ReorderingTypes type = mlrt.positionalMapping[i]; if (type == finalBackwardOrientation) { if (usePrior(mlrt.positionalMapping[i])) { if (finalScores != null)</BUG> values.add(new FeatureValue<String>(featureTags[i],
float[] finalScores = mlrt == null ? f.rule.abstractRule.reoderingScores : mlrt.getReorderingScores(f.derivation.rule.abstractRule); for (int i = 0; i < positionalMapping.length; ++i) { ReorderingTypes type = positionalMapping[i]; if (usePrior(positionalMapping[i])) { if (finalScores != null)
9,390
f.sourceSentence.size()); if (DEBUG && f.sourceSentence.size() < 20) { AlignmentGrid.printDecoderGrid(f, System.err); System.err.println(); } <BUG>Deque<String> lines = new LinkedList<String>(); while (f != null) {</BUG> HierBlock hb = (HierBlock) f.getState(this); lines.addFirst(String.format("cs=%s sz=%d (M,S)=(%d,%d) (M,S)=(%d,%d)", hb.cs, hb.stackSz, monotoneWithPrevious(f) ? 1 : 0,
Deque<String> lines = new LinkedList<>(); while (f != null) {
9,391
final Thread thread = Thread.currentThread(); final ClassLoader previousContextClassLoader = thread.getContextClassLoader(); final ClassLoader classLoader = new URLClassLoader(new DefaultClassPath(runSpec.getClasspath()).getAsURLArray(), null); thread.setContextClassLoader(classLoader); try { <BUG>ClassLoader docsClassLoader = classLoader; Object buildDocHandler = runAdapter.getBuildDocHandler(docsClassLoader, runSpec.getClasspath()); Object buildLink = runAdapter.getBuildLink(classLoader, runSpec.getProjectPath(), runSpec.getApplicationJar(), runSpec.getChangingClasspath(), runSpec.getAssetsJar(), runSpec.getAssetsDirs()); runAdapter.runDevHttpServer(classLoader, docsClassLoader, buildLink, buildDocHandler, runSpec.getHttpPort()); } catch (Exception e) {</BUG> throw UncheckedException.throwAsUncheckedException(e);
Object buildDocHandler = runAdapter.getBuildDocHandler(classLoader, runSpec.getClasspath()); runAdapter.runDevHttpServer(classLoader, classLoader, buildLink, buildDocHandler, runSpec.getHttpPort()); } catch (Exception e) {
9,392
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 {
9,393
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));
9,394
} 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()
9,395
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));
9,396
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));
9,397
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 {
9,398
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);
9,399
queue.put(new RowContainer(new NotifyingSSTableIdentityIterator(iter, condition))); } else { logger.debug("parallel eager deserialize from " + iter.getPath()); <BUG>queue.put(new RowContainer(new Row(iter.getKey(), iter.getColumnFamilyWithColumns(TreeMapBackedSortedColumns.factory())))); </BUG> } } }
queue.put(new RowContainer(new Row(iter.getKey(), iter.getColumnFamilyWithColumns(ArrayBackedSortedColumns.factory()))));
9,400
package org.apache.cassandra.db.compaction; import java.io.DataOutput; import java.io.IOException; <BUG>import java.security.MessageDigest; import java.util.List; import com.google.common.base.Functions; import org.apache.cassandra.db.*; import org.apache.cassandra.db.index.SecondaryIndexManager;</BUG> import org.apache.cassandra.io.sstable.ColumnStats;
import java.util.ArrayList; import java.util.Comparator; import java.util.Iterator; import org.apache.cassandra.db.columniterator.IdentityQueryFilter; import org.apache.cassandra.db.filter.IDiskAtomFilter; import org.apache.cassandra.db.index.SecondaryIndexManager;