重要:工程运行环境由jdk1.7调整为jdk1.6

This commit is contained in:
jinyu 2015-09-21 22:32:42 +08:00
parent 50b01790af
commit 03ca6e670a
15 changed files with 45 additions and 47 deletions

View File

@ -470,3 +470,7 @@
+ weixin4j-[mp|qy]:version upgrade to 1.6.1
+ weixin4j-server:version upgrade to 1.1.1
* 2015-09-21
重要:工程运行环境由jdk1.7调整为jdk1.6

View File

@ -54,8 +54,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.6</source>
<target>1.6</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>

View File

@ -94,8 +94,12 @@ public abstract class HttpClientFactory {
new X509TrustManager[] { createX509TrustManager() },
new java.security.SecureRandom());
return sslContext;
} catch (NoSuchAlgorithmException | KeyManagementException e) {
throw new HttpClientException("Create SSLContext Error:", e);
} catch (NoSuchAlgorithmException e) {
throw new HttpClientException(
"Create SSLContext NoSuchAlgorithmException:", e);
} catch (KeyManagementException e) {
throw new HttpClientException(
"Create SSLContext KeyManagementException:", e);
}
}

View File

@ -108,10 +108,18 @@ public class Netty4HttpClient extends AbstractHttpClient {
.addListener(listener);
response = future.get();
handleResponse(response);
} catch (IOException | InterruptedException | ExecutionException e) {
} catch (IOException e) {
throw new HttpClientException("I/O error on "
+ request.getMethod().name() + " request for \""
+ request.getURI().toString() + "\":" + e.getMessage(), e);
} catch (InterruptedException e) {
throw new HttpClientException("Execute error on "
+ request.getMethod().name() + " request for \""
+ request.getURI().toString() + "\":" + e.getMessage(), e);
} catch (ExecutionException e) {
throw new HttpClientException("Execute error on "
+ request.getMethod().name() + " request for \""
+ request.getURI().toString() + "\":" + e.getMessage(), e);
} finally {
if (response != null) {
response.close();
@ -135,9 +143,9 @@ public class Netty4HttpClient extends AbstractHttpClient {
HttpEntity entity = request.getEntity();
if (entity != null) {
ByteBuf byteBuf = ByteBufAllocator.DEFAULT.buffer();
try (ByteBufOutputStream out = new ByteBufOutputStream(byteBuf)) {
ByteBufOutputStream out = new ByteBufOutputStream(byteBuf);
entity.writeTo(out);
}
out.close();
uriRequest = new DefaultFullHttpRequest(
uriRequest.getProtocolVersion(), uriRequest.getMethod(),
uriRequest.getUri(), byteBuf);

View File

@ -1,9 +1,8 @@
package com.foxinmy.weixin4j.tuple;
import java.beans.Transient;
import java.io.Serializable;
import com.alibaba.fastjson.annotation.JSONField;
import javax.xml.bind.annotation.XmlTransient;
/**
* 消息元件
@ -21,7 +20,6 @@ public interface Tuple extends Serializable {
*
* @return
*/
@Transient
@JSONField(deserialize = false, serialize = false)
@XmlTransient
public String getMessageType();
}

View File

@ -2,7 +2,6 @@ package com.foxinmy.weixin4j.util;
import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.Objects;
import com.foxinmy.weixin4j.model.Consts;
@ -159,8 +158,7 @@ public final class StringUtil {
}
final Object first = iterator.next();
if (!iterator.hasNext()) {
String result = Objects.toString(first);
return result;
return String.valueOf(first);
}
// two or more elements

View File

@ -1,10 +1,9 @@
package com.foxinmy.weixin4j.mp.payment.v2;
import java.beans.Transient;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import com.alibaba.fastjson.annotation.JSONField;
import com.foxinmy.weixin4j.model.WeixinPayAccount;
@ -13,8 +12,7 @@ import com.foxinmy.weixin4j.util.DigestUtil;
import com.foxinmy.weixin4j.util.MapUtil;
/**
* V2微信JS支付:get_brand_wcpay_request</br>
* <font color="red">所列参数均为非空字符串</font>
* V2微信JS支付:get_brand_wcpay_request</br> <font color="red">所列参数均为非空字符串</font>
* <p>
* get_brand_wcpay_request:ok 支付成功<br>
* get_brand_wcpay_request:cancel 支付过程中用户取消<br>
@ -37,13 +35,14 @@ public class JsPayRequestV2 extends PayRequest {
// jaxb required
}
public JsPayRequestV2(WeixinPayAccount weixinAccount, PayPackageV2 payPackage) {
public JsPayRequestV2(WeixinPayAccount weixinAccount,
PayPackageV2 payPackage) {
this.setAppId(weixinAccount.getId());
this.setPackageInfo(package2string(payPackage,
weixinAccount.getPartnerKey()));
}
@Transient
@XmlTransient
@JSONField(serialize = false)
private String package2string(PayPackageV2 payPackage, String partnerKey) {
StringBuilder sb = new StringBuilder();

View File

@ -48,8 +48,9 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.6</source>
<target>1.6</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>

View File

@ -1,6 +1,5 @@
package com.foxinmy.weixin4j.qy.chat;
import java.beans.Transient;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Date;
@ -111,7 +110,6 @@ public class ChatItem implements Serializable {
return createTime;
}
@Transient
@XmlTransient
public Date getFormatCreateTime() {
return createTime > 0l ? new Date(createTime * 1000l) : null;
@ -121,7 +119,6 @@ public class ChatItem implements Serializable {
return msgType;
}
@Transient
@XmlTransient
public MessageType getFormatMsgType() {
return msgType != null ? MessageType.valueOf(msgType) : null;
@ -131,7 +128,6 @@ public class ChatItem implements Serializable {
return eventType;
}
@Transient
@XmlTransient
public ChatEventType getFormatEventType() {
return eventType != null ? ChatEventType.valueOf(eventType) : null;
@ -153,7 +149,6 @@ public class ChatItem implements Serializable {
return members;
}
@Transient
@XmlTransient
public List<String> getFormatMembers() {
return members != null ? Arrays.asList(members.split(LIST_SEPARATOR))
@ -164,7 +159,6 @@ public class ChatItem implements Serializable {
return addMembers;
}
@Transient
@XmlTransient
public List<String> getFormatAddMembers() {
return addMembers != null ? Arrays.asList(addMembers
@ -175,7 +169,6 @@ public class ChatItem implements Serializable {
return deleteMembers;
}
@Transient
@XmlTransient
public List<String> getFormatDeleteMembers() {
return deleteMembers != null ? Arrays.asList(deleteMembers

View File

@ -1,6 +1,5 @@
package com.foxinmy.weixin4j.qy.chat;
import java.beans.Transient;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlElement;
@ -37,7 +36,6 @@ public class ChatReceiver implements Serializable {
return chatType;
}
@Transient
@XmlTransient
public ChatType getFormatChatType() {
return ChatType.valueOf(chatType);

View File

@ -1,6 +1,5 @@
package com.foxinmy.weixin4j.qy.chat;
import java.beans.Transient;
import java.io.Serializable;
import java.util.List;
@ -61,7 +60,6 @@ public class WeixinChatMessage implements Serializable {
return agentType;
}
@Transient
@XmlTransient
public AgentType getFormatAgentType() {
return AgentType.valueOf(agentType);

View File

@ -1,6 +1,5 @@
package com.foxinmy.weixin4j.qy.suite;
import java.beans.Transient;
import java.io.Serializable;
import java.util.Date;
@ -58,7 +57,6 @@ public class WeixinSuiteMessage implements Serializable {
return eventType;
}
@Transient
@XmlTransient
public SuiteEventType getFormatEventType() {
return SuiteEventType.valueOf(eventType);
@ -68,7 +66,6 @@ public class WeixinSuiteMessage implements Serializable {
return timeStamp;
}
@Transient
@XmlTransient
public Date getFormatTimeStamp() {
return timeStamp > 0l ? new Date(timeStamp * 1000l) : null;

View File

@ -1,6 +1,5 @@
package com.foxinmy.weixin4j.request;
import java.beans.Transient;
import java.io.Serializable;
import java.util.Date;
@ -95,7 +94,6 @@ public class WeixinMessage implements Serializable {
return createTime;
}
@Transient
@XmlTransient
public Date getFormatCreateTime() {
return createTime > 0l ? new Date(createTime * 1000l) : null;
@ -105,7 +103,6 @@ public class WeixinMessage implements Serializable {
return msgType;
}
@Transient
@XmlTransient
public MessageType getFormatMsgType() {
return MessageType.valueOf(msgType);

View File

@ -139,7 +139,9 @@ public final class ClassUtil {
bis = new ByteArrayInputStream(bos.toByteArray());
ois = new ObjectInputStream(bis);
return ois.readObject();
} catch (IOException | ClassNotFoundException e) {
} catch (IOException e) {
throw new RuntimeException(e);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} finally {
try {

View File

@ -2,7 +2,6 @@ package com.foxinmy.weixin4j.server.test;
import java.io.IOException;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
@ -14,6 +13,8 @@ import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import com.foxinmy.weixin4j.util.Consts;
/**
* 发送消息请求到服务器
*
@ -51,7 +52,7 @@ public class MessagePush {
public String push(String para, String xml) throws IOException {
httpPost.setURI(URI.create(server + para));
httpPost.setEntity(new StringEntity(xml, StandardCharsets.UTF_8));
httpPost.setEntity(new StringEntity(xml, Consts.UTF_8));
HttpResponse httpResponse = httpClient.execute(httpPost);
return entity(httpResponse);
}
@ -68,6 +69,6 @@ public class MessagePush {
throw new IOException(Integer.toString(status) + "uri moved");
}
return EntityUtils.toString(httpResponse.getEntity(),
StandardCharsets.UTF_8);
Consts.UTF_8);
}
}