JavaʱÇøbug£¬TimeZone.setDefault()Ö»ÔÚµ±Ç°Ïß³ÌÓÐЧ
ÏîÄ¿ÊÇ»ùÓÚGMTʱ¼äµÄ£¬ÔÚϵͳÆô¶¯µÄʱºò£¬ÎÒÃǾͻáµ÷ÓÃTimeZone.setDefault(timeZone)½«Ä¬ÈÏʱÇøÉèΪGMT¡£
ºóÀ´Í»È»·¢ÏÖ£¬ÓÐʱÓû§Ñ¡ÔñµÄʱ¼ä¾¹ýºǫ́һȦºó»Ø²úÉú8¸öСʱÎó²î¡£ÓÖÊǼäЪÐԵģ¬ÒªËûÖØÏÖµÄʱºòÓÖÆ«²»À´¡£¿àÐÄdebug£¬ÖÕÓÚ·¢ÏÖÔÚ²¿·ÖÏß³ÌÖУ¬Ê±Çø»¹ÊÇGMT+8£¬ºǫ́ij¸öµ÷ÓÿÉÄÜ°ÑʱÇø±äΪÁËGMT£¬8СʱÎó²î¾Í²úÉúÁË¡£ÍøÉÏÒ»ËÑ£¬ÔÀ´ÊÇbug£º
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6352812
Ö»ÔÚ²¿·ÖµçÄÔÉÏÓÐÎÊÌ⣬ÐÒºÃproductionÉÏÊǺõģ¬Ð´ÁËÒ»¸ö³ÌÐòÀ´²âÊÔ£º
import java.util.Date;
import java.util.TimeZone;
public class Test {
@SuppressWarnings("unused")
public static void main(String[] args) throws InterruptedException {
DateThread thread = new DateThread();
thread.start();
TimeZone gmt = TimeZone.getTimeZone("GMT");
Date now = new Date();
System.out.println("main thread,before set timezone:" + now.toString());
TimeZone.setDefault(gmt);
Thread.currentThread().sleep(2000);
thread.resume();
System.out.println("main thread,after set timezone:" + now.toString());
}
}
class DateThread extends Thread {
@SuppressWarnings( { "unused", "deprecation" })
public void run() {
Date now = new Date();
System.out.println("sub thread,before set timezone:" + now.toString());
this.suspend();
System.out.println("sub thread,after set timezone:" + now.toString());
}
}
Èç¹û×ÓÏß³ÌÊä³öµÄʱÇøÒ»Ñù£¬¾Í˵Ã÷ÓÐbug
Ïà¹ØÎĵµ£º
ÔÚJAVAÎļþÖлñÈ¡¸ÃÏîÄ¿µÄÏà¶Ô·¾¶
1.»ù±¾¸ÅÄîµÄÀí½â
¡¡¡¡¾ø¶Ô·¾¶£º¾ø¶Ô·¾¶¾ÍÊÇÄãµÄÖ÷Ò³ÉϵÄÎļþ»òĿ¼ÔÚÓ²ÅÌÉÏÕæÕýµÄ·¾¶£¬(URLºÍÎïÀí·¾¶)ÀýÈ磺
C:\xyz\test.txt ´ú±íÁËtest.txtÎļþµÄ¾ø¶Ô·¾¶¡£http://www.sun.com/index.htmÒ²´ú±íÁËÒ»¸ö
URL¾ø¶Ô·¾¶¡£
¡¡¡¡Ïà¶Ô·¾¶£ºÏà¶ÔÓëij¸ö»ù׼Ŀ¼µÄ·¾¶¡£°üº¬WebµÄ ......
1. ʼÖÕʹÓà MVC ¿ò¼Ü¡£
½«ÒµÎñÂß¼£¨Java Bean ºÍ EJB ×é¼þ£©´Ó¿ØÖÆÆ÷Âß¼£¨Servlet/Struts ²Ù×÷£©ºÍ±íʾÂß¼£¨JSP¡¢XML/XSLT£©ÖÐÇåÎúµØ·ÖÀë³öÀ´¡£Á¼ºÃµÄ·Ö²ã¿ÉÒÔ´øÀ´Ðí¶àºÃ´¦¡£
×¢:¶ÔÓÚһЩСÐ͵ĻòÕßÒµÎñÏà¶Ô¼òµ¥µÄϵͳ¶øÑÔ,Óÿò¼Ü¿ª·¢²¢²»ÄÜ´øÀ´ÈκÎЧÒæ,²¢ÇÒÎÒÉîÐÅÔÚһЩÏîÄ¿¿ª·¢ÖÐ,ÌرðÊǽö½öÓÉij¸öÈ˶ÀÁ ......
1¡¢commons-math/commons-lang-math
ÒÔÉÏÁ½¸ö°üÊÇapacheϵģ¬Ç°Õ߱ȺóÕߵŦÄÜÇ¿´ó£¬ºóÕßÓеŦÄÜÇ°¶¼ÓУ¬ºóÕßÖ÷Òª½â¾öƽʱ³ÌÐòÖеÄһЩ»ù±¾µÄÊýѧ¼ÆË㣬Ö÷ÒªÊÇ·¶Î§Åжϣ¨*Range£©,Ëæ»úÊýÉú³É£¨JVMRandom,RandomUtils£©£¬·ÖÊý´¦Àí£¨Fraction£©£¬Êý×Öת»¯¡¢´óСÅжϣ¨NumberUtils£©µÈ¡£Ç°Õß¿ÉÒÔ´¦Àí¸ü¸´ÔÓµÄÊý¾Ý·Ö ......