forked from chanjarster/weixin-java-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue #71 替换掉JAXB,避免因OpenJDK造成无法deserialize xml的错误
- Loading branch information
1 parent
eaa77bc
commit f3ec0b1
Showing
73 changed files
with
834 additions
and
986 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,73 @@ | ||
<?xml version="1.0"?> | ||
<project | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" | ||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>me.chanjar</groupId> | ||
<artifactId>weixin-java-parent</artifactId> | ||
<version>1.0.7-SNAPSHOT</version> | ||
</parent> | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" | ||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>me.chanjar</groupId> | ||
<artifactId>weixin-java-parent</artifactId> | ||
<version>1.0.7-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>weixin-java-common</artifactId> | ||
<name>WeiXin Java Tools - Common</name> | ||
<description>微信公众号、企业号Java SDK Common</description> | ||
<artifactId>weixin-java-common</artifactId> | ||
<name>WeiXin Java Tools - Common</name> | ||
<description>微信公众号、企业号Java SDK Common</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.testng</groupId> | ||
<artifactId>testng</artifactId> | ||
<version>6.8.7</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-all</artifactId> | ||
<version>1.9.5</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.inject</groupId> | ||
<artifactId>guice</artifactId> | ||
<version>3.0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.jetty</groupId> | ||
<artifactId>jetty-server</artifactId> | ||
<version>9.3.0.M0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.jetty</groupId> | ||
<artifactId>jetty-servlet</artifactId> | ||
<version>9.3.0.M0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.thoughtworks.xstream</groupId> | ||
<artifactId>xstream</artifactId> | ||
<version>1.4.7</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.testng</groupId> | ||
<artifactId>testng</artifactId> | ||
<version>6.8.7</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-all</artifactId> | ||
<version>1.9.5</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.inject</groupId> | ||
<artifactId>guice</artifactId> | ||
<version>3.0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.jetty</groupId> | ||
<artifactId>jetty-server</artifactId> | ||
<version>9.3.0.M0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.jetty</groupId> | ||
<artifactId>jetty-servlet</artifactId> | ||
<version>9.3.0.M0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<suiteXmlFiles> | ||
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile> | ||
</suiteXmlFiles> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<suiteXmlFiles> | ||
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile> | ||
</suiteXmlFiles> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
24 changes: 0 additions & 24 deletions
24
weixin-java-common/src/main/java/me/chanjar/weixin/common/util/xml/AdapterCDATA.java
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
weixin-java-common/src/main/java/me/chanjar/weixin/common/util/xml/MediaIdMarshaller.java
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
...in-java-common/src/main/java/me/chanjar/weixin/common/util/xml/XStreamCDataConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package me.chanjar.weixin.common.util.xml; | ||
|
||
import com.thoughtworks.xstream.converters.basic.StringConverter; | ||
|
||
/** | ||
* Created by qianjia on 15/1/19. | ||
*/ | ||
public class XStreamCDataConverter extends StringConverter { | ||
|
||
@Override | ||
public String toString(Object obj) { | ||
return "<![CDATA[" + super.toString(obj) + "]]>"; | ||
} | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
weixin-java-common/src/main/java/me/chanjar/weixin/common/util/xml/XStreamInitializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package me.chanjar.weixin.common.util.xml; | ||
|
||
import com.thoughtworks.xstream.XStream; | ||
import com.thoughtworks.xstream.converters.basic.DoubleConverter; | ||
import com.thoughtworks.xstream.converters.basic.FloatConverter; | ||
import com.thoughtworks.xstream.converters.basic.IntConverter; | ||
import com.thoughtworks.xstream.core.util.QuickWriter; | ||
import com.thoughtworks.xstream.io.HierarchicalStreamWriter; | ||
import com.thoughtworks.xstream.io.xml.PrettyPrintWriter; | ||
import com.thoughtworks.xstream.io.xml.XppDriver; | ||
|
||
import java.io.Writer; | ||
|
||
/** | ||
* Created by qianjia on 15/1/19. | ||
*/ | ||
public class XStreamInitializer { | ||
|
||
public static XStream getInstance() { | ||
XStream xstream = new XStream(new XppDriver() { | ||
@Override | ||
public HierarchicalStreamWriter createWriter(Writer out) { | ||
return new PrettyPrintWriter(out, getNameCoder()) { | ||
protected String PREFIX_CDATA = "<![CDATA["; | ||
protected String SUFFIX_CDATA = "]]>"; | ||
protected String PREFIX_MEDIA_ID = "<MediaId>"; | ||
protected String SUFFIX_MEDIA_ID = "</MediaId>"; | ||
@Override | ||
protected void writeText(QuickWriter writer, String text) { | ||
if (text.startsWith(PREFIX_CDATA) && text.endsWith(SUFFIX_CDATA)) { | ||
writer.write(text); | ||
} else if (text.startsWith(PREFIX_MEDIA_ID) && text.endsWith(SUFFIX_MEDIA_ID)) { | ||
writer.write(text); | ||
} else { | ||
super.writeText(writer, text); | ||
} | ||
|
||
} | ||
}; | ||
} | ||
}); | ||
xstream.setMode(XStream.NO_REFERENCES); | ||
return xstream; | ||
} | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
...-java-common/src/main/java/me/chanjar/weixin/common/util/xml/XStreamMediaIdConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package me.chanjar.weixin.common.util.xml; | ||
|
||
/** | ||
* Created by qianjia on 15/1/19. | ||
*/ | ||
public class XStreamMediaIdConverter extends XStreamCDataConverter { | ||
@Override | ||
public String toString(Object obj) { | ||
return "<MediaId>" + super.toString(obj) + "</MediaId>"; | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpMessageHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpMessageInterceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 8 additions & 7 deletions
15
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.