Broads
  •  Broads
  • 51.8% (Neutral)
  • YAF Forumling Topic Starter
2008-12-16T02:42:32Z
After some investigation into why badwords were causing errors to appear in the Application Event Log under a release build it would appear that there are several issues.

Basically Anything that gets put into badwords that is null or empty will cause an error.


So topics with no titles, messages with no message, etc.. all cause writes to the application log.

Rather than put a generic wrapper around the code eg.

if (!string.isnullorempty( blah )
{
BadWords.
}


I thought I would leave the code in as this could be an indicator of problems further up the line.
Instead I and my Colleague Raptophile have traced back to the causes.

Some of the errors are down to topics that have been moved as mentioned in a previous post.

Whilst another issue I have come across is the use of the following code in the YAF.Controls.TopicLine


            RenderAnchorBegin(writer, YafBuildLink.GetLink(ForumPages.posts, linkParams, _row["LinkTopicID"]), "post_link", General.BadWordReplace(General.Truncate(firstMessage, 255)));


You will notice that there is a call to General.Truncate. This when passed an empty title will return a null.
In its current State Truncate is called before the BadWordReplace so BadWord is passed a NULL and so Events written to the log. To fix this I have modified the code as follows.


            RenderAnchorBegin(writer, YafBuildLink.GetLink(ForumPages.posts, linkParams, _row["LinkTopicID"]), "post_link", General.Truncate(General.BadWordReplace(firstMessage), 255));


Since the rendering of the title handles nulls this fixes this little bug.

Hope this helps.


Regards

Mark
Sponsor
Mek
  •  Mek
  • 100% (Exalted)
  • YAF Developer
2008-12-16T03:10:01Z
Many thanks.

Fixed and comitted to SVN: 27/12/2008.



UserPostedImage 

"It's a case of RTFM.. the only problem being we don't have a manual!"

When I post FP:Mek in a topic, I'm leaving my footprint there so I can track it once I get into coding/supporting. (Yes I stole this off Ederon 🙂 )
Users browsing this topic

    About Us

    The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

    Powered by Resharper Donate with PayPal button

    Project Twitter Updates

    Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved