[
https://issues.apache.org/jira/browse/FELIX-765?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Karl Pauls resolved FELIX-765.
------------------------------
Resolution: Incomplete
Fix Version/s: felix-1.4.0
I commited the patch as is since I didn't got any feedback. Please test it and
close this issue if it fixes your problem or reopen it if not, respectively.
> Invalid occasional OSGi filter toString() value
> -----------------------------------------------
>
> Key: FELIX-765
> URL: https://issues.apache.org/jira/browse/FELIX-765
> Project: Felix
> Issue Type: Bug
> Components: Framework
> Affects Versions: felix-1.2.2
> Reporter: Don Brown
> Assignee: Karl Pauls
> Fix For: felix-1.4.0
>
> Attachments: ldap.patch
>
>
> Rather frequently, under the right conditions, FilterImpl.toString() will
> generate an invalid filter string. In my case, this happens when Spring DM
> loads two bundles on two different threads simultaneously when processing a
> number of OSGi service imports. The actual stracktrace isn't very useful
> since what Spring DM does internally is get a filter's string, pass that
> around a bit, then try to give that to Felix, which causes an exception. I
> narrowed the problem down to the toString() method:
> java.lang.RuntimeException: Invalid filter
> string:(&some49(&(bean-name=some49)(plugins-host=true)))
> at
> org.apache.felix.framework.FilterImpl.checkFilter(FilterImpl.java:330)
> at org.apache.felix.framework.FilterImpl.toString(FilterImpl.java:244)
> at java.lang.String.valueOf(String.java:2615)
> at java.lang.StringBuffer.append(StringBuffer.java:220)
> at
> org.springframework.osgi.service.importer.DefaultOsgiServiceDependency.<init>(DefaultOsgiServiceDependency.java:53)
> at
> org.springframework.osgi.extender.internal.dependencies.startup.MandatoryImporterDependencyFactory.getServiceDependencies(MandatoryImporterDependencyFactory.java:69)
> at
> org.springframework.osgi.extender.internal.dependencies.startup.DependencyServiceManager.findServiceDependencies(DependencyServiceManager.java:233)
> at
> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:253)
> at
> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:173)
> at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:136)
> at
> org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:741)
> at java.lang.Thread.run(Thread.java:613)
> This checkFilter() method simply looks for invalid strings where the '&'
> character isn't followed by a '(' character:
> public static void checkFilter(String filter)
> {
> if (filter != null)
> {
> boolean andFound = false;
> for (int x=0; x<filter.length(); x++)
> {
> char c = filter.charAt(x);
> if (c == '&') {
> andFound = true;
> } else if (andFound && c != '(') {
> throw new RuntimeException("Invalid filter
> string:"+filter);
> } else
> andFound = false;
> }
> }
> }
> Deeper in the code, I put this check in Parser to find out when this invalid
> filter String was being created (line 594):
> for (int x=0; x<tmp.length; x++) {
> if (tmp[x] instanceof ConstOperator) {
> System.out.println("Invalid tree
> constructed:"+tmp[x]);
> }
> }
> This detected when the const operator was incorrectly listed as a child of
> the AND operator, but I also saw the PUSH operator a direct child as well.
> Therefore, this issue seems related to FELIX-721, although I was unable to
> find a direct fix. For now, I'm commenting out the program cache in
> FilterImpl line 64, which fixes the issue and has a negligible impact on
> performance from my testing. Since we are seeing this exception between 10%
> and 80% of the time, a slower Felix is preferable to a frequently broken
> startup.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.