You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2008/09/24 05:12:19 UTC
svn commit: r698419 -
/servicemix/maven-plugins/features-maven-plugin/trunk/src/main/java/org/apache/servicemix/tooling/features/GenerateFeaturesFileMojo.java
Author: ffang
Date: Tue Sep 23 20:12:18 2008
New Revision: 698419
URL: http://svn.apache.org/viewvc?rev=698419&view=rev
Log:
[SMX4-118] features maven plugin can't build with jdk15
Modified:
servicemix/maven-plugins/features-maven-plugin/trunk/src/main/java/org/apache/servicemix/tooling/features/GenerateFeaturesFileMojo.java
Modified: servicemix/maven-plugins/features-maven-plugin/trunk/src/main/java/org/apache/servicemix/tooling/features/GenerateFeaturesFileMojo.java
URL: http://svn.apache.org/viewvc/servicemix/maven-plugins/features-maven-plugin/trunk/src/main/java/org/apache/servicemix/tooling/features/GenerateFeaturesFileMojo.java?rev=698419&r1=698418&r2=698419&view=diff
==============================================================================
--- servicemix/maven-plugins/features-maven-plugin/trunk/src/main/java/org/apache/servicemix/tooling/features/GenerateFeaturesFileMojo.java (original)
+++ servicemix/maven-plugins/features-maven-plugin/trunk/src/main/java/org/apache/servicemix/tooling/features/GenerateFeaturesFileMojo.java Tue Sep 23 20:12:18 2008
@@ -27,10 +27,10 @@
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -207,7 +207,8 @@
stream = new BufferedInputStream(new FileInputStream(translation));
Properties file = new Properties();
file.load(stream);
- for (String key : file.stringPropertyNames()) {
+ ArrayList<String> stringNames = getStringNames(file);
+ for (String key : stringNames) {
String[] elements = key.split("/");
translations.get(String.format("%s/%s", elements[0], elements[1]))
.put(VersionRange.createFromVersionSpec(elements[2]), file.getProperty(key));
@@ -232,7 +233,21 @@
getLog().info("-- <end of list> --");
}
- private void writeProjectDependencyFeatures(PrintStream out) {
+ private ArrayList<String> getStringNames(Properties file) {
+ // this method simulate the Properties.stringPropertyNames() of JDK6 in order to make this class
+ // compile with jdk5
+ ArrayList<String> ret = new ArrayList<String>();
+ Enumeration<?> name = file.propertyNames();
+ while (name.hasMoreElements()) {
+ Object ele = name.nextElement();
+ if (ele instanceof String && file.get(ele) instanceof String) {
+ ret.add((String)ele);
+ }
+ }
+ return ret;
+ }
+
+ private void writeProjectDependencyFeatures(PrintStream out) {
Set<Artifact> dependencies = (Set<Artifact>)project.getDependencyArtifacts();
dependencies.removeAll(provided);
for (Artifact artifact : dependencies) {