palaniyappanBala / ospy

Automatically exported from code.google.com/p/ospy
0 stars 0 forks source link

Unhandled CriteriaException when adding a new softrule with the same name. #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. On main form goto Options -> Softwall rules ...
2. Add a new softwall rule (there must exist atleast one previously 
created softrule for this bug to be generated.)
3. Give the new sofrule a repetitive name

What is the expected output? What do you see instead?
The expected output would be a message box complaining about repitetive 
rule name, the program crashes instead.

Suggestion:
private void rulesListView_AfterLabelEdit(object sender, 
LabelEditEventArgs e)
        {
            if (e.Label == null || e.Label == "")
            {
                cancelAddRule(e);
                return;
            }

            DataTable tbl = softwallDataSet.Tables[0];

            if (addingRow)
            {
                DataRow newRow = tbl.NewRow();
                newRow["Name"] = e.Label;
                newRow["ReturnValue"] = DEFAULT_RETURN_VALUE;
                newRow["LastError"] = DEFAULT_LAST_ERROR;
                try
                {
                    tbl.Rows.Add(newRow);
                }
                catch (ConstraintException e1)
                {
                    MessageBox.Show(e1.Message);
                    cancelAddRule(e);
                    return;
                }

                ruleListView.SelectedIndices.Clear();
                ruleListView.SelectedIndices.Add(e.Item);
            }
            else
            {
                DataRow row = tbl.Rows[e.Item];
                row["Name"] = e.Label;
            }

            addingRow = false;

        }

        private void cancelAddRule(LabelEditEventArgs e)
        {
            e.CancelEdit = true;

            if (addingRow)
            {
                ruleListView.Items.RemoveAt(e.Item);
                ResetUI();
                addingRow = false;
            }
        }

Original issue reported on code.google.com by firouzab...@gmail.com on 4 Jan 2007 at 6:16

GoogleCodeExporter commented 9 years ago
I meant ConstraintException :D

Original comment by firouzab...@gmail.com on 4 Jan 2007 at 6:57

GoogleCodeExporter commented 9 years ago
Thanks for the report and suggested fix. Unfortunately oSpy1 is unmaintained 
these
days, and I'm trying to spend the little time I've got on oSpy2. Feel free to 
join in
on development, I'm
mostly alone in development these days so I tend to prioritize features that I 
need
the most myself (as my time is very limited). :-)

Original comment by ole...@gmail.com on 4 Aug 2007 at 12:02

GoogleCodeExporter commented 9 years ago
Sorry, I take all of that back. :) I realized I won't have enough time to 
finish the 
rewrite, so instead I'll keep improving oSpy 1.x and gradually rewrite piece by 
piece 
as I go along.

About to release 1.10.0 with lots of changes, including a fix based on the one 
you 
suggested -- thanks a lot for that!

Pleaseile new bugs if you find any new issues with 1.10.0 -- it should 
hopefully suck 
a lot less than the previous releases. :)

Original comment by ole...@gmail.com on 20 Aug 2009 at 12:03