ioexception

Android - How to work around a “no space left on device” error

夙愿已清 提交于 2019-12-06 07:22:28
So my latest app runs into this problem where it complains in the logcat that theres no room left on the device to save files but that is definitely not the case as I can close my app open the stock camera and take a picture. How has everybody else dealt with this problem. Edit: The error occurs in this method private void writeFile(Bitmap bmp, File f) { FileOutputStream out = null; try { out = new FileOutputStream(f); bmp.compress(Bitmap.CompressFormat.PNG, 80, out);//<---error here } catch (NullPointerException e) { e.printStackTrace(); Log.w("nullpointerException on image error",

Java: how to stop a server (close a Socket) without an exception?

强颜欢笑 提交于 2019-12-06 03:01:36
I've made a server which allows to join many clients. However I have a problem. I added START/STOP button which should start/stop server. But the code does not work like I want: connection isn't closed and code goes to the IOException "THIS IS PROBLEM" (in ServerLogic part). Additionally clients still can contact with server. SERVER LOGIC public class ServerLogic { private static ServerSocket m_sSocket; private static Set<ServerSubscriber> m_subscriberList = new HashSet<ServerSubscriber>(); private static boolean m_isServerRun = false; private static class ServerLogicHolder { static final

when does java.util.zip.ZipFile.close() throw IOException?

馋奶兔 提交于 2019-12-06 01:48:28
问题 Under what circumstances would java.util.zip.ZipFile.close() throw an IOException? Its method signature indicates that it can be thrown, but from the source code there doesn't seem to be any place where this could happen, unless it's in native code. What corrective action, if any, could be taken at the point where that exception is caught? 回答1: From the API docs on ZipFile.close(): Closing this ZIP file will close all of the input streams previously returned by invocations of the

Deleting a window's background image WPF

夙愿已清 提交于 2019-12-05 22:14:57
I'm having a problem in WPF where a window doesn't release it's file-lock on the background image file after closing, before another part of the application tries to write to the image. So as an example; say I have a WPF app consisting of 3 windows, 1 "menu" selection window and 2 others. Both of the windows create an ImageBrush using a BitmapImage as the ImageSource (the same image). Window A has a button that when pressed, cycles through the available background images by copying them each over the file used as the original ImageSource and creating a new ImageBrush and setting the Window

Call Python from Java

≯℡__Kan透↙ 提交于 2019-12-05 21:56:16
I want to call a python script from Java. My python version is 2.5 and Java is 6. My current code: try{ Process p= Runtime.getRuntime().exec("path/dirs/file.py"); p.waitFor(); } catch (InterruptedException ex){ System.out.println(ex.getMessage());} } The error I receive is: Java.IO.IOException: Cannot run program filename: CreateProcess error = 193, %1 is not a valid Win32 application Try to use PrecessBuilder - try{ String prg = "import sys\nprint int(sys.argv[1])+int(sys.argv[2])\n"; BufferedWriter out = new BufferedWriter(new FileWriter("test1.py")); out.write(prg); out.close(); int number1

java.io.IOException: Stream closed

允我心安 提交于 2019-12-05 18:16:35
问题 For multiple image retrieval I am calling a PhotoHelperServlet with an anchor tag to get imageNames(multiple images) as follows PhotoHelperServlet to get names of Images protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Getting userid from session Image image = new Image(); image.setUserid(userid); ImageDAO imageDAO = new ImageDAO(); try { List<Image> imageId = imageDAO.listNames(image); if (imageId == null) { // check if

File.Move and File.Copy gives IOException Logon failure

人盡茶涼 提交于 2019-12-05 17:36:53
I'm writing an add-in for a fujitsu scanner in C#. Documents are scanned to a local directory, and I wanted to copy them to a pc on the network. I keep getting System.IO.IOException: Logon failure: unknown user name or bad password though. I tried copying them to a public directory (at least I think its public), and I still get the same result. Any ideas for stuff I could try? I don't think my code here is the issue, but here it is anyway. private bool moveTheFile(String source, String destination) { System.DirectoryServices.DirectoryEntry dntry = null; try { //System.IO.File.Move(source,

Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host in C#

我与影子孤独终老i 提交于 2019-12-05 12:50:45
I have a code where I am sending the URL request and receiving the response and storing it as a String as public String GenerateXML(String q)// Here 'q' is the URL { // Generating the XML file for reference // Getting the response in XML format from the URL Debug.WriteLine("The Http URL after URL encoding :" + q); try { Uri signs1 = new Uri(q); //Debug.WriteLine("The Requested URL for getting the XML data :" + re); WebRequest request1 = WebRequest.Create(signs1); HttpWebResponse response1 = (HttpWebResponse)request1.GetResponse(); //HttpWebResponse response1 = (HttpWebResponse)request1

Debugging the “Too many files open” issue

烈酒焚心 提交于 2019-12-05 12:23:07
问题 The application i am working on suddenly crashed with java.io.IOException: ... Too many open files As i understand the issue it means that files are opened but not closed. Stacktrace of course happens after the fact and can only help understand before what event error occurred. What would be an intelligent way to search your code base to find this issue which only seems to occur when app is under high stress load. 回答1: I think the best way to use a tool specifically designed for the purpose,

SerialPort.Open() throws IOException - Insufficient system resources exist to complete the requested service

自闭症网瘾萝莉.ら 提交于 2019-12-05 11:44:33
I have a .NET 4 Windows service I've written that periodically (usually once a day) communicates with an external device over a serial port. All in all the service works great, but for one customer, every now and then, a call to SerialPort.Open() throws the following exception: System.IO.IOException: Insufficient system resources exist to complete the requested service. at System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str) at System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32