Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
修改不符合P3C规约的代码
Browse files Browse the repository at this point in the history
  • Loading branch information
easepan committed Oct 19, 2017
1 parent 12c9ea6 commit 5b23d24
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ private void initialize() {
resTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
// 设置默认的开始和结束日期,并调用dateChange事件刷新数据
endDate.setValue(LocalDate.now());
LocalDate endDate = Utils.dateToLocalDate(new Date(new Date().getTime() - Values.DATE_SPAN_OF_THIRTY_ONE));
long startTime = System.currentTimeMillis() - Values.DATE_SPAN_OF_THIRTY_ONE;
LocalDate endDate = Utils.dateToLocalDate(new Date(startTime));
startDate.setValue(endDate);
// 设置BucketChoiceComboBox改变事件,改变后并配置新的上传环境
bucketChoiceCombo.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
Expand Down
16 changes: 11 additions & 5 deletions src/main/java/com/zhazhapan/qiniu/util/Formatter.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ public class Formatter {

private static Logger logger = Logger.getLogger(Formatter.class);

private static final String[] SIZE_POST = { "TB", "GB", "MB", "KB" };
private static final String SIZE_KB = "KB";

private static final String SIZE_MB = "MB";

private static final String SIZE_GB = "GB";

private static final String SIZE_TB = "TB";

public static int stringToInt(String string) {
if (Checker.isNumber(string)) {
Expand Down Expand Up @@ -65,13 +71,13 @@ public static long sizeToLong(String size) {
if (Checker.isNotEmpty(size)) {
String num = size.split(" ")[0];
double result = 0;
if (size.contains(SIZE_POST[0])) {
if (size.contains(SIZE_TB)) {
result = stringToDouble(num) * Values.TB;
} else if (size.contains(SIZE_POST[1])) {
} else if (size.contains(SIZE_GB)) {
result = stringToDouble(num) * Values.GB;
} else if (size.contains(SIZE_POST[2])) {
} else if (size.contains(SIZE_MB)) {
result = stringToDouble(num) * Values.MB;
} else if (size.contains(SIZE_POST[3])) {
} else if (size.contains(SIZE_KB)) {
result = stringToDouble(num) * Values.KB;
} else {
result = stringToDouble(num);
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/zhazhapan/qiniu/view/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public void init() {
Dialogs.showFatalError(Values.INIT_APP_ERROR_HEADER, e);
}
stage.setTitle(Values.MAIN_TITLE);
// stage.setResizable(false);
stage.setOnCloseRequest((e) -> {
ThreadPool.shutdown();
ConfigLoader.checkWorkPath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @author pantao
*
*/
public class TestFormatter {
public class FormatterTest {

@Test
public void testSizeToLong() {
Expand Down

0 comments on commit 5b23d24

Please sign in to comment.