Skip to content

Commit c6a1b75

Browse files
committed
#1747 issue number is long
1 parent 13236a3 commit c6a1b75

25 files changed

+206
-54
lines changed

.rultor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
docker:
2-
image: yegor256/rultor-image:1.13.0
2+
image: yegor256/rultor-image:1.23.1
33
assets:
44
settings.xml: yegor256/home#assets/jcabi/settings.xml
55
secring.gpg: yegor256/home#assets/secring.gpg

src/main/java/com/jcabi/github/Comment.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import com.jcabi.aspects.Immutable;
3333
import com.jcabi.aspects.Loggable;
3434
import java.io.IOException;
35+
import java.net.URI;
36+
import java.net.URISyntaxException;
3537
import java.net.URL;
3638
import java.text.ParseException;
3739
import java.util.Collection;
@@ -79,7 +81,7 @@ public interface Comment
7981
* Number.
8082
* @return Comment number
8183
*/
82-
int number();
84+
long number();
8385

8486
/**
8587
* Delete the comment.
@@ -161,7 +163,11 @@ public void body(final String text) throws IOException {
161163
* @throws IOException If there is any I/O problem
162164
*/
163165
public URL url() throws IOException {
164-
return new URL(this.jsn.text("url"));
166+
try {
167+
return new URI(this.jsn.text("url")).toURL();
168+
} catch (final URISyntaxException ex) {
169+
throw new IllegalArgumentException(ex);
170+
}
165171
}
166172
/**
167173
* When this comment was created.
@@ -196,7 +202,7 @@ public Issue issue() {
196202
return this.comment.issue();
197203
}
198204
@Override
199-
public int number() {
205+
public long number() {
200206
return this.comment.number();
201207
}
202208
@Override

src/main/java/com/jcabi/github/Commit.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import com.jcabi.aspects.Immutable;
3333
import com.jcabi.aspects.Loggable;
3434
import java.io.IOException;
35+
import java.net.URI;
36+
import java.net.URISyntaxException;
3537
import java.net.URL;
3638
import javax.json.JsonObject;
3739
import lombok.EqualsAndHashCode;
@@ -106,7 +108,11 @@ public String message() throws IOException {
106108
* @throws IOException If there is any I/O problem
107109
*/
108110
public URL url() throws IOException {
109-
return new URL(this.jsn.text("url"));
111+
try {
112+
return new URI(this.jsn.text("url")).toURL();
113+
} catch (final URISyntaxException ex) {
114+
throw new IllegalArgumentException(ex);
115+
}
110116
}
111117
@Override
112118
public Repo repo() {

src/main/java/com/jcabi/github/Content.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
import com.jcabi.aspects.Loggable;
3434
import java.io.IOException;
3535
import java.io.InputStream;
36+
import java.net.URI;
37+
import java.net.URISyntaxException;
3638
import java.net.URL;
3739
import javax.json.JsonObject;
3840
import javax.xml.bind.DatatypeConverter;
@@ -134,23 +136,35 @@ public String sha() throws IOException {
134136
* @throws IOException If there is any I/O problem
135137
*/
136138
public URL url() throws IOException {
137-
return new URL(this.jsn.text("url"));
139+
try {
140+
return new URI(this.jsn.text("url")).toURL();
141+
} catch (final URISyntaxException ex) {
142+
throw new IllegalArgumentException(ex);
143+
}
138144
}
139145
/**
140146
* Get its HTML URL.
141147
* @return URL of content
142148
* @throws IOException If there is any I/O problem
143149
*/
144150
public URL htmlUrl() throws IOException {
145-
return new URL(this.jsn.text("html_url"));
151+
try {
152+
return new URI(this.jsn.text("html_url")).toURL();
153+
} catch (final URISyntaxException ex) {
154+
throw new IllegalArgumentException(ex);
155+
}
146156
}
147157
/**
148158
* Get its GIT URL.
149159
* @return URL of content
150160
* @throws IOException If there is any I/O problem
151161
*/
152162
public URL gitUrl() throws IOException {
153-
return new URL(this.jsn.text("git_url"));
163+
try {
164+
return new URI(this.jsn.text("git_url")).toURL();
165+
} catch (final URISyntaxException ex) {
166+
throw new IllegalArgumentException(ex);
167+
}
154168
}
155169
/**
156170
* Get its encoded content.

src/main/java/com/jcabi/github/DeployKey.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import com.jcabi.aspects.Immutable;
3333
import com.jcabi.aspects.Loggable;
3434
import java.io.IOException;
35+
import java.net.URI;
36+
import java.net.URISyntaxException;
3537
import java.net.URL;
3638
import javax.json.Json;
3739
import javax.json.JsonObject;
@@ -118,7 +120,11 @@ public void key(final String value) throws IOException {
118120
* @throws IOException If there is any I/O problem
119121
*/
120122
public URL url() throws IOException {
121-
return new URL(this.jsn.text("url"));
123+
try {
124+
return new URI(this.jsn.text("url")).toURL();
125+
} catch (final URISyntaxException ex) {
126+
throw new IllegalArgumentException(ex);
127+
}
122128
}
123129

124130
/**

src/main/java/com/jcabi/github/Event.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
import com.jcabi.aspects.Immutable;
3434
import com.jcabi.aspects.Loggable;
3535
import java.io.IOException;
36+
import java.net.URI;
37+
import java.net.URISyntaxException;
3638
import java.net.URL;
3739
import java.text.ParseException;
3840
import java.util.Date;
@@ -223,7 +225,11 @@ public String type() throws IOException {
223225
* @throws IOException If there is any I/O problem
224226
*/
225227
public URL url() throws IOException {
226-
return new URL(this.jsn.text("url"));
228+
try {
229+
return new URI(this.jsn.text("url")).toURL();
230+
} catch (final URISyntaxException ex) {
231+
throw new IllegalArgumentException(ex);
232+
}
227233
}
228234
/**
229235
* When this issue was created.

src/main/java/com/jcabi/github/Fork.java

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import com.jcabi.aspects.Immutable;
3333
import com.jcabi.aspects.Loggable;
3434
import java.io.IOException;
35+
import java.net.URI;
36+
import java.net.URISyntaxException;
3537
import java.net.URL;
3638
import javax.json.JsonObject;
3739
import lombok.EqualsAndHashCode;
@@ -103,7 +105,11 @@ public String organization() throws IOException {
103105
* @throws IOException If there is any I/O problem
104106
*/
105107
public URL url() throws IOException {
106-
return new URL(this.jsn.text("url"));
108+
try {
109+
return new URI(this.jsn.text("url")).toURL();
110+
} catch (final URISyntaxException ex) {
111+
throw new IllegalArgumentException(ex);
112+
}
107113
}
108114

109115
/**
@@ -130,7 +136,11 @@ public String description() throws IOException {
130136
* @throws IOException If there is any I/O problem
131137
*/
132138
public URL htmlUrl() throws IOException {
133-
return new URL(this.jsn.text("html_url"));
139+
try {
140+
return new URI(this.jsn.text("html_url")).toURL();
141+
} catch (final URISyntaxException ex) {
142+
throw new IllegalArgumentException(ex);
143+
}
134144
}
135145

136146
/**
@@ -139,7 +149,11 @@ public URL htmlUrl() throws IOException {
139149
* @throws IOException If there is any I/O problem
140150
*/
141151
public URL cloneUrl() throws IOException {
142-
return new URL(this.jsn.text("clone_url"));
152+
try {
153+
return new URI(this.jsn.text("clone_url")).toURL();
154+
} catch (final URISyntaxException ex) {
155+
throw new IllegalArgumentException(ex);
156+
}
143157
}
144158

145159
/**
@@ -166,7 +180,11 @@ public String sshUrl() throws IOException {
166180
* @throws IOException If there is any I/O problem
167181
*/
168182
public URL svnUrl() throws IOException {
169-
return new URL(this.jsn.text("svn_url"));
183+
try {
184+
return new URI(this.jsn.text("svn_url")).toURL();
185+
} catch (final URISyntaxException ex) {
186+
throw new IllegalArgumentException(ex);
187+
}
170188
}
171189

172190
/**
@@ -184,7 +202,11 @@ public String mirrorUrl() throws IOException {
184202
* @throws IOException If there is any I/O problem
185203
*/
186204
public URL homeUrl() throws IOException {
187-
return new URL(this.jsn.text("homepage"));
205+
try {
206+
return new URI(this.jsn.text("homepage")).toURL();
207+
} catch (final URISyntaxException ex) {
208+
throw new IllegalArgumentException(ex);
209+
}
188210
}
189211

190212
/**

src/main/java/com/jcabi/github/GistComment.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import com.jcabi.aspects.Immutable;
3333
import com.jcabi.aspects.Loggable;
3434
import java.io.IOException;
35+
import java.net.URI;
36+
import java.net.URISyntaxException;
3537
import java.net.URL;
3638
import java.text.ParseException;
3739
import java.util.Date;
@@ -149,7 +151,11 @@ public void body(final String text) throws IOException {
149151
* @throws IOException If there is any I/O problem
150152
*/
151153
public URL url() throws IOException {
152-
return new URL(this.jsn.text("url"));
154+
try {
155+
return new URI(this.jsn.text("url")).toURL();
156+
} catch (final URISyntaxException ex) {
157+
throw new IllegalArgumentException(ex);
158+
}
153159
}
154160

155161
/**

src/main/java/com/jcabi/github/Issue.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import com.jcabi.aspects.Immutable;
3333
import com.jcabi.aspects.Loggable;
3434
import java.io.IOException;
35+
import java.net.URI;
36+
import java.net.URISyntaxException;
3537
import java.net.URL;
3638
import java.text.ParseException;
3739
import java.util.ArrayList;
@@ -320,15 +322,23 @@ public void assign(final String login) throws IOException {
320322
* @throws IOException If there is any I/O problem
321323
*/
322324
public URL url() throws IOException {
323-
return new URL(this.jsn.text("url"));
325+
try {
326+
return new URI(this.jsn.text("url")).toURL();
327+
} catch (final URISyntaxException ex) {
328+
throw new IllegalArgumentException(ex);
329+
}
324330
}
325331
/**
326332
* Get its HTML URL.
327333
* @return URL of issue
328334
* @throws IOException If there is any I/O problem
329335
*/
330336
public URL htmlUrl() throws IOException {
331-
return new URL(this.jsn.text("html_url"));
337+
try {
338+
return new URI(this.jsn.text("html_url")).toURL();
339+
} catch (final URISyntaxException ex) {
340+
throw new IllegalArgumentException(ex);
341+
}
332342
}
333343
/**
334344
* When this issue was created.

src/main/java/com/jcabi/github/Milestone.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import com.jcabi.aspects.Immutable;
3333
import com.jcabi.aspects.Loggable;
3434
import java.io.IOException;
35+
import java.net.URI;
36+
import java.net.URISyntaxException;
3537
import java.net.URL;
3638
import java.text.ParseException;
3739
import java.util.Date;
@@ -245,7 +247,11 @@ public void description(
245247
* @throws IOException If there is any I/O problem
246248
*/
247249
public URL url() throws IOException {
248-
return new URL(this.jsn.text("url"));
250+
try {
251+
return new URI(this.jsn.text("url")).toURL();
252+
} catch (final URISyntaxException ex) {
253+
throw new IllegalArgumentException(ex);
254+
}
249255
}
250256

251257
/**

src/main/java/com/jcabi/github/Organization.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import com.jcabi.aspects.Immutable;
3333
import com.jcabi.aspects.Loggable;
3434
import java.io.IOException;
35+
import java.net.URI;
36+
import java.net.URISyntaxException;
3537
import java.net.URL;
3638
import java.text.ParseException;
3739
import java.util.Date;
@@ -245,7 +247,11 @@ public String blog() throws IOException {
245247
* @throws IOException If there is any I/O problem
246248
*/
247249
public URL url() throws IOException {
248-
return new URL(this.jsn.text("url"));
250+
try {
251+
return new URI(this.jsn.text("url")).toURL();
252+
} catch (final URISyntaxException ex) {
253+
throw new IllegalArgumentException(ex);
254+
}
249255
}
250256

251257
/**
@@ -254,7 +260,11 @@ public URL url() throws IOException {
254260
* @throws IOException If there is any I/O problem
255261
*/
256262
public URL htmlUrl() throws IOException {
257-
return new URL(this.jsn.text("html_url"));
263+
try {
264+
return new URI(this.jsn.text("html_url")).toURL();
265+
} catch (final URISyntaxException ex) {
266+
throw new IllegalArgumentException(ex);
267+
}
258268
}
259269

260270
/**
@@ -263,7 +273,11 @@ public URL htmlUrl() throws IOException {
263273
* @throws IOException If there is any I/O problem
264274
*/
265275
public URL avatarUrl() throws IOException {
266-
return new URL(this.jsn.text("avatar_url"));
276+
try {
277+
return new URI(this.jsn.text("avatar_url")).toURL();
278+
} catch (final URISyntaxException ex) {
279+
throw new IllegalArgumentException(ex);
280+
}
267281
}
268282

269283
/**

src/main/java/com/jcabi/github/PublicKey.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import com.jcabi.aspects.Immutable;
3333
import com.jcabi.aspects.Loggable;
3434
import java.io.IOException;
35+
import java.net.URI;
36+
import java.net.URISyntaxException;
3537
import java.net.URL;
3638
import javax.json.Json;
3739
import javax.json.JsonObject;
@@ -132,7 +134,11 @@ public void key(
132134
* @throws IOException If there is any I/O problem
133135
*/
134136
public URL url() throws IOException {
135-
return new URL(this.jsn.text("url"));
137+
try {
138+
return new URI(this.jsn.text("url")).toURL();
139+
} catch (final URISyntaxException ex) {
140+
throw new IllegalArgumentException(ex);
141+
}
136142
}
137143

138144
/**

0 commit comments

Comments
 (0)