From e2e3bbb64c4c1c99adc20d7fb4d7259fa0de29ca Mon Sep 17 00:00:00 2001 From: Fevzi Ozgul Date: Tue, 24 May 2016 09:13:25 +0300 Subject: [PATCH] Fixing squid: common-java:DuplicatedBlocks Source files should not have any duplicated blocks --- .../clouddisk360/parser/FileInfoParser.java | 18 +- .../parser/UserCheckLoginParser.java | 7 +- .../clouddisk360/parser/UserInfoParser.java | 9 +- .../deserializer/file/info/FileInfo.java | 160 +----------------- .../parse/FileListParserTest.java | 2 +- 5 files changed, 20 insertions(+), 176 deletions(-) diff --git a/src/main/java/com/dounine/clouddisk360/parser/FileInfoParser.java b/src/main/java/com/dounine/clouddisk360/parser/FileInfoParser.java index 75d886a..fce2404 100644 --- a/src/main/java/com/dounine/clouddisk360/parser/FileInfoParser.java +++ b/src/main/java/com/dounine/clouddisk360/parser/FileInfoParser.java @@ -49,23 +49,7 @@ public FileInfo parse(final FileInfoParameter parameter) { .filter(f -> f.getPath().equals(parameter.getFilePath())).collect(Collectors.toList()); if (null != fileIfs && fileIfs.size() == 1) { final FileListData fileListData = fileIfs.get(0); - fileInfo.setDate(fileListData.getDate()); - fileInfo.setFhash(fileListData.getFhash()); - fileInfo.setFileType(fileListData.getFileType()); - fileInfo.setHasThumb(fileListData.getHasThumb()); - fileInfo.setIsDir(fileListData.getIsDir()); - fileInfo.setIsFav(fileListData.getIsFav()); - fileInfo.setFmtime(fileListData.getFmtime()); - fileInfo.setMtime(fileListData.getMtime()); - fileInfo.setNid(fileListData.getNid()); - fileInfo.setOriName(fileListData.getOriName()); - fileInfo.setOriSize(fileListData.getOriSize()); - fileInfo.setPath(fileListData.getPath()); - fileInfo.setPic(fileListData.getPic()); - fileInfo.setPreview(fileListData.getPreview()); - fileInfo.setScid(fileListData.getScid()); - fileInfo.setSize(fileListData.getSize()); - fileInfo.setThumb(fileListData.getThumb()); + fileInfo.setFileListData(fileListData); return fileInfo; } } diff --git a/src/main/java/com/dounine/clouddisk360/parser/UserCheckLoginParser.java b/src/main/java/com/dounine/clouddisk360/parser/UserCheckLoginParser.java index 59b196e..08660bd 100644 --- a/src/main/java/com/dounine/clouddisk360/parser/UserCheckLoginParser.java +++ b/src/main/java/com/dounine/clouddisk360/parser/UserCheckLoginParser.java @@ -1,6 +1,7 @@ package com.dounine.clouddisk360.parser; import com.dounine.clouddisk360.annotation.Parse; +import com.dounine.clouddisk360.parser.deserializer.BaseConst; import com.dounine.clouddisk360.parser.deserializer.login.Login; import com.dounine.clouddisk360.parser.deserializer.login.LoginConst; import com.dounine.clouddisk360.parser.deserializer.login.LoginUserToken; @@ -43,8 +44,8 @@ public HttpPost initRequest(final UserCheckLoginParameter userCheckLoginParamete } final HttpPost request = new HttpPost(CONST.URI_PATH); final List data = new ArrayList<>(); - data.add(new BasicNameValuePair(CONST.QID_NAME, login.getQid())); - data.add(new BasicNameValuePair(CONST.METHOD_KEY, CONST.METHOD_VAL)); + data.add(new BasicNameValuePair(UserCheckLoginConst.QID_NAME, login.getQid())); + data.add(new BasicNameValuePair(UserCheckLoginConst.METHOD_KEY, UserCheckLoginConst.METHOD_VAL)); data.add(new BasicNameValuePair(CONST.AJAX_KEY, CONST.AJAX_VAL)); data.add(new BasicNameValuePair("t", TimeUtil.getTimeLenth(13))); request.setConfig(RequestConfig.custom().setCookieSpec(CookieSpecs.NETSCAPE).build()); @@ -57,7 +58,7 @@ public UserCheckLogin execute(final HttpPost request) { httpClient = HttpClients.custom() .setConnectionManager(PoolingHttpClientConnection.getInstalce()) .addInterceptorLast(requestInterceptor) - .setDefaultCookieStore(cookieStoreUT.readCookieStoreForDisk(CONST.BASE_COOKIES_VALUES)) + .setDefaultCookieStore(cookieStoreUT.readCookieStoreForDisk(BaseConst.BASE_COOKIES_VALUES)) .build(); try { return httpClient.execute(request, responseHandler, this.httpClientContext); diff --git a/src/main/java/com/dounine/clouddisk360/parser/UserInfoParser.java b/src/main/java/com/dounine/clouddisk360/parser/UserInfoParser.java index 1980d3f..04cbde6 100644 --- a/src/main/java/com/dounine/clouddisk360/parser/UserInfoParser.java +++ b/src/main/java/com/dounine/clouddisk360/parser/UserInfoParser.java @@ -3,6 +3,7 @@ import com.dounine.clouddisk360.annotation.DependResult; import com.dounine.clouddisk360.annotation.Dependency; import com.dounine.clouddisk360.annotation.Parse; +import com.dounine.clouddisk360.parser.deserializer.BaseConst; import com.dounine.clouddisk360.parser.deserializer.login.LoginUserToken; import com.dounine.clouddisk360.parser.deserializer.user.info.*; import com.dounine.clouddisk360.pool.PoolingHttpClientConnection; @@ -43,11 +44,11 @@ public HttpGet initRequest(final UserInfoParameter userInfoParameter) { uriBuilder.addParameter(CONST.SRC_KEY, CONST.SRC_VAL); uriBuilder.addParameter(CONST.FROM_KEY, CONST.FROM_VAL); uriBuilder.addParameter(CONST.CHARSET_KEY, CONST.CHARSET_VAL); - uriBuilder.addParameter(CONST.METHOD_KEY, CONST.METHOD_VAL); + uriBuilder.addParameter(UserInfoConst.METHOD_KEY, UserInfoConst.METHOD_VAL); uriBuilder.addParameter(CONST.REQUESTSCEMA_KEY, CONST.REQUESTSCEMA_VAL); uriBuilder.addParameter(CONST.O_KEY, CONST.O_VAL); - uriBuilder.addParameter(CONST.SHOW_NAME_FLAG_NAME, CONST.SHOW_NAME_FLAG_VALUE); - uriBuilder.addParameter(CONST.HEAD_TYPE_NAME, CONST.HEAD_TYPE_VAL); + uriBuilder.addParameter(UserInfoConst.SHOW_NAME_FLAG_NAME, UserInfoConst.SHOW_NAME_FLAG_VALUE); + uriBuilder.addParameter(UserInfoConst.HEAD_TYPE_NAME, UserInfoConst.HEAD_TYPE_VAL); uriBuilder.addParameter("-", TimeUtil.getTimeLenth(13)); final HttpGet request = new HttpGet(uriBuilder.build()); request.setConfig(RequestConfig.custom().setCookieSpec(CookieSpecs.NETSCAPE).build()); @@ -63,7 +64,7 @@ public UserInfo execute(final HttpGet request) { httpClient = HttpClients.custom() .setConnectionManager(PoolingHttpClientConnection.getInstalce()) .addInterceptorLast(requestInterceptor) - .setDefaultCookieStore(cookieStoreUT.readCookieStoreForDisk(CONST.BASE_COOKIES_VALUES)) + .setDefaultCookieStore(cookieStoreUT.readCookieStoreForDisk(BaseConst.BASE_COOKIES_VALUES)) .build(); try { return httpClient.execute(request, responseHandler, this.httpClientContext); diff --git a/src/main/java/com/dounine/clouddisk360/parser/deserializer/file/info/FileInfo.java b/src/main/java/com/dounine/clouddisk360/parser/deserializer/file/info/FileInfo.java index 1e6ec4a..d1a472e 100644 --- a/src/main/java/com/dounine/clouddisk360/parser/deserializer/file/info/FileInfo.java +++ b/src/main/java/com/dounine/clouddisk360/parser/deserializer/file/info/FileInfo.java @@ -2,163 +2,21 @@ import com.alibaba.fastjson.JSON; import com.dounine.clouddisk360.parser.deserializer.BaseDes; +import com.dounine.clouddisk360.parser.deserializer.file.list.FileListData; public class FileInfo extends BaseDes { - private String oriName; - private String path; - private String nid; - private String date; - private Integer isDir; - private String isFav; - private String mtime; - private String fmtime; - private Long oriSize; - private String size; - private String scid; - private String preview; - private String hasThumb; - private String thumb; - private String fhash; - private String pic; - private String fileType; - - public String getOriName() { - return oriName; - } - - public void setOriName(String oriName) { - this.oriName = oriName; - } - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } - - public String getNid() { - return nid; - } - - public void setNid(String nid) { - this.nid = nid; - } - - public String getDate() { - return date; - } - - public void setDate(String date) { - this.date = date; - } - - public Integer getIsDir() { - return isDir; - } - - public void setIsDir(Integer isDir) { - this.isDir = isDir; - } - - public String getIsFav() { - return isFav; - } - - public void setIsFav(String isFav) { - this.isFav = isFav; - } - - public String getMtime() { - return mtime; - } - - public void setMtime(String mtime) { - this.mtime = mtime; - } - - public String getFmtime() { - return fmtime; - } - - public void setFmtime(String fmtime) { - this.fmtime = fmtime; - } - - public Long getOriSize() { - return oriSize; + private FileListData fileListData; + + public FileInfo(){ + fileListData=new FileListData(); } - - public void setOriSize(Long oriSize) { - this.oriSize = oriSize; + public FileListData getFileListData() { + return fileListData; } - - public String getSize() { - return size; + public void setFileListData(FileListData fileListData) { + this.fileListData = fileListData; } - - public void setSize(String size) { - this.size = size; - } - - public String getScid() { - return scid; - } - - public void setScid(String scid) { - this.scid = scid; - } - - public String getPreview() { - return preview; - } - - public void setPreview(String preview) { - this.preview = preview; - } - - public String getHasThumb() { - return hasThumb; - } - - public void setHasThumb(String hasThumb) { - this.hasThumb = hasThumb; - } - - public String getThumb() { - return thumb; - } - - public void setThumb(String thumb) { - this.thumb = thumb; - } - - public String getFhash() { - return fhash; - } - - public void setFhash(String fhash) { - this.fhash = fhash; - } - - public String getPic() { - return pic; - } - - public void setPic(String pic) { - this.pic = pic; - } - - public String getFileType() { - return fileType; - } - - public void setFileType(String fileType) { - this.fileType = fileType; - } - @Override public String toString() { return JSON.toJSONString(this, true); diff --git a/src/test/java/com/dounine/clouddisk360/parse/FileListParserTest.java b/src/test/java/com/dounine/clouddisk360/parse/FileListParserTest.java index 0ad1867..2f79194 100644 --- a/src/test/java/com/dounine/clouddisk360/parse/FileListParserTest.java +++ b/src/test/java/com/dounine/clouddisk360/parse/FileListParserTest.java @@ -22,7 +22,7 @@ public void testParse() { fileListParameter.setOrder(Order.DESC); fileListParameter.setPage(0); fileListParameter.setPage_size(300); - fileListParameter.setPath(fileListParameter.ROOT_PATH); + fileListParameter.setPath(FileListParameter.ROOT_PATH); final FileList fileList = fileListParser.parse(fileListParameter); LOGGER.info(fileList.toString()); }