Skip to content

Commit 194bc7b

Browse files
Merge branch 'master' into post-boundaries
2 parents 689d028 + 8957e7d commit 194bc7b

File tree

14 files changed

+316
-274
lines changed

14 files changed

+316
-274
lines changed

android/pom.xml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323
<groupId>commons-io</groupId>
2424
<artifactId>commons-io</artifactId>
2525
</exclusion>
26-
<exclusion> <!-- exclude bouncycastle from android -->
27-
<groupId>org.bouncycastle</groupId>
28-
<artifactId>bcprov-jdk18on</artifactId>
29-
</exclusion>
3026
</exclusions>
3127
</dependency>
3228
<dependency>
@@ -38,10 +34,6 @@
3834
<groupId>commons-io</groupId>
3935
<artifactId>commons-io</artifactId>
4036
</exclusion>
41-
<exclusion> <!-- exclude bouncycastle from android -->
42-
<groupId>org.bouncycastle</groupId>
43-
<artifactId>bcprov-jdk18on</artifactId>
44-
</exclusion>
4537
</exclusions>
4638
</dependency>
4739
<dependency>
@@ -66,14 +58,6 @@
6658
<artifactId>commons-io</artifactId>
6759
<version>2.2</version>
6860
</dependency>
69-
<!-- add explicit bouncycastle in Android, version used in Android Flexible client -->
70-
<!-- keep in sync version here and in Android Flexible client -->
71-
<dependency>
72-
<groupId>org.bouncycastle</groupId>
73-
<artifactId>bcprov-jdk15on</artifactId>
74-
<version>1.65</version>
75-
</dependency>
76-
7761
</dependencies>
7862

7963
<build>

common/src/main/java/com/genexus/CommonUtil.java

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
import java.math.BigDecimal;
1010
import java.io.*;
1111
import java.net.URLEncoder;
12-
import java.nio.file.Files;
13-
import java.nio.file.Path;
14-
import java.nio.file.Paths;
1512
import java.text.*;
1613
import java.util.*;
1714

@@ -179,62 +176,6 @@ public Object initialValue()
179176
throw new ExceptionInInitializerError("GXUtil static constructor error: " + e.getMessage());
180177
}
181178
}
182-
183-
public static String getContentType(String fileName) {
184-
Path path = Paths.get(fileName);
185-
String defaultContentType = "application/octet-stream";
186-
187-
try {
188-
String probedContentType = Files.probeContentType(path);
189-
if (probedContentType == null || probedContentType.equals(defaultContentType))
190-
return findContentTypeByExtension(fileName);
191-
return probedContentType;
192-
} catch (IOException ioe) {
193-
return findContentTypeByExtension(fileName);
194-
}
195-
}
196-
197-
private static String findContentTypeByExtension(String fileName) {
198-
String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
199-
String contentType = contentTypes.get(fileExtension);
200-
return contentType != null ? contentTypes.get(fileExtension) : "application/octet-stream";
201-
}
202-
203-
private static Map<String, String> contentTypes = new HashMap<String, String>() {{
204-
put("txt" , "text/plain");
205-
put("rtx" , "text/richtext");
206-
put("htm" , "text/html");
207-
put("html" , "text/html");
208-
put("xml" , "text/xml");
209-
put("aif" , "audio/x-aiff");
210-
put("au" , "audio/basic");
211-
put("wav" , "audio/wav");
212-
put("bmp" , "image/bmp");
213-
put("gif" , "image/gif");
214-
put("jpe" , "image/jpeg");
215-
put("jpeg" , "image/jpeg");
216-
put("jpg" , "image/jpeg");
217-
put("jfif" , "image/pjpeg");
218-
put("tif" , "image/tiff");
219-
put("tiff" , "image/tiff");
220-
put("png" , "image/x-png");
221-
put("3gp" , "video/3gpp");
222-
put("3g2" , "video/3gpp2");
223-
put("mpg" , "video/mpeg");
224-
put("mpeg" , "video/mpeg");
225-
put("mov" , "video/quicktime");
226-
put("qt" , "video/quicktime");
227-
put("avi" , "video/x-msvideo");
228-
put("exe" , "application/octet-stream");
229-
put("dll" , "application/x-msdownload");
230-
put("ps" , "application/postscript");
231-
put("pdf" , "application/pdf");
232-
put("svg" , "image/svg+xml");
233-
put("tgz" , "application/x-compressed");
234-
put("zip" , "application/x-zip-compressed");
235-
put("gz" , "application/x-gzip");
236-
put("json" , "application/json");
237-
}};
238179

239180
public static String removeAllQuotes(String fileName)
240181
{

common/src/main/java/com/genexus/URLRouter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private static String convertParmsToQueryString(boolean useNamedParameters, Stri
115115
for (int i = 0; i < parms.length; i++)
116116
{
117117
if (!useNamedParameters || parms.length != parmsName.length)
118-
queryString = queryString + parms[i] + ((i < parms.length -1)? "," : "");
118+
queryString = queryString + parms[i] + ((i < parms.length -1 || (i == parms.length -1 && parms[i].isEmpty()) ) ? "," : "");
119119
else
120120
queryString = queryString + parmsName[i] + "=" + parms[i] + ((i < parms.length -1)? "&" : "");
121121
}

common/src/main/java/com/genexus/internet/GXHttpClient.java

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -568,81 +568,74 @@ protected String setPathUrl(String url) {
568568
return url;
569569
}
570570

571-
572-
protected File fileToPost;
573-
protected String fileToPostName;
574-
575571
@SuppressWarnings("unchecked")
576572
protected byte[] getData()
577573
{
578574
byte[] out = new byte[0];
579575

580-
for (Object key : getVariablesToSend().keySet())
576+
for (Object key: getVariablesToSend().keySet())
581577
{
582-
String value = getMultipartTemplate().getFormDataTemplate((String) key, (String) getVariablesToSend().get(key));
583-
getContentToSend().add(0, value); // Variables al principio
578+
String value = getMultipartTemplate().getFormDataTemplate((String)key, (String)getVariablesToSend().get(key));
579+
getContentToSend().add(0, value); //Variables al principio
584580
}
585581

586582
for (int idx = 0; idx < getContentToSend().size(); idx++)
587583
{
588584
Object curr = getContentToSend().elementAt(idx);
589585

590-
if (curr instanceof String)
586+
if (curr instanceof String)
591587
{
592588
try
593589
{
594-
if (contentEncoding != null)
590+
if(contentEncoding != null)
595591
{
596-
out = addToArray(out, ((String) curr).getBytes(contentEncoding));
597-
} else
592+
out = addToArray(out, ((String)curr).getBytes(contentEncoding));
593+
}else
598594
{
599595
out = addToArray(out, (String) curr);
600596
}
601-
} catch (UnsupportedEncodingException e)
597+
}catch(UnsupportedEncodingException e)
602598
{
603599
System.err.println(e.toString());
604600
out = addToArray(out, (String) curr);
605601
}
606602
}
607-
else if (curr instanceof Object[])
603+
else if (curr instanceof Object[])
608604
{
609-
StringWriter writer = (StringWriter) ((Object[]) curr)[0];
610-
StringBuffer encoding = (StringBuffer) ((Object[]) curr)[1];
605+
StringWriter writer = (StringWriter)((Object[])curr)[0];
606+
StringBuffer encoding = (StringBuffer)((Object[])curr)[1];
611607

612-
if (encoding == null || encoding.length() == 0)
608+
if(encoding == null || encoding.length() == 0)
613609
{
614610
encoding = new StringBuffer("UTF-8");
615611
}
616612
try
617613
{
618614
out = addToArray(out, writer.toString().getBytes(encoding.toString()));
619615
}
620-
catch (UnsupportedEncodingException e)
616+
catch(UnsupportedEncodingException e)
621617
{
622618
out = addToArray(out, writer.toString());
623619
}
624620
}
625-
else if (curr instanceof byte[])
621+
else if (curr instanceof byte[])
626622
{
627623
out = addToArray(out, (byte[]) curr);
628624
}
629-
else // File or FormFile
625+
else //File or FormFile
630626
{
631627
File file;
632628
if (curr instanceof FormFile)
633629
{
634-
FormFile formFile = (FormFile) curr;
630+
FormFile formFile = (FormFile)curr;
635631
out = startMultipartFile(out, formFile.name, formFile.file);
636632
file = new File(formFile.file);
637-
fileToPostName = formFile.name;
638633
}
639634
else
640635
{
641636
file = (File) curr;
642637
}
643-
fileToPost = file;
644-
645-
try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file)))
638+
try (BufferedInputStream bis = new java.io.BufferedInputStream(new FileInputStream(file)))
646639
{
647640
out = addToArray(out, CommonUtil.readToByteArray(bis));
648641
}

common/src/main/java/com/genexus/json/JSONTokenerWrapper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.genexus.json;
22

3+
import org.json.JSONObject;
34
import org.json.JSONTokener;
45
import org.json.JSONException;
56

@@ -14,7 +15,7 @@ public Object nextValue() throws JSONException {
1415
this.back();
1516
if (c == '{') {
1617
try {
17-
return new JSONObjectWrapper(this);
18+
return new JSONObjectWrapper((JSONObject) super.nextValue());
1819
} catch (StackOverflowError e) {
1920
throw new JSONException("JSON Array or Object depth too large to process.", e);
2021
}

common/src/main/java/com/genexus/properties/GXObjectProperties.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ public class GXObjectProperties
88
private String errorMessage = "";
99
private int errorCode = 0;
1010
private int statusCode = 0;
11+
private String statusMessage = "";
1112
private int protocol = 1;
1213

14+
1315
public Location getLocation()
1416
{
1517
return location;
@@ -45,7 +47,14 @@ public void setErrorMessage(String value)
4547
{
4648
errorMessage = value;
4749
}
48-
50+
public String getStatusMessage()
51+
{
52+
return statusMessage;
53+
}
54+
public void setStatusMessage(String value)
55+
{
56+
statusMessage = value;
57+
}
4958
public int getProtocol()
5059
{
5160
return protocol;

gxcloudstorage-awss3-v2/src/main/java/com/genexus/db/driver/ExternalProviderS3V2.java

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import org.apache.logging.log4j.Logger;
1818
import org.apache.logging.log4j.LogManager;
1919

20-
import com.genexus.CommonUtil;
2120
import com.genexus.util.GXService;
2221
import com.genexus.util.StorageUtils;
2322
import com.genexus.StructSdtMessages_Message;
@@ -293,6 +292,62 @@ public String copy(String objectUrl, String newName, String tableName, String fi
293292
copyWithoutACL(objectUrl, newName, tableName, fieldName);
294293
}
295294

295+
private String getContentType(String fileName) {
296+
Path path = Paths.get(fileName);
297+
String defaultContentType = "application/octet-stream";
298+
299+
try {
300+
String probedContentType = Files.probeContentType(path);
301+
if (probedContentType == null || probedContentType.equals(defaultContentType))
302+
return findContentTypeByExtension(fileName);
303+
return probedContentType;
304+
} catch (IOException ioe) {
305+
return findContentTypeByExtension(fileName);
306+
}
307+
}
308+
309+
private String findContentTypeByExtension(String fileName) {
310+
String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
311+
String contentType = contentTypes.get(fileExtension);
312+
return contentType != null ? contentTypes.get(fileExtension) : "application/octet-stream";
313+
}
314+
315+
private static Map<String, String> contentTypes = new HashMap<String, String>() {{
316+
put("txt" , "text/plain");
317+
put("rtx" , "text/richtext");
318+
put("htm" , "text/html");
319+
put("html" , "text/html");
320+
put("xml" , "text/xml");
321+
put("aif" , "audio/x-aiff");
322+
put("au" , "audio/basic");
323+
put("wav" , "audio/wav");
324+
put("bmp" , "image/bmp");
325+
put("gif" , "image/gif");
326+
put("jpe" , "image/jpeg");
327+
put("jpeg" , "image/jpeg");
328+
put("jpg" , "image/jpeg");
329+
put("jfif" , "image/pjpeg");
330+
put("tif" , "image/tiff");
331+
put("tiff" , "image/tiff");
332+
put("png" , "image/x-png");
333+
put("3gp" , "video/3gpp");
334+
put("3g2" , "video/3gpp2");
335+
put("mpg" , "video/mpeg");
336+
put("mpeg" , "video/mpeg");
337+
put("mov" , "video/quicktime");
338+
put("qt" , "video/quicktime");
339+
put("avi" , "video/x-msvideo");
340+
put("exe" , "application/octet-stream");
341+
put("dll" , "application/x-msdownload");
342+
put("ps" , "application/postscript");
343+
put("pdf" , "application/pdf");
344+
put("svg" , "image/svg+xml");
345+
put("tgz" , "application/x-compressed");
346+
put("zip" , "application/x-zip-compressed");
347+
put("gz" , "application/x-gzip");
348+
put("json" , "application/json");
349+
}};
350+
296351
private String buildPath(String... pathPart) {
297352
ArrayList<String> pathParts = new ArrayList<>();
298353
for (String part : pathPart) {
@@ -646,7 +701,7 @@ private String copyWithACL(String objectUrl, String newName, String tableName, S
646701
.bucket(bucket)
647702
.key(resourceKey)
648703
.metadata(metadata)
649-
.contentType(CommonUtil.getContentType(newName));
704+
.contentType(getContentType(newName));
650705
if (endpointUrl.contains(".amazonaws.com"))
651706
putObjectRequestBuilder = putObjectRequestBuilder.acl(internalToAWSACLWithACL(acl));
652707
PutObjectRequest putObjectRequest = putObjectRequestBuilder.build();
@@ -766,7 +821,7 @@ private String copyWithoutACL(String objectUrl, String newName, String tableName
766821
.bucket(bucket)
767822
.key(resourceKey)
768823
.metadata(metadata)
769-
.contentType(CommonUtil.getContentType(newName));
824+
.contentType(getContentType(newName));
770825
PutObjectRequest putObjectRequest = putObjectRequestBuilder.build();
771826
client.putObject(putObjectRequest, RequestBody.fromBytes(objectBytes.asByteArray()));
772827

java/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,6 @@
112112
<artifactId>html2pdf</artifactId>
113113
<version>5.0.0</version>
114114
</dependency>
115-
<dependency>
116-
<groupId>com.lowagie</groupId>
117-
<artifactId>itextasian</artifactId>
118-
<version>1.5.2</version>
119-
</dependency>
120115
<dependency>
121116
<groupId>org.apache.pdfbox</groupId>
122117
<artifactId>pdfbox</artifactId>

0 commit comments

Comments
 (0)