Skip to content

Commit

Permalink
Fixed a webapp resource bug
Browse files Browse the repository at this point in the history
  • Loading branch information
datasetutil committed May 13, 2015
1 parent b0f10d9 commit 6d96c79
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<description>Analytics Cloud Datatset Utils</description>
<artifactId>datasetutils</artifactId>
<packaging>jar</packaging>
<version>32.0.22-SNAPSHOT</version>
<version>32.0.23-SNAPSHOT</version>
<url>https://github.com/forcedotcom/Analytics-Cloud-Dataset-Utils</url>
<organization>
<name>salesforce.com</name>
<url>http://salesforce.com</url>
</organization>
<properties>
<force.version>32.0.0</force.version>
<java.compile.version>1.6</java.compile.version>
<java.compile.version>1.7</java.compile.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<distributionManagement>
Expand Down Expand Up @@ -119,12 +119,12 @@
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>9.2.6.v20141205</version>
<version>9.2.10.v20150310</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>9.2.6.v20141205</version>
<version>9.2.10.v20150310</version>
</dependency>
</dependencies>
<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,7 @@ public BigDecimal detectNumeric(LinkedList<String> columnValues)
{
BigDecimal maxScale = null;
BigDecimal maxPrecision = null;
@SuppressWarnings("unused")
int failures = 0;
int consectiveFailures = 0;
int success = 0;
int absoluteMaxScale = 6;
int absoluteMaxScaleExceededCount = 0;
Expand Down Expand Up @@ -303,10 +302,14 @@ public BigDecimal detectNumeric(LinkedList<String> columnValues)
maxPrecision = bd;

success++;
consectiveFailures=0; //reset the failure count
}catch(Throwable t)
{
failures++;
consectiveFailures++;
}

if(consectiveFailures>=1000)
return null;
}

if(maxScale==null || maxPrecision==null)
Expand Down Expand Up @@ -388,8 +391,7 @@ public SimpleDateFormat detectDate(LinkedList<String> columnValues)

if(dt!=null)
{
@SuppressWarnings("unused")
int failures = 0;
int consectiveFailures = 0;
int success = 0;
for(int k=0;k<columnValues.size();k++)
{
Expand All @@ -402,13 +404,17 @@ public SimpleDateFormat detectDate(LinkedList<String> columnValues)
String tmpDate = dtf.format(dt1);
if(tmpDate.length() == columnValue.length())
{
success++;
success++;
consectiveFailures=0; //reset the failure count
}
} catch (ParseException e) {
failures++;
}
consectiveFailures++;
}

if(consectiveFailures>=1000)
break;
}
if((1.0*success/columnValues.size()) > 0.95)
if(!(consectiveFailures>=1000) && (1.0*success/columnValues.size()) > 0.95)
{
return dtf;
}else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static void main(String[] args) throws Exception {
public void init(String[] args, boolean join) throws Exception {

// DatasetUtilServer.partnerConnection = partnerConnection;
final String WEBAPPDIR = "index.html";
final String WEBAPPDIR = "login.html";
final String contextPath = "/";
final int maxFormContentSize = 40 * 1000 * 1024 * 1024;

Expand All @@ -72,13 +72,14 @@ public void init(String[] args, boolean join) throws Exception {

final URL warUrl = this.getClass().getClassLoader().getResource(WEBAPPDIR);
String warUrlString = "src/main/webapp";
System.out.println("warUrl:"+warUrlString);
if(warUrl!=null)
{
warUrlString = warUrl.toExternalForm();
// System.out.println("warUrlString:"+warUrlString);
System.out.println("warUrlString:"+warUrlString);
warUrlString = warUrlString.replace(WEBAPPDIR, "");
}
// System.out.println("warUrlString:"+warUrlString);
System.out.println("warUrlString:"+warUrlString);
WebAppContext context = new WebAppContext(warUrlString, contextPath);
context.setMaxFormContentSize(maxFormContentSize);
server.setHandler(context);
Expand Down

0 comments on commit 6d96c79

Please sign in to comment.