yuwei5380 / jsonplugin

Automatically exported from code.google.com/p/jsonplugin
0 stars 0 forks source link

doesn't work with struts 2.1.7 #91

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
JSONUtils.java uses com.opensymphony.xwork2.util.TextUtils which doesn't
exist in XWorks 2.1.3 (part of struts 2.1.7)

java.lang.NoClassDefFoundError: com.opensymphony.xwork2.util.TextUtils
    at com.googlecode.jsonplugin.JSONUtil.writeJSONToResponse(JSONUtil.java:197)
    at com.googlecode.jsonplugin.JSONResult.writeToResponse(JSONResult.java:192)

Original issue reported on code.google.com by noamhof...@gmail.com on 4 May 2009 at 10:31

GoogleCodeExporter commented 8 years ago
Attached is a patch that doesn't use the missing TextUtils.

Original comment by byar...@gmail.com on 19 May 2009 at 9:32

Attachments:

GoogleCodeExporter commented 8 years ago
How should i install the patch ???

Original comment by gustav...@gmail.com on 25 Jul 2009 at 4:06

GoogleCodeExporter commented 8 years ago
svn checkout http://jsonplugin.googlecode.com/svn/trunk/ jsonplugin-read-only
edit the one line in the patch
edit the pom.xml '0.33' -> '0.34-SNAPSHOT'
mvn install

Original comment by di...@cs.virginia.edu on 25 Jul 2009 at 4:20

GoogleCodeExporter commented 8 years ago
I never had done it before so I´m a little confused. I got a SVN plugin to 
Eclipse
and made a checkout. Ok, i got the project. Then i changed the JSONUtil.java 
and the
pom.xml. But i didnt find how to make the mvn install. Could you help me?
Thanks!!

Original comment by gustav...@gmail.com on 27 Jul 2009 at 6:46

GoogleCodeExporter commented 8 years ago
Obs.: I had used the "apply patch" to change JSONUtil.java, and mannually 
pom.xml.

Original comment by gustav...@gmail.com on 27 Jul 2009 at 6:58

GoogleCodeExporter commented 8 years ago
Install "maven" if necessary, then run "mvn install" while in the directory 
"jsonplugin-read-only".

Original comment by di...@cs.virginia.edu on 27 Jul 2009 at 7:41

GoogleCodeExporter commented 8 years ago
I will fix this when struts 2.1.8 is released (xwork 2.1.5)

Original comment by musa...@gmail.com on 28 Jul 2009 at 4:38

GoogleCodeExporter commented 8 years ago
cant take com.opensymphony.xwork2.util.TextUtils out of the picture yet
writeJSONToResponse will produce CNFE errors for TextUtils references 
specifically

    public static void writeJSONToResponse(SerializationParams serializationParams)
throws IOException {
        StringBuilder stringBuilder = new StringBuilder();
        if (TextUtils.stringSet(serializationParams.getSerializedJSON()))
            stringBuilder.append(serializationParams.getSerializedJSON());

        if (TextUtils.stringSet(serializationParams.getWrapPrefix()))
            stringBuilder.insert(0, serializationParams.getWrapPrefix());
        else if (serializationParams.isWrapWithComments()) {
            stringBuilder.insert(0, "/* ");
            stringBuilder.append(" */");
        } else if (serializationParams.isPrefix())
            stringBuilder.insert(0, "{}&& ");

        if (TextUtils.stringSet(serializationParams.getWrapSuffix()))
            stringBuilder.append(serializationParams.getWrapSuffix());

Original comment by gaintyma...@gmail.com on 6 Aug 2009 at 3:30

GoogleCodeExporter commented 8 years ago
F:\struts\jsonplugin\src\main\java\com\googlecode\jsonplugin\JSONUtil.java:[197,
11] cannot find symbol
symbol  : variable smd
location: class com.googlecode.jsonplugin.JSONUtil

F:\struts\jsonplugin\src\main\java\com\googlecode\jsonplugin\JSONUtil.java:[200,
68] cannot find symbol
symbol  : variable encoding
location: class com.googlecode.jsonplugin.JSONUtil

\struts\jsonplugin\src\main\java\com\googlecode\jsonplugin\JSONUtil.java:[204,
18] cannot find symbol
symbol  : variable contentType
location: class com.googlecode.jsonplugin.JSONUtil

rollback to serializationParams.isSmd() instead of smd
rollback to serializationParams.getEncoding() instead of encoding
rollback to serializationParams.getContentType() instead of contentType

also had to rollback to xwork-2.1.2 to get 
com.opensymphony.xwork2.util.TextUtils 
pom.xml contains
    <dependencies>
         <dependency>
                    <groupId>com.opensymphony.xwork2.util</groupId>
                    <artifactId>xwork</artifactId>
                    <version>2.1.2</version>
         </dependency>

location for pom.xml,settings.xml and jar: 
http://m2proxy.atlassian.com/repository/public/com/opensymphony/xwork/2.1.2/

stringSet method from TextUtils is intact

Original comment by gaintyma...@gmail.com on 6 Aug 2009 at 5:42