id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
47,601
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;
47,602
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();
47,603
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: " +
47,604
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;
47,605
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]);
47,606
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;
47,607
public ComponentImpl(BatchReport.Component component, @Nullable Iterable<Component> children) { this.component = component; this.type = convertType(component.getType()); this.children = children == null ? Collections.<Component>emptyList() : copyOf(filter(children, notNull())); } <BUG>private static Type convertType(Constants.ComponentType type) { </BUG> switch (type) { case PROJECT: return Type.PROJECT;
public static Type convertType(Constants.ComponentType type) {
47,608
} else { updateMemo(); callback.updateMemo(); } dismiss(); <BUG>}else{ </BUG> Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show(); } }
[DELETED]
47,609
} @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_memo); <BUG>ChinaPhoneHelper.setStatusBar(this,true); </BUG> topicId = getIntent().getLongExtra("topicId", -1); if (topicId == -1) { finish();
ChinaPhoneHelper.setStatusBar(this, true);
47,610
MemoEntry.COLUMN_REF_TOPIC__ID + " = ?" , new String[]{String.valueOf(topicId)}); } public Cursor selectMemo(long topicId) { Cursor c = db.query(MemoEntry.TABLE_NAME, null, MemoEntry.COLUMN_REF_TOPIC__ID + " = ?", new String[]{String.valueOf(topicId)}, null, null, <BUG>MemoEntry._ID + " DESC", null); </BUG> if (c != null) { c.moveToFirst(); }
MemoEntry.COLUMN_ORDER + " ASC", null);
47,611
MemoEntry._ID + " = ?", new String[]{String.valueOf(memoId)}); } public long updateMemoContent(long memoId, String memoContent) { ContentValues values = new ContentValues(); <BUG>values.put(MemoEntry.COLUMN_CONTENT, memoContent); return db.update(</BUG> MemoEntry.TABLE_NAME, values, MemoEntry._ID + " = ?",
return db.update(
47,612
import android.widget.RelativeLayout; import android.widget.TextView; import com.kiminonawa.mydiary.R; import com.kiminonawa.mydiary.db.DBManager; import com.kiminonawa.mydiary.shared.EditMode; <BUG>import com.kiminonawa.mydiary.shared.ThemeManager; import java.util.List; public class MemoAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements EditMode { </BUG> private List<MemoEntity> memoList;
import com.marshalchen.ultimaterecyclerview.dragsortadapter.DragSortAdapter; public class MemoAdapter extends DragSortAdapter<DragSortAdapter.ViewHolder> implements EditMode {
47,613
private DBManager dbManager; private boolean isEditMode = false; private EditMemoDialogFragment.MemoCallback callback; private static final int TYPE_HEADER = 0; private static final int TYPE_ITEM = 1; <BUG>public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback) { this.mActivity = activity;</BUG> this.topicId = topicId; this.memoList = memoList;
public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback, RecyclerView recyclerView) { super(recyclerView); this.mActivity = activity;
47,614
this.memoList = memoList; this.dbManager = dbManager; this.callback = callback; } @Override <BUG>public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { </BUG> View view; if (isEditMode) { if (viewType == TYPE_HEADER) {
public DragSortAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
47,615
editMemoDialogFragment.show(mActivity.getSupportFragmentManager(), "editMemoDialogFragment"); } }); } } <BUG>protected class MemoViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private View rootView; private TextView TV_memo_item_content;</BUG> private ImageView IV_memo_item_delete;
protected class MemoViewHolder extends DragSortAdapter.ViewHolder implements View.OnClickListener, View.OnLongClickListener { private ImageView IV_memo_item_dot; private TextView TV_memo_item_content;
47,616
import org.spongepowered.api.world.Locatable; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; import java.util.List; <BUG>import java.util.Optional; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG> public class CommandDelete extends FCCommandBase { private static final FlagMapper MAPPER = map -> key -> value -> { map.put(key, value);
import java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
47,617
.append(Text.of(TextColors.GREEN, "Usage: ")) .append(getUsage(source)) .build()); return CommandResult.empty(); } else if (isIn(REGIONS_ALIASES, parse.args[0])) { <BUG>if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); IRegion region = FGManager.getInstance().getRegion(parse.args[1]); </BUG> boolean isWorldRegion = false; if (region == null) {
String regionName = parse.args[1]; IRegion region = FGManager.getInstance().getRegion(regionName).orElse(null);
47,618
</BUG> isWorldRegion = true; } if (region == null) <BUG>throw new CommandException(Text.of("No region exists with the name \"" + parse.args[1] + "\"!")); if (region instanceof GlobalWorldRegion) { </BUG> throw new CommandException(Text.of("You may not delete the global region!")); }
if (world == null) throw new CommandException(Text.of("No world exists with name \"" + worldName + "\"!")); if (world == null) throw new CommandException(Text.of("Must specify a world!")); region = FGManager.getInstance().getWorldRegion(world, regionName).orElse(null); throw new CommandException(Text.of("No region exists with the name \"" + regionName + "\"!")); if (region instanceof IGlobal) {
47,619
source.getName() + " deleted " + (isWorldRegion ? "world" : "") + "region" ); return CommandResult.success(); } else if (isIn(HANDLERS_ALIASES, parse.args[0])) { if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); <BUG>IHandler handler = FGManager.getInstance().gethandler(parse.args[1]); if (handler == null) throw new ArgumentParseException(Text.of("No handler exists with that name!"), parse.args[1], 1); if (handler instanceof GlobalHandler)</BUG> throw new CommandException(Text.of("You may not delete the global handler!"));
Optional<IHandler> handlerOpt = FGManager.getInstance().gethandler(parse.args[1]); if (!handlerOpt.isPresent()) IHandler handler = handlerOpt.get(); if (handler instanceof GlobalHandler)
47,620
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
47,621
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
47,622
@Dependency(id = "foxcore") }, description = "A world protection plugin built for SpongeAPI. Requires FoxCore.", authors = {"gravityfox"}, url = "https://github.com/FoxDenStudio/FoxGuard") <BUG>public final class FoxGuardMain { public final Cause pluginCause = Cause.builder().named("plugin", this).build(); private static FoxGuardMain instanceField;</BUG> @Inject private Logger logger;
private static FoxGuardMain instanceField;
47,623
private UserStorageService userStorage; private EconomyService economyService = null; private boolean loaded = false; private FCCommandDispatcher fgDispatcher; public static FoxGuardMain instance() { <BUG>return instanceField; }</BUG> @Listener public void construct(GameConstructionEvent event) { instanceField = this;
} public static Cause getCause() { return instance().pluginCause; }
47,624
return configDirectory; } public boolean isLoaded() { return loaded; } <BUG>public static Cause getCause() { return instance().pluginCause; }</BUG> public EconomyService getEconomyService() { return economyService;
[DELETED]
47,625
import org.spongepowered.api.world.Locatable; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; import java.util.*; <BUG>import java.util.stream.Collectors; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG> public class CommandHere extends FCCommandBase { private static final String[] PRIORITY_ALIASES = {"priority", "prio", "p"}; private static final FlagMapper MAPPER = map -> key -> value -> {
import java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
47,626
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index > 0) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
47,627
private static FGStorageManager instance; private final Logger logger = FoxGuardMain.instance().getLogger();</BUG> private final Set<LoadEntry> loaded = new HashSet<>(); private final Path directory = getDirectory(); private final Map<String, Path> worldDirectories; <BUG>private FGStorageManager() { defaultModifiedMap = new CacheMap<>((k, m) -> {</BUG> if (k instanceof IFGObject) { m.put((IFGObject) k, true); return true;
public final HashMap<IFGObject, Boolean> defaultModifiedMap; private final UserStorageService userStorageService; private final Logger logger = FoxGuardMain.instance().getLogger(); userStorageService = FoxGuardMain.instance().getUserStorage(); defaultModifiedMap = new CacheMap<>((k, m) -> {
47,628
String name = fgObject.getName(); Path singleDir = dir.resolve(name.toLowerCase()); </BUG> boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { <BUG>logger.info((shouldSave ? "S" : "Force s") + "aving handler \"" + name + "\" in directory: " + singleDir); </BUG> constructDirectory(singleDir); try { fgObject.save(singleDir);
UUID owner = fgObject.getOwner(); boolean isOwned = !owner.equals(SERVER_UUID); Optional<User> userOwner = userStorageService.get(owner); String logName = (userOwner.isPresent() ? userOwner.get().getName() + ":" : "") + (isOwned ? owner + ":" : "") + name; if (fgObject.autoSave()) { Path singleDir = serverDir.resolve(name.toLowerCase()); logger.info((shouldSave ? "S" : "Force s") + "aving handler " + logName + " in directory: " + singleDir);
47,629
if (fgObject.autoSave()) { Path singleDir = dir.resolve(name.toLowerCase()); </BUG> boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { <BUG>logger.info((shouldSave ? "S" : "Force s") + "aving world region \"" + name + "\" in directory: " + singleDir); </BUG> constructDirectory(singleDir); try { fgObject.save(singleDir);
Path singleDir = serverDir.resolve(name.toLowerCase()); logger.info((shouldSave ? "S" : "Force s") + "aving world region " + logName + " in directory: " + singleDir);
47,630
public synchronized void loadRegionLinks() { logger.info("Loading region links"); try (DB mainDB = DBMaker.fileDB(directory.resolve("regions.foxdb").normalize().toString()).make()) { Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen(); linksMap.entrySet().forEach(entry -> { <BUG>IRegion region = FGManager.getInstance().getRegion(entry.getKey()); if (region != null) { logger.info("Loading links for region \"" + region.getName() + "\"");</BUG> String handlersString = entry.getValue();
Optional<IRegion> regionOpt = FGManager.getInstance().getRegion(entry.getKey()); if (regionOpt.isPresent()) { IRegion region = regionOpt.get(); logger.info("Loading links for region \"" + region.getName() + "\"");
47,631
public synchronized void loadWorldRegionLinks(World world) { logger.info("Loading world region links for world \"" + world.getName() + "\""); try (DB mainDB = DBMaker.fileDB(worldDirectories.get(world.getName()).resolve("wregions.foxdb").normalize().toString()).make()) { Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen(); linksMap.entrySet().forEach(entry -> { <BUG>IRegion region = FGManager.getInstance().getWorldRegion(world, entry.getKey()); if (region != null) { logger.info("Loading links for world region \"" + region.getName() + "\"");</BUG> String handlersString = entry.getValue();
Optional<IWorldRegion> regionOpt = FGManager.getInstance().getWorldRegion(world, entry.getKey()); if (regionOpt.isPresent()) { IWorldRegion region = regionOpt.get(); logger.info("Loading links for world region \"" + region.getName() + "\"");
47,632
StringBuilder builder = new StringBuilder(); for (Iterator<IHandler> it = handlers.iterator(); it.hasNext(); ) { builder.append(it.next().getName()); if (it.hasNext()) builder.append(","); } <BUG>return builder.toString(); }</BUG> private final class LoadEntry { public final String name; public final Type type;
public enum Type { REGION, WREGION, HANDLER
47,633
.autoCloseQuotes(true) .leaveFinalAsIs(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "worldregion", "handler", "controller").stream() </BUG> .filter(new StartsWithPredicate(parse.current.token)) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "worldregion", "handler", "controller")
47,634
package org.opennms.netmgt.config; import java.io.File; import java.io.FileInputStream; import java.io.IOException; <BUG>import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList;</BUG> import java.util.Collection; import java.util.Enumeration;
import java.io.Reader; import java.util.ArrayList;
47,635
es.addServerSubscription(generatedSubscriptionName); } } if (generatedSubscriptionName != null) { boolean foundUnnamedSubscription = false; <BUG>for (Subscription s : m_singleton.getConfiguration().getSubscriptionCollection()) { if (s.getName() == null) {</BUG> s.setName(generatedSubscriptionName); foundUnnamedSubscription = true; break;
for (Subscription s : getConfiguration().getSubscriptionCollection()) { if (s.getName() == null) {
47,636
return m_singleton; }</BUG> public synchronized XmlrpcdConfiguration getConfiguration() { return m_config; } <BUG>public synchronized ArrayList<SubscribedEvent> getEventList(ExternalServers server) throws ValidationException { List<String> serverSubs = server.getServerSubscriptionCollection(); ArrayList<SubscribedEvent> allEventsList = new ArrayList<SubscribedEvent>(); for (int i = 0; i < serverSubs.size(); i++) { String name = serverSubs.get(i);</BUG> List<Subscription> subscriptions = m_config.getSubscriptionCollection();
public static synchronized void setInstance(XmlrpcdConfigFactory instance) { m_singleton = instance; m_loaded = true; public synchronized List<SubscribedEvent> getEventList(ExternalServers server) throws ValidationException { for (String name : server.getServerSubscriptionCollection()) {
47,637
foundSubscription = true; break; } } if (!foundSubscription) { <BUG>Category log = ThreadCategory.getInstance(getClass()); log.error("serverSubscription element " + name + </BUG> " references a subscription that does not exist"); throw new ValidationException("serverSubscription element " +
log().error("serverSubscription element " + name +
47,638
" references a subscription that does not exist"); throw new ValidationException("serverSubscription element " + name + " references a subscription that does not exist"); } } <BUG>return(allEventsList); </BUG> } public synchronized Enumeration<ExternalServers> getExternalServerEnumeration() { return m_config.enumerateExternalServers();
return allEventsList;
47,639
.filter(notNull(COLUMN_PROCESS_ID)) .column(COLUMN_PROCESS_INSTANCE_ID, COUNT, "Processes") .format(COLUMN_PROCESS_INSTANCE_ID, i18n.processes(), NO_DECIMALS) .width(METRIC_WIDTH).height(METRIC_HEIGHT) .margins(0, 0, 0, 0) <BUG>.backgroundColor(BG_COLOR) .filterOn(false, true, true)</BUG> .refreshOn() .buildSettings();
.backgroundColor(METRIC_BG) .htmlTemplate(METRIC_HTML) .jsTemplate(METRIC_JS) .filterOn(false, true, true)
47,640
.filter(COLUMN_PROCESS_STATUS, equalsTo(1)) .column(COLUMN_PROCESS_INSTANCE_ID, COUNT, "Processes") .format(COLUMN_PROCESS_INSTANCE_ID, i18n.activeProcesses(), NO_DECIMALS) .width(METRIC_WIDTH).height(METRIC_HEIGHT) .margins(0, 0, 0, 0) <BUG>.backgroundColor(BG_COLOR) .filterOn(false, true, true)</BUG> .refreshOn() .buildSettings();
.backgroundColor(METRIC_BG) .htmlTemplate(METRIC_HTML) .jsTemplate(METRIC_JS) .filterOn(false, true, true)
47,641
.filter(COLUMN_PROCESS_STATUS, equalsTo(0)) .column(COLUMN_PROCESS_INSTANCE_ID, COUNT, "Processes") .format(COLUMN_PROCESS_INSTANCE_ID, i18n.pendingProcesses(), NO_DECIMALS) .width(METRIC_WIDTH).height(METRIC_HEIGHT) .margins(0, 0, 0, 0) <BUG>.backgroundColor(BG_COLOR) .filterOn(false, true, true)</BUG> .refreshOn() .buildSettings();
.backgroundColor(METRIC_BG) .htmlTemplate(METRIC_HTML) .jsTemplate(METRIC_JS) .filterOn(false, true, true)
47,642
.filter(COLUMN_PROCESS_STATUS, equalsTo(4)) .column(COLUMN_PROCESS_INSTANCE_ID, COUNT, "Processes") .format(COLUMN_PROCESS_INSTANCE_ID, i18n.suspendedProcesses(), NO_DECIMALS) .width(METRIC_WIDTH).height(METRIC_HEIGHT) .margins(0, 0, 0, 0) <BUG>.backgroundColor(BG_COLOR) .filterOn(false, true, true)</BUG> .refreshOn() .buildSettings();
.backgroundColor(METRIC_BG) .htmlTemplate(METRIC_HTML) .jsTemplate(METRIC_JS) .filterOn(false, true, true)
47,643
.filter(COLUMN_PROCESS_STATUS, equalsTo(3)) .column(COLUMN_PROCESS_INSTANCE_ID, COUNT, "Processes") .format(COLUMN_PROCESS_INSTANCE_ID, i18n.abortedProcesses(), NO_DECIMALS) .width(METRIC_WIDTH).height(METRIC_HEIGHT) .margins(0, 0, 0, 0) <BUG>.backgroundColor(BG_COLOR) .filterOn(false, true, true)</BUG> .refreshOn() .buildSettings();
.backgroundColor(METRIC_BG) .htmlTemplate(METRIC_HTML) .jsTemplate(METRIC_JS) .filterOn(false, true, true)
47,644
.filter(COLUMN_PROCESS_STATUS, equalsTo(2)) .column(COLUMN_PROCESS_INSTANCE_ID, COUNT, "Processes") .format(COLUMN_PROCESS_INSTANCE_ID, i18n.completedProcesses(), NO_DECIMALS) .width(METRIC_WIDTH).height(METRIC_HEIGHT) .margins(0, 0, 0, 0) <BUG>.backgroundColor(BG_COLOR) .filterOn(false, true, true)</BUG> .refreshOn() .buildSettings();
.backgroundColor(METRIC_BG) .htmlTemplate(METRIC_HTML) .jsTemplate(METRIC_JS) .filterOn(false, true, true)
47,645
.filter(notNull(COLUMN_TASK_ID)) .column(COLUMN_TASK_ID, COUNT, "Tasks") .format(COLUMN_TASK_ID, i18n.tasks(), NO_DECIMALS) .width(METRIC_WIDTH).height(METRIC_HEIGHT) .margins(0, 0, 0, 0) <BUG>.backgroundColor(BG_COLOR) .filterOn(false, true, true)</BUG> .refreshOn() .buildSettings();
.backgroundColor(METRIC_BG) .htmlTemplate(METRIC_HTML) .jsTemplate(METRIC_JS) .filterOn(false, true, true)
47,646
.filter(COLUMN_TASK_STATUS, equalsTo(TASK_STATUS_CREATED)) .column(COLUMN_TASK_ID, COUNT, "Tasks") .format(COLUMN_TASK_ID, i18n.tasksCreated(), NO_DECIMALS) .width(METRIC_WIDTH).height(METRIC_HEIGHT) .margins(0, 0, 0, 0) <BUG>.backgroundColor(BG_COLOR) .filterOn(false, true, true)</BUG> .refreshOn() .buildSettings();
.backgroundColor(METRIC_BG) .htmlTemplate(METRIC_HTML) .jsTemplate(METRIC_JS) .filterOn(false, true, true)
47,647
.filter(COLUMN_TASK_STATUS, equalsTo(TASK_STATUS_READY)) .column(COLUMN_TASK_ID, COUNT, "Tasks") .format(COLUMN_TASK_ID, i18n.tasksReady(), NO_DECIMALS) .width(METRIC_WIDTH).height(METRIC_HEIGHT) .margins(0, 0, 0, 0) <BUG>.backgroundColor(BG_COLOR) .filterOn(false, true, true)</BUG> .refreshOn() .buildSettings();
.backgroundColor(METRIC_BG) .htmlTemplate(METRIC_HTML) .jsTemplate(METRIC_JS) .filterOn(false, true, true)
47,648
.filter(COLUMN_TASK_STATUS, equalsTo(TASK_STATUS_RESERVED)) .column(COLUMN_TASK_ID, COUNT, "Tasks") .format(COLUMN_TASK_ID, i18n.tasksReserved(), NO_DECIMALS) .width(METRIC_WIDTH).height(METRIC_HEIGHT) .margins(0, 0, 0, 0) <BUG>.backgroundColor(BG_COLOR) .filterOn(false, true, true)</BUG> .refreshOn() .buildSettings();
.backgroundColor(METRIC_BG) .htmlTemplate(METRIC_HTML) .jsTemplate(METRIC_JS) .filterOn(false, true, true)
47,649
.filter(COLUMN_TASK_STATUS, equalsTo(TASK_STATUS_IN_PROGRESS)) .column(COLUMN_TASK_ID, COUNT, "Tasks") .format(COLUMN_TASK_ID, i18n.tasksInProgress(), NO_DECIMALS) .width(METRIC_WIDTH).height(METRIC_HEIGHT) .margins(0, 0, 0, 0) <BUG>.backgroundColor(BG_COLOR) .filterOn(false, true, true)</BUG> .refreshOn() .buildSettings();
.backgroundColor(METRIC_BG) .htmlTemplate(METRIC_HTML) .jsTemplate(METRIC_JS) .filterOn(false, true, true)
47,650
.filter(COLUMN_TASK_STATUS, equalsTo(TASK_STATUS_SUSPENDED)) .column(COLUMN_TASK_ID, COUNT, "Tasks") .format(COLUMN_TASK_ID, i18n.tasksSuspended(), NO_DECIMALS) .width(METRIC_WIDTH).height(METRIC_HEIGHT) .margins(0, 0, 0, 0) <BUG>.backgroundColor(BG_COLOR) .filterOn(false, true, true)</BUG> .refreshOn() .buildSettings();
.backgroundColor(METRIC_BG) .htmlTemplate(METRIC_HTML) .jsTemplate(METRIC_JS) .filterOn(false, true, true)
47,651
.filter(COLUMN_TASK_STATUS, equalsTo(TASK_STATUS_COMPLETED)) .column(COLUMN_TASK_ID, COUNT, "Tasks") .format(COLUMN_TASK_ID, i18n.tasksCompleted(), NO_DECIMALS) .width(METRIC_WIDTH).height(METRIC_HEIGHT) .margins(0, 0, 0, 0) <BUG>.backgroundColor(BG_COLOR) .filterOn(false, true, true)</BUG> .refreshOn() .buildSettings();
.backgroundColor(METRIC_BG) .htmlTemplate(METRIC_HTML) .jsTemplate(METRIC_JS) .filterOn(false, true, true)
47,652
.filter(COLUMN_TASK_STATUS, equalsTo(TASK_STATUS_FAILED)) .column(COLUMN_TASK_ID, COUNT, "Tasks") .format(COLUMN_TASK_ID, i18n.tasksFailed(), NO_DECIMALS) .width(METRIC_WIDTH).height(METRIC_HEIGHT) .margins(0, 0, 0, 0) <BUG>.backgroundColor(BG_COLOR) .filterOn(false, true, true)</BUG> .refreshOn() .buildSettings();
.backgroundColor(METRIC_BG) .htmlTemplate(METRIC_HTML) .jsTemplate(METRIC_JS) .filterOn(false, true, true)
47,653
.filter(COLUMN_TASK_STATUS, equalsTo(TASK_STATUS_ERROR)) .column(COLUMN_TASK_ID, COUNT, "Tasks") .format(COLUMN_TASK_ID, i18n.tasksError(), NO_DECIMALS) .width(METRIC_WIDTH).height(METRIC_HEIGHT) .margins(0, 0, 0, 0) <BUG>.backgroundColor(BG_COLOR) .filterOn(false, true, true)</BUG> .refreshOn() .buildSettings();
.backgroundColor(METRIC_BG) .htmlTemplate(METRIC_HTML) .jsTemplate(METRIC_JS) .filterOn(false, true, true)
47,654
.filter(COLUMN_TASK_STATUS, equalsTo(TASK_STATUS_EXITED)) .column(COLUMN_TASK_ID, COUNT, "Tasks") .format(COLUMN_TASK_ID, i18n.tasksExited(), NO_DECIMALS) .width(METRIC_WIDTH).height(METRIC_HEIGHT) .margins(0, 0, 0, 0) <BUG>.backgroundColor(BG_COLOR) .filterOn(false, true, true)</BUG> .refreshOn() .buildSettings();
.backgroundColor(METRIC_BG) .htmlTemplate(METRIC_HTML) .jsTemplate(METRIC_JS) .filterOn(false, true, true)
47,655
.filter(COLUMN_TASK_STATUS, equalsTo(TASK_STATUS_OBSOLETE)) .column(COLUMN_TASK_ID, COUNT, "Tasks") .format(COLUMN_TASK_ID, i18n.tasksObsolete(), NO_DECIMALS) .width(METRIC_WIDTH).height(METRIC_HEIGHT) .margins(0, 0, 0, 0) <BUG>.backgroundColor(BG_COLOR) .filterOn(false, true, true)</BUG> .refreshOn() .buildSettings();
.backgroundColor(METRIC_BG) .htmlTemplate(METRIC_HTML) .jsTemplate(METRIC_JS) .filterOn(false, true, true)
47,656
package org.glowroot.agent.config; import com.google.common.collect.ImmutableList; <BUG>import org.immutables.value.Value; import org.glowroot.wire.api.model.AgentConfigOuterClass.AgentConfig;</BUG> @Value.Immutable public abstract class UiConfig { @Value.Default
import org.glowroot.common.config.ConfigDefaults; import org.glowroot.wire.api.model.AgentConfigOuterClass.AgentConfig;
47,657
class RepoAdminImpl implements RepoAdmin { private final DataSource dataSource; private final List<CappedDatabase> rollupCappedDatabases; private final CappedDatabase traceCappedDatabase; private final ConfigRepository configRepository; <BUG>private final AgentDao agentDao; </BUG> private final GaugeValueDao gaugeValueDao; private final GaugeNameDao gaugeNameDao; private final TransactionTypeDao transactionTypeDao;
private final EnvironmentDao agentDao;
47,658
private final TransactionTypeDao transactionTypeDao; private final FullQueryTextDao fullQueryTextDao; private final TraceAttributeNameDao traceAttributeNameDao; RepoAdminImpl(DataSource dataSource, List<CappedDatabase> rollupCappedDatabases, CappedDatabase traceCappedDatabase, ConfigRepository configRepository, <BUG>AgentDao agentDao, GaugeValueDao gaugeValueDao, GaugeNameDao gaugeNameDao, </BUG> TransactionTypeDao transactionTypeDao, FullQueryTextDao fullQueryTextDao, TraceAttributeNameDao traceAttributeNameDao) { this.dataSource = dataSource;
EnvironmentDao agentDao, GaugeValueDao gaugeValueDao, GaugeNameDao gaugeNameDao,
47,659
this.fullQueryTextDao = fullQueryTextDao; this.traceAttributeNameDao = traceAttributeNameDao; } @Override public void deleteAllData() throws Exception { <BUG>Environment environment = agentDao.readEnvironment(""); dataSource.deleteAll();</BUG> agentDao.reinitAfterDeletingDatabase(); gaugeValueDao.reinitAfterDeletingDatabase(); gaugeNameDao.invalidateCache();
Environment environment = agentDao.read(""); dataSource.deleteAll();
47,660
public class SimpleRepoModule { private static final long SNAPSHOT_REAPER_PERIOD_MINUTES = 5; private final DataSource dataSource; private final ImmutableList<CappedDatabase> rollupCappedDatabases; private final CappedDatabase traceCappedDatabase; <BUG>private final AgentDao agentDao; private final TransactionTypeDao transactionTypeDao;</BUG> private final AggregateDao aggregateDao; private final TraceAttributeNameDao traceAttributeNameDao; private final TraceDao traceDao;
private final EnvironmentDao environmentDao; private final TransactionTypeDao transactionTypeDao;
47,661
rollupCappedDatabases.add(new CappedDatabase(file, sizeKb, ticker)); } this.rollupCappedDatabases = ImmutableList.copyOf(rollupCappedDatabases); traceCappedDatabase = new CappedDatabase(new File(dataDir, "trace-detail.capped.db"), storageConfig.traceCappedDatabaseSizeMb() * 1024, ticker); <BUG>agentDao = new AgentDao(dataSource); </BUG> transactionTypeDao = new TransactionTypeDao(dataSource); rollupLevelService = new RollupLevelService(configRepository, clock); FullQueryTextDao fullQueryTextDao = new FullQueryTextDao(dataSource);
environmentDao = new EnvironmentDao(dataSource);
47,662
traceDao = new TraceDao(dataSource, traceCappedDatabase, transactionTypeDao, fullQueryTextDao, traceAttributeNameDao); GaugeNameDao gaugeNameDao = new GaugeNameDao(dataSource); gaugeValueDao = new GaugeValueDao(dataSource, gaugeNameDao, clock); repoAdmin = new RepoAdminImpl(dataSource, rollupCappedDatabases, traceCappedDatabase, <BUG>configRepository, agentDao, gaugeValueDao, gaugeNameDao, transactionTypeDao, </BUG> fullQueryTextDao, traceAttributeNameDao); if (backgroundExecutor == null) { reaperRunnable = null;
configRepository, environmentDao, gaugeValueDao, gaugeNameDao, transactionTypeDao,
47,663
new TraceCappedDatabaseStats(traceCappedDatabase), "org.glowroot:type=TraceCappedDatabase"); platformMBeanServerLifecycle.lazyRegisterMBean(new H2DatabaseStats(dataSource), "org.glowroot:type=H2Database"); } <BUG>public AgentDao getAgentDao() { return agentDao; </BUG> } public TransactionTypeRepository getTransactionTypeRepository() {
public EnvironmentDao getEnvironmentDao() { return environmentDao;
47,664
package org.glowroot.agent.embedded.init; import java.io.Closeable; import java.io.File; <BUG>import java.lang.instrument.Instrumentation; import java.util.Map;</BUG> import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService;
import java.util.List; import java.util.Map;
47,665
import java.util.concurrent.ScheduledExecutorService; import javax.annotation.Nullable; import com.google.common.base.MoreObjects; import com.google.common.base.Stopwatch; import com.google.common.base.Supplier; <BUG>import com.google.common.base.Ticker; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;</BUG> import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.glowroot.agent.collector.Collector.AgentConfigUpdater;
import com.google.common.collect.ImmutableList; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
47,666
import org.glowroot.agent.init.EnvironmentCreator; import org.glowroot.agent.init.GlowrootThinAgentInit; import org.glowroot.agent.init.JRebelWorkaround; import org.glowroot.agent.util.LazyPlatformMBeanServer; import org.glowroot.common.live.LiveAggregateRepository.LiveAggregateRepositoryNop; <BUG>import org.glowroot.common.live.LiveTraceRepository.LiveTraceRepositoryNop; import org.glowroot.common.repo.ConfigRepository; import org.glowroot.common.util.Clock;</BUG> import org.glowroot.common.util.OnlyUsedByTests; import org.glowroot.ui.CreateUiModuleBuilder;
import org.glowroot.common.repo.AgentRepository; import org.glowroot.common.repo.ImmutableAgentRollup; import org.glowroot.common.util.Clock;
47,667
SimpleRepoModule simpleRepoModule = new SimpleRepoModule(dataSource, dataDir, clock, ticker, configRepository, backgroundExecutor); simpleRepoModule.registerMBeans(new PlatformMBeanServerLifecycleImpl( agentModule.getLazyPlatformMBeanServer())); CollectorImpl collectorImpl = new CollectorImpl( <BUG>simpleRepoModule.getAgentDao(), simpleRepoModule.getAggregateDao(), simpleRepoModule.getTraceDao(),</BUG> simpleRepoModule.getGaugeValueDao()); collectorProxy.setInstance(collectorImpl); collectorImpl.init(baseDir, EnvironmentCreator.create(glowrootVersion),
simpleRepoModule.getEnvironmentDao(), simpleRepoModule.getTraceDao(),
47,668
.baseDir(baseDir) .glowrootDir(glowrootDir) .ticker(ticker) .clock(clock) .liveJvmService(agentModule.getLiveJvmService()) <BUG>.configRepository(simpleRepoModule.getConfigRepository()) .agentRepository(simpleRepoModule.getAgentDao()) </BUG> .transactionTypeRepository(simpleRepoModule.getTransactionTypeRepository()) .traceAttributeNameRepository(
.agentRepository(new AgentRepositoryImpl()) .environmentRepository(simpleRepoModule.getEnvironmentDao())
47,669
.baseDir(baseDir) .glowrootDir(glowrootDir) .ticker(ticker) .clock(clock) .liveJvmService(null) <BUG>.configRepository(simpleRepoModule.getConfigRepository()) .agentRepository(simpleRepoModule.getAgentDao()) </BUG> .transactionTypeRepository(simpleRepoModule.getTransactionTypeRepository()) .traceAttributeNameRepository(
.liveJvmService(agentModule.getLiveJvmService()) .agentRepository(new AgentRepositoryImpl()) .environmentRepository(simpleRepoModule.getEnvironmentDao())
47,670
} @Override public void lazyRegisterMBean(Object object, String name) { lazyPlatformMBeanServer.lazyRegisterMBean(object, name); } <BUG>} } </BUG>
void initEmbeddedServer() throws Exception { if (simpleRepoModule == null) { return;
47,671
List<GaugeConfig> configs = Lists.newArrayList(configService.getGaugeConfigs()); for (GaugeConfig loopConfig : configs) { if (loopConfig.mbeanObjectName().equals(gaugeConfig.getMbeanObjectName())) { throw new DuplicateMBeanObjectNameException(); } <BUG>} String version = Versions.getVersion(gaugeConfig); for (GaugeConfig loopConfig : configs) { if (Versions.getVersion(loopConfig.toProto()).equals(version)) { throw new IllegalStateException("This exact gauge already exists"); } } configs.add(GaugeConfig.create(gaugeConfig));</BUG> configService.updateGaugeConfigs(configs);
[DELETED]
47,672
configService.updateGaugeConfigs(configs); } } @Override public void updateGaugeConfig(String agentId, AgentConfig.GaugeConfig gaugeConfig, <BUG>String priorVersion) throws Exception { synchronized (writeLock) {</BUG> List<GaugeConfig> configs = Lists.newArrayList(configService.getGaugeConfigs()); boolean found = false; for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) {
GaugeConfig config = GaugeConfig.create(gaugeConfig); synchronized (writeLock) {
47,673
boolean found = false; for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) { GaugeConfig loopConfig = i.next(); String loopVersion = Versions.getVersion(loopConfig.toProto()); if (loopVersion.equals(priorVersion)) { <BUG>i.set(GaugeConfig.create(gaugeConfig)); found = true; break;</BUG> } else if (loopConfig.mbeanObjectName().equals(gaugeConfig.getMbeanObjectName())) { throw new DuplicateMBeanObjectNameException();
i.set(config);
47,674
boolean found = false; for (ListIterator<PluginConfig> i = configs.listIterator(); i.hasNext();) { PluginConfig loopPluginConfig = i.next(); if (pluginId.equals(loopPluginConfig.id())) { String loopVersion = Versions.getVersion(loopPluginConfig.toProto()); <BUG>checkVersionsEqual(loopVersion, priorVersion); PluginDescriptor pluginDescriptor = getPluginDescriptor(pluginId); i.set(PluginConfig.create(pluginDescriptor, properties));</BUG> found = true; break;
for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) { GaugeConfig loopConfig = i.next(); String loopVersion = Versions.getVersion(loopConfig.toProto()); if (loopVersion.equals(version)) { i.remove();
47,675
boolean found = false; for (ListIterator<InstrumentationConfig> i = configs.listIterator(); i.hasNext();) { InstrumentationConfig loopConfig = i.next(); String loopVersion = Versions.getVersion(loopConfig.toProto()); if (loopVersion.equals(priorVersion)) { <BUG>i.set(InstrumentationConfig.create(instrumentationConfig)); found = true; break; }</BUG> }
i.set(config); } else if (loopConfig.equals(config)) { throw new IllegalStateException("This exact instrumentation already exists");
47,676
package org.glowroot.agent.embedded.init; import java.io.File; import java.util.List; import org.glowroot.agent.collector.Collector; <BUG>import org.glowroot.agent.embedded.repo.AgentDao; import org.glowroot.agent.embedded.repo.AggregateDao; import org.glowroot.agent.embedded.repo.GaugeValueDao;</BUG> import org.glowroot.agent.embedded.repo.TraceDao; import org.glowroot.wire.api.model.AgentConfigOuterClass.AgentConfig;
import org.glowroot.agent.embedded.repo.EnvironmentDao; import org.glowroot.agent.embedded.repo.GaugeValueDao;
47,677
</BUG> private final AggregateDao aggregateDao; private final TraceDao traceDao; private final GaugeValueDao gaugeValueDao; <BUG>CollectorImpl(AgentDao agentDao, AggregateDao aggregateRepository, TraceDao traceRepository, GaugeValueDao gaugeValueRepository) { this.agentDao = agentDao;</BUG> this.aggregateDao = aggregateRepository; this.traceDao = traceRepository;
import org.glowroot.wire.api.model.CollectorServiceOuterClass.Environment; import org.glowroot.wire.api.model.CollectorServiceOuterClass.GaugeValue; import org.glowroot.wire.api.model.CollectorServiceOuterClass.LogEvent; import org.glowroot.wire.api.model.TraceOuterClass.Trace; class CollectorImpl implements Collector { private final EnvironmentDao agentDao; CollectorImpl(EnvironmentDao agentDao, AggregateDao aggregateRepository, TraceDao traceRepository, GaugeValueDao gaugeValueRepository) { this.agentDao = agentDao;
47,678
variant = new CompletionVariant(PsiAnnotationMethod.class, position); variant.addCompletion(PsiKeyword.DEFAULT); registerVariant(variant); } { <BUG>final CompletionVariant variant = new CompletionVariant(new OrFilter(END_OF_BLOCK, new LeftNeighbour(new TextFilter(PsiKeyword.FINAL)))); variant.includeScopeClass(PsiCodeBlock.class, false); addPrimitiveTypes(variant, CompletionVariant.DEFAULT_TAIL_TYPE); variant.addCompletion(PsiKeyword.CLASS); registerVariant(variant); } {</BUG> final ElementFilter position = INSTANCEOF_PLACE;
[DELETED]
47,679
final ElementFilter position = INSTANCEOF_PLACE; final CompletionVariant variant = new CompletionVariant(position); variant.includeScopeClass(PsiExpression.class, true); variant.includeScopeClass(PsiMethod.class); variant.addCompletion(PsiKeyword.INSTANCEOF); <BUG>registerVariant(variant); } { final CompletionVariant variant = new CompletionVariant(PsiMethod.class, END_OF_BLOCK); addKeywords(variant);</BUG> registerVariant(variant);
[DELETED]
47,680
)); final CompletionVariant variant = new CompletionVariant(PsiMethod.class, position); variant.addCompletion(PsiKeyword.ELSE); registerVariant(variant); } <BUG>{ final CompletionVariant variant = new CompletionVariant(INSIDE_SWITCH); variant.includeScopeClass(PsiElement.class, true); variant.addCompletion(PsiKeyword.CASE, TailType.SPACE); variant.addCompletion(PsiKeyword.DEFAULT, TailType.CASE_COLON); registerVariant(variant); }</BUG> }
[DELETED]
47,681
@Override public void handleInsert(InsertionContext context, LookupElement item) { if (context.shouldAddCompletionChar()) { return; } <BUG>TailType type = analyzeItem(item.getObject(), context.getFile().findElementAt(context.getStartOffset())); if (type == TailType.NONE) { type = tailType; } if (type != TailType.NONE) { type.processTail(context.getEditor(), context.getTailOffset()); </BUG> }
[DELETED]
47,682
}); myMap.put(new ClassFilter(PsiJavaFile.class), new String[][]{ new String[]{"public"}, new String[]{"final", "abstract"} }); <BUG>myMap.put(new OrFilter(new ClassFilter(PsiStatement.class), new ClassFilter(PsiCodeBlock.class)), new String[][]{ new String[]{"final"} });</BUG> myMap.put(new ClassFilter(PsiParameterList.class), new String[][]{ new String[]{"final"}
myMap.put(new InterfaceFilter(), new String[][]{ new String[]{"public", "protected"}, new String[]{"static"},
47,683
final List<String> ret = new ArrayList<String>(); try{ </BUG> PsiElement scope; <BUG>if(position == null) scope = context.file; else scope = position.getParent(); final PsiModifierList list = getModifierList(position);</BUG> scopes:
try { if (position == null) { } else { } final PsiModifierList list = getModifierList(position);
47,684
scope = scope.getContext(); } if (scope instanceof PsiDirectory) break; } } <BUG>catch(Exception e){} return ArrayUtil.toStringArray(ret);</BUG> } private static PsiModifierList getModifierList(PsiElement element)
catch (Exception e) { return ArrayUtil.toStringArray(ret);
47,685
} if (json.getValue("heartbeat") instanceof JsonObject) { obj.setHeartbeat(((JsonObject)json.getValue("heartbeat")).copy()); } if (json.getValue("maxBodyLength") instanceof Number) { <BUG>obj.setMaxBodyLength(((Number)json.getValue("maxBodyLength")).intValue()); }</BUG> if (json.getValue("maxHeaderLength") instanceof Number) { obj.setMaxHeaderLength(((Number)json.getValue("maxHeaderLength")).intValue()); }
if (json.getValue("maxFrameInTransaction") instanceof Number) { obj.setMaxFrameInTransaction(((Number)json.getValue("maxFrameInTransaction")).intValue());
47,686
public static void toJson(StompServerOptions obj, JsonObject json) { json.put("ackTimeout", obj.getAckTimeout()); if (obj.getHeartbeat() != null) { json.put("heartbeat", obj.getHeartbeat()); } <BUG>json.put("maxBodyLength", obj.getMaxBodyLength()); json.put("maxHeaderLength", obj.getMaxHeaderLength());</BUG> json.put("maxHeaders", obj.getMaxHeaders()); json.put("secured", obj.isSecured()); json.put("sendErrorOnNoSubscriptions", obj.isSendErrorOnNoSubscriptions());
json.put("maxFrameInTransaction", obj.getMaxFrameInTransaction()); json.put("maxHeaderLength", obj.getMaxHeaderLength());
47,687
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$
47,688
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$
47,689
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$
47,690
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$
47,691
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 {
47,692
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$
47,693
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$
47,694
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$
47,695
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$
47,696
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$
47,697
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$
47,698
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$
47,699
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$
47,700
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$