PILLUTLAAVINASH / google-enterprise-connector-manager

Automatically exported from code.google.com/p/google-enterprise-connector-manager
0 stars 0 forks source link

InstanceMap.createNewConnector() should delete partial connector directory if instantiation fails #133

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a new connector with invalid configuration parameters.
2. InstanceMap.createNewConnector() will create a new connector directory
and extract the connectorInstance.xml.
3. validateConfig() will fail and the connector instance will not be fully
created, so no properties file or schedule file will exist.
4. Restart Tomcat.
5. InstanceMap.processTypeDirectory() sees the partially constructed
connector, but throws a property placeholder beans exception trying to
instantiate the connector.

What is the expected output? What do you see instead?

InstanceMap.createNewConnector() should delete the directory if the
instantiation fails.  This will require refactoring
InstanceMap.removeConnector() to extract the directory removal code.  As it
stands, if the customer modified the connectorInstance.xml file during the
failed configuration, the file will not be removed.  But that is probably a
good thing.

We could also detect that no properties file exists and stop instantiation
there, but there might be connector types that do not require a properties
file.  In those instances, I think we would create one anyway with
googleWorkDir, googleConnectorWorkDir, and googleConnectorName properties
in it.

Original issue reported on code.google.com by Brett.Mi...@gmail.com on 30 Mar 2009 at 11:16

GoogleCodeExporter commented 8 years ago

Original comment by jl1615@gmail.com on 10 Apr 2009 at 8:22

GoogleCodeExporter commented 8 years ago
Fixed in Connector Manager trunk revision r1683 on 10 April 2009:

This set of changes addresses Connector Manager Issue 133 -
InstanceMap.createNewConnector() should delete partial connector
directory if instantiation fails.

InstanceMap.createNewConnector() now deletes the directory it
created if the instantiation fails.  This required refactoring
InstanceMap.removeConnector() to extract the directory removal code.

As it stands, if the customer modified the connectorInstance.xml
file during the failed configuration, the file will not be removed.
But that is probably a good thing.

We also detect that no properties file exists and stop instantiation there,
throwing an InstanceInfoException("Connector configuration not found...").
This is much more informative that the Spring PropertyPlacholderException
that was thrown previously.

Finally, if on startup, a connector does not have a schedule and
none was found in a legacy store, I create a disabled schedule and
log a warning.  This is better than spamming the log file with
"Connector Schedule not found" messages once a second.

Original comment by Brett.Mi...@gmail.com on 16 Apr 2009 at 10:15

GoogleCodeExporter commented 8 years ago

Original comment by Brett.Mi...@gmail.com on 16 May 2009 at 9:10