Skip to content

Commit f937cec

Browse files
committed
fix string == -> equals()
1 parent ba43e12 commit f937cec

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<project name="CloudKey" default="jar" basedir=".">
3-
<property name="version" value="1.1" />
3+
<property name="version" value="1.2" />
44
<property name="src" location="src" />
55
<property name="build" location="build" />
66
<property name="thirdparty" value="third-party" />

cloudkey-1.1.jar

13 Bytes
Binary file not shown.

src/net/dmcloud/cloudkey/CloudKey.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,18 @@ public String mediaGetStreamUrl(String id, String asset_name, int seclevel, Stri
5858

5959
public String mediaGetStreamUrl(String url, String id, String asset_name, int seclevel, String asnum, String ip, String useragent, String[] countries, String[] referers, int expires, String extension, Boolean download) throws DCException
6060
{
61-
if (extension == "")
61+
if (extension.equals(""))
6262
{
6363
String[] parts = asset_name.split("\\_");
64-
extension = (parts[0] != asset_name) ? parts[0] : extension;
64+
extension = (!parts[0].equals(asset_name)) ? parts[0] : extension;
6565
}
6666
if (asset_name.length() >= 15 && asset_name.substring(0, 15) == "jpeg_thumbnail_")
6767
{
6868
return CloudKey.STATIC_URL + this.user_id + "/" + id + "/" + asset_name + "." + extension;
6969
}
7070
else
7171
{
72-
String _url = this.cdn_url + "/route/" + this.user_id + "/" + id + "/" + asset_name + ((extension != "") ? "." + extension : "");
72+
String _url = this.cdn_url + "/route/" + this.user_id + "/" + id + "/" + asset_name + ((!extension.equals("")) ? "." + extension : "");
7373
return Helpers.sign_url(_url, this.api_key, seclevel, asnum, ip, useragent, countries, referers, expires) + (download ? "&throttle=0&helper=0&cache=0" : "");
7474
}
7575
}
@@ -165,11 +165,11 @@ public DCObject fileUpload(Boolean status, String jsonp_cb, String target) throw
165165
{
166166
args.push("status", true);
167167
}
168-
if (jsonp_cb != "")
168+
if (!jsonp_cb.equals(""))
169169
{
170170
args.push("jsonp_cb", jsonp_cb);
171171
}
172-
if (target != "")
172+
if (!target.equals(""))
173173
{
174174
args.push("target", target);
175175
}

src/net/dmcloud/cloudkey/Helpers.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,23 +125,23 @@ static public String sign_url(String url, String secret, int seclevel, String as
125125
{
126126
if ((seclevel & CloudKey.SECLEVEL_ASNUM) > 0)
127127
{
128-
if (asnum == "")
128+
if (asnum.equals(""))
129129
{
130130
throw new DCException("IP security level required and no IP address provided.");
131131
}
132132
secparams += asnum;
133133
}
134134
if ((seclevel & CloudKey.SECLEVEL_IP) > 0)
135135
{
136-
if (asnum == "")
136+
if (asnum.equals(""))
137137
{
138138
throw new DCException("IP security level required and no IP address provided.");
139139
}
140140
secparams += ip;
141141
}
142142
if ((seclevel & CloudKey.SECLEVEL_USERAGENT) > 0)
143143
{
144-
if (asnum == "")
144+
if (asnum.equals(""))
145145
{
146146
throw new DCException("USERAGENT security level required and no user-agent provided.");
147147
}
@@ -184,7 +184,7 @@ static public String sign_url(String url, String secret, int seclevel, String as
184184
{
185185
try
186186
{
187-
public_secparams_encoded = Base64.encodeBase64String(gzcompress(implode("&", public_secparams)));
187+
public_secparams_encoded = Base64.encodeBase64URLSafeString(gzcompress(implode("&", public_secparams)));
188188
}
189189
catch (Exception e)
190190
{
@@ -201,7 +201,7 @@ static public String sign_url(String url, String secret, int seclevel, String as
201201

202202
String digest = md5(seclevel + url + expires + rand + secret + secparams + public_secparams_encoded);
203203

204-
return url + "?" + (query != "" ? query + '&' : "") + "auth=" + expires + "-" + seclevel + "-" + rand + "-" + digest + (public_secparams_encoded != "" ? "-" + public_secparams_encoded : "");
204+
return url + "?" + (!query.equals("") ? query + '&' : "") + "auth=" + expires + "-" + seclevel + "-" + rand + "-" + digest + (public_secparams_encoded != "" ? "-" + public_secparams_encoded : "");
205205
}
206206

207207
private static String implode(String delim, String[] args)

src/net/dmcloud/cloudkey/Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public void testCloudKey()
9797
for(int i=0; i<list.size(); i++)
9898
{
9999
DCObject item = DCObject.create((Map)list.get(i));
100-
assertEquals((item.pull("meta.title") != ""), true);
100+
assertEquals((!item.pull("meta.title").equals("")), true);
101101
}
102102
}
103103
catch (Exception e)

src/net/dmcloud/util/FAToken.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public String toJSON() throws Exception {
187187
}
188188

189189
public String toBase64() throws Exception {
190-
return Base64.encodeBase64String(toJSON().getBytes());
190+
return Base64.encodeBase64URLSafeString(toJSON().getBytes());
191191
}
192192

193193
}

0 commit comments

Comments
 (0)