Commit c84f699d authored by Quxl's avatar Quxl

x

parent c0b08c84
......@@ -13,6 +13,7 @@ import java.net.URLEncoder;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -104,8 +105,8 @@ public class HttpUtil {
System.out.println(requestUrl);
connection = createConnection(requestUrl, proxy);
connection.setRequestMethod("GET");
connection.setRequestProperty("Accept-Charset", charset);
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
//connection.setRequestProperty("Accept-Charset", charset);
//connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
if (header != null) {
for (String key : header.keySet()) {
connection.setRequestProperty(key, header.get(key));
......@@ -176,6 +177,7 @@ public class HttpUtil {
try {
bytes = FileUtil.streamToBytes(connection.getInputStream());
} catch (IOException e) {
e.printStackTrace();
bytes = FileUtil.streamToBytes(connection.getErrorStream());
}
Map<String, List<String>> responseHeaders = connection.getHeaderFields();
......@@ -257,8 +259,7 @@ public class HttpUtil {
for (Object key : parameters.keySet()) {
Object val = parameters.get(key);
String sKey = String.valueOf(key);
Object[] sVals = (val == null ? null
: (val instanceof Object[] ? (Object[]) val : new Object[] { val }));
Object[] sVals = (val == null ? null : (val instanceof Object[] ? (Object[]) val : (val instanceof Collection<?> ? ((Collection<?>)val).toArray() : new Object[] { val })));
if (sVals != null && sVals.length > 0) {
for (Object sVal : sVals) {
if(StringUtil.isNotEmpty(sVal)) {
......
......@@ -1001,7 +1001,8 @@ public class StringUtil {
public static String[] searchNumber(String string) {
List<String> numbers = new ArrayList<String>();
Pattern pattern = Pattern.compile("[\\d]+(\\.?[\\d]+)?");
String regexText = "\\d+(\\.\\d+)?";
Pattern pattern = Pattern.compile(regexText);
Matcher matcher = pattern.matcher(string);
while(matcher.find()) {
numbers.add(matcher.group(0));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment