List of usage examples for java.util.logging Logger getLogger
@CallerSensitive public static Logger getLogger(String name)
From source file:deincraftlauncher.IO.download.FTPConnection.java
public static void disconnect() { if (!connected) { return;//from w w w.j ava2 s.c o m } try { client.logout(); client.disconnect(); } catch (IOException ex) { Logger.getLogger(FTPConnection.class.getName()).log(Level.SEVERE, null, ex); } connected = false; }
From source file:bridgempp.ConfigurationManager.java
public static void initializeConfiguration() { try {//ww w.j a va 2 s . c o m ShadowManager.log(Level.INFO, "Configuration files are being loaded..."); serviceConfiguration = new XMLConfiguration(BridgeMPP.getPathLocation() + "/config.xml"); serviceConfiguration.setEncoding("UTF-8"); groupConfiguration = new XMLConfiguration(BridgeMPP.getPathLocation() + "/groups.xml"); groupConfiguration.setEncoding("UTF-8"); endpointConfiguration = new XMLConfiguration(BridgeMPP.getPathLocation() + "/endpoints.xml"); endpointConfiguration.setEncoding("UTF-8"); permissionConfiguration = new XMLConfiguration(BridgeMPP.getPathLocation() + "/keys.xml"); permissionConfiguration.setEncoding("UTF-8"); ShadowManager.log(Level.INFO, "Configuration files have been loaded"); } catch (ConfigurationException ex) { Logger.getLogger(ConfigurationManager.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:controller.file.FileUploader.java
public static void fileDownloader(HttpServletRequest request, HttpServletResponse response) { PrintWriter out = null;//w w w . j a v a2 s . c o m try { String filename = "foo.xml"; String filepath = "/tmp/"; out = response.getWriter(); response.setContentType("APPLICATION/OCTET-STREAM"); response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\""); java.io.FileInputStream fileInputStream = new java.io.FileInputStream(filepath + filename); int i; while ((i = fileInputStream.read()) != -1) { out.write(i); } fileInputStream.close(); out.close(); } catch (IOException ex) { Logger.getLogger(FileUploader.class.getName()).log(Level.SEVERE, null, ex); } finally { out.close(); } }
From source file:com.nuance.expertassistant.ContentExtractor.java
public static void startDocument(String Title, String Filepath) { try {/*ww w . j a v a 2 s.co m*/ writer = new PrintWriter(Filepath, "UTF-8"); writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<document xmlns:fo=\"http://www.w3.org/1999/XSL/Format\"\n" + " xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\n" + " xmlns:fn=\"http://www.w3.org/2005/xpath-functions\"\n" + " xmlns:xdt=\"http://www.w3.org/2005/xpath-datatypes\"\n" + " docid=\"a382247e\"\n" + " title=\"" + Title + "\">"); } catch (final FileNotFoundException ex) { Logger.getLogger(ContentExtractor.class.getName()).log(Level.SEVERE, null, ex); } catch (final UnsupportedEncodingException ex) { Logger.getLogger(ContentExtractor.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:de.scrubstudios.srvmon.notificator.classes.Crypt.java
public static String encrypt(String key, String data) { byte[] encryptedData = null; SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(), "AES"); try {//from www . j a va 2 s . c om Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, keySpec); encryptedData = cipher.doFinal(data.getBytes()); byte[] encr64 = Base64.encodeBase64(encryptedData); //System.out.println(new String(encr64)); return new String(encr64); } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException ex) { Logger.getLogger(Crypt.class.getName()).log(Level.SEVERE, null, ex); } return null; }
From source file:controller.NewEntryDeleteControllerTest.java
@BeforeClass public static void setUpClass() { File file = new File(System.getProperty("user.dir") + fSeparator + "MyDiaryBook" + fSeparator + "Users" + fSeparator + "Panagiwtis Georgiadis" + fSeparator + "Entries" + fSeparator + "Entry1"); file.mkdirs();// ww w. j a v a 2 s.co m file = new File(System.getProperty("user.dir") + fSeparator + "MyDiaryBook" + fSeparator + "Users" + fSeparator + "Panagiwtis Georgiadis" + fSeparator + "Entries" + fSeparator + "Entry2"); file.mkdirs(); File imageFile = new File(System.getProperty("user.dir") + fSeparator + "src" + fSeparator + "test" + fSeparator + "java" + fSeparator + "resources" + fSeparator + "testImg.jpg"); try { FileUtils.copyFileToDirectory(imageFile, file); } catch (IOException ex) { Logger.getLogger(NewEntryDeleteControllerTest.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:com.iselect.web.controller.GlobalExceptionHandler.java
@ExceptionHandler(CopyPropertiesException.class) public String copyPropertyException(CopyPropertiesException ex) { Logger.getLogger(GlobalExceptionHandler.class.getName()).log(Level.SEVERE, null, ex); return "global.exception.copyproperties"; }
From source file:flexpos.restfulConnection.java
public static ArrayList<ArrayList<String>> getRESTful(String RESTfull_URL, ArrayList<String> columnasTabla) { try {//from w ww .java2 s .com URL url; URLConnection urlConnection; DataInputStream readString; url = new URL(RESTfull_URL); urlConnection = url.openConnection(); urlConnection.setDoInput(true); urlConnection.setUseCaches(false); readString = new DataInputStream(urlConnection.getInputStream()); String s; String getRequest = ""; while ((s = readString.readLine()) != null) { getRequest += s; } readString.close(); if (!"".equals(getRequest)) { return completeArray(getRequest, columnasTabla); } } catch (Exception ex) { Logger.getLogger(restfulConnection.class.getName()).log(Level.SEVERE, null, ex); } return null; }
From source file:JGraphLoader.GraphSaver.java
public static void saveG(String filename, Graph g) { final AbstractLayout layout = new StaticLayout(g); GraphMLWriter<node, edge> graphWriter = new GraphMLWriter<node, edge>(); try {//from w ww . jav a 2 s .co m PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(filename))); graphWriter.addEdgeData("id", null, "0", new Transformer<edge, String>() { @Override public String transform(edge i) { return i.getValue(); } }); /* graphWriter.addVertexData("y", null, "0", new Transformer<node, String>() { public String transform(node v) { return Double.toString(layout.getY(v)); } } );*/ graphWriter.save(g, out); } catch (IOException ex) { Logger.getLogger(GraphSaver.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:be.ugent.maf.cellmissy.analysis.KDTreeTest.java
@BeforeClass public static void creteKDTree() { try {/*from www .jav a2 s. c om*/ // create a new KD Tree with two dimensions and add the first 3 points to it tree = new KDTree(2); tree.insert(A, "A"); tree.insert(B, "B"); tree.insert(C, "C"); } catch (KeySizeException | KeyDuplicateException ex) { Logger.getLogger(KDTreeTest.class.getName()).log(Level.SEVERE, null, ex); } }