Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 21299 Details for
Bug 88807
PDE manifest editor incorrectly used to display jar manifests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch for org.eclipse.pde
org.eclipse.pde_bug88807.diff (text/plain), 6.90 KB, created by
Rafael Chaves
on 2005-05-17 17:45:46 EDT
(
hide
)
Description:
patch for org.eclipse.pde
Filename:
MIME Type:
Creator:
Rafael Chaves
Created:
2005-05-17 17:45:46 EDT
Size:
6.90 KB
patch
obsolete
>Index: plugin.properties >=================================================================== >RCS file: /home/eclipse/org.eclipse.pde/plugin.properties,v >retrieving revision 1.18 >diff -u -r1.18 plugin.properties >--- plugin.properties 28 Apr 2005 19:51:17 -0000 1.18 >+++ plugin.properties 17 May 2005 21:45:44 -0000 >@@ -29,6 +29,7 @@ > productConfiguration = Product Configuration File > buildPropertiesName = Build Properties File > schemaFile = Extension Point Schema File >+bundleManifest = Bundle Manifest File > > #Cheatsheets > cheatsheet.category.pde = Plug-in Development >Index: plugin.xml >=================================================================== >RCS file: /home/eclipse/org.eclipse.pde/plugin.xml,v >retrieving revision 1.52 >diff -u -r1.52 plugin.xml >--- plugin.xml 28 Apr 2005 19:51:17 -0000 1.52 >+++ plugin.xml 17 May 2005 21:45:44 -0000 >@@ -214,7 +214,13 @@ > name="%buildPropertiesName" > base-type="org.eclipse.jdt.core.javaProperties" > priority="high" >- file-names="build.properties"/> >+ file-names="build.properties"/> >+ <content-type >+ id="bundleManifest" >+ name="%bundleManifest" >+ base-type="org.eclipse.jdt.core.JARManifest" >+ priority="high" >+ describer="org.eclipse.pde.internal.activationexempt.BundleManifestDescriber"/> > </extension> > > </plugin> >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /home/eclipse/org.eclipse.pde/META-INF/MANIFEST.MF,v >retrieving revision 1.5 >diff -u -r1.5 MANIFEST.MF >--- META-INF/MANIFEST.MF 16 May 2005 03:00:30 -0000 1.5 >+++ META-INF/MANIFEST.MF 17 May 2005 21:45:44 -0000 >@@ -7,6 +7,7 @@ > Bundle-Vendor: %providerName > Bundle-Localization: plugin > Export-Package: org.eclipse.pde.internal;x-friends:="org.eclipse.pde.ui", >+ org.eclipse.pde.internal.activationexempt, > org.eclipse.pde.internal.builders;x-friends:="org.eclipse.pde.ui" > Require-Bundle: org.eclipse.core.runtime, > org.eclipse.pde.core;visibility:=reexport, >@@ -17,4 +18,4 @@ > org.eclipse.core.filebuffers, > org.eclipse.ui.intro;resolution:=optional, > org.eclipse.ui.cheatsheets;resolution:=optional >-Eclipse-AutoStart: true >+Eclipse-AutoStart: true;exceptions="org.eclipse.pde.internal.activationexempt" >Index: src/org/eclipse/pde/internal/activationexempt/BundleManifestDescriber.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/activationexempt/BundleManifestDescriber.java >diff -N src/org/eclipse/pde/internal/activationexempt/BundleManifestDescriber.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/activationexempt/BundleManifestDescriber.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,106 @@ >+/******************************************************************************* >+ * Copyright (c) 2005 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.pde.internal.activationexempt; >+ >+import java.io.*; >+import org.eclipse.core.runtime.QualifiedName; >+import org.eclipse.core.runtime.content.IContentDescription; >+import org.eclipse.core.runtime.content.ITextContentDescriber; >+import org.osgi.framework.Constants; >+ >+public class BundleManifestDescriber implements ITextContentDescriber { >+ >+ private final static String[] HEADERS = {Constants.BUNDLE_MANIFESTVERSION, Constants.BUNDLE_NAME, Constants.BUNDLE_VERSION, Constants.BUNDLE_SYMBOLICNAME, Constants.BUNDLE_VENDOR, Constants.BUNDLE_ACTIVATOR}; >+ private final static int LINES = 50; //$NON-NLS-1$ >+ >+ private final static QualifiedName[] SUPPORTED_OPTIONS = {IContentDescription.BYTE_ORDER_MARK}; >+ >+ /* (Intentionally not included in javadoc) >+ * @see IContentDescriber#describe(InputStream, IContentDescription) >+ */ >+ public int describe(InputStream contents, IContentDescription description) throws IOException { >+ byte[] bom = getByteOrderMark(contents); >+ contents.reset(); >+ String charset = "UTF-8"; //$NON-NLS-1$ >+ if (bom != null) { >+ // has a bom >+ // remember to skip it >+ contents.skip(bom.length); >+ // compute a corresponding charset >+ if (bom == IContentDescription.BOM_UTF_8) >+ charset = "UTF-8"; //$NON-NLS-1$ >+ else if (bom == IContentDescription.BOM_UTF_16BE || bom == IContentDescription.BOM_UTF_16LE) >+ // UTF-16 will properly recognize the BOM >+ charset = "UTF-16"; //$NON-NLS-1$ >+ // fill description if requesed >+ if (description != null && description.isRequested(IContentDescription.BYTE_ORDER_MARK)) >+ description.setProperty(IContentDescription.BYTE_ORDER_MARK, bom); >+ } >+ BufferedReader reader = new BufferedReader(new InputStreamReader(contents, charset)); >+ String line; >+ for (int i = 0; ((line = reader.readLine()) != null) && i < LINES; i++) >+ if (matches(line)) >+ // found signature >+ return VALID; >+ // could not find signature >+ return INDETERMINATE; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * @see org.eclipse.core.runtime.content.ITextContentDescriber#describe(java.io.Reader, org.eclipse.core.runtime.content.IContentDescription) >+ */ >+ public int describe(Reader contents, IContentDescription description) throws IOException { >+ BufferedReader reader = new BufferedReader(contents); >+ String line; >+ for (int i = 0; ((line = reader.readLine()) != null) && i < LINES; i++) >+ if (matches(line)) >+ return VALID; >+ return INDETERMINATE; >+ } >+ >+ byte[] getByteOrderMark(InputStream input) throws IOException { >+ int first = (input.read() & 0xFF);//converts unsigned byte to int >+ int second = (input.read() & 0xFF); >+ if (first == -1 || second == -1) >+ return null; >+ //look for the UTF-16 Byte Order Mark (BOM) >+ if (first == 0xFE && second == 0xFF) >+ return IContentDescription.BOM_UTF_16BE; >+ if (first == 0xFF && second == 0xFE) >+ return IContentDescription.BOM_UTF_16LE; >+ int third = (input.read() & 0xFF); >+ if (third == -1) >+ return null; >+ //look for the UTF-8 BOM >+ if (first == 0xEF && second == 0xBB && third == 0xBF) >+ return IContentDescription.BOM_UTF_8; >+ return null; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * @see org.eclipse.core.runtime.content.IContentDescriber#getSupportedOptions() >+ */ >+ public QualifiedName[] getSupportedOptions() { >+ return SUPPORTED_OPTIONS; >+ } >+ >+ private boolean matches(String line) { >+ for (int i = 0; i < HEADERS.length; i++) { >+ int length = HEADERS[i].length(); >+ if (line.length() >= length) >+ if (line.substring(0, length).equalsIgnoreCase(HEADERS[i])) >+ return true; >+ } >+ return false; >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 88807
: 21299 |
21300