• R/O
  • SSH
  • HTTPS

opengion: Commit


Commit MetaInfo

Révision1706 (tree)
l'heure2019-03-05 08:48:29
Auteurtakahashi_m

Message de Log

(empty log message)

Change Summary

Modification

--- trunk/opengionV5/uap/webapps/gf/doc/RELEASE-NOTES.txt (revision 1705)
+++ trunk/opengionV5/uap/webapps/gf/doc/RELEASE-NOTES.txt (revision 1706)
@@ -1,6 +1,7 @@
11 5.10.9.1 (2019/03/08)
2- [コンパイラの警告対応]
2+ [コンパイラの警告対応等]
33 コンパイラの警告を修正します。(アノテーションなど)
4+ また、一部引数のfinal化等も行います。
45 fukurou.model.FileOperationInfo
56 fukurou.model.CloudFileOperation
67 fukurou.model.FileOperation
@@ -7,6 +8,7 @@
78 fukutou.model.FileOperationFactory
89 fukurou.util.FileUtil
910 fukurou.security.HybsCryptography
11+ hayabusa.io.HybsFileOperationFactory
1012
1113 5.10.9.0 (2019/03/01)
1214 [クラウドストレージ対応]
--- trunk/opengionV5/uap/webapps/gf/src/org/opengion/fukurou/model/CloudFileOperation.java (revision 1705)
+++ trunk/opengionV5/uap/webapps/gf/src/org/opengion/fukurou/model/CloudFileOperation.java (revision 1706)
@@ -36,8 +36,9 @@
3636 // バケット名
3737 protected final String conBucket;
3838
39- private final String UNIMPLEMNTED_ERR="このクラスでは未実装のメソッドです。";
40-
39+ private static final String UNIMPLEMNTED_ERR="このクラスでは未実装のメソッドです。";
40+ private static final char FS = '/' ;
41+
4142 /**
4243 * コンストラクタ
4344 *
@@ -53,7 +54,7 @@
5354 this.conBucket = bucket;
5455
5556 if (StringUtil.isNull(conBucket)) {
56- String errMsg = "バケット未指定です。hayabusa利用ではシステム変数の「CLOUD_BUCKET」にバケット名を設定して下さい。";
57+ final String errMsg = "バケット未指定です。hayabusa利用ではシステム変数の「CLOUD_BUCKET」にバケット名を設定して下さい。";
5758 throw new RuntimeException(errMsg);
5859 }
5960 }
@@ -218,7 +219,7 @@
218219 * @return 成否フラグ
219220 */
220221 @Override
221- public boolean move(String afPath) {
222+ public boolean move(final String afPath) {
222223 boolean flgRtn = false;
223224
224225 flgRtn = copy(afPath);
@@ -279,7 +280,7 @@
279280 * @return 成否フラグ
280281 */
281282 @Override
282- public boolean renameTo(File dest) {
283+ public boolean renameTo(final File dest) {
283284 return move(dest.getPath());
284285 }
285286
@@ -360,7 +361,7 @@
360361 * @return 成否フラグ
361362 */
362363 @Override
363- public boolean setLastModified(long time) {
364+ public boolean setLastModified(final long time) {
364365 // クラウドストレージでは、setLastModifiedによる、
365366 // 最終更新時刻の設定はできないので、
366367 // 処理を行わずにtrueを返します。
@@ -411,13 +412,14 @@
411412 // 「//+」は「/」に置換
412413 rtn = rtn.replaceAll("//+", "/");
413414 // 先頭が「/」の場合は除去
414- if ("/".equals(rtn.substring(0, 1))) {
415+// if ("/".equals(rtn.substring(0, 1))) {
416+ if( FS == rtn.charAt(0) ) {
415417 rtn = rtn.substring(1);
416418 }
417419 // 後尾の「.」は除去
418420 rtn = rTrim(rtn, '.');
419421 // 後尾の「/」は除去
420- rtn = rTrim(rtn, '/');
422+ rtn = rTrim(rtn, FS);
421423
422424 return rtn;
423425 }
@@ -430,12 +432,12 @@
430432 * @param key キー
431433 * @return 親のパス
432434 */
433- protected String drawParent(String key) {
434- int k = key.lastIndexOf("/");
435+ protected String drawParent(final String key) {
436+ final int k = key.lastIndexOf(FS);
435437
436438 String rtn = "";
437439 if (k > 0) {
438- rtn = key.substring(0, key.lastIndexOf("/"));
440+ rtn = key.substring(0, key.lastIndexOf(FS));
439441 }
440442 if ("/".equals(File.separator)) {
441443 rtn = File.separator + rtn;
@@ -452,12 +454,12 @@
452454 * @param key キー(パス)
453455 * @return 名称
454456 */
455- protected String drawName(String key) {
456- int k = key.lastIndexOf("/");
457+ protected String drawName(final String key) {
458+ final int k = key.lastIndexOf(FS);
457459
458460 String rtn = key;
459461 if (k > 0) {
460- rtn = key.substring(key.lastIndexOf("/") + 1);
462+ rtn = key.substring(key.lastIndexOf(FS) + 1);
461463 }
462464 return rtn;
463465 }
@@ -470,14 +472,15 @@
470472 * @param path パス
471473 * @return 後尾に「/」ありのパス
472474 */
473- protected String setDirTail(String path) {
475+ protected String setDirTail(final String path) {
474476 if (StringUtil.isNull(path)) {
475477 return path;
476478 }
477479
478- StringBuilder sb = new StringBuilder(path);
479- if (!"/".equals(path.substring(path.length() - 1))) {
480- sb.append("/");
480+ final StringBuilder sb = new StringBuilder(path);
481+// if (!"/".equals(path.substring(path.length() - 1))) {
482+ if ( FS != path.charAt(path.length() - 1) ) {
483+ sb.append(FS);
481484 }
482485 return sb.toString();
483486 }
@@ -491,7 +494,7 @@
491494 * @param chr 指定文字
492495 * @return 右側から指定文字を除去後の文字列
493496 */
494- protected String rTrim(final String str, char chr) {
497+ protected String rTrim(final String str, final char chr) {
495498 String rtn = str;
496499 int trgPos = 0;
497500 for (int i = str.length() - 1; i >= 0; i--) {
@@ -538,9 +541,9 @@
538541 * @param filter フィルタ情報
539542 * @return フィルタ後のリスト
540543 */
541- protected File[] filter(List<File> list, FileFilter filter) {
542- List<File> files = new ArrayList<File>();
543- for (File file : list) {
544+ protected File[] filter(final List<File> list, final FileFilter filter) {
545+ final List<File> files = new ArrayList<File>();
546+ for (final File file : list) {
544547 if (filter.accept(file)) {
545548 files.add(file);
546549 }
@@ -558,10 +561,10 @@
558561 * @return InpusStreamをbyte配列に変換した値
559562 * @throws IOException ファイル関連エラー情報
560563 */
561- protected byte[] toByteArray(InputStream is) throws IOException {
562- ByteArrayOutputStream output = new ByteArrayOutputStream();
564+ protected byte[] toByteArray(final InputStream is) throws IOException {
565+ final ByteArrayOutputStream output = new ByteArrayOutputStream();
563566 try {
564- byte[] b = new byte[BUFFER_SIZE];
567+ final byte[] b = new byte[BUFFER_SIZE];
565568 int n = 0;
566569 while ((n = is.read(b)) != -1) {
567570 output.write(b, 0, n);
@@ -678,7 +681,7 @@
678681 * @return フラグ
679682 */
680683 @Override
681- public boolean setReadable(boolean readable) {
684+ public boolean setReadable(final boolean readable) {
682685 throw new RuntimeException(UNIMPLEMNTED_ERR);
683686 }
684687
@@ -692,7 +695,7 @@
692695 * @return フラグ
693696 */
694697 @Override
695- public boolean setReadable(boolean readable, boolean ownerOnly) {
698+ public boolean setReadable(final boolean readable, final boolean ownerOnly) {
696699 throw new RuntimeException(UNIMPLEMNTED_ERR);
697700 }
698701
@@ -705,7 +708,7 @@
705708 * @return フラグ
706709 */
707710 @Override
708- public boolean setWritable(boolean writable) {
711+ public boolean setWritable(final boolean writable) {
709712 throw new RuntimeException(UNIMPLEMNTED_ERR);
710713 }
711714
@@ -719,7 +722,7 @@
719722 * @return フラグ
720723 */
721724 @Override
722- public boolean setWritable(boolean writable, boolean ownerOnly) {
725+ public boolean setWritable(final boolean writable, final boolean ownerOnly) {
723726 throw new RuntimeException(UNIMPLEMNTED_ERR);
724727 }
725728
--- trunk/opengionV5/uap/webapps/gf/src/org/opengion/fukurou/model/FileOperation.java (revision 1705)
+++ trunk/opengionV5/uap/webapps/gf/src/org/opengion/fukurou/model/FileOperation.java (revision 1706)
@@ -34,7 +34,7 @@
3434 *
3535 * @param path ファイルパス
3636 */
37- public FileOperation(String path) {
37+ public FileOperation(final String path) {
3838 super(path);
3939 }
4040
@@ -46,7 +46,7 @@
4646 * @param bucket バケット名
4747 * @param path ファイルパス
4848 */
49- public FileOperation(String bucket, String path) {
49+ public FileOperation(final String bucket, final String path) {
5050 this(path);
5151 this.mybucket = bucket;
5252 }
@@ -84,7 +84,7 @@
8484 * @param afPath コピー先
8585 * @return 成否フラグ
8686 */
87- public boolean copy(String afPath) {
87+ public boolean copy(final String afPath) {
8888 boolean flgRtn = false;
8989
9090 try {
@@ -106,7 +106,7 @@
106106 * @param afPath 移動先
107107 * @return 成否フラグ
108108 */
109- public boolean move(String afPath) {
109+ public boolean move(final String afPath) {
110110 boolean flgRtn = false;
111111
112112 try {
@@ -120,7 +120,7 @@
120120 }
121121
122122 /**
123- * 保存先のローカル判定
123+ * 保存先のローカル判定。
124124 *
125125 * 判定結果を返します。
126126 * trueの場合は、ローカル保存。
@@ -133,7 +133,7 @@
133133 }
134134
135135 /**
136- * カノニカルファイル取得
136+ * カノニカルファイル取得。
137137 *
138138 * カノニカルファイル情報を取得します。
139139 *
@@ -142,12 +142,12 @@
142142 */
143143 @Override
144144 public FileOperation getCanonicalFile() throws IOException {
145- String canonPath = getCanonicalPath();
146- return new FileOperation(canonPath);
147- }
145+ final String canonPath = getCanonicalPath();
146+ return new FileOperation(canonPath);
147+ }
148148
149149 /**
150- * バケット名取得
150+ * バケット名取得。
151151 *
152152 * バケット名を取得します。
153153 *
@@ -158,7 +158,7 @@
158158 }
159159
160160 /**
161- * プラグイン名取得
161+ * プラグイン名取得。
162162 *
163163 * プラグイン名を取得します。
164164 *
@@ -169,13 +169,13 @@
169169 }
170170
171171 /**
172- * プラグイン名のセット
172+ * プラグイン名のセット。
173173 *
174174 * プラグイン名をセットします。
175175 *
176176 * @param plugin プラグイン名
177177 */
178- protected void setPlugin( String plugin ) {
178+ protected void setPlugin( final String plugin ) {
179179 myplugin = plugin;
180180 }
181181
--- trunk/opengionV5/uap/webapps/gf/src/org/opengion/fukurou/model/FileOperationFactory.java (revision 1705)
+++ trunk/opengionV5/uap/webapps/gf/src/org/opengion/fukurou/model/FileOperationFactory.java (revision 1706)
@@ -1,6 +1,7 @@
11 package org.opengion.fukurou.model;
22
33 import java.io.File;
4+import java.util.Locale;
45 import org.opengion.fukurou.util.StringUtil;
56
67
@@ -28,8 +29,9 @@
2829 * @param path ファイルパス
2930 * @return ファイル操作インスタンス
3031 */
31- public static FileOperation newStorageOperation(String path) {
32- return newStorageOperation( (String)null, null, path.toString());
32+ public static FileOperation newStorageOperation(final String path) {
33+// return newStorageOperation( (String)null, null, path.toString());
34+ return newStorageOperation( (String)null, null, path);
3335 }
3436
3537 /**
@@ -46,8 +48,8 @@
4648 * @param fileName ファイル名
4749 * @return ファイル操作インスタンス
4850 */
49- public static FileOperation newStorageOperation(String plugin, String buket, String dir, String fileName) {
50- StringBuilder path = new StringBuilder(BUFFER_MIDDLE);
51+ public static FileOperation newStorageOperation(final String plugin, final String buket, final String dir, final String fileName) {
52+ final StringBuilder path = new StringBuilder(BUFFER_MIDDLE);
5153 path.append( dir );
5254
5355 if(fileName != null) {
@@ -69,20 +71,20 @@
6971 * @param path ファイルパス
7072 * @return ファイル操作インスタンス
7173 */
72- public static FileOperation newStorageOperation(String plugin, String buket, String path) {
74+ public static FileOperation newStorageOperation(final String plugin, final String buket, final String path) {
7375 FileOperation rtn;
7476 String cloudTarget = null;
7577
76- Object[] args = new Object[] { buket, path };
78+ final Object[] args = new Object[] { buket, path };
7779
7880 // 対象のクラウドサービスを取得(大文字化)。
7981 // 未指定の場合は、ローカルディレクトリを利用。
8082 if ( plugin != null && plugin.length() > 0 ) {
81- cloudTarget = plugin.toUpperCase();
83+ cloudTarget = plugin.toUpperCase( Locale.JAPAN );
8284 }
8385
8486 try {
85- StringBuilder sb = new StringBuilder(BUFFER_MIDDLE);
87+ final StringBuilder sb = new StringBuilder(BUFFER_MIDDLE);
8688
8789 if (StringUtil.isNull(cloudTarget) || "DEFAULT".equals(cloudTarget)) {
8890 sb.append("org.opengion.fukurou.model.FileOperation");
@@ -95,9 +97,10 @@
9597 rtn = (FileOperation) Class.forName(sb.toString())
9698 .getConstructor(String.class, String.class)
9799 .newInstance(args);
98- } catch (Exception e) {
100+// } catch (Exception e) {
101+ } catch (final Throwable th) {
99102 // キャッチしたエラー情報をスロー
100- throw new RuntimeException(e);
103+ throw new RuntimeException(th);
101104 }
102105
103106 return rtn;
@@ -118,7 +121,7 @@
118121 * @param fileName 子パス
119122 * @return 設定をコピーしたのFileOperation
120123 */
121- public static FileOperation newStorageOperation(File file, String dir, String fileName) {
124+ public static FileOperation newStorageOperation(final File file, final String dir, final String fileName) {
122125 String plugin = null;
123126 String buket = null;
124127
@@ -135,7 +138,7 @@
135138 }
136139
137140 /**
138- * インスタンス生成
141+ * インスタンス生成。
139142 *
140143 * コピーするタイプで、子パスを与えないパターンです。
141144 *
@@ -143,7 +146,7 @@
143146 * @param path パス
144147 * @return 設定をコピーしたのFileOperation
145148 */
146- public static FileOperation newStorageOperation(File file, String path) {
149+ public static FileOperation newStorageOperation(final File file, final String path) {
147150 return newStorageOperation( file, path, null);
148151
149152 }
--- trunk/opengionV5/uap/webapps/gf/src/org/opengion/hayabusa/io/HybsFileOperationFactory.java (revision 1705)
+++ trunk/opengionV5/uap/webapps/gf/src/org/opengion/hayabusa/io/HybsFileOperationFactory.java (revision 1706)
@@ -23,7 +23,7 @@
2323 * @author Takahashi Masakazu
2424 * @since JDK7.0
2525 */
26-public class HybsFileOperationFactory {
26+public final class HybsFileOperationFactory {
2727 private static String defPlugin=HybsSystem.sys("CLOUD_TARGET");
2828 private static String defBucket=HybsSystem.sys("CLOUD_BUCKET");
2929
@@ -43,7 +43,7 @@
4343 * @param path ファイルパス
4444 * @return FileOperationインスタンス
4545 */
46- public static FileOperation create(String plugin, String bucket, String path) {
46+ public static FileOperation create(final String plugin, final String bucket, final String path) {
4747 return FileOperationFactory.newStorageOperation( StringUtil.nval(plugin, defPlugin), StringUtil.nval(bucket, defBucket), path );
4848 }
4949
@@ -56,8 +56,8 @@
5656 * @param file ファイル名
5757 * @return FileOperationインスタンス
5858 */
59- public static FileOperation create(String plugin, String bucket, String dir, String file) {
60- StringBuilder sb = new StringBuilder(HybsSystem.BUFFER_SMALL);
59+ public static FileOperation create(final String plugin, final String bucket, final String dir, final String file) {
60+ final StringBuilder sb = new StringBuilder(HybsSystem.BUFFER_SMALL);
6161 sb.append(dir).append(HybsSystem.FS).append(file);
6262 return create(plugin, bucket, sb.toString());
6363 }
@@ -71,8 +71,8 @@
7171 * @param file ファイル名
7272 * @return FileOperationインスタンス
7373 */
74- public static FileOperation create(String plugin, String bucket, File dir, String file) {
75- StringBuilder sb = new StringBuilder(HybsSystem.BUFFER_SMALL);
74+ public static FileOperation create(final String plugin, final String bucket, final File dir, final String file) {
75+ final StringBuilder sb = new StringBuilder(HybsSystem.BUFFER_SMALL);
7676 sb.append(dir.getPath()).append(HybsSystem.FS).append(file);
7777 return create(plugin, bucket, sb.toString());
7878 }
Afficher sur ancien navigateur de dépôt.