mirror of
				https://e.coding.net/circlecloud/YumCore.git
				synced 2025-11-03 23:06:02 +00:00 
			
		
		
		
	@@ -300,9 +300,12 @@ public class FileConfig extends AbstractConfig {
 | 
				
			|||||||
     * @return 是否需要更新
 | 
					     * @return 是否需要更新
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public boolean needUpdate(final String newver, final String oldver) {
 | 
					    public boolean needUpdate(final String newver, final String oldver) {
 | 
				
			||||||
        if (newver == null || oldver == null) {
 | 
					        if (newver == null) {
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        if (oldver == null) {
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        final String[] va1 = newver.split("\\.");// 注意此处为正则匹配,不能用".";
 | 
					        final String[] va1 = newver.split("\\.");// 注意此处为正则匹配,不能用".";
 | 
				
			||||||
        final String[] va2 = oldver.split("\\.");
 | 
					        final String[] va2 = oldver.split("\\.");
 | 
				
			||||||
        int idx = 0;
 | 
					        int idx = 0;
 | 
				
			||||||
@@ -432,6 +435,7 @@ public class FileConfig extends AbstractConfig {
 | 
				
			|||||||
            Log.warning(String.format(CONFIG_BACKUP, filename, newCfgName));
 | 
					            Log.warning(String.format(CONFIG_BACKUP, filename, newCfgName));
 | 
				
			||||||
        } catch (final IOException e) {
 | 
					        } catch (final IOException e) {
 | 
				
			||||||
            Log.warning(String.format(CONFIG_BACKUP_ERROR, filename, e.getMessage()));
 | 
					            Log.warning(String.format(CONFIG_BACKUP_ERROR, filename, e.getMessage()));
 | 
				
			||||||
 | 
					            Log.debug(oldcfg.getConfigName(), e);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -482,7 +486,7 @@ public class FileConfig extends AbstractConfig {
 | 
				
			|||||||
     * @return yyyy-MM-dd HH:mm:ss
 | 
					     * @return yyyy-MM-dd HH:mm:ss
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    protected String getStringDate(String format) {
 | 
					    protected String getStringDate(String format) {
 | 
				
			||||||
        format = format == null ? format : "yyyy-MM-dd HH:mm:ss";
 | 
					        format = format == null ? "yyyy-MM-dd HH:mm:ss" : format;
 | 
				
			||||||
        final Date currentTime = new Date();
 | 
					        final Date currentTime = new Date();
 | 
				
			||||||
        return new SimpleDateFormat(format).format(currentTime);
 | 
					        return new SimpleDateFormat(format).format(currentTime);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -508,6 +512,7 @@ public class FileConfig extends AbstractConfig {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    protected FileConfig init(final File file, final boolean check) {
 | 
					    protected FileConfig init(final File file, final boolean check) {
 | 
				
			||||||
        Validate.notNull(file, FILE_NOT_BE_NULL);
 | 
					        Validate.notNull(file, FILE_NOT_BE_NULL);
 | 
				
			||||||
 | 
					        this.file = file;
 | 
				
			||||||
        if (check) {
 | 
					        if (check) {
 | 
				
			||||||
            check(file);
 | 
					            check(file);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user