[jbosstools-commits] JBoss Tools SVN: r43934 - trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Sep 21 12:14:36 EDT 2012


Author: fbricon
Date: 2012-09-21 12:14:36 -0400 (Fri, 21 Sep 2012)
New Revision: 43934

Modified:
   trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectExampleUtil.java
Log:
JBIDE-12472	: files read from github can not be cached as their lastmodified date is 0.

Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectExampleUtil.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectExampleUtil.java	2012-09-21 16:01:26 UTC (rev 43933)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectExampleUtil.java	2012-09-21 16:14:36 UTC (rev 43934)
@@ -778,14 +778,13 @@
 						return file;
 					}
 				}
-				if (urlModified == 0) {
-					if (file.exists()) {
-						return file;
-					}
-				}
+				//!!! urlModified == 0 when querying files from github 
+				//It means that files from github can not be cached! 
 				if (file.exists()) {
 					long modified = file.lastModified();
-					if (urlModified == modified) {
+					if (modified > 0 && //file already exists and doesn't come from github (or other server sending lastmodified = 0) 
+							(urlModified == 0 //and now there is a problem downloading the file
+							|| urlModified == modified )) {//or the file hasn't changed
 						return file;
 					}
 				}
@@ -795,9 +794,6 @@
 				if (monitor.isCanceled()) {
 					return null;
 				}
-				if (monitor.isCanceled()) {
-					return null;
-				}
 				BufferedOutputStream destination = new BufferedOutputStream(
 						new FileOutputStream(file));
 				IStatus result = getTransport().download(prefix,



More information about the jbosstools-commits mailing list