Skip to content

Commit

Permalink
#1747 issue number is long
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jun 5, 2024
1 parent 13236a3 commit c6a1b75
Show file tree
Hide file tree
Showing 25 changed files with 206 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .rultor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
docker:
image: yegor256/rultor-image:1.13.0
image: yegor256/rultor-image:1.23.1
assets:
settings.xml: yegor256/home#assets/jcabi/settings.xml
secring.gpg: yegor256/home#assets/secring.gpg
Expand Down
12 changes: 9 additions & 3 deletions src/main/java/com/jcabi/github/Comment.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import com.jcabi.aspects.Immutable;
import com.jcabi.aspects.Loggable;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.text.ParseException;
import java.util.Collection;
Expand Down Expand Up @@ -79,7 +81,7 @@ public interface Comment
* Number.
* @return Comment number
*/
int number();
long number();

/**
* Delete the comment.
Expand Down Expand Up @@ -161,7 +163,11 @@ public void body(final String text) throws IOException {
* @throws IOException If there is any I/O problem
*/
public URL url() throws IOException {
return new URL(this.jsn.text("url"));
try {
return new URI(this.jsn.text("url")).toURL();
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}
/**
* When this comment was created.
Expand Down Expand Up @@ -196,7 +202,7 @@ public Issue issue() {
return this.comment.issue();
}
@Override
public int number() {
public long number() {
return this.comment.number();
}
@Override
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/com/jcabi/github/Commit.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import com.jcabi.aspects.Immutable;
import com.jcabi.aspects.Loggable;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import javax.json.JsonObject;
import lombok.EqualsAndHashCode;
Expand Down Expand Up @@ -106,7 +108,11 @@ public String message() throws IOException {
* @throws IOException If there is any I/O problem
*/
public URL url() throws IOException {
return new URL(this.jsn.text("url"));
try {
return new URI(this.jsn.text("url")).toURL();
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}
@Override
public Repo repo() {
Expand Down
20 changes: 17 additions & 3 deletions src/main/java/com/jcabi/github/Content.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import com.jcabi.aspects.Loggable;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import javax.json.JsonObject;
import javax.xml.bind.DatatypeConverter;
Expand Down Expand Up @@ -134,23 +136,35 @@ public String sha() throws IOException {
* @throws IOException If there is any I/O problem
*/
public URL url() throws IOException {
return new URL(this.jsn.text("url"));
try {
return new URI(this.jsn.text("url")).toURL();
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}
/**
* Get its HTML URL.
* @return URL of content
* @throws IOException If there is any I/O problem
*/
public URL htmlUrl() throws IOException {
return new URL(this.jsn.text("html_url"));
try {
return new URI(this.jsn.text("html_url")).toURL();
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}
/**
* Get its GIT URL.
* @return URL of content
* @throws IOException If there is any I/O problem
*/
public URL gitUrl() throws IOException {
return new URL(this.jsn.text("git_url"));
try {
return new URI(this.jsn.text("git_url")).toURL();
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}
/**
* Get its encoded content.
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/com/jcabi/github/DeployKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import com.jcabi.aspects.Immutable;
import com.jcabi.aspects.Loggable;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import javax.json.Json;
import javax.json.JsonObject;
Expand Down Expand Up @@ -118,7 +120,11 @@ public void key(final String value) throws IOException {
* @throws IOException If there is any I/O problem
*/
public URL url() throws IOException {
return new URL(this.jsn.text("url"));
try {
return new URI(this.jsn.text("url")).toURL();
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}

/**
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/com/jcabi/github/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import com.jcabi.aspects.Immutable;
import com.jcabi.aspects.Loggable;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.text.ParseException;
import java.util.Date;
Expand Down Expand Up @@ -223,7 +225,11 @@ public String type() throws IOException {
* @throws IOException If there is any I/O problem
*/
public URL url() throws IOException {
return new URL(this.jsn.text("url"));
try {
return new URI(this.jsn.text("url")).toURL();
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}
/**
* When this issue was created.
Expand Down
32 changes: 27 additions & 5 deletions src/main/java/com/jcabi/github/Fork.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import com.jcabi.aspects.Immutable;
import com.jcabi.aspects.Loggable;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import javax.json.JsonObject;
import lombok.EqualsAndHashCode;
Expand Down Expand Up @@ -103,7 +105,11 @@ public String organization() throws IOException {
* @throws IOException If there is any I/O problem
*/
public URL url() throws IOException {
return new URL(this.jsn.text("url"));
try {
return new URI(this.jsn.text("url")).toURL();
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}

/**
Expand All @@ -130,7 +136,11 @@ public String description() throws IOException {
* @throws IOException If there is any I/O problem
*/
public URL htmlUrl() throws IOException {
return new URL(this.jsn.text("html_url"));
try {
return new URI(this.jsn.text("html_url")).toURL();
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}

/**
Expand All @@ -139,7 +149,11 @@ public URL htmlUrl() throws IOException {
* @throws IOException If there is any I/O problem
*/
public URL cloneUrl() throws IOException {
return new URL(this.jsn.text("clone_url"));
try {
return new URI(this.jsn.text("clone_url")).toURL();
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}

/**
Expand All @@ -166,7 +180,11 @@ public String sshUrl() throws IOException {
* @throws IOException If there is any I/O problem
*/
public URL svnUrl() throws IOException {
return new URL(this.jsn.text("svn_url"));
try {
return new URI(this.jsn.text("svn_url")).toURL();
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}

/**
Expand All @@ -184,7 +202,11 @@ public String mirrorUrl() throws IOException {
* @throws IOException If there is any I/O problem
*/
public URL homeUrl() throws IOException {
return new URL(this.jsn.text("homepage"));
try {
return new URI(this.jsn.text("homepage")).toURL();
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}

/**
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/com/jcabi/github/GistComment.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import com.jcabi.aspects.Immutable;
import com.jcabi.aspects.Loggable;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.text.ParseException;
import java.util.Date;
Expand Down Expand Up @@ -149,7 +151,11 @@ public void body(final String text) throws IOException {
* @throws IOException If there is any I/O problem
*/
public URL url() throws IOException {
return new URL(this.jsn.text("url"));
try {
return new URI(this.jsn.text("url")).toURL();
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}

/**
Expand Down
14 changes: 12 additions & 2 deletions src/main/java/com/jcabi/github/Issue.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import com.jcabi.aspects.Immutable;
import com.jcabi.aspects.Loggable;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.text.ParseException;
import java.util.ArrayList;
Expand Down Expand Up @@ -320,15 +322,23 @@ public void assign(final String login) throws IOException {
* @throws IOException If there is any I/O problem
*/
public URL url() throws IOException {
return new URL(this.jsn.text("url"));
try {
return new URI(this.jsn.text("url")).toURL();
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}
/**
* Get its HTML URL.
* @return URL of issue
* @throws IOException If there is any I/O problem
*/
public URL htmlUrl() throws IOException {
return new URL(this.jsn.text("html_url"));
try {
return new URI(this.jsn.text("html_url")).toURL();
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}
/**
* When this issue was created.
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/com/jcabi/github/Milestone.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import com.jcabi.aspects.Immutable;
import com.jcabi.aspects.Loggable;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.text.ParseException;
import java.util.Date;
Expand Down Expand Up @@ -245,7 +247,11 @@ public void description(
* @throws IOException If there is any I/O problem
*/
public URL url() throws IOException {
return new URL(this.jsn.text("url"));
try {
return new URI(this.jsn.text("url")).toURL();
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}

/**
Expand Down
20 changes: 17 additions & 3 deletions src/main/java/com/jcabi/github/Organization.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import com.jcabi.aspects.Immutable;
import com.jcabi.aspects.Loggable;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.text.ParseException;
import java.util.Date;
Expand Down Expand Up @@ -245,7 +247,11 @@ public String blog() throws IOException {
* @throws IOException If there is any I/O problem
*/
public URL url() throws IOException {
return new URL(this.jsn.text("url"));
try {
return new URI(this.jsn.text("url")).toURL();
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}

/**
Expand All @@ -254,7 +260,11 @@ public URL url() throws IOException {
* @throws IOException If there is any I/O problem
*/
public URL htmlUrl() throws IOException {
return new URL(this.jsn.text("html_url"));
try {
return new URI(this.jsn.text("html_url")).toURL();
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}

/**
Expand All @@ -263,7 +273,11 @@ public URL htmlUrl() throws IOException {
* @throws IOException If there is any I/O problem
*/
public URL avatarUrl() throws IOException {
return new URL(this.jsn.text("avatar_url"));
try {
return new URI(this.jsn.text("avatar_url")).toURL();
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}

/**
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/com/jcabi/github/PublicKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import com.jcabi.aspects.Immutable;
import com.jcabi.aspects.Loggable;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import javax.json.Json;
import javax.json.JsonObject;
Expand Down Expand Up @@ -132,7 +134,11 @@ public void key(
* @throws IOException If there is any I/O problem
*/
public URL url() throws IOException {
return new URL(this.jsn.text("url"));
try {
return new URI(this.jsn.text("url")).toURL();
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}

/**
Expand Down
Loading

0 comments on commit c6a1b75

Please sign in to comment.