Skip to content

Commit

Permalink
Fix some nullable warnings in DFS library.
Browse files Browse the repository at this point in the history
  • Loading branch information
SvenGroot committed Oct 26, 2023
1 parent ec5316f commit 600d422
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/NameServer/NameServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<CodeAnalysisRuleSet>../Jumbo.ruleset</CodeAnalysisRuleSet>
<Nullable>enable</Nullable>
<Nullable>annotations</Nullable>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Ookii.Jumbo.Dfs/DfsInputStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ public DfsInputStream(INameServerClientProtocol nameServer, string path)

_nameServer = nameServer;
_log.DebugFormat("Opening file {0} from the DFS.", path);
_file = nameServer.GetFileInfo(path);
// GetFileInfo doesn't throw if the file doesn't exist; we do.
if (_file == null)
_file = nameServer.GetFileInfo(path) ??
throw new FileNotFoundException(string.Format(System.Globalization.CultureInfo.CurrentCulture, "The file '{0}' does not exist on the distributed file system.", path));

BlockSize = (int)_file.BlockSize;
_endOffset = _file.Size;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Ookii.Jumbo.Dfs/FileSystem/DfsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public override void CreateDirectory(string path)
/// <returns>
/// A <see cref="JumboDirectory"/> object representing the directory, or <see langword="null"/> if the directory doesn't exist.
/// </returns>
public override JumboDirectory GetDirectoryInfo(string path)
public override JumboDirectory? GetDirectoryInfo(string path)
{
return _nameServer.GetDirectoryInfo(path);
}
Expand All @@ -183,7 +183,7 @@ public override JumboDirectory GetDirectoryInfo(string path)
/// <returns>
/// A <see cref="JumboFile"/> object referring to the file, or <see langword="null"/> if the file doesn't exist.
/// </returns>
public override JumboFile GetFileInfo(string path)
public override JumboFile? GetFileInfo(string path)
{
return _nameServer.GetFileInfo(path);
}
Expand All @@ -195,7 +195,7 @@ public override JumboFile GetFileInfo(string path)
/// <returns>
/// A <see cref="JumboFileSystemEntry"/> object referring to the file or directory, or <see langword="null"/> if the entry doesn't exist.
/// </returns>
public override JumboFileSystemEntry GetFileSystemEntryInfo(string path)
public override JumboFileSystemEntry? GetFileSystemEntryInfo(string path)
{
return _nameServer.GetFileSystemEntryInfo(path);
}
Expand Down

0 comments on commit 600d422

Please sign in to comment.