List of usage examples for java.util.logging Level WARNING
Level WARNING
To view the source code for java.util.logging Level WARNING.
Click Source Link
From source file:ch.zhaw.iamp.rct.weights.Weights.java
/** * Calculates a pseudo-inverse using the values in the given files. They are * first read, then converted to a matrix, and finally used for the * calculation of the inverse, using Singular value decomposition (SVD). * * @param pathToA The file which contains the matrix A, represented in * comma-separated-value format.// w ww . j a va 2 s . c o m * @param targetTrajectoryFile The file which contains the target * trajectory, represented in comma-separated-value format. * @param weightsFile The file, to which the calculated weights should be * written to. * @param offset The numbers of first steps to ignore (to skip fading-memory * initialization steps). */ public static void calculateWeights(final String pathToA, final String targetTrajectoryFile, final String weightsFile, final int offset) { try { RealMatrix A = csvToMatrix(pathToA); // cut first n elements A = A.getSubMatrix(offset, A.getRowDimension() - 1, 0, A.getColumnDimension() - 1); A = addNoise(A); RealMatrix b = csvToMatrix(targetTrajectoryFile); // adjust b to cutting int n = offset % b.getRowDimension(); if (n > 0) { RealMatrix tmp = b.getSubMatrix(n, b.getRowDimension() - 1, 0, b.getColumnDimension() - 1); b = b.getSubMatrix(0, n - 1, 0, b.getColumnDimension() - 1); double[][] tmpArray = tmp.getData(); double[][] tmpArray2 = b.getData(); b = MatrixUtils.createRealMatrix(concat(tmpArray, tmpArray2)); tmpArray = b.getData(); for (int i = 0; tmpArray.length < A.getRowDimension(); ++i) { tmpArray2 = new double[1][tmpArray[0].length]; for (int j = 0; j < tmpArray[i].length; ++j) { tmpArray2[0][j] = tmpArray[i][j]; } tmpArray = concat(tmpArray, tmpArray2); } b = MatrixUtils.createRealMatrix(tmpArray); } DecompositionSolver solver = new SingularValueDecomposition(A).getSolver(); RealMatrix x = solver.solve(b).transpose(); matrixToCsv(x, weightsFile); } catch (IOException ex) { JOptionPane.showMessageDialog(null, "Could not read a file: " + ex.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); Logger.getLogger(Weights.class.getName()).log(Level.WARNING, "Could not read a file: {0}", ex); } catch (DimensionMismatchException ex) { JOptionPane.showMessageDialog(null, "<html>Could not calculate the " + "pseudo-inverse since a dimension mismatch occurred.<br />" + "Please make sure that all lines of the CSV file posses " + "the same amount of entries.<br />Hint: Remove the last " + "line and try it again.</html>", "Matrix Dimension Mismatch", JOptionPane.ERROR_MESSAGE); Logger.getLogger(Weights.class.getName()).log(Level.WARNING, "A dimension mismatch occurred: {0}", ex); } }
From source file:com.berkgokden.mongodb.MongoMapStore.java
public Map loadAll(Collection keys) { Map map = new HashMap(); BasicDBList dbo = new BasicDBList(); for (Object key : keys) { dbo.add(new BasicDBObject("_id", key)); }/*from www . j ava2 s . c o m*/ BasicDBObject dbb = new BasicDBObject("$or", dbo); DBCursor cursor = coll.find(dbb); while (cursor.hasNext()) { try { DBObject obj = cursor.next(); Class clazz = Class.forName(obj.get("_class").toString()); map.put(obj.get("_id"), converter.toObject(clazz, obj)); } catch (ClassNotFoundException e) { logger.log(Level.WARNING, e.getMessage(), e); } } return map; }
From source file:com.sun.labs.aura.fb.DataManager.java
public List<Scored<Artist>> getSimilarArtists(List<String> artistKeys, int count, Popularity popularity) { List<Scored<Artist>> ret = null; try {// w w w.jav a 2 s.co m List<Scored<Artist>> results = mdb.artistFindSimilar(artistKeys, count + artistKeys.size(), popularity); // // We need to manually filter out the original artists ret = new ArrayList<Scored<Artist>>(); for (Scored<Artist> sa : results) { Artist a = sa.getItem(); if (!artistKeys.contains(a.getKey())) { ret.add(sa); } } if (ret.size() > count) { ret = ret.subList(0, count); } } catch (AuraException e) { logger.log(Level.WARNING, "Failed to get similar artists", e); return new ArrayList<Scored<Artist>>(); } sortByArtistPopularity(ret); return ret; }
From source file:com.nabla.wapp.report.server.ReportManager.java
@Inject public ReportManager(final IReportCategoryValidator reportCategoryValidator) throws BirtException { this.reportCategoryValidator = reportCategoryValidator; if (log.isDebugEnabled()) log.debug("initializing BIRT report engine"); final EngineConfig config = new EngineConfig(); Platform.startup(config);/*www.j a v a 2 s .c om*/ final IReportEngineFactory factory = (IReportEngineFactory) Platform .createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY); engine = factory.createReportEngine(config); engine.changeLogLevel(Level.WARNING); /* engine.destroy(); Platform.shutdown(); */ }
From source file:com.yahoo.dba.perf.myperf.springmvc.ProfileController.java
@Override protected ModelAndView handleRequestImpl(HttpServletRequest req, HttpServletResponse resp) throws Exception { int status = Constants.STATUS_OK; String message = "OK"; String group = req.getParameter("group"); String host = req.getParameter("host"); boolean explainPlan = "y".equalsIgnoreCase(req.getParameter("plan")); boolean sessionStatus = "y".equalsIgnoreCase(req.getParameter("st")); boolean profile = "y".equalsIgnoreCase(req.getParameter("pf")); String dbuser = req.getParameter("dbuser"); String dbpwd = req.getParameter("dbpwd"); String dbname = req.getParameter("dbname"); String sqltext = req.getParameter("sqltext"); String format = req.getParameter("format"); boolean useJson = "json".equalsIgnoreCase(format) && explainPlan; if (useJson) { sessionStatus = false;/* w w w . j av a 2 s . co m*/ profile = false; } logger.info("profiling " + sqltext); ResultList rList = null; LinkedHashMap<String, ResultList> listMap = new LinkedHashMap<String, ResultList>(); String jsonString = null; MyProfiler profiler = new MyProfiler(); DBInstanceInfo dbinfo = null; try { dbinfo = this.frameworkContext.getDbInfoManager().findDB(group, host).copy(); if (dbuser == null || dbuser.isEmpty()) { //use build in credential AppUser appUser = null; DBCredential cred = null; appUser = AppUser.class.cast(req.getSession().getAttribute(AppUser.SESSION_ATTRIBUTE)); if (appUser == null) throw new RuntimeException("No user found. Session might not be valid."); cred = WebAppUtil.findDBCredential(this.frameworkContext, dbinfo.getDbGroupName(), appUser); if (cred != null) { dbuser = cred.getUsername(); dbpwd = cred.getPassword(); } } profiler.setDbinfo(dbinfo); profiler.setFrameworkContext(frameworkContext); if (dbname != null && !dbname.isEmpty()) dbinfo.setDatabaseName(dbname); profiler.setSqlText(sqltext); profiler.connect(dbuser, dbpwd, explainPlan && !profile && !sessionStatus); if (useJson) { jsonString = profiler.runExplainPlanJson(); } else if (explainPlan) listMap.put("plan", profiler.runExplainPlan()); if (profile) listMap.put("profile", profiler.runProfile()); if (sessionStatus) listMap.put("stats", profiler.runStats()); } catch (Exception ex) { status = Constants.STATUS_BAD; message = "Error when profiling: " + ex.getMessage(); logger.log(Level.WARNING, "Error when profiling", ex); } finally { if (profiler != null) profiler.destroy(); } ModelAndView mv = null; mv = new ModelAndView(this.jsonView); if (req.getParameter("callback") != null && req.getParameter("callback").trim().length() > 0) mv.addObject("callback", req.getParameter("callback"));//YUI datasource binding if (jsonString == null) mv.addObject("json_result", ResultListUtil.toMultiListJSONStringUpper(listMap, null, status, message)); else mv.addObject("json_result", jsonString); return mv; }
From source file:com.sifiso.dvs.util.DocFileUtil.java
public ResponseDTO downloadPDF(HttpServletRequest request, PlatformUtil platformUtil) throws FileUploadException { logger.log(Level.INFO, "######### starting PDF DOWNLOAD process\n\n"); ResponseDTO resp = new ResponseDTO(); InputStream stream = null;/*ww w. j a v a 2 s.c o m*/ File rootDir; try { rootDir = dvsProperties.getDocumentDir(); logger.log(Level.INFO, "rootDir - {0}", rootDir.getAbsolutePath()); if (!rootDir.exists()) { rootDir.mkdir(); } } catch (Exception ex) { logger.log(Level.SEVERE, "Properties file problem", ex); resp.setMessage("Server file unavailable. Please try later"); resp.setStatusCode(114); return resp; } PatientfileDTO dto = null; Gson gson = new Gson(); File clientDir = null, surgeryDir = null, doctorDir = null; try { ServletFileUpload upload = new ServletFileUpload(); FileItemIterator iter = upload.getItemIterator(request); while (iter.hasNext()) { FileItemStream item = iter.next(); String name = item.getFieldName(); stream = item.openStream(); if (item.isFormField()) { if (name.equalsIgnoreCase("JSON")) { String json = Streams.asString(stream); if (json != null) { logger.log(Level.INFO, "picture with associated json: {0}", json); dto = gson.fromJson(json, PatientfileDTO.class); if (dto != null) { surgeryDir = createSurgeryFileDirectory(rootDir, surgeryDir, dto.getDoctor().getSurgeryID()); if (dto.getDoctorID() != null) { doctorDir = createDoctorDirectory(surgeryDir, doctorDir, dto.getDoctorID()); if (dto.getClientID() != null) { clientDir = createClientDirectory(doctorDir, clientDir); } } } } else { logger.log(Level.WARNING, "JSON input seems pretty fucked up! is NULL.."); } } } else { File imageFile = null; if (dto == null) { continue; } DateTime dt = new DateTime(); String fileName = ""; if (dto.getClientID() != null) { fileName = "client" + dto.getClientID() + ".pdf"; } imageFile = new File(clientDir, fileName); writeFile(stream, imageFile); resp.setStatusCode(0); resp.setMessage("Photo downloaded from mobile app "); //add database System.out.println("filepath: " + imageFile.getAbsolutePath()); } } } catch (FileUploadException | IOException | JsonSyntaxException ex) { logger.log(Level.SEVERE, "Servlet failed on IOException, images NOT uploaded", ex); throw new FileUploadException(); } return resp; }
From source file:com.bbva.arq.devops.ae.mirrorgate.jenkins.plugin.utils.RestCall.java
public MirrorGateResponse makeRestCallGet(String url, String user, String password) { MirrorGateResponse response;//ww w. ja v a 2 s .c om GetMethod get = new GetMethod(url); try { HttpClient client = getHttpClient(); if (user != null && password != null) { client.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(user, password)); get.setDoAuthentication(true); } get.getParams().setContentCharset("UTF-8"); int responseCode = client.executeMethod(get); String responseString = get.getResponseBodyAsStream() != null ? getResponseString(get.getResponseBodyAsStream()) : ""; response = new MirrorGateResponse(responseCode, responseString); } catch (HttpException e) { LOGGER.log(Level.WARNING, "Error connecting to MirrorGate", e); response = new MirrorGateResponse(HttpStatus.SC_BAD_REQUEST, ""); } catch (IOException e) { LOGGER.log(Level.WARNING, "Error connecting to MirrorGate", e); response = new MirrorGateResponse(HttpStatus.SC_BAD_REQUEST, ""); } finally { get.releaseConnection(); } return response; }
From source file:com.google.enterprise.connector.sharepoint.wsclient.soap.SPClientFactory.java
/** * Gets the instance of the alerts web service. * * @return a new alerts web service instance. */// w w w.jav a 2 s.c o m public AlertsWS getAlertsWS(final SharepointClientContext ctx) { try { return new SPAlertsWS(ctx); } catch (final Exception e) { LOGGER.log(Level.WARNING, "Unable to create alerts web service instance.", e); return null; } }
From source file:com.match_tracker.twitter.TwitterSearch.java
public Integer search(String id, String queryString, ZonedDateTime startTime, ZonedDateTime endTime, TweetCallbackListener callback) { waitUntilStartIsInThePast(startTime); ZonedDateTime postedTimeStart = startTime, postedTimeEnd = startTime; LocalDateTime lastLogTime = LocalDateTime.now(); Integer counter = 0;//w ww .j a v a2 s . c om do { postedTimeStart = postedTimeEnd; postedTimeEnd = calculatePostedTimeEnd(endTime); try { counter += this.search(constructSearchQuery(queryString, postedTimeStart, postedTimeEnd), callback); if (isLongRunningSearch(lastLogTime)) { log.log(Level.INFO, "Long-running Twitter search ({0}) has now returned messages: {1}", new Object[] { id, counter }); lastLogTime = LocalDateTime.now(); } sleep(SEARCH_RATE_DELAY_MS); } catch (UnirestException e) { log.log(Level.WARNING, "Twitter search failed (UnirestException), retrying in sixty seconds. {0}", e.getMessage()); postedTimeEnd = postedTimeStart; sleep(SEARCH_FAILED_RETRY_DELAY_MS); } catch (ParseException e) { log.log(Level.WARNING, "Twitter search failed (JsonParseException), retrying in sixty seconds. {0}", e.getMessage()); postedTimeEnd = postedTimeStart; sleep(SEARCH_FAILED_RETRY_DELAY_MS); } } while (!postedTimeEnd.isEqual(endTime)); return counter; }
From source file:is.idega.idegaweb.egov.gumbo.licenses.LicensesUtil.java
public Boolean sendPDFByEmail(String to, String shipID) { if (StringUtil.isEmpty(to) || StringUtil.isEmpty(shipID)) return Boolean.FALSE; if (to.equals("notset")) { to = IWMainApplication.getDefaultIWApplicationContext().getApplicationSettings() .getProperty("default.rejected.application.receiver", "ingvar@fiskistofa.is"); }//w ww .jav a2 s .c om File xformInPDF = null; try { IWContext iwc = CoreUtil.getIWContext(); if (iwc == null) return Boolean.FALSE; Object submissionId = iwc.getSessionAttribute(ExecuteAction.XFORM_SUBMISSION_UUID_PARAM); if (!(submissionId instanceof String)) return Boolean.FALSE; String formSubmissionId = (String) submissionId; String pdfName = getLocalizedFormName(getFormSubmission(formSubmissionId), getCurrentLocale()); String path = CoreConstants.CONTENT_PATH + "/xforms/pdf/" + formSubmissionId; String linkToPDF = xFormConverter.getGeneratedPDFFromXForm(null, null, formSubmissionId, path, pdfName, false); if (StringUtil.isEmpty(linkToPDF)) return Boolean.FALSE; IWResourceBundle iwrb = IWMainApplication.getDefaultIWMainApplication() .getBundle(GumboConstants.IW_BUNDLE_IDENTIFIER).getResourceBundle(getCurrentLocale()); String subject = iwrb.getLocalizedString("sending_failure_message", "Uggi: Error when trying to send application for ship") + ": " + shipID; xformInPDF = new File(pdfName.concat(".pdf")); if (!xformInPDF.exists()) xformInPDF.createNewFile(); IWSlideService slide = getServiceInstance(IWSlideService.class); FileUtil.streamToFile(slide.getInputStream(linkToPDF), xformInPDF); SendMail.send("fiskistofa@fiskistofa.is", to, null, null, null, subject, "", xformInPDF); return Boolean.TRUE; } catch (Exception e) { getLogger().log(Level.WARNING, "Error sending saved XForm in PDF by email", e); } finally { if (xformInPDF != null) xformInPDF.delete(); } return Boolean.FALSE; }