code: @SuppressWarnings("ThrowFromFinallyBlock")
      private void updateByXml(final P project, Source source) throws IOException {
          project.checkPermission(Item.CONFIGURE);
          final String projectName = project.getName();
          XmlFile configXmlFile = project.getConfigFile();
          final AtomicFileWriter out = new AtomicFileWriter(configXmlFile.getFile());
          try {
              try {
                  XMLUtils.safeTransform(source, new StreamResult(out));
                  out.close();
              } catch (SAXException | TransformerException e) {
                  throw new IOException("Failed to persist config.xml", e);
              }
  
              // try to reflect the changes by reloading
              Object o = new XmlFile(Items.XSTREAM, out.getTemporaryFile()).unmarshal(project);
              if (o != project) {
                  // ensure that we've got the same job type. extending this code to support updating
                  // to different job type requires destroying & creating a new job type
                  throw new IOException("Expecting " + project.getClass() + " but got " + o.getClass() + " instead");
              }
  
              Items.whileUpdatingByXml(new NotReallyRoleSensitiveCallable<Void, IOException>() {
                  @SuppressWarnings("unchecked")
                  @Override
                  public Void call() throws IOException {
                      project.onLoad(project.getParent(), projectName);
                      return null;
                  }
              });
              Jenkins.getActiveInstance().rebuildDependencyGraphAsync();
  
              // if everything went well, commit this new version
              out.commit();
          } finally {
              out.abort();
          }
      }
docs: This is a mirror of {@link hudson.model.AbstractItem#updateByXml(Source)} without the
  {@link hudson.model.listeners.SaveableListener#fireOnChange(Saveable, XmlFile)} trigger.
  
  @param project project to update by XML
  @param source  source of XML
  @throws IOException if error performing update