Index: /branches/HiveStatistics/sources/HeuristicLab.Services.Hive.JanitorService/3.3/app.config
===================================================================
--- /branches/HiveStatistics/sources/HeuristicLab.Services.Hive.JanitorService/3.3/app.config	(revision 11222)
+++ /branches/HiveStatistics/sources/HeuristicLab.Services.Hive.JanitorService/3.3/app.config	(revision 11223)
@@ -1,3 +1,27 @@
 <?xml version="1.0"?>
 <configuration>
-<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
+  <connectionStrings>
+    <add name="HeuristicLab.Authentication" connectionString="data source=localhost;Integrated Security=SSPI;Initial Catalog=HeuristicLab.Authentication"/>
+    <add name="HeuristicLab.Services.Hive.DataAccess.Settings.HeuristicLab_Hive_LinqConnectionString"
+       connectionString="Data Source=localhost;Initial Catalog=HeuristicLab.Hive-3.3;Integrated Security=True;"
+       providerName="System.Data.SqlClient" />
+  </connectionStrings>
+  <system.web>
+    <authentication mode="Forms" />
+    <membership defaultProvider="AspNetSqlMembershipProvider">
+      <providers>
+        <clear />
+        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="HeuristicLab.Authentication" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="HeuristicLab.Authentication" />
+        <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
+      </providers>
+    </membership>
+    <roleManager enabled="true" defaultProvider="AspNetSqlRoleProvider">
+      <providers>
+        <clear />
+        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="HeuristicLab.Authentication" applicationName="HeuristicLab.Authentication" />
+        <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
+      </providers>
+    </roleManager>
+  </system.web>
+</configuration>
Index: /branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/HiveStatisticsGenerator.cs
===================================================================
--- /branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/HiveStatisticsGenerator.cs	(revision 11222)
+++ /branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/HiveStatisticsGenerator.cs	(revision 11223)
@@ -12,4 +12,5 @@
 
     private static readonly TimeSpan SmallestTimeSpan = new TimeSpan(0, 5, 0);
+    private static readonly string UnknownUserName = "Unknown";
 
     public void GenerateStatistics() {
@@ -75,10 +76,11 @@
         select u;
 
+
       var newDimUsers =
-        from u in newUsers.ToList()
-        select new DimUser {
-          UserId = u,
-          Name = userManager.GetUserById(u).UserName
-        };
+     from u in newUsers.ToList()
+     select new DimUser {
+       UserId = u,
+       Name = userManager.GetUserById(u) != null ? userManager.GetUserById(u).UserName : UnknownUserName
+     };
 
       db.DimUsers.InsertAllOnSubmit(newDimUsers);
@@ -100,7 +102,7 @@
         select new DimJob {
           JobId = j.JobId,
-          JobName = j.Name,
+          JobName = j.Name == null ? string.Empty : j.Name,
           UserId = j.OwnerUserId,
-          UserName = userManager.GetUserById(j.OwnerUserId).UserName
+          UserName = userManager.GetUserById(j.OwnerUserId) != null ? userManager.GetUserById(j.OwnerUserId).UserName : UnknownUserName
         };
 
@@ -255,5 +257,5 @@
           TotalTransferTime = stateLogsLinkedList.SumTotalTimeWhere(stateLog => stateLog.Value.State == TaskState.Transferring),
           TaskState = t.Task.State,
-          Exception = stateLogsLinkedList.First(sl => sl.Exception != null).Exception
+          Exception = stateLogsLinkedList.FirstOrDefault(sl => sl.Exception != null) == null ? string.Empty : stateLogsLinkedList.FirstOrDefault(sl => sl.Exception != null).Exception
         };
 
