Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24599/Support
Modified Files:
AbstractAutowireCapableObjectFactory.cs
AbstractObjectFactory.cs StaticListableObjectFactory.cs
Log Message:
Update use of 'ObjectCreationException's for better message exceptions.
Index: StaticListableObjectFactory.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/StaticListableObjectFactory.cs,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** StaticListableObjectFactory.cs 30 Jul 2007 18:00:01 -0000 1.23
--- StaticListableObjectFactory.cs 5 Dec 2007 00:28:05 -0000 1.24
***************
*** 106,110 ****
catch (Exception ex)
{
! throw new ObjectCreationException(
"IFactoryObject threw an exception on object creation", ex);
}
--- 106,110 ----
catch (Exception ex)
{
! throw new ObjectCreationException(name,
"IFactoryObject threw an exception on object creation", ex);
}
Index: AbstractAutowireCapableObjectFactory.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractAutowireCapableObjectFactory.cs,v
retrieving revision 1.82
retrieving revision 1.83
diff -C2 -d -r1.82 -r1.83
*** AbstractAutowireCapableObjectFactory.cs 7 Sep 2007 01:52:24 -0000 1.82
--- AbstractAutowireCapableObjectFactory.cs 5 Dec 2007 00:28:04 -0000 1.83
***************
*** 463,467 ****
if (properties.PropertyValues.Length > 0)
{
! throw new ObjectCreationException(name, "Cannot apply property values to null instance");
}
else
--- 463,468 ----
if (properties.PropertyValues.Length > 0)
{
! throw new ObjectCreationException(definition.ResourceDescription,
! name, "Cannot apply property values to null instance.");
}
else
***************
*** 2233,2240 ****
if (result == null)
{
! throw new ObjectCreationException(
string.Format(CultureInfo.InvariantCulture,
"PostProcessBeforeInitialization method of IObjectPostProcessor [{0}] "
! + " returned null for object [{1}] with name [{2}].", objectProcessor, result, name));
}
}
--- 2234,2241 ----
if (result == null)
{
! throw new ObjectCreationException(name,
string.Format(CultureInfo.InvariantCulture,
"PostProcessBeforeInitialization method of IObjectPostProcessor [{0}] "
! + " returned null for object [{1}] with name '{2}'.", objectProcessor, instance, name));
}
}
***************
*** 2278,2285 ****
if (result == null)
{
! throw new ObjectCreationException(
string.Format(CultureInfo.InvariantCulture,
"PostProcessAfterInitialization method of IObjectPostProcessor [{0}] "
! + " returned null for object [{1}] with name [{2}].", objectProcessor, result, name));
}
}
--- 2279,2286 ----
if (result == null)
{
! throw new ObjectCreationException(name,
string.Format(CultureInfo.InvariantCulture,
"PostProcessAfterInitialization method of IObjectPostProcessor [{0}] "
! + " returned null for object [{1}] with name [{2}].", objectProcessor, instance, name));
}
}
Index: AbstractObjectFactory.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs,v
retrieving revision 1.72
retrieving revision 1.73
diff -C2 -d -r1.72 -r1.73
*** AbstractObjectFactory.cs 10 Oct 2007 19:17:07 -0000 1.72
--- AbstractObjectFactory.cs 5 Dec 2007 00:28:04 -0000 1.73
***************
*** 820,829 ****
instance = factory.GetObject();
}
! catch (FactoryObjectNotInitializedException ex) {
! throw new ObjectCurrentlyInCreationException("Object Name = " + objectName + ", " + ex, ex);
}
catch (Exception ex)
{
! throw new ObjectCreationException("IFactoryObject threw exception on object creation for object with name = " + objectName, ex);
}
--- 820,832 ----
instance = factory.GetObject();
}
! catch (FactoryObjectNotInitializedException ex)
! {
! throw new ObjectCurrentlyInCreationException(
! rod.ResourceDescription, objectName, ex);
}
catch (Exception ex)
{
! throw new ObjectCreationException(rod.ResourceDescription, objectName,
! "FactoryObject threw exception on object creation.", ex);
}
***************
*** 831,835 ****
// initialized yet: Many FactoryBeans just return null then.
if (instance == null && IsSingletonCurrentlyInCreation(objectName)) {
! throw new ObjectCurrentlyInCreationException(objectName, "FactoryObject which is currently in creation returned null from GetObject");
}
--- 834,839 ----
// initialized yet: Many FactoryBeans just return null then.
if (instance == null && IsSingletonCurrentlyInCreation(objectName)) {
! throw new ObjectCurrentlyInCreationException(rod.ResourceDescription, objectName,
! "FactoryObject which is currently in creation returned null from GetObject.");
}
***************
*** 841,845 ****
catch (Exception ex) {
throw new ObjectCreationException(rod.ResourceDescription, objectName,
! "Post-processing of the FactoryObject's object failed", ex);
}
}
--- 845,849 ----
catch (Exception ex) {
throw new ObjectCreationException(rod.ResourceDescription, objectName,
! "Post-processing of the FactoryObject's object failed.", ex);
}
}
|