while (entries.hasNext()) { Attributes.Name name = (Attributes.Name) entries.next(); if (!name.equals(versionName)) { writeEntry(out, name, manifest.mainAttributes.getValue(name), encoder, buffer);
public void readEntries(Map<String, Attributes> entries, Map<String, Manifest.Chunk> chunks) throws IOException { int mark = pos; while (readHeader()) { if (!Attributes.Name.NAME.equals(name)) { throw new IOException("Entry is not named"); } String entryNameValue = value; Attributes entry = entries.get(entryNameValue); if (entry == null) { entry = new Attributes(12); } while (readHeader()) { entry.put(name, value); } if (chunks != null) { if (chunks.get(entryNameValue) != null) { // TODO A bug: there might be several verification chunks for // the same name. I believe they should be used to update // signature in order of appearance; there are two ways to fix // this: either use a list of chunks, or decide on used // signature algorithm in advance and reread the chunks while // updating the signature; for now a defensive error is thrown throw new IOException("A jar verifier does not support more than one entry with the same name"); } chunks.put(entryNameValue, new Manifest.Chunk(mark, pos)); mark = pos; } entries.put(entryNameValue, entry); } }
while (entries.hasNext()) { Attributes.Name name = (Attributes.Name) entries.next(); if (!name.equals(versionName)) { writeEntry(out, name, manifest.mainAttributes.getValue(name), encoder, buffer);
while (entries.hasNext()) { Attributes.Name name = (Attributes.Name) entries.next(); if (!name.equals(versionName)) { writeEntry(out, name, manifest.mainAttributes.getValue(name), encoder, buffer);
while (entries.hasNext()) { Attributes.Name name = (Attributes.Name) entries.next(); if (!name.equals(versionName)) { writeEntry(out, name, manifest.mainAttributes.getValue(name), encoder, buffer);
if (Attributes.Name.CLASS_PATH.equals(key)) { newValue = orderClasspath(newValue); existingValue = orderClasspath(existingValue);
while (entries.hasNext()) { Attributes.Name name = (Attributes.Name) entries.next(); if (!name.equals(versionName)) { writeEntry(out, name, manifest.mainAttributes.getValue(name), encoder, buffer);
while (entries.hasNext()) { Attributes.Name name = (Attributes.Name) entries.next(); if (!name.equals(versionName)) { writeEntry(out, name, manifest.mainAttributes.getValue(name), encoder, buffer);
while (entries.hasNext()) { Attributes.Name name = (Attributes.Name) entries.next(); if (!name.equals(versionName)) { writeEntry(out, name, manifest.mainAttributes.getValue(name), encoder, buffer);
while (entries.hasNext()) { Attributes.Name name = (Attributes.Name) entries.next(); if (!name.equals(versionName)) { writeEntry(out, name, manifest.mainAttributes.getValue(name), encoder, buffer);
public void readEntries(Map<String, Attributes> entries, Map<String, Manifest.Chunk> chunks) throws IOException { int mark = pos; while (readHeader()) { if (!Attributes.Name.NAME.equals(name)) { throw new IOException("Entry is not named"); } String entryNameValue = value; Attributes entry = entries.get(entryNameValue); if (entry == null) { entry = new Attributes(12); } while (readHeader()) { entry.put(name, value); } if (chunks != null) { if (chunks.get(entryNameValue) != null) { // TODO A bug: there might be several verification chunks for // the same name. I believe they should be used to update // signature in order of appearance; there are two ways to fix // this: either use a list of chunks, or decide on used // signature algorithm in advance and reread the chunks while // updating the signature; for now a defensive error is thrown throw new IOException("A jar verifier does not support more than one entry with the same name"); } chunks.put(entryNameValue, new Manifest.Chunk(mark, pos)); mark = pos; } entries.put(entryNameValue, entry); } }
public void readEntries(Map<String, Attributes> entries, Map<String, Manifest.Chunk> chunks) throws IOException { int mark = pos; while (readHeader()) { if (!Attributes.Name.NAME.equals(name)) { throw new IOException("Entry is not named"); } String entryNameValue = value; Attributes entry = entries.get(entryNameValue); if (entry == null) { entry = new Attributes(12); } while (readHeader()) { entry.put(name, value); } if (chunks != null) { if (chunks.get(entryNameValue) != null) { // TODO A bug: there might be several verification chunks for // the same name. I believe they should be used to update // signature in order of appearance; there are two ways to fix // this: either use a list of chunks, or decide on used // signature algorithm in advance and reread the chunks while // updating the signature; for now a defensive error is thrown throw new IOException("A jar verifier does not support more than one entry with the same name"); } chunks.put(entryNameValue, new Manifest.Chunk(mark, pos)); mark = pos; } entries.put(entryNameValue, entry); } }
public void readEntries(Map<String, Attributes> entries, Map<String, Manifest.Chunk> chunks) throws IOException { int mark = pos; while (readHeader()) { if (!Attributes.Name.NAME.equals(name)) { throw new IOException("Entry is not named"); } String entryNameValue = value; Attributes entry = entries.get(entryNameValue); if (entry == null) { entry = new Attributes(12); } while (readHeader()) { entry.put(name, value); } if (chunks != null) { if (chunks.get(entryNameValue) != null) { // TODO A bug: there might be several verification chunks for // the same name. I believe they should be used to update // signature in order of appearance; there are two ways to fix // this: either use a list of chunks, or decide on used // signature algorithm in advance and reread the chunks while // updating the signature; for now a defensive error is thrown throw new IOException("A jar verifier does not support more than one entry with the same name"); } chunks.put(entryNameValue, new Manifest.Chunk(mark, pos)); mark = pos; } entries.put(entryNameValue, entry); } }
public void readEntries(Map<String, Attributes> entries, Map<String, Manifest.Chunk> chunks) throws IOException { int mark = pos; while (readHeader()) { if (!Attributes.Name.NAME.equals(name)) { throw new IOException("Entry is not named"); } String entryNameValue = value; Attributes entry = entries.get(entryNameValue); if (entry == null) { entry = new Attributes(12); } while (readHeader()) { entry.put(name, value); } if (chunks != null) { if (chunks.get(entryNameValue) != null) { // TODO A bug: there might be several verification chunks for // the same name. I believe they should be used to update // signature in order of appearance; there are two ways to fix // this: either use a list of chunks, or decide on used // signature algorithm in advance and reread the chunks while // updating the signature; for now a defensive error is thrown throw new IOException("A jar verifier does not support more than one entry with the same name"); } chunks.put(entryNameValue, new Manifest.Chunk(mark, pos)); mark = pos; } entries.put(entryNameValue, entry); } }
public void readEntries(Map<String, Attributes> entries, Map<String, Manifest.Chunk> chunks) throws IOException { int mark = pos; while (readHeader()) { if (!Attributes.Name.NAME.equals(name)) { throw new IOException("Entry is not named"); } String entryNameValue = value; Attributes entry = entries.get(entryNameValue); if (entry == null) { entry = new Attributes(12); } while (readHeader()) { entry.put(name, value); } if (chunks != null) { if (chunks.get(entryNameValue) != null) { // TODO A bug: there might be several verification chunks for // the same name. I believe they should be used to update // signature in order of appearance; there are two ways to fix // this: either use a list of chunks, or decide on used // signature algorithm in advance and reread the chunks while // updating the signature; for now a defensive error is thrown throw new IOException("A jar verifier does not support more than one entry with the same name"); } chunks.put(entryNameValue, new Manifest.Chunk(mark, pos)); mark = pos; } entries.put(entryNameValue, entry); } }
public void readEntries(Map<String, Attributes> entries, Map<String, Manifest.Chunk> chunks) throws IOException { int mark = pos; while (readHeader()) { if (!Attributes.Name.NAME.equals(name)) { throw new IOException("Entry is not named"); } String entryNameValue = value; Attributes entry = entries.get(entryNameValue); if (entry == null) { entry = new Attributes(12); } while (readHeader()) { entry.put(name, value); } if (chunks != null) { if (chunks.get(entryNameValue) != null) { // TODO A bug: there might be several verification chunks for // the same name. I believe they should be used to update // signature in order of appearance; there are two ways to fix // this: either use a list of chunks, or decide on used // signature algorithm in advance and reread the chunks while // updating the signature; for now a defensive error is thrown throw new IOException("A jar verifier does not support more than one entry with the same name"); } chunks.put(entryNameValue, new Manifest.Chunk(mark, pos)); mark = pos; } entries.put(entryNameValue, entry); } }
/** * Returns the class path (if any) from the given manifest file as an * URL list. * * @param manifest manifest file of an archive * @param rootPath root path to the module * * @return a list of URLs * an empty list if given manifest is null */ public static List<URL> getManifestClassPathAsURLs(Manifest manifest, String rootPath) { List<URL> urlList = new ArrayList<URL>(); if (manifest != null) { Attributes mainAttributes = manifest.getMainAttributes(); for (Iterator itr=mainAttributes.keySet().iterator(); itr.hasNext();) { Attributes.Name next = (Attributes.Name) itr.next(); if (next.equals(Attributes.Name.CLASS_PATH)) { String classpathString = (String) mainAttributes.get(next); urlList = getURLsFromClasspath(classpathString, " ", rootPath); } } } return urlList; }
public void readEntries(Map<String, Attributes> entries, Map<String, Manifest.Chunk> chunks) throws IOException { int mark = pos; while (readHeader()) { if (!Attributes.Name.NAME.equals(name)) { throw new IOException("Entry is not named"); } String entryNameValue = value; Attributes entry = entries.get(entryNameValue); if (entry == null) { entry = new Attributes(12); } while (readHeader()) { entry.put(name, value); } if (chunks != null) { if (chunks.get(entryNameValue) != null) { // TODO A bug: there might be several verification chunks for // the same name. I believe they should be used to update // signature in order of appearance; there are two ways to fix // this: either use a list of chunks, or decide on used // signature algorithm in advance and reread the chunks while // updating the signature; for now a defensive error is thrown throw new IOException("A jar verifier does not support more than one entry with the same name"); } chunks.put(entryNameValue, new Manifest.Chunk(mark, pos)); mark = pos; } entries.put(entryNameValue, entry); } }
/** * obtains the MQ Light version information from the manifest. * * @return The MQ Light version. */ public static String getVersion() { String version = "unknown"; final URLClassLoader cl = (URLClassLoader)cclass.getClassLoader(); try { final URL url = cl.findResource("META-INF/MANIFEST.MF"); final Manifest manifest = new Manifest(url.openStream()); for (Entry<Object,Object> entry : manifest.getMainAttributes().entrySet()) { final Attributes.Name key = (Attributes.Name)entry.getKey(); if(Attributes.Name.IMPLEMENTATION_VERSION.equals(key)) { version = (String)entry.getValue(); } } } catch (IOException e) { logger.error("Unable to determine the product version due to error", e); } return version; } }
public boolean accept(Attributes.Name name) { return BUNDLE_CLASSPATH.equals(name); }