The code is:
Throwable z = e.getTargetException();
if (z instanceof Error)
throw (Error)z;
else
throw (ManifoldCFException)z;
The problem cannot be that z is null, because "z instanceof Error"
does not blow up. Indeed:
"java.lang.NullPointerException cannot be cast to
org.apache.manifoldcf.core.interfaces.ManifoldCFException" is the
message. The code is not resilient against RuntimeError exceptions is
one problem.
The problem with your connector code is therefore a NPE being thrown.
I'll check in changes here and it should be possible for you to tell
what is happening.
Karl
On Wed, Jun 8, 2011 at 2:55 PM, Farzad Valad <[email protected]> wrote:
> Looking at the OutputConnectorFactory code, it seems there are two problems.
> The exception handling has a bug assuming a null value won't be passed.
> Line 149 says "throw (ManifoldCFException) z;" where z is null. The main
> problem is why registering my connector is now producing an
> InvocationTargetException? and it wasn't a problem before?
>
> public DupFinderConnector() throws ManifoldCFException {
> Logging.connectors.log(Level.ALL, "DupFinder Version 1.0.0");
>
> calendar = Calendar.getInstance();
> hashGen = new HashsumGenerator();
> }
>
>
> On 6/8/2011 12:00 PM, Farzad Valad wrote:
>>
>> Any idea why I would get this failure on registering my connector. Hadn't
>> seen it before. I was trying to setup a new system and was issuing commands
>> to setup the database. Note I was able to register Null Output and File
>> System connectors without error.
>>
>> D:\Program
>> Files\Apache\ManifoldCF\myMCF>processes\script\executecommand.bat
>> org.apache.manifoldcf.agents.RegisterOutput org.apache.manifoldcf.agents.
>> output.dupfinder.DupFinderConnector DupFinder
>> Configuration file successfully read
>> Exception in thread "main" java.lang.ClassCastException:
>> java.lang.NullPointerException cannot be cast to
>> org.apache.manifoldcf.core.interfaces.ManifoldCFException
>> at
>> org.apache.manifoldcf.agents.interfaces.OutputConnectorFactory.getConnectorNoCheck(OutputConnectorFactory.java:149)
>> at
>> org.apache.manifoldcf.agents.interfaces.OutputConnectorFactory.install(OutputConnectorFactory.java:50)
>> at
>> org.apache.manifoldcf.agents.outputconnmgr.OutputConnectorManager.registerConnector(OutputConnectorManager.java:180)
>> at
>> org.apache.manifoldcf.agents.RegisterOutput.doExecute(RegisterOutput.java:47)
>> at
>> org.apache.manifoldcf.agents.TransactionalAgentsInitializationCommand.execute(TransactionalAgentsInitializationCommand.java:43)
>> at
>> org.apache.manifoldcf.agents.RegisterOutput.main(RegisterOutput.java:70)
>>
>> D:\Program
>> Files\Apache\ManifoldCF\myMCF>processes\script\executecommand.bat
>> org.apache.manifoldcf.agents.RegisterOutput
>> org.apache.manifoldcf.agents.output.nullconnector.NullConnector NullOutput
>> Configuration file successfully read
>> Successfully registered output connector
>> 'org.apache.manifoldcf.agents.output.nullconnector.NullConnector'
>>
>> D:\Program
>> Files\Apache\ManifoldCF\myMCF>processes\script\executecommand.bat
>> org.apache.manifoldcf.crawler.Register
>> org.apache.manifoldcf.crawler.connectors.filesystem.FileConnector FileSystem
>> Configuration file successfully read
>> Successfully registered connector
>> 'org.apache.manifoldcf.crawler.connectors.filesystem.FileConnector'
>>
>> D:\Program Files\Apache\ManifoldCF\myMCF>
>
>