...The story of gatherer accord in the beginning of the forty years immediately after the story of the spies as it says in the Midrash his intent was for the sake of heaven as the Jewish people were saying it was decreed on us not to enter the land..we are not obligated in the Mitzvoet. He went and violated Shabbos in order to be killed so others will see...
ויש שאלו בזה בת"י היאך חטא באיסור שבת כדי לידע באיזה מיתה דנין המחלל שבת וי"ל כיון שלא היה צריך למלאכה זו אלא לידע באיזו מיתה כו' ה"ל מלאכה שאינה צריכה לגופה כמו חופר גומא וא"צ אלא לעפרה שהוא פטור לר"ש ומיהו הוא ודאי דהיה חייב מיתה בדיני אדם שלא ידעו העדים שהתרו בו שהוא עשה על דעת זו ואינן אלא דברים שבלב ודנין היו אותו למיתה ע"פ העדות וכן י"ל לפי המדרש שכתבו התוס' לקמן דצלפחד היינו מקושש והיה בתחלת מ' שנה ולשם שמים נתכוין שהיו אומרים כיון שנגזר עליהם שלא ליכנס לארץ ממעשה המרגלים שוב אין חייבים במצות עמד וחילל שבת כדי שיהרג ויראו אחרים עכ"ל דה"ל נמי מלאכה שאינה צריכה לגופה וק"ל:
...Our sages, quoted in a Tossaphot Baba Batra 119, claim that the individual gathering firewood on the Sabbath and subsequently executed for having violated the Sabbath (Numbers 15,32-36) had committed his sin with a noble motive, i.e. to demonstrate the Torah’s warning of the penalty dealt out to the deliberate transgressor is not an empty threat. He did not want his peers to think that seeing that they would not enter the Holy Land anyways that the Torah laws no longer applied to them.
The whole episode of the Israelite gathering firewood is puzzling even without this especial motivation that he supposedly had for this. We have a general rule that when a major violation of the Sabbath is performed without the intention being that this act is the one intended, i.e. that it had been used for when building the Tabernacle (מלאכה שאינו צריכה לגופה), the act is not punishable by death. Seeing that this is so the execution of this individual appears highly questionable, as what he did was not the classic desecration of the Sabbath. We must therefore conclude that his execution was a signal to the other Israelites not to consider Torah laws as no longer binding for the adults who would not enter the Holy Land.