id
int64 1
194k
| buggy
stringlengths 23
37.5k
| fixed
stringlengths 6
37.4k
|
---|---|---|
193,301 | package com.google.api.gax.grpc;
import com.google.api.gax.bundling.ThresholdBundlingForwarder;
<BUG>import com.google.api.gax.core.FlowController.FlowControlException;
import com.google.api.gax.core.FlowController.FlowControlRuntimeException;</BUG>
import com.google.api.gax.core.RpcFuture;
import com.google.common.base.Preconditions;
class BundlingCallable<RequestT, ResponseT> implements FutureCallable<RequestT, ResponseT> {
| package com.google.api.gax.grpc;
import com.google.api.gax.bundling.ThresholdBundlingForwarder;
import com.google.api.gax.core.RpcFuture;
import com.google.common.base.Preconditions;
class BundlingCallable<RequestT, ResponseT> implements FutureCallable<RequestT, ResponseT> {
|
193,302 | BundlingContext<RequestT, ResponseT> bundlableMessage =
new BundlingContext<RequestT, ResponseT>(request, context, unaryCallable, result);
String partitionKey = bundlingDescriptor.getBundlePartitionKey(request);
ThresholdBundlingForwarder<BundlingContext<RequestT, ResponseT>> forwarder =
bundlerFactory.getForwarder(partitionKey);
<BUG>try {</BUG>
forwarder.addToNextBundle(bundlableMessage);
return result;
<BUG>} catch (FlowControlException e) {
throw FlowControlRuntimeException.fromFlowControlException(e);
}</BUG>
} else {
| BundlingContext<RequestT, ResponseT> bundlableMessage =
new BundlingContext<RequestT, ResponseT>(request, context, unaryCallable, result);
String partitionKey = bundlingDescriptor.getBundlePartitionKey(request);
ThresholdBundlingForwarder<BundlingContext<RequestT, ResponseT>> forwarder =
bundlerFactory.getForwarder(partitionKey);
forwarder.addToNextBundle(bundlableMessage);
return result;
} else {
|
193,303 | package com.easytoolsoft.easyreport.web.controller.common;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping(value = "/error")
<BUG>public class ErrorController extends AbstractController {
@RequestMapping(value = {"/404"})</BUG>
public String error404() {
return "/error/404";
}
| package com.easytoolsoft.easyreport.web.controller.common;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping(value = "/error")
public class ErrorController {
@RequestMapping(value = {"/404"})
public String error404() {
return "/error/404";
}
|
193,304 | package com.easytoolsoft.easyreport.web.controller.membership;
<BUG>import com.easytoolsoft.easyreport.web.controller.common.AbstractController;</BUG>
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping(value = "/membership")
<BUG>public class LoginController extends AbstractController {
@RequestMapping(value = {"/login"})</BUG>
public String login() {
| package com.easytoolsoft.easyreport.web.controller.membership;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping(value = "/membership")
public class LoginController {
@RequestMapping(value = {"/login"})
public String login() {
|
193,305 | package com.easytoolsoft.easyreport.metadata.service.impl;
import com.alibaba.fastjson.JSON;
<BUG>import com.easytoolsoft.easyreport.engine.query.QueryerFactory;</BUG>
import com.easytoolsoft.easyreport.data.common.helper.PageInfo;
import com.easytoolsoft.easyreport.data.common.helper.ParameterBuilder;
import com.easytoolsoft.easyreport.data.common.service.AbstractCrudService;
<BUG>import com.easytoolsoft.easyreport.engine.data.ReportDataSource;
import com.easytoolsoft.easyreport.engine.data.ReportMetaDataColumn;
import com.easytoolsoft.easyreport.engine.data.ReportQueryParamItem;</BUG>
import com.easytoolsoft.easyreport.data.metadata.dao.IReportDao;
| package com.easytoolsoft.easyreport.metadata.service.impl;
import com.alibaba.fastjson.JSON;
import com.easytoolsoft.easyreport.data.common.helper.PageInfo;
import com.easytoolsoft.easyreport.data.common.helper.ParameterBuilder;
import com.easytoolsoft.easyreport.data.common.service.AbstractCrudService;
import com.easytoolsoft.easyreport.data.metadata.dao.IReportDao;
import com.easytoolsoft.easyreport.data.metadata.po.Category;
import com.easytoolsoft.easyreport.data.metadata.po.DataSource;
import com.easytoolsoft.easyreport.data.metadata.po.Report;
import com.easytoolsoft.easyreport.data.metadata.po.ReportOptions;
import com.easytoolsoft.easyreport.engine.data.ReportDataSource;
|
193,306 | package com.easytoolsoft.easyreport.web.controller;
<BUG>import com.easytoolsoft.easyreport.web.controller.common.AbstractController;</BUG>
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping(value = "/home")
<BUG>public class HomeController extends AbstractController {
@RequestMapping(value = {"", "/", "/index"})</BUG>
public String index() {
| package com.easytoolsoft.easyreport.web.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping(value = "/home")
public class HomeController {
@RequestMapping(value = {"", "/", "/index"})
public String index() {
|
193,307 | }
@Test public void testDefaultPagination() {
EyeEm request = EyeEm.albumPhotos("10359833");
List<Photo> photosFeed = Photo.fromJSONArray(request.declutter.jsonArray(photos_feed));
assertEquals("photosFeed.size()", photosFeed.size(), 30);
<BUG>EyeEm paginatedRequest = (EyeEm) request.fetchBack(photosFeed);
</BUG>
assertEquals("pagination Url", "https://api.eyeem.com/v2/albums/10359833/photos?offset=30", paginatedRequest.toUrl());
}
@Test public void testNewsPagination() {
| }
}
@Before public void setup() throws Exception {
news_feed = new JSONObject(Utils.readFile("news_feed.json"));
photos_feed = new JSONObject(Utils.readFile("photos_feed.json"));
}
@Test public void testDefaultPagination() {
EyeEm request = EyeEm.albumPhotos("10359833");
List<Photo> photosFeed = Photo.fromJSONArray(request.declutter.jsonArray(photos_feed));
assertEquals("photosFeed.size()", photosFeed.size(), 30);
EyeEm paginatedRequest = (EyeEm) request.copy().fetchBack(photosFeed);
assertEquals("pagination Url", "https://api.eyeem.com/v2/albums/10359833/photos?offset=30", paginatedRequest.toUrl());
}
@Test public void testNewsPagination() {
|
193,308 | rb.paramEncoded("ids", TextUtils.join(",", subIDs));
}
@Override public void fetchBack(RequestBuilder rb, Object info) {
int currentCount = ((List) info).size();
List<String> subIDs = subList(currentCount, Math.min(currentCount + limitPerPage, idsSize()));
<BUG>if (subIDs.size() == 0) return;
rb.paramEncoded("ids", TextUtils.join(",", subIDs));</BUG>
}
private int idsSize() {
| rb.paramEncoded("ids", TextUtils.join(",", subIDs));
}
@Override public void fetchBack(RequestBuilder rb, Object info) {
int currentCount = ((List) info).size();
List<String> subIDs = subList(currentCount, Math.min(currentCount + limitPerPage, idsSize()));
if (subIDs.size() == 0) {
if (ids != null && ids.size() > 0) {
rb.paramEncoded("ids", ids.get(ids.size() - 1));
return;
}
}
rb.paramEncoded("ids", TextUtils.join(",", subIDs));
}
private int idsSize() {
|
193,309 | static final byte GET_STICK_SCALING = 7;
static final byte SET_ANGLE_MAX_INC = 8;
static final byte GET_ANGLE_MAX_INC = 9;
static final byte SET_KALMAN = 10;
static final byte GET_KALMAN = 11;
<BUG>static final byte START_IMU = 12;
static final byte STOP_IMU = 13;
</BUG>
static final String commandHeader = "$S>"; // Standard command header
| static final byte GET_STICK_SCALING = 7;
static final byte SET_ANGLE_MAX_INC = 8;
static final byte GET_ANGLE_MAX_INC = 9;
static final byte SET_KALMAN = 10;
static final byte GET_KALMAN = 11;
static final byte SEND_ANGLES = 12;
static final byte SEND_INFO = 13;
static final String commandHeader = "$S>"; // Standard command header
|
193,310 | import com.jjoe64.graphview.LineGraphView;
public class GraphFragment extends Fragment {
private static final String TAG = GraphFragment.class.getSimpleName();
private static final boolean D = LaunchPadFlightControllerActivity.D;
private static LineGraphView graphView;
<BUG>private static GraphViewSeries accSeries, gyroSeries, kalmanSeries;
</BUG>
private static double counter = 100.0;
private static CheckBox mCheckBox1, mCheckBox2, mCheckBox3;
private static EditText mQangle, mQbias, mRmeasure;
| import com.jjoe64.graphview.LineGraphView;
public class GraphFragment extends Fragment {
private static final String TAG = GraphFragment.class.getSimpleName();
private static final boolean D = LaunchPadFlightControllerActivity.D;
private static LineGraphView graphView;
private static GraphViewSeries rollSeries, pitchSeries, yawSeries;
private static double counter = 100.0;
private static CheckBox mCheckBox1, mCheckBox2, mCheckBox3;
private static EditText mQangle, mQbias, mRmeasure;
|
193,311 | for (int i = 0; i < 101; i++) { // Restore last data
data0[i] = new GraphViewData(counter - 100 + i, buffer[0][i]);
data1[i] = new GraphViewData(counter - 100 + i, buffer[1][i]);
data2[i] = new GraphViewData(counter - 100 + i, buffer[2][i]);
}
<BUG>accSeries = new GraphViewSeries("Accelerometer", new GraphViewSeriesStyle(Color.RED, 2), data0);
gyroSeries = new GraphViewSeries("Gyro", new GraphViewSeriesStyle(Color.GREEN, 2), data1);
kalmanSeries = new GraphViewSeries("Kalman", new GraphViewSeriesStyle(Color.BLUE, 2), data2);
</BUG>
graphView = new LineGraphView(getActivity(), "");
| for (int i = 0; i < 101; i++) { // Restore last data
data0[i] = new GraphViewData(counter - 100 + i, buffer[0][i]);
data1[i] = new GraphViewData(counter - 100 + i, buffer[1][i]);
data2[i] = new GraphViewData(counter - 100 + i, buffer[2][i]);
}
rollSeries = new GraphViewSeries("Roll", new GraphViewSeriesStyle(Color.RED, 2), data0);
pitchSeries = new GraphViewSeries("Pitch", new GraphViewSeriesStyle(Color.GREEN, 2), data1);
yawSeries = new GraphViewSeries("Yaw", new GraphViewSeriesStyle(Color.BLUE, 2), data2);
graphView = new LineGraphView(getActivity(), "");
|
193,312 | } else
<BUG>graphView.addSeries(accSeries);
</BUG>
if (mCheckBox2 != null) {
if (mCheckBox2.isChecked())
<BUG>graphView.addSeries(gyroSeries);
</BUG>
} else
<BUG>graphView.addSeries(gyroSeries);
</BUG>
if (mCheckBox3 != null) {
| } else
graphView.addSeries(rollSeries);
if (mCheckBox2 != null) {
if (mCheckBox2.isChecked())
graphView.addSeries(pitchSeries);
} else
graphView.addSeries(pitchSeries);
if (mCheckBox3 != null) {
|
193,313 | } else
<BUG>graphView.addSeries(gyroSeries);
</BUG>
if (mCheckBox3 != null) {
if (mCheckBox3.isChecked())
<BUG>graphView.addSeries(kalmanSeries);
</BUG>
} else
<BUG>graphView.addSeries(kalmanSeries);
</BUG>
graphView.setManualYAxisBounds(180, -180);
| } else
graphView.addSeries(rollSeries);
if (mCheckBox2 != null) {
if (mCheckBox2.isChecked())
graphView.addSeries(pitchSeries);
} else
graphView.addSeries(pitchSeries);
if (mCheckBox3 != null) {
if (mCheckBox3.isChecked())
graphView.addSeries(yawSeries);
} else
graphView.addSeries(yawSeries);
graphView.setManualYAxisBounds(180, -180);
|
193,314 | mCheckBox1 = (CheckBox) v.findViewById(R.id.checkBox1);
mCheckBox1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (((CheckBox) v).isChecked())
<BUG>graphView.addSeries(accSeries);
</BUG>
else
<BUG>graphView.removeSeries(accSeries);
</BUG>
}
| mCheckBox1 = (CheckBox) v.findViewById(R.id.checkBox1);
mCheckBox1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (((CheckBox) v).isChecked())
graphView.addSeries(rollSeries);
else
graphView.removeSeries(rollSeries);
}
|
193,315 | mCheckBox2 = (CheckBox) v.findViewById(R.id.checkBox2);
mCheckBox2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (((CheckBox) v).isChecked())
<BUG>graphView.addSeries(gyroSeries);
</BUG>
else
<BUG>graphView.removeSeries(gyroSeries);
</BUG>
}
| mCheckBox2 = (CheckBox) v.findViewById(R.id.checkBox2);
mCheckBox2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (((CheckBox) v).isChecked())
graphView.addSeries(pitchSeries);
else
graphView.removeSeries(pitchSeries);
}
|
193,316 | mCheckBox3 = (CheckBox) v.findViewById(R.id.checkBox3);
mCheckBox3.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (((CheckBox) v).isChecked())
<BUG>graphView.addSeries(kalmanSeries);
</BUG>
else
<BUG>graphView.removeSeries(kalmanSeries);
</BUG>
}
| mCheckBox3 = (CheckBox) v.findViewById(R.id.checkBox3);
mCheckBox3.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (((CheckBox) v).isChecked())
graphView.addSeries(yawSeries);
else
graphView.removeSeries(yawSeries);
}
|
193,317 | mToggleButton.setText("Start");
LaunchPadFlightControllerActivity activity = ((LaunchPadFlightControllerActivity) getActivity());
if (activity != null && activity.mChatService != null) {
if (activity.mChatService.getState() == BluetoothChatService.STATE_CONNECTED && activity.checkTab(ViewPagerAdapter.GRAPH_FRAGMENT)) {
if (((ToggleButton) v).isChecked())
<BUG>activity.mChatService.mBluetoothProtocol.startImu(); // Request data
</BUG>
else
<BUG>activity.mChatService.mBluetoothProtocol.stopImu(); // Stop sending data
</BUG>
}
| mToggleButton.setText("Start");
LaunchPadFlightControllerActivity activity = ((LaunchPadFlightControllerActivity) getActivity());
if (activity != null && activity.mChatService != null) {
if (activity.mChatService.getState() == BluetoothChatService.STATE_CONNECTED && activity.checkTab(ViewPagerAdapter.GRAPH_FRAGMENT)) {
if (((ToggleButton) v).isChecked())
activity.mChatService.mBluetoothProtocol.sendAngles((byte) 1); // Request data
else
activity.mChatService.mBluetoothProtocol.sendAngles((byte) 0); // Stop sending data
|
193,318 | if (!Rmeasure.isEmpty() && mRmeasure != null && mRmeasure.getText() != null) {
if (!(mRmeasure.getText().toString().equals(Rmeasure)))
mRmeasure.setText(Rmeasure);
}
}
<BUG>public void updateIMUValues(String accValue, String gyroValue, String kalmanValue) {
</BUG>
if (mToggleButton == null || !(mToggleButton.isChecked()))
return;
for (int i = 0; i < 3; i++)
| if (!Rmeasure.isEmpty() && mRmeasure != null && mRmeasure.getText() != null) {
if (!(mRmeasure.getText().toString().equals(Rmeasure)))
mRmeasure.setText(Rmeasure);
}
}
public void updateAngles(String rollValue, String pitchValue, String yawValue) {
if (mToggleButton == null || !(mToggleButton.isChecked()))
return;
for (int i = 0; i < 3; i++)
|
193,319 | if (mToggleButton == null || !(mToggleButton.isChecked()))
return;
for (int i = 0; i < 3; i++)
System.arraycopy(buffer[i], 1, buffer[i], 0, 100);
try { // In some rare occasions the values can be corrupted
<BUG>buffer[0][100] = Double.parseDouble(accValue);
buffer[1][100] = Double.parseDouble(gyroValue);
buffer[2][100] = Double.parseDouble(kalmanValue);
</BUG>
} catch (NumberFormatException e) {
| if (mToggleButton == null || !(mToggleButton.isChecked()))
return;
for (int i = 0; i < 3; i++)
System.arraycopy(buffer[i], 1, buffer[i], 0, 100);
try { // In some rare occasions the values can be corrupted
buffer[0][100] = Double.parseDouble(rollValue);
buffer[1][100] = Double.parseDouble(pitchValue);
buffer[2][100] = Double.parseDouble(yawValue);
} catch (NumberFormatException e) {
|
193,320 | Log.e(TAG, "Error in input", e);
return;
}
boolean scroll = mCheckBox1.isChecked() || mCheckBox2.isChecked() || mCheckBox3.isChecked();
counter++;
<BUG>accSeries.appendData(new GraphViewData(counter, buffer[0][100]), scroll, 101);
gyroSeries.appendData(new GraphViewData(counter, buffer[1][100]), scroll, 101);
kalmanSeries.appendData(new GraphViewData(counter, buffer[2][100]), scroll, 101);
</BUG>
if (!scroll)
| Log.e(TAG, "Error in input", e);
return;
}
boolean scroll = mCheckBox1.isChecked() || mCheckBox2.isChecked() || mCheckBox3.isChecked();
counter++;
rollSeries.appendData(new GraphViewData(counter, buffer[0][100]), scroll, 101);
pitchSeries.appendData(new GraphViewData(counter, buffer[1][100]), scroll, 101);
yawSeries.appendData(new GraphViewData(counter, buffer[2][100]), scroll, 101);
if (!scroll)
|
193,321 | else
mToggleButton.setText("Start");
LaunchPadFlightControllerActivity activity = ((LaunchPadFlightControllerActivity) getActivity());
if (activity != null && activity.mChatService != null && activity.mChatService.getState() == BluetoothChatService.STATE_CONNECTED && activity.checkTab(ViewPagerAdapter.GRAPH_FRAGMENT)) {
if (mToggleButton.isChecked())
<BUG>activity.mChatService.mBluetoothProtocol.startImu(); // Request data
</BUG>
else
<BUG>activity.mChatService.mBluetoothProtocol.stopImu(); // Stop sending data
</BUG>
}
| else
mToggleButton.setText("Start");
LaunchPadFlightControllerActivity activity = ((LaunchPadFlightControllerActivity) getActivity());
if (activity != null && activity.mChatService != null && activity.mChatService.getState() == BluetoothChatService.STATE_CONNECTED && activity.checkTab(ViewPagerAdapter.GRAPH_FRAGMENT)) {
if (mToggleButton.isChecked())
activity.mChatService.mBluetoothProtocol.sendAngles((byte) 1); // Request data
else
activity.mChatService.mBluetoothProtocol.sendAngles((byte) 0); // Stop sending data
|
193,322 | public static final String BATTERY_LEVEL = "battery_level";
public static final String RUN_TIME = "run_time";
public static final String QANGLE_VALUE = "qangle_value";
public static final String QBIAS_VALUE = "qbias_value";
public static final String RMEASURE_VALUE = "rmeasure_value";
<BUG>public static final String ACC_ANGLE = "acc_angle";
public static final String GYRO_ANGLE = "gyro_angle";
public static final String KALMAN_ANGLE = "kalman_angle";
</BUG>
private static final int REQUEST_CONNECT_DEVICE = 1;
| public static final String BATTERY_LEVEL = "battery_level";
public static final String RUN_TIME = "run_time";
public static final String QANGLE_VALUE = "qangle_value";
public static final String QBIAS_VALUE = "qbias_value";
public static final String RMEASURE_VALUE = "rmeasure_value";
public static final String ROLL_ANGLE = "roll_angle";
public static final String PITCH_ANGLE = "pitch_angle";
public static final String YAW_ANGLE = "yaw_angle";
private static final int REQUEST_CONNECT_DEVICE = 1;
|
193,323 | super.onPause();
if (D)
Log.d(TAG, "- ON PAUSE -");
if (mChatService != null) { // Send stop command and stop sending graph data command
if (mChatService.getState() == BluetoothChatService.STATE_CONNECTED) {
<BUG>mChatService.mBluetoothProtocol.stopInfo();
mChatService.mBluetoothProtocol.stopImu();
}</BUG>
}
}
| super.onPause();
if (D)
Log.d(TAG, "- ON PAUSE -");
if (mChatService != null) { // Send stop command and stop sending graph data command
if (mChatService.getState() == BluetoothChatService.STATE_CONNECTED) {
mChatService.mBluetoothProtocol.sendInfo((byte) 0); // Stop sending info
mChatService.mBluetoothProtocol.sendAngles((byte) 0); // Stop sending angles
}
}
}
|
193,324 | Log.d(TAG, "onTabSelected: " + tab.getPosition());
currentTabSelected = tab.getPosition();
mUnderlinePageIndicator.setCurrentItem(currentTabSelected);
if (mChatService != null && mChatService.getState() == BluetoothChatService.STATE_CONNECTED) {
if (checkTab(ViewPagerAdapter.INFO_FRAGMENT))
<BUG>mChatService.mBluetoothProtocol.startInfo();
else if (checkTab(ViewPagerAdapter.PID_FRAGMENT)) {</BUG>
mChatService.mBluetoothProtocol.getPIDRollPitch();
mChatService.mBluetoothProtocol.getPIDYaw();
} else if (checkTab(ViewPagerAdapter.GRAPH_FRAGMENT)) {
| Log.d(TAG, "onTabSelected: " + tab.getPosition());
currentTabSelected = tab.getPosition();
mUnderlinePageIndicator.setCurrentItem(currentTabSelected);
if (mChatService != null && mChatService.getState() == BluetoothChatService.STATE_CONNECTED) {
if (checkTab(ViewPagerAdapter.INFO_FRAGMENT))
mChatService.mBluetoothProtocol.sendInfo((byte) 1); // Request info
else if (checkTab(ViewPagerAdapter.PID_FRAGMENT)) {
mChatService.mBluetoothProtocol.getPIDRollPitch();
mChatService.mBluetoothProtocol.getPIDYaw();
} else if (checkTab(ViewPagerAdapter.GRAPH_FRAGMENT)) {
|
193,325 | mChatService.mBluetoothProtocol.getPIDYaw();
} else if (checkTab(ViewPagerAdapter.GRAPH_FRAGMENT)) {
mChatService.mBluetoothProtocol.getKalman();
if (GraphFragment.mToggleButton != null) {
if (GraphFragment.mToggleButton.isChecked())
<BUG>mChatService.mBluetoothProtocol.startImu(); // Request data
</BUG>
else
<BUG>mChatService.mBluetoothProtocol.stopImu(); // Stop sending data
</BUG>
}
| mChatService.mBluetoothProtocol.getPIDYaw();
} else if (checkTab(ViewPagerAdapter.GRAPH_FRAGMENT)) {
mChatService.mBluetoothProtocol.getKalman();
if (GraphFragment.mToggleButton != null) {
if (GraphFragment.mToggleButton.isChecked())
mChatService.mBluetoothProtocol.sendAngles((byte) 1); // Request data
else
mChatService.mBluetoothProtocol.sendAngles((byte) 0); // Stop sending data
|
193,326 | public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
if (D)
Log.d(TAG, "onTabUnselected: " + tab.getPosition() + " " + currentTabSelected);
if (mChatService != null && mChatService.getState() == BluetoothChatService.STATE_CONNECTED) {
if (checkTab(ViewPagerAdapter.INFO_FRAGMENT))
<BUG>mChatService.mBluetoothProtocol.stopInfo(); // Stop sending info
</BUG>
else if (checkTab(ViewPagerAdapter.GRAPH_FRAGMENT))
<BUG>mChatService.mBluetoothProtocol.stopImu(); // Stop sending data
</BUG>
}
| public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
if (D)
Log.d(TAG, "onTabUnselected: " + tab.getPosition() + " " + currentTabSelected);
if (mChatService != null && mChatService.getState() == BluetoothChatService.STATE_CONNECTED) {
if (checkTab(ViewPagerAdapter.INFO_FRAGMENT))
mChatService.mBluetoothProtocol.sendInfo((byte) 0); // Stop sending info
else if (checkTab(ViewPagerAdapter.GRAPH_FRAGMENT))
mChatService.mBluetoothProtocol.sendAngles((byte) 0); // Stop sending data
}
|
193,327 | if (mLaunchPadFlightControllerActivity.checkTab(ViewPagerAdapter.INFO_FRAGMENT)) {
mHandler.postDelayed(new Runnable() {
public void run() {
LaunchPadFlightControllerActivity mLaunchPadFlightControllerActivity = mActivity.get();
if (mLaunchPadFlightControllerActivity != null)
<BUG>mLaunchPadFlightControllerActivity.mChatService.mBluetoothProtocol.startInfo(); // Request info
</BUG>
}
}, 2000); // Wait 2 seconds before sending the message
} else if (mLaunchPadFlightControllerActivity.checkTab(ViewPagerAdapter.GRAPH_FRAGMENT)) {
| if (mLaunchPadFlightControllerActivity.checkTab(ViewPagerAdapter.INFO_FRAGMENT)) {
mHandler.postDelayed(new Runnable() {
public void run() {
LaunchPadFlightControllerActivity mLaunchPadFlightControllerActivity = mActivity.get();
if (mLaunchPadFlightControllerActivity != null)
mLaunchPadFlightControllerActivity.mChatService.mBluetoothProtocol.sendInfo((byte) 1); // Request info
}
}, 2000); // Wait 2 seconds before sending the message
} else if (mLaunchPadFlightControllerActivity.checkTab(ViewPagerAdapter.GRAPH_FRAGMENT)) {
|
193,328 | mHandler.postDelayed(new Runnable() {
public void run() {
LaunchPadFlightControllerActivity mLaunchPadFlightControllerActivity = mActivity.get();
if (mLaunchPadFlightControllerActivity != null) {
if (GraphFragment.mToggleButton.isChecked())
<BUG>mLaunchPadFlightControllerActivity.mChatService.mBluetoothProtocol.startImu(); // Request data
</BUG>
else
<BUG>mLaunchPadFlightControllerActivity.mChatService.mBluetoothProtocol.stopImu(); // Stop sending data
</BUG>
}
| mHandler.postDelayed(new Runnable() {
public void run() {
LaunchPadFlightControllerActivity mLaunchPadFlightControllerActivity = mActivity.get();
if (mLaunchPadFlightControllerActivity != null)
mLaunchPadFlightControllerActivity.mChatService.mBluetoothProtocol.sendInfo((byte) 1); // Request info
|
193,329 | if (data.containsKey(QANGLE_VALUE) && data.containsKey(QBIAS_VALUE) && data.containsKey(RMEASURE_VALUE)) {
graphFragment = (GraphFragment) mLaunchPadFlightControllerActivity.getFragment(ViewPagerAdapter.GRAPH_FRAGMENT);
if (graphFragment != null)
graphFragment.updateKalman(data.getString(QANGLE_VALUE), data.getString(QBIAS_VALUE), data.getString(RMEASURE_VALUE));
}
<BUG>if (data.containsKey(ACC_ANGLE) && data.containsKey(GYRO_ANGLE) && data.containsKey(KALMAN_ANGLE)) {
</BUG>
graphFragment = (GraphFragment) mLaunchPadFlightControllerActivity.getFragment(ViewPagerAdapter.GRAPH_FRAGMENT);
if (graphFragment != null)
<BUG>graphFragment.updateIMUValues(data.getString(ACC_ANGLE), data.getString(GYRO_ANGLE), data.getString(KALMAN_ANGLE));
</BUG>
}
| if (data.containsKey(QANGLE_VALUE) && data.containsKey(QBIAS_VALUE) && data.containsKey(RMEASURE_VALUE)) {
graphFragment = (GraphFragment) mLaunchPadFlightControllerActivity.getFragment(ViewPagerAdapter.GRAPH_FRAGMENT);
if (graphFragment != null)
graphFragment.updateKalman(data.getString(QANGLE_VALUE), data.getString(QBIAS_VALUE), data.getString(RMEASURE_VALUE));
|
193,330 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
setOutlineProvider(ViewOutlineProvider.BOUNDS);
}
}
@Override
<BUG>public void draw(@NonNull Canvas canvas) {
if (cornerRadius > 0 && getWidth() > 0 && getHeight() > 0 && Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT_WATCH) {</BUG>
int saveCount = canvas.saveLayer(0, 0, getWidth(), getHeight(), null, Canvas.ALL_SAVE_FLAG);
super.draw(canvas);
paint.setXfermode(pdMode);
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
setOutlineProvider(ViewOutlineProvider.BOUNDS);
}
}
@Override
public void draw(@NonNull Canvas canvas) {
drawCalled = true;
if (cornerRadius > 0 && getWidth() > 0 && getHeight() > 0 && Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT_WATCH) {
int saveCount = canvas.saveLayer(0, 0, getWidth(), getHeight(), null, Canvas.ALL_SAVE_FLAG);
super.draw(canvas);
paint.setXfermode(pdMode);
|
193,331 | }
@RootTask
static Task<Exec.Result> exec(String parameter, int number) {
Task<String> task1 = MyTask.create(parameter);
Task<Integer> task2 = Adder.create(number, number + 2);
<BUG>return Task.ofType(Exec.Result.class).named("exec", "/bin/sh")
.in(() -> task1)</BUG>
.in(() -> task2)
.process(Exec.exec((str, i) -> args("/bin/sh", "-c", "\"echo " + i + "\"")));
}
| }
@RootTask
static Task<Exec.Result> exec(String parameter, int number) {
Task<String> task1 = MyTask.create(parameter);
Task<Integer> task2 = Adder.create(number, number + 2);
return Task.named("exec", "/bin/sh").ofType(Exec.Result.class)
.in(() -> task1)
.in(() -> task2)
.process(Exec.exec((str, i) -> args("/bin/sh", "-c", "\"echo " + i + "\"")));
}
|
193,332 | return args;
}
static class MyTask {
static final int PLUS = 10;
static Task<String> create(String parameter) {
<BUG>return Task.ofType(String.class).named("MyTask", parameter)
.in(() -> Adder.create(parameter.length(), PLUS))</BUG>
.in(() -> Fib.create(parameter.length()))
.process((sum, fib) -> something(parameter, sum, fib));
}
| return args;
}
static class MyTask {
static final int PLUS = 10;
static Task<String> create(String parameter) {
return Task.named("MyTask", parameter).ofType(String.class)
.in(() -> Adder.create(parameter.length(), PLUS))
.in(() -> Fib.create(parameter.length()))
.process((sum, fib) -> something(parameter, sum, fib));
}
|
193,333 | final String instanceField = "from instance";
final TaskContext context = TaskContext.inmem();
final AwaitingConsumer<String> val = new AwaitingConsumer<>();
@Test
public void shouldJavaUtilSerialize() throws Exception {
<BUG>Task<Long> task1 = Task.ofType(Long.class).named("Foo", "Bar", 39)
.process(() -> 9999L);
Task<String> task2 = Task.ofType(String.class).named("Baz", 40)
.in(() -> task1)</BUG>
.ins(() -> singletonList(task1))
| final String instanceField = "from instance";
final TaskContext context = TaskContext.inmem();
final AwaitingConsumer<String> val = new AwaitingConsumer<>();
@Test
public void shouldJavaUtilSerialize() throws Exception {
Task<Long> task1 = Task.named("Foo", "Bar", 39).ofType(Long.class)
.process(() -> 9999L);
Task<String> task2 = Task.named("Baz", 40).ofType(String.class)
.in(() -> task1)
.ins(() -> singletonList(task1))
|
193,334 | assertEquals(des.id().name(), "Baz");
assertEquals(val.awaitAndGet(), "[9999] hello 10004");
}
@Test(expected = NotSerializableException.class)
public void shouldNotSerializeWithInstanceFieldReference() throws Exception {
<BUG>Task<String> task = Task.ofType(String.class).named("WithRef")
.process(() -> instanceField + " causes an outer reference");</BUG>
serialize(task);
}
@Test
| assertEquals(des.id().name(), "Baz");
assertEquals(val.awaitAndGet(), "[9999] hello 10004");
}
@Test(expected = NotSerializableException.class)
public void shouldNotSerializeWithInstanceFieldReference() throws Exception {
Task<String> task = Task.named("WithRef").ofType(String.class)
.process(() -> instanceField + " causes an outer reference");
serialize(task);
}
@Test
|
193,335 | serialize(task);
}
@Test
public void shouldSerializeWithLocalReference() throws Exception {
String local = instanceField;
<BUG>Task<String> task = Task.ofType(String.class).named("WithLocalRef")
.process(() -> local + " won't cause an outer reference");</BUG>
serialize(task);
Task<String> des = deserialize();
context.evaluate(des).consume(val);
| serialize(task);
}
@Test
public void shouldSerializeWithLocalReference() throws Exception {
String local = instanceField;
Task<String> task = Task.named("WithLocalRef").ofType(String.class)
.process(() -> local + " won't cause an outer reference");
serialize(task);
Task<String> des = deserialize();
context.evaluate(des).consume(val);
|
193,336 | TaskContext taskContext = TaskContext.inmem();
TaskContext.Value<Long> value = taskContext.evaluate(fib92);
value.consume(f92 -> System.out.println("fib(92) = " + f92));
}
static Task<Long> create(long n) {
<BUG>TaskBuilder<Long> fib = Task.ofType(Long.class).named("Fib", n);
</BUG>
if (n < 2) {
return fib
.process(() -> n);
| TaskContext taskContext = TaskContext.inmem();
TaskContext.Value<Long> value = taskContext.evaluate(fib92);
value.consume(f92 -> System.out.println("fib(92) = " + f92));
}
static Task<Long> create(long n) {
TaskBuilder<Long> fib = Task.named("Fib", n).ofType(Long.class);
if (n < 2) {
return fib
.process(() -> n);
|
193,337 | }
@RootTask
public static Task<String> standardArgs(int first, String second) {
firstInt = first;
secondString = second;
<BUG>return Task.ofType(String.class).named("StandardArgs", first, second)
.process(() -> second + " " + first * 100);</BUG>
}
@Test
public void shouldParseFlags() throws Exception {
| }
@RootTask
public static Task<String> standardArgs(int first, String second) {
firstInt = first;
secondString = second;
return Task.named("StandardArgs", first, second).ofType(String.class)
.process(() -> second + " " + first * 100);
}
@Test
public void shouldParseFlags() throws Exception {
|
193,338 | assertThat(parsedEnum, is(CustomEnum.BAR));
}
@RootTask
public static Task<String> enums(CustomEnum enm) {
parsedEnum = enm;
<BUG>return Task.ofType(String.class).named("Enums", enm)
.process(enm::toString);</BUG>
}
@Test
public void shouldParseCustomTypes() throws Exception {
| assertThat(parsedEnum, is(CustomEnum.BAR));
}
@RootTask
public static Task<String> enums(CustomEnum enm) {
parsedEnum = enm;
return Task.named("Enums", enm).ofType(String.class)
.process(enm::toString);
}
@Test
public void shouldParseCustomTypes() throws Exception {
|
193,339 | assertThat(parsedType.content, is("blarg parsed for you!"));
}
@RootTask
public static Task<String> customType(CustomType myType) {
parsedType = myType;
<BUG>return Task.ofType(String.class).named("Types", myType.content)
.process(() -> myType.content);</BUG>
}
public enum CustomEnum {
BAR
| assertThat(parsedType.content, is("blarg parsed for you!"));
}
@RootTask
public static Task<String> customType(CustomType myType) {
parsedType = myType;
return Task.named("Types", myType.content).ofType(String.class)
.process(() -> myType.content);
}
public enum CustomEnum {
BAR
|
193,340 | package com.mrcrayfish.modelcreator.element;
import java.util.List;
import com.mrcrayfish.modelcreator.texture.PendingTexture;
public interface ElementManager
{
<BUG>public Element getSelectedCuboid();
public List<Element> getAllCuboids();</BUG>
public Element getCuboid(int index);
public int getCuboidCount();
public void clearElements();
| package com.mrcrayfish.modelcreator.element;
import java.util.List;
import com.mrcrayfish.modelcreator.texture.PendingTexture;
public interface ElementManager
{
public Element getSelectedCuboid();
public void setSelectedCuboid(int pos);
public List<Element> getAllCuboids();
public Element getCuboid(int index);
public int getCuboidCount();
public void clearElements();
|
193,341 | import java.awt.event.ComponentEvent;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
<BUG>import java.io.InputStream;
import java.util.ArrayList;</BUG>
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import javax.swing.BorderFactory;
| import java.awt.event.ComponentEvent;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import javax.swing.BorderFactory;
|
193,342 | {
glClearColor(0.92F, 0.92F, 0.93F, 1.0F);
drawGrid();
glTranslatef(-8, 0, -8);
for (int i = 0; i < manager.getCuboidCount(); i++)
<BUG>{
Element cube = manager.getCuboid(i);
cube.draw();
cube.drawExtras(manager);</BUG>
}
| {
glClearColor(0.92F, 0.92F, 0.93F, 1.0F);
drawGrid();
glTranslatef(-8, 0, -8);
for (int i = 0; i < manager.getCuboidCount(); i++)
{
GL11.glLoadName(i+1);
Element cube = manager.getCuboid(i);
cube.draw();
GL11.glLoadName(0);
cube.drawExtras(manager);
}
|
193,343 | glVertex2i(45, 5);
}
glEnd();
}
private int lastMouseX, lastMouseY;
<BUG>private boolean grabbing = false;
public void handleInput()</BUG>
{
final float cameraMod = Math.abs(camera.getZ());
if (Mouse.isButtonDown(0) | Mouse.isButtonDown(1))
| glVertex2i(45, 5);
}
glEnd();
}
private int lastMouseX, lastMouseY;
private boolean grabbing = false;
private Element grabbed = null;
public void handleInput()
{
final float cameraMod = Math.abs(camera.getZ());
if (Mouse.isButtonDown(0) | Mouse.isButtonDown(1))
|
193,344 | int newMouseY = Mouse.getY();
int xMovement = (int) ((newMouseX - lastMouseX) / 20);
int yMovement = (int) ((newMouseY - lastMouseY) / 20);
if (xMovement != 0 | yMovement != 0)
{
<BUG>Element element = manager.getSelectedCuboid();
switch (state)</BUG>
{
case 0:
element.addStartX(xMovement);
| int newMouseY = Mouse.getY();
int xMovement = (int) ((newMouseX - lastMouseX) / 20);
int yMovement = (int) ((newMouseY - lastMouseY) / 20);
if (xMovement != 0 | yMovement != 0)
{
if (Mouse.isButtonDown(0))
{
switch (state)
{
case 0:
element.addStartX(xMovement);
|
193,345 | this.builtinPatterns = builtinPatterns;
}
@Override
public GrokProcessor doCreate(String processorTag, Map<String, Object> config) throws Exception {
String matchField = ConfigurationUtils.readStringProperty(TYPE, processorTag, config, "field");
<BUG>String matchPattern = ConfigurationUtils.readStringProperty(TYPE, processorTag, config, "pattern");
Map<String, String> customPatternBank = ConfigurationUtils.readOptionalMap(TYPE, processorTag, config, "pattern_definitions");</BUG>
Map<String, String> patternBank = new HashMap<>(builtinPatterns);
if (customPatternBank != null) {
| this.builtinPatterns = builtinPatterns;
}
@Override
public GrokProcessor doCreate(String processorTag, Map<String, Object> config) throws Exception {
String matchField = ConfigurationUtils.readStringProperty(TYPE, processorTag, config, "field");
List<String> matchPatterns = ConfigurationUtils.readList(TYPE, processorTag, config, "patterns");
boolean traceMatch = ConfigurationUtils.readBooleanProperty(TYPE, processorTag, config, "trace_match", false);
if (matchPatterns.isEmpty()) {
throw newConfigurationException(TYPE, processorTag, "patterns", "List of patterns must not be empty");
}
Map<String, String> customPatternBank = ConfigurationUtils.readOptionalMap(TYPE, processorTag, config, "pattern_definitions");
Map<String, String> patternBank = new HashMap<>(builtinPatterns);
if (customPatternBank != null) {
|
193,346 | Map<String, String> customPatternBank = ConfigurationUtils.readOptionalMap(TYPE, processorTag, config, "pattern_definitions");</BUG>
Map<String, String> patternBank = new HashMap<>(builtinPatterns);
if (customPatternBank != null) {
patternBank.putAll(customPatternBank);
}
<BUG>Grok grok;</BUG>
try {
<BUG>grok = new Grok(patternBank, matchPattern);
} catch (Exception e) {
throw newConfigurationException(TYPE, processorTag, "pattern", "Invalid regex pattern. " + e.getMessage());
}
return new GrokProcessor(processorTag, grok, matchField);</BUG>
}
| this.builtinPatterns = builtinPatterns;
}
@Override
public GrokProcessor doCreate(String processorTag, Map<String, Object> config) throws Exception {
String matchField = ConfigurationUtils.readStringProperty(TYPE, processorTag, config, "field");
List<String> matchPatterns = ConfigurationUtils.readList(TYPE, processorTag, config, "patterns");
boolean traceMatch = ConfigurationUtils.readBooleanProperty(TYPE, processorTag, config, "trace_match", false);
if (matchPatterns.isEmpty()) {
throw newConfigurationException(TYPE, processorTag, "patterns", "List of patterns must not be empty");
}
Map<String, String> customPatternBank = ConfigurationUtils.readOptionalMap(TYPE, processorTag, config, "pattern_definitions");
Map<String, String> patternBank = new HashMap<>(builtinPatterns);
if (customPatternBank != null) {
patternBank.putAll(customPatternBank);
|
193,347 | public class GrokProcessorFactoryTests extends ESTestCase {
public void testBuild() throws Exception {
GrokProcessor.Factory factory = new GrokProcessor.Factory(Collections.emptyMap());
Map<String, Object> config = new HashMap<>();
config.put("field", "_field");
<BUG>config.put("pattern", "(?<foo>\\w+)");
String processorTag = randomAsciiOfLength(10);</BUG>
config.put(AbstractProcessorFactory.TAG_KEY, processorTag);
GrokProcessor processor = factory.create(config);
assertThat(processor.getTag(), equalTo(processorTag));
| public class GrokProcessorFactoryTests extends ESTestCase {
public void testBuild() throws Exception {
GrokProcessor.Factory factory = new GrokProcessor.Factory(Collections.emptyMap());
Map<String, Object> config = new HashMap<>();
config.put("field", "_field");
config.put("patterns", Collections.singletonList("(?<foo>\\w+)"));
String processorTag = randomAsciiOfLength(10);
config.put(AbstractProcessorFactory.TAG_KEY, processorTag);
GrokProcessor processor = factory.create(config);
assertThat(processor.getTag(), equalTo(processorTag));
|
193,348 | public void testBuildMissingPattern() throws Exception {
</BUG>
GrokProcessor.Factory factory = new GrokProcessor.Factory(Collections.emptyMap());
Map<String, Object> config = new HashMap<>();
<BUG>config.put("field", "foo");
try {
factory.create(config);
fail("should fail");
} catch (ElasticsearchParseException e) {
assertThat(e.getMessage(), equalTo("[pattern] required property is missing"));
}
}</BUG>
public void testCreateWithCustomPatterns() throws Exception {
| assertThat(processor.getMatchField(), equalTo("_field"));
assertThat(processor.getGrok(), notNullValue());
}
public void testBuildMissingField() throws Exception {
GrokProcessor.Factory factory = new GrokProcessor.Factory(Collections.emptyMap());
Map<String, Object> config = new HashMap<>();
config.put("patterns", Collections.singletonList("(?<foo>\\w+)"));
ElasticsearchParseException e = expectThrows(ElasticsearchParseException.class, () -> factory.create(config));
assertThat(e.getMessage(), equalTo("[field] required property is missing"));
}
public void testBuildMissingPatterns() throws Exception {
|
193,349 | assertThat(processor.getGrok().match("foo!"), equalTo(true));
}
public void testCreateWithInvalidPattern() throws Exception {
GrokProcessor.Factory factory = new GrokProcessor.Factory(Collections.emptyMap());
Map<String, Object> config = new HashMap<>();
<BUG>config.put("field", "_field");
config.put("pattern", "[");
try {
factory.create(config);
fail("should fail");
} catch (ElasticsearchParseException e) {
assertThat(e.getMessage(), equalTo("[pattern] Invalid regex pattern. premature end of char-class"));
}</BUG>
}
| assertThat(processor.getGrok().match("foo!"), equalTo(true));
}
public void testCreateWithInvalidPattern() throws Exception {
GrokProcessor.Factory factory = new GrokProcessor.Factory(Collections.emptyMap());
Map<String, Object> config = new HashMap<>();
config.put("field", "_field");
config.put("patterns", Collections.singletonList("["));
ElasticsearchParseException e = expectThrows(ElasticsearchParseException.class, () -> factory.create(config));
assertThat(e.getMessage(), equalTo("[patterns] Invalid regex pattern found in: [[]. premature end of char-class"));
}
|
193,350 | this.delayedReferences = new HashMap<String, List<String>>();
this.delayedBundles = new LinkedList<Bundle>();
importProviders = new LinkedHashMap<String, ImportProvider>();
importProviders.put(EXT_JCR_XML, null);
importProviders.put(EXT_JSON, JsonReader.PROVIDER);
<BUG>importProviders.put(EXT_XJSON, XJsonReader.PROVIDER);
importProviders.put(EXT_XML, XmlReader.PROVIDER);</BUG>
}
public void dispose() {
this.delayedReferences = null;
| this.delayedReferences = new HashMap<String, List<String>>();
this.delayedBundles = new LinkedList<Bundle>();
importProviders = new LinkedHashMap<String, ImportProvider>();
importProviders.put(EXT_JCR_XML, null);
importProviders.put(EXT_JSON, JsonReader.PROVIDER);
importProviders.put(EXT_XJSON, JsonReader.PROVIDER);
importProviders.put(EXT_XML, XmlReader.PROVIDER);
}
public void dispose() {
this.delayedReferences = null;
|
193,351 | package org.apache.sling.jcr.resource.internal.loader;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
<BUG>import java.io.InputStream;
import java.util.Iterator;
</BUG>
import javax.jcr.PropertyType;
import org.apache.sling.commons.json.JSONArray;
| package org.apache.sling.jcr.resource.internal.loader;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashSet;
import java.util.Set;
import javax.jcr.PropertyType;
import org.apache.sling.commons.json.JSONArray;
|
193,352 | return this.createNode(name, json);
} catch (JSONException je) {
throw (IOException) new IOException(je.getMessage()).initCause(je);
}
}
<BUG>protected Node createNode(String name, JSONObject nodeDescriptor) throws JSONException {
</BUG>
Node node = new Node();
node.setName(name);
<BUG>Object primaryType = nodeDescriptor.opt("primaryNodeType");
</BUG>
if (primaryType != null) {
| return this.createNode(name, json);
} catch (JSONException je) {
throw (IOException) new IOException(je.getMessage()).initCause(je);
}
}
protected Node createNode(String name, JSONObject obj) throws JSONException {
Node node = new Node();
node.setName(name);
Object primaryType = obj.opt("jcr:primaryType");
if (primaryType != null) {
|
193,353 | value = null;
}
} else {
property.setValue(String.valueOf(value));
}
<BUG>property.setType((type != null) ? type : this.getType(value));
return property;</BUG>
}
protected String getType(Object object) {
if (object instanceof Double || object instanceof Float) {
| value = null;
}
} else {
property.setValue(String.valueOf(value));
}
property.setType(getType(value));
return property;
}
protected String getType(Object object) {
if (object instanceof Double || object instanceof Float) {
|
193,354 | 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.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.DigestOutputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
public final class PatchUtils {
|
193,355 | package org.jboss.as.patching;
import org.jboss.as.controller.AttributeDefinition;
<BUG>import org.jboss.as.controller.SimpleAttributeDefinition;</BUG>
import org.jboss.as.controller.SimpleAttributeDefinitionBuilder;
import org.jboss.dmr.ModelType;
<BUG>class Constants {
</BUG>
static final AttributeDefinition PATCH_ID = SimpleAttributeDefinitionBuilder.create("patch-id", ModelType.STRING).build();
| package org.jboss.as.patching;
import org.jboss.as.controller.AttributeDefinition;
import org.jboss.as.controller.SimpleAttributeDefinitionBuilder;
import org.jboss.dmr.ModelType;
public class Constants {
|
193,356 | 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 {
| 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;
import org.jboss.logging.annotations.MessageBundle;
import org.jboss.logging.annotations.Cause;
import java.io.IOException;
import java.util.List;
@MessageBundle(projectCode = "JBAS")
public interface PatchMessages {
|
193,357 | 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;
| package org.jboss.as.patching.runner;
import static org.jboss.as.patching.runner.PatchUtils.generateTimestamp;
import org.jboss.as.boot.DirectoryStructure;
import org.jboss.as.patching.CommonAttributes;
import org.jboss.as.patching.LocalPatchInfo;
import org.jboss.as.patching.PatchInfo;
import org.jboss.as.patching.PatchLogger;
import org.jboss.as.patching.PatchMessages;
|
193,358 | 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"),
| 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"),
ADDED_MODULE("added-module"),
APPLIES_TO_VERSION("applies-to-version"),
BUNDLES("bundles"),
CUMULATIVE("cumulative"),
DESCRIPTION("description"),
MISC_FILES("misc-files"),
|
193,359 | writer.writeEndElement();
final Patch.PatchType type = patch.getPatchType();
<BUG>final List<String> appliesTo = patch.getAppliesTo();</BUG>
if(type == Patch.PatchType.ONE_OFF) {
<BUG>writer.writeEmptyElement(Element.ONE_OFF.name);
</BUG>
} else {
<BUG>writer.writeEmptyElement(Element.CUMULATIVE.name);
</BUG>
writer.writeAttribute(Attribute.RESULTING_VERSION.name, patch.getResultingVersion());
| writer.writeEndElement();
writer.writeStartElement(Element.DESCRIPTION.name);
writer.writeCharacters(patch.getDescription());
writer.writeEndElement();
final Patch.PatchType type = patch.getPatchType();
if(type == Patch.PatchType.ONE_OFF) {
writer.writeStartElement(Element.ONE_OFF.name);
} else {
writer.writeStartElement(Element.CUMULATIVE.name);
writer.writeAttribute(Attribute.RESULTING_VERSION.name, patch.getResultingVersion());
|
193,360 | } else {
<BUG>writer.writeEmptyElement(Element.CUMULATIVE.name);
</BUG>
writer.writeAttribute(Attribute.RESULTING_VERSION.name, patch.getResultingVersion());
}
<BUG>writer.writeAttribute(Attribute.APPLIES_TO_VERSION.name, appliesTo);
final List<ContentModification> bundlesAdd = new ArrayList<ContentModification>();</BUG>
final List<ContentModification> bundlesUpdate = new ArrayList<ContentModification>();
final List<ContentModification> bundlesRemove = new ArrayList<ContentModification>();
final List<ContentModification> miscAdd = new ArrayList<ContentModification>();
| } else {
writer.writeStartElement(Element.CUMULATIVE.name);
writer.writeAttribute(Attribute.RESULTING_VERSION.name, patch.getResultingVersion());
}
writeAppliesToVersions(writer, patch.getAppliesTo());
writer.writeEndElement(); // </one-off> or </cumulative>
final List<ContentModification> bundlesAdd = new ArrayList<ContentModification>();
final List<ContentModification> bundlesUpdate = new ArrayList<ContentModification>();
final List<ContentModification> bundlesRemove = new ArrayList<ContentModification>();
final List<ContentModification> miscAdd = new ArrayList<ContentModification>();
|
193,361 | 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) {
| 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) {
case RESULTING_VERSION:
if(type == Patch.PatchType.CUMULATIVE) {
|
193,362 | 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) {
| final StringBuilder path = new StringBuilder();
for(final String p : item.getPath()) {
path.append(p).append(PATH_DELIMITER);
}
path.append(item.getName());
writer.writeAttribute(Attribute.PATH.name, path.toString());
if (item.isDirectory()) {
writer.writeAttribute(Attribute.DIRECTORY.name, "true");
}
if(type != ModificationType.REMOVE) {
writer.writeAttribute(Attribute.HASH.name, bytesToHexString(item.getContentHash()));
}
if(type != ModificationType.ADD) {
|
193,363 | package betterquesting.client.gui.editors;
import java.util.List;
import net.minecraft.client.gui.GuiButton;
<BUG>import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;</BUG>
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
| package betterquesting.client.gui.editors;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.resources.I18n;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
|
193,364 | public class GuiPrerequisiteEditor extends GuiQuesting
{
QuestInstance quest;
int leftScroll = 0;
int rightScroll = 0;
<BUG>int maxRows = 0;
public GuiPrerequisiteEditor(GuiScreen parent, QuestInstance quest)</BUG>
{
super(parent, "betterquesting.title.pre_requisites");
| public class GuiPrerequisiteEditor extends GuiQuesting
{
QuestInstance quest;
int leftScroll = 0;
int rightScroll = 0;
int maxRowsL = 0;
int maxRowsR = 0;
GuiTextField searchBox;
ArrayList<QuestInstance> searchResults = new ArrayList<QuestInstance>();
public GuiPrerequisiteEditor(GuiScreen parent, QuestInstance quest)
{
super(parent, "betterquesting.title.pre_requisites");
|
193,365 | }
<BUG>for(int i = 0; i < maxRows; i++)
</BUG>
{
<BUG>GuiButtonQuesting btn = new GuiButtonQuesting(this.buttonList.size(), guiLeft + sizeX/4 - (btnWidth/2 + 4), guiTop + 48 + (i*20), 20, 20, "" + EnumChatFormatting.YELLOW + EnumChatFormatting.BOLD + "-");
</BUG>
this.buttonList.add(btn);
}
<BUG>for(int i = 0; i < maxRows; i++)
</BUG>
{
| }
@Override
@SuppressWarnings("unchecked")
public void initGui()
|
193,366 | }
<BUG>for(int i = 0; i < maxRows; i++)
</BUG>
{
<BUG>GuiButtonQuesting btn = new GuiButtonQuesting(this.buttonList.size(), guiLeft + sizeX/4*3 - (btnWidth/2 + 4) + 40, guiTop + 48 + (i*20), btnWidth - 40, 20, "NULL");
</BUG>
this.buttonList.add(btn);
}
<BUG>for(int i = 0; i < maxRows; i++)
</BUG>
{
| }
@Override
@SuppressWarnings("unchecked")
public void initGui()
|
193,367 | }
<BUG>for(int i = 0; i < maxRows; i++)
</BUG>
{
<BUG>GuiButtonQuesting btn = new GuiButtonQuesting(this.buttonList.size(), guiLeft + sizeX/4*3 - (btnWidth/2 + 4) + 20, guiTop + 48 + (i*20), 20, 20, "" + EnumChatFormatting.RED + EnumChatFormatting.BOLD + "x");
</BUG>
this.buttonList.add(btn);
}
<BUG>for(int i = 0; i < maxRows; i++)
</BUG>
{
| }
@Override
@SuppressWarnings("unchecked")
public void initGui()
|
193,368 |
this.drawTexturedModalRect(guiLeft + sizeX/4*3 - 4 + btnWidth/2, this.guiTop + 48, 248, 0, 8, 20);
</BUG>
s = 20;
<BUG>while(s < (maxRows - 1) * 20)
</BUG>
{
<BUG>this.drawTexturedModalRect(guiLeft + sizeX/4*3 - 4 + btnWidth/2, this.guiTop + 48 + s, 248, 20, 8, 20);
</BUG>
s += 20;
| int s = 20;
while(s < (maxRowsL - 1) * 20)
{
this.drawTexturedModalRect(guiLeft + sizeX/2 - 16, this.guiTop + 48 + s, 248, 20, 8, 20);
s += 20;
}
this.drawTexturedModalRect(guiLeft + sizeX/2 - 16, this.guiTop + 48 + s, 248, 40, 8, 20);
this.drawTexturedModalRect(guiLeft + sizeX/2 - 16, this.guiTop + 48 + (int)Math.max(0, s * (float)leftScroll/(quest == null? 1 : quest.preRequisites.size() - maxRowsL)), 248, 60, 8, 20);
this.drawTexturedModalRect(guiLeft + sizeX - 24, this.guiTop + 68, 248, 0, 8, 20);
s = 20;
while(s < (maxRowsR - 1) * 20)
{
this.drawTexturedModalRect(guiLeft + sizeX - 24, this.guiTop + 68 + s, 248, 20, 8, 20);
s += 20;
|
193,369 | quest.preRequisites.remove(n3);
SendChanges();
}
} else if(n2 == 2) // Edit quest
{
<BUG>if(!(n4 < 0 || n4 >= QuestDatabase.questDB.size()))
{
mc.displayGuiScreen(new GuiQuestInstance(this, QuestDatabase.getQuestByOrder(n4)));
</BUG>
}
| quest.preRequisites.remove(n3);
SendChanges();
}
} else if(n2 == 2) // Edit quest
{
if(!(n4 < 0 || n4 >= searchResults.size()))
{
mc.displayGuiScreen(new GuiQuestInstance(this, searchResults.get(n4)));
}
|
193,370 | int mx = Mouse.getEventX() * this.width / this.mc.displayWidth;
int my = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
int SDX = (int)-Math.signum(Mouse.getEventDWheel());
if(SDX != 0 && isWithin(mx, my, this.guiLeft, this.guiTop, sizeX/2, sizeY))
{
<BUG>leftScroll = quest == null? 0 : Math.max(0, MathHelper.clamp_int(leftScroll + SDX, 0, quest.preRequisites.size() - maxRows));
</BUG>
RefreshColumns();
}
if(SDX != 0 && isWithin(mx, my, this.guiLeft + sizeX/2, this.guiTop, sizeX/2, sizeY))
| int mx = Mouse.getEventX() * this.width / this.mc.displayWidth;
int my = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
int SDX = (int)-Math.signum(Mouse.getEventDWheel());
if(SDX != 0 && isWithin(mx, my, this.guiLeft, this.guiTop, sizeX/2, sizeY))
{
leftScroll = quest == null? 0 : Math.max(0, MathHelper.clamp_int(leftScroll + SDX, 0, quest.preRequisites.size() - maxRowsL));
RefreshColumns();
}
if(SDX != 0 && isWithin(mx, my, this.guiLeft + sizeX/2, this.guiTop, sizeX/2, sizeY))
|
193,371 | </BUG>
RefreshColumns();
}
if(SDX != 0 && isWithin(mx, my, this.guiLeft + sizeX/2, this.guiTop, sizeX/2, sizeY))
{
<BUG>rightScroll = Math.max(0, MathHelper.clamp_int(rightScroll + SDX, 0, QuestDatabase.questDB.size() - maxRows));
</BUG>
RefreshColumns();
}
}
| int mx = Mouse.getEventX() * this.width / this.mc.displayWidth;
int my = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
int SDX = (int)-Math.signum(Mouse.getEventDWheel());
if(SDX != 0 && isWithin(mx, my, this.guiLeft, this.guiTop, sizeX/2, sizeY))
{
leftScroll = quest == null? 0 : Math.max(0, MathHelper.clamp_int(leftScroll + SDX, 0, quest.preRequisites.size() - maxRowsL));
RefreshColumns();
}
if(SDX != 0 && isWithin(mx, my, this.guiLeft + sizeX/2, this.guiTop, sizeX/2, sizeY))
{
rightScroll = Math.max(0, MathHelper.clamp_int(rightScroll + SDX, 0, searchResults.size() - maxRowsR));
RefreshColumns();
}
}
|
193,372 | tags.setTag("Data", NBTConverter.JSONtoNBT_Object(json, new NBTTagCompound()));
BetterQuesting.instance.network.sendToServer(PacketDataType.QUEST_EDIT.makePacket(tags));
}
public void RefreshColumns()
{
<BUG>leftScroll = quest == null? 0 : Math.max(0, MathHelper.clamp_int(leftScroll, 0, quest.preRequisites.size() - maxRows));
rightScroll = Math.max(0, MathHelper.clamp_int(rightScroll, 0, QuestDatabase.questDB.size() - maxRows));
</BUG>
if(quest != null && !QuestDatabase.questDB.containsValue(quest))
| tags.setTag("Data", NBTConverter.JSONtoNBT_Object(json, new NBTTagCompound()));
BetterQuesting.instance.network.sendToServer(PacketDataType.QUEST_EDIT.makePacket(tags));
}
public void RefreshColumns()
|
193,373 | } else if(n2 == 1) // Remove quest
{
btn.visible = btn.enabled = quest != null && !(n3 < 0 || n3 >= quest.preRequisites.size());
} else if(n2 == 2) // Edit quest
{
<BUG>if(n4 < 0 || n4 >= QuestDatabase.questDB.size())
{</BUG>
btn.displayString = "NULL";
btn.visible = btn.enabled = false;
} else
| } else if(n2 == 1) // Remove quest
{
btn.visible = btn.enabled = quest != null && !(n3 < 0 || n3 >= quest.preRequisites.size());
} else if(n2 == 2) // Edit quest
{
if(n4 < 0 || n4 >= searchResults.size())
{
btn.displayString = "NULL";
btn.visible = btn.enabled = false;
} else
|
193,374 | <BUG>if(n4 < 0 || n4 >= QuestDatabase.questDB.size())
{</BUG>
btn.visible = btn.enabled = false;
} else
{
<BUG>QuestInstance q = QuestDatabase.getQuestByOrder(n4);
btn.visible = true;
btn.enabled = quest != null && !quest.preRequisites.contains(q);
</BUG>
}
| } else if(n2 == 1) // Remove quest
{
btn.visible = btn.enabled = quest != null && !(n3 < 0 || n3 >= quest.preRequisites.size());
} else if(n2 == 2) // Edit quest
{
if(n4 < 0 || n4 >= searchResults.size())
{
btn.displayString = "NULL";
btn.visible = btn.enabled = false;
} else
{
QuestInstance q = searchResults.get(n4);
btn.visible = btn.enabled = true;
btn.displayString = q.name;
|
193,375 | GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glPushMatrix();
double scaleX = sx2/128D;
double scaleY = sizeY/128D;
GL11.glScaled(scaleX, scaleY, 1F);
<BUG>screen.drawTexturedModalRect((int)Math.round((posX)/scaleX), (int)Math.round((posY)/scaleY), 0, 128, 128, 128);
GL11.glPopMatrix();</BUG>
QuestInstance qTooltip = null;
if(qLine != null)
{
| GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glPushMatrix();
double scaleX = sx2/128D;
double scaleY = sizeY/128D;
GL11.glScaled(scaleX, scaleY, 1F);
GL11.glTranslated(posX/scaleX, posY/scaleY, 0);
screen.drawTexturedModalRect(0, 0, 0, 128, 128, 128);
GL11.glPopMatrix();
QuestInstance qTooltip = null;
if(qLine != null)
{
|
193,376 | import java.util.List;
import java.util.Queue;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.regex.Pattern;
public class CaptchaSolveHelper {
<BUG>public static final String USER_AGENT =
"Mozilla/5.0 (Windows NT 10.0; WOW64) "
+ "AppleWebKit/537.36 (KHTML, like Gecko) "
+ "Chrome/54.0.2840.99 Safari/537.36";</BUG>
private static final List<Listener> LISTENERS = new ArrayList<>();
| import java.util.List;
import java.util.Queue;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.regex.Pattern;
public class CaptchaSolveHelper {
public static final String USER_AGENT = "Niantic App";
private static final List<Listener> LISTENERS = new ArrayList<>();
|
193,377 | package com.pokegoapi.api.pokemon;
import POGOProtos.Enums.PokemonIdOuterClass.PokemonId;
import POGOProtos.Networking.Responses.DownloadItemTemplatesResponseOuterClass.DownloadItemTemplatesResponse.ItemTemplate;
<BUG>import POGOProtos.Settings.Master.PokemonSettingsOuterClass.PokemonSettings;
import java.util.ArrayList;</BUG>
import java.util.HashMap;
import java.util.List;
import java.util.Map;
| package com.pokegoapi.api.pokemon;
import POGOProtos.Enums.PokemonIdOuterClass.PokemonId;
import POGOProtos.Networking.Responses.DownloadItemTemplatesResponseOuterClass.DownloadItemTemplatesResponse.ItemTemplate;
import POGOProtos.Settings.Master.PokemonSettingsOuterClass.PokemonSettings;
import com.pokegoapi.main.PokemonMeta;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
|
193,378 | import com.pokegoapi.util.hash.crypto.Crypto;
import com.pokegoapi.util.hash.crypto.PokeHashCrypto;
import com.squareup.moshi.Moshi;
import com.squareup.moshi.Moshi.Builder;
import lombok.Getter;
<BUG>import net.iharder.Base64;
import java.io.BufferedReader;</BUG>
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
| import com.pokegoapi.util.hash.crypto.Crypto;
import com.pokegoapi.util.hash.crypto.PokeHashCrypto;
import com.squareup.moshi.Moshi;
import com.squareup.moshi.Moshi.Builder;
import lombok.Getter;
import net.iharder.Base64;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
|
193,379 | import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;
public class PokeHashProvider implements HashProvider {
<BUG>private static final String HASH_ENDPOINT = "http://pokehash.buddyauth.com/api/v122/hash";
</BUG>
private static final int VERSION = 5100;
private static final long UNK25 = -8832040574896607694L;
private static final Moshi MOSHI = new Builder().build();
| import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;
public class PokeHashProvider implements HashProvider {
private static final String HASH_ENDPOINT = "https://pokehash.buddyauth.com/api/v121_2/hash";
private static final int VERSION = 5100;
private static final long UNK25 = -8832040574896607694L;
private static final Moshi MOSHI = new Builder().build();
|
193,380 | @Override
public Hash provide(long timestamp, double latitude, double longitude, double altitude, byte[] authTicket,
byte[] sessionData, byte[][] requests) throws HashException {
Request request = new Request(latitude, longitude, altitude, timestamp, authTicket, sessionData, requests);
try {
<BUG>HttpURLConnection connection = (HttpURLConnection) new URL(HASH_ENDPOINT).openConnection();
</BUG>
connection.setRequestMethod("POST");
connection.setRequestProperty("X-AuthToken", key);
connection.setRequestProperty("content-type", "application/json");
| @Override
public Hash provide(long timestamp, double latitude, double longitude, double altitude, byte[] authTicket,
byte[] sessionData, byte[][] requests) throws HashException {
Request request = new Request(latitude, longitude, altitude, timestamp, authTicket, sessionData, requests);
try {
HttpsURLConnection connection = (HttpsURLConnection) new URL(HASH_ENDPOINT).openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("X-AuthToken", key);
connection.setRequestProperty("content-type", "application/json");
|
193,381 | package ro.fortsoft.pf4j.demo;
import java.util.List;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
<BUG>import ro.fortsoft.pf4j.DefaultPluginManager;
import ro.fortsoft.pf4j.PluginManager;</BUG>
import ro.fortsoft.pf4j.PluginWrapper;
import ro.fortsoft.pf4j.demo.api.Greeting;
public class Boot {
| package ro.fortsoft.pf4j.demo;
import java.util.List;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import ro.fortsoft.pf4j.DefaultPluginManager;
import ro.fortsoft.pf4j.JarPluginManager;
import ro.fortsoft.pf4j.PluginManager;
import ro.fortsoft.pf4j.PluginWrapper;
import ro.fortsoft.pf4j.demo.api.Greeting;
public class Boot {
|
193,382 | 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.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;
import org.rajawali3d.math.Matrix4;
import org.rajawali3d.math.Quaternion;
import org.rajawali3d.math.vector.Vector3;
import org.rajawali3d.primitives.ScreenQuad;
import org.rajawali3d.primitives.Sphere;
import org.rajawali3d.renderer.RajawaliRenderer;
|
193,383 | 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() {
| translationMoon.setRepeatMode(Animation.RepeatMode.INFINITE);
translationMoon.setTransformable3D(moon);
getCurrentScene().registerAnimation(translationMoon);
translationMoon.play();
}
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]);
}
public int getTextureId() {
|
193,384 | 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;
| package com.projecttango.examples.java.helloareadescription;
import com.google.atap.tangoservice.Tango;
import com.google.atap.tangoservice.Tango.OnTangoUpdateListener;
import com.google.atap.tangoservice.TangoAreaDescriptionMetaData;
import com.google.atap.tangoservice.TangoConfig;
import com.google.atap.tangoservice.TangoCoordinateFramePair;
import com.google.atap.tangoservice.TangoErrorException;
import com.google.atap.tangoservice.TangoEvent;
|
193,385 | Toast.makeText(this, R.string.tango_not_ready, Toast.LENGTH_SHORT).show();
return;
}
Bundle bundle = new Bundle();
TangoAreaDescriptionMetaData metaData = mTango.loadAreaDescriptionMetaData(mCurrentUuid);
<BUG>byte[] adfNameBytes = metaData.get("name");
if (adfNameBytes != null) {</BUG>
String fillDialogName = new String(adfNameBytes);
<BUG>bundle.putString("name", fillDialogName);
}
bundle.putString("id", mCurrentUuid);
FragmentManager manager = getFragmentManager();</BUG>
SetAdfNameDialog setAdfNameDialog = new SetAdfNameDialog();
| Toast.makeText(this, R.string.tango_not_ready, Toast.LENGTH_SHORT).show();
return;
}
Bundle bundle = new Bundle();
TangoAreaDescriptionMetaData metaData = mTango.loadAreaDescriptionMetaData(mCurrentUuid);
byte[] adfNameBytes = metaData.get(TangoAreaDescriptionMetaData.KEY_NAME);
if (adfNameBytes != null) {
String fillDialogName = new String(adfNameBytes);
bundle.putString(TangoAreaDescriptionMetaData.KEY_NAME, fillDialogName);
}
bundle.putString(TangoAreaDescriptionMetaData.KEY_UUID, mCurrentUuid);
FragmentManager manager = getFragmentManager();
SetAdfNameDialog setAdfNameDialog = new SetAdfNameDialog();
|
193,386 | 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;
| 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;
import com.google.atap.tangoservice.TangoCoordinateFramePair;
import com.google.atap.tangoservice.TangoErrorException;
import com.google.atap.tangoservice.TangoEvent;
import com.google.atap.tangoservice.TangoOutOfDateException;
import com.google.atap.tangoservice.TangoPoseData;
import com.google.atap.tangoservice.TangoXyzIjData;
|
193,387 | 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) {
| super.onResume();
if (!mIsConnected) {
mTango = new Tango(AugmentedRealityActivity.this, new Runnable() {
@Override
public void run() {
try {
TangoSupport.initialize();
connectTango();
setupRenderer();
mIsConnected = true;
} catch (TangoOutOfDateException e) {
|
193,388 | 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
| if (lastFramePose.statusCode == TangoPoseData.POSE_VALID) {
mRenderer.updateRenderCameraPose(lastFramePose);
mCameraPoseTimestamp = lastFramePose.timestamp;
} else {
Log.w(TAG, "Can't get device pose at time: " +
mRgbTimestampGlThread);
}
}
}
}
@Override
|
193,389 | package licola.demo.com.huabandemo.Module.Type;
import android.app.Activity;
import android.content.Intent;
<BUG>import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;</BUG>
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.Toolbar;
<BUG>import android.view.View;
import butterknife.Bind;</BUG>
import licola.demo.com.huabandemo.API.OnFragmentRefreshListener;
| package licola.demo.com.huabandemo.Module.Type;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.Toolbar;
import android.view.View;
import java.lang.ref.WeakReference;
import butterknife.Bind;
import licola.demo.com.huabandemo.API.OnFragmentRefreshListener;
|
193,390 | if (fragment != null) {
mListenerRefresh = fragment;
}
getSupportFragmentManager().
beginTransaction().replace(R.id.container_with_refresh, fragment).commit();
<BUG>long start=System.currentTimeMillis();
for (int i = 0; i < 1000; i++) {
SPUtils.get(this, Constant.TOKENACCESS,"");</BUG>
}
<BUG>long end=System.currentTimeMillis();
Logger.d("used time="+(end-start));
}</BUG>
@Override
| if (fragment != null) {
mListenerRefresh = fragment;
}
getSupportFragmentManager().
beginTransaction().replace(R.id.container_with_refresh, fragment).commit();
}
@Override
protected void onResume() {
super.onResume();
}
@Override
|
193,391 | package licola.demo.com.huabandemo.Service;
import android.app.Activity;
import android.app.IntentService;
import android.app.Notification;
import android.app.NotificationManager;
<BUG>import android.content.Intent;
import android.os.AsyncTask;</BUG>
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
| package licola.demo.com.huabandemo.Service;
import android.app.Activity;
import android.app.IntentService;
import android.app.Notification;
import android.app.NotificationManager;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
|
193,392 | private static HuaBanApplication instance;
private RefWatcher refWatcher;
@Override
public void onCreate() {
super.onCreate();
<BUG>instance = this;
Fresco.initialize(HuaBanApplication.getInstance());//初始化Fresco图片加载框架
refWatcher= LeakCanary.install(this);//初始化 内存检测工具</BUG>
}
public static HuaBanApplication getInstance() {
| private static HuaBanApplication instance;
private RefWatcher refWatcher;
@Override
public void onCreate() {
super.onCreate();
instance = this;
refWatcher= LeakCanary.install(this);//初始化 内存检测工具
Fresco.initialize(HuaBanApplication.getInstance());//初始化Fresco图片加载框架
}
public static HuaBanApplication getInstance() {
|
193,393 | import licola.demo.com.huabandemo.Module.Main.MainActivity;
import licola.demo.com.huabandemo.Observable.MyRxObservable;
import licola.demo.com.huabandemo.R;
import licola.demo.com.huabandemo.Util.Base64;
import licola.demo.com.huabandemo.Util.Constant;
<BUG>import licola.demo.com.huabandemo.Util.Logger;
import licola.demo.com.huabandemo.Util.SPUtils;</BUG>
import licola.demo.com.huabandemo.Util.TimeUtils;
import rx.Observable;
import rx.Subscriber;
| import licola.demo.com.huabandemo.Module.Main.MainActivity;
import licola.demo.com.huabandemo.Observable.MyRxObservable;
import licola.demo.com.huabandemo.R;
import licola.demo.com.huabandemo.Util.Base64;
import licola.demo.com.huabandemo.Util.Constant;
import licola.demo.com.huabandemo.Util.Logger;
import licola.demo.com.huabandemo.Util.SPBuild;
import licola.demo.com.huabandemo.Util.SPUtils;
import licola.demo.com.huabandemo.Util.TimeUtils;
import rx.Observable;
import rx.Subscriber;
|
193,394 | saveToken(tokenBean);
}
});
}
private void saveToken(TokenBean tokenBean) {
<BUG>SPUtils.putApply(getApplicationContext(), Constant.LOGINTIME, System.currentTimeMillis());
SPUtils.putApply(getApplicationContext(), Constant.TOKENACCESS, tokenBean.getAccess_token());
SPUtils.putApply(getApplicationContext(), Constant.TOKENTYPE, tokenBean.getToken_type());
}</BUG>
private Observable<TokenBean> getUserToken(String username, String password) {
| saveToken(tokenBean);
}
});
}
private void saveToken(TokenBean tokenBean) {
new SPBuild(getApplicationContext())
.addData(Constant.LOGINTIME, System.currentTimeMillis())
.addData(Constant.TOKENACCESS, tokenBean.getAccess_token())
.addData(Constant.TOKENTYPE, tokenBean.getToken_type())
.build();
}
private Observable<TokenBean> getUserToken(String username, String password) {
|
193,395 | import android.support.design.widget.FloatingActionButton;
import android.support.graphics.drawable.AnimatedVectorDrawableCompat;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
<BUG>import android.view.View;
import com.facebook.drawee.controller.BaseControllerListener;</BUG>
import com.facebook.drawee.view.SimpleDraweeView;
import com.facebook.imagepipeline.image.ImageInfo;
import com.squareup.leakcanary.CanaryLog;
| import android.support.design.widget.FloatingActionButton;
import android.support.graphics.drawable.AnimatedVectorDrawableCompat;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import com.davemorrissey.labs.subscaleview.ImageSource;
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
import com.facebook.drawee.controller.BaseControllerListener;
import com.facebook.drawee.view.SimpleDraweeView;
import com.facebook.imagepipeline.image.ImageInfo;
import com.squareup.leakcanary.CanaryLog;
|
193,396 | Logger.d();
mPinsBean = savedInstanceState.getParcelable(KEYPARCELABLE);
}
}
mImageUrl = mPinsBean.getFile().getKey();
<BUG>mImageType=mPinsBean.getFile().getType();
</BUG>
mPinsId = String.valueOf(mPinsBean.getPin_id());
isLike = mPinsBean.isLiked();
int width = mPinsBean.getFile().getWidth();
| Logger.d();
mPinsBean = savedInstanceState.getParcelable(KEYPARCELABLE);
}
}
mImageUrl = mPinsBean.getFile().getKey();
mImageType = mPinsBean.getFile().getType();
mPinsId = String.valueOf(mPinsBean.getPin_id());
isLike = mPinsBean.isLiked();
int width = mPinsBean.getFile().getWidth();
|
193,397 | package licola.demo.com.huabandemo.Module.User;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
<BUG>import android.graphics.Bitmap;
import android.graphics.Color;</BUG>
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
<BUG>import android.os.Bundle;
import android.support.design.widget.AppBarLayout;</BUG>
import android.support.design.widget.CollapsingToolbarLayout;
| package licola.demo.com.huabandemo.Module.User;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Looper;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CollapsingToolbarLayout;
|
193,398 | import licola.demo.com.huabandemo.Util.Constant;
import licola.demo.com.huabandemo.Util.DialogUtils;
import licola.demo.com.huabandemo.Util.FastBlurUtil;
import licola.demo.com.huabandemo.Util.Logger;
import licola.demo.com.huabandemo.Util.NetUtils;
<BUG>import licola.demo.com.huabandemo.Util.SPUtils;
import licola.demo.com.huabandemo.Widget.MyDialog.BoardEditDialogFragment;</BUG>
import rx.Subscriber;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
| import licola.demo.com.huabandemo.Util.Constant;
import licola.demo.com.huabandemo.Util.DialogUtils;
import licola.demo.com.huabandemo.Util.FastBlurUtil;
import licola.demo.com.huabandemo.Util.Logger;
import licola.demo.com.huabandemo.Util.NetUtils;
import licola.demo.com.huabandemo.Util.SPUtils;
import licola.demo.com.huabandemo.Util.Utils;
import licola.demo.com.huabandemo.Widget.MyDialog.BoardEditDialogFragment;
import rx.Subscriber;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
|
193,399 | throw new ReviewedStingException("Haplotypes a and b must be of same length");
byte chA, chB;
byte wc = (byte)REGEXP_WILDCARD;
final int length = a.length;
byte[] consensusChars = new byte[length];
<BUG>double[] consensusQuals = new double[length];
for (int i=0; i < length; i++) {</BUG>
chA = a[i];
chB = b[i];
if ((chA != chB) && (chA != wc) && (chB != wc))
| throw new ReviewedStingException("Haplotypes a and b must be of same length");
byte chA, chB;
byte wc = (byte)REGEXP_WILDCARD;
final int length = a.length;
byte[] consensusChars = new byte[length];
double[] consensusQuals = new double[length];
final double[] qualsA = haplotypeA.getQuals();
final double[] qualsB = haplotypeB.getQuals();
for (int i=0; i < length; i++) {
chA = a[i];
chB = b[i];
if ((chA != chB) && (chA != wc) && (chB != wc))
|
193,400 | boolean matched = BaseUtils.basesAreEqual(readBase, haplotypeBase );
double e = QualityUtils.qualToErrorProb(read.getBaseQualities()[baseOffset]);
expected += e;</BUG>
mismatches += matched ? e : 1 - e / 3;
if ( DEBUG ) System.out.printf("Read %s: scoring %c vs. %c => e = %f Q%d esum %f vs. msum %f%n",
<BUG>read.getReadName(), (char)haplotypeBase, (char)readBase, e, read.getBaseQualities()[baseOffset], expected, mismatches);
}</BUG>
return mismatches - expected;
}
private static final double[] FLAT_BASE_PRIORS = new double[BaseUtils.Base.values().length];
| boolean matched = BaseUtils.basesAreEqual(readBase, haplotypeBase );
double e = QualityUtils.qualToErrorProb(readQuals[baseOffset]);
expected += e;
mismatches += matched ? e : 1 - e / 3;
if ( DEBUG ) System.out.printf("Read %s: scoring %c vs. %c => e = %f Q%d esum %f vs. msum %f%n",
read.getReadName(), (char)haplotypeBase, (char)readBase, e, readQuals[baseOffset], expected, mismatches);
}
return mismatches - expected;
}
private static final double[] FLAT_BASE_PRIORS = new double[BaseUtils.Base.values().length];
|