Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 144783
Collapse All | Expand All

(-)osgi/src/org/osgi/util/tracker/ServiceTracker.java (-24 / +5 lines)
Lines 194-200 Link Here
194
		this.context = context;
194
		this.context = context;
195
		this.trackReference = null;
195
		this.trackReference = null;
196
		this.trackClass = null;
196
		this.trackClass = null;
197
		this.listenerFilter = null;
197
		this.listenerFilter = filter.toString();
198
		this.filter = filter;
198
		this.filter = filter;
199
		this.customizer = (customizer == null) ? this : customizer;
199
		this.customizer = (customizer == null) ? this : customizer;
200
		if ((context == null) || (filter == null)) { // we throw a NPE here
200
		if ((context == null) || (filter == null)) { // we throw a NPE here
Lines 255-265 Link Here
255
			try {
255
			try {
256
				context.addServiceListener(tracked, listenerFilter);
256
				context.addServiceListener(tracked, listenerFilter);
257
				ServiceReference[] references;
257
				ServiceReference[] references;
258
				if (listenerFilter == null) { // user supplied filter
258
				if (trackClass == null && trackReference == null) { // user supplied filter
259
					references = getInitialReferences(trackAllServices, null,
259
					references = getInitialReferences(trackAllServices, null,
260
							filter.toString());
260
							listenerFilter);
261
				}
261
				}
262
				else { // constructor supplied filter
262
				else { // user supplied no filter
263
					if (trackClass == null) {
263
					if (trackClass == null) {
264
						references = new ServiceReference[] {trackReference};
264
						references = new ServiceReference[] {trackReference};
265
					}
265
					}
Lines 912-942 Link Here
912
			switch (event.getType()) {
912
			switch (event.getType()) {
913
				case ServiceEvent.REGISTERED :
913
				case ServiceEvent.REGISTERED :
914
				case ServiceEvent.MODIFIED :
914
				case ServiceEvent.MODIFIED :
915
					if (listenerFilter != null) { // constructor supplied
916
													// filter
917
						track(reference);
915
						track(reference);
918
						/*
916
						/*
919
						 * If the customizer throws an unchecked exception, it
917
						 * If the customizer throws an unchecked exception, it
920
						 * is safe to let it propagate
918
						 * is safe to let it propagate
921
						 */
919
						 */
922
					}
920
			break;
923
					else { // user supplied filter
924
						if (filter.match(reference)) {
925
							track(reference);
926
							/*
927
							 * If the customizer throws an unchecked exception,
928
							 * it is safe to let it propagate
929
							 */
930
						}
931
						else {
932
							untrack(reference);
933
							/*
934
							 * If the customizer throws an unchecked exception,
935
							 * it is safe to let it propagate
936
							 */
937
						}
938
					}
939
					break;
940
				case ServiceEvent.UNREGISTERING :
921
				case ServiceEvent.UNREGISTERING :
941
					untrack(reference);
922
					untrack(reference);
942
					/*
923
					/*

Return to bug 144783