Browse code

modify code to be compatible with playn html backend (ie fix for gwt API and compiler)

devnewton authored on 04/01/2014 15:03:28
Showing 8 changed files
... ...
@@ -4,3 +4,4 @@
4 4
 *.jar
5 5
 *.war
6 6
 *.ear
7
+/target/
7 8
\ No newline at end of file
... ...
@@ -51,6 +51,21 @@
51 51
 					<target>1.6</target>
52 52
 				</configuration>
53 53
 			</plugin>
54
+                        <plugin>
55
+                            <groupId>org.apache.maven.plugins</groupId>
56
+                            <artifactId>maven-source-plugin</artifactId>
57
+                            <version>2.2.1</version>
58
+                            <!-- build a -sources.jar always, rather than only on deploy -->
59
+                            <executions>
60
+                                <execution>
61
+                                    <id>attach-sources</id>
62
+                                    <phase>generate-resources</phase>
63
+                                    <goals>
64
+                                        <goal>jar-no-fork</goal>
65
+                                    </goals>
66
+                                </execution>
67
+                            </executions>
68
+                        </plugin>
54 69
 			<plugin>
55 70
 				<groupId>com.github.github</groupId>
56 71
 				<artifactId>site-maven-plugin</artifactId>
... ...
@@ -36,8 +36,8 @@ public class Utils {
36 36
 		int replacePos = input.indexOf(toReplace);
37 37
 		while (replacePos != -1)
38 38
 		{
39
-			res = String.format("%s%s%s", res.substring(0, replacePos), replacement,
40
-					res.substring(replacePos + toReplace.length()));
39
+			res = res.substring(0, replacePos)+ replacement+
40
+					res.substring(replacePos + toReplace.length());
41 41
 			
42 42
 			replacePos = res.indexOf(toReplace, replacePos + replacement.length());
43 43
 		}
... ...
@@ -33,7 +33,7 @@ public class XmlDoc {
33 33
 
34 34
 	@Override
35 35
 	public String toString() {
36
-		String res = String.format("%s%s", prologue.toString(), root.toString());
36
+		String res = prologue.toString() + root.toString();
37 37
 
38 38
 		return res;
39 39
 	}
... ...
@@ -25,7 +25,7 @@ public class XmlParseException extends Exception{
25 25
 
26 26
 	public XmlParseException(String msg, int pos)
27 27
 	{
28
-		super(String.format("%s at %d", msg, pos));
28
+		super(msg + " at " + pos);
29 29
 		
30 30
 		this.pos = pos;
31 31
 	}
... ...
@@ -63,7 +63,7 @@ public class XmlParser {
63 63
 				throw new XmlParseException("Missing comment ending '-->'", commentPos);
64 64
 			}
65 65
 
66
-			res = String.format("%s%s", res.substring(0, commentPos), res.substring(commentEnd + 3));
66
+			res = res.substring(0, commentPos) + res.substring(commentEnd + 3);
67 67
 
68 68
 			commentPos = res.indexOf("<!--");
69 69
 		}
... ...
@@ -268,7 +268,7 @@ public class XmlParser {
268 268
 		TagHeaderActions res = TagHeaderActions.NameChar;
269 269
 
270 270
 		// Checking if it's some form of whitespace
271
-		if (Character.isWhitespace(c)) {
271
+		if (Character.isSpace(c)) {
272 272
 			res = TagHeaderActions.Space;
273 273
 		} else if (c == '<') {
274 274
 			res = TagHeaderActions.TagInit;
... ...
@@ -379,7 +379,7 @@ public class XmlParser {
379 379
 		if (correct) {
380 380
 			res = endPos + 1;
381 381
 		} else {
382
-			throw new XmlParseException(String.format("Expecting end tag <%s/>", tagName), pointer);
382
+			throw new XmlParseException("Expecting end tag <"+ tagName+">", pointer);
383 383
 		}
384 384
 
385 385
 		return res;
... ...
@@ -523,7 +523,7 @@ public class XmlParser {
523 523
 		AttrActions res = AttrActions.NameChar;
524 524
 
525 525
 		// Checking if it's some form of whitespace
526
-		if (Character.isWhitespace(c)) {
526
+		if (Character.isSpace(c)) {
527 527
 			res = AttrActions.Space;
528 528
 		}
529 529
 		// For this parser '<' and '>' are invalid
... ...
@@ -32,7 +32,7 @@ public class XmlPrologue {
32 32
 
33 33
 	@Override
34 34
 	public String toString() {
35
-		String res = String.format("<?xml version=\"%s\" encoding=\"%s\"?>", version, encoding);
35
+		String res = "<?xml version=\""+version+ "\" encoding=\"" + encoding +"\"?>";
36 36
 
37 37
 		return res;
38 38
 	}
... ...
@@ -78,12 +78,20 @@ public class XmlTag {
78 78
 			String value = XmlParser.escapeXmlLiteral(attributes.get(key), new String[] { "\"", "'" });
79 79
 
80 80
 			boolean valueHasDoubleQuotes = value.indexOf("\"") != -1;
81
-			String attrFormat = valueHasDoubleQuotes ? "%s='%s' " : "%s=\"%s\" ";
82
-			attrStr += String.format(attrFormat, key, value);
81
+                        if(valueHasDoubleQuotes) {
82
+                            attrStr += key + "='"+value+"' ";
83
+                        }else {
84
+                            attrStr += key + "=\""+value+"\" ";
85
+                        }
86
+			
83 87
 		}
84 88
 
85
-		String headerFormat = empty ? "<%s %s/>" : "<%s %s>";
86
-		res = String.format(headerFormat, XmlParser.escapeXmlLiteral(name, null), attrStr);
89
+                res = "<" +XmlParser.escapeXmlLiteral(name, null) +" " + attrStr;
90
+                if(empty) {
91
+                    res += "/>";
92
+                } else {
93
+                    res += ">";
94
+                }
87 95
 
88 96
 		// if the header is not empty print its children and ending tag
89 97
 		if (!empty) {
... ...
@@ -99,10 +107,15 @@ public class XmlTag {
99 107
 
100 108
 			// Checking if the content has any char that needs to be inside a
101 109
 			// CDATA block
102
-			String procContent = contentHasSpecialChars() ? String.format("<![CDATA[%s]]>", content) : content;
110
+			String procContent;
111
+                        if(contentHasSpecialChars()) {
112
+                            procContent = "<![CDATA[" + content + "]]>";
113
+                        } else {
114
+                            procContent = content;
115
+                        }
103 116
 
104 117
 			// Adding the ending tag
105
-			res = String.format("%s%s%s</%s>", res, childrenStr, procContent, XmlParser.escapeXmlLiteral(name, null));
118
+			res = res + childrenStr + procContent + "</" +XmlParser.escapeXmlLiteral(name, null) + ">";
106 119
 		}
107 120
 
108 121
 		return res;