Author: maartenc Date: Tue Jan 4 13:46:12 2011 New Revision: 1055036 URL: http://svn.apache.org/viewvc?rev=1055036&view=rev Log: Some obvious code changes to get the osgi code to compile on JDK 1.4.
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfo.java ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/ManifestHeaderValue.java ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/filter/CompareFilter.java ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/filter/MultiOperatorFilter.java ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/filter/RequirementFilterParser.java ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/filter/UniOperatorFilter.java ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/xml/RequirementFilter.java ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/BundleRepoResolver.java ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/core/ManifestParserTest.java Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfo.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfo.java?rev=1055036&r1=1055035&r2=1055036&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfo.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfo.java Tue Jan 4 13:46:12 2011 @@ -51,7 +51,7 @@ public class BundleInfo { private Set/* <BundleCapability> */capabilities = new LinkedHashSet/* <BundleCapability> */(); - private List/* <String> */executionEnvironments = Collections.emptyList(); + private List/* <String> */executionEnvironments = Collections.EMPTY_LIST; private String description; @@ -69,7 +69,7 @@ public class BundleInfo { } public String toString() { - StringBuilder builder = new StringBuilder(); + StringBuffer builder = new StringBuffer(); builder.append("BundleInfo [executionEnvironments="); builder.append(executionEnvironments); builder.append(", capabilities="); Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java?rev=1055036&r1=1055035&r2=1055036&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java Tue Jan 4 13:46:12 2011 @@ -168,7 +168,7 @@ public class BundleInfoAdapter { private static String encodeIvyLocation(String org, String name, String branch, String rev, String type, String art, String ext) { - StringBuilder builder = new StringBuilder(); + StringBuffer builder = new StringBuffer(); builder.append("ivy://"); builder.append(org); builder.append('/'); Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/ManifestHeaderValue.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/ManifestHeaderValue.java?rev=1055036&r1=1055035&r2=1055036&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/ManifestHeaderValue.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/ManifestHeaderValue.java Tue Jan 4 13:46:12 2011 @@ -70,7 +70,7 @@ public class ManifestHeaderValue { public List/* <String> */getValues() { if (elements.isEmpty()) { - return Collections.emptyList(); + return Collections.EMPTY_LIST; } List/* <String> */list = new ArrayList/* <String> */(); Iterator itElements = getElements().iterator(); @@ -100,7 +100,7 @@ public class ManifestHeaderValue { /** * buffer */ - private StringBuilder buffer = new StringBuilder(); + private StringBuffer buffer = new StringBuffer(); /** * position in the source Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/filter/CompareFilter.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/filter/CompareFilter.java?rev=1055036&r1=1055035&r2=1055036&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/filter/CompareFilter.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/filter/CompareFilter.java Tue Jan 4 13:46:12 2011 @@ -73,7 +73,7 @@ public class CompareFilter extends Requi return rightValue; } - public void append(StringBuilder builder) { + public void append(StringBuffer builder) { builder.append("("); builder.append(leftValue); builder.append(operator.toString()); Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/filter/MultiOperatorFilter.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/filter/MultiOperatorFilter.java?rev=1055036&r1=1055035&r2=1055036&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/filter/MultiOperatorFilter.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/filter/MultiOperatorFilter.java Tue Jan 4 13:46:12 2011 @@ -40,7 +40,7 @@ public abstract class MultiOperatorFilte abstract protected char operator(); - public void append(StringBuilder builder) { + public void append(StringBuffer builder) { builder.append('('); builder.append(operator()); Iterator itSubFilters = subFilters.iterator(); Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/filter/RequirementFilterParser.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/filter/RequirementFilterParser.java?rev=1055036&r1=1055035&r2=1055036&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/filter/RequirementFilterParser.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/filter/RequirementFilterParser.java Tue Jan 4 13:46:12 2011 @@ -118,7 +118,7 @@ public class RequirementFilterParser { } private String parseCompareValue() { - StringBuilder builder = new StringBuilder(); + StringBuffer builder = new StringBuffer(); do { readNext(); if (!isOperator(c) && c != ')' && c != '(') { Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/filter/UniOperatorFilter.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/filter/UniOperatorFilter.java?rev=1055036&r1=1055035&r2=1055036&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/filter/UniOperatorFilter.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/filter/UniOperatorFilter.java Tue Jan 4 13:46:12 2011 @@ -29,7 +29,7 @@ public abstract class UniOperatorFilter abstract protected char operator(); - public void append(StringBuilder builder) { + public void append(StringBuffer builder) { builder.append("("); builder.append(operator()); builder.append(subFilter.toString()); Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/xml/RequirementFilter.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/xml/RequirementFilter.java?rev=1055036&r1=1055035&r2=1055036&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/xml/RequirementFilter.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/xml/RequirementFilter.java Tue Jan 4 13:46:12 2011 @@ -20,11 +20,11 @@ package org.apache.ivy.osgi.obr.xml; public abstract class RequirementFilter { public String toString() { - StringBuilder builder = new StringBuilder(); + StringBuffer builder = new StringBuffer(); append(builder); return builder.toString(); } - public abstract void append(StringBuilder builder); + public abstract void append(StringBuffer builder); } Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/BundleRepoResolver.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/BundleRepoResolver.java?rev=1055036&r1=1055035&r2=1055036&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/BundleRepoResolver.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/BundleRepoResolver.java Tue Jan 4 13:46:12 2011 @@ -477,13 +477,13 @@ public abstract class BundleRepoResolver Map/* <String, Set<BundleCapabilityAndLocation>> */bundleCapabilityMap = (Map) getRepoDescriptor() .getBundleByCapabilities().get(osgiAtt); if (bundleCapabilityMap == null || bundleCapabilityMap.isEmpty()) { - return Collections./* <Map<String, String>> */emptySet(); + return Collections.EMPTY_SET; } tokenSet.remove(IvyPatternHelper.ORGANISATION_KEY); String org = (String) criteria.get(IvyPatternHelper.ORGANISATION_KEY); if (org != null && org.length() != 0) { - return Collections./* <Map<String, String>> */emptySet(); + return Collections.EMPTY_SET; } values.put(IvyPatternHelper.ORGANISATION_KEY, ""); @@ -509,7 +509,7 @@ public abstract class BundleRepoResolver Set/* <BundleCapabilityAndLocation> */bundleCapabilities = (Set) bundleCapabilityMap .get(module); if (bundleCapabilities == null) { - return Collections./* <Map<String, String>> */emptySet(); + return Collections.EMPTY_SET; } Set/* <Map<String, String>> */tokenValues = new HashSet/* <Map<String, String>> */(); Iterator itBundle = bundleCapabilities.iterator(); @@ -534,13 +534,13 @@ public abstract class BundleRepoResolver Set/* <BundleCapabilityAndLocation> */bundleCapabilities = (Set) bundleCapabilityMap .get(module); if (bundleCapabilities == null) { - return Collections./* <Map<String, String>> */emptySet(); + return Collections.EMPTY_SET; } Version v; try { v = new Version(rev); } catch (NumberFormatException e) { - return Collections./* <Map<String, String>> */emptySet(); + return Collections.EMPTY_SET; } BundleCapabilityAndLocation found = null; Iterator itBundle = bundleCapabilities.iterator(); @@ -552,7 +552,7 @@ public abstract class BundleRepoResolver } } if (found == null) { - return Collections./* <Map<String, String>> */emptySet(); + return Collections.EMPTY_SET; } Set/* <Map<String, String>> */tokenValues = new HashSet/* <Map<String, String>> */(); DefaultModuleDescriptor md = BundleInfoAdapter.toModuleDescriptor( Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/core/ManifestParserTest.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/core/ManifestParserTest.java?rev=1055036&r1=1055035&r2=1055036&view=diff ============================================================================== --- ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/core/ManifestParserTest.java (original) +++ ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/core/ManifestParserTest.java Tue Jan 4 13:46:12 2011 @@ -46,8 +46,8 @@ public class ManifestParserTest extends assertEquals(2, bundleInfo.getImports().size()); final String importsList = bundleInfo.getImports().toString(); - assertTrue(importsList.contains("com.acme.bravo")); - assertTrue(importsList.contains("com.acme.delta")); + assertTrue(importsList.indexOf("com.acme.bravo") != -1); + assertTrue(importsList.indexOf("com.acme.delta") != -1); bundleInfo = ManifestParser.parseJarManifest(getClass().getResourceAsStream( "com.acme.bravo-2.0.0.20080202.jar")); @@ -61,8 +61,8 @@ public class ManifestParserTest extends expectedRequires.add(new BundleRequirement(BundleInfo.BUNDLE_TYPE, "com.acme.charlie", new VersionRange("3.0.0"), null)); assertEquals(1, bundleInfo.getExports().size()); - assertTrue(bundleInfo.getExports().toString().contains("com.acme.bravo")); + assertTrue(bundleInfo.getExports().toString().indexOf("com.acme.bravo") != -1); assertEquals(1, bundleInfo.getImports().size()); - assertTrue(bundleInfo.getImports().toString().contains("com.acme.charlie")); + assertTrue(bundleInfo.getImports().toString().indexOf("com.acme.charlie") != -1); } }