Commit ca9999a8 authored by Zachary Seguin's avatar Zachary Seguin
Browse files

Timezone fix

parent c931a577
......@@ -148,7 +148,7 @@ class AlertXMLParser
{
Calendar time = GregorianCalendar.getInstance();
time.setTime(AlertsCanada.DATE_TIME_FORMATTER.parse(value));
time.setTimeZone(TimeZone.getTimeZone(value.substring(value.length() - 6)));
time.setTimeZone(TimeZone.getTimeZone("GMT" + value.substring(value.length() - 6)));
return time;
}// End of try
......
......@@ -117,6 +117,7 @@ public class AlertsCanada
dateFormat.setTimeZone(alertReference.getSent().getTimeZone());
String dateTime = dateTimeFormat.format(alertReference.getSent().getTime()).replace("Z", "-00:00");
System.out.println(dateTime);
String file = dateTime + "I" + alertReference.getIdentifier();
file = file.replaceAll("(-|:)", "_");
......
......@@ -46,6 +46,8 @@ public class HttpContents
{
try
{
logger.info("Getting Contents of: " + url.toString());
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"));
StringBuilder content = new StringBuilder();
......
......@@ -29,8 +29,13 @@ import javax.xml.xpath.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
public class XMLHelpers
{
private static Logger logger = LogManager.getLogger(XMLHelpers.class);
/**
* XPath object for performing XPath operations.
* @since 1.0
......@@ -48,7 +53,7 @@ public class XMLHelpers
{
try
{
System.out.println(xml);
//logger.debug("XML: " + xml);
return DocumentBuilderFactory
.newInstance()
.newDocumentBuilder()
......
......@@ -51,6 +51,6 @@ public class AlertsCanadaTester
}
});
ac.parseAlert(ca.zacharyseguin.util.net.HttpContents.getURLContents(new URL("http://zachary-mb.zacharyseguin.ca/alert.xml")));
//ac.parseAlert(ca.zacharyseguin.util.net.HttpContents.getURLContents(new URL("http://zachary-mb.zacharyseguin.ca/alert.xml")));
}// End of main method
}// End of class
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