Search Results

Search found 13191 results on 528 pages for 'unhandled exception'.

Page 45/528 | < Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >

  • JQuery Ajax error handling, show custom exception messages

    Hey Folks, I am wondering if there is some way where I can show custom exception messages as an alert in my Jquery ajax error message. For example, say if I want to throw an exception in server side via Struts by "throw new ApplicationException("User name already exists");", I want to catch this message(User name already exists) in Jquery ajax error message. jQuery("#save").click(function(){ if(jQuery('#form').jVal()){ jQuery.ajax({ type: "POST", url: "saveuser.do", dataType:"html", data:"userId="+encodeURIComponent(trim(document.forms[0].userId.value)), success:function(response){ jQuery("#usergrid").trigger("reloadGrid"); clear(); alert("Details saved successfully!!!"); }, error:function (xhr, ajaxOptions, thrownError){ alert(xhr.status); alert(thrownError); } }); } } ); On the second alert where I alert thrown error, I am getting undefined and the status code is 500. I am not sure where I am going wrong. Please let me know on this. Thanks, Dukes

    Read the article

  • InvalidCastException for two Objects of the same type

    - by LLEA
    hi, I have this weird problem that I cannot handle myself. A class in the model of my mvp-project designed as singleton causes an InvalidCastException. The source of error is found in this code line where the deserialised object is assigned to the instance variable of the class: engineObject = (ENGINE)xSerializer.Deserialize(str); It occurs whenever I try to add one of my UserControls to a Form or to a different UC. All of my UCs have a special presenter that access the above mentioned instance variable of the singleton class. This is what I get when trying to add a UC somewhere: 'System.TypeInitializationException: The type initializer for 'MVP.Model.EngineData' threw an exception. ---- System.InvalidCastException: [A]Engine cannot be cast to [B]Engine. Type A originates from 'MVP.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' in the context 'LoadNeither' at location '[...]\AppData\Roaming\Microsoft\VisualStudio\9.0\ProjectAssemblies\uankw1hh01\MVP.Model.dll'. Type B originates from 'MVP.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' in the context 'LoadNeither' at location '[...]\AppData\Roaming\Microsoft\VisualStudio\9.0\ProjectAssemblies\u_hge2de01\MVP.Model.dll'... So I somehow have two assemblies and they are not accessed from my project folder, but from a VS temp folder? I googled a lot and only found this: IronPython Exception: [A]Person cannot be cast to [B]Person. There is a solution offered, but first it concerns IronPhyton and second I don't know where to use it within my project? It would be just great, if u could help me out here :-) thx

    Read the article

  • Convert an exception into HTTP 404 response in the Application_Error

    - by Dmitriy Nagirnyak
    Hi, First of all, quickly what exactly I want to achieve: translate particular exception into the HTTP 404 so the ASP.NET can handle it further. I am handling exceptions in the ASP.NET (MVC2) this way: protected void Application_Error(object sender, EventArgs e) { var err = Server.GetLastError(); if (err == null) return; err = err.GetBaseException(); var noObject = err as ObjectNotFoundException; if (noObject != null) HandleObjectNotFound(); var handled = noObject != null; if (!handled) Logger.Fatal("Unhandled exception has occured in application.", err); } private void HandleObjectNotFound() { Server.ClearError(); Response.Clear(); // new HttpExcepton(404, "Not Found"); // Throw or not to throw? Response.StatusCode = 404; Response.StatusDescription = "Not Found"; Response.StatusDescription = "Not Found"; Response.Write("The whole HTML body explaining whata 404 is??"); } The problem is that I cannot configure default customErrors to work with it. When it is on then it never redirects to the page specified in customErrors: <error statusCode="404" redirect="404.html"/>. I also tried to raise new HttpExcepton(404, "Not Found") from the handler but then the response code is 200 which I don't understand why. So the questions are: What is the proper way of translating AnException into HTTP 404 response? How does customErrors section work when handling exceptions in Application_Error? Why throwing HttpException(404) renders (blank) page with success (200) status? Thanks, Dmitriy.

    Read the article

  • Handling exception from unmanaged dll in C#

    - by StuffHappens
    Hello. I have the following function written in C# public static string GetNominativeDeclension(string surnameNamePatronimic) { if(surnameNamePatronimic == null) throw new ArgumentNullException("surnameNamePatronimic"); IntPtr[] ptrs = null; try { ptrs = StringsToIntPtrArray(surnameNamePatronimic); int resultLen = MaxResultBufSize; int err = decGetNominativePadeg(ptrs[0], ptrs[1], ref resultLen); ThrowException(err); return IntPtrToString(ptrs, resultLen); } catch { return surnameNamePatronimic; } finally { FreeIntPtr(ptrs); } } Function decGetNominativePadeg is in unmanaged dll [DllImport("Padeg.dll", EntryPoint = "GetNominativePadeg")] private static extern Int32 decGetNominativePadeg(IntPtr surnameNamePatronimic, IntPtr result, ref Int32 resultLength); and throws an exception: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. The catch that is in C# code doesn't actually catch it. Why? How to handle this exception? Thank you for your help! UPDATED private static IntPtr[] StringsToIntPtrArray(params string[] strs) { IntPtr[] ptrs = new IntPtr[strs.Length + 1]; for(int i = 0; i < ptrs.Length - 1; i++) ptrs[i] = StringToIntPtr(strs[i]); ptrs[ptrs.Length - 1] = Marshal.AllocHGlobal(m_MaxResultStringBufSize); return ptrs; }

    Read the article

  • SQLite table does not exist exception for existing SQLite database (and table)

    - by SK9
    I've followed the instructions given here for introducing an existing SQLite database to your Android app. When I query the table "android_metadata" this is fine. But when I run a similar query on my own table "words" (which has _id for primary integer key) I get a table does not exist exception and the app crashes. Why is that? Code: Cursor c = myDatabase.query("android_metadata", null, null, null, null, null, null, null); works but Cursor c = myDatabase.query("words", null, null, null, null, null, null, null); returns a table does not exist exception. This is how I'm creating the database (the references to paths and filenames are correct): private void copyDatabase() throws IOException{ //Open local db as the input stream InputStream myInput = mContext.getAssets().open(DB_NAME); //Path to the just created empty db String outFileName = DB_PATH + DB_NAME; //Open the empty db as the output stream OutputStream myOutput = new FileOutputStream(outFileName); //Transfer bytes from the inputfile to the outputfile byte[] buffer = new byte[1024]; int length; while ((length = myInput.read(buffer))>0){ myOutput.write(buffer, 0, length); } //Close the streams myOutput.flush(); myOutput.close(); myInput.close(); } (Note: To my eyes, the table is there. I'm looking right at it in my SQLite browser.)

    Read the article

  • How to best handle exception to repeating calendar events

    - by blcArmadillo
    I'm working on a project that will require me to implement a calendar. I'm trying to come up with a system that is very flexible: can handle repeating events, exceptions to repeats, etc. I've looked at the schema for applications like iCal, Lotus Notes, and Mozilla to get an idea of how to go about implementing such a system. Currently I'm having trouble deciding what is the best way to handle exceptions to repeating events. I've used databases quite a bit but don't have a ton of experience with really optimizing everything so I'm not sure which method of the two I'm considering would be optimal in terms of overall performance and ability to query/search: Breaking the repeating event. So taking the changing the ending date on the current row for the repeating event, inserting a new row with the exception, and adding another row continuing the old sequence. Simply adding an exception. So adding a new row with some field that indicates it as an override. So here is why I can't decide. Method one will result in a lot more rows since each edit requires 2 extra rows as apposed to only one row by the second method. On the other hand I think the query to find an event would be much simper, and thus possibly faster(?) using the first method. The second method seems like it will require more calculating on the application server since once you get the data you'll have to remove the intersection of the two rows. I know databases are often the bottleneck for websites and while I'm sure a lot of you are thinking either is fine because your project will probably never get large enough for the difference in efficiency to really matter, I'd still like to implement the best solution. So what method would you guys pick, or would you do something completely different? Also, as a side note I'll be using MySQL and PHP. If there is another technology that you think would be better suited for this, especially in the database area, please mention it. Thanks for the advice.

    Read the article

  • NoSuchMethod exception thrown in GWT

    - by eb1
    I'm starting to get my feet wet in the latest Google Web Toolkit using the Eclipse plugin on OS X 10.5.8. So far I've been able to get the client up and running, which is great. The server, though, is a different matter. I'm trying to link to a .jar file that has some classes I want to use in a server ServiceImpl class, but it seems to have glommed onto a previous iteration of the .jar - I've added a method, rebuilt the jar, removed the jar from the libraries tab on the GWT project's build path (as well as on the exports) and reincluded the jar. No luck - I'm still getting: [WARN] Exception while dispatching incoming RPC call com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract org.gwtapplication.client.LWDocument org.gwtapplication.client.DocumentService.getDocument()' threw an unexpected exception: java.lang.NoSuchMethodError: org.externalmodel.MyReallyValidClass.toSomething()Ljava/lang/String; at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:378) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:581) ... Caused by: java.lang.NoSuchMethodError: org.externalmodel.MyReallyValidClass.toSomething()Ljava/lang/String; at org.application.server.DocumentServiceImpl.getDocument(DocumentServiceImpl.java:45) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) Eclipse's code sense has no problems resolving the MyReallyValidClass.toSomething() call, and there are no errors with other calls into the externalmodel classes. Any clue where I should be looking?

    Read the article

  • Custom RoleProvider: Can't insert record in UsersInRole Table

    - by mahr.g.mohyuddin
    Hi, I have implemented a LINQ to SQL based RoleProvider, when I assign role to a user following exception is thrown while AddUsersToRoles method is called. I have defined a composite primary key userid & roleId on this table, it still throwing this exception: Can't perform Create, Update or Delete operations on 'Table(UsersInRole)' because it has no primary key. My LinQ to SQL implementation of AddUsersToRoles method is as follows. It breaks at db.UsersInRoles.InsertOnSubmit(userInRole); using (RussarmsDataContext db = new RussarmsDataContext()) { List<UsersInRole> usersInRole = new List<UsersInRole>(); foreach (string username in usernames) { foreach (string rolename in rolenames) { UsersInRole userInRole = new UsersInRole(); object userId = ProvidersUtility.GetUserIdByUserName(username,applicationName); object roleId = ProvidersUtility.GetRoleIdByRoleName(rolename,applicationName); if (userId != null && roleId != null) { userInRole.UserId = (Guid)userId; userInRole.RoleId = (Guid)roleId; db.UsersInRoles.InsertOnSubmit(userInRole); } } } try { // db.UsersInRoles.InsertAllOnSubmit(usersInRole); db.SubmitChanges(); } catch (ChangeConflictException) { db.ChangeConflicts.ResolveAll(RefreshMode.OverwriteCurrentValues); db.SubmitChanges(); } } Any help will be appreciated. Thanks.

    Read the article

  • SerializationException Occurring Only in Release Mode

    - by Calvin Nguyen
    Hi, I am working on an ASP.NET web app using Visual Studio 2008 and a third-party library. Things are fine in my development environment. Things are also good if the web app is deployed in Debug configuration. However, when it is deployed in Release mode, SerializationExceptions appear intermittently, breaking other functionality. In the Windows event log, the following error can be seen: "An unhandled exception occurred and the process was terminated. Application ID: DefaultDomain Process ID: 3972 Exception: System.Runtime.Serialization.SerializationException Message: Unable to find assembly 'MyThirdPartyLibrary, Version=1.234.5.67, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89'. StackTrace: at System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly( ) at System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAsse mblyInfo assemblyInfo, String name) at System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(String objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable) at System.Runtime.Serialization.Formatters.Binary.ObjectMap.Create(String name, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable) at System.Runtime.Serialization.Formatters.Binary._BinaryParser.ReadObjectWithMa pTyped(BinaryObjectWithMapTyped record) at System.Runtime.Serialization.Formatters.Binary._BinaryParser.ReadObjectWithMa pTyped(BinaryHeaderEnum binaryHeaderEnum) at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run() at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(Header Handler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Str eam serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) at System.Runtime.Remoting.Channels.CrossAppDomainSerializer.DeserializeObject(Me moryStream stm) at System.AppDomain.Deserialize(Byte[] blob) at System.AppDomain.UnmarshalObject(Byte[] blob) For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp." Using FUSLOGVW.exe (i.e., Assembly Binding Log Viewer), I can see the problem is that IIS attempts to find MyThirdPartyLibrary in directory C:\windows\system32\inetsrv. It refuses to look in the bin folder of the web app, where the DLL is actually located. Does anyone know what the problem is? Thanks, Calvin

    Read the article

  • What causes exception in string.concat

    - by Budda
    Here are few classes: public class MyItem : ParamOut { public string Code { get { return _quoteCode; } } public InnerItem[] Skus { get { return _skus; } } public PriceSummary Price { get { return _price; } } public override string ToString() { return string.Concat("Code=", Code, "; SKUs=[", Skus != null ? "{" + string.Join("},{", Array.ConvertAll(Skus, item => item.ToString())) + "}" : "", "]" , "; Price={", Price.ToString(), "}", base.ToString() ); } ... } public abstract class ParamOut { public override string ToString() { return null; } public string ErrorMessage { get; set; } } Here is calling functionality: { MyItem item = new MyItem{ ErrorMessage = "Bla-bla-bla" }; string text = item.ToString(); } I am getting NullReference exception inside of 'ToString()' method (each property of item variable is null). Question: Q1. what overload of string.Concat will be called in this case? I have 9 parameters, so I guess one of the following: public static string Concat(params Object[] args) or public static string Concat(params string[] values) But which of them? Q2. Why exception is generated? Shouldn't 'null' be converted into something like 'null' or "" (empty string)? Thanks a lot!

    Read the article

  • ASP.Net 2.0 VB WebSite Project "Type 'Exception' is not defined"

    - by AtlSteve
    All of a sudden our VB ASP.Net 2.0 WebSite Project started complaining that Exception was not defined. I have discovered that if I add "Imports System" to the header, or explicitly use System.Exception that it works, but this error permeates a lot of other System descendants like the Data namespace, and the DateTime object. We have hundreds and hundreds of pages, so adding Imports System to all of them not only would be time consuming, but it seems like a band-aid fix to the problem. I have checked the Project-Property Pages-References, and the web.config file, and the assembly is imported into the project, it is just not being "Auto Imported" into the Class Files like it USUALLY is. Note this does not JUST affect CodeBehind, but All className.vb files. I would like to fix this problem, but more importantly would like to understand what could cause the System namespace to all of a sudden stop being auto imported. There is obviously some file change that caused this, as my co-worker started seeing the problem this morning after he did a Full-Get on the project. MORE: The Web.Config file located in the Windows\Microsoft.Net...\Config\Web.Config file does have the , and System is added. Adding the tags, and adding System to the LOCAL web.config did nothing to mitigate the problem. Any help would be appreciated. First SO Question, so I hope I was descriptive enough.

    Read the article

  • JTable Delete All Rows Exception

    - by Dimitri
    Hi, I'm trying to delete all entrys from my abstractTableModel. As long as I don't delete the last remaining row, everything works fine, but as soon as I delete this one, I get an ArrayOutOfBoundsException. I'm using a DefaultRowSorter and this seems to be the Exception. Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0 at java.util.Vector.get(Vector.java:694) at graphics.tableModel.MyTableModel.getValueAt(MyTableModel.java:78) at graphics.tableModel.MyTableModel.getColumnClass(MyTableModel.java:90) at javax.swing.table.TableRowSorter.useToString(TableRowSorter.java:224) at javax.swing.DefaultRowSorter.updateUseToString(DefaultRowSorter.java:607) at javax.swing.DefaultRowSorter.sort(DefaultRowSorter.java:556) at javax.swing.DefaultRowSorter.shouldOptimizeChange(DefaultRowSorter.java:1008) at javax.swing.DefaultRowSorter.rowsDeleted(DefaultRowSorter.java:866) at javax.swing.JTable.notifySorter(JTable.java:4262) at javax.swing.JTable.sortedTableChanged(JTable.java:4106) at javax.swing.JTable.tableChanged(JTable.java:4383) at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280) my Code to delete all Rows: public void deleteAll() { int size = data.size()-1; data.clear(); this.fireTableRowsDeleted(0, size); } Same thing happens with simply deleting the last existing row. public void deleteRow(int row) { data.remove(row); } the way i'm calling deleteRow: for (int i = rows.length - 1; i >=0; i--) { tm.deleteRow(rows[i]); } tm.fireTableDataChanged(); thanks for your help

    Read the article

  • Java - SAX parser on a XHTML document

    - by Peter
    Hey, I'm trying to write a SAX parser for an XHTML document that I download from the web. At first I was having a problem with the doctype declaration (I found out from here that it was because W3C have intentionally blocked access to the DTD), but I fixed that with: XMLReader reader = parser.getXMLReader(); reader.setFeature("http://apache.org/xml/features/disallow-doctype-decl",true); However, now I'm experiencing a second problem. The SAX parser throws an exception when it reaches some Javascript embedded in the XHTML document: <script type="text/javascript" language="JavaScript"> function checkForm() { answer = true; if (siw && siw.selectingSomething) answer = false; return answer; }// </script> Specifically the parser throws an error once it reaches the &&'s, as it's expecting an entity reference. The exact exception is: `org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:391) at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1390) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEntityReference(XMLDocumentFragmentScannerImpl.java:1814) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3000) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:624) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:486) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:810) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:740) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:110) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1208) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:525) at MLIAParser.readPage(MLIAParser.java:55) at MLIAParser.main(MLIAParser.java:75)` I suspect (but I don't know) that if I hadn't disabled the DTD then I wouldn't get this error. So, how can I avoid the DTD error and avoid the entity reference error? Cheers, Pete

    Read the article

  • saxon java xpath exception :

    - by changed
    Hi I am trying to read XPath queries from a file and run it against a xml data file. I am doing it through Saxon Xpath processor. But i keep getting this error. Code i am using is from sample code provided with the library. Error i am getting is : Exception in thread "main" javax.xml.xpath.XPathExpressionException: Supplied node must be built using the same or a compatible Configuration at net.sf.saxon.xpath.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:283) at net.sf.saxon.xpath.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:375) at edu.xml.XPathExample.go(XPathExample.java:81) at edu.xml.XPathExample.main(XPathExample.java:42) - public void go(String filename) throws Exception { XPathExpression findLine = null; String readLine = null; Object document = new XPathEvaluator().setSource(new StreamSource(new File(dataPath))); System.setProperty("javax.xml.xpath.XPathFactory:" + NamespaceConstant.OBJECT_MODEL_SAXON, "net.sf.saxon.xpath.XPathFactoryImpl"); XPathFactory xpf = XPathFactory.newInstance(NamespaceConstant.OBJECT_MODEL_SAXON); XPath xpe = xpf.newXPath(); if (filename != null) { this.queryPath = filename; } try { fileReader = new BufferedReader(new FileReader(queryPath)); } catch (FileNotFoundException ex) { System.out.println("File not found: " + ex.getMessage()); } xpe.setXPathVariableResolver(this); while (true) { try { readLine = fileReader.readLine(); } catch (IOException ex) { System.out.println("Error while reading file: " + ex.getMessage()); } if (readLine == null) { break; } findLine = xpe.compile(readLine); String resultString = findLine.evaluate(document); System.out.println("<output>"); System.out.println("String Value => " + resultString); System.out.println("</output>"); } }

    Read the article

  • Android & SQLite: "Table audios has no column named downloaded"

    - by Erik
    I get this weird exception when i run my app on both the emulator and a USB connected device. i can see the table inside the shell, but when I try to insert a record from the Activity acton I get this exception: android.database.sqlite.SQLiteException: table audios has no column named downloaded I am mostly running on an emulator with Android 1.5. The predominant part of my code is linked to this tutorial - http://www.devx.com/wireless/Article/40842/1954. This is the create statement I use: private static final String DATABASE_CREATE = "create table audios ( _id integer primary key autoincrement, " + "user_name text not null, title text not null, file_path text not null, download integer not null, " + "created_at integer not null, downloaded_at integer not null );"; This is the insert code I use: //--- insert a title into the database --- public long insertTitle(String user_name, String title, String file_path, Integer downloaded, long created_at, String downloaded_at ) { ContentValues initialValues = new ContentValues(); initialValues.put(KEY_USER_NAME, user_name); initialValues.put(KEY_TITLE, title); initialValues.put(KEY_FILE, file_path); initialValues.put(KEY_DOWNLOADED, downloaded); initialValues.put(KEY_CREATED_AT, created_at); initialValues.put(KEY_DOWNLOADED_AT, downloaded_at); return db.insert(DATABASE_TABLE, null, initialValues); }

    Read the article

  • IncludeExceptionDetailInFaults not behaving as thought

    - by pdiddy
    I have this simple test project just to test the IncludeExceptionDetailInFaults behavior. public class Service1 : IService1 { public string GetData(int value) { throw new InvalidCastException("test"); return string.Format("You entered: {0}", value); } } [ServiceContract] public interface IService1 { [OperationContract] string GetData(int value); } In the app.config of the service i have it set to true <serviceDebug includeExceptionDetailInFaults="True" /> On the client side: try { using (var proxy = new ServiceReference1.Service1Client()) Console.WriteLine(proxy.GetData(5)); } catch (Exception ex) { Console.WriteLine(ex.Message); } This is what I thought the behavior was: Setting to includeExceptionDetailInFaults=true would propagate the exception detail to the client. But I'm always getting the CommunicationObjectFaultException. I did try having the FaultContract(typeof(InvalidCastException)) on the contract but same behavior, only getting the CommunicationObjectFaultException. The only way to make it work was to throw new FaultException(new InvalidCastException("test")); But I thought with IncludeExceptionDetailInFaults=true the above was done automatically. Am I missing something?

    Read the article

  • ComboBox exception caused in winforms FormClosing event

    - by Spooky2010
    Using c# vs2008 winforms I have an application with a bunch of child winforms. Each time a form is closed I need to store the current selected value of a combobox that is on each form to a Global application variable so that I can track it and use it in new forms. The combobox is populated on form start via a method to set its datasource to an ArrayList of items What I have found is if the combobox is populated with items in the designer, and you try to get the combobox value in the form closing event, I always get a NullReferenceException. However if the comboBox has an datasource like I DO have in my application and I try to get the combobox value in the form closing event then I would say 95% of the time I DO NOT get the NullReferenceException, but I do get it 5% of the time. That ratio can even vary depending on what computer I run the application on. for example I have 1 computer where the exception always occurs. My question is therefore what is (the best) way to get the value of the combobox, last thing before the form closes without causing the exception. I would def prefer to do it last thing before the form closes rather than track it with every selected index change event. Any advice appreciated.

    Read the article

  • Run time error in java servlet

    - by Derk
    The build of the project is succesfull, but when I go the the url I get the following error report: >HTTP Status 500 - type Exception report >message description The server encountered an internal error () that prevented it from fulfilling this request. >exception javax.servlet.ServletException: Error instantiating servlet class example.servlet.ScrapingServlet org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) java.lang.Thread.run(Thread.java:619) >root cause java.lang.NoClassDefFoundError: org/apache/http/impl/client/DefaultHttpClient java.lang.Class.getDeclaredConstructors0(Native Method) java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) java.lang.Class.getConstructor0(Class.java:2699) java.lang.Class.newInstance0(Class.java:326) java.lang.Class.newInstance(Class.java:308) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) java.lang.Thread.run(Thread.java:619) >root cause java.lang.ClassNotFoundException: org.apache.http.impl.client.DefaultHttpClient org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204) java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) java.lang.Class.getDeclaredConstructors0(Native Method) java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) java.lang.Class.getConstructor0(Class.java:2699) java.lang.Class.newInstance0(Class.java:326) java.lang.Class.newInstance(Class.java:308) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) java.lang.Thread.run(Thread.java:619) >note The full stack trace of the root cause is available in the Apache Tomcat/6.0.14 logs. Apache Tomcat/6.0.14 And that is because I added this simple line to the code: HttpClient httpclient = new DefaultHttpClient(); What am I doing wrong?

    Read the article

  • FluentNHibernate SQLite configuration exception - after switching to .net4

    - by stiank81
    I get an exception thrown when trying to use Fluent to configure my NHibernate connection to SQLite. The code I use to configure is as follows: var cfg = Fluently.Configure(). Database(SQLiteConfiguration.Standard.ShowSql().UsingFile("MyDb.db")). Mappings(m => m.FluentMappings.AddFromAssemblyOf<MappingsPersistenceModel>()); _sessionFactory = cfg.BuildSessionFactory(); A HibernateException is thrown when BuildSessionFactory() is called, saying: Could not create the driver from NHibernate.Driver.SQLite20Driver, NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4. It has an InnerException: Exception has been thrown by the target of an invocation. Which again has an InnerException: The IDbCommand and IDbConnection implementation in the assembly System.Data.SQLite could not be found. Ensure that the assembly System.Data.SQLite is located in the application directory or in the Global Assembly Cache. If the assembly is in the GAC, use element in the application configuration file to specify the full name of the assembly. Now - to me it sounds like it doesn't find System.Data.SQLite.dll, but I can't understand this. Everywhere this is referenced I have "Copy Local", and I have verified that it is in every build folder for projects using SQLite. I have also copied it manually to every Debug folder of the solution - without luck. What can be causing this? Any ideas? My suspicion is that it is related to .Net4 somehow. The reason is that it worked just fine when I used .Net3.5, and then I changed to .Net4, and the problem started. You can also check out this other question for a more general approach towards Fluent-.Net4 compatibility.

    Read the article

  • Exception during iteration on collection and remove items from that collection

    - by Muhammad Kashif Nadeem
    I remove item from ArrayList in foreach loop and get follwing exception. Collection was modified; enumeration operation may not execute. How can I remove items in foreach Following is my code: /* * Need to remove all items from 'attachementsFielPath' which does not exist in names array. */ try { string attachmentFileNames = txtAttachment.Text.Trim(); // Textbox having file names. string[] names = attachmentFileNames.Split(new char[] { ';' }); int index = 0; // attachmentsFilePath is ArrayList holding full path of fiels user selected at any time. foreach (var fullFilePath in attachmentsFilePath) { bool isNeedToRemove = true; // Extract filename from full path. string fileName = fullFilePath.ToString().Substring(fullFilePath.ToString().LastIndexOf('\\') + 1); for (int i = 0; i < names.Length; i++) { // If filename found in array then no need to check remaining items. if (fileName.Equals(names[i].Trim())) { isNeedToRemove = false; break; } } // If file not found in names array, remove it. if (isNeedToRemove) { attachmentsFilePath.RemoveAt(index); isNeedToRemove = true; } index++; } } catch (Exception ex) { throw ex; }

    Read the article

  • Translate an exception into 404 from Application_Error

    - by Dmitriy Nagirnyak
    Hi, First of all, quickly what exactly I want to achieve: translate particular exception into the HTTP 404 so the ASP.NET can handle it further. I am handling exceptions in the ASP.NET (MVC2) this way: protected void Application_Error(object sender, EventArgs e) { var err = Server.GetLastError(); if (err == null) return; err = err.GetBaseException(); var noObject = err as ObjectNotFoundException; if (noObject != null) HandleObjectNotFound(); var handled = noObject != null; if (!handled) Logger.Fatal("Unhandled exception has occured in application.", err); } private void HandleObjectNotFound() { Server.ClearError(); Response.Clear(); // new HttpExcepton(404, "Not Found"); // Throw or not to throw? Response.StatusCode = 404; Response.StatusDescription = "Not Found"; Response.StatusDescription = "Not Found"; Response.Write("The whole HTML body explaining whata 404 is??"); } The problem is that I cannot configure default customErrors to work with it. When it is on then it never redirects to the page specified in customErrors: <error statusCode="404" redirect="404.html"/>. I also tried to raise new HttpExcepton(404, "Not Found") from the handler but then the response code is 200 which I don't understand why. So the questions are: What is the proper way of translating AnException into HTTP 404 response? How does customErrors section work when handling exceptions in Application_Error? Why throwing HttpException(404) renders (blank) page with success (200) status? Thanks, Dmitriy.

    Read the article

  • bash - how to filter java exception info

    - by Michael Mao
    Hi all: We've got a multi-agent Java environment where different agent would most likely produce all sorts of exceptions thrown to stderr. Here is a sample taken from the huge exception log **java.security.AccessControlException: access denied (java.io.FilePermission ..\tournament\Driver\HotelRoomAnalyser.class read)** at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at java.lang.SecurityManager.checkRead(Unknown Source) at java.io.File.length(Unknown Source) at emarket.client.EmarketSandbox$SandboxFileLoader.loadClassData(EmarketSandbox.java:218) at emarket.client.EmarketSandbox$SandboxFileLoader.loadClass(EmarketSandbox.java:199) at java.lang.ClassLoader.loadClass(Unknown Source) **java.security.AccessControlException: access denied (java.io.FilePermission ..\tournament\Driver\HotelRoomAnalyser.class read)** at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at java.lang.SecurityManager.checkRead(Unknown Source) at java.io.File.length(Unknown Source) at emarket.client.EmarketSandbox$SandboxFileLoader.loadClassData(EmarketSandbox.java:218) at emarket.client.EmarketSandbox$SandboxFileLoader.loadClass(EmarketSandbox.java:199) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at MySmarterAgent.hotelRoomBookings(MySmarterAgent.java:108) fortunately all top-tier exceptions are denoted by no leading spaces, as wrapped by ** above. My concern is to get all of the top-tier exception name (delimited by colon :), together with the first line below which contains something like at emarket.client.EmarketSandbox$SandboxFileLoader.loadClassData(EmarketSandbox.java:218) Basically, something with padded style, starts with "at" and ends with ".java:108" So this info can be forwarded to the owner of that error-prone agent and let him/her fix it. My code in ~/.bashrc is incompleted now : alias startmatch='java -jar "emarket.jar" ../tournament 100'; function geterrors() { startmatch 2>"$1"; a=0; while read line do if true; then a=$(($a+1)); echo $a; fi; done } What it does now is to redirect all stderr to a text file specified by the first argument passed in, and after that, parse that text file line by line, if certain conditions returns true, echo only that line. And I am stuck with what to do inside the loop. Any suggestion is much appreciates, any hint is welcomed.

    Read the article

  • Reason for Null pointer Exception

    - by Rahul Varma
    Hi, I cant figure out why my program is showing null pointer exception. Plz help me...Here's the program... public class MusicListActivity extends Activity { List<HashMap<String, String>> songNodeDet = new ArrayList<HashMap<String,String>>(); HashMap<?,?>[] songNodeWeb; XMLRPCClient client; String logInSess; ArrayList<String> paths=new ArrayList<String>(); public ListAdapter adapter ; Object[] websongListObject; List<SongsList> SngList=new ArrayList<SongsList>(); Runnable r; ProgressDialog p; ListView lv; String s; @Override public void onCreate(Bundle si){ super.onCreate(si); setContentView(R.layout.openadiuofile); lv=(ListView)findViewById(R.id.list1); r=new Runnable(){ public void run(){ try{ getSongs(); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XMLRPCException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }; Thread t=new Thread(r,"background"); t.start(); Log.e("***","process over"); } @Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); } private Runnable returnRes = new Runnable() { @Override public void run() { Log.d("handler","handler"); removeDialog(0); p.dismiss(); list(); } }; public void list() { Log.d("#####","#####"); LayoutInflater inflater=getLayoutInflater(); String[] from={}; int[] n={}; adapter=new SongsAdapter(getApplicationContext(),songNodeDet,R.layout.row,from,n,inflater); lv.setAdapter(adapter);} private Handler handler = new Handler() { public void handleMessage(Message msg){ Log.d("*****","handler"); removeDialog(0); p.dismiss(); } }; public void webObjectList(Object[] imgListObj,String logInSess) throws XMLRPCException{ songNodeWeb = new HashMap<?,?>[imgListObj.length]; if(imgListObj!=null){ Log.e("completed","completed"); for(int i=0;i<imgListObj.length;i++){ //imgListObj.length songNodeWeb[i]=(HashMap<?,?>)imgListObj[i]; String nodeid=(String) songNodeWeb[i].get("nid"); break; Log.e("img",i+"completed"); HashMap<String,String> nData=new HashMap<String,String>(); nData.put("nid",nodeid); Object nodeget=client.call("node.get",logInSess,nodeid); HashMap<?,?> imgNode=(HashMap<?,?>)nodeget; String titleName=(String) imgNode.get("titles"); String movieName=(String) imgNode.get("album"); String singerName=(String) imgNode.get("artist"); nData.put("titles", titleName); nData.put("album", movieName); nData.put("artist", singerName); Object[] imgObject=(Object[])imgNode.get("field_image"); HashMap<?,?>[] imgDetails=new HashMap<?,?>[imgObject.length]; imgDetails[0]=(HashMap<?, ?>)imgObject[0]; String path=(String) imgDetails[0].get("filepath"); if(path.contains(" ")){ path=path.replace(" ", "%20"); } String imgPath="http://www.gorinka.com/"+path; paths.add(imgPath); nData.put("path", imgPath); Log.e("my path",path); String mime=(String)imgDetails[0].get("filemime"); nData.put("mime", mime); SongsList songs=new SongsList(titleName,movieName,singerName,imgPath,imgPath); SngList.add(i,songs); songNodeDet.add(i,nData); } Log.e("paths values",paths.toString()); // return imgNodeDet; handler.sendEmptyMessage(0); } } public void getSongs() throws MalformedURLException, XMLRPCException { String ur="http://www.gorinka.com/?q=services/xmlrpc"; URL u=new URL(ur); client = new XMLRPCClient(u); //Connecting to the website HashMap<?, ?> siteConn =(HashMap<?, ?>) client.call("system.connect"); // Getting initial sessio id String initSess=(String)siteConn.get("sessid"); //Login to the site using session id HashMap<?, ?> logInConn =(HashMap<?, ?>) client.call("user.login",initSess,"prakash","stellentsoft2009"); //Getting Login sessid logInSess=(String)logInConn.get("sessid"); websongListObject =(Object[]) client.call("nodetype.get",logInSess,""); webObjectList(websongListObject,logInSess); Log.d("webObjectList","webObjectList"); runOnUiThread(returnRes); } } Here's the Adapter associated... public class SongsAdapter extends SimpleAdapter{ static List<HashMap<String,String>> songsList; Context context; LayoutInflater inflater; public SongsAdapter(Context context,List<HashMap<String,String>> imgListWeb,int layout,String[] from,int[] to,LayoutInflater inflater) { super(context,songsList,layout,from,to); this.songsList=songsList; this.context=context; this.inflater=inflater; // TODO Auto-generated constructor stub } @Override public View getView(int postition,View convertView,ViewGroup parent)throws java.lang.OutOfMemoryError{ try { View v = ((LayoutInflater) inflater).inflate(R.layout.row,null); ImageView images=(ImageView)v.findViewById(R.id.image); TextView tvTitle=(TextView)v.findViewById(R.id.text1); TextView tvAlbum=(TextView)v.findViewById(R.id.text2); TextView tvArtist=(TextView)v.findViewById(R.id.text3); HashMap<String,String> songsHash=songsList.get(postition); String path=songsHash.get("path"); String title=songsHash.get("title"); String album=songsHash.get("album"); String artist=songsHash.get("artist"); String imgPath=path; final ImageView imageView = (ImageView) v.findViewById(R.id.image); AsyncImageLoaderv asyncImageLoader=new AsyncImageLoaderv(); Bitmap cachedImage = asyncImageLoader.loadDrawable(imgPath, new AsyncImageLoaderv.ImageCallback() { public void imageLoaded(Bitmap imageDrawable, String imageUrl) { imageView.setImageBitmap(imageDrawable); } }); imageView.setImageBitmap(cachedImage); tvTitle.setText(title); tvAlbum.setText(album); tvArtist.setText(artist); return v; } catch(Exception e){ Log.e("error",e.toString()); } return null; } public static Bitmap loadImageFromUrl(String url) { InputStream inputStream;Bitmap b; try { inputStream = (InputStream) new URL(url).getContent(); BitmapFactory.Options bpo= new BitmapFactory.Options(); bpo.inSampleSize=2; b=BitmapFactory.decodeStream(inputStream, null,bpo ); return b; } catch (IOException e) { throw new RuntimeException(e); } } } Here is what logcat is showing... 04-23 16:02:02.211: ERROR/completed(1450): completed 04-23 16:02:02.211: ERROR/paths values(1450): [] 04-23 16:02:02.211: DEBUG/*****(1450): handler 04-23 16:02:02.211: DEBUG/AndroidRuntime(1450): Shutting down VM 04-23 16:02:02.211: WARN/dalvikvm(1450): threadid=3: thread exiting with uncaught exception (group=0x4001aa28) 04-23 16:02:02.222: ERROR/AndroidRuntime(1450): Uncaught handler: thread main exiting due to uncaught exception 04-23 16:02:02.241: DEBUG/webObjectList(1450): webObjectList 04-23 16:02:02.252: ERROR/AndroidRuntime(1450): java.lang.NullPointerException 04-23 16:02:02.252: ERROR/AndroidRuntime(1450): at com.stellent.gorinka.MusicListActivity$2.handleMessage(MusicListActivity.java:81) 04-23 16:02:02.252: ERROR/AndroidRuntime(1450): at android.os.Handler.dispatchMessage(Handler.java:99) 04-23 16:02:02.252: ERROR/AndroidRuntime(1450): at android.os.Looper.loop(Looper.java:123) 04-23 16:02:02.252: ERROR/AndroidRuntime(1450): at android.app.ActivityThread.main(ActivityThread.java:4203) 04-23 16:02:02.252: ERROR/AndroidRuntime(1450): at java.lang.reflect.Method.invokeNative(Native Method) 04-23 16:02:02.252: ERROR/AndroidRuntime(1450): at java.lang.reflect.Method.invoke(Method.java:521) 04-23 16:02:02.252: ERROR/AndroidRuntime(1450): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) 04-23 16:02:02.252: ERROR/AndroidRuntime(1450): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) 04-23 16:02:02.252: ERROR/AndroidRuntime(1450): at dalvik.system.NativeStart.main(Native Method) I have declared the getter and setter methods in a seperate claa named SongsList. Plz help me determine the problem...

    Read the article

  • C# .net Deserialization I get an exception.

    - by starz26
    namespace N1 { public class InputEntry { //FieldName is a class tht is generated from an XSD which has complex type Name and value private FieldName[] name; public FieldName[] Name { get { return this.Name; } set { this.Name = value; } } } public class B { public void Method1() { InputEntry inputEntry = new InputEntry(); inputEntry.Name = "abc"; } private void Method2(InputEntry inputEntry) { System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(InputEntry)); System.IO.StringWriter inputStr = new System.IO.StringWriter(CultureInfo.InvariantCulture); serializer.Serialize(inputStr, inputEntry); string ipEntry = inputStr.ToString(); Method3(ipEntry); } private void Method3(string ipEntry) { System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(InputEntry)); System.IO.StringReader inputStr = new System.IO.StringReader(ipEntry); InputEntry inputEntry = (InputEntry)serializer.Deserialize(inputStr); } } } I get an exception when deserialising the follwing data(when a client configues data as <FieldName>PRINTLINE00</FieldName> <FieldValue>DENIAL STATE</FieldValue> ) Exception is: Message: There is an error in XML document (6, 22). String: <?xml version="1.0" encoding="utf-16"?> <InputEntry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Fields> <Field> <FieldName>PRINTLINE00</FieldName> <FieldValue>&#x1B;DENIAL STATE 217</FieldValue> </Field> </InputEntry>

    Read the article

  • Why ClassCastException on JMS ConnectionFactory lookup in JNDI?

    - by Derek Mahar
    What might be the cause of the following ClassCastException in a standalone JMS client application when it attempts to retrieve a connection factory from the JNDI provider? Exception in thread "main" java.lang.ClassCastException: javax.naming.Reference cannot be cast to javax.jms.ConnectionFactory Here is an abbreviated version of the JMS client that includes only its start() and stop() methods. The exception occurs on the first line in method start() which attempts to retrieve the connection factory from the JNDI provider, a remote LDAP server. The JMS connection factory and destination objects are on a remote JMS server. class JmsClient { private ConnectionFactory connectionFactory; private Connection connection; private Session session; private MessageConsumer consumer; private Topic topic; public void stop() throws JMSException { consumer.close(); session.close(); connection.close(); } public void start(Context context, String connectionFactoryName, String topicName) throws NamingException, JMSException { // ClassCastException occurs when retrieving connection factory. connectionFactory = (ConnectionFactory) context.lookup(connectionFactoryName); connection = connectionFactory.createConnection("username","password"); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); topic = (Topic) context.lookup(topicName); consumer = session.createConsumer(topic); connection.start(); } private static Context getInitialContext() throws NamingException, IOException { String filename = "context.properties"; Properties props = new Properties(); props.load(new FileInputStream(filename)); return new InitialContext(props); } }

    Read the article

< Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >