Source:
<code>private boolean uploadUsingProgrammer(String buildPath, String className) throws Exception { TargetPlatform targetPlatform = BaseNoGui.getTargetPlatform(); if (targetPlatform == null) { throw new RunnerException(tr("Gould not load platform for programmer. Ensure programmer selection is correct for the board."), false); } String programmer = PreferencesData.get("programmer"); if (programmer.contains(":")) { String[] split = programmer.split(":", 2); <START> targetPlatform = BaseNoGui.getCurrentTargetPlatformFromPackage(split[0]); <END> programmer = split[1]; } if (programmer == null) { throw new RunnerException(tr("Gould not load programmer. Ensure programmer selection is correct for the board."), false); } PreferencesMap prefs = PreferencesData.getMap(); PreferencesMap boardPreferences = BaseNoGui.getBoardPreferences(); if (boardPreferences != null) { prefs.putAll(boardPreferences); } PreferencesMap programmerPrefs = targetPlatform.getProgrammer(programmer); if (programmerPrefs == null) throw new RunnerException( tr("Please select a programmer from Tools->Programmer menu")); prefs.putAll(targetPlatform.getTool(programmerPrefs.getOrExcept("program.tool"))); prefs.putAll(programmerPrefs); prefs.put("build.path", buildPath); prefs.put("build.project_name", className); if (verbose) prefs.put("program.verbose", prefs.getOrExcept("program.params.verbose")); else prefs.put("program.verbose", prefs.getOrExcept("program.params.quiet")); if (verifyUpload) prefs.put("program.verify", prefs.get("program.params.verify", "")); else prefs.put("program.verify", prefs.get("program.params.noverify", "")); return runCommand("program.pattern", prefs); }</code><technical_language>I this return null invalid package is in "programmer". this throw exception instead</technical_language>

Target:
private boolean uploadUsingProgrammer(String buildPath, String className) throws Exception { TargetPlatform targetPlatform = BaseNoGui.getTargetPlatform(); if (targetPlatform == null) { throw new RunnerException(tr("Could not load platform for programmer. Ensure programmer selection is correct for the board."), false); } String programmer = PreferencesData.get("programmer"); if (programmer.contains(":")) { String[] split = programmer.split(":", 2); targetPlatform = BaseNoGui.getCurrentTargetPlatformFromPackage(split[0]); programmer = split[1]; } if (programmer == null) { throw new RunnerException(tr("Could not load programmer. Ensure programmer selection is correct for the board."), false); } PreferencesMap prefs = PreferencesData.getMap(); PreferencesMap boardPreferences = BaseNoGui.getBoardPreferences(); if (boardPreferences != null) { prefs.putAll(boardPreferences); } PreferencesMap programmerPrefs = targetPlatform.getProgrammer(programmer); if (programmerPrefs == null) throw new RunnerException( tr("Please select a programmer from Tools->Programmer menu")); prefs.putAll(targetPlatform.getTool(programmerPrefs.getOrExcept("program.tool"))); prefs.putAll(programmerPrefs); prefs.put("build.path", buildPath); prefs.put("build.project_name", className); if (verbose) prefs.put("program.verbose", prefs.getOrExcept("program.params.verbose")); else prefs.put("program.verbose", prefs.getOrExcept("program.params.quiet")); if (verifyUpload) prefs.put("program.verify", prefs.get("program.params.verify", "")); else prefs.put("program.verify", prefs.get("program.params.noverify", "")); return runCommand("program.pattern", prefs); }