List Info

Thread: Re: Problems with installing and uninstalling Extensions




Re: Problems with installing and uninstalling Extensions
user name
2007-10-19 02:08:59
Tobias Krais wrote:
> Hi together,
> 
> I have a strange problem here. I created a java program
installing my OO
> extension. After testing it many times (removing and
adding the
> extension again and again, maybe 50 times), the
extension (written in
> Java, too) does not work anymore! As if the the API I
use and also
> unopkg would quit working!
> 
> Then one (just one time) I got this error when adding
my extension again:
> ----%<-----
> Exception in thread "main"
com.sun.star.lang.DisposedException:
> java.io.EOFException
> 	at
>
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge$
MessageDispatcher.run(java_remote_bridge.java:176)
> ----%<-----
> 
> Can anybody tell me what went wrong? Has someone made
similar experiences?

well, that can have different reasons. It works normally
quite well and 
more interesting would be what are you doing in detail.

When did you get this error, when you install the extensions
or when you 
remove it.

When you get error when you remove the extensions i would be
interested 
what exactly are you doing in your extension. It's quite
easy to crash 
the office or doing some strange things in extensions.

Juergen


> 
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
> For additional commands, e-mail: dev-helpapi.openoffice.org
> 

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: Problems with installing and uninstalling Extensions
user name
2007-10-19 06:25:09
Hi Juergen,

> well, that can have different reasons. It works
normally quite well and
> more interesting would be what are you doing in
detail.

I tested many many times and I try to find out what is
wrong, to be able
to reproduce my failure. The last thing I found out is:
1. If I install my Extension (named JudasComponent.oxt), the
extension
does NOT work.
2. Renaming the extension (e.g. JudasComponent01.oxt) and
installing it
will install it and my extension works well!
3. The problem does not depend on my user profile.
4. I experienced the problem only on Ubuntu (amd64) Feisty
(OOo 2.2.0)
and Gutsy (OOo 2.3). Up to now, I was not able to reproduce
the failure
on Windows and I want to test on Debian Etch systems next
week.
5. The first 5 or six times worked also well on my Ubuntu
system.
6. The problem first occured when doing the following steps
via Java
API: - detecting the version number of the installed
extension. Then
removing the extension. At least installing a newer version
of the
extension.

-> Is my OpenOffice registry broken?

> When did you get this error, when you install the
extensions or when you
> remove it.

I got the one specific error on installing my extension.
Normally, there
is no error messages.

> When you get error when you remove the extensions i
would be interested
> what exactly are you doing in your extension. It's
quite easy to crash
> the office or doing some strange things in extensions.

My extension contains two protocol handler.
1. The first one dispatches the save dialog.
2. The second reads my file and prints the current document
on a printer
and a printer tray I specified on the file.

Here is the code I use for adding the package:
-----%<-----
public class UNOPackageManager implements
XCommandEnvironment {

public void addPackage(String packageURL, String
packageManagerType) {
	String packageUNOURL = createUNOFileURL(packageURL);
		
	XComponentContext xComponentContext =
				OOWorkbench.getXComponentContext();
			
	// Package manager name
	String packageManagerName =
	"/singletons/com.sun.star.deployment.thePackageManager
Factory";
	
	XPackageManager xPM = null;
	try {
		XPackageManagerFactory xPMF = (XPackageManagerFactory)
		AnyConverter.toObject(XPackageManagerFactory.class,
		xComponentContext.getValueByName(packageManagerName));
		
		// Getting the package manager representative
		xPM = xPMF.getPackageManager(pmType);
	}
	catch (Exception e) {
	}
	try {
		XAbortChannel xAbortChannel = xPM.createAbortChannel();
		xPM.addPackage(packageUNOURL, "", xAbortChannel,
this);
	}
	catch (Exception e) {
	}
}
		
/**
 * Implementation of the getProgressHandler method of the
 * XCommandEnvironment.
 * return An implementation of the XProgressHandler.
 */
public XProgressHandler getProgressHandler() {
	return new ProgressImpl();
}
	
/**
 * Implementation of the getInteractionHandler method of
the
 * XCommandEnvironment.
 * return An implementation of the XInteractionHandler.
 */
public XInteractionHandler getInteractionHandler() {
	return new InteractionImpl();
}

}

/**
 * InteractionImpl implements the XInteractionHandler. It is
needed to
 * add a UNO package.
 * author tobias
 */
class InteractionImpl implements XInteractionHandler
{
    /**
     * Implementation of the handle method of the
XInteractionHandler. 	
     * It handles the add request of a package.
     * param xRequest The XInteractionRequest needed to
handle the 		
     * interaction.
     */
     public void handle (XInteractionRequest xRequest)
    {
        boolean approve = true;
        XInteractionContinuation[] conts =
xRequest.getContinuations();

        for (int i = 0; i < conts.length; i++)
        {
            if (approve)
            {
                XInteractionApprove xApprove =
(XInteractionApprove)
                   
	UnoRuntime.queryInterface(XInteractionApprove.class,
                    			conts[i]);
                if (xApprove != null)
                    xApprove.select();
                //don't query again for ongoing extensions
                approve = false;
            }
        }
    }
}

/**
 * ProgressImpl implements the XProgressHandler. This class
is quiete empty,
 * but nothing more is needed to add UNO packages.
 * author tobias
 */
class ProgressImpl implements XProgressHandler {
    /**
     * Implementation of the push method of the
XProgressHandler. Empty.
     * param status Object
     */
	public void push(Object status) {
    }

	/**
     * Implementation of the update method of the
XProgressHandler. Empty.
     * param status Object
     */
    public void update(Object status) {
    }

    /**
     * Implementation of the pop method of the
XProgressHandler. Empty.
     */
    public void pop() {
    }
}
-----%<-----

Now I continued testing with renamed packages. Adding the
package via
API does install the package, but it is not working. Is
there a failure
in the code?

Maybe that helps to give me a hint how to continue.

Greetings, Tobias

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )