osgi / bugzilla-archive

Archive of OSGi Alliance Specification Bugzilla bugs. The Specification Bugzilla system was decommissioned with the move to GitHub. The issues in this repository are imported from the Specification Bugzilla system for archival purposes.
0 stars 1 forks source link

UserPromptCondition.UserPromptConditionFactory must be removed #303

Closed bjhargrave closed 17 years ago

bjhargrave commented 17 years ago

Original bug ID: BZ#332 From: @bjhargrave Reported version: R4

bjhargrave commented 17 years ago

Comment author: @bjhargrave

The UserPromptCondition class defines an inner interface: UserPromptConditionFactory which is marked protected. However the class file is public and so the inner interface is part of the public API.

// class version 46.0 (46) // access flags 1537 public abstract interface org/osgi/util/mobile/UserPromptCondition$UserPromptConditionFactory {

// compiled from: UserPromptCondition.java INNERCLASS org/osgi/util/mobile/UserPromptCondition$UserPromptConditionFactory org/osgi/util/mobile/UserPromptCondition UserPromptConditionFactory 1548

// access flags 1025 public abstract getInstance(Lorg/osgi/framework/Bundle;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/osgi/util/mobile/UserPromptCondition; }

The UserPromptCondition class must be changed to remove this inner interface.

bjhargrave commented 17 years ago

Comment author: @bjhargrave

Also the following methods of UserPromptCondition are part of the public API and are not documented:

protected UserPromptCondition() protected static void setFactory(UserPromptConditionFactory factory) protected static UserPromptCondition unWrap(UserPromptCondition c)

These methods must either be documented or be removed from the public API (at least no longer public or protected).

bjhargrave commented 17 years ago

Comment author: @pkriens

In this case, the interface was no necessary. The conditions were designed to use a factory approach, the implementation of ConditionalPermissionAdmin must always use the getCondition() method and the return value does not even have to extend the implementation class, the return value must implement the Condition interface only (It can even return the TRUE or FALSE instances).

Unfortunately, the test verified that the class relation, so this is also changed. the UserPromptCondition is now clean, there are no public methods outside the static getCondition method. All tests pass.

Eclipse Workspace Patch 1.0

P org.osgi.test.cases.policy

Index: src/org/osgi/test/cases/policy/tbc/UserPromptCondition/GetCondition.java

RCS file: /cvshome/build/org.osgi.test.cases.policy/src/org/osgi/test/cases/policy/tbc/UserPromptCondition/GetCondition.java,v retrieving revision 1.3 diff -u -r1.3 GetCondition.java --- src/org/osgi/test/cases/policy/tbc/UserPromptCondition/GetCondition.java 18 Nov 2005 20:20:18 -0000 1.3 +++ src/org/osgi/test/cases/policy/tbc/UserPromptCondition/GetCondition.java 7 Jul 2006 07:28:49 -0000 @ @ -99,7 +99,9 @ @ MessagesConstants.ASSERT_NOT_NULL, new String[] { "Created UserPrompt" }), condition);

-import java.util.Dictionary; -import org.osgi.framework.AdminPermission; +import java.lang.reflect.; +import java.security.; + import org.osgi.framework.Bundle; -import org.osgi.service.condpermadmin.Condition; -import org.osgi.service.condpermadmin.ConditionInfo; +import org.osgi.service.condpermadmin.*;

/**

bjhargrave commented 17 years ago

Comment author: Peter Nagy <peter.1.nagy@nokia.com>

I've committed new org.osgi.util.mobile.UserPromptCondition version, all unofficial methods are either private or package-protected now.

bjhargrave commented 17 years ago

Comment author: @bjhargrave

Change to UserPromptCondition has causes the test to fail in the daily build:

From http://membercvs.osgi.org/db/osgi.test/director/run-mobile.xml#test.policy

085848.133 test.policy_TBC #testGetCondition012 085848.219 test.policy_TBC X testUserPromptConditionGetCondition: "# expected:[java.lang.IllegalArgumentException] and got nothing" [result] [reference]

bjhargrave commented 17 years ago

Comment author: Peter Nagy <peter.1.nagy@nokia.com>

right, I forgot to unwrap some exceptions. It is fixed now