Closed muffl0n closed 10 years ago
The exception is thrown to short circuit the change detection logic. Once a group has been detected as changed, there is no need to continue checking other resources.
I understand your confusion. I think one approach would be throwing a dedicated exception instead, and treating it differently (not logging). Other thoughts?
First thing I learned when programming Java was: "Don't use exceptions if it's not really an exception." :) In other words: I would not throw an exception for a logic that is totally ok and normal. Couldn't apply() return something other than Void? Maybe a bool that tells the calling Processor to continue or not?
I'm sorry that I can not be more helpful but I'm still trying to understand the Processor/func-logic in ResourceChangeHandler and haven't got so far as I wished I had. :)
But maybe throwing a special exception that is treated differently would be a solution for the time being at least.
I agree that in this case the exception is misused. Changing the func to return a boolean could work, but it require few changes. If you have time, could you give it a try and see how it looks like? The unit tests should help to identify if everything works as expected and nothing is broken.
I gave my best in PR #201. I'm really not sure that this does not break anything. My project builds just fine and the tests don't fail. But I have kind of a mixed feeling about this whole thing. :)
Looking forward to hearing your opinion on this.
Looks good to me. Will merege it soon...
Thank you! Looks good for my coworkers and me so far. :)
@muffl0n I should thank you :).. Most of the recent issues are fixed by you. Great job! If you have any other suggestions or ideas, please let me know.
Btw, would you like me to add you to the wro4j github organization? I really appreciate your help.
Just polishing the edges of a really nice plugin. Nice to see that you are keeping on maintaining the code and accept PRs. You can add me to the organization. I don't know exactly what this means, but it sound's cool. :)
I've created the github organization to host other wro4j related project. The wro4j code base is not yet migrated there, but I'm planning to do it at some point of the future. Also the organization is a good place for documentation and other small projects which have similar concerns.
For better comprehensibility I pushed my test-project to muffl0n/wro4j-scss-test.
When I execute maven with goal compile on this project (using current 1.7.7-SNAPSHOT) I encounter this exception when compiling after changed the file
/src/main/webapp/scss/header.scss
:Everything is generated correctly but this error does confuse me and will confuse others.
The problem seems to be the WroRuntimeException that is thrown in ro.isdc.wro.maven.plugin.support.ResourceChangeHandler.detectChangeForCssImports():
and logged in ro.isdc.wro.maven.plugin.support.ResourceChangeHandler.createCssImportProcessor():
I'm not quite sure how to handle this. I feel like throwing an exception if the file has changed is not the right way. But I'm not sure what option would be better.