jmini / Eclipse-Copyright-Generator

Fork of http://sourceforge.net/projects/eclipsecopyrigh/
Eclipse Public License 1.0
7 stars 12 forks source link

Destroying source file on syntax error #7

Open ghost opened 6 years ago

ghost commented 6 years ago

Dear Jérémie,

Today I found a rather dangerous issue with your copyright generator. In the plugin settings header tab I wrote my own copyright header. But I thought I had to write this header in the form of a comment:

/*
 * Copyright etc...
 */

After running the generator it turned out that it generates comments by itself. So the copyright headers became:

/*********
 * /*
 *  * Copyright etc...
 *  */            <- multiline comments ends here
 **********/      <- syntax error

This gives a syntax error. Then I fixed the copyright header in the plugin settings and ran the generator again to replace the (erroneous) headers.

Because of the syntax error however, the generator replaced not only the erroneous headers, but the complete source. And that for of every single file in the project. That means the whole project was wiped with no option to recover.

Luckily I tried the generator with an old project first, so that this wasn't too much of a disaster. But it may be good to have a look at how the generator copes with syntax errors in general... Perhaps forbid the plugin to run as long as there are syntax errors?

Kind regards, Wouter