CraftonOReilly / workspacemechanic

Automatically exported from code.google.com/p/workspacemechanic
0 stars 0 forks source link

Enhancement+patch : use MD5 hash from contents instead of last modification date to detect that a LastMod task has changed #86

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Configure a LastMod task, by URI, and publish it on a web provider that does 
not support HEAD method, or does not reflect the file's modification date (ie, 
the http last modification date field is always 'now')
2. Play your task with workspacemechanic => OK
3. Ask again workspacemechanic to check if it has something to do => KO, it 
will say yes while the task has not changed

What is the expected output? What do you see instead?
I expect workspacemechanic to detect that the task has not changed, so it stops 
borring me at each of its runs.
Ok, I know that all of that come from my web provider mishandling the last 
modification date http field, but sadly, I do not have the power to change that 
:(

What version of the product are you using? On what operating system?
0.1.5 / Ubuntu 64bits / Windows XP/7 32bits / Windows 7 64bits

Please provide any additional information below.
Attached is a proposal of patch :)

Original issue reported on code.google.com by benoit.g...@gmail.com on 26 Feb 2012 at 3:15

Attachments:

GoogleCodeExporter commented 8 years ago
You can see the patch on my github clone :
https://github.com/bguerin/workspacemechanic/commit/ea5ec6f7f0ea692f7c2720344d6a
322ba59be886

Original comment by benoit.g...@gmail.com on 4 Mar 2012 at 6:25

GoogleCodeExporter commented 8 years ago
This is a very clever idea. Let me think about this over the weekend. Also, to 
submit patches to Google projects, you need to sign a Contributor License 
Agreement [1]. Have you done that?

[1] 
http://code.google.com/a/eclipselabs.org/p/workspacemechanic/wiki/ContributorLic
enseAgreements

Original comment by konigsb...@gmail.com on 23 Jun 2012 at 3:49

GoogleCodeExporter commented 8 years ago
Just done :)

Original comment by benoit.g...@gmail.com on 23 Jun 2012 at 11:23

GoogleCodeExporter commented 8 years ago
Good morning!

This looks like a nice idea. I slept on it, and I like it very much.

I found some coding issues which I'd address, but aren't a big deal, but 
there's IMO one fundamental thing I'd like to change: use MD5 solely for 
non-file: URI tasks. Using md5 for all tasks means reading the full contents of 
every task on every update, rather than the much faster time modification scan. 
I have many tasks from multiple places. So, I'd rather this not be determined 
by preference, but instead, by task type. What do you think?

Original comment by konigsb...@gmail.com on 23 Jun 2012 at 12:31

GoogleCodeExporter commented 8 years ago
I'm pretty sure it's as simple as changing 

LastModifiedPreferencesFileTask.evaluate to:
  public boolean evaluate() {
    return taskRef.asFile() == null ? evaluateByMD5() : evaluateByModificationDate();
  }

and then removing all the preferences code.

Original comment by konigsb...@gmail.com on 23 Jun 2012 at 12:47

GoogleCodeExporter commented 8 years ago
If you want :)

I done this because my tasks are on a webserver which always returns "now" when 
the plugin asks for the modification date.
Until this problem keeps fixed, I think you are better placed than me to decide 
what to do :)

Original comment by benoit.g...@gmail.com on 23 Jun 2012 at 12:56

GoogleCodeExporter commented 8 years ago
Aw, damn. I did some reading and here's the problem:

 * MD5 utilities class, copied from apache-commons-codec

Unless you were the original author of the md5 code, I can't accept the patch 
as-is. I'll see if I can find an alternative. (Perhaps there's something 
already available in Eclipse plug-ins?)

Original comment by konigsb...@gmail.com on 23 Jun 2012 at 1:01

GoogleCodeExporter commented 8 years ago
Aha! Never mind, we'll be fine. 
http://docs.guava-libraries.googlecode.com/git-history/release/javadoc/com/googl
e/common/hash/Hashing.html#md5()

Original comment by konigsb...@gmail.com on 23 Jun 2012 at 1:02

GoogleCodeExporter commented 8 years ago
I haven't significantly tested this, but take a look at head. It requires a new 
version of Guava, so you'll need to pull at least the last two commits. Do you 
want me to build another testing repository?

Original comment by konigsb...@gmail.com on 23 Jun 2012 at 1:39

GoogleCodeExporter commented 8 years ago
Great !

> Do you want me to build another testing repository?
No, thanks, I will pull, build and test by myself, do not worry with that

Will provide feedback ASAP :)

Original comment by benoit.g...@gmail.com on 23 Jun 2012 at 1:45

GoogleCodeExporter commented 8 years ago
Great! Please contact me via email if you prefer  - my account name at gmail.com

Original comment by konigsb...@gmail.com on 23 Jun 2012 at 1:47

GoogleCodeExporter commented 8 years ago

Original comment by konigsb...@gmail.com on 9 Jul 2012 at 3:05

GoogleCodeExporter commented 8 years ago
Sorry for the delay ... but I tested 0.3.2 and it works great !
Thanks !

Original comment by benoit.g...@gmail.com on 8 Aug 2012 at 10:45

GoogleCodeExporter commented 8 years ago

Original comment by konigsb...@gmail.com on 8 Aug 2012 at 11:35