Skip to content

Commit 1546d17

Browse files
authored
Merge pull request #14 from Gruncan/v1.2a
V1.2.0
2 parents dfa2fdf + c1145da commit 1546d17

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1245
-77
lines changed

pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
<scope>test</scope>
2424
</dependency>
2525

26+
<dependency>
27+
<groupId>org.projectlombok</groupId>
28+
<artifactId>lombok</artifactId>
29+
<version>1.18.26</version>
30+
<scope>provided</scope>
31+
</dependency>
32+
2633
</dependencies>
2734

2835
<build>

src/main/java/com/http/SpotifyHttpServerProvider.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,13 @@ public void runServer() {
3434
if (!url.getHost().equals("127.0.0.1"))
3535
url = new URL("https://127.0.0.1:8888/redirect/");
3636

37-
3837
Desktop desktop = Desktop.getDesktop();
39-
server = HttpServer.create(new InetSocketAddress(url.getPort()), 0);
38+
this.server = HttpServer.create(new InetSocketAddress(url.getPort()), 0);
4039
this.countDownLatch = new CountDownLatch(1);
41-
server.createContext(url.getPath(), new RedirectHandler());
40+
this.server.createContext(url.getPath(), new RedirectHandler());
4241

43-
desktop.browse(new URI(spotifyClientBuilder.buildAuthUrl()));
44-
server.start();
42+
desktop.browse(new URI(this.spotifyClientBuilder.buildAuthUrl()));
43+
this.server.start();
4544
} catch (IOException | URISyntaxException e) {
4645
System.out.println("Unable to start server.");
4746
e.printStackTrace();
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.spotify.json;
17+
package com.json;
1818

1919

2020
class JSON {

src/main/java/com/spotify/json/JSONArray.java renamed to src/main/java/com/json/JSONArray.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.spotify.json;
17+
package com.json;
1818

1919

2020
import java.lang.reflect.Array;
@@ -633,6 +633,7 @@ public JSONObject getJSONObject(int index) throws JSONException {
633633
if (object instanceof JSONObject) {
634634
return (JSONObject) object;
635635
} else {
636+
if (object == null || object.toString().equals("null")) return null;
636637
throw JSON.typeMismatch(index, object, "JSONObject");
637638
}
638639
}
@@ -647,7 +648,7 @@ public JSONObject getModifiedJSONObject(int index) throws JSONException {
647648
} else if (object instanceof Boolean) {
648649
return new JSONObject(String.format("{\"value\": %b}", object));
649650
} else if (object instanceof Double) {
650-
return new JSONObject(String.format("{\"value\": %d}", object));
651+
return new JSONObject(String.format("{\"value\": %f}", object));
651652
} else if (object instanceof Integer) {
652653
return new JSONObject(String.format("{\"value\": %d}", object));
653654
} else {

src/main/java/com/spotify/json/JSONException.java renamed to src/main/java/com/json/JSONException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.spotify.json;
17+
package com.json;
1818

1919
// Note: this class was written without inspecting the non-free org.json sourcecode.
2020

src/main/java/com/spotify/json/JSONObject.java renamed to src/main/java/com/json/JSONObject.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.spotify.json;
17+
package com.json;
1818

1919

2020
import java.beans.IntrospectionException;

src/main/java/com/spotify/json/JSONString.java renamed to src/main/java/com/json/JSONString.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.spotify.json;
1+
package com.json;
22

33
/**
44
* The <code>JSONString</code> interface allows a <code>toJSONString()</code>

src/main/java/com/spotify/json/JSONStringer.java renamed to src/main/java/com/json/JSONStringer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.spotify.json;
17+
package com.json;
1818

1919

2020
import java.util.ArrayList;

src/main/java/com/spotify/json/JSONTokener.java renamed to src/main/java/com/json/JSONTokener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.spotify.json;
17+
package com.json;
1818

1919
// Note: this class was written without inspecting the non-free org.json sourcecode.
2020

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
package com.spotify;
22

3-
import com.spotify.requests.IRequest;
4-
import com.spotify.requests.RequestResponse;
3+
import com.spotify.requests.AbstractRequest;
54

65
public interface SpotifyClient {
76

87

98
// to be changed
10-
RequestResponse executeRequest(IRequest request);
9+
SpotifyResponse executeRequest(AbstractRequest request);
1110

1211

1312
}

0 commit comments

Comments
 (0)