id int64 1 49k | buggy stringlengths 34 37.5k | fixed stringlengths 2 37k |
|---|---|---|
8,101 | Class<? extends TokenizerFactory> type = tokenizerSettings.getAsClass("type", null, "org.elasticsearch.index.analysis.", "TokenizerFactory");
if (type == null) {
throw new IllegalArgumentException("Tokenizer [" + tokenizerName + "] must have a type associated with it");
}
tokenizerBinder.addBinding(tokenizerName).toProvider(FactoryProvider.newFactory(TokenizerFactoryFactory.class, type)).in(Scopes.SINGLETON);
<BUG>}
for (AnalysisBinderProcessor processor : processors) {
processor.processTokenizers(tokenizerBinder, tokenizersSettings);
</BUG>
}
| AnalysisBinderProcessor.TokenizersBindings tokenizersBindings = new AnalysisBinderProcessor.TokenizersBindings(tokenizerBinder, tokenizersSettings);
processor.processTokenizers(tokenizersBindings);
|
8,102 | } else {
throw new IllegalArgumentException("Analyzer [" + analyzerName + "] must have a type associated with it or a tokenizer");
}
}
analyzerBinder.addBinding(analyzerName).toProvider(FactoryProvider.newFactory(AnalyzerProviderFactory.class, type)).in(Scopes.SINGLETON);
<BUG>}
for (AnalysisBinderProcessor processor : processors) {
processor.processAnalyzers(analyzerBinder, analyzersSettings);
</BUG>
}
| AnalysisBinderProcessor.AnalyzersBindings analyzersBindings = new AnalysisBinderProcessor.AnalyzersBindings(analyzerBinder, analyzersSettings, indicesAnalysisService);
processor.processAnalyzers(analyzersBindings);
|
8,103 | import org.elasticsearch.index.settings.IndexSettings;
import org.elasticsearch.util.inject.Inject;
import org.elasticsearch.util.inject.assistedinject.Assisted;
import org.elasticsearch.util.lucene.Lucene;
import org.elasticsearch.util.settings.Settings;
<BUG>public class ThaiAnalyzerProvider extends AbstractAnalyzerProvider<ThaiAnalyzer> {
</BUG>
private final ThaiAnalyzer analyzer;
@Inject public ThaiAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
super(index, indexSettings, name);
| public class ThaiAnalyzerProvider extends AbstractIndexAnalyzerProvider<ThaiAnalyzer> {
|
8,104 | import org.elasticsearch.util.inject.Inject;
import org.elasticsearch.util.inject.assistedinject.Assisted;
import org.elasticsearch.util.lucene.Lucene;
import org.elasticsearch.util.settings.Settings;
import java.util.Set;
<BUG>public class PersianAnalyzerProvider extends AbstractAnalyzerProvider<PersianAnalyzer> {
</BUG>
private final Set<?> stopWords;
private final PersianAnalyzer analyzer;
@Inject public PersianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
| public class PersianAnalyzerProvider extends AbstractIndexAnalyzerProvider<PersianAnalyzer> {
|
8,105 | import org.elasticsearch.index.Index;
import org.elasticsearch.index.settings.IndexSettings;
import org.elasticsearch.util.inject.Inject;
import org.elasticsearch.util.inject.assistedinject.Assisted;
import org.elasticsearch.util.settings.Settings;
<BUG>public class ChineseAnalyzerProvider extends AbstractAnalyzerProvider<ChineseAnalyzer> {
</BUG>
private final ChineseAnalyzer analyzer;
@Inject public ChineseAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
super(index, indexSettings, name);
| public class ChineseAnalyzerProvider extends AbstractIndexAnalyzerProvider<ChineseAnalyzer> {
|
8,106 | import org.elasticsearch.util.inject.Inject;
import org.elasticsearch.util.inject.assistedinject.Assisted;
import org.elasticsearch.util.lucene.Lucene;
import org.elasticsearch.util.settings.Settings;
import java.util.Set;
<BUG>public class BrazilianAnalyzerProvider extends AbstractAnalyzerProvider<BrazilianAnalyzer> {
</BUG>
private final Set<?> stopWords;
private final Set<?> stemExclusion;
private final BrazilianAnalyzer analyzer;
| public class BrazilianAnalyzerProvider extends AbstractIndexAnalyzerProvider<BrazilianAnalyzer> {
|
8,107 | import org.elasticsearch.util.inject.Inject;
import org.elasticsearch.util.inject.assistedinject.Assisted;
import org.elasticsearch.util.lucene.Lucene;
import org.elasticsearch.util.settings.Settings;
import java.util.Set;
<BUG>public class GermanAnalyzerProvider extends AbstractAnalyzerProvider<GermanAnalyzer> {
</BUG>
private final Set<?> stopWords;
private final Set<?> stemExclusion;
private final GermanAnalyzer analyzer;
| public class GermanAnalyzerProvider extends AbstractIndexAnalyzerProvider<GermanAnalyzer> {
|
8,108 | import org.elasticsearch.util.settings.ImmutableSettings;
import org.elasticsearch.util.settings.Settings;
import java.util.List;
import java.util.Map;
import static org.elasticsearch.util.collect.Lists.*;
<BUG>public class CustomAnalyzerProvider extends AbstractAnalyzerProvider<CustomAnalyzer> {
</BUG>
private final TokenizerFactory tokenizerFactory;
private final TokenFilterFactory[] tokenFilterFactories;
private final CustomAnalyzer customAnalyzer;
| public class CustomAnalyzerProvider extends AbstractIndexAnalyzerProvider<CustomAnalyzer> {
|
8,109 | import org.elasticsearch.util.inject.Inject;
import org.elasticsearch.util.inject.assistedinject.Assisted;
import org.elasticsearch.util.lucene.Lucene;
import org.elasticsearch.util.settings.Settings;
import java.util.Set;
<BUG>public class DutchAnalyzerProvider extends AbstractAnalyzerProvider<DutchAnalyzer> {
</BUG>
private final Set<?> stopWords;
private final Set<?> stemExclusion;
private final DutchAnalyzer analyzer;
| public class DutchAnalyzerProvider extends AbstractIndexAnalyzerProvider<DutchAnalyzer> {
|
8,110 | import org.elasticsearch.util.inject.Inject;
import org.elasticsearch.util.inject.assistedinject.Assisted;
import org.elasticsearch.util.lucene.Lucene;
import org.elasticsearch.util.settings.Settings;
import java.util.Set;
<BUG>public class FrenchAnalyzerProvider extends AbstractAnalyzerProvider<FrenchAnalyzer> {
</BUG>
private final Set<?> stopWords;
private final Set<?> stemExclusion;
private final FrenchAnalyzer analyzer;
| public class FrenchAnalyzerProvider extends AbstractIndexAnalyzerProvider<FrenchAnalyzer> {
|
8,111 | import org.elasticsearch.index.Index;
import org.elasticsearch.index.settings.IndexSettings;
import org.elasticsearch.util.inject.Inject;
import org.elasticsearch.util.inject.assistedinject.Assisted;
import org.elasticsearch.util.settings.Settings;
<BUG>public class SimpleAnalyzerProvider extends AbstractAnalyzerProvider<SimpleAnalyzer> {
</BUG>
private final SimpleAnalyzer simpleAnalyzer;
@Inject public SimpleAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
super(index, indexSettings, name);
| public class SimpleAnalyzerProvider extends AbstractIndexAnalyzerProvider<SimpleAnalyzer> {
|
8,112 | import org.elasticsearch.util.collect.Iterators;
import org.elasticsearch.util.inject.Inject;
import org.elasticsearch.util.inject.assistedinject.Assisted;
import org.elasticsearch.util.lucene.Lucene;
import org.elasticsearch.util.settings.Settings;
<BUG>public class RussianAnalyzerProvider extends AbstractAnalyzerProvider<RussianAnalyzer> {
</BUG>
private final RussianAnalyzer analyzer;
@Inject public RussianAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
super(index, indexSettings, name);
| public class RussianAnalyzerProvider extends AbstractIndexAnalyzerProvider<RussianAnalyzer> {
|
8,113 | import org.elasticsearch.util.inject.Inject;
import org.elasticsearch.util.inject.assistedinject.Assisted;
import org.elasticsearch.util.lucene.Lucene;
import org.elasticsearch.util.settings.Settings;
import java.util.Set;
<BUG>public class GreekAnalyzerProvider extends AbstractAnalyzerProvider<GreekAnalyzer> {
</BUG>
private final Set<?> stopWords;
private final GreekAnalyzer analyzer;
@Inject public GreekAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
| public class GreekAnalyzerProvider extends AbstractIndexAnalyzerProvider<GreekAnalyzer> {
|
8,114 | import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
<BUG>public class DetectorTest extends Assert {
private static final String TRAINING_EN = "a a a b b c c d e";</BUG>
private static final String TRAINING_FR = "a b b c c c d d d";
private static final String TRAINING_JA = "\u3042 \u3042 \u3042 \u3044 \u3046 \u3048 \u3048";
private Detector detect;
| private static final String UNKNOWN_LANG = "unknown";
private static final String TRAINING_EN = "a a a b b c c d e";
|
8,115 | assertEquals(langList.size(), 3);
assertEquals(langList.get(0), "en");
assertEquals(langList.get(1), "fr");
assertEquals(langList.get(2), "ja");
}
<BUG>@Test(expectedExceptions = LanguageDetectionException.class)
public void testPunctuation() throws LanguageDetectionException {
assertEquals(detect.detect("..."), "none");
</BUG>
}
| [DELETED] |
8,116 | package com.liferay.portlet.wsrp;
import com.liferay.portal.kernel.util.GetterUtil;
<BUG>import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.util.WebKeys;</BUG>
import com.liferay.portal.wsrp.util.WSRPUtil;
import com.liferay.portlet.StrutsPortlet;
| import com.liferay.portal.kernel.util.StringMaker;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.util.WebKeys;
|
8,117 | i++;
}
return ret;
}
@Override
<BUG>public void visitClosureExpression(final ClosureExpression expression) {
SharedVariableCollector collector = new SharedVariableCollector(getSourceUnit());</BUG>
collector.visitClosureExpression(expression);
Set<VariableExpression> closureSharedExpressions = collector.getClosureSharedExpressions();
Map<VariableExpression, ListHashMap> typesBeforeVisit = null;
| final Map<VariableExpression, ClassNode> varOrigType = new HashMap<VariableExpression, ClassNode>();
Statement code = expression.getCode();
code.visit(new VariableExpressionTypeMemoizer(varOrigType));
Map<VariableExpression, List<ClassNode>> oldTracker = pushAssignmentTracking();
SharedVariableCollector collector = new SharedVariableCollector(getSourceUnit());
|
8,118 | }
@Override
public void visitField(final FieldNode field) {
result.set(field.getType());
}
<BUG>}
}
</BUG>
| } finally {
popAssignmentTracking(oldTracker);
|
8,119 | public class Relationship {
private static final int ARROWHEAD_LENGTH = 10;</BUG>
private static final int ARROWHEAD_WIDTH = ARROWHEAD_LENGTH / 2;
private Line edge;
private HTML label;
<BUG>private Widget from;
private Widget to;
</BUG>
private Line arrowheadLeft;
| package org.neo4j.server.ext.visualization.gwt.client;
import org.vaadin.gwtgraphics.client.Line;
import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.HTML;
private static final int ARROWHEAD_LENGTH = 10;
private Node from;
private Node to;
|
8,120 | arrowheadRight = new Line(0, 0, 0, 0);
parent.add(arrowheadRight);
updateArrowhead();
}
private void addEdge(VGraphComponent parent) {
<BUG>edge = new Line((int) Math.round(getCenterX(from)),
(int) Math.round(getCenterY(from)),
(int) Math.round(getCenterX(to)),
(int) Math.round(getCenterY(to)));
</BUG>
parent.add(edge);
| [DELETED] |
8,121 | label = new HTML("<div style='text-align:center'>" + type + "</div>");
parent.add(label);
Style style = label.getElement().getStyle();
style.setPosition(Position.ABSOLUTE);
style.setBackgroundColor("white");
<BUG>style.setFontSize(9, Unit.PX);
</BUG>
updateLabel();
}
void update() {
| style.setFontSize(10, Unit.PX);
|
8,122 | void update() {
updateEdge();
updateLabel();
updateArrowhead();
}
<BUG>private void updateArrowhead() {
double originX = getArrowheadOrigin(getCenterX(from), getCenterX(to));
double originY = getArrowheadOrigin(getCenterY(from), getCenterY(to));
double angle = Math.atan2(getCenterY(to) - getCenterY(from),
getCenterX(to) - getCenterX(from));</BUG>
double leftX = originX
| double fromX = from.getCenterX();
double fromY = from.getCenterY();
double toX = to.getCenterX();
double toY = to.getCenterY();
double originX = getArrowheadOrigin(fromX, toX);
double originY = getArrowheadOrigin(fromY, toY);
double angle = Math.atan2(toY - fromY, toX - fromX);
|
8,123 | double rightY = originY
+ rotateY(-ARROWHEAD_LENGTH, ARROWHEAD_WIDTH, angle);
updateLine(arrowheadRight, originX, originY, rightX, rightY);
}
private void updateEdge() {
<BUG>updateLine(edge, getCenterX(from), getCenterY(from), getCenterX(to),
getCenterY(to));
</BUG>
}
| updateLine(edge, from.getCenterX(), from.getCenterY(), to.getCenterX(),
to.getCenterY());
|
8,124 | package com.projecttango.examples.java.augmentedreality;
import com.google.atap.tangoservice.Tango;
import com.google.atap.tangoservice.Tango.OnTangoUpdateListener;
import com.google.atap.tangoservice.TangoCameraIntrinsics;
import com.google.atap.tangoservice.TangoConfig;
<BUG>import com.google.atap.tangoservice.TangoCoordinateFramePair;
import com.google.atap.tangoservice.TangoEvent;</BUG>
import com.google.atap.tangoservice.TangoOutOfDateException;
import com.google.atap.tangoservice.TangoPoseData;
import com.google.atap.tangoservice.TangoXyzIjData;
| import com.google.atap.tangoservice.TangoErrorException;
import com.google.atap.tangoservice.TangoEvent;
|
8,125 | 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();
|
8,126 | 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: " +
|
8,127 | import org.rajawali3d.materials.Material;
import org.rajawali3d.materials.methods.DiffuseMethod;
import org.rajawali3d.materials.textures.ATexture;
import org.rajawali3d.materials.textures.StreamingTexture;
import org.rajawali3d.materials.textures.Texture;
<BUG>import org.rajawali3d.math.Matrix4;
import org.rajawali3d.math.vector.Vector3;</BUG>
import org.rajawali3d.primitives.ScreenQuad;
import org.rajawali3d.primitives.Sphere;
import org.rajawali3d.renderer.RajawaliRenderer;
| import org.rajawali3d.math.Quaternion;
import org.rajawali3d.math.vector.Vector3;
|
8,128 | translationMoon.setRepeatMode(Animation.RepeatMode.INFINITE);
translationMoon.setTransformable3D(moon);
getCurrentScene().registerAnimation(translationMoon);
translationMoon.play();
}
<BUG>public void updateRenderCameraPose(TangoPoseData devicePose, DeviceExtrinsics extrinsics) {
Pose cameraPose = ScenePoseCalculator.toOpenGlCameraPose(devicePose, extrinsics);
getCurrentCamera().setRotation(cameraPose.getOrientation());
getCurrentCamera().setPosition(cameraPose.getPosition());
}</BUG>
public int getTextureId() {
| public void updateRenderCameraPose(TangoPoseData cameraPose) {
float[] rotation = cameraPose.getRotationAsFloats();
float[] translation = cameraPose.getTranslationAsFloats();
Quaternion quaternion = new Quaternion(rotation[3], rotation[0], rotation[1], rotation[2]);
getCurrentCamera().setRotation(quaternion.conjugate());
getCurrentCamera().setPosition(translation[0], translation[1], translation[2]);
|
8,129 | package com.projecttango.examples.java.helloareadescription;
import com.google.atap.tangoservice.Tango;
<BUG>import com.google.atap.tangoservice.Tango.OnTangoUpdateListener;
import com.google.atap.tangoservice.TangoConfig;</BUG>
import com.google.atap.tangoservice.TangoCoordinateFramePair;
import com.google.atap.tangoservice.TangoErrorException;
import com.google.atap.tangoservice.TangoEvent;
| import com.google.atap.tangoservice.TangoAreaDescriptionMetaData;
import com.google.atap.tangoservice.TangoConfig;
|
8,130 | package model;
import model.battlefield.Battlefield;
import model.battlefield.BattlefieldFactory;
<BUG>import model.battlefield.map.parcel.ParcelManager;
import model.builders.entity.definitions.DefParser;</BUG>
import event.BattleFieldUpdateEvent;
import event.EventManager;
import geometry.tools.LogUtil;
| import model.builders.MapArtisan;
import model.builders.entity.definitions.DefParser;
|
8,131 | private static void setBattlefield(Battlefield battlefield) {
if (battlefield != null) {
ModelManager.battlefield = battlefield;
battlefieldReady = true;
ParcelManager.createParcelMeshes(ModelManager.getBattlefield().getMap());
<BUG>getBattlefield().getMap().resetTrinkets();
getBattlefield().getEngagement().reset();</BUG>
EventManager.post(new BattleFieldUpdateEvent());
LogUtil.logger.info("Done.");
}
| MapArtisan.act(getBattlefield().getMap());
getBattlefield().getEngagement().reset();
|
8,132 | package controller.editor;
<BUG>import model.ModelManager;
import model.battlefield.lighting.SunLight;</BUG>
import model.editor.ToolManager;
import com.jme3.input.InputManager;
import com.jme3.input.KeyInput;
| import model.Reporter;
import model.battlefield.lighting.SunLight;
|
8,133 | protected final static String DEC_GREEN = "decgreen";
protected final static String DEC_BLUE = "decblue";
protected final static String RESET_COLOR = "resetcolor";
protected final static String SAVE = "save";
protected final static String LOAD = "load";
<BUG>protected final static String NEW = "new";
boolean analogUnpressed = false;</BUG>
EditorInputInterpreter(EditorController controller) {
super(controller);
controller.spatialSelector.centered = false;
| protected final static String REPORT = "report";
boolean analogUnpressed = false;
|
8,134 | mappings = new String[] { SWITCH_CTRL_1, SWITCH_CTRL_2, SWITCH_CTRL_3,
PRIMARY_ACTION, SECONDARY_ACTION, TOGGLE_PENCIL_SHAPE, TOGGLE_PENCIL_MODE, INC_SELECTOR_RADIUS, DEC_SELECTOR_RADIUS, SET_CLIFF_TOOL, SET_HEIGHT_TOOL,
SET_ATLAS_TOOL, SET_RAMP_TOOL, SET_UNIT_TOOL,
TOGGLE_GRID, TOGGLE_SOWER, TOGGLE_SET, TOGGLE_OPERATION, INC_AIRBRUSH_FALLOF, DEC_AIRBRUSH_FALLOF,
TOGGLE_LIGHT_COMP, INC_DAYTIME, DEC_DAYTIME, COMPASS_EAST, COMPASS_WEST, INC_INTENSITY, DEC_INTENSITY, TOGGLE_SPEED, DEC_RED, DEC_GREEN,
<BUG>DEC_BLUE, RESET_COLOR, SAVE, LOAD, NEW, };
</BUG>
}
@Override
protected void registerInputs(InputManager inputManager) {
| DEC_BLUE, RESET_COLOR, SAVE, LOAD, NEW, REPORT};
|
8,135 | inputManager.addMapping(DEC_GREEN, new KeyTrigger(KeyInput.KEY_NUMPAD2));
inputManager.addMapping(DEC_BLUE, new KeyTrigger(KeyInput.KEY_NUMPAD3));
inputManager.addMapping(RESET_COLOR, new KeyTrigger(KeyInput.KEY_NUMPAD0));
inputManager.addMapping(SAVE, new KeyTrigger(KeyInput.KEY_F5));
inputManager.addMapping(LOAD, new KeyTrigger(KeyInput.KEY_F9));
<BUG>inputManager.addMapping(NEW, new KeyTrigger(KeyInput.KEY_F12));
inputManager.addListener(this, mappings);</BUG>
}
@Override
protected void unregisterInputs(InputManager inputManager) {
| inputManager.addMapping(REPORT, new KeyTrigger(KeyInput.KEY_SPACE));
inputManager.addListener(this, mappings);
|
8,136 | case LOAD:
ModelManager.loadBattlefield();
break;
case NEW:
ModelManager.setNewBattlefield();
<BUG>break;
}</BUG>
ctrl.guiController.askRedraw();
}
}
| case REPORT:
Reporter.reportAll();
|
8,137 | List<MapStyleBuilder> builders = BuilderManager.getAllMapStyleBuilders();
List<String> ids = new ArrayList<>();
for (MapStyleBuilder b : builders) {
ids.add(b.getId());
}
<BUG>int selIndex = ids.indexOf(ModelManager.getBattlefield().getMap().mapStyleID);
</BUG>
fillDropDown(DROPDOWN_STYLE_ID, ids, selIndex);
}
private void drawPencilPanel() {
| int selIndex = ids.indexOf(ModelManager.getBattlefield().getMap().getMapStyleID());
|
8,138 | <BUG>package geometry.structure.grid;
public class Node {
protected final int index;
protected final Grid<? extends Node> grid;
public Node(Grid<? extends Node> grid, int index) {</BUG>
this.grid = grid;
| import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonProperty
@JsonIgnore
protected Grid<? extends Node> grid;
public Node(Grid<? extends Node> grid, int index) {
|
8,139 | package geometry.structure.grid;
import geometry.collections.Map2D;
import geometry.geom2d.Point2D;
import java.util.ArrayList;
import java.util.List;
<BUG>public class Grid<T extends Node> extends Map2D<T> {
public Grid(int width, int height) {</BUG>
super(width, height);
}
public T getNorthNode(T n){
| public Grid(){
super();
public Grid(int width, int height) {
|
8,140 | import geometry.geom2d.Point2D;
import geometry.geom3d.Point3D;
import geometry.geom3d.Triangle3D;
import geometry.math.Angle;
import geometry.structure.grid.Grid;
<BUG>public class Grid3D<T extends Node3D> extends Grid<T> {
public Grid3D(int width, int height) {</BUG>
super(width, height);
}
private Triangle3D getTriangleAt(Point2D coord) {
| public Grid3D(){
super();
public Grid3D(int width, int height) {
|
8,141 | import java.util.ArrayList;
import java.util.List;
public class Map2D<E> {
private List<E> values;
protected int xSize;
<BUG>protected int ySize;
public Map2D(int xSize, int ySize) {</BUG>
this(xSize, ySize, null);
}
public Map2D(int xSize, int ySize, E defaultVal) {
| public Map2D(){
public Map2D(int xSize, int ySize) {
|
8,142 | }
public Map2D(int xSize, int ySize, E defaultVal) {
this.xSize = xSize;
this.ySize = ySize;
values = new ArrayList<>(xSize*ySize);
<BUG>setAll(defaultVal);
</BUG>
}
public void set(int index, E val) {
values.set(index, val);
| public Map2D(int xSize, int ySize) {
this(xSize, ySize, null);
setAllAs(defaultVal);
|
8,143 | return x >= 0 && x < xSize && y >= 0 && y < ySize;
}
public boolean isInBounds(Point2D p){
return isInBounds((int)p.x, (int)p.y);
}
<BUG>public void setAll(E value){
</BUG>
values.clear();
for (int i = 0; i < xSize*ySize; i++)
values.add(value);
| private void setAllAs(E value){
|
8,144 | values.clear();
for (int i = 0; i < xSize*ySize; i++)
values.add(value);
}
public List<E> getAll(){
<BUG>return values;
}</BUG>
public int getIndex(int x, int y){
return y*xSize+x;
}
| protected void setAll(List<E> values){
this.values = values;
|
8,145 | import model.ModelManager;
import model.battlefield.map.Map;
import model.battlefield.map.Tile;
import model.battlefield.map.cliff.Cliff;
import model.battlefield.map.cliff.Ramp;
<BUG>import model.battlefield.map.parcel.ParcelManager;
import model.builders.entity.MapStyleBuilder;</BUG>
import model.builders.entity.definitions.BuilderManager;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
| import model.builders.MapArtisan;
import model.builders.entity.MapStyleBuilder;
|
8,146 | }
}
LogUtil.logger.info(" map builders");</BUG>
Battlefield res = new Battlefield();
<BUG>res.setMap(m);
LogUtil.logger.info("Loading done.");</BUG>
return res;
}
public Battlefield loadWithFileChooser() {
final JFileChooser fc = new JFileChooser(ModelManager.DEFAULT_MAP_PATH);
| public Battlefield getNew(int width, int height) {
LogUtil.logger.info("Creating new battlefield...");
MapArtisan.buildMap(res);
LogUtil.logger.info("Loading done.");
|
8,147 | try {
LogUtil.logger.info("Loading battlefield " + file.getCanonicalPath() + "...");
ObjectMapper mapper = new ObjectMapper(); // can reuse, share globally
bField = mapper.readValue(file, Battlefield.class);
bField.setFileName(file.getCanonicalPath());
<BUG>bField.getMap().atlas.finalize();
bField.getMap().cover.finalize();</BUG>
} catch (Exception e1) {
e1.printStackTrace();
}
| [DELETED] |
8,148 | public class MessageCodeGenerator {
private static final String BIGDECIMAL_TYPE_OPTION = "generator.decimal";
private static final String ORDERED_FIELDS_OPTION = "generator.orderedFields";
private static final String OVERWRITE_OPTION = "generator.overwrite";
private static final long SERIAL_UID = 20050617;
<BUG>private static final String SERIAL_UID_STR = String.valueOf(SERIAL_UID);
</BUG>
private static final String XSLPARAM_SERIAL_UID = "serialVersionUID";
protected void logInfo(String msg) {
System.out.println(msg);
| private static final String SERIAL_UID_STR = Long.toString(SERIAL_UID);
|
8,149 | if (!repository.exists() || !repository.isDirectory()) {
System.err.println("Invalid repository: " + repository.getAbsolutePath());
System.exit(1);
return;
}
<BUG>int major = Integer.valueOf(args[1]);
int minor = Integer.valueOf(args[2]);
</BUG>
new Generator(repository, major, minor).generate();
| [DELETED] |
8,150 | TestIoHandler handler = getIoHandler(clientId);
handler.getSession().write(message);
}
private TestIoHandler getIoHandler(int clientId) {
synchronized (ioHandlers) {
<BUG>return ioHandlers.get(Integer.valueOf(clientId));
}</BUG>
}
public void tearDown() {
for (TestIoHandler testIoHandler : ioHandlers.values()) {
| return ioHandlers.get(clientId);
|
8,151 | message.getField(leavesQty);
fillSize = new BigDecimal(order.getQuantity()).subtract(new BigDecimal("" + leavesQty.getValue()));
}
if (fillSize.compareTo(BigDecimal.ZERO) > 0) {
order.setOpen(order.getOpen() - (int) Double.parseDouble(fillSize.toPlainString()));
<BUG>order.setExecuted(new Integer(message.getString(CumQty.FIELD)));
order.setAvgPx(new Double(message.getString(AvgPx.FIELD)));
</BUG>
}
| order.setExecuted(Integer.parseInt(message.getString(CumQty.FIELD)));
order.setAvgPx(Double.parseDouble(message.getString(AvgPx.FIELD)));
|
8,152 | Execution execution = new Execution();
execution.setExchangeID(sessionID + message.getField(new ExecID()).getValue());
execution.setSymbol(message.getField(new Symbol()).getValue());
execution.setQuantity(fillSize.intValue());
if (message.isSetField(LastPx.FIELD)) {
<BUG>execution.setPrice(new Double(message.getString(LastPx.FIELD)));
</BUG>
}
Side side = (Side) message.getField(new Side());
execution.setSide(FIXSideToSide(side));
| execution.setPrice(Double.parseDouble(message.getString(LastPx.FIELD)));
|
8,153 | private SocketAcceptor createAcceptor(int i) throws ConfigError {
Map<Object, Object> acceptorProperties = new HashMap<Object, Object>();
acceptorProperties.put("ConnectionType", "acceptor");
acceptorProperties.put("HeartBtInt", "5");
acceptorProperties.put("SocketAcceptHost", "localhost");
<BUG>acceptorProperties.put("SocketAcceptPort", String.valueOf(9999 + i) );
</BUG>
acceptorProperties.put("ReconnectInterval", "2");
acceptorProperties.put("StartTime", "00:00:00");
acceptorProperties.put("EndTime", "00:00:00");
| acceptorProperties.put("SocketAcceptPort", Integer.toString(9999 + i));
|
8,154 | public SocketInitiator createInitiator(int i) throws ConfigError {
Map<Object, Object> acceptorProperties = new HashMap<Object, Object>();
acceptorProperties.put("ConnectionType", "initiator");
acceptorProperties.put("HeartBtInt", "5");
acceptorProperties.put("SocketConnectHost", "localhost");
<BUG>acceptorProperties.put("SocketConnectPort", String.valueOf(9999 + i) );
</BUG>
acceptorProperties.put("ReconnectInterval", "2");
acceptorProperties.put("StartTime", "00:00:00");
acceptorProperties.put("EndTime", "00:00:00");
| acceptorProperties.put("SocketConnectPort", Integer.toString(9999 + i));
|
8,155 | private double price;
private String ID = null;
private String exchangeID = null;
private static int nextID = 1;
public Execution() {
<BUG>ID = Integer.valueOf(nextID++).toString();
}</BUG>
public Execution(String ID) {
this.ID = ID;
}
| ID = Integer.toString(nextID++);
|
8,156 | if (!isMsgType(msgType)) {
throw new FieldException(SessionRejectReason.INVALID_MSGTYPE);
}
}
void checkValidTagNumber(Field<?> field) {
<BUG>if (!fields.contains(Integer.valueOf(field.getTag()))) {
throw new FieldException(SessionRejectReason.INVALID_TAG_NUMBER, field.getField());</BUG>
}
}
void checkField(Field<?> field, String msgType, boolean message) {
| if (!fields.contains(field.getTag())) {
throw new FieldException(SessionRejectReason.INVALID_TAG_NUMBER, field.getField());
|
8,157 | fail = !messageField && !allowUnknownMessageFields;
} else {
fail = !messageField && checkUserDefinedFields;
}
if (fail) {
<BUG>if (fields.contains(Integer.valueOf(field.getTag()))) {
throw new FieldException(SessionRejectReason.TAG_NOT_DEFINED_FOR_THIS_MESSAGE_TYPE, field.getField());</BUG>
} else {
throw new FieldException(SessionRejectReason.INVALID_TAG_NUMBER, field.getField());
}
| if (fields.contains(field.getTag())) {
throw new FieldException(SessionRejectReason.TAG_NOT_DEFINED_FOR_THIS_MESSAGE_TYPE, field.getField());
|
8,158 | return order;
} catch (CloneNotSupportedException e) {}
return null;
}
public String generateID() {
<BUG>return Long.valueOf(System.currentTimeMillis() + (nextID++)).toString();
</BUG>
}
public SessionID getSessionID() {
return sessionID;
| return Long.toString(System.currentTimeMillis() + (nextID++));
|
8,159 | if (connect(isProducer)) {
break;
}
} catch (InvalidSelectorException e) {
throw new ConnectionException(
<BUG>"Connection to JMS failed. Invalid message selector");
} catch (JMSException | NamingException e) {
logger.log(LogLevel.ERROR, "RECONNECTION_EXCEPTION",
</BUG>
new Object[] { e.toString() });
| Messages.getString("CONNECTION_TO_JMS_FAILED_INVALID_MSG_SELECTOR")); //$NON-NLS-1$
logger.log(LogLevel.ERROR, "RECONNECTION_EXCEPTION", //$NON-NLS-1$
|
8,160 | private synchronized void createConnectionNoRetry() throws ConnectionException {
if (!isConnectValid()) {
try {
connect(isProducer);
} catch (JMSException e) {
<BUG>logger.log(LogLevel.ERROR, "Connection to JMS failed", new Object[] { e.toString() });
throw new ConnectionException(
"Connection to JMS failed. Did not try to reconnect as the policy is reconnection policy does not apply here.");
}</BUG>
}
| logger.log(LogLevel.ERROR, "CONNECTION_TO_JMS_FAILED", new Object[] { e.toString() }); //$NON-NLS-1$
Messages.getString("CONNECTION_TO_JMS_FAILED_NO_RECONNECT_AS_RECONNECT_POLICY_DOES_NOT_APPLY")); //$NON-NLS-1$
|
8,161 | boolean res = false;
int count = 0;
do {
try {
if(count > 0) {
<BUG>logger.log(LogLevel.INFO, "ATTEMPT_TO_RESEND_MESSAGE", new Object[] { count });
</BUG>
Thread.sleep(messageRetryDelay);
}
synchronized (getSession()) {
| logger.log(LogLevel.INFO, "ATTEMPT_TO_RESEND_MESSAGE", new Object[] { count }); //$NON-NLS-1$
|
8,162 | getProducer().send(message);
res = true;
}
}
catch (JMSException e) {
<BUG>logger.log(LogLevel.WARN, "ERROR_DURING_SEND", new Object[] { e.toString() });
logger.log(LogLevel.INFO, "ATTEMPT_TO_RECONNECT");
</BUG>
setConnect(null);
| logger.log(LogLevel.WARN, "ERROR_DURING_SEND", new Object[] { e.toString() }); //$NON-NLS-1$
logger.log(LogLevel.INFO, "ATTEMPT_TO_RECONNECT"); //$NON-NLS-1$
|
8,163 | import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import com.ibm.streams.operator.Attribute;
import com.ibm.streams.operator.StreamSchema;
import com.ibm.streams.operator.Type;
<BUG>import com.ibm.streams.operator.Type.MetaType;
class ConnectionDocumentParser {</BUG>
private static final Set<String> supportedSPLTypes = new HashSet<String>(Arrays.asList("int8", "uint8", "int16", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"uint16", "int32", "uint32", "int64", "float32", "float64", "boolean", "blob", "rstring", "uint64", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$
"decimal32", "decimal64", "decimal128", "ustring", "timestamp", "xml")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
| import com.ibm.streamsx.messaging.jms.Messages;
class ConnectionDocumentParser {
|
8,164 | return msgClass;
}
private void convertProviderURLPath(File applicationDir) throws ParseConnectionDocumentException {
if(!isAMQ()) {
if(this.providerURL == null || this.providerURL.trim().length() == 0) {
<BUG>throw new ParseConnectionDocumentException("A value must be specified for provider_url attribute in connection document");
}</BUG>
try {
URL url = new URL(providerURL);
if("file".equalsIgnoreCase(url.getProtocol())) { //$NON-NLS-1$
| throw new ParseConnectionDocumentException(Messages.getString("PROVIDER_URL_MUST_BE_SPECIFIED_IN_CONN_DOC")); //$NON-NLS-1$
|
8,165 | URL absProviderURL = new URL(url.getProtocol(), url.getHost(), applicationDir.getAbsolutePath() + File.separator + path);
this.providerURL = absProviderURL.toExternalForm();
}
}
} catch (MalformedURLException e) {
<BUG>throw new ParseConnectionDocumentException("Invalid provider_url value detected: " + e.getMessage());
}</BUG>
}
}
public void parseAndValidateConnectionDocument(String connectionDocument, String connection, String access,
| throw new ParseConnectionDocumentException(Messages.getString("INVALID_PROVIDER_URL", e.getMessage())); //$NON-NLS-1$
|
8,166 | for (int j = 0; j < accessSpecChildNodes.getLength(); j++) {
if (accessSpecChildNodes.item(j).getNodeName().equals("destination")) { //$NON-NLS-1$
destIndex = j;
} else if (accessSpecChildNodes.item(j).getNodeName().equals("uses_connection")) { //$NON-NLS-1$
if (!connection.equals(accessSpecChildNodes.item(j).getAttributes().getNamedItem("connection") //$NON-NLS-1$
<BUG>.getNodeValue())) {
throw new ParseConnectionDocumentException("The value of the connection parameter "
+ connection + " is not the same as the connection used by access element "
+ access + " as mentioned in the uses_connection element in connections document");</BUG>
}
| throw new ParseConnectionDocumentException(Messages.getString("VALUE_OF_CONNECTION_PARAM_NOT_THE_SAME_AS_CONN_USED_BY_ACCESS_ELEMENT", connection, access )); //$NON-NLS-1$
|
8,167 | nativeSchema = access_specification.item(i).getChildNodes().item(nativeSchemaIndex);
}
break;
}
}
<BUG>if (!accessFound) {
throw new ParseConnectionDocumentException("The value of the access parameter " + access
+ " is not found in the connections document");</BUG>
}
return nativeSchema;
| throw new ParseConnectionDocumentException(Messages.getString("VALUE_OF_ACCESS_PARAM_NOT_FOUND_IN_CONN_DOC", access )); //$NON-NLS-1$
|
8,168 | nativeAttrLength = Integer.parseInt((attrList.item(i).getAttributes().getNamedItem("length") //$NON-NLS-1$
.getNodeValue()));
}
if ((msgClass == MessageClass.wbe || msgClass == MessageClass.wbe22)
&& ((streamSchema.getAttribute(nativeAttrName) != null) && (streamSchema
<BUG>.getAttribute(nativeAttrName).getType().getMetaType() == Type.MetaType.BLOB))) {
throw new ParseConnectionDocumentException(" Blob data type is not supported for message class "
+ msgClass);</BUG>
}
Iterator<NativeSchema> it = nativeSchemaObjects.iterator();
| throw new ParseConnectionDocumentException(Messages.getString("BLOB_NOT_SUPPORTED_FOR_MSG_CLASS", msgClass)); //$NON-NLS-1$
|
8,169 | throw new ParseConnectionDocumentException(" Blob data type is not supported for message class "
+ msgClass);</BUG>
}
Iterator<NativeSchema> it = nativeSchemaObjects.iterator();
while (it.hasNext()) {
<BUG>if (it.next().getName().equals(nativeAttrName)) {
throw new ParseConnectionDocumentException("Parameter name: " + nativeAttrName
+ " is appearing more than once In native schema file");</BUG>
}
}
| nativeAttrLength = Integer.parseInt((attrList.item(i).getAttributes().getNamedItem("length") //$NON-NLS-1$
.getNodeValue()));
if ((msgClass == MessageClass.wbe || msgClass == MessageClass.wbe22)
&& ((streamSchema.getAttribute(nativeAttrName) != null) && (streamSchema
.getAttribute(nativeAttrName).getType().getMetaType() == Type.MetaType.BLOB))) {
throw new ParseConnectionDocumentException(Messages.getString("BLOB_NOT_SUPPORTED_FOR_MSG_CLASS", msgClass)); //$NON-NLS-1$
throw new ParseConnectionDocumentException(Messages.getString("PARAMETER_NOT_UNIQUE_IN_NATIVE_SCHEMA", nativeAttrName )); //$NON-NLS-1$
|
8,170 | if (msgClass == MessageClass.text) {
typesWithLength = new HashSet<String>(Arrays.asList("Bytes")); //$NON-NLS-1$
}
Set<String> typesWithoutLength = new HashSet<String>(Arrays.asList("Byte", "Short", "Int", "Long", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
"Float", "Double", "Boolean")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
<BUG>if (typesWithoutLength.contains(nativeAttrType) && nativeAttrLength != LENGTH_ABSENT_IN_NATIVE_SCHEMA) {
throw new ParseConnectionDocumentException("Length attribute should not be present for parameter: "
+ nativeAttrName + " In native schema file");</BUG>
}
if ((nativeAttrLength != LENGTH_ABSENT_IN_NATIVE_SCHEMA)
| throw new ParseConnectionDocumentException(Messages.getString("LENGTH_ATTRIB_SHOULD_NOT_BE_PRESENT_FOR_PARAM_IN_NATIVE_SCHEMA", nativeAttrName )); //$NON-NLS-1$
|
8,171 | if ((nativeAttrLength != LENGTH_ABSENT_IN_NATIVE_SCHEMA)
&& (msgClass == MessageClass.wbe || msgClass == MessageClass.wbe22 || msgClass == MessageClass.xml)
&& (streamSchema.getAttribute(nativeAttrName) != null)
&& (streamSchema.getAttribute(nativeAttrName).getType().getMetaType() != Type.MetaType.RSTRING)
&& (streamSchema.getAttribute(nativeAttrName).getType().getMetaType() != Type.MetaType.USTRING)
<BUG>&& (streamSchema.getAttribute(nativeAttrName).getType().getMetaType() != Type.MetaType.BLOB)) {
throw new ParseConnectionDocumentException("Length attribute should not be present for parameter: "
+ nativeAttrName + " In native schema file");</BUG>
}
if (streamSchema.getAttribute(nativeAttrName) != null) {
| throw new ParseConnectionDocumentException(Messages.getString("LENGTH_ATTRIB_SHOULD_NOT_BE_PRESENT_FOR_PARAM_IN_NATIVE_SCHEMA", nativeAttrName )); //$NON-NLS-1$
|
8,172 | if (streamSchema.getAttribute(nativeAttrName) != null) {
MetaType metaType = streamSchema.getAttribute(nativeAttrName).getType().getMetaType();
if (metaType == Type.MetaType.DECIMAL32 || metaType == Type.MetaType.DECIMAL64
|| metaType == Type.MetaType.DECIMAL128 || metaType == Type.MetaType.TIMESTAMP) {
if (nativeAttrLength != LENGTH_ABSENT_IN_NATIVE_SCHEMA) {
<BUG>throw new ParseConnectionDocumentException(
"Length attribute should not be present for parameter: " + nativeAttrName
+ " with type " + metaType + " in native schema file.");</BUG>
}
if (msgClass == MessageClass.bytes) {
| Messages.getString("LENGTH_ATTRIB_SHOULD_NOT_BE_PRESENT_FOR_PARAM_WITH_TYPE_IN_NATIVE_SCHEMA", nativeAttrName, metaType )); //$NON-NLS-1$
|
8,173 | nativeAttrLength = -4;
}
}
}
if (typesWithLength.contains(nativeAttrType)) {
<BUG>if (nativeAttrLength == LENGTH_ABSENT_IN_NATIVE_SCHEMA && msgClass == MessageClass.bytes) {
throw new ParseConnectionDocumentException("Length attribute should be present for parameter: "
+ nativeAttrName + " In native schema file for message class bytes");</BUG>
}
if ((nativeAttrLength < 0) && nativeAttrLength != LENGTH_ABSENT_IN_NATIVE_SCHEMA) {
| throw new ParseConnectionDocumentException(Messages.getString("LENGTH_ATTRIB_SHOULD_NOT_BE_PRESENT_FOR_PARAM_IN_NATIVE_SCHEMA_FOR_MSG_CLASS_BYTES", nativeAttrName )); //$NON-NLS-1$
|
8,174 | if (streamSchema.getAttribute(nativeAttrName) != null) {
streamAttrName = streamSchema.getAttribute(nativeAttrName).getName();
streamAttrMetaType = streamSchema.getAttribute(nativeAttrName).getType().getMetaType();
if ((msgClass == MessageClass.stream || msgClass == MessageClass.map)
&& !mapSPLToNativeSchemaDataTypesForOtherMsgClass.get(streamAttrMetaType.getLanguageType())
<BUG>.equals(nativeAttrType)) {
throw new ParseConnectionDocumentException("Attribute Name: " + nativeAttrName + " with type:"
+ nativeAttrType + " in the native schema cannot be mapped with attribute: "
+ streamAttrName + " with type : " + streamAttrMetaType.getLanguageType());</BUG>
}
| throw new ParseConnectionDocumentException(Messages.getString("ATTRIB_WITH_TYPE_IN_NATIVE_SCHEMA_CANNOT_BE_MAPPED_TO_ATTRIB_WITH_TYPE", nativeAttrName, nativeAttrType, streamAttrName, streamAttrMetaType.getLanguageType())); //$NON-NLS-1$
|
8,175 | + nativeAttrType + " in the native schema cannot be mapped with attribute: "
+ streamAttrName + " with type : " + streamAttrMetaType.getLanguageType());</BUG>
}
else if (msgClass == MessageClass.bytes
&& !mapSPLToNativeSchemaDataTypesForBytes.get(streamAttrMetaType.getLanguageType()).equals(
<BUG>nativeAttrType)) {
throw new ParseConnectionDocumentException("Attribute Name: " + nativeAttrName + " with type:"
+ nativeAttrType + " in the native schema cannot be mapped with attribute: "
+ streamAttrName + " with type : " + streamAttrMetaType.getLanguageType());</BUG>
}
| if (streamSchema.getAttribute(nativeAttrName) != null) {
streamAttrName = streamSchema.getAttribute(nativeAttrName).getName();
streamAttrMetaType = streamSchema.getAttribute(nativeAttrName).getType().getMetaType();
if ((msgClass == MessageClass.stream || msgClass == MessageClass.map)
&& !mapSPLToNativeSchemaDataTypesForOtherMsgClass.get(streamAttrMetaType.getLanguageType())
.equals(nativeAttrType)) {
throw new ParseConnectionDocumentException(Messages.getString("ATTRIB_WITH_TYPE_IN_NATIVE_SCHEMA_CANNOT_BE_MAPPED_TO_ATTRIB_WITH_TYPE", nativeAttrName, nativeAttrType, streamAttrName, streamAttrMetaType.getLanguageType())); //$NON-NLS-1$
throw new ParseConnectionDocumentException(Messages.getString("ATTRIB_WITH_TYPE_IN_NATIVE_SCHEMA_CANNOT_BE_MAPPED_TO_ATTRIB_WITH_TYPE", nativeAttrName, nativeAttrType, streamAttrName, streamAttrMetaType.getLanguageType())); //$NON-NLS-1$
|
8,176 | package com.ibm.streamsx.messaging.i18n;
import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
public class Messages {
<BUG>private static final String BUNDLE_NAME = "com.ibm.streamsx.messaging.mqtt.MQTTMessages"; //$NON-NLS-1$
</BUG>
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
.getBundle(BUNDLE_NAME);
private Messages() {
| private static final String BUNDLE_NAME = "com.ibm.streamsx.messaging.i18n.CommonMessages"; //$NON-NLS-1$
|
8,177 | for (Change change : changes) {
Assert.assertEquals(ChangeCategory.MODIFY_INSTANCE, change.getChangeCategory());
oneChange = change;
}
}
<BUG>private List<Change> doTest(String original, String overlay) {
ServiceLocator locator = Utilities.createLocator(UpdateListener.class);</BUG>
XmlService xmlService = locator.getService(XmlService.class);
Hub hub = locator.getService(Hub.class);
| private List<Change> doTestA(String original, String overlay) {
return doTestA(original, overlay, true, true);
private List<Change> doTestA(String original, String overlay, boolean generateLists, boolean generateArrays) {
ServiceLocator locator = Utilities.createLocator(UpdateListener.class);
|
8,178 | Assert.assertEquals(overlay, overlayFromArray);
OverlayUtilities.checkSingleLetterOveralyRootA(originalHandle, hub, original);
</BUG>
originalHandle.overlay(overlayHandle);
String overlayedFromList = OverlayUtilities.getStringVersionOfTree(originalHandle.getRoot(), true);
<BUG>String overlayedFromArray = OverlayUtilities.getStringVersionOfTree(originalHandle.getRoot(), false);
Assert.assertEquals(overlay, overlayedFromList);
Assert.assertEquals(overlay, overlayedFromArray);
OverlayUtilities.checkSingleLetterOveralyRootA(originalHandle, hub, overlay);
</BUG>
return listener.getChanges();
| }
OverlayUtilities.checkSingleLetterOveralyRootA(originalHandle, hub, generateLists, generateArrays, original);
if (generateLists) {
}
if (generateArrays) {
}
OverlayUtilities.checkSingleLetterOveralyRootA(originalHandle, hub, generateLists, generateArrays, overlay);
|
8,179 | OverlayUtilities.A_ARRAY_CHILD) // prop changed
);
}
@Test
public void testABCxAB() throws Exception {
<BUG>List<Change> changes = doTest("ABC", "AB");
</BUG>
checkChanges(changes,
new ChangeDescriptor(ChangeCategory.MODIFY_INSTANCE,
OverlayUtilities.OROOT_TYPE, // type name
| List<Change> changes = doTestA("ABC", "AB");
|
8,180 | OverlayUtilities.OROOT_A + ".*", "C") // instance name
);
}
@Test
public void testABCxCBA() throws Exception {
<BUG>List<Change> changes = doTest("ABC", "CBA");
</BUG>
checkChanges(changes,
new ChangeDescriptor(ChangeCategory.MODIFY_INSTANCE,
OverlayUtilities.OROOT_TYPE, // type name
| , new ChangeDescriptor(ChangeCategory.REMOVE_INSTANCE,
OverlayUtilities.LIST_TYPE, // type name
List<Change> changes = doTestA("ABC", "CBA");
|
8,181 | OverlayUtilities.OROOT_A + ".*", "D") // instance name
);
}
@Test
public void testABCxCABC() throws Exception {
<BUG>List<Change> changes = doTest("ABC", "CABC");
</BUG>
checkChanges(changes,
new ChangeDescriptor(ChangeCategory.MODIFY_INSTANCE,
OverlayUtilities.OROOT_TYPE, // type name
| , new ChangeDescriptor(ChangeCategory.ADD_INSTANCE,
OverlayUtilities.LIST_TYPE, // type name
List<Change> changes = doTestA("ABC", "CABC");
|
8,182 | OverlayUtilities.OROOT_A + ".*", "C") // instance name
);
}
@Test
public void testABCxABDC() throws Exception {
<BUG>List<Change> changes = doTest("ABC", "ABDC");
</BUG>
checkChanges(changes,
new ChangeDescriptor(ChangeCategory.MODIFY_INSTANCE,
OverlayUtilities.OROOT_TYPE, // type name
| , new ChangeDescriptor(ChangeCategory.ADD_INSTANCE,
OverlayUtilities.LIST_TYPE, // type name
List<Change> changes = doTestA("ABC", "ABDC");
|
8,183 | OverlayUtilities.OROOT_A + ".*", "D") // instance name
);
}
@Test
public void testABCxABC() throws Exception {
<BUG>List<Change> changes = doTest("ABC", "ABC");
</BUG>
checkChanges(changes);
}
@Test
| , new ChangeDescriptor(ChangeCategory.ADD_INSTANCE,
OverlayUtilities.LIST_TYPE, // type name
List<Change> changes = doTestA("ABC", "ABC");
|
8,184 | OverlayUtilities.NAME_TAG) // prop changed
);
}
@Test
public void testA_B_A_C_A_D_xA_B_A_C_A_D_() throws Exception {
<BUG>List<Change> changes = doTest("A(B)A(C)A(D)", "A(B)A(C)A(D)");
</BUG>
checkChanges(changes);
}
@Test
| , new ChangeDescriptor(ChangeCategory.MODIFY_INSTANCE,
OverlayUtilities.ARRAY_TYPE, // type name
OverlayUtilities.OROOT_A + ".*", // instance name
"C",
List<Change> changes = doTestA("A(B)A(C)A(D)", "A(B)A(C)A(D)");
|
8,185 | OverlayUtilities.OROOT_A, "D") // instance name
);
}
@Test
public void testA_B_A_CxA_C_A_B_() throws Exception {
<BUG>List<Change> changes = doTest("A(B)A(C)", "A(C)A(B)");
</BUG>
checkChanges(changes,
new ChangeDescriptor(ChangeCategory.MODIFY_INSTANCE,
OverlayUtilities.OROOT_TYPE, // type name
| List<Change> changes = doTestA("A(B)A(C)", "A(C)A(B)");
|
8,186 | OverlayUtilities.A_ARRAY_CHILD) // prop changed
);
}
@Test
public void testA_B_A_C_A_D_xA_C_A_D_() throws Exception {
<BUG>List<Change> changes = doTest("A(B)A(C)A(D)", "A(C)A(D)");
</BUG>
checkChanges(changes,
new ChangeDescriptor(ChangeCategory.MODIFY_INSTANCE,
OverlayUtilities.OROOT_TYPE, // type name
| List<Change> changes = doTestA("A(B)A(C)A(D)", "A(C)A(D)");
|
8,187 | OverlayUtilities.OROOT_A, "B") // instance name
);
}
@Test
public void testA_B_C_D_EF__G_HI_JKL__xA_B_C_D_EF__G_HI_JKL__() throws Exception {
<BUG>List<Change> changes = doTest("A(B(C)D(EF))G(HI(JKL))", "A(B(C)D(EF))G(HI(JKL))");
</BUG>
checkChanges(changes);
}
@Test
| List<Change> changes = doTestA("A(B(C)D(EF))G(HI(JKL))", "A(B(C)D(EF))G(HI(JKL))");
|
8,188 | </BUG>
checkChanges(changes);
}
@Test
public void testA_B_C_D_EF__G_HI_JKL__xG_HI_JKL__A_B_C_D_EF__() throws Exception {
<BUG>List<Change> changes = doTest("A(B(C)D(EF))G(HI(JKL))", "G(HI(JKL))A(B(C)D(EF))");
</BUG>
checkChanges(changes,
new ChangeDescriptor(ChangeCategory.MODIFY_INSTANCE,
OverlayUtilities.OROOT_TYPE, // type name
| OverlayUtilities.OROOT_A, "B") // instance name
public void testA_B_C_D_EF__G_HI_JKL__xA_B_C_D_EF__G_HI_JKL__() throws Exception {
List<Change> changes = doTestA("A(B(C)D(EF))G(HI(JKL))", "A(B(C)D(EF))G(HI(JKL))");
List<Change> changes = doTestA("A(B(C)D(EF))G(HI(JKL))", "G(HI(JKL))A(B(C)D(EF))");
|
8,189 | } else if (evt.getSource() == jSizeButton) {
jSizeChooseDialog.setLocation(jSizeButton.getLocationOnScreen().x, jSizeButton.getLocationOnScreen().y);
jSizeChooseDialog.setVisible(true);
} else if (evt.getSource() == jTableButton) {
try {
<BUG>((DefaultStyledDocument) jTextPane1.getDocument()).insertString(jTextPane1.getCaretPosition(), "[table]\n[**]head1[||]head2[/**]\n[*]test1[|]test2\n[/table]", null);
} catch (BadLocationException ble) {</BUG>
}
}
}//GEN-LAST:event_fireAddContentEvent
| jTextPane1.getDocument().insertString(jTextPane1.getCaretPosition(), "[table]\n[**]head1[||]head2[/**]\n[*]test1[|]test2\n[/table]", null);
} catch (BadLocationException ble) {
|
8,190 | rgb = rgb.substring(2, rgb.length());
String pOpenCode = "[color=#" + rgb + "]";
String pCloseCode = "[/color]";
int s = jTextPane1.getSelectionStart();
int e = jTextPane1.getSelectionEnd();
<BUG>String t = ((DefaultStyledDocument) jTextPane1.getDocument()).getText(s, e - s);
((DefaultStyledDocument) jTextPane1.getDocument()).remove(s, e - s);
((DefaultStyledDocument) jTextPane1.getDocument()).insertString(s, pOpenCode + t + pCloseCode, null);
if (t.length() == 0) {</BUG>
jTextPane1.setCaretPosition(s + pOpenCode.length());
| String t = jTextPane1.getDocument().getText(s, e - s);
jTextPane1.getDocument().remove(s, e - s);
jTextPane1.getDocument().insertString(s, pOpenCode + t + pCloseCode, null);
if (t.length() == 0) {
|
8,191 | String size = Integer.toString(jSlider1.getValue());
String pOpenCode = "[size=" + size + "]";
String pCloseCode = "[/size]";
int s = jTextPane1.getSelectionStart();
int e = jTextPane1.getSelectionEnd();
<BUG>String t = ((DefaultStyledDocument) jTextPane1.getDocument()).getText(s, e - s);
((DefaultStyledDocument) jTextPane1.getDocument()).remove(s, e - s);
((DefaultStyledDocument) jTextPane1.getDocument()).insertString(s, pOpenCode + t + pCloseCode, null);
if (t.length() == 0) {</BUG>
jTextPane1.setCaretPosition(s + pOpenCode.length());
| String t = jTextPane1.getDocument().getText(s, e - s);
jTextPane1.getDocument().remove(s, e - s);
jTextPane1.getDocument().insertString(s, pOpenCode + t + pCloseCode, null);
if (t.length() == 0) {
|
8,192 | case 3:
return f.getBounds().y;
case 4:
switch (type) {
case ARROW:
<BUG>return ((Arrow) f).getBounds().width;
case CIRCLE:
return ((Circle) f).getBounds().width;
case FREEFORM:</BUG>
return 0;
| return f.getBounds().width;
return f.getBounds().width;
case FREEFORM:
|
8,193 | case CIRCLE:
return ((Circle) f).getBounds().width;
case FREEFORM:</BUG>
return 0;
case LINE:
<BUG>return ((Line) f).getBounds().width;
case RECTANGLE:
return ((Rectangle) f).getBounds().width;
default:</BUG>
return 0;
| return f.getBounds().width;
case FREEFORM:
return f.getBounds().width;
return f.getBounds().width;
default:
|
8,194 | case CIRCLE:
return ((Circle) f).getBounds().height;
case FREEFORM:</BUG>
return 0;
case LINE:
<BUG>return ((Line) f).getBounds().height;
case RECTANGLE:
return ((Rectangle) f).getBounds().height;
default:</BUG>
return 0;
| return f.getBounds().width;
case FREEFORM:
return f.getBounds().width;
return f.getBounds().width;
default:
|
8,195 | pack();
capabilityInfoPanel1.addActionListener(MapPanel.getSingleton());
Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
@Override
public void eventDispatched(AWTEvent event) {
<BUG>if (((KeyEvent) event).getID() == KeyEvent.KEY_PRESSED) {
KeyEvent e = (KeyEvent) event;</BUG>
if (DSWorkbenchMainFrame.getSingleton().isActive()) {
if (e.getKeyCode() == KeyEvent.VK_DOWN) {
scroll(0.0, 2.0);
| if (event.getID() == KeyEvent.KEY_PRESSED) {
KeyEvent e = (KeyEvent) event;
|
8,196 | MapPanel.getSingleton().setSpaceDown(true);
} else if (e.getKeyCode() == KeyEvent.VK_SHIFT) {
jMapPanelHolder.requestFocusInWindow();
MapPanel.getSingleton().setShiftDown(true);
}
<BUG>} else if (((KeyEvent) event).getID() == KeyEvent.KEY_RELEASED) {
KeyEvent e = (KeyEvent) event;</BUG>
if (e.getKeyCode() == KeyEvent.VK_SPACE) {
MapPanel.getSingleton().setSpaceDown(false);
} else if (e.getKeyCode() == KeyEvent.VK_SHIFT) {
| } else if (event.getID() == KeyEvent.KEY_RELEASED) {
KeyEvent e = (KeyEvent) event;
|
8,197 | List<Village> toRemove = new LinkedList<Village>();
jChurchTable.invalidate();
for (int i = rows.length - 1; i >= 0; i--) {
int row = jChurchTable.convertRowIndexToModel(rows[i]);
int col = jChurchTable.convertColumnIndexToModel(1);
<BUG>Village v = ((Village) ((ChurchTableModel) jChurchTable.getModel()).getValueAt(row, col));
toRemove.add(v);</BUG>
}
jChurchTable.revalidate();
ChurchManager.getSingleton().removeChurches(toRemove.toArray(new Village[]{}));
| Village v = ((Village) jChurchTable.getModel().getValueAt(row, col));
toRemove.add(v);
|
8,198 | package de.tor.tribes.types.drawing;
import de.tor.tribes.ui.panels.MapPanel;
<BUG>import de.tor.tribes.util.GlobalOptions;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Point;</BUG>
import java.awt.geom.Rectangle2D;
| import org.jdom.Element;
import java.awt.*;
|
8,199 | GlobalOptions.addProperty("proxyUser", (String) result.get("proxyUser"));
GlobalOptions.addProperty("proxyPassword", (String) result.get("proxyPassword"));
GlobalOptions.addProperty("account.name", (String) result.get("account.name"));
GlobalOptions.addProperty("account.password", (String) result.get("account.password"));
GlobalOptions.addProperty("default.server", (String) result.get("server"));
<BUG>GlobalOptions.addProperty("player." + (String) result.get("server"), (String) result.get("tribe"));
logger.debug("Creating initial profile");</BUG>
UserProfile p = UserProfile.create(GlobalOptions.getProperty("default.server"), GlobalOptions.getProperty("player." + GlobalOptions.getProperty("default.server")));
GlobalOptions.setSelectedProfile(p);
GlobalOptions.addProperty("selected.profile", Long.toString(p.getProfileId()));
| GlobalOptions.addProperty("player." + result.get("server"), (String) result.get("tribe"));
logger.debug("Creating initial profile");
|
8,200 | }
public static DataFlavor villageDataFlavor = new DataFlavor(VillageTransferable.class, "Village");
public static DataFlavor[] supportedFlavors = {villageDataFlavor, DataFlavor.stringFlavor};
@Override
public DataFlavor[] getTransferDataFlavors() {
<BUG>return (DataFlavor[]) supportedFlavors.clone();
}</BUG>
@Override
public boolean isDataFlavorSupported(DataFlavor flavor) {
return (flavor.equals(villageDataFlavor) || flavor.equals(DataFlavor.stringFlavor));
| public VillageTransferable(List<Village> pVillage) {
villages = pVillage;
return supportedFlavors.clone();
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.