Skip to content

Commit

Permalink
IEP-1301: Null Build error if you're building a project with out any …
Browse files Browse the repository at this point in the history
…esp-idf version (#1062)

* fix(build_error): fixed the error message in case the toolchains are missing

* Updated the message
  • Loading branch information
alirana01 authored Nov 19, 2024
1 parent ed9e5d1 commit f0c20d6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.debug.core.DebugPlugin;
Expand Down Expand Up @@ -278,7 +280,12 @@ private IBinary[] getBuildOutput(final IBinaryContainer binaries, final IPath ou
public ICMakeToolChainFile getToolChainFile() throws CoreException
{
ICMakeToolChainManager manager = IDFCorePlugin.getService(ICMakeToolChainManager.class);
this.toolChainFile = manager.getToolChainFileFor(getToolChain());
IToolChain toolChain = getToolChain();
if (toolChain == null)
{
throw new CoreException(new Status(IStatus.ERROR, IDFCorePlugin.PLUGIN_ID, Messages.IDFToolChainsMissingErrorMsg));
}
this.toolChainFile = manager.getToolChainFileFor(toolChain);
return toolChainFile;

Check warning on line 289 in bundles/com.espressif.idf.core/src/com/espressif/idf/core/build/IDFBuildConfiguration.java

View workflow job for this annotation

GitHub Actions / spotbugs

EI_EXPOSE_REP

com.espressif.idf.core.build.IDFBuildConfiguration.getToolChainFile() may expose internal representation by returning IDFBuildConfiguration.toolChainFile
Raw output
Returning a reference to a mutable object value stored in one of the object's fields exposes the internal representation of the object.  If instances are accessed by untrusted code, and unchecked changes to the mutable object would compromise security or other important properties, you will need to do something different. Returning a new copy of the object is better approach in many situations.
}

Expand Down Expand Up @@ -388,6 +395,8 @@ private boolean buildPrechecks(IConsole console) throws Exception

return false;
}



return true;

Check warning on line 401 in bundles/com.espressif.idf.core/src/com/espressif/idf/core/build/IDFBuildConfiguration.java

View workflow job for this annotation

GitHub Actions / spotbugs

THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION

Method lists Exception in its throws clause.
Raw output
Method lists Exception in its throws clause.
When declaring a method, the types of exceptions in the throws clause should be the most specific. Therefore, using Exception in the throws clause would force the caller to either use it in its own throws clause, or use it in a try-catch block (when it does not necessarily contain any meaningful information about the thrown exception).

For more information, see the SEI CERT ERR07-J rule [https://wiki.sei.cmu.edu/confluence/display/java/ERR07-J.+Do+not+throw+RuntimeException%2C+Exception%2C+or+Throwable].
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class Messages extends NLS
public static String ToolsInitializationDifferentPathMessageBoxTitle;
public static String ToolsInitializationDifferentPathMessageBoxOptionYes;
public static String ToolsInitializationDifferentPathMessageBoxOptionNo;
public static String IDFToolChainsMissingErrorMsg;

public static String RefreshingProjects_JobName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ ToolsInitializationDifferentPathMessageBoxOptionYes=Use New Path
ToolsInitializationDifferentPathMessageBoxOptionNo=Use Old Path
RefreshingProjects_JobName=Refreshing Projects...
IDFBuildConfiguration_PreCheck_DifferentIdfPath=The project was built using the ESP-IDF located at the {0} path.\nThe currently active ESP-IDF path in the IDE is {1}.\nPlease clean the project using "ESP-IDF:Project Full Clean" menu option to use the active ESP-IDF configuration.
IDFToolChainsMissingErrorMsg=Toolchains are missing. Please use ESP-IDF Manager for configuring

0 comments on commit f0c20d6

Please sign in to comment.