1010import WikiBot .Utils .ArrayUtils ;
1111
1212/**
13+ * @Description
1314 * This class is a base for making APIcommands.
1415 *
1516 * APIcommands are commands to a wiki's API.
@@ -61,7 +62,7 @@ protected void enforceMWVersion(String introduced) {
6162 protected void enforceMWVersion (String introduced , String removed ) {
6263 VersionNumber myVersion = getMWVersion ();
6364
64- if ((myVersion .compareTo (introduced ) < 0 || introduced == null ) && ( myVersion .compareTo (removed ) > 0 || removed == null )) {
65+ if ((introduced == null || myVersion .compareTo (introduced ) < 0 ) && ( removed == null || myVersion .compareTo (removed ) > 0 )) {
6566 throw new UnsupportedError ("The " + getLanguage () + " wiki does not support this API command. (command name: " + commandName + ")" );
6667 }
6768 }
@@ -85,16 +86,6 @@ public void addParameter(String key, String value) {
8586 values .add (value );
8687 }
8788
88- public boolean setParameter (String key , String value ) {
89- if (keys .contains (key )) {
90- values .set (keys .indexOf (key ), value );
91- return true ;
92- } else {
93- addParameter (key , value );
94- return false ;
95- }
96- }
97-
9889 public boolean removeParameter (String key ) {
9990 if (keys .contains (key )) {
10091 values .remove (keys .indexOf (key ));
@@ -159,8 +150,12 @@ public String getSummary() {
159150 temp += "\n Page name: " + pl .getTitle ();
160151 temp += "\n Edit type: " + getValue ("action" );
161152 for (String key : keys ) {
162- if (!(key .equals ("action" ) || key .equals ("title" ) || key .contains ("text" ) || key .equals ("filename" ) || key .equals ("from" ))) {
163- temp += "\n " + key .substring (0 ,1 ).toUpperCase () + key .substring (1 ) + ": " + getValue (key );
153+ if (!(key .equals ("action" ) || key .equals ("title" ) || key .contains ("text" ) || key .equals ("filename" ) || key .equals ("from" ) || key .equals ("format" ))) {
154+ if (getValue (key ) == null ) {
155+ temp += "\n " + key .substring (0 ,1 ).toUpperCase () + key .substring (1 );
156+ } else {
157+ temp += "\n " + key .substring (0 ,1 ).toUpperCase () + key .substring (1 ) + ": " + getValue (key );
158+ }
164159 }
165160 }
166161 if (doesKeyExist ("text" )) {
0 commit comments