OSDN Git Service

Merge develop into pomconfig pomconfig
authorOlyutorskii <olyutorskii@users.osdn.me>
Thu, 4 Jul 2019 07:29:43 +0000 (16:29 +0900)
committerOlyutorskii <olyutorskii@users.osdn.me>
Thu, 4 Jul 2019 07:29:43 +0000 (16:29 +0900)
40 files changed:
CHANGELOG.txt
config/checkstyle/checkstyle-suppressions.xml
config/pmd/pmdrules.xml
pom.xml
src/main/java/jp/sfjp/mikutoga/pmd/model/BoneGroup.java
src/main/java/jp/sfjp/mikutoga/pmd/model/IKChain.java
src/main/java/jp/sfjp/mikutoga/pmd/model/Material.java
src/main/java/jp/sfjp/mikutoga/pmd/model/MorphPart.java
src/main/java/jp/sfjp/mikutoga/pmd/model/PmdModel.java
src/main/java/jp/sfjp/mikutoga/pmd/model/RigidGroup.java
src/main/java/jp/sfjp/mikutoga/pmd/model/RigidInfo.java
src/main/java/jp/sfjp/mikutoga/pmd/model/SerialNumbered.java
src/main/java/jp/sfjp/mikutoga/pmd/model/Surface.java
src/main/java/jp/sfjp/mikutoga/pmd/model/ToonMap.java
src/main/java/jp/sfjp/mikutoga/pmd/model/Vertex.java
src/main/java/jp/sfjp/mikutoga/pmd/model/binio/BoneBuilder.java
src/main/java/jp/sfjp/mikutoga/pmd/model/binio/MorphBuilder.java
src/main/java/jp/sfjp/mikutoga/pmd/model/binio/PmdExporterBase.java
src/main/java/jp/sfjp/mikutoga/pmd/model/binio/PmdExporterExt1.java
src/main/java/jp/sfjp/mikutoga/pmd/model/binio/PmdExporterExt2.java
src/main/java/jp/sfjp/mikutoga/pmd/model/binio/PmdExporterExt3.java
src/main/java/jp/sfjp/mikutoga/pmd/model/binio/PmdLoader.java
src/main/java/jp/sfjp/mikutoga/pmd/model/xml/CloseXmlMark.java
src/main/java/jp/sfjp/mikutoga/pmd/model/xml/OpenXmlMark.java
src/main/java/jp/sfjp/mikutoga/pmd/model/xml/PmdTag.java
src/main/java/jp/sfjp/mikutoga/pmd/model/xml/RefHelper.java
src/main/java/jp/sfjp/mikutoga/pmd/model/xml/SaxListener.java
src/main/java/jp/sfjp/mikutoga/pmd/model/xml/SaxMorphListener.java
src/main/java/jp/sfjp/mikutoga/pmd/model/xml/Schema101009.java
src/main/java/jp/sfjp/mikutoga/pmd/model/xml/Schema130128.java
src/main/java/jp/sfjp/mikutoga/pmd/model/xml/XmlHandler.java
src/main/java/jp/sfjp/mikutoga/pmd/model/xml/XmlModelFileType.java
src/main/java/jp/sfjp/mikutoga/pmd/model/xml/XmlPmdLoader.java
src/main/java/jp/sfjp/mikutoga/pmd2xml/CmdLine.java
src/main/java/jp/sfjp/mikutoga/pmd2xml/ModelFileType.java
src/main/java/jp/sfjp/mikutoga/pmd2xml/OptInfo.java
src/main/java/jp/sfjp/mikutoga/pmd2xml/OptSwitch.java
src/main/java/jp/sfjp/mikutoga/pmd2xml/Pmd2Xml.java
src/main/java/jp/sfjp/mikutoga/pmd2xml/Pmd2XmlConv.java
src/main/java/jp/sfjp/mikutoga/pmd2xml/XmlInputUtil.java

index c09bcd0..045d841 100644 (file)
@@ -4,9 +4,8 @@
 Pmd2XML 変更履歴
 
 
-X.XXX.X ()
-    * Prevent XXE vulnerabilities with XML-schema(XSD).
-    * Upgrade ToaGem to 3.122.2
+1.203.2 (2019-07-04)
+    * Prevent XXE vulnerabilities from external resources.
 
 1.202.2 (2019-06-06)
     ・必須環境をJavaSE8に引き上げ。
index 3860edf..4e65e28 100644 (file)
@@ -42,6 +42,7 @@
     <suppress files="" checks="RedundantModifier" />
 
     <!-- Whitespace -->
+    <suppress files="" checks="MethodParam" />
     <suppress files="" checks="ParenPad" />
     <suppress files="" checks="SingleSpaceSeparator" />
 
index db56675..7b3f79b 100644 (file)
             <property name="checkSingleIfStmt" value="false"/>
         </properties>
     </rule>
+    <rule ref="category/java/codestyle.xml/LongVariable" >
+        <properties>
+            <property name="minimum" value="25"/>
+        </properties>
+    </rule>
 
     <rule ref="category/java/design.xml" >
         <exclude name="LawOfDemeter" />
diff --git a/pom.xml b/pom.xml
index 45d2c62..b0807d6 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -16,7 +16,7 @@
     <groupId>jp.sourceforge.mikutoga</groupId>
     <artifactId>pmd2xml</artifactId>
 
-    <version>1.202.3-SNAPSHOT</version>
+    <version>1.203.3-SNAPSHOT</version>
 
     <packaging>jar</packaging>
     <name>Pmd2XML</name>
index 564eff7..d605875 100644 (file)
@@ -18,11 +18,11 @@ import jp.sfjp.mikutoga.corelib.I18nText;
  * 通し番号0のボーングループは、
  * 暗黙に用意される「デフォルトボーングループ」とする。
  */
-public class BoneGroup implements SerialNumbered , Iterable<BoneInfo> {
+public class BoneGroup implements SerialNumbered, Iterable<BoneInfo> {
 
     private final I18nText groupName = new I18nText();
 
-    private final List<BoneInfo> boneList = new ArrayList<BoneInfo>();
+    private final List<BoneInfo> boneList = new ArrayList<>();
 
     private int serialNo = -1;
 
index 58134d1..929d589 100644 (file)
@@ -21,7 +21,7 @@ public class IKChain implements Iterable<BoneInfo> {
     private int ikDepth;
     private float ikWeight;
 
-    private final List<BoneInfo> chainList = new ArrayList<BoneInfo>();
+    private final List<BoneInfo> chainList = new ArrayList<>();
 
 
     /**
index e17a6bc..1a1d1c3 100644 (file)
@@ -39,7 +39,7 @@ public class Material implements Iterable<Surface> {
 
     private boolean edgeAppearance = true;
 
-    private final List<Surface> surfaceList = new ArrayList<Surface>();
+    private final List<Surface> surfaceList = new ArrayList<>();
 
 
     /**
index e9a7463..fc5615d 100644 (file)
@@ -23,7 +23,7 @@ public class MorphPart implements SerialNumbered, Iterable<MorphVertex> {
     private MorphType type;
 
     private final List<MorphVertex> morphVertexList =
-            new ArrayList<MorphVertex>();
+            new ArrayList<>();
 
     private int morphSerialNo = -1;
 
index d44c89c..82dda6d 100644 (file)
@@ -29,23 +29,23 @@ public class PmdModel {
     private final I18nText modelName = new I18nText();
     private final I18nText description = new I18nText();
 
-    private final List<Vertex> vertexList = new ArrayList<Vertex>();
-    private final List<Surface> surfaceList = new ArrayList<Surface>();
-    private final List<Material> materialList = new LinkedList<Material>();
+    private final List<Vertex> vertexList = new ArrayList<>();
+    private final List<Surface> surfaceList = new ArrayList<>();
+    private final List<Material> materialList = new LinkedList<>();
 
-    private final List<BoneInfo> boneList = new ArrayList<BoneInfo>();
-    private final List<BoneGroup> boneGroupList = new ArrayList<BoneGroup>();
+    private final List<BoneInfo> boneList = new ArrayList<>();
+    private final List<BoneGroup> boneGroupList = new ArrayList<>();
 
-    private final List<IKChain> ikChainList = new ArrayList<IKChain>();
+    private final List<IKChain> ikChainList = new ArrayList<>();
 
     private final Map<MorphType, List<MorphPart>> morphMap =
-            new EnumMap<MorphType, List<MorphPart>>(MorphType.class);
+            new EnumMap<>(MorphType.class);
 
-    private final List<RigidInfo> rigidList = new ArrayList<RigidInfo>();
+    private final List<RigidInfo> rigidList = new ArrayList<>();
     private final List<RigidGroup> rigidGroupList =
-            new ArrayList<RigidGroup>();
+            new ArrayList<>();
 
-    private final List<JointInfo> jointList = new ArrayList<JointInfo>();
+    private final List<JointInfo> jointList = new ArrayList<>();
 
     private ToonMap toonMap = new ToonMap();
 
@@ -59,10 +59,10 @@ public class PmdModel {
         assert this.vertexList instanceof RandomAccess;
         assert this.surfaceList instanceof RandomAccess;
 
-        this.morphMap.put(MorphType.EYEBROW, new ArrayList<MorphPart>());
-        this.morphMap.put(MorphType.EYE,     new ArrayList<MorphPart>());
-        this.morphMap.put(MorphType.LIP,     new ArrayList<MorphPart>());
-        this.morphMap.put(MorphType.EXTRA,   new ArrayList<MorphPart>());
+        this.morphMap.put(MorphType.EYEBROW, new ArrayList<>());
+        this.morphMap.put(MorphType.EYE,     new ArrayList<>());
+        this.morphMap.put(MorphType.LIP,     new ArrayList<>());
+        this.morphMap.put(MorphType.EXTRA,   new ArrayList<>());
 
         return;
     }
@@ -70,6 +70,7 @@ public class PmdModel {
 
     /**
      * モデル名を返す。
+     *
      * @return モデル名
      */
     public I18nText getModelName(){
@@ -79,6 +80,7 @@ public class PmdModel {
     /**
      * モデル説明文を返す。
      * 改行表現には{@literal \n}が用いられる
+     *
      * @return モデル説明文
      */
     public I18nText getDescription(){
@@ -87,6 +89,7 @@ public class PmdModel {
 
     /**
      * 頂点リストを返す。
+     *
      * @return 頂点リスト。
      */
     public List<Vertex> getVertexList(){
@@ -95,6 +98,7 @@ public class PmdModel {
 
     /**
      * 面リストを返す。
+     *
      * @return 面リスト
      */
     public List<Surface> getSurfaceList(){
@@ -103,6 +107,7 @@ public class PmdModel {
 
     /**
      * 素材リストを返す。
+     *
      * @return 素材リスト
      */
     public List<Material> getMaterialList(){
@@ -111,6 +116,7 @@ public class PmdModel {
 
     /**
      * ボーンリストを返す。
+     *
      * @return ボーンリスト
      */
     public List<BoneInfo> getBoneList(){
@@ -119,6 +125,7 @@ public class PmdModel {
 
     /**
      * ボーングループリストを返す。
+     *
      * @return ボーングループリスト
      */
     public List<BoneGroup> getBoneGroupList(){
@@ -127,6 +134,7 @@ public class PmdModel {
 
     /**
      * IKチェーンリストを返す。
+     *
      * @return IKチェーンリスト
      */
     public List<IKChain> getIKChainList(){
@@ -135,6 +143,7 @@ public class PmdModel {
 
     /**
      * 種類別モーフリストのマップを返す。
+     *
      * @return 種類別モーフリストのマップ
      */
     public Map<MorphType, List<MorphPart>> getMorphMap(){
@@ -143,6 +152,7 @@ public class PmdModel {
 
     /**
      * 剛体リストを返す。
+     *
      * @return 剛体リスト
      */
     public List<RigidInfo> getRigidList(){
@@ -151,6 +161,7 @@ public class PmdModel {
 
     /**
      * 剛体グループリストを返す。
+     *
      * @return 剛体グループリスト。
      */
     public List<RigidGroup> getRigidGroupList(){
@@ -159,6 +170,7 @@ public class PmdModel {
 
     /**
      * 剛体間ジョイントリストを返す。
+     *
      * @return 剛体間ジョイントリスト
      */
     public List<JointInfo> getJointList(){
@@ -167,6 +179,7 @@ public class PmdModel {
 
     /**
      * トゥーンファイルマップを返す。
+     *
      * @return トゥーンファイルマップ
      */
     public ToonMap getToonMap(){
@@ -176,6 +189,7 @@ public class PmdModel {
     /**
      * トゥーンファイルマップを設定する。
      * 各素材のシェーディングで参照するトゥーンファイルマップも更新される。
+     *
      * @param map トゥーンファイルマップ
      */
     public void setToonMap(ToonMap map){
@@ -190,6 +204,7 @@ public class PmdModel {
     /**
      * このモデルがグローバル名を含むか判定する。
      * ボーン名、ボーングループ名、モーフ名、モデル説明文が判定対象。
+     *
      * @return グローバル名を持つならtrue
      */
     public boolean hasGlobalText(){
@@ -216,10 +231,11 @@ public class PmdModel {
     /**
      * 全モーフが使う全モーフ頂点の出現順リストを返す。
      * モーフ種別毎に固まっている事が保証される。
+     *
      * @return モーフ頂点リスト
      */
     private List<MorphVertex> getAllMorphVertexList(){
-        List<MorphVertex> allList = new ArrayList<MorphVertex>();
+        List<MorphVertex> allList = new ArrayList<>();
 
         for(MorphType type : this.morphMap.keySet()){
             if(type.isBase()) continue;
@@ -239,14 +255,15 @@ public class PmdModel {
 
     /**
      * 重複する頂点参照を除いたモーフ頂点リストを返す。
+     *
      * @param allList モーフ頂点リスト
      * @return 重複が除かれたモーフ頂点リスト
      */
     private List<MorphVertex> getUniqueMorphVertexList(
             List<MorphVertex> allList ){
-        List<MorphVertex> result = new ArrayList<MorphVertex>();
+        List<MorphVertex> result = new ArrayList<>();
 
-        Set<Vertex> mergedVertexSet = new HashSet<Vertex>();
+        Set<Vertex> mergedVertexSet = new HashSet<>();
 
         for(MorphVertex morphVertex : allList){
             Vertex vertex = morphVertex.getBaseVertex();
@@ -264,9 +281,10 @@ public class PmdModel {
      * モーフで使われる全てのモーフ頂点のリストを返す。
      * モーフ間で重複する頂点はマージされる。
      * 頂点IDでソートされる。
-     * <p>
-     * 0から始まる通し番号がリナンバリングされる。
+     *
+     * <p>0から始まる通し番号がリナンバリングされる。
      * 通し番号は返されるモーフ頂点リストの添え字番号と一致する。
+     *
      * @return モーフに使われるモーフ頂点のリスト
      */
     public List<MorphVertex> mergeMorphVertex(){
@@ -279,7 +297,7 @@ public class PmdModel {
         ListUtil.assignIndexedSerial(result);
 
         Map<Vertex, MorphVertex> numberedMap =
-                new HashMap<Vertex, MorphVertex>();
+                new HashMap<>();
         for(MorphVertex morphVertex : result){
             Vertex vertex = morphVertex.getBaseVertex();
             numberedMap.put(vertex, morphVertex);
@@ -319,10 +337,11 @@ public class PmdModel {
      * 所属マテリアル順に再配置し、通し番号を割り振り直す。
      * 所属マテリアルの無い面はリストの末端に配置される。
      * 面リスト中のnullは削除され詰められる。
+     *
      * @return トリミングされた面リスト
      */
     private List<Surface> trimmingSurfaceList(){
-        Set<Surface> materialedSurfaceSet = new HashSet<Surface>();
+        Set<Surface> materialedSurfaceSet = new HashSet<>();
         for(Material material : this.materialList){
             if(material == null) continue;
             for(Surface surface : material){
@@ -333,7 +352,7 @@ public class PmdModel {
 
         materialedSurfaceSet.removeAll(this.surfaceList);
 
-        List<Surface> result = new ArrayList<Surface>();
+        List<Surface> result = new ArrayList<>();
         for(Surface surface : this.surfaceList){
             if(surface == null) continue;
             result.add(surface);
@@ -355,10 +374,11 @@ public class PmdModel {
      * 通し番号を振り直す。
      * 所属面の無い頂点はリストの末端に配置される。
      * 頂点リスト中のnullは削除され詰められる。
+     *
      * @return トリミングされた頂点リスト
      */
     private List<Vertex> trimmingVertexList(){
-        Set<Vertex> surfacedVertexSet = new HashSet<Vertex>();
+        Set<Vertex> surfacedVertexSet = new HashSet<>();
         for(Surface surface : this.surfaceList){
             if(surface == null) continue;
             for(Vertex vertex : surface){
@@ -368,7 +388,7 @@ public class PmdModel {
 
         surfacedVertexSet.removeAll(this.vertexList);
 
-        List<Vertex> result = new ArrayList<Vertex>();
+        List<Vertex> result = new ArrayList<>();
         for(Vertex vertex : this.vertexList){
             if(vertex == null) continue;
             result.add(vertex);
index a28eea7..710dfdd 100644 (file)
@@ -21,7 +21,7 @@ public class RigidGroup implements SerialNumbered, Iterable<RigidInfo> {
     public static final int MAX_RIGID_GROUP = 16;
 
 
-    private final List<RigidInfo> rigidList = new ArrayList<RigidInfo>();
+    private final List<RigidInfo> rigidList = new ArrayList<>();
 
     private int rigidGroupSerialNo = -1;
 
index 95adef8..13b7af9 100644 (file)
@@ -32,7 +32,7 @@ public class RigidInfo implements SerialNumbered {
     private final DynamicsInfo dynamicsInfo = new DynamicsInfo();
 
     private final Collection<RigidGroup> throughGroupColl =
-            new ArrayList<RigidGroup>();
+            new ArrayList<>();
 
     private RigidGroup rigidGroup;
 
index b8df4be..2e1636e 100644 (file)
@@ -15,20 +15,23 @@ import java.util.Comparator;
 public interface SerialNumbered {
 
     /** 昇順での比較子。 */
-    Comparator<SerialNumbered> COMPARATOR = new SerialComparator();
+    public static final Comparator<SerialNumbered> COMPARATOR =
+            new SerialComparator();
 
 
     /**
      * 通し番号を設定する。
+     *
      * @param num 通し番号
      */
-    void setSerialNumber(int num);
+    public abstract void setSerialNumber(int num);
 
     /**
      * 通し番号を返す。
+     *
      * @return 通し番号
      */
-    int getSerialNumber();
+    public abstract int getSerialNumber();
 
 
     /**
@@ -36,7 +39,7 @@ public interface SerialNumbered {
      * 通し番号の昇順を定義づける。
      */
     @SuppressWarnings("serial")
-    class SerialComparator
+    public static class SerialComparator
             implements Comparator<SerialNumbered> {
 
         /**
@@ -50,6 +53,7 @@ public interface SerialNumbered {
 
         /**
          * {@inheritDoc}
+         *
          * @param o1 {@inheritDoc}
          * @param o2 {@inheritDoc}
          * @return {@inheritDoc}
index f3e9ab5..6e4b33d 100644 (file)
@@ -38,6 +38,7 @@ public class Surface implements SerialNumbered, Iterable<Vertex> {
 
     /**
      * 3頂点を設定する。
+     *
      * @param vtx1 頂点1
      * @param vtx2 頂点2
      * @param vtx3 頂点3
@@ -61,10 +62,11 @@ public class Surface implements SerialNumbered, Iterable<Vertex> {
 
     /**
      * 3頂点を返す。
+     *
      * @param store 頂点格納用配列。nullもしくは3要素に満たない場合は無視され、
-     * 新規に格納用配列が生成される。
+     *     新規に格納用配列が生成される。
      * @return 先頭3要素に3頂点が収められた配列。未設定要素にはnullが入る。
-     * 引数が長さ3以上の配列であれば引数と同じ配列が返る。
+     *     引数が長さ3以上の配列であれば引数と同じ配列が返る。
      */
     public Vertex[] getTriangle(Vertex[] store){
         Vertex[] result;
@@ -83,6 +85,7 @@ public class Surface implements SerialNumbered, Iterable<Vertex> {
 
     /**
      * 頂点その1を返す。
+     *
      * @return 頂点その1
      */
     public Vertex getVertex1(){
@@ -91,6 +94,7 @@ public class Surface implements SerialNumbered, Iterable<Vertex> {
 
     /**
      * 頂点その2を返す。
+     *
      * @return 頂点その2
      */
     public Vertex getVertex2(){
@@ -99,6 +103,7 @@ public class Surface implements SerialNumbered, Iterable<Vertex> {
 
     /**
      * 頂点その3を返す。
+     *
      * @return 頂点その3
      */
     public Vertex getVertex3(){
@@ -109,11 +114,12 @@ public class Surface implements SerialNumbered, Iterable<Vertex> {
      * {@inheritDoc}
      * 頂点を返す反復子を生成する。
      * 反復子がnullを返す可能性もありうる。
+     *
      * @return {@inheritDoc}
      */
     @Override
     public Iterator<Vertex> iterator(){
-        List<Vertex> list = new ArrayList<Vertex>(TRIANGLE);
+        List<Vertex> list = new ArrayList<>(TRIANGLE);
 
         list.add(this.vertex1);
         list.add(this.vertex2);
@@ -124,6 +130,7 @@ public class Surface implements SerialNumbered, Iterable<Vertex> {
 
     /**
      * 3頂点全てが設定されているか判定する。
+     *
      * @return 3頂点とも非nullが設定されていればtrue
      */
     public boolean isCompleted(){
@@ -136,6 +143,7 @@ public class Surface implements SerialNumbered, Iterable<Vertex> {
 
     /**
      * {@inheritDoc}
+     *
      * @param num {@inheritDoc}
      */
     @Override
@@ -146,6 +154,7 @@ public class Surface implements SerialNumbered, Iterable<Vertex> {
 
     /**
      * {@inheritDoc}
+     *
      * @return {@inheritDoc}
      */
     @Override
@@ -155,6 +164,7 @@ public class Surface implements SerialNumbered, Iterable<Vertex> {
 
     /**
      * {@inheritDoc}
+     *
      * @return {@inheritDoc}
      */
     @Override
index a7a29e0..f57f5da 100644 (file)
@@ -33,7 +33,7 @@ public class ToonMap {
     private static final int IDX_SP = 0xff;  // 特殊トゥーンのインデックス
 
     static{
-        Map<Integer, String> map = new TreeMap<Integer, String>();
+        Map<Integer, String> map = new TreeMap<>();
 
         int idx = 0x00;
         map.put(idx++, "toon01.bmp");
@@ -57,7 +57,7 @@ public class ToonMap {
 
 
     private final Map<Integer, String> toonDefMap =
-            new TreeMap<Integer, String>(DEF_TOONMAP);
+            new TreeMap<>(DEF_TOONMAP);
 
 
     /**
index b037d88..64437ae 100644 (file)
@@ -47,6 +47,7 @@ public class Vertex implements SerialNumbered {
 
     /**
      * 頂点位置座標を返す。
+     *
      * @return 頂点の位置座標
      */
     public MkPos3D getPosition(){
@@ -55,6 +56,7 @@ public class Vertex implements SerialNumbered {
 
     /**
      * 法線ベクトルを返す。
+     *
      * @return 法線ベクトル
      */
     public MkVec3D getNormal(){
@@ -63,6 +65,7 @@ public class Vertex implements SerialNumbered {
 
     /**
      * UVマップ座標を返す。
+     *
      * @return UVマップ情報
      */
     public MkPos2D getUVPosition(){
@@ -71,6 +74,7 @@ public class Vertex implements SerialNumbered {
 
     /**
      * 頂点の属するボーンを設定する。
+     *
      * @param boneAArg ボーンA
      * @param boneBArg ボーンB
      * @throws NullPointerException 引数がnull
@@ -88,6 +92,7 @@ public class Vertex implements SerialNumbered {
 
     /**
      * ボーンAを返す。
+     *
      * @return ボーンA
      */
     public BoneInfo getBoneA(){
@@ -96,6 +101,7 @@ public class Vertex implements SerialNumbered {
 
     /**
      * ボーンBを返す。
+     *
      * @return ボーンB
      */
     public BoneInfo getBoneB(){
@@ -104,12 +110,13 @@ public class Vertex implements SerialNumbered {
 
     /**
      * ボーンAのウェイト値を設定する。
+     *
      * @param weight ウェイト値。0(影響小)-100(影響大)
      * @throws IllegalArgumentException ウェイト値が範囲外
      */
     public void setWeightA(int weight) throws IllegalArgumentException{
-        if(   weight < MIN_WEIGHT
-           || MAX_WEIGHT < weight ){
+        if(    weight < MIN_WEIGHT
+            || MAX_WEIGHT < weight ){
             throw new IllegalArgumentException();
         }
         this.boneWeight = weight;
@@ -118,6 +125,7 @@ public class Vertex implements SerialNumbered {
 
     /**
      * ボーンBのウェイト値を設定する。
+     *
      * @param weight ウェイト値。0(影響小)-100(影響大)
      * @throws IllegalArgumentException ウェイト値が範囲外
      */
@@ -128,6 +136,7 @@ public class Vertex implements SerialNumbered {
 
     /**
      * ボーンAのウェイト値を返す。
+     *
      * @return ウェイト値
      */
     public int getWeightA(){
@@ -136,6 +145,7 @@ public class Vertex implements SerialNumbered {
 
     /**
      * ボーンBのウェイト値を返す。
+     *
      * @return ウェイト値
      */
     public int getWeightB(){
@@ -145,6 +155,7 @@ public class Vertex implements SerialNumbered {
 
     /**
      * ボーンAのウェイト率を返す。
+     *
      * @return ウェイト率。0.0(影響小)-1.0(影響大)
      */
     public float getWeightRatioA(){
@@ -153,6 +164,7 @@ public class Vertex implements SerialNumbered {
 
     /**
      * ボーンBのウェイト率を返す。
+     *
      * @return ウェイト率。0.0(影響小)-1.0(影響大)
      */
     public float getWeightRatioB(){
@@ -163,6 +175,7 @@ public class Vertex implements SerialNumbered {
     /**
      * エッジを表示するか設定する。
      * マテリアル材質単位の設定より優先度は高い。
+     *
      * @param show 表示するならtrue
      */
     public void setEdgeAppearance(boolean show){
@@ -173,6 +186,7 @@ public class Vertex implements SerialNumbered {
     /**
      * エッジを表示するか判定する。
      * マテリアル材質単位の設定より優先度は高い。
+     *
      * @return 表示するならtrue
      */
     public boolean getEdgeAppearance(){
@@ -181,6 +195,7 @@ public class Vertex implements SerialNumbered {
 
     /**
      * {@inheritDoc}
+     *
      * @param num {@inheritDoc}
      */
     @Override
@@ -191,6 +206,7 @@ public class Vertex implements SerialNumbered {
 
     /**
      * {@inheritDoc}
+     *
      * @return {@inheritDoc}
      */
     @Override
@@ -200,6 +216,7 @@ public class Vertex implements SerialNumbered {
 
     /**
      * {@inheritDoc}
+     *
      * @return {@inheritDoc}
      */
     @Override
index 391d4f0..3ae3255 100644 (file)
@@ -158,7 +158,7 @@ class BoneBuilder implements PmdBoneHandler {
      * 所属グループの無いボーンをデフォルトボーングループへ登録する。
      */
     private void pickOrphanBone(){
-        List<BoneInfo> orpahnList = new LinkedList<BoneInfo>();
+        List<BoneInfo> orpahnList = new LinkedList<>();
         orpahnList.addAll(this.boneList);
         for(BoneGroup group : this.boneGroupList){
             orpahnList.removeAll(group.getBoneList());
index ec93d41..869d931 100644 (file)
@@ -34,7 +34,7 @@ class MorphBuilder implements PmdMorphHandler {
     private MorphPart currentMorphPart;
     private final List<Vertex> vertexList;
 
-    private final List<Vertex> morphVertexList = new ArrayList<Vertex>();
+    private final List<Vertex> morphVertexList = new ArrayList<>();
 
     /**
      * コンストラクタ。
@@ -183,7 +183,7 @@ class MorphBuilder implements PmdMorphHandler {
 
         List<MorphPart> partList = this.morphMap.get(type);
         if(partList == null){
-            partList = new LinkedList<MorphPart>();
+            partList = new LinkedList<>();
             this.morphMap.put(type, partList);
         }
         partList.add(part);
index 5cfe69a..3a8596f 100644 (file)
@@ -38,8 +38,8 @@ import jp.sfjp.mikutoga.pmd.model.Vertex;
 
 /**
  * PMDファイルのエクスポーター(拡張無し基本フォーマット)。
- * <p>
- * 英名対応以降のPMDファイルフォーマットを
+ *
+ * <p>英名対応以降のPMDファイルフォーマットを
  * 使いたくない場合はこのエクスポーターを用いて出力せよ。
  */
 public class PmdExporterBase extends BinaryExporter{
@@ -88,6 +88,7 @@ public class PmdExporterBase extends BinaryExporter{
 
     /**
      * コンストラクタ。
+     *
      * @param stream 出力ストリーム
      * @throws NullPointerException 引数がnull
      */
@@ -100,6 +101,7 @@ public class PmdExporterBase extends BinaryExporter{
     /**
      * 改行文字の正規化を行う。
      * CR(0x0d)およびCRLF(0x0d0a)がLF(0x0a)へと正規化される。
+     *
      * @param text 文字列
      * @return 正規化の行われた文字列。
      */
@@ -117,11 +119,12 @@ public class PmdExporterBase extends BinaryExporter{
      * 文字列の改行記号はLF(0x0a)に正規化される。
      * エンコード結果がバイト長に満たない場合は
      * 1つの0x00及びそれに続く複数の0xfdがパディングされる。
+     *
      * @param text 文字列
      * @param maxByteLength バイト長指定
      * @throws IOException 出力エラー
      * @throws IllegalTextExportException エンコード結果が
-     * 指定バイト長をはみ出した。
+     *     指定バイト長をはみ出した。
      */
     protected void dumpText(String text, int maxByteLength)
             throws IOException, IllegalTextExportException{
@@ -131,6 +134,7 @@ public class PmdExporterBase extends BinaryExporter{
 
     /**
      * モデルデータをPMDファイル形式で出力する。
+     *
      * @param model モデルデータ
      * @throws IOException 出力エラー
      * @throws IllegalPmdDataException モデルデータに不備が発見された
@@ -156,6 +160,7 @@ public class PmdExporterBase extends BinaryExporter{
 
     /**
      * モデル基本情報を出力する。
+     *
      * @param model モデルデータ
      * @throws IOException 出力エラー
      * @throws IllegalTextExportException モデル名もしくは説明が長すぎる
@@ -179,6 +184,7 @@ public class PmdExporterBase extends BinaryExporter{
 
     /**
      * 頂点リストを出力する。
+     *
      * @param model モデルデータ
      * @throws IOException 出力エラー
      */
@@ -200,6 +206,7 @@ public class PmdExporterBase extends BinaryExporter{
 
     /**
      * 個別の頂点データを出力する。
+     *
      * @param vertex 頂点
      * @throws IOException 出力エラー
      */
@@ -233,6 +240,7 @@ public class PmdExporterBase extends BinaryExporter{
 
     /**
      * 面リストを出力する。
+     *
      * @param model モデルデータ
      * @throws IOException 出力エラー
      */
@@ -262,6 +270,7 @@ public class PmdExporterBase extends BinaryExporter{
 
     /**
      * マテリアル素材リストを出力する。
+     *
      * @param model モデルデータ
      * @throws IOException 出力エラー
      * @throws IllegalTextExportException シェーディングファイル情報が長すぎる
@@ -285,6 +294,7 @@ public class PmdExporterBase extends BinaryExporter{
 
     /**
      * フォンシェーディングの色情報を出力する。
+     *
      * @param material マテリアル情報
      * @throws IOException 出力エラー
      */
@@ -317,6 +327,7 @@ public class PmdExporterBase extends BinaryExporter{
 
     /**
      * シェーディング情報を出力する。
+     *
      * @param material マテリアル情報
      * @throws IOException 出力エラー
      * @throws IllegalTextExportException ファイル名が長すぎる
@@ -343,6 +354,7 @@ public class PmdExporterBase extends BinaryExporter{
 
     /**
      * シェーディングファイル情報を出力する。
+     *
      * @param shade シェーディング情報
      * @throws IOException 出力エラー
      * @throws IllegalTextExportException ファイル名が長すぎる
@@ -372,6 +384,7 @@ public class PmdExporterBase extends BinaryExporter{
 
     /**
      * ボーンリストを出力する。
+     *
      * @param model モデルデータ
      * @throws IOException 出力エラー
      * @throws IllegalTextExportException ボーン名が長すぎる
@@ -394,6 +407,7 @@ public class PmdExporterBase extends BinaryExporter{
 
     /**
      * 個別のボーン情報を出力する。
+     *
      * @param bone ボーン情報
      * @throws IOException 出力エラー
      * @throws IllegalTextExportException ボーン名が長すぎる
@@ -431,6 +445,7 @@ public class PmdExporterBase extends BinaryExporter{
 
     /**
      * IKチェーンリストを出力する。
+     *
      * @param model モデルデータ
      * @throws IOException 出力エラー
      */
@@ -452,6 +467,7 @@ public class PmdExporterBase extends BinaryExporter{
 
     /**
      * IKチェーンを出力する。
+     *
      * @param chain IKチェーン
      * @throws IOException 出力エラー
      */
@@ -485,6 +501,7 @@ public class PmdExporterBase extends BinaryExporter{
 
     /**
      * モーフリストを出力する。
+     *
      * @param model モデルデータ
      * @throws IOException 出力エラー
      * @throws IllegalTextExportException モーフ名が長すぎる
@@ -493,7 +510,7 @@ public class PmdExporterBase extends BinaryExporter{
             throws IOException, IllegalTextExportException{
         Map<MorphType, List<MorphPart>> morphMap = model.getMorphMap();
         Set<MorphType> typeSet = morphMap.keySet();
-        List<MorphPart> morphPartList = new LinkedList<MorphPart>();
+        List<MorphPart> morphPartList = new LinkedList<>();
 
         for(MorphType type : typeSet){
             List<MorphPart> partList = morphMap.get(type);
@@ -533,6 +550,7 @@ public class PmdExporterBase extends BinaryExporter{
 
     /**
      * BASEモーフを出力する。
+     *
      * @param model モデルデータ
      * @throws IOException 出力エラー
      * @throws IllegalTextExportException モーフ名が長すぎる
@@ -557,6 +575,7 @@ public class PmdExporterBase extends BinaryExporter{
 
     /**
      * モーフグループを出力する。
+     *
      * @param model モデルデータ
      * @throws IOException 出力エラー
      */
@@ -573,7 +592,7 @@ public class PmdExporterBase extends BinaryExporter{
         }
         dumpByte(totalMorph);
 
-        List<MorphType> typeList = new LinkedList<MorphType>();
+        List<MorphType> typeList = new LinkedList<>();
         for(MorphType type : typeSet){
             assert ! type.isBase();
             typeList.add(type);
@@ -596,6 +615,7 @@ public class PmdExporterBase extends BinaryExporter{
     /**
      * ボーングループリストを出力する。
      * デフォルトボーングループ内訳は出力されない。
+     *
      * @param model モデルデータ
      * @throws IOException 出力エラー
      * @throws IllegalTextExportException ボーングループ名が長すぎる
@@ -632,6 +652,7 @@ public class PmdExporterBase extends BinaryExporter{
     /**
      * 各種通し番号をshort値で出力する。
      * short値に収まらない上位ビットは捨てられる。
+     *
      * @param obj 番号づけられたオブジェクト
      * @throws IOException 出力エラー
      */
@@ -644,6 +665,7 @@ public class PmdExporterBase extends BinaryExporter{
 
     /**
      * 2次元位置情報を出力する。
+     *
      * @param position 2次元位置情報
      * @throws IOException 出力エラー
      */
@@ -659,6 +681,7 @@ public class PmdExporterBase extends BinaryExporter{
 
     /**
      * 3次元位置情報を出力する。
+     *
      * @param position 3次元位置情報
      * @throws IOException 出力エラー
      */
@@ -676,6 +699,7 @@ public class PmdExporterBase extends BinaryExporter{
 
     /**
      * 3次元ベクトル情報を出力する。
+     *
      * @param vector 3次元ベクトル
      * @throws IOException 出力エラー
      */
index c5ae1ac..150905d 100644 (file)
@@ -22,14 +22,15 @@ import jp.sfjp.mikutoga.pmd.model.PmdModel;
 
 /**
  * PMDファイルのエクスポーター(拡張1:英名対応)。
- * <p>
- * 任意のトゥーンファイル名対応以降のPMDファイルフォーマットを
+ *
+ * <p>任意のトゥーンファイル名対応以降のPMDファイルフォーマットを
  * 使いたくない場合はこのエクスポーターを用いて出力せよ。
  */
 public class PmdExporterExt1 extends PmdExporterBase{
 
     /**
      * コンストラクタ。
+     *
      * @param stream 出力ストリーム
      * @throws NullPointerException 引数がnull
      */
@@ -41,6 +42,7 @@ public class PmdExporterExt1 extends PmdExporterBase{
 
     /**
      * {@inheritDoc}
+     *
      * @param model {@inheritDoc}
      * @throws IOException {@inheritDoc}
      * @throws IllegalPmdDataException {@inheritDoc}
@@ -57,6 +59,7 @@ public class PmdExporterExt1 extends PmdExporterBase{
 
     /**
      * 英語名情報を出力する。
+     *
      * @param model モデルデータ
      * @throws IOException 出力エラー
      * @throws IllegalPmdDataException 文字列が長すぎる。
@@ -87,6 +90,7 @@ public class PmdExporterExt1 extends PmdExporterBase{
 
     /**
      * モデル基本情報を英語で出力する。
+     *
      * @param model モデルデータ
      * @throws IOException 出力エラー
      * @throws IllegalTextExportException 文字列が長すぎる。
@@ -106,6 +110,7 @@ public class PmdExporterExt1 extends PmdExporterBase{
 
     /**
      * ボーン英語名情報を出力する。
+     *
      * @param model モデルデータ
      * @throws IOException 出力エラー
      * @throws IllegalTextExportException 文字列が長すぎる。
@@ -123,6 +128,7 @@ public class PmdExporterExt1 extends PmdExporterBase{
 
     /**
      * モーフ英語名情報を出力する。
+     *
      * @param model モデルデータ
      * @throws IOException 出力エラー
      * @throws IllegalTextExportException 文字列が長すぎる。
@@ -147,6 +153,7 @@ public class PmdExporterExt1 extends PmdExporterBase{
 
     /**
      * ボーングループ英語名情報を出力する。
+     *
      * @param model モデルデータ
      * @throws IOException 出力エラー
      * @throws IllegalTextExportException 文字列が長すぎる
index ede02ae..64df86c 100644 (file)
@@ -17,14 +17,15 @@ import jp.sfjp.mikutoga.pmd.model.ToonMap;
 
 /**
  * PMDファイルのエクスポーター(拡張2:任意のトゥーンファイル名対応)。
- * <p>
- * 物理演算対応以降のPMDファイルフォーマットを
+ *
+ * <p>物理演算対応以降のPMDファイルフォーマットを
  * 使いたくない場合はこのエクスポーターを用いて出力せよ。
  */
 public class PmdExporterExt2 extends PmdExporterExt1{
 
     /**
      * コンストラクタ。
+     *
      * @param stream 出力ストリーム
      * @throws NullPointerException 引数がnull
      */
@@ -36,6 +37,7 @@ public class PmdExporterExt2 extends PmdExporterExt1{
 
     /**
      * {@inheritDoc}
+     *
      * @param model {@inheritDoc}
      * @throws IOException {@inheritDoc}
      * @throws IllegalPmdDataException {@inheritDoc}
@@ -56,6 +58,7 @@ public class PmdExporterExt2 extends PmdExporterExt1{
 
     /**
      * 独自トゥーンファイルテーブルを出力する。
+     *
      * @param model モデルデータ
      * @throws IOException 出力エラー
      * @throws IllegalTextExportException トゥーンファイル名が長すぎる
index 01af3ac..edbfe0a 100644 (file)
@@ -27,8 +27,8 @@ import jp.sfjp.mikutoga.pmd.model.RigidShape;
 
 /**
  * PMDファイルのエクスポーター(拡張3:物理演算対応)。
- * <p>
- * 物理演算対応のPMDファイルフォーマットを
+ *
+ * <p>物理演算対応のPMDファイルフォーマットを
  * 使いたい場合はこのエクスポーターを用いて出力せよ。
  */
 public class PmdExporterExt3 extends PmdExporterExt2{
@@ -37,6 +37,7 @@ public class PmdExporterExt3 extends PmdExporterExt2{
 
     /**
      * コンストラクタ。
+     *
      * @param stream 出力ストリーム
      * @throws NullPointerException 引数がnull
      */
@@ -48,6 +49,7 @@ public class PmdExporterExt3 extends PmdExporterExt2{
 
     /**
      * {@inheritDoc}
+     *
      * @param model {@inheritDoc}
      * @throws IOException {@inheritDoc}
      * @throws IllegalPmdDataException {@inheritDoc}
@@ -69,6 +71,7 @@ public class PmdExporterExt3 extends PmdExporterExt2{
 
     /**
      * 剛体リストを出力する。
+     *
      * @param model モデルデータ
      * @throws IOException 出力エラー
      * @throws IllegalTextExportException 長すぎる剛体名
@@ -90,6 +93,7 @@ public class PmdExporterExt3 extends PmdExporterExt2{
 
     /**
      * 個別の剛体情報を出力する。
+     *
      * @param rigid 剛体
      * @throws IOException 出力エラー
      * @throws IllegalTextExportException 長すぎる剛体名
@@ -130,6 +134,7 @@ public class PmdExporterExt3 extends PmdExporterExt2{
 
     /**
      * 剛体形状を出力する。
+     *
      * @param shape 剛体形状
      * @throws IOException 出力エラー
      */
@@ -151,6 +156,7 @@ public class PmdExporterExt3 extends PmdExporterExt2{
 
     /**
      * 力学設定を出力する。
+     *
      * @param dynamics 力学設定
      * @throws IOException 出力エラー
      */
@@ -173,6 +179,7 @@ public class PmdExporterExt3 extends PmdExporterExt2{
 
     /**
      * ジョイントリストを出力する。
+     *
      * @param model モデルデータ
      * @throws IOException 出力エラー
      * @throws IllegalTextExportException 長すぎるジョイント名
@@ -194,6 +201,7 @@ public class PmdExporterExt3 extends PmdExporterExt2{
 
     /**
      * 個別のジョイント情報を出力する。
+     *
      * @param joint ジョイント
      * @throws IOException 出力エラー
      * @throws IllegalTextExportException 長すぎるジョイント名
@@ -223,6 +231,7 @@ public class PmdExporterExt3 extends PmdExporterExt2{
 
     /**
      * 3次元範囲制約を出力する。
+     *
      * @param range 3次元範囲制約
      * @throws IOException 出力エラー
      */
@@ -248,6 +257,7 @@ public class PmdExporterExt3 extends PmdExporterExt2{
 
     /**
      * ラジアンによる3次元姿勢情報を出力する。
+     *
      * @param rad 3次元姿勢情報
      * @throws IOException 出力エラー
      */
@@ -265,6 +275,7 @@ public class PmdExporterExt3 extends PmdExporterExt2{
 
     /**
      * 度数法による3次元姿勢情報を出力する。
+     *
      * @param deg 3次元姿勢情報
      * @throws IOException 出力エラー
      */
index 7c3c561..e237b91 100644 (file)
@@ -40,8 +40,10 @@ public class PmdLoader {
 
     /**
      * 正常パース時に読み残したデータがあったか判定する。
+     *
      * <p>MMDでの仕様拡張による
      * PMDファイルフォーマットの拡張が行われた場合を想定。
+     *
      * @return 読み残したデータがあればtrue
      * @throws IllegalStateException まだパースを試みていない。
      */
@@ -53,6 +55,7 @@ public class PmdLoader {
     /**
      * PMDファイルの読み込みを行いモデル情報を返す。
      * 1インスタンスにつき一度しかロードできない。
+     *
      * @param source PMDファイル入力ソース
      * @return モデル情報
      * @throws IOException 入力エラー
@@ -78,7 +81,7 @@ public class PmdLoader {
         RigidBuilder    rigidBuilder    = new RigidBuilder(model);
         JointBuilder    jointBuilder    = new JointBuilder(model);
 
-        List<MorphPart> morphPartList = new ArrayList<MorphPart>();
+        List<MorphPart> morphPartList = new ArrayList<>();
         morphBuilder.setMorphPartList(morphPartList);
         textBuilder.setMorphPartList(morphPartList);
 
index 09a9023..e27878c 100644 (file)
@@ -18,6 +18,12 @@ import java.lang.annotation.Target;
 @Target(ElementType.METHOD)
 @Retention(RetentionPolicy.RUNTIME)
 @interface CloseXmlMark {
-    /** タグ指定。 */
+
+    /**
+     * タグ指定。
+     *
+     * @return tag
+     */
     PmdTag value();
+
 }
index d5d9a7b..c135d4f 100644 (file)
@@ -18,6 +18,12 @@ import java.lang.annotation.Target;
 @Target(ElementType.METHOD)
 @Retention(RetentionPolicy.RUNTIME)
 @interface OpenXmlMark {
-    /** タグ指定。 */
+
+    /**
+     * タグ指定。
+     *
+     * @return tag
+     */
     PmdTag value();
+
 }
index d7a977f..a5e831c 100644 (file)
@@ -93,7 +93,7 @@ enum PmdTag {
     ;
 
     private static final Map<String, PmdTag> NAME_MAP =
-            new HashMap<String, PmdTag>();
+            new HashMap<>();
 
     static{
         for(PmdTag tag : values()){
index 86d7e46..c9fa6b9 100644 (file)
@@ -28,41 +28,41 @@ class RefHelper {
 
     // マテリアル関連
     private final List<IdRefHolder<Material>> materialSfcGroupIdRefList =
-            new LinkedList<IdRefHolder<Material>>();
+            new LinkedList<>();
     private final List<IdRefHolder<Material>> materialToonIdRefList =
-            new LinkedList<IdRefHolder<Material>>();
+            new LinkedList<>();
     private final Map<String, Integer> toonIdxMap =
-            new HashMap<String, Integer>();
+            new HashMap<>();
 
     // ボーン関連
     private final Map<String, BoneInfo> boneIdMap =
-            new HashMap<String, BoneInfo>();
+            new HashMap<>();
     private final List<IdRefHolder<BoneInfo>> boneChainIdRefList =
-            new LinkedList<IdRefHolder<BoneInfo>>();
+            new LinkedList<>();
     private final List<IdRefHolder<BoneInfo>> boneSourceIdRefList =
-            new LinkedList<IdRefHolder<BoneInfo>>();
+            new LinkedList<>();
 
     // モーフ関連
     private final List<IdRefHolder<MorphVertex>> morphVertexIdRefList =
-            new LinkedList<IdRefHolder<MorphVertex>>();
+            new LinkedList<>();
 
     // 剛体関連
     private final Map<String, RigidInfo> rigidIdMap =
-            new HashMap<String, RigidInfo>();
+            new HashMap<>();
     private final Map<String, RigidGroup> rigidGroupIdMap =
-            new HashMap<String, RigidGroup>();
+            new HashMap<>();
     private final List<IdRefHolder<RigidInfo>> thghRigidGroupIdRefList =
-            new LinkedList<IdRefHolder<RigidInfo>>();
+            new LinkedList<>();
 
     // 面関連
     private final Map<String, List<Surface>> surfaceGroupIdMap =
-            new HashMap<String, List<Surface>>();
+            new HashMap<>();
     private final List<IdRefHolder<Surface>> surfaceVertexIdRef =
-            new LinkedList<IdRefHolder<Surface>>();
+            new LinkedList<>();
 
     // 頂点関連
     private final Map<String, Vertex> vertexIdMap =
-            new HashMap<String, Vertex>();
+            new HashMap<>();
 
 
     /**
@@ -81,7 +81,7 @@ class RefHelper {
      */
     void addSurfaceGroupIdRef(Material material, String idRef){
         IdRefHolder<Material> holder =
-                new IdRefHolder<Material>(material, idRef);
+                new IdRefHolder<>(material, idRef);
         this.materialSfcGroupIdRefList.add(holder);
 
         return;
@@ -96,7 +96,7 @@ class RefHelper {
         List<Surface> surfaceGroup =
                 this.surfaceGroupIdMap.get(surfaceGroupId);
         if(surfaceGroup == null){
-            surfaceGroup = new LinkedList<Surface>();
+            surfaceGroup = new LinkedList<>();
             this.surfaceGroupIdMap.put(surfaceGroupId, surfaceGroup);
         }
 
@@ -130,7 +130,7 @@ class RefHelper {
      */
     void addToonFileIdRef(Material material, String idRef){
         IdRefHolder<Material> holder =
-                new IdRefHolder<Material>(material, idRef);
+                new IdRefHolder<>(material, idRef);
         this.materialToonIdRefList.add(holder);
         return;
     }
@@ -190,7 +190,7 @@ class RefHelper {
     void addBoneChain(BoneInfo bone,
                         String prevBoneIdRef, String nextBoneIdRef ){
         IdRefHolder<BoneInfo> holder =
-                new IdRefHolder<BoneInfo>(bone, prevBoneIdRef, nextBoneIdRef);
+                new IdRefHolder<>(bone, prevBoneIdRef, nextBoneIdRef);
         this.boneChainIdRefList.add(holder);
         return;
     }
@@ -225,7 +225,7 @@ class RefHelper {
      */
     void addSrcBoneIdRef(BoneInfo bone, String srcBoneIdRef){
         IdRefHolder<BoneInfo> holder =
-                new IdRefHolder<BoneInfo>(bone, srcBoneIdRef);
+                new IdRefHolder<>(bone, srcBoneIdRef);
         this.boneSourceIdRefList.add(holder);
         return;
     }
@@ -253,7 +253,7 @@ class RefHelper {
      */
     void addMorphVertexIdRef(MorphVertex morphVertex, String vertexIdRef){
         IdRefHolder<MorphVertex> holder =
-                new IdRefHolder<MorphVertex>(morphVertex, vertexIdRef);
+                new IdRefHolder<>(morphVertex, vertexIdRef);
         this.morphVertexIdRefList.add(holder);
         return;
     }
@@ -285,7 +285,7 @@ class RefHelper {
      */
     void addThroughRigidGroupIdRef(RigidInfo rigid, String rigidGroupIdRef){
         IdRefHolder<RigidInfo> holder =
-                new IdRefHolder<RigidInfo>(rigid, rigidGroupIdRef);
+                new IdRefHolder<>(rigid, rigidGroupIdRef);
         this.thghRigidGroupIdRefList.add(holder);
         return;
     }
@@ -329,10 +329,10 @@ class RefHelper {
                             String vtxIdRef2,
                             String vtxIdRef3 ){
         IdRefHolder<Surface> holder =
-                new IdRefHolder<Surface>(surface,
-                                         vtxIdRef1,
-                                         vtxIdRef2,
-                                         vtxIdRef3 );
+                new IdRefHolder<>(surface,
+                                  vtxIdRef1,
+                                  vtxIdRef2,
+                                  vtxIdRef3 );
 
         this.surfaceVertexIdRef.add(holder);
 
index 1f9a4b0..66b94aa 100644 (file)
@@ -53,7 +53,7 @@ class SaxListener {
      */
     private static Collection<Method> filtMethod(Class<?> klass,
                                    Class<? extends Annotation> filter ){
-        Collection<Method> result = new LinkedList<Method>();
+        Collection<Method> result = new LinkedList<>();
 
         for(Method method : klass.getDeclaredMethods()){
             int modifiers = method.getModifiers();
@@ -77,7 +77,7 @@ class SaxListener {
      */
     private static Map<PmdTag, Method> getOpenDispatcher(Class<?> klass){
         Map<PmdTag, Method> result =
-                new EnumMap<PmdTag, Method>(PmdTag.class);
+                new EnumMap<>(PmdTag.class);
 
         for(Method method : filtMethod(klass, OpenXmlMark.class)){
             Annotation anno = method.getAnnotation(OpenXmlMark.class);
@@ -96,7 +96,7 @@ class SaxListener {
      */
     private static Map<PmdTag, Method> getCloseDispatcher(Class<?> klass){
         Map<PmdTag, Method> result =
-                new EnumMap<PmdTag, Method>(PmdTag.class);
+                new EnumMap<>(PmdTag.class);
 
         for(Method method : filtMethod(klass, CloseXmlMark.class)){
             Annotation anno = method.getAnnotation(CloseXmlMark.class);
index c118b28..06ac0fc 100644 (file)
@@ -54,7 +54,7 @@ class SaxMorphListener extends SaxListener{
     void closeMorphList(){
         Map<MorphType, List<MorphPart>> morphMap =
                 getPmdModel().getMorphMap();
-        List<MorphPart> tempList = new LinkedList<MorphPart>();
+        List<MorphPart> tempList = new LinkedList<>();
 
         tempList.addAll(morphMap.get(MorphType.EYEBROW));
         tempList.addAll(morphMap.get(MorphType.EYE));
index e1a8acf..2e00f27 100644 (file)
@@ -28,7 +28,9 @@ public final class Schema101009{
     public static final String LOCAL_SCHEMA_PMDXML =
             "resources/pmdxml-101009.xsd";
 
+    /** schema URI. */
     public static final URI URI_SCHEMA_PMDXML = URI.create(SCHEMA_PMDXML);
+    /** local resource URI. */
     public static final URI RES_SCHEMA_PMDXML;
 
     private static final Class<?> THISCLASS = Schema101009.class;
index caada11..4214176 100644 (file)
@@ -28,7 +28,9 @@ public final class Schema130128{
     public static final String LOCAL_SCHEMA_PMDXML =
             "resources/pmdxml-130128.xsd";
 
+    /** schema URI. */
     public static final URI URI_SCHEMA_PMDXML = URI.create(SCHEMA_PMDXML);
+    /** local resource URI. */
     public static final URI RES_SCHEMA_PMDXML;
 
     private static final Class<?> THISCLASS = Schema130128.class;
index f8db09c..0efa1aa 100644 (file)
@@ -17,6 +17,7 @@ import org.xml.sax.SAXException;
 
 /**
  * XMLモデルファイルパース用SAXハンドラ。
+ *
  * <p>下位リスナに各種通知が振り分けられる。
  */
 class XmlHandler implements ContentHandler{
@@ -44,7 +45,7 @@ class XmlHandler implements ContentHandler{
         SaxListener dynamicsListener = new SaxDynamicsListener(helper);
         SaxListener shapeListener    = new SaxShapeListener(helper);
 
-        this.listenerMap = new EnumMap<PmdTag, SaxListener>(PmdTag.class);
+        this.listenerMap = new EnumMap<>(PmdTag.class);
         this.listenerMap.put(PmdTag.PMD_MODEL,          modelListener);
         this.listenerMap.put(PmdTag.MATERIAL_LIST,      materialListener);
         this.listenerMap.put(PmdTag.BONE_LIST,          boneListener);
@@ -58,6 +59,7 @@ class XmlHandler implements ContentHandler{
 
     /**
      * ビルド対象のモデルを返す。
+     *
      * @return ビルド対象のモデル。ビルド前ならnull
      */
     PmdModel getPmdModel(){
@@ -66,6 +68,7 @@ class XmlHandler implements ContentHandler{
 
     /**
      * {@inheritDoc}
+     *
      * @throws SAXException {@inheritDoc}
      */
     @Override
@@ -81,6 +84,7 @@ class XmlHandler implements ContentHandler{
 
     /**
      * {@inheritDoc}
+     *
      * @throws SAXException {@inheritDoc}
      */
     @Override
@@ -92,6 +96,7 @@ class XmlHandler implements ContentHandler{
 
     /**
      * {@inheritDoc}
+     *
      * @param prefix {@inheritDoc}
      * @param uri {@inheritDoc}
      * @throws SAXException {@inheritDoc}
@@ -99,8 +104,8 @@ class XmlHandler implements ContentHandler{
     @Override
     public void startPrefixMapping(String prefix, String uri)
             throws SAXException {
-        if(   Schema101009.NS_PMDXML.equals(uri)
-           || Schema130128.NS_PMDXML.equals(uri) ){
+        if(    Schema101009.NS_PMDXML.equals(uri)
+            || Schema130128.NS_PMDXML.equals(uri) ){
             this.nspfx = prefix;
             this.nsuri = uri;
         }
@@ -109,6 +114,7 @@ class XmlHandler implements ContentHandler{
 
     /**
      * {@inheritDoc}
+     *
      * @param prefix {@inheritDoc}
      * @throws SAXException {@inheritDoc}
      */
@@ -123,6 +129,7 @@ class XmlHandler implements ContentHandler{
 
     /**
      * {@inheritDoc}
+     *
      * @param uri {@inheritDoc}
      * @param localName {@inheritDoc}
      * @param qName {@inheritDoc}
@@ -150,6 +157,7 @@ class XmlHandler implements ContentHandler{
 
     /**
      * タグ出現に従い通知リスナを切り替える。
+     *
      * @param tag タグ種別
      */
     private void switchListener(PmdTag tag){
@@ -163,6 +171,7 @@ class XmlHandler implements ContentHandler{
 
     /**
      * {@inheritDoc}
+     *
      * @param uri {@inheritDoc}
      * @param localName {@inheritDoc}
      * @param qName {@inheritDoc}
@@ -185,6 +194,7 @@ class XmlHandler implements ContentHandler{
 
     /**
      * {@inheritDoc}
+     *
      * @param locator {@inheritDoc}
      */
     @Override
@@ -195,6 +205,7 @@ class XmlHandler implements ContentHandler{
 
     /**
      * {@inheritDoc}
+     *
      * @param target {@inheritDoc}
      * @param data {@inheritDoc}
      * @throws SAXException {@inheritDoc}
@@ -208,6 +219,7 @@ class XmlHandler implements ContentHandler{
 
     /**
      * {@inheritDoc}
+     *
      * @param ch {@inheritDoc}
      * @param start {@inheritDoc}
      * @param length {@inheritDoc}
@@ -223,6 +235,7 @@ class XmlHandler implements ContentHandler{
 
     /**
      * {@inheritDoc}
+     *
      * @param ch {@inheritDoc}
      * @param start {@inheritDoc}
      * @param length {@inheritDoc}
@@ -237,6 +250,7 @@ class XmlHandler implements ContentHandler{
 
     /**
      * {@inheritDoc}
+     *
      * @param name {@inheritDoc}
      * @throws SAXException {@inheritDoc}
      */
index 555b283..19f0a3a 100644 (file)
@@ -14,8 +14,8 @@ public enum XmlModelFileType {
 
     /**
      * XMLファイル。
-     * <p>読み込み時のスキーマ判別は自動。
-     * 出力時のスキーマ種別は最新。
+     *
+     * <p>読み込み時のスキーマ判別は自動。出力時のスキーマ種別は最新。
      */
     XML_AUTO,
 
index c7a3411..3bd0a26 100644 (file)
@@ -27,7 +27,9 @@ public class XmlPmdLoader {
 
     /**
      * コンストラクタ。
+     *
      * <p>XMLリーダは名前空間をサポートしていなければならない。
+     *
      * @param reader XMLリーダ
      * @throws NullPointerException 引数がnull
      * @throws SAXException 機能不足のXMLリーダが渡された
@@ -49,6 +51,7 @@ public class XmlPmdLoader {
 
     /**
      * XMLのパースを開始する。
+     *
      * @param source XML入力
      * @return モデルデータ
      * @throws SAXException 構文エラー
index 900a7f2..5fe350f 100644 (file)
@@ -33,6 +33,7 @@ final class CmdLine {
 
     /**
      * コマンドライン解析を行う。
+     *
      * @param args コマンドライン
      * @return 解析されたコマンドライン並び
      */
@@ -43,11 +44,12 @@ final class CmdLine {
 
     /**
      * コマンドライン解析を行う。
+     *
      * @param argList コマンドライン
      * @return 解析されたコマンドライン並び
      */
     static List<CmdLine> parse(List<String> argList){
-        List<CmdLine> result = new LinkedList<CmdLine>();
+        List<CmdLine> result = new LinkedList<>();
 
         Iterator<String> it = argList.iterator();
         while (it.hasNext()) {
@@ -62,7 +64,7 @@ final class CmdLine {
             if (info.opt != null) {
                 exArgNum = info.opt.getExArgNum();
             }
-            info.optArgs = new ArrayList<String>(exArgNum + 1);
+            info.optArgs = new ArrayList<>(exArgNum + 1);
 
             info.optArgs.add(arg);
 
@@ -81,8 +83,9 @@ final class CmdLine {
 
     /**
      * オプション識別子を返す。
+     *
      * @return オプション識別子。
-     * オプションを伴わない単純なコマンドライン引数の場合はnullを返す。
+     *     オプションを伴わない単純なコマンドライン引数の場合はnullを返す。
      */
     OptSwitch getOptSwitch() {
         return this.opt;
@@ -90,9 +93,10 @@ final class CmdLine {
 
     /**
      * オプションに付随する引数群を返す。
+     *
      * @return オプションに付随する引数群。
-     * 先頭要素はオプション識別子。
-     * 単純なコマンドライン引数の場合は自身が1要素のみを占める。
+     *     先頭要素はオプション識別子。
+     *     単純なコマンドライン引数の場合は自身が1要素のみを占める。
      */
     List<String> getOptArgs() {
         return this.optArgs;
index 9375b97..048219a 100644 (file)
@@ -26,7 +26,9 @@ public enum ModelFileType {
 
     /**
      * XMLファイル。
+     *
      * <p>読み込み時のスキーマ判別は自動。
+     *
      * <p>書き込み時のスキーマは最新。
      */
     XML_AUTO,
@@ -51,13 +53,15 @@ public enum ModelFileType {
     /**
      * コンストラクタ。
      */
-    private ModelFileType(){
+    ModelFileType(){
         return;
     }
 
     /**
      * ファイル種別をXMLファイル種別に変換する。
+     *
      * <p>未定義の場合はXML_AUTOを返す。
+     *
      * @return XMLファイル種別
      */
     public XmlModelFileType toXmlType(){
@@ -83,6 +87,7 @@ public enum ModelFileType {
 
     /**
      * ファイル種別がXMLか判定する。
+     *
      * @return XMLならtrue
      */
     public boolean isXml(){
@@ -104,6 +109,7 @@ public enum ModelFileType {
 
     /**
      * ファイル種別がPMDか判定する。
+     *
      * @return PMDならtrue
      */
     public boolean isPmd(){
index 9fc99b0..17d4edd 100644 (file)
@@ -73,6 +73,7 @@ final class OptInfo {
 
     /**
      * フォーマット種別指定子をデコードする。
+     *
      * @param arg 文字列
      * @return デコード結果。
      * @throws CmdLineException 不正なフォーマット種別
@@ -99,6 +100,7 @@ final class OptInfo {
 
     /**
      * 改行文字指定子をデコードする。
+     *
      * @param arg 文字列
      * @return デコード結果。
      * @throws CmdLineException 不正なフォーマット種別
@@ -121,6 +123,7 @@ final class OptInfo {
 
     /**
      * ブール指定子をデコードする。
+     *
      * @param arg 文字列
      * @return デコード結果。
      * @throws CmdLineException 不正なフォーマット種別
@@ -129,9 +132,9 @@ final class OptInfo {
             throws CmdLineException{
         boolean result;
 
-        if(   "on"  .equals(arg)
-           || "true".equals(arg)
-           || "yes" .equals(arg) ){
+        if(    "on"  .equals(arg)
+            || "true".equals(arg)
+            || "yes" .equals(arg) ){
             result = true;
         }else if(   "off"  .equals(arg)
                  || "false".equals(arg)
@@ -147,7 +150,9 @@ final class OptInfo {
 
     /**
      * ファイル名からファイル種別を類推する。
+     *
      * <p>拡張子が「pmd」ならPMDファイル、「xml」ならXMLファイル。
+     *
      * @param fileName ファイル名
      * @return ファイル種別
      */
@@ -164,6 +169,7 @@ final class OptInfo {
 
     /**
      * コマンドラインを解析する。
+     *
      * @param args コマンドライン
      * @return オプション情報
      * @throws CmdLineException 不正なコマンドライン
@@ -233,7 +239,9 @@ final class OptInfo {
 
     /**
      * 単純なコマンドラインエラーを検出する。
+     *
      * <p>検出項目は未知のオプションおよび不正な引数の個数
+     *
      * @param cmdLines コマンドライン
      * @throws CmdLineException 異常系
      */
@@ -266,6 +274,7 @@ final class OptInfo {
 
     /**
      * ファイルフォーマット情報の推測を行う。
+     *
      * @param result オプション情報
      */
     private static void fixFormat(OptInfo result){
@@ -282,6 +291,7 @@ final class OptInfo {
 
     /**
      * オプション整合性の事後検査。
+     *
      * @param result オプション情報
      * @throws CmdLineException 不正なオプション設定
      */
@@ -309,6 +319,7 @@ final class OptInfo {
 
     /**
      * ヘルプ表示が必要か否か判定する。
+     *
      * @return 必要ならtrue
      */
     boolean needHelp(){
@@ -317,6 +328,7 @@ final class OptInfo {
 
     /**
      * 入力ファイル種別を返す。
+     *
      * @return 入力ファイル種別
      */
     ModelFileType getInFileType(){
@@ -325,6 +337,7 @@ final class OptInfo {
 
     /**
      * 出力ファイル種別を返す。
+     *
      * @return 出力ファイル種別
      */
     ModelFileType getOutFileType(){
@@ -333,6 +346,7 @@ final class OptInfo {
 
     /**
      * 入力ファイル名を返す。
+     *
      * @return 入力ファイル名
      */
     String getInFilename(){
@@ -341,6 +355,7 @@ final class OptInfo {
 
     /**
      * 出力ファイル名を返す。
+     *
      * @return 出力ファイル名
      */
     String getOutFilename(){
@@ -349,6 +364,7 @@ final class OptInfo {
 
     /**
      * 上書きモードか否か返す。
+     *
      * @return 上書きモードならtrue
      */
     boolean overwriteMode(){
@@ -357,6 +373,7 @@ final class OptInfo {
 
     /**
      * XML改行文字を返す。
+     *
      * @return 改行文字
      */
     String getNewline(){
@@ -365,6 +382,7 @@ final class OptInfo {
 
     /**
      * ジェネレータ名を返す。
+     *
      * @return ジェネレータ名。表示したくない時はnull
      */
     String getGenerator(){
index 46aad83..b4ce1d2 100644 (file)
@@ -18,14 +18,14 @@ import java.util.Map;
  */
 enum OptSwitch {
 
-    OPT_HELP    (0, "-h", "-help", "-?"),
-    OPT_INFILE  (1, "-i"),
-    OPT_OUTFILE (1, "-o"),
-    OPT_FORCE   (0, "-f"),
-    OPT_NEWLINE (1, "-nl"),
-    OPT_GENOUT  (1, "-genout"),
-    OPT_IFORM   (1, "-iform"),
-    OPT_OFORM   (1, "-oform"),
+    OPT_HELP(    0, "-h", "-help", "-?"),
+    OPT_INFILE(  1, "-i"),
+    OPT_OUTFILE1, "-o"),
+    OPT_FORCE(   0, "-f"),
+    OPT_NEWLINE1, "-nl"),
+    OPT_GENOUT(  1, "-genout"),
+    OPT_IFORM(   1, "-iform"),
+    OPT_OFORM(   1, "-oform"),
     ;
 
     private static final String HELP_CONSOLE =
@@ -50,7 +50,7 @@ enum OptSwitch {
     private static final Map<String, OptSwitch> MAP_OPT;
 
     static{
-        Map<String, OptSwitch> map = new HashMap<String, OptSwitch>();
+        Map<String, OptSwitch> map = new HashMap<>();
 
         for(OptSwitch opt : values()){
             for(String cmdarg : opt.cmdopts){
@@ -69,10 +69,11 @@ enum OptSwitch {
 
     /**
      * コンストラクタ。
+     *
      * @param argnum 必要な引数の数
      * @param cmdopts オプションスイッチパターン群
      */
-    private OptSwitch(int argnum, String... cmdopts) {
+    OptSwitch(int argnum, String... cmdopts) {
         this.exArgNum = argnum;
 
         List<String> optlist;
@@ -86,6 +87,7 @@ enum OptSwitch {
 
     /**
      * コンソール提示用ヘルプ出力文字列を返す。
+     *
      * @return オプションヘルプ文字列
      */
     static String getConsoleHelp(){
@@ -94,7 +96,9 @@ enum OptSwitch {
 
     /**
      * 文字列に合致するオプションを返す。
+     *
      * <p>一つのオプションが複数の表記に合致する場合がある。
+     *
      * @param cmd 文字列
      * @return オプション種別。合致する物が見つからなければnull
      */
@@ -106,7 +110,9 @@ enum OptSwitch {
 
     /**
      * 各オプションに後続する引数の数を返す。
+     *
      * <p>引数をとらないオプションは0を返す。
+     *
      * @return 引数の数
      */
     int getExArgNum(){
index 05ba75d..a928de4 100644 (file)
@@ -110,6 +110,7 @@ public final class Pmd2Xml {
 
     /**
      * VMを終了させる。
+     *
      * @param code 終了コード
      * @see java.lang.System#exit(int)
      */
@@ -121,6 +122,7 @@ public final class Pmd2Xml {
 
     /**
      * 共通エラーメッセージを出力する。
+     *
      * @param text 個別メッセージ
      */
     private static void errMsg(String text){
@@ -131,6 +133,7 @@ public final class Pmd2Xml {
 
     /**
      * 標準エラー出力へ例外情報出力。
+     *
      * @param ex 例外
      * @param dumpStack スタックトレースを出力するならtrue
      */
@@ -147,6 +150,7 @@ public final class Pmd2Xml {
 
     /**
      * 標準エラー出力へ例外情報出力。
+     *
      * @param ex 例外
      */
     private static void thPrintln(Throwable ex){
@@ -157,6 +161,7 @@ public final class Pmd2Xml {
     /**
      * 入出力エラー処理。
      * 例外を出力してVM終了する。
+     *
      * @param ex 例外
      */
     private static void ioError(IOException ex){
@@ -167,6 +172,7 @@ public final class Pmd2Xml {
     /**
      * XML構文エラー処理。
      * 例外を出力してVM終了する。
+     *
      * @param ex 例外
      */
     private static void xmlError(Throwable ex){
@@ -177,6 +183,7 @@ public final class Pmd2Xml {
     /**
      * PMDファイルフォーマットエラー処理。
      * 例外を出力してVM終了する。
+     *
      * @param ex 例外
      */
     private static void pmdError(MmdFormatException ex){
@@ -187,6 +194,7 @@ public final class Pmd2Xml {
     /**
      * 内部エラー処理。
      * 例外を出力してVM終了する。
+     *
      * @param ex 例外
      */
     private static void internalError(Throwable ex){
@@ -222,8 +230,11 @@ public final class Pmd2Xml {
 
     /**
      * ファイルサイズを0に切り詰める。
+     *
      * <p>ファイルが存在しなければなにもしない。
+     *
      * <p>通常ファイルでなければなにもしない。
+     *
      * @param file ファイル
      * @throws IOException 入出力エラー
      */
@@ -250,7 +261,9 @@ public final class Pmd2Xml {
 
     /**
      * 入力ソースを準備する。
+     *
      * <p>入力ファイルが通常ファイルとして存在しなければエラー終了。
+     *
      * @param optInfo オプション情報
      * @return 入力ソース
      */
@@ -272,8 +285,11 @@ public final class Pmd2Xml {
 
     /**
      * 出力ストリームを準備する。
+     *
      * <p>出力ファイルが通常ファイルでない場合はエラー終了。
+     *
      * <p>既存の出力ファイルに上書き指示が伴っていなければエラー終了。
+     *
      * @param optInfo オプション情報
      * @return 出力ストリーム
      */
@@ -318,13 +334,14 @@ public final class Pmd2Xml {
 
     /**
      * オプション情報に従いコンバータを生成する。
+     *
      * @param optInfo オプション情報
      * @return コンバータ
      */
     private static Pmd2XmlConv buildConverter(OptInfo optInfo){
         Pmd2XmlConv converter = new Pmd2XmlConv();
 
-        converter.setInType (optInfo.getInFileType());
+        converter.setInTypeoptInfo.getInFileType());
         converter.setOutType(optInfo.getOutFileType());
 
         converter.setNewline(optInfo.getNewline());
@@ -335,7 +352,9 @@ public final class Pmd2Xml {
 
     /**
      * 実際のコンバート作業と異常系処理を行う。
+     *
      * <p>異常系が起きた場合、このメソッドは制御を戻さない。
+     *
      * @param converter コンバータ
      * @param source 入力ソース
      * @param ostream 出力ストリーム
@@ -362,11 +381,13 @@ public final class Pmd2Xml {
 
     /**
      * コマンドライン文字列をオプション情報としてパースする。
+     *
      * <p>異常系が起きた場合、このメソッドは制御を戻さない。
+     *
      * @param args コマンドライン文字列群
      * @return オプション情報
      */
-    private static OptInfo parseOption(String[] args){
+    private static OptInfo parseOption(String... args){
         OptInfo optInfo;
 
         try{
@@ -385,6 +406,7 @@ public final class Pmd2Xml {
 
     /**
      * Mainエントリ。
+     *
      * @param args コマンドパラメータ
      */
     public static void main(String[] args){
index 1b222f2..041c9e5 100644 (file)
@@ -53,6 +53,7 @@ public class Pmd2XmlConv {
 
     /**
      * 入力ファイル種別を設定する。
+     *
      * @param type ファイル種別
      * @throws NullPointerException 引数がnull
      * @throws IllegalArgumentException 具体的な種別を渡さなかった
@@ -67,6 +68,7 @@ public class Pmd2XmlConv {
 
     /**
      * 入力ファイル種別を返す。
+     *
      * @return ファイル種別
      */
     public ModelFileType getInTypes(){
@@ -75,6 +77,7 @@ public class Pmd2XmlConv {
 
     /**
      * 出力ファイル種別を設定する。
+     *
      * @param type ファイル種別
      * @throws NullPointerException 引数がnull
      * @throws IllegalArgumentException 具体的な種別を渡さなかった
@@ -89,6 +92,7 @@ public class Pmd2XmlConv {
 
     /**
      * 出力ファイル種別を返す。
+     *
      * @return ファイル種別
      */
     public ModelFileType getOutTypes(){
@@ -97,6 +101,7 @@ public class Pmd2XmlConv {
 
     /**
      * XML出力用改行文字列を設定する。
+     *
      * @param newline 改行文字
      */
     public void setNewline(String newline){
@@ -106,6 +111,7 @@ public class Pmd2XmlConv {
 
     /**
      * XML出力用改行文字列を返す。
+     *
      * @return 改行文字
      */
     public String getNewline(){
@@ -114,6 +120,7 @@ public class Pmd2XmlConv {
 
     /**
      * ジェネレータ名を設定する。
+     *
      * @param generator ジェネレータ名。表示したくない場合はnull
      */
     public void setGenerator(String generator){
@@ -123,6 +130,7 @@ public class Pmd2XmlConv {
 
     /**
      * ジェネレータ名を返す。
+     *
      * @return ジェネレータ名。非表示の場合はnullを返す。
      */
     public String getGenerator(){
@@ -131,8 +139,10 @@ public class Pmd2XmlConv {
 
     /**
      * ファイル変換を行う。
+     *
      * <p>XML入力の場合は{@link #convert(InputSource, OutputStream)}を
      * 推奨する。
+     *
      * @param is 入力ストリーム
      * @param os 出力ストリーム
      * @throws IOException 入力エラー
@@ -154,10 +164,13 @@ public class Pmd2XmlConv {
 
     /**
      * ファイル変換を行う。
+     *
      * <p>PMD入力の場合は{@link InputStream}に
      * バイトストリームが直接設定されていなければならない。
+     *
      * <p>XML入力の場合は{@link InputStream}に
      * URL(systemId)のみの設定を推奨する。
+     *
      * @param source 入力ソース
      * @param os 出力ストリーム
      * @throws IOException 入力エラー
@@ -179,8 +192,10 @@ public class Pmd2XmlConv {
 
     /**
      * モデルファイルを読み込む。
+     *
      * <p>XML読み込みの場合は、
      * こちらより{@link #readModel(InputSource)}版を推奨する。
+     *
      * @param is 入力ストリーム
      * @return モデルデータ
      * @throws IOException 入力エラー
@@ -208,6 +223,7 @@ public class Pmd2XmlConv {
 
     /**
      * モデルファイルを読み込む。
+     *
      * @param source 入力ソース
      * @return モデルデータ
      * @throws IOException 入力エラー
@@ -240,6 +256,7 @@ public class Pmd2XmlConv {
 
     /**
      * モデルファイルを出力する。
+     *
      * @param model モデルデータ
      * @param os 出力ストリーム
      * @throws IOException 出力エラー
@@ -261,6 +278,7 @@ public class Pmd2XmlConv {
 
     /**
      * PMDファイルからモデルデータを読み込む。
+     *
      * @param is 入力ストリーム
      * @return モデルデータ
      * @throws IOException 入力エラー
@@ -275,6 +293,7 @@ public class Pmd2XmlConv {
 
     /**
      * XMLファイルからモデルデータを読み込む。
+     *
      * @param source 入力ソース
      * @return モデルデータ
      * @throws IOException 入力エラー
@@ -293,6 +312,7 @@ public class Pmd2XmlConv {
 
     /**
      * モデルデータをPMDファイルに出力する。
+     *
      * @param model モデルデータ
      * @param ostream 出力ストリーム
      * @throws IOException 出力エラー
@@ -308,6 +328,7 @@ public class Pmd2XmlConv {
 
     /**
      * モデルデータをXMLファイルに出力する。
+     *
      * @param model モデルデータ
      * @param ostream 出力ストリーム
      * @throws IOException 出力エラー
index e1a87b8..d17c406 100644 (file)
@@ -14,6 +14,7 @@ import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URL;
+import javax.xml.XMLConstants;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
@@ -25,6 +26,8 @@ import jp.sfjp.mikutoga.xml.NoopEntityResolver;
 import jp.sfjp.mikutoga.xml.SchemaUtil;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
 import org.xml.sax.XMLReader;
 
 /**
@@ -32,6 +35,16 @@ import org.xml.sax.XMLReader;
  */
 final class XmlInputUtil {
 
+    private static final String F_DISALLOW_DOCTYPE_DECL =
+            "http://apache.org/xml/features/disallow-doctype-decl";
+    private static final String F_EXTERNAL_GENERAL_ENTITIES =
+            "http://xml.org/sax/features/external-general-entities";
+    private static final String F_EXTERNAL_PARAMETER_ENTITIES =
+            "http://xml.org/sax/features/external-parameter-entities";
+    private static final String F_LOAD_EXTERNAL_DTD =
+            "http://apache.org/xml/features/nonvalidating/load-external-dtd";
+
+
     /**
      * 隠しコンストラクタ。
      */
@@ -43,6 +56,7 @@ final class XmlInputUtil {
 
     /**
      * 実在ファイルからXML入力ソースを得る。
+     *
      * @param file 実在ファイル
      * @return XML入力ソース
      */
@@ -69,8 +83,10 @@ final class XmlInputUtil {
 
     /**
      * InputSourceからInputStreamを得る。
+     *
      * <p>入力ソースには、少なくともバイトストリームか
      * URL文字列(SystemId)のいずれかが設定されていなければならない。
+     *
      * @param source 入力ソース
      * @return 入力バイトストリーム
      * @throws IllegalArgumentException 入力ソースの設定が足りない。
@@ -97,11 +113,13 @@ final class XmlInputUtil {
 
     /**
      * SAXパーサファクトリを生成する。
+     *
      * <ul>
      * <li>XML名前空間機能は有効になる。
      * <li>DTDによる形式検証は無効となる。
      * <li>XIncludeによる差し込み機能は無効となる。
      * </ul>
+     *
      * @param schema スキーマ
      * @return ファクトリ
      */
@@ -111,7 +129,19 @@ final class XmlInputUtil {
         factory.setNamespaceAware(true);
         factory.setValidating(false);
         factory.setXIncludeAware(false);
-//      factory.setFeature(name, value);
+
+        try{
+            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+            factory.setFeature(F_DISALLOW_DOCTYPE_DECL, true);
+            factory.setFeature(F_EXTERNAL_GENERAL_ENTITIES, false);
+            factory.setFeature(F_EXTERNAL_PARAMETER_ENTITIES, false);
+            factory.setFeature(F_LOAD_EXTERNAL_DTD, false);
+        }catch(   ParserConfigurationException
+                | SAXNotRecognizedException
+                | SAXNotSupportedException e ){
+            assert false;
+            throw new AssertionError(e);
+        }
 
         factory.setSchema(schema);
 
@@ -120,6 +150,7 @@ final class XmlInputUtil {
 
     /**
      * SAXパーサを生成する。
+     *
      * @param schema スキーマ
      * @return SAXパーサ
      */
@@ -134,14 +165,20 @@ final class XmlInputUtil {
             throw new AssertionError(e);
         }
 
-//      parser.setProperty(name, value);
+        try{
+            parser.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, "");
+            parser.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
+        }catch(SAXNotRecognizedException | SAXNotSupportedException e){
+            assert false;
+            throw new AssertionError(e);
+        }
 
         return parser;
     }
 
     /**
      * スキーマを生成する。
-     * @param resolver リゾルバ
+     *
      * @param xmlInType 入力XML種別
      * @return スキーマ
      */
@@ -181,7 +218,9 @@ final class XmlInputUtil {
 
     /**
      * XMLリーダを生成する。
+     *
      * <p>エラーハンドラには{@link BotherHandler}が指定される。
+     *
      * @param xmlInType 入力XML種別
      * @return XMLリーダ
      */