final String patchPath = patchID + ".zip"; entries.add(new BundledPatch.BundledPatchEntry(patchID, patchPath));
if (identity.getAllInstalledPatches().contains(entry.getPatchId())) { alreadyApplied = true; break; final File patch = new File(workDir, entry.getPatchPath()); final FileInputStream is = new FileInputStream(patch); PatchingResult currentResult = null; rollback(committed.getPatchId(), contentPolicy, false, false).commit(); } catch (PatchingException oe) { PatchLogger.ROOT_LOGGER.debugf(oe, "failed to rollback patch '%s'", committed.getPatchId());
IoUtils.copy(zippedCP, new File(patchBundleDir, zippedCP.getName())); final List<BundledPatch.BundledPatchEntry> bundledPatches = new ArrayList<BundledPatch.BundledPatchEntry>(); bundledPatches.add(new BundledPatch.BundledPatchEntry(patchID, zippedOneOff.getName())); bundledPatches.add(new BundledPatch.BundledPatchEntry(patchID2, zippedCP.getName())); TestUtils.createPatchBundleXMLFile(patchBundleDir, bundledPatches); final File zippedBundle = createZippedPatchFile(patchBundleDir, "patch-bundle.zip");
final File patchOutput = new File(tempDir, path); ZipUtils.zip(step.getPatchDir(), patchOutput); entries.add(new BundledPatch.BundledPatchEntry(patchId, path));
final ZipEntry bundledZip = patchZip.getEntry(bundledPatch.getPatchPath()); if (bundledZip == null) { throw new CommandException("Patch file not found in the bundle: " + bundledPatch.getPatchPath()); throw new CommandLineException("Failed to locate " + PatchXml.PATCH_XML + " in bundled patch " + bundledPatch.getPatchPath()); ctx.printLine("CONTENT OF " + bundledPatch.getPatchPath() + ':' + Util.LINE_SEPARATOR); ctx.printLine(""); } catch (Exception e) { throw new CommandException("Failed to inspect " + bundledPatch.getPatchPath(), e); } finally { IoUtils.safeClose(bundledPatchIs);
final ZipEntry bundledZip = patchZip.getEntry(bundledPatch.getPatchPath()); if(bundledZip == null) { throw new CommandLineException("Patch file not found in the bundle: " + bundledPatch.getPatchPath()); throw new CommandLineException("Failed to locate " + PatchXml.PATCH_XML + " in bundled patch " + bundledPatch.getPatchPath()); ctx.printLine("CONTENT OF " + bundledPatch.getPatchPath() + ':' + Util.LINE_SEPARATOR); ctx.printLine(""); } catch (Exception e) { throw new CommandLineException("Failed to inspect " + bundledPatch.getPatchPath(), e); } finally { IoUtils.safeClose(bundledPatchIs);
final ZipEntry bundledZip = patchZip.getEntry(bundledPatch.getPatchPath()); if (bundledZip == null) { throw new CommandException("Patch file not found in the bundle: " + bundledPatch.getPatchPath()); throw new CommandLineException("Failed to locate " + PatchXml.PATCH_XML + " in bundled patch " + bundledPatch.getPatchPath()); ctx.printLine("CONTENT OF " + bundledPatch.getPatchPath() + ':' + Util.LINE_SEPARATOR); ctx.printLine(""); } catch (Exception e) { throw new CommandException("Failed to inspect " + bundledPatch.getPatchPath(), e); } finally { IoUtils.safeClose(bundledPatchIs);
final ZipEntry bundledZip = patchZip.getEntry(bundledPatch.getPatchPath()); if(bundledZip == null) { throw new CommandLineException("Patch file not found in the bundle: " + bundledPatch.getPatchPath()); throw new CommandLineException("Failed to locate " + PatchXml.PATCH_XML + " in bundled patch " + bundledPatch.getPatchPath()); ctx.printLine("CONTENT OF " + bundledPatch.getPatchPath() + ':' + Util.LINE_SEPARATOR); ctx.printLine(""); } catch (Exception e) { throw new CommandLineException("Failed to inspect " + bundledPatch.getPatchPath(), e); } finally { IoUtils.safeClose(bundledPatchIs);
if (identity.getAllInstalledPatches().contains(entry.getPatchId())) { alreadyApplied = true; break; final File patch = new File(workDir, entry.getPatchPath()); final FileInputStream is = new FileInputStream(patch); PatchingResult currentResult = null; rollback(committed.getPatchId(), contentPolicy, false, false).commit(); } catch (PatchingException oe) { PatchLogger.ROOT_LOGGER.debugf(oe, "failed to rollback patch '%s'", committed.getPatchId());
private void parseElement(XMLExtendedStreamReader reader, List<BundledPatch.BundledPatchEntry> patches) throws XMLStreamException { String id = null; String path = null; final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case ID: id = value; break; case PATH: path = value; break; default: throw unexpectedAttribute(reader, i); } } if (id == null) { throw missingRequired(reader, Attribute.ID.name); } if (path == null) { throw missingRequired(reader, Attribute.PATH.name); } // requireNoContent(reader); patches.add(new BundledPatch.BundledPatchEntry(id, path)); }
private void parseElement(XMLExtendedStreamReader reader, List<BundledPatch.BundledPatchEntry> patches) throws XMLStreamException { String id = null; String path = null; final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case ID: id = value; break; case PATH: path = value; break; default: throw unexpectedAttribute(reader, i); } } if (id == null) { throw missingRequired(reader, Attribute.ID.name); } if (path == null) { throw missingRequired(reader, Attribute.PATH.name); } // requireNoContent(reader); patches.add(new BundledPatch.BundledPatchEntry(id, path)); }
@Override public void rollback() { last.rollback(); // Rollback the last for (final BundledPatch.BundledPatchEntry entry : committed) { try { PatchToolImpl.this.rollback(entry.getPatchId(), policy, false, false).commit(); } catch (Exception e) { PatchLogger.ROOT_LOGGER.debugf(e, "failed to rollback patch '%s'", entry.getPatchId()); } } } }
@Override public void rollback() { last.rollback(); // Rollback the last for (final BundledPatch.BundledPatchEntry entry : committed) { try { PatchToolImpl.this.rollback(entry.getPatchId(), policy, false, false).commit(); } catch (Exception e) { PatchLogger.ROOT_LOGGER.debugf(e, "failed to rollback patch '%s'", entry.getPatchId()); } } } }
@Override public void writeContent(XMLExtendedStreamWriter writer, BundledPatch bundledPatch) throws XMLStreamException { writer.writeStartElement(Element.PATCHES.name); writer.writeDefaultNamespace(PatchXml.Namespace.PATCH_BUNDLE_1_0.getNamespace()); for (final BundledPatch.BundledPatchEntry entry : bundledPatch.getPatches()) { writer.writeEmptyElement(Element.PATCH_ELEMENT.name); writer.writeAttribute(Attribute.ID.name, entry.getPatchId()); writer.writeAttribute(Attribute.PATH.name, entry.getPatchPath()); } writer.writeEndElement(); } }
@Override public void writeContent(XMLExtendedStreamWriter writer, BundledPatch bundledPatch) throws XMLStreamException { writer.writeStartElement(Element.PATCHES.name); writer.writeDefaultNamespace(PatchXml.Namespace.PATCH_BUNDLE_1_0.getNamespace()); for (final BundledPatch.BundledPatchEntry entry : bundledPatch.getPatches()) { writer.writeEmptyElement(Element.PATCH_ELEMENT.name); writer.writeAttribute(Attribute.ID.name, entry.getPatchId()); writer.writeAttribute(Attribute.PATH.name, entry.getPatchPath()); } writer.writeEndElement(); } }