Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Resolve warnings in DotNetNuke.Syndication #5525

Merged
merged 1 commit into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion DNN Platform/Library/Services/Syndication/RssHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace DotNetNuke.Services.Syndication
using DotNetNuke.Services.Search.Entities;
using DotNetNuke.Services.Search.Internals;

/// <summary>An HTTP handler for serving an RSS feed.</summary>
public class RssHandler : SyndicationHandlerBase
{
/// <inheritdoc />
Expand Down Expand Up @@ -99,7 +100,7 @@ protected override void OnPreRender(EventArgs ea)
}

/// <summary>Creates an RSS Item.</summary>
/// <param name="searchResult"></param>
/// <param name="searchResult">The search result to convert to an RSS item.</param>
/// <returns>A new <see cref="GenericRssElement"/> instance.</returns>
private GenericRssElement GetRssItem(SearchResult searchResult)
{
Expand Down
113 changes: 53 additions & 60 deletions DNN Platform/Library/Services/Syndication/SyndicationHandlerBase.cs
Original file line number Diff line number Diff line change
@@ -1,66 +1,59 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
namespace DotNetNuke.Services.Syndication
{
using System.Web;
namespace DotNetNuke.Services.Syndication
{
using System.Web;

using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Portals;

public class SyndicationHandlerBase : GenericRssHttpHandlerBase
{
private int moduleId = Null.NullInteger;

private int tabId = Null.NullInteger;

public PortalSettings Settings
{
get
{
return Globals.GetPortalSettings();
}
}

public int TabId
{
get
{
if (this.tabId == Null.NullInteger && this.Request.QueryString["tabid"] != null)
{
if (!int.TryParse(this.Request.QueryString["tabid"], out this.tabId))
{
this.tabId = Null.NullInteger;
}
}

return this.tabId;
}
}

public int ModuleId
{
get
{
if (this.moduleId == Null.NullInteger && this.Request.QueryString["moduleid"] != null)
{
if (!int.TryParse(this.Request.QueryString["moduleid"], out this.moduleId))
{
this.moduleId = Null.NullInteger;
}
}

return this.moduleId;
}
}

public HttpRequest Request
{
get
{
return HttpContext.Current.Request;
}
}
}
}
/// <summary>An HTTP handler for generating an RSS feed.</summary>
public class SyndicationHandlerBase : GenericRssHttpHandlerBase
{
private int moduleId = Null.NullInteger;

private int tabId = Null.NullInteger;

/// <summary>Gets the portal settings.</summary>
public PortalSettings Settings => Globals.GetPortalSettings();

/// <summary>Gets the tab ID of the request.</summary>
public int TabId
{
get
{
if (this.tabId == Null.NullInteger && this.Request.QueryString["tabid"] != null)
{
if (!int.TryParse(this.Request.QueryString["tabid"], out this.tabId))
{
this.tabId = Null.NullInteger;
}
}

return this.tabId;
}
}

/// <summary>Gets the module ID of the request.</summary>
public int ModuleId
{
get
{
if (this.moduleId == Null.NullInteger && this.Request.QueryString["moduleid"] != null)
{
if (!int.TryParse(this.Request.QueryString["moduleid"], out this.moduleId))
{
this.moduleId = Null.NullInteger;
}
}

return this.moduleId;
}
}

/// <summary>Gets the HTTP request.</summary>
public HttpRequest Request => HttpContext.Current.Request;
}
}
2 changes: 2 additions & 0 deletions DNN Platform/Syndication/DotNetNuke.Syndication.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<DocumentationFile>bin\DotNetNuke.Services.Syndication.xml</DocumentationFile>
<NoWarn>1591</NoWarn>
<LangVersion>7</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -55,6 +56,7 @@
<DocumentationFile>bin\DotNetNuke.Services.Syndication.xml</DocumentationFile>
<Optimize>true</Optimize>
<LangVersion>7</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="DotNetNuke.Instrumentation">
Expand Down
Loading