Source:
<code>public HttpResponse doUploadPlugin(StaplerRequest req) throws IOException, ServletException { try { Jenkins.getInstance().checkPermission(UPLOAD_PLUGINS); ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory()); FileItem fileItem = (FileItem) upload.parseRequest(req).get(0); String fileName = Util.getFileName(fileItem.getName()); if("".equals(fileName)){ return new HttpRedirect("advanced"); } if(!fileName.endsWith(".jpi") && !fileName.endsWith(".hpi")){ throw new Failure(hudson.model.Messages.Hudson_NotAPlugin(fileName)); } File t = File.createTempFile("uploaded", ".jpi"); t.deleteOnExit(); fileItem.write(t); fileItem.delete(); final String baseName = identifyPluginShortName(t); pluginUploaded = true; JSONArray dependencies = new JSONArray(); try { Manifest m = new JarFile(t).getManifest(); String deps = m.getMainAttributes().getValue("Plugin-Dependencies"); if (StringUtils.isNotBlank(deps)) { String[] plugins = deps.split(","); for (String p : plugins) { <START> String[] attrs = p.split("[:;]"); <END> dependencies.add(new JSONObject() .element("name", attrs[0]) .element("version", attrs[1]) .element("optional", p.contains("resolution:=optional"))); } } } catch(IOException e) { } JSONObject cfg = new JSONObject(). element("name", baseName). element("version", "0"). element("url", t.toURI().toString()). element("dependencies", dependencies); new UpdateSite(UpdateCenter.ID_UPLOAD, null).new Plugin(UpdateCenter.ID_UPLOAD, cfg).deploy(true); return new HttpRedirect("../updateCenter"); } catch (IOException e) { throw e; } catch (Exception e) { throw new ServletException(e); } }</code><technical_language>simplified code in #2172 I think</technical_language>

Target:
public HttpResponse doUploadPlugin(StaplerRequest req) throws IOException, ServletException { try { Jenkins.getInstance().checkPermission(UPLOAD_PLUGINS); ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory()); FileItem fileItem = (FileItem) upload.parseRequest(req).get(0); String fileName = Util.getFileName(fileItem.getName()); if("".equals(fileName)){ return new HttpRedirect("advanced"); } if(!fileName.endsWith(".jpi") && !fileName.endsWith(".hpi")){ throw new Failure(hudson.model.Messages.Hudson_NotAPlugin(fileName)); } File t = File.createTempFile("uploaded", ".jpi"); t.deleteOnExit(); fileItem.write(t); fileItem.delete(); final String baseName = identifyPluginShortName(t); pluginUploaded = true; JSONArray dependencies = new JSONArray(); try { Manifest m = new JarFile(t).getManifest(); String deps = m.getMainAttributes().getValue("Plugin-Dependencies"); if (StringUtils.isNotBlank(deps)) { String[] plugins = deps.split(","); for (String p : plugins) { String[] attrs = p.split("[:;]"); dependencies.add(new JSONObject() .element("name", attrs[0]) .element("version", attrs[1]) .element("optional", p.contains("resolution:=optional"))); } } } catch(IOException e) { LOGGER.log(WARNING, "Unable to setup dependency list for plugin upload", e); } JSONObject cfg = new JSONObject(). element("name", baseName). element("version", "0"). element("url", t.toURI().toString()). element("dependencies", dependencies); new UpdateSite(UpdateCenter.ID_UPLOAD, null).new Plugin(UpdateCenter.ID_UPLOAD, cfg).deploy(true); return new HttpRedirect("../updateCenter"); } catch (IOException e) { throw e; } catch (Exception e) { throw new ServletException(e); } }