Skip to content

Commit 4be56df

Browse files
author
Javen
committed
Fix default result bug
1 parent 77ca447 commit 4be56df

File tree

5 files changed

+10
-21
lines changed

5 files changed

+10
-21
lines changed

.classpath

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,12 @@
1313
<attribute name="maven.pomderived" value="true"/>
1414
</attributes>
1515
</classpathentry>
16-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
17-
<attributes>
18-
<attribute name="maven.pomderived" value="true"/>
19-
</attributes>
20-
</classpathentry>
2116
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
2217
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
2318
<attributes>
2419
<attribute name="maven.pomderived" value="true"/>
2520
</attributes>
2621
</classpathentry>
22+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
2723
<classpathentry kind="output" path="target/classes"/>
2824
</classpath>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
<artifactId>maven-compiler-plugin</artifactId>
8787
<version>3.1</version>
8888
<configuration>
89-
<source>1.6</source>
89+
<source>1.8</source>
9090
<target>1.6</target>
9191
</configuration>
9292
</plugin>

src/cn/jpush/api/common/resp/DefaultResult.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,11 @@
22

33
public class DefaultResult extends BaseResult {
44

5-
public static DefaultResult fromResponse(ResponseWrapper responseWrapper, Class<DefaultResult> clazz) {
5+
public static DefaultResult fromResponse(ResponseWrapper responseWrapper) {
66
DefaultResult result = null;
77

88
if (responseWrapper.isServerResponse()) {
99
result = new DefaultResult();
10-
} else {
11-
try {
12-
result = clazz.newInstance();
13-
} catch (InstantiationException e) {
14-
e.printStackTrace();
15-
} catch (IllegalAccessException e) {
16-
e.printStackTrace();
17-
}
1810
}
1911

2012
result.setResponseWrapper(responseWrapper);

src/cn/jpush/api/device/DeviceClient.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public DefaultResult updateDeviceTagAlias(String registrationId, boolean clearAl
6767

6868
ResponseWrapper response = _httpClient.sendPost(url, top.toString());
6969

70-
return DefaultResult.fromResponse(response, DefaultResult.class);
70+
return DefaultResult.fromResponse(response);
7171
}
7272

7373
public DefaultResult updateDeviceTagAlias(String registrationId, String alias,
@@ -96,7 +96,7 @@ public DefaultResult updateDeviceTagAlias(String registrationId, String alias,
9696

9797
ResponseWrapper response = _httpClient.sendPost(url, top.toString());
9898

99-
return DefaultResult.fromResponse(response, DefaultResult.class);
99+
return DefaultResult.fromResponse(response);
100100
}
101101

102102
// ------------- tags
@@ -141,7 +141,7 @@ public DefaultResult addRemoveDevicesFromTag(String theTag, Set<String> toAddUse
141141

142142
ResponseWrapper response = _httpClient.sendPost(url, top.toString());
143143

144-
return DefaultResult.fromResponse(response, DefaultResult.class);
144+
return DefaultResult.fromResponse(response);
145145
}
146146

147147
public DefaultResult deleteTag(String theTag, String platform) throws APIConnectionException, APIRequestException {
@@ -152,7 +152,7 @@ public DefaultResult deleteTag(String theTag, String platform) throws APIConnect
152152

153153
ResponseWrapper response = _httpClient.sendDelete(url);
154154

155-
return DefaultResult.fromResponse(response, DefaultResult.class);
155+
return DefaultResult.fromResponse(response);
156156
}
157157

158158

@@ -166,7 +166,7 @@ public AliasDeviceListResult getAliasDeviceList(String alias, String platform) t
166166

167167
ResponseWrapper response = _httpClient.sendGet(url);
168168

169-
return DefaultResult.fromResponse(response, AliasDeviceListResult.class);
169+
return BaseResult.fromResponse(response, AliasDeviceListResult.class);
170170
}
171171

172172
public DefaultResult deleteAlias(String alias, String platform) throws APIConnectionException, APIRequestException {
@@ -177,7 +177,7 @@ public DefaultResult deleteAlias(String alias, String platform) throws APIConnec
177177

178178
ResponseWrapper response = _httpClient.sendDelete(url);
179179

180-
return DefaultResult.fromResponse(response, DefaultResult.class);
180+
return DefaultResult.fromResponse(response);
181181
}
182182

183183
}

test/cn/jpush/api/push/model/PushPayloadTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ public void testMessage() {
101101

102102
@Test
103103
public void testGlobalExceed() {
104+
System.out.println("Size of long text - " + LONG_TEXT_2.getBytes().length);
104105
PushPayload payload = PushPayload.newBuilder()
105106
.setPlatform(Platform.all())
106107
.setAudience(Audience.all())

0 commit comments

Comments
 (0)