File tree Expand file tree Collapse file tree
codegen/src/main/java/ch/loway/oss/ari4java/codegen/models
src/main/java/ch/loway/oss/ari4java Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,7 +26,13 @@ public String toString() {
2626 sb .append (" private " ).append (typeInterface ).append (" " ).append (field ).append (";\n " );
2727
2828 sb .append (getDeclarationGet ()).append (" {\n " );
29- sb .append (" return " ).append (field ).append (";\n }\n " );
29+ sb .append (" return " );
30+ if ("Date" .equals (typeConcrete )) {
31+ sb .append ("new Date(" ).append (field ).append (".getTime())" );
32+ } else {
33+ sb .append (field );
34+ }
35+ sb .append (";\n }\n " );
3036
3137 if (typeConcrete .startsWith ("List" )) {
3238 String innerType = typeConcrete .substring (5 , typeConcrete .length () - 1 );
@@ -37,7 +43,13 @@ public String toString() {
3743 sb .append (" @JsonDeserialize( as=" ).append (typeConcrete ).append (".class )\n " );
3844 }
3945 sb .append (getDeclarationSet ()).append (" {\n " );
40- sb .append (" " ).append (field ).append (" = val;\n }\n \n " );
46+ sb .append (" " ).append (field );
47+ if ("Date" .equals (typeConcrete )) {
48+ sb .append (" = new Date(val.getTime())" );
49+ } else {
50+ sb .append (" = val" );
51+ }
52+ sb .append (";\n }\n \n " );
4153
4254 return sb .toString ();
4355 }
Original file line number Diff line number Diff line change @@ -142,8 +142,10 @@ public String toString() {
142142 if (responseInterface .equalsIgnoreCase ("byte[]" )) {
143143 sb .append (" return httpActionSyncAsBytes(build());\n " );
144144 } else {
145- sb .append (" String json = httpActionSync(build());\n " );
146- if (!responseInterface .equalsIgnoreCase ("void" )) {
145+ if (responseInterface .equalsIgnoreCase ("void" )) {
146+ sb .append (" httpActionSync(build());\n " );
147+ } else {
148+ sb .append (" String json = httpActionSync(build());\n " );
147149 String deserializationType = responseConcreteClass + ".class" ;
148150 if (responseConcreteClass .startsWith ("List<" )) {
149151 deserializationType = "new TypeReference<" + responseConcreteClass + ">() {}" ;
Original file line number Diff line number Diff line change 22package ch .loway .oss .ari4java ;
33
44import java .io .IOException ;
5+ import java .io .InputStream ;
56import java .util .Properties ;
67
78/**
@@ -15,12 +16,19 @@ public class BUILD {
1516
1617 static {
1718 String number = "x" ;
19+ InputStream stream = BUILD .class .getResourceAsStream ("build.properties" );
1820 try {
1921 Properties p = new Properties ();
20- p .load (BUILD . class . getResourceAsStream ( "build.properties" ) );
22+ p .load (stream );
2123 number = p .getProperty ("BUILD_NUMBER" );
2224 } catch (IOException e ) {
2325 // oh well
26+ } finally {
27+ try {
28+ stream .close ();
29+ } catch (IOException e ) {
30+ // oh well
31+ }
2432 }
2533 BUILD_N = number ;
2634 }
Original file line number Diff line number Diff line change 3232 */
3333public class BaseAriAction {
3434
35- public class AriRequest {
35+ public static class AriRequest {
3636 private List <HttpParam > lParamQuery = new ArrayList <HttpParam >();
3737 private List <HttpParam > lParamForm = new ArrayList <HttpParam >();
3838 private List <HttpParam > lParamBody = new ArrayList <HttpParam >();
@@ -308,7 +308,7 @@ public synchronized void setForcedResponse(String forcedResponse) {
308308 this .forcedResponse = forcedResponse ;
309309 }
310310
311- public String getForcedResponse () {
311+ public synchronized String getForcedResponse () {
312312 return this .forcedResponse ;
313313 }
314314
Original file line number Diff line number Diff line change 77import io .netty .handler .codec .http .FullHttpResponse ;
88import io .netty .handler .codec .http .HttpResponseStatus ;
99
10+ import java .util .Arrays ;
11+
1012/**
1113 * HttpClientHandler handles the asynchronous response from the remote
1214 * HTTP server.
@@ -48,7 +50,10 @@ public String getResponseText() {
4850 }
4951
5052 public byte [] getResponseBytes () {
51- return responseBytes ;
53+ if (responseBytes == null || responseBytes .length == 0 ) {
54+ return null ;
55+ }
56+ return Arrays .copyOf (responseBytes , responseBytes .length );
5257 }
5358
5459 public HttpResponseStatus getResponseStatus () {
You can’t perform that action at this time.
0 commit comments