Skip to content

Commit

Permalink
Remove WorkflowJobSourceAdapter reference (PowerShell#10326)
Browse files Browse the repository at this point in the history
  • Loading branch information
KirkMunro authored and iSazonov committed Sep 17, 2019
1 parent 6bf5c76 commit ee8e4e0
Showing 1 changed file with 34 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,51 +81,43 @@ internal void RegisterJobSourceAdapter(Type jobSourceAdapterType)
Dbg.Assert(jobSourceAdapterType != null, "JobSourceAdapterType should never be called with null value.");
object instance = null;

if (jobSourceAdapterType.FullName != null && jobSourceAdapterType.FullName.EndsWith("WorkflowJobSourceAdapter", StringComparison.OrdinalIgnoreCase))
ConstructorInfo constructor = jobSourceAdapterType.GetConstructor(Type.EmptyTypes);
if (!constructor.IsPublic)
{
MethodInfo method = jobSourceAdapterType.GetMethod("GetInstance");
instance = method.Invoke(null, null);
string message = string.Format(CultureInfo.CurrentCulture,
RemotingErrorIdStrings.JobManagerRegistrationConstructorError,
jobSourceAdapterType.FullName);
throw new InvalidOperationException(message);
}
else
{
ConstructorInfo constructor = jobSourceAdapterType.GetConstructor(Type.EmptyTypes);
if (!constructor.IsPublic)
{
string message = string.Format(CultureInfo.CurrentCulture,
RemotingErrorIdStrings.JobManagerRegistrationConstructorError,
jobSourceAdapterType.FullName);
throw new InvalidOperationException(message);
}

try
{
instance = constructor.Invoke(null);
}
catch (MemberAccessException exception)
{
_tracer.TraceException(exception);
throw;
}
catch (TargetInvocationException exception)
{
_tracer.TraceException(exception);
throw;
}
catch (TargetParameterCountException exception)
{
_tracer.TraceException(exception);
throw;
}
catch (NotSupportedException exception)
{
_tracer.TraceException(exception);
throw;
}
catch (SecurityException exception)
{
_tracer.TraceException(exception);
throw;
}
try
{
instance = constructor.Invoke(null);
}
catch (MemberAccessException exception)
{
_tracer.TraceException(exception);
throw;
}
catch (TargetInvocationException exception)
{
_tracer.TraceException(exception);
throw;
}
catch (TargetParameterCountException exception)
{
_tracer.TraceException(exception);
throw;
}
catch (NotSupportedException exception)
{
_tracer.TraceException(exception);
throw;
}
catch (SecurityException exception)
{
_tracer.TraceException(exception);
throw;
}

if (instance != null)
Expand Down

0 comments on commit ee8e4e0

Please sign in to comment.