List of usage examples for java.text SimpleDateFormat setTimeZone
public void setTimeZone(TimeZone zone)
From source file:info.archinnov.achilles.it.TestDSLEntityWithClusterings.java
@Test public void should_dsl_select_slice_with_asymetric_tuples_same_partition() throws Exception { //Given/*from ww w . j av a2s . c om*/ final Map<String, Object> values = new HashMap<>(); final long id = RandomUtils.nextLong(0L, Long.MAX_VALUE); values.put("id1", id); values.put("id2", id); values.put("id3", id); values.put("id4", id); values.put("id5", id); final UUID uuid1 = new UUID(0L, 0L); final UUID uuid2 = new UUID(0L, 1L); values.put("uuid1", uuid1); values.put("uuid2", uuid1); values.put("uuid3", uuid1); values.put("uuid4", uuid2); values.put("uuid5", uuid2); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); final Date date2 = dateFormat.parse("2015-10-02 00:00:00 GMT"); final Date date3 = dateFormat.parse("2015-10-03 00:00:00 GMT"); values.put("date1", "'2015-10-01 00:00:00+0000'"); values.put("date2", "'2015-10-02 00:00:00+0000'"); values.put("date3", "'2015-10-03 00:00:00+0000'"); values.put("date4", "'2015-10-04 00:00:00+0000'"); values.put("date5", "'2015-10-05 00:00:00+0000'"); scriptExecutor.executeScriptTemplate("EntityWithClusteringColumns/insert_many_rows.cql", values); /* Data are ordered as: uuid1, date3, uuid1, date2, uuid1, date1, uuid2, date5, uuid2, date4 because date is ORDERED BY DESC natively but (uuid,date) > (uuid1, date2) AND uuid < uuid2 should return uuid1, date3 */ //When final List<EntityWithClusteringColumns> list = manager.dsl().select().uuid().date().value().fromBaseTable() .where().id_Eq(id).uuid_And_date_Gt_And_uuid_Lt(uuid1, date2, uuid2).getList(); //Then assertThat(list).hasSize(1); assertThat(list.get(0).getUuid()).isEqualTo(uuid1); assertThat(list.get(0).getDate()).isEqualTo(date3); assertThat(list.get(0).getValue()).isEqualTo("val3"); }
From source file:net.solarnetwork.web.support.SimpleXmlView.java
/** * Create a {@link SimpleDateFormat} and cache on the {@link #SDF} * ThreadLocal to re-use for all dates within a single response. * /*w w w . j a v a2 s. c om*/ * @param model * the model, to look for a TimeZone to format the dates in */ private Map<String, Object> setupDateFormat(Map<String, Object> model) { TimeZone tz = TimeZone.getTimeZone("GMT"); Map<String, Object> result = new LinkedHashMap<String, Object>(); for (Map.Entry<String, Object> me : model.entrySet()) { Object o = me.getValue(); if (useModelTimeZoneForDates && o instanceof TimeZone) { tz = (TimeZone) o; } else if (modelKey != null) { if (modelKey.equals(me.getKey())) { result.put(modelKey, o); } } else { //if ( !(o instanceof BindingResult) ) { result.put(me.getKey(), o); } } SimpleDateFormat sdf = new SimpleDateFormat(); if (tz.getRawOffset() == 0) { sdf.applyPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); } else { sdf.applyPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); } sdf.setTimeZone(tz); if (logger.isTraceEnabled()) { logger.trace("TZ offset " + tz.getRawOffset()); } SDF.set(sdf); return result; }
From source file:info.archinnov.achilles.it.TestDSLEntityWithClusterings.java
@Test public void should_dsl_select_slice_with_tuples_same_partition() throws Exception { //Given//from ww w. ja va 2 s . c o m final Map<String, Object> values = new HashMap<>(); final long id = RandomUtils.nextLong(0L, Long.MAX_VALUE); values.put("id1", id); values.put("id2", id); values.put("id3", id); values.put("id4", id); values.put("id5", id); final UUID uuid1 = new UUID(0L, 0L); final UUID uuid2 = new UUID(0L, 1L); values.put("uuid1", uuid1); values.put("uuid2", uuid1); values.put("uuid3", uuid1); values.put("uuid4", uuid2); values.put("uuid5", uuid2); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); final Date date2 = dateFormat.parse("2015-10-02 00:00:00 GMT"); final Date date3 = dateFormat.parse("2015-10-03 00:00:00 GMT"); final Date date4 = dateFormat.parse("2015-10-04 00:00:00 GMT"); values.put("date1", "'2015-10-01 00:00:00+0000'"); values.put("date2", "'2015-10-02 00:00:00+0000'"); values.put("date3", "'2015-10-03 00:00:00+0000'"); values.put("date4", "'2015-10-04 00:00:00+0000'"); values.put("date5", "'2015-10-05 00:00:00+0000'"); /* Data are ordered as physically: uuid1, date3, uuid1, date2, uuid1, date1, uuid2, date5, uuid2, date4 because date is ORDERED BY DESC natively but (uuid,date) >= (uuid1, date2) AND (uuid,date) < (uuid2, date4) should return uuid1, date3 uuid1, date2 */ scriptExecutor.executeScriptTemplate("EntityWithClusteringColumns/insert_many_rows.cql", values); //When final List<EntityWithClusteringColumns> list = manager.dsl().select().uuid().date().value().fromBaseTable() .where().id_Eq(id).uuid_And_date_Gte_And_Lt(uuid1, date2, uuid2, date4).getList(); //Then assertThat(list).hasSize(2); assertThat(list.get(0).getUuid()).isEqualTo(uuid1); assertThat(list.get(0).getDate()).isEqualTo(date3); assertThat(list.get(0).getValue()).isEqualTo("val3"); assertThat(list.get(1).getUuid()).isEqualTo(uuid1); assertThat(list.get(1).getDate()).isEqualTo(date2); assertThat(list.get(1).getValue()).isEqualTo("val2"); }
From source file:executor.TesterMainGUIMode.java
public void start() throws Exception { // get the instance of the IClient interface final ITesterClient client = TesterFactory.getDefaultInstance(); // set the listener that will receive system events if (StringUtils.isNotEmpty(PropertyHandler.getProperty(StrategyProperties.HISTORY_DATE_START))) { final SimpleDateFormat dateFormat = new SimpleDateFormat( PropertyHandler.getProperty(StrategyProperties.HISTORY_DATE_FORMAT)); dateFormat.setTimeZone( TimeZone.getTimeZone(PropertyHandler.getProperty(StrategyProperties.HISTORY_DATE_TIMEZONE))); Date dateFrom = dateFormat.parse(PropertyHandler.getProperty(StrategyProperties.HISTORY_DATE_START)); Date dateTo = dateFormat.parse(PropertyHandler.getProperty(StrategyProperties.HISTORY_DATE_END)); client.setDataInterval(DataLoadingMethod.ALL_TICKS, dateFrom.getTime(), dateTo.getTime()); }// ww w . j ava 2 s . co m final String strategyName = strategy.getClass().getName(); client.setSystemListener(new ISystemListener() { @Override public void onStart(long processId) { LOGGER.info("Strategy started: " + processId); updateButtons(); } @Override public void onStop(long processId) { LOGGER.info("Strategy stopped: " + processId); resetButtons(); LOGGER.info("Strategy stopped: " + processId); SimpleDateFormat sdf = new SimpleDateFormat( PropertyHandler.getProperty(StrategyProperties.REPORTER_CURRENT_REPORT_FORMAT)); String propertyFolder = PropertyHandler .getProperty(StrategyProperties.REPORTER_CURRENT_REPORT_OUTPUT_DIRECTORY); File reportFile; if (Boolean.getBoolean( PropertyHandler.getProperty(StrategyProperties.REPORTER_CURRENT_REPORT_OVERWRITABLE))) { reportFile = new File(propertyFolder + strategyName + ".html"); } else { reportFile = new File( propertyFolder + sdf.format(GregorianCalendar.getInstance().getTime()) + ".html"); } try { client.createReport(processId, reportFile); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } if (client.getStartedStrategies().size() == 0) { // Do nothing } } @Override public void onConnect() { LOGGER.info("Connected"); } @Override public void onDisconnect() { // tester doesn't disconnect } }); LOGGER.info("Connecting..."); // connect to the server using jnlp, user name and password // connection is needed for data downloading client.connect("https://www.dukascopy.com/client/demo/jclient/jforex.jnlp", PropertyHandler.getProperty(StrategyProperties.CLIENT_USERNAME), PropertyHandler.getProperty(StrategyProperties.CLIENT_PASSWORD)); // wait for it to connect int i = 10; // wait max ten seconds while (i > 0 && !client.isConnected()) { Thread.sleep(1000); i--; } if (!client.isConnected()) { LOGGER.error("Failed to connect Dukascopy servers"); System.exit(1); } // set instruments that will be used in testing for (String anInstrument : PropertyHandler.getProperty(StrategyProperties.CLIENT_INSTRUMENTS_USED) .split(",")) { instrumentsToAdd.add(Instrument.fromString(anInstrument)); } final Set<Instrument> instruments = new HashSet<>(); instruments.addAll(instrumentsToAdd); LOGGER.info("Subscribing instruments..."); client.setSubscribedInstruments(instruments); // setting initial deposit client.setInitialDeposit( Instrument .fromString(PropertyHandler.getProperty(StrategyProperties.CLIENT_DEPOSIT_INITIAL_CURRENCY)) .getSecondaryJFCurrency(), Double.parseDouble(PropertyHandler.getProperty(StrategyProperties.CLIENT_DEPOSIT_INITIAL_AMOUNT))); // load data LOGGER.info("Downloading data"); Future<?> future = client.downloadData(null); // wait for downloading to complete future.get(); // start the strategy LOGGER.info("Starting strategy"); client.startStrategy(strategy, new LoadingProgressListener() { @Override public void dataLoaded(long startTime, long endTime, long currentTime, String information) { LOGGER.info(information); } @Override public void loadingFinished(boolean allDataLoaded, long startTime, long endTime, long currentTime) { } @Override public boolean stopJob() { return false; } }, this, this); // now it's running }
From source file:com.knowbout.epg.processor.ScheduleParser.java
private Date processSchedules(InputStream stream) throws IOException { log.debug("Processing raw text schedules for schedules"); Date firstProgram = null;/*from ww w. j a va 2 s .co m*/ BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); String line = reader.readLine(); SimpleDateFormat dateTimeFormat = new SimpleDateFormat("yyyyMMddHHmm"); dateTimeFormat.setTimeZone(TimeZone.getTimeZone("GMT")); while (line != null) { String[] parts = line.split("\\|", -1); long stationId = Long.parseLong(parts[0]); String programId = parts[1]; Date airTime = null; try { airTime = dateTimeFormat.parse(parts[2] + parts[3]); } catch (ParseException e) { log.error("Error parsing airtime for :" + line); } if (airTime != null) { if (firstProgram == null || firstProgram.after(airTime)) { firstProgram = airTime; } StationLineup lineup = stationIdToLineup.get(stationId); if (lineup != null) { ChannelSchedule schedule = programSchedules.get(new Key(programId, lineup.getCallSign())); if (schedule == null) { schedule = new ChannelSchedule(programId, lineup); programSchedules.put(new Key(programId, lineup.getCallSign()), schedule); } if (schedule != null) { String duration = parts[4]; int durationInMinutes = 0; if (duration.length() == 4) { int hours = Integer.parseInt(duration.substring(0, 2)); int minutes = Integer.parseInt(duration.substring(2, 4)); durationInMinutes = hours * 60 + minutes; } //End time is calculated, but we need it for searching Calendar calendar = Calendar.getInstance(); calendar.setTimeZone(TimeZone.getTimeZone("GMT")); calendar.setTime(airTime); calendar.add(Calendar.MINUTE, durationInMinutes); ScheduleAiring airing = new ScheduleAiring(schedule, stationId, airTime, calendar.getTime(), durationInMinutes, line); schedule.addAiring(airing); } } } line = reader.readLine(); } reader.close(); log.debug("Finished processing raw text schedules for schedules"); return firstProgram; }
From source file:com.pr7.logging.CustomDailyRollingFileAppender.java
int computeCheckPeriod() { RollingCalendar rollingCalendar = new RollingCalendar(gmtTimeZone, Locale.ENGLISH); // set sate to 1970-01-01 00:00:00 GMT Date epoch = new Date(0); if (datePattern != null) { for (int i = TOP_OF_MINUTE; i <= TOP_OF_MONTH; i++) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(datePattern); simpleDateFormat.setTimeZone(gmtTimeZone); // do all date // formatting in GMT String r0 = simpleDateFormat.format(epoch); rollingCalendar.setType(i);//from w ww. j ava2s. co m Date next = new Date(rollingCalendar.getNextCheckMillis(epoch)); String r1 = simpleDateFormat.format(next); // System.out.println("Type = "+i+", r0 = "+r0+", r1 = "+r1); if (r0 != null && r1 != null && !r0.equals(r1)) { return i; } } } return TOP_OF_TROUBLE; // Deliberately head for trouble... }
From source file:com.st.maven.debian.DebianPackageMojo.java
@Override public void execute() throws MojoExecutionException { validate();/*from w w w . j av a2 s. co m*/ fillDefaults(); freemarkerConfig.setDefaultEncoding("UTF-8"); freemarkerConfig.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); freemarkerConfig.setClassForTemplateLoading(DebianPackageMojo.class, "/"); freemarkerConfig.setTimeZone(TimeZone.getTimeZone("GMT")); Config config = new Config(); config.setArtifactId(project.getArtifactId()); config.setDescription(project.getDescription()); config.setGroup(unixGroupId); config.setUser(unixUserId); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); config.setVersion(sdf.format(new Date())); Developer dev = project.getDevelopers().get(0); String maintainer = dev.getName() + " <" + dev.getEmail() + ">"; config.setMaintainer(maintainer); config.setName(project.getName()); config.setDescription(project.getDescription()); config.setDepends(formatDependencies(osDependencies)); config.setInstallDir("/home/" + unixUserId + "/" + project.getArtifactId()); if (section == null || section.trim().length() == 0) { config.setSection("java"); } else { config.setSection(section); } if (arch == null || arch.trim().length() == 0) { config.setArch("all"); } else { config.setArch(arch); } if (priority == null || priority.trim().length() == 0) { config.setPriority(Priority.STANDARD); } else { config.setPriority(Priority.valueOf(priority.toUpperCase(Locale.UK))); } ArFileOutputStream aros = null; try { File debFile = new File(project.getBuild().getDirectory() + File.separator + project.getArtifactId() + "-" + config.getVersion() + ".deb"); getLog().info("Building deb: " + debFile.getAbsolutePath()); aros = new ArFileOutputStream(debFile.getAbsolutePath()); aros.putNextEntry(createEntry("debian-binary")); aros.write("2.0\n".getBytes(StandardCharsets.US_ASCII)); aros.closeEntry(); aros.putNextEntry(createEntry("control.tar.gz")); fillControlTar(config, aros); aros.closeEntry(); aros.putNextEntry(createEntry("data.tar.gz")); fillDataTar(config, aros); aros.closeEntry(); if (attachArtifact) { VersionableAttachedArtifact artifact = new VersionableAttachedArtifact(project.getArtifact(), "deb", config.getVersion()); artifact.setFile(debFile); artifact.setResolved(true); project.addAttachedArtifact(artifact); } } catch (Exception e) { throw new MojoExecutionException("unable to create .deb file", e); } finally { if (aros != null) { try { aros.close(); } catch (IOException e) { throw new MojoExecutionException("unable to close .deb file", e); } } } }
From source file:de.hybris.platform.marketplaceintegrationbackoffice.renderer.MarketplaceIntegrationOrderInitialRenderer.java
private void initialOrderDownload(final MarketplaceStoreModel model) { if (null == model.getOrderStartTime()) { NotificationUtils.notifyUserVia(Localization .getLocalizedString("type.Marketplacestore." + MarketplaceStoreModel.ORDERSTARTTIME + ".name") + " " + Labels.getLabel("backoffice.field.notfilled"), NotificationEvent.Type.WARNING, ""); LOG.warn("get order start time is not filled!"); return;/*from w w w . j a v a 2 s . c o m*/ } else if (null == model.getOrderEndTime()) { NotificationUtils.notifyUserVia(Localization .getLocalizedString("type.Marketplacestore." + MarketplaceStoreModel.ORDERENDTIME + ".name") + " " + Labels.getLabel("backoffice.field.notfilled"), NotificationEvent.Type.WARNING, ""); LOG.warn("get order end time is not filled!"); return; } else if (model.getOrderStartTime().after(model.getOrderEndTime())) { NotificationUtils.notifyUserVia(Labels.getLabel("backoffice.field.timerange.error"), NotificationEvent.Type.WARNING, ""); LOG.warn("start time is greate than end time!"); return; } else if (model.getMarketplace().getTmallOrderStatus().isEmpty() || null == model.getMarketplace().getTmallOrderStatus()) { NotificationUtils.notifyUserVia( Localization .getLocalizedString("type.Marketplace." + MarketplaceModel.TMALLORDERSTATUS + ".name") + " " + Labels.getLabel("backoffice.field.notfilled"), NotificationEvent.Type.WARNING, ""); LOG.warn("order status field is not filled!"); return; } if (!StringUtils.isBlank(model.getIntegrationId()) && !model.getAuthorized().booleanValue()) { NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.authorization.fail"), NotificationEvent.Type.WARNING, ""); LOG.warn("authorization is expired!"); return; } // in order to avoid this value out of date, we only get it from // database final Boolean isAuth = ((MarketplaceStoreModel) modelService.get(model.getPk())).getAuthorized(); final String integrationId = ((MarketplaceStoreModel) modelService.get(model.getPk())).getIntegrationId(); model.setIntegrationId(integrationId); model.setAuthorized(isAuth); if (null == isAuth || !isAuth.booleanValue()) { NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.initorder.unauthed"), NotificationEvent.Type.WARNING, ""); LOG.warn("marketplace store do not authorized, initial download failed!"); return; } String urlStr = ""; final String logUUID = logUtil.getUUID(); final MarketplaceSellerModel seller = model.getMarketplaceSeller(); final MarketplaceModel marketPlace = seller.getMarketplace(); try { // Configure and open a connection to the site you will send the urlStr = marketPlace.getAdapterUrl() + Config.getParameter(MARKETPLACE_ORDER_SYCHRONIZE_PATH) + Config.getParameter(MARKETPLACE_ORDER_INITIAL_PATH) + integrationId + Config.getParameter(MARKETPLACE_ORDER_INITIAL_LOGUUID) + logUUID; final JSONObject jsonObj = new JSONObject(); jsonObj.put("batchSize", BATCH_SIZE); jsonObj.put("status", getOrderStatus(model.getMarketplace().getTmallOrderStatus())); //jsonObj.put("marketplaceLogId", marketplacelogUUID); // set the correct timezone final String configTimezone = model.getMarketplace().getTimezone(); boolean isValidTimezone = false; for (final String vaildTimezone : TimeZone.getAvailableIDs()) { if (vaildTimezone.equals(configTimezone)) { isValidTimezone = true; break; } } if (!isValidTimezone) { final String[] para = { configTimezone == null ? "" : configTimezone, model.getMarketplace().getName() }; NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.initorder.wrongtimezone", para), NotificationEvent.Type.WARNING, ""); LOG.warn("wrong timezone or missing timezone configed in market:" + model.getMarketplace().getName()); return; } final SimpleDateFormat format = new SimpleDateFormat(Config.getParameter(BACKOFFICE_FORMAT_DATEFORMAT)); format.setTimeZone(TimeZone.getTimeZone(configTimezone)); final String startTimeWithCorrectZone = format.format(model.getOrderStartTime()).toString(); final String endTimeWithCorrectZone = format.format(model.getOrderEndTime()).toString(); jsonObj.put("startCreated", startTimeWithCorrectZone); jsonObj.put("endCreated", endTimeWithCorrectZone); jsonObj.put("productCatalogVersion", model.getCatalogVersion().getCatalog().getId() + ":" + model.getCatalogVersion().getVersion()); jsonObj.put("currency", model.getCurrency().getIsocode()); NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.initorder.success"), NotificationEvent.Type.SUCCESS, ""); final JSONObject results = marketplaceHttpUtil.post(urlStr, jsonObj.toJSONString()); final String msg = results.toJSONString(); final String responseCode = results.get("code").toString(); if ("401".equals(responseCode)) { LOG.error("========================================================================="); LOG.error("Order initial download request post to Tmall failed!"); LOG.error("Marketplacestore Code: " + model.getName()); LOG.error("Error Status Code: " + responseCode); LOG.error("Request path: " + urlStr); LOG.error("-------------------------------------------------------------------------"); LOG.error("Failed Reason:"); LOG.error("Authentication was failed, please re-authenticate again!"); LOG.error("========================================================================="); NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.authorization.fail"), NotificationEvent.Type.FAILURE, ""); LOG.warn("Authentication was failed, please re-authenticate again!"); return; } else if (!("0".equals(responseCode))) { LOG.error("========================================================================="); LOG.error("Order initial download request post to Tmall failed!"); LOG.error("Marketplacestore Code: " + model.getName()); LOG.error("Error Status Code: " + responseCode); LOG.error("Request path: " + urlStr); LOG.error("-------------------------------------------------------------------------"); LOG.error("Failed Reason:"); LOG.error("A known issue occurs in tmall, error details :" + msg); LOG.error("========================================================================="); NotificationUtils.notifyUserVia( Labels.getLabel("marketplace.tmallapp.known.issues", new Object[] { msg }), NotificationEvent.Type.FAILURE, ""); LOG.warn("A known issue occurs in tmall, error details :" + msg); return; } } catch (final HttpClientErrorException httpError) { if (httpError.getStatusCode().is4xxClientError()) { LOG.error("========================================================================="); LOG.error("Order initial download request post to Tmall failed!"); LOG.error("Marketplacestore Code: " + model.getName()); LOG.error("Error Status Code: " + httpError.getStatusCode().toString()); LOG.error("Request path: " + urlStr); LOG.error("-------------------------------------------------------------------------"); LOG.error("Failed Reason:"); LOG.error("Requested Tmall service URL is not correct!"); LOG.error("Detail error info: " + httpError.getMessage()); LOG.error("========================================================================="); NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.request.post.error"), NotificationEvent.Type.FAILURE, ""); } if (httpError.getStatusCode().is5xxServerError()) { LOG.error("========================================================================="); LOG.error("Order initial download request post to Tmall failed!"); LOG.error("Marketplacestore Code: " + model.getName()); LOG.error("Error Status Code: " + httpError.getStatusCode().toString()); LOG.error("Request path: " + urlStr); LOG.error("-------------------------------------------------------------------------"); LOG.error("Failed Reason:"); LOG.error("Requested Json Ojbect is not correct!"); LOG.error("Detail error info: " + httpError.getMessage()); LOG.error("========================================================================="); NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.process.error"), NotificationEvent.Type.FAILURE, ""); } LOG.error(httpError.toString()); return; } catch (final ResourceAccessException raError) { LOG.error("========================================================================="); LOG.error("Order initial download request post to Tmall failed!"); LOG.error("Marketplacestore Code: " + model.getName()); LOG.error("Request path: " + urlStr); LOG.error("-------------------------------------------------------------------------"); LOG.error("Failed Reason:"); LOG.error("Marketplace order download request server access failed!"); LOG.error("Detail error info: " + raError.getMessage()); LOG.error("========================================================================="); NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.access.error"), NotificationEvent.Type.FAILURE, ""); return; } catch (final HttpServerErrorException serverError) { LOG.error("========================================================================="); LOG.error("Order initial download request post to Tmall failed!"); LOG.error("Marketplacestore Code: " + model.getName()); LOG.error("Request path: " + urlStr); LOG.error("-------------------------------------------------------------------------"); LOG.error("Failed Reason:"); LOG.error("Marketplace order download request server process failed!"); LOG.error("Detail error info: " + serverError.getMessage()); LOG.error("========================================================================="); NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.process.error"), NotificationEvent.Type.FAILURE, ""); return; } catch (final Exception e) { final String errorMsg = e.getClass().toString() + ":" + e.getMessage(); NotificationUtils.notifyUserVia( Labels.getLabel("marketplace.runtime.issues", new Object[] { errorMsg }), NotificationEvent.Type.FAILURE, ""); LOG.warn(e.getMessage() + e.getStackTrace()); return; } LOG.info("========================================================================="); LOG.info("Order initial download request post to Tmall suceessfully!"); LOG.info("-------------------------------------------------------------------------"); LOG.info("Marketplacestore Code: " + model.getName()); LOG.info("Request path: " + urlStr); LOG.info("========================================================================="); // logUtil.addMarketplaceLog("PENDING", model.getIntegrationId(), Labels.getLabel("marketplace.order.initial.action"), // Labels.getLabel("marketplace.order.initial.object.type"), marketPlace, model, logUUID); }
From source file:eionet.util.Util.java
/** * * @return/* w w w. j av a2 s. c o m*/ */ public static synchronized String getExpiresDateString() { if (expiresDateString == null) { java.text.SimpleDateFormat dateFormat = new java.text.SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.UK); dateFormat.setTimeZone(TimeZone.getTimeZone("")); expiresDateString = dateFormat.format(new Date(0)); } return expiresDateString; }