|
Lines 16-24
Link Here
|
| 16 |
import java.util.zip.ZipEntry; |
16 |
import java.util.zip.ZipEntry; |
| 17 |
import java.util.zip.ZipFile; |
17 |
import java.util.zip.ZipFile; |
| 18 |
import org.eclipse.core.runtime.*; |
18 |
import org.eclipse.core.runtime.*; |
|
|
19 |
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper; |
| 19 |
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; |
20 |
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; |
|
|
21 |
import org.eclipse.equinox.internal.p2.metadata.generator.Activator; |
| 20 |
import org.eclipse.equinox.internal.p2.metadata.generator.Messages; |
22 |
import org.eclipse.equinox.internal.p2.metadata.generator.Messages; |
| 21 |
import org.eclipse.equinox.internal.p2.metadata.repository.Activator; |
|
|
| 22 |
import org.eclipse.osgi.service.pluginconversion.PluginConversionException; |
23 |
import org.eclipse.osgi.service.pluginconversion.PluginConversionException; |
| 23 |
import org.eclipse.osgi.service.pluginconversion.PluginConverter; |
24 |
import org.eclipse.osgi.service.pluginconversion.PluginConverter; |
| 24 |
import org.eclipse.osgi.service.resolver.*; |
25 |
import org.eclipse.osgi.service.resolver.*; |
|
Lines 60-66
Link Here
|
| 60 |
try { |
61 |
try { |
| 61 |
converter = acquirePluginConverter(); |
62 |
converter = acquirePluginConverter(); |
| 62 |
if (converter == null) { |
63 |
if (converter == null) { |
| 63 |
new RuntimeException("Unable to aquire PluginConverter service during generation for: " + bundleLocation).printStackTrace(); //$NON-NLS-1$ |
64 |
LogHelper.log(new Status(IStatus.ERROR, Activator.ID, "Unable to aquire PluginConverter service during generation for: " + bundleLocation)); |
| 64 |
return null; |
65 |
return null; |
| 65 |
} |
66 |
} |
| 66 |
return converter.convertManifest(bundleLocation, false, null, true, null); |
67 |
return converter.convertManifest(bundleLocation, false, null, true, null); |
|
Lines 72-79
Link Here
|
| 72 |
return null; |
73 |
return null; |
| 73 |
if (logConversionException) { |
74 |
if (logConversionException) { |
| 74 |
IStatus status = new Status(IStatus.WARNING, Activator.ID, 0, NLS.bind(Messages.exception_errorConverting, bundleLocation.getAbsolutePath()), convertException); |
75 |
IStatus status = new Status(IStatus.WARNING, Activator.ID, 0, NLS.bind(Messages.exception_errorConverting, bundleLocation.getAbsolutePath()), convertException); |
| 75 |
System.out.println(status); |
76 |
LogHelper.log(status); |
| 76 |
//TODO Need to find a way to get a logging service to log |
|
|
| 77 |
} |
77 |
} |
| 78 |
return null; |
78 |
return null; |
| 79 |
} |
79 |
} |
|
Lines 85-93
Link Here
|
| 85 |
descriptor.setUserObject(enhancedManifest); |
85 |
descriptor.setUserObject(enhancedManifest); |
| 86 |
return descriptor; |
86 |
return descriptor; |
| 87 |
} catch (BundleException e) { |
87 |
} catch (BundleException e) { |
| 88 |
// IStatus status = new Status(IStatus.WARNING, IPDEBuildConstants.PI_PDEBUILD, EXCEPTION_STATE_PROBLEM, NLS.bind(Messages.exception_stateAddition, enhancedManifest.get(Constants.BUNDLE_NAME)), e); |
88 |
String message = NLS.bind(Messages.exception_stateAddition, bundleLocation == null ? null : bundleLocation.getAbsoluteFile()); |
| 89 |
// BundleHelper.getDefault().getLog().log(status); |
89 |
IStatus status = new Status(IStatus.WARNING, Activator.ID, message, e); |
| 90 |
System.err.println(NLS.bind(Messages.exception_stateAddition, bundleLocation != null ? bundleLocation.getAbsoluteFile() : null)); |
90 |
LogHelper.log(status); |
| 91 |
return null; |
91 |
return null; |
| 92 |
} |
92 |
} |
| 93 |
} |
93 |
} |
|
Lines 105-115
Link Here
|
| 105 |
ManifestElement.parseBundleManifest(manifestStream, entries); |
105 |
ManifestElement.parseBundleManifest(manifestStream, entries); |
| 106 |
return getBundleDescription(entries, bundleLocation); |
106 |
return getBundleDescription(entries, bundleLocation); |
| 107 |
} catch (IOException e) { |
107 |
} catch (IOException e) { |
| 108 |
// TODO Auto-generated catch block |
108 |
String message = "An error occurred while reading the bundle description."; |
| 109 |
e.printStackTrace(); |
109 |
IStatus status = new Status(IStatus.ERROR, Activator.ID, message, e); |
|
|
110 |
LogHelper.log(status); |
| 110 |
} catch (BundleException e) { |
111 |
} catch (BundleException e) { |
| 111 |
// TODO Auto-generated catch block |
112 |
String message = "An error occurred while reading the bundle description."; |
| 112 |
e.printStackTrace(); |
113 |
IStatus status = new Status(IStatus.ERROR, Activator.ID, message, e); |
|
|
114 |
LogHelper.log(status); |
| 113 |
} |
115 |
} |
| 114 |
return null; |
116 |
return null; |
| 115 |
} |
117 |
} |
|
Lines 128-134
Link Here
|
| 128 |
manifestStream = new BufferedInputStream(new FileInputStream(new File(bundleLocation, JarFile.MANIFEST_NAME))); |
130 |
manifestStream = new BufferedInputStream(new FileInputStream(new File(bundleLocation, JarFile.MANIFEST_NAME))); |
| 129 |
} |
131 |
} |
| 130 |
} catch (IOException e) { |
132 |
} catch (IOException e) { |
| 131 |
//ignore |
133 |
//ignore but log |
|
|
134 |
LogHelper.log(new Status(IStatus.WARNING, Activator.ID, "An error occurred while loading the bundle manifest.", e)); |
| 132 |
} |
135 |
} |
| 133 |
|
136 |
|
| 134 |
Dictionary manifest = null; |
137 |
Dictionary manifest = null; |
|
Lines 138-146
Link Here
|
| 138 |
// TODO temporary hack. We are reading a Map but everyone wants a Dictionary so convert. |
141 |
// TODO temporary hack. We are reading a Map but everyone wants a Dictionary so convert. |
| 139 |
// real answer is to have people expect a Map but that is a wider change. |
142 |
// real answer is to have people expect a Map but that is a wider change. |
| 140 |
manifest = new Hashtable(manifestMap); |
143 |
manifest = new Hashtable(manifestMap); |
| 141 |
} catch (IOException ioe) { |
144 |
} catch (IOException e) { |
|
|
145 |
LogHelper.log(new Status(IStatus.ERROR, Activator.ID, "An error occurred while loading the bundle manifest.", e)); |
| 142 |
return null; |
146 |
return null; |
| 143 |
} catch (BundleException e) { |
147 |
} catch (BundleException e) { |
|
|
148 |
LogHelper.log(new Status(IStatus.ERROR, Activator.ID, "An error occurred while loading the bundle manifest.", e)); |
| 144 |
return null; |
149 |
return null; |
| 145 |
} finally { |
150 |
} finally { |
| 146 |
try { |
151 |
try { |