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 186576
Collapse All | Expand All

(-)src/org/eclipse/hyades/test/tools/core/internal/util/ManifestUtil.java (-13 / +48 lines)
Lines 40-46 Link Here
40
 * 
40
 * 
41
 * @author      Julien Canches
41
 * @author      Julien Canches
42
 * @author      Paul E. Slauenwhite
42
 * @author      Paul E. Slauenwhite
43
 * @version     April 26, 2007
43
 * @version     May 11, 2007
44
 * @since       April 26, 2007
44
 * @since       April 26, 2007
45
 */
45
 */
46
public class ManifestUtil {
46
public class ManifestUtil {
Lines 105-121 Link Here
105
		
105
		
106
		try {
106
		try {
107
			
107
			
108
			String propertyValue = new Manifest(manifestFile.getContents(true)).getMainAttributes().getValue(propertyName);
108
			String[] propertyValues = getPropertyValues(manifestFile, propertyName);
109
			
109
			
110
			if(propertyValue != null){
110
			if(propertyValues != null){				
111
				
111
112
				propertyValue = propertyValue.trim();
112
				if(propertyValues.length > 1){
113
				
113
					
114
				if((propertyName.equals(VERSION_PROPERTY)) && (propertyValue.endsWith(".qualifier"))){ //$NON-NLS-1$		
114
					StringBuffer propertyValue = new StringBuffer();
115
					propertyValue = (propertyValue.substring(0, (propertyValue.length() - 10)));
115
					
116
					for (int counter = 0; counter < propertyValues.length; counter++) {
117
						
118
						if(propertyValue.length() > 0){
119
							propertyValue.append(", "); //$NON-NLS-1$
120
						}
121
						
122
						propertyValue.append(propertyValues[counter]);
123
					}
124
					
125
					return (propertyValue.toString());
116
				}
126
				}
117
				
127
				
118
				return propertyValue;
128
				return (propertyValues[0]);
119
			}
129
			}
120
		} 
130
		} 
121
		catch (Exception e) {
131
		catch (Exception e) {
Lines 143-152 Link Here
143
	 */
153
	 */
144
	public static String[] getPropertyValues(IFile manifestFile, String propertyName) {
154
	public static String[] getPropertyValues(IFile manifestFile, String propertyName) {
145
		
155
		
146
		String propertyValue = getPropertyValue(manifestFile, propertyName);
156
		try {
147
		
157
			
148
		if(propertyValue != null){
158
			String propertyValue = new Manifest(manifestFile.getContents(true)).getMainAttributes().getValue(propertyName);
149
			return (propertyValue.split("\\s*,\\s*"));
159
			
160
			if(propertyValue != null){
161
				
162
				propertyValue = propertyValue.trim();
163
				
164
				String[] propertyValues = propertyValue.split("\\s*,\\s*"); //$NON-NLS-1$		
165
				int colonIndex = -1;
166
					
167
				for (int counter = 0; counter < propertyValues.length; counter++) {
168
						
169
					colonIndex = propertyValues[counter].indexOf(';');
170
						
171
					if(colonIndex != -1){
172
						propertyValues[counter] = propertyValues[counter].substring(0, colonIndex).trim();
173
					}
174
175
					if((propertyName.equals(VERSION_PROPERTY)) && (propertyValues[counter].endsWith(".qualifier"))){ //$NON-NLS-1$		
176
						propertyValues[counter] = propertyValues[counter].substring(0, (propertyValues[counter].length() - 10));
177
					}
178
				}
179
180
				return propertyValues;
181
			}
182
		} 
183
		catch (Exception e) {
184
			//Ignore and return null.
150
		}
185
		}
151
		
186
		
152
		return null;
187
		return null;

Return to bug 186576