diff options
author | Noel Grandin <noel@peralex.com> | 2012-06-18 18:45:19 +0200 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2012-06-20 10:26:52 +0200 |
commit | 197d1c2dfc562dbfb9ad746244ffa7276dd4c1f7 (patch) | |
tree | f058d213ed52e49ff22d6036600869643b9d74ef /qadevOOo | |
parent | 2554f08f6544c54e45a5fc660d65d50ef3f29aed (diff) |
Convert date/calendar code to avoid deprecation warnings
Change-Id: Ib9a3e9620064aaea3d51f432b523861656363f7e
Signed-off-by: Fridrich Štrba <fridrich.strba@bluewin.ch>
Diffstat (limited to 'qadevOOo')
-rw-r--r-- | qadevOOo/tests/java/ifc/ucb/_XSimpleFileAccess.java | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/qadevOOo/tests/java/ifc/ucb/_XSimpleFileAccess.java b/qadevOOo/tests/java/ifc/ucb/_XSimpleFileAccess.java index cb58dde31f25..a5b3e763f3f6 100644 --- a/qadevOOo/tests/java/ifc/ucb/_XSimpleFileAccess.java +++ b/qadevOOo/tests/java/ifc/ucb/_XSimpleFileAccess.java @@ -37,6 +37,9 @@ import com.sun.star.ucb.XSimpleFileAccess; import com.sun.star.uno.UnoRuntime; import com.sun.star.util.DateTime; +import java.util.Calendar; +import java.util.GregorianCalendar; + /** * Testing <code>com.sun.star.ucb.XSimpleFileAccess</code> * interface methods. <p> @@ -347,28 +350,30 @@ public class _XSimpleFileAccess extends MultiMethodTest { java.io.File the_file = new java.io.File(filename); long lastModified = the_file.lastModified(); java.util.Date lastMod = new java.util.Date(lastModified); + GregorianCalendar lastModCal = new GregorianCalendar(); + lastModCal.setTime(lastMod); //compare the dates gained by java with those gained by this method boolean res = true; - boolean partResult = (fTime.Day == lastMod.getDay()); + boolean partResult = (fTime.Day == lastModCal.get(Calendar.DAY_OF_WEEK)); if (!partResult) { log.println("Wrong Day"); - log.println("Expected: "+lastMod.getDay()); + log.println("Expected: "+lastModCal.get(Calendar.DAY_OF_WEEK)); log.println("Gained: "+fTime.Day); log.println("------------------------------"); } - partResult = (fTime.Month == lastMod.getMonth()); + partResult = (fTime.Month == lastModCal.get(Calendar.MONTH)); if (!partResult) { log.println("Wrong Month"); - log.println("Expected: "+lastMod.getMonth()); + log.println("Expected: "+lastModCal.get(Calendar.MONTH)); log.println("Gained: "+fTime.Month); log.println("------------------------------"); } - partResult = (fTime.Year == lastMod.getYear()); + partResult = (fTime.Year == (lastModCal.get(Calendar.MONTH) - 1900)); if (!partResult) { log.println("Wrong Year"); - log.println("Expected: "+lastMod.getYear()); + log.println("Expected: "+(lastModCal.get(Calendar.MONTH) - 1900)); log.println("Gained: "+fTime.Year); log.println("------------------------------"); } |