elharo commented on code in PR #1194:
URL: https://github.com/apache/maven/pull/1194#discussion_r1251298102


##########
api/maven-api-settings/src/main/mdo/settings.mdo:
##########
@@ -459,17 +459,19 @@
         The <code>&lt;proxy&gt;</code> element contains informations required 
to a proxy settings.
         ]]></description>
       <fields>
-        <field>
-          <name>active</name>
+        <field xml.tagName="active">
+          <name>activeString</name>
           <version>1.0.0+</version>
           <required>false</required>
           <defaultValue>true</defaultValue>
           <description>
             <![CDATA[

Review Comment:
   CDATA not needed here



##########
api/maven-api-settings/src/main/mdo/settings.mdo:
##########
@@ -502,15 +504,17 @@
           </description>
           <type>String</type>
         </field>
-        <field>
-          <name>port</name>
+        <field xml.tagName="port">
+          <name>portString</name>
           <version>1.0.0+</version>
           <description>
             <![CDATA[

Review Comment:
   CDATA not needed here



##########
api/maven-api-settings/src/main/mdo/settings.mdo:
##########
@@ -535,6 +539,62 @@
           <type>String</type>
         </field>
       </fields>
+      <codeSegments>
+        <codeSegment>
+          <version>1.0.0/1.3.0</version>
+          <code>
+            <![CDATA[
+    public boolean isActive() {
+        return (getActiveString() != null) ? 
Boolean.parseBoolean(getActiveString()) : true;
+    }
+
+    public void setActive(boolean active) {
+        setActiveString(String.valueOf(active));
+    }
+
+    public int getPort() {
+        return (getPortString() != null) ? Integer.parseInt(getPortString()) : 
8080;
+    }
+
+    public void setPort(int port) {
+        setPortString(String.valueOf(port));
+    }
+            ]]>
+          </code>
+        </codeSegment>
+        <codeSegment>
+          <version>2.0.0+</version>
+          <code>
+            <![CDATA[
+    /**
+     * Indicates if this proxy is active or not.
+     * To allow interpolation of this field, this method lazily parses
+     * the {@link #getActiveString()} value as a boolean and defaults to 
{@code true}
+     * if not set.
+     *
+     * @return a boolean indicating whether this proxy is active or not

Review Comment:
   delete "or not"



##########
api/maven-api-settings/src/main/mdo/settings.mdo:
##########
@@ -535,6 +539,62 @@
           <type>String</type>
         </field>
       </fields>
+      <codeSegments>
+        <codeSegment>
+          <version>1.0.0/1.3.0</version>
+          <code>
+            <![CDATA[
+    public boolean isActive() {
+        return (getActiveString() != null) ? 
Boolean.parseBoolean(getActiveString()) : true;
+    }
+
+    public void setActive(boolean active) {
+        setActiveString(String.valueOf(active));
+    }
+
+    public int getPort() {
+        return (getPortString() != null) ? Integer.parseInt(getPortString()) : 
8080;
+    }
+
+    public void setPort(int port) {
+        setPortString(String.valueOf(port));

Review Comment:
   This allows any port value, including negative numbers and other ints that 
aren't legal port values. An IllegalArgumentException might helpful.
   
   
   
[IllegalArgumentException](https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html)
 - if the port parameter is outside the specified range of valid port values, 
which is between 0 and 65535, inclusive.



##########
api/maven-api-settings/src/main/mdo/settings.mdo:
##########
@@ -535,6 +539,62 @@
           <type>String</type>
         </field>
       </fields>
+      <codeSegments>
+        <codeSegment>
+          <version>1.0.0/1.3.0</version>
+          <code>
+            <![CDATA[
+    public boolean isActive() {
+        return (getActiveString() != null) ? 
Boolean.parseBoolean(getActiveString()) : true;
+    }
+
+    public void setActive(boolean active) {
+        setActiveString(String.valueOf(active));
+    }
+
+    public int getPort() {
+        return (getPortString() != null) ? Integer.parseInt(getPortString()) : 
8080;
+    }
+
+    public void setPort(int port) {
+        setPortString(String.valueOf(port));
+    }
+            ]]>
+          </code>
+        </codeSegment>
+        <codeSegment>
+          <version>2.0.0+</version>
+          <code>
+            <![CDATA[
+    /**
+     * Indicates if this proxy is active or not.
+     * To allow interpolation of this field, this method lazily parses
+     * the {@link #getActiveString()} value as a boolean and defaults to 
{@code true}
+     * if not set.
+     *
+     * @return a boolean indicating whether this proxy is active or not
+     */
+    public boolean isActive() {
+        return (getActiveString() != null) ? 
Boolean.parseBoolean(getActiveString()) : true;
+    }
+
+    /**
+     * Returns the port to use for this proxy.
+     * To allow interpolation of this field, this method lazily parses
+     * the {@link #getPortString()} value as an integer and defaults to {@code 
8080}
+     * if not set.
+     *
+     * @return an integer indicating the port to use for this proxy
+     * @throws NumberFormatException if the port string is not a valid integer

Review Comment:
   This should happen when the port string is set, not later when the getter 
method is called



##########
api/maven-api-settings/src/main/mdo/settings.mdo:
##########
@@ -535,6 +539,62 @@
           <type>String</type>
         </field>
       </fields>
+      <codeSegments>
+        <codeSegment>
+          <version>1.0.0/1.3.0</version>
+          <code>
+            <![CDATA[

Review Comment:
   CDATA not needed here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to