Search Results

Search found 13112 results on 525 pages for 'exception duck'.

Page 73/525 | < Previous Page | 69 70 71 72 73 74 75 76 77 78 79 80  | Next Page >

  • How to use SQLErrorCodeSQLExceptionTranslator and DAO class with @Repository in Spring?

    - by GuidoMB
    I'm using Spring 3.0.2 and I have a class called MovieDAO that uses JDBC to handle the db. I have set the @Repository annotations and I want to convert the SQLException to the Spring's DataAccessException I have the following example: @Repository public class JDBCCommentDAO implements CommentDAO { static JDBCCommentDAO instance; ConnectionManager connectionManager; private JDBCCommentDAO() { connectionManager = new ConnectionManager("org.postgresql.Driver", "postgres", "postgres"); } static public synchronized JDBCCommentDAO getInstance() { if (instance == null) instance = new JDBCCommentDAO(); return instance; } @Override public Collection<Comment> getComments(User user) throws DAOException { Collection<Comment> comments = new ArrayList<Comment>(); try { String query = "SELECT * FROM Comments WHERE Comments.userId = ?"; Connection conn = connectionManager.getConnection(); PreparedStatement stmt = conn.prepareStatement(query); stmt = conn.prepareStatement(query); stmt.setInt(1, user.getId()); ResultSet result = stmt.executeQuery(); while (result.next()) { Movie movie = JDBCMovieDAO.getInstance().getLightMovie(result.getInt("movie")); comments.add(new Comment(result.getString("text"), result.getInt("score"), user, result.getDate("date"), movie)); } connectionManager.closeConnection(conn); } catch (SQLException e) { e.printStackTrace(); //CONVERT TO DATAACCESSEXCEPTION } return comments; } } I Don't know how to get the Translator and I don't want to extends any Spring class, because that is why I'm using the @Repository annotation

    Read the article

  • Exception when programmatically copying content type

    - by BeraCim
    Hi all: I'm getting exceptions when copying content type from one web to another: foreach (SPContentType destinationWebCt in destinationWeb.ContentTypes) { destinationWeb.ContentTypes.Add(existingWebCt); destinationWeb.Update(); } existingWebCt is the content type from another web e.g. /Site/Web. destinationWeb is the web that I wish to copy the content type to e.g. /Site/DestinationWeb. I got the SPException that says something like could not copy content type to scope. Then I decided to replace all "ContentTypes" to "AvailableContentTypes", but then I got the SPException saying this collcetion could not be modified. So how can I copy a content type to another web? Thanks.

    Read the article

  • Is there any reason to throw a DivideByZeroException?

    - by Atomiton
    Are there any cases when it's a good idea to throw errors that can be avoided? I'm thinking specifically of the DivideByZeroException and NullReferenceException For example: double numerator = 10; double denominator = getDenominatorFromUser(); if( denominator == 0 ){ throw new DivideByZeroException("You can't divide by Zero!"); } Are there any reasons for throwing an error like this? NOTE: I'm not talking about catching these errors, but specifically in knowing if there are ever good reasons for throwing them.

    Read the article

  • Releasing NSData causes exception...

    - by badmanj
    Hi, Can someone please explain why the following code causes my app to bomb? NSData *myImage = UIImagePNGRepresentation(imageView.image); : [myImage release]; If I comment out the 'release' line, the app runs... but a few times calling the function containing this code and I get a crash - I guess caused by a memory leak. Even if I comment EVERYTHING else in the function out and just leave those two lines, when the release executes, the app crashes. I'm sure this must be a newbie "you don't know how to clean up your mess properly" kind of thing ;-) Cheers, Jamie.

    Read the article

  • Strange GWT serialization exception when overiding method of serialized object

    - by Flueras Bogdan
    Hi there! I have a GWT serializable class, lets call it Foo. Foo implements IsSerializable, has primitive and serializable members as well as other transient members and a no-arg constructor. class Foo implements IsSerializable { // transient members // primitive members public Foo() {} public void bar() {} } Also a Service which handles RPC comunication. // server code public interface MyServiceImpl { public void doStuff(Foo foo); } public interface MyServiceAsync { void doStuff(Foo foo, AsyncCallback<Void> async); } How i use this: private MyServiceAsync myService = GWT.create(MyService.class); Foo foo = new Foo(); ... AsyncCallback callback = new new AsyncCallback {...}; myService.doStuff(foo, callback); In the above case the code is running, and the onSuccess() method of callback instance gets executed. But when I override the bar() method on foo instance like this: Foo foo = new Foo() { public void bar() { //do smthng different } } AsyncCallback callback = new new AsyncCallback {...}; myService.doStuff(foo, callback); I get the GWT SerializationException. Please enlighten me, because I really don't understand why.

    Read the article

  • Iterables.find and Iterators.find - instead of throwing exception, get null

    - by mjlee
    I'm using google-collections and trying to find the first element that satisfies Predicate if not, return me 'null'. Unfortunately, Iterables.find and Iterators.find throws NoSuchElementException when no element is found. Now, I am forced to do Object found = null; if ( Iterators.any( newIterator(...) , my_predicate ) { found = Iterators.find( newIterator(...), my_predicate ) } I can surround by 'try/catch' and do the same thing but for my use-cases, I am going to encounter many cases where no-element is found. Is there a simpler way of doing this?

    Read the article

  • What causes this retainAll exception?

    - by Joren
    java.lang.UnsupportedOperationException: This operation is not supported on Query Results at org.datanucleus.store.query.AbstractQueryResult.contains(AbstractQueryResult.java:250) at java.util.AbstractCollection.retainAll(AbstractCollection.java:369) at namespace.MyServlet.doGet(MyServlet.java:101) I'm attempting to take one list I retrieved from a datastore query, and keep only the results which are also in a list I retrieved from a list of keys. Both my lists are populated as expected, but I can't seem to user retainAll on either one of them. // List<Data> listOne = new ArrayList(query.execute(theQuery)); // DatastoreService ds = DatastoreServiceFactory.getDatastoreService(); // List<Data> listTwo = new ArrayList(ds.get(keys).values()); // listOne.retainAll(listTwo);

    Read the article

  • Grails Illegel Exception

    - by Srinath
    Hi, Can any one tell me when this error occurs . I suspect this is coming when added any new js in Grails . I'm unable to dig this : 16 Apr, 2010 4:58:25 PM org.apache.catalina.loader.WebappClassLoader loadClass INFO: Illegal access: this web application instance has been stopped already. Could not load org.codehaus.groovy.grails.plugins.codecs.HTMLCodecBeanInfo. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact. java.lang.IllegalStateException thanks in advance, srinath

    Read the article

  • regexp exclusion

    - by Vlad
    Hello everyone! I have regexp to change smileys to images. Here it is (?:(?![0]:\)|:\)\)|:-\)\)))(:\)|:-\)) The point is not to change 0:) and :)) and :-)) while changing :) and :-) It works pretty well with :)) and :-)) but somehow still grabs :) in 0:) Where's my mistake?

    Read the article

  • Who interrupts my thread?

    - by Thirler
    I understand what an InterruptedException does and why it is thrown. However in my application I get it when waiting for SwingUtilities.invokeAndWait() on a thread that is only known by my application, and my application never class Thread.interrupt() on any thread, also it never passes the reference of the thread on to anyone. So my question is: Who interrupts my thread? Is there any way to tell? Is there a reason why the InterruptedException doesn't contain the name of the Thread that requests the interrupt? I read that it could be a framework or library that does this, we use the following, but I can't think of reason for them to interrupt my thread: Hibernate Spring Log4J Mysql connector

    Read the article

  • Java Mail timeout & connectiontimeout handling

    - by Gnanam
    Hi, I'm using JavaMail to send email requests to an SMTP server. I would like to set both "mail.smtp.connectiontimeout" and "mail.smtp.timeout" properties within my code. Programmatically, I want to catch both when timeout and/or connectiontimeout operations are reached in Java and handle things accordingly. Handling in the sense, I need to retry the same email once again the next time. How do I handle this in Java/JavaMail? Is it possible to catch & handle this timeout operations?

    Read the article

  • Uncaught exception while using xdebug

    - by rich97
    I'm not too great with xdebug so forgive me if this is a stupid question. But I installed it on a separate machine and it performed some magic for me like formating my var_dump() output and catching any uncaught exceptions. It also fails to format the stack traces, outputting plain text which is extremely hard to read. As I am learning the Lithium PHP Framework I am required to use php5.3, on my other machine I compiled from the source but on this machine I'm using the precompiled packages from dotdeb.org. As far as I can tell the only difference is that this is a slightly newer version of php and it comes with the Suhosin patch. The other odd thing is that the xdebug functions such as xdebug_var_dump() work, aside from poor formatting. This is an Ubuntu machine, so I don't know if it could be anything to do with the dotdep packages, but I have installed xdebug through pecl, the downloadable tarball and from the SVN repository. But to no avail. You can see my php.ini and output of php -i in the following gist. I copied php.ini from /etc/php5/apache2/php.ini over to /etc/php5/cli/php.ini so php -i should reflect my apache setup. http://gist.github.com/391675 Any help is appreciated. Rich

    Read the article

  • C# Desktop Application "Encounters an error and has to exit" on first run of the day

    - by Sreedevi J
    Hello, It seems I tend to attract strange issues. This time, I have written a C# application, and handled most of the exceptions I can find. The problem is, when I run the installed/bundled version on any PC for the first time in a day (after the PC has been shut down and started after a while) it comes across some error and has to shutdown the application (even though the try-catch block surrounding the Main() does not fire). The application does not throw the same error on subsequent runs. I added an #if(!DEBUG) ... #else ... #endif surrounding the Main() code. Can anyone help me? Thanks!

    Read the article

  • IO Exception: directory name is invalid using directory from File System Watcher OnChanged Event

    - by Bi
    My C# application throws a System.IO.IOExcepton (The directory name is invalid) for the following code for implementing a filewatcher: public void OnChanged(object source, FileSystemEventArgs e) { DirectoryInfo dList = new DirectoryInfo(e.FullPath); FileInfo[] TxtFiles = dList.GetFiles("*.TXT"); } e.FullPath is "C:/Documents and Settings/Bi/Application Data/TestApp/Reports\\0MA01P62240_000005798_TRI_4947712701738551.TXT". If you notice it seems to append a "\\" to the path when it tracks the file. Any idea what the problem may be?

    Read the article

  • how do I get only the stack trace from my app in rails?

    - by codeman73
    The default behavior seems to be printing large stack traces like ArgumentError (too few arguments): app/controllers/players_controller.rb:55:in `format' app/controllers/players_controller.rb:55:in `create' /dh/passenger/lib/phusion_passenger/rack/request_handler.rb:92:in `process_request' /dh/passenger/lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop' /dh/passenger/lib/phusion_passenger/railz/application_spawner.rb:400:in `start_request_handler' /dh/passenger/lib/phusion_passenger/railz/application_spawner.rb:351:in `handle_spawn_application' /dh/passenger/lib/phusion_passenger/utils.rb:184:in `safe_fork' /dh/passenger/lib/phusion_passenger/railz/application_spawner.rb:349:in `handle_spawn_application' /dh/passenger/lib/phusion_passenger/abstract_server.rb:352:in `__send__' /dh/passenger/lib/phusion_passenger/abstract_server.rb:352:in `main_loop' /dh/passenger/lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously' /dh/passenger/lib/phusion_passenger/abstract_server.rb:163:in `start' /dh/passenger/lib/phusion_passenger/railz/application_spawner.rb:209:in `start' /dh/passenger/lib/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application' /dh/passenger/lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add' /dh/passenger/lib/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application' /dh/passenger/lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize' /dh/passenger/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize' /dh/passenger/lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application' /dh/passenger/lib/phusion_passenger/spawn_manager.rb:154:in `spawn_application' /dh/passenger/lib/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application' /dh/passenger/lib/phusion_passenger/abstract_server.rb:352:in `__send__' /dh/passenger/lib/phusion_passenger/abstract_server.rb:352:in `main_loop' /dh/passenger/lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously' but I only want to see the stack trace from my app. In this case, it's the top 3 lines, which consist of the actual Error, and then the parts of my app. In this case I'd prefer to see this: ArgumentError (too few arguments): app/controllers/players_controller.rb:55:in `format' app/controllers/players_controller.rb:55:in `create' Is this possible?

    Read the article

  • Exceptions and Access Violations in Paint events in Windows

    - by Patrick
    After executing some new code, my C++ application started to behave strange (incorrect or incomplete screen updates, sometimes no screen updates at all). After a while we found out that the new code is causing an Access Violation. Strange enough, the application simply keeps on running (but with the incorrect screen updates). At first we thought the problem was caused by a "try-catch(...)" construction (put there by an overactive ex-colleague), but several hours later (carefully inspecting the call stacks, adding many breakpoints, ...) we found out that if there's an Access Violation in a paint event, Windows catches it, and simply continues running the application. Is this normal behavior? Is it normal that Windows catches exceptions/errors during a paint event? Is there a way to disable this? (if not, it would mean that we have to always run in the debugger with all exceptions enabled while testing our code). Patrick

    Read the article

  • How can I show SQL Server LOGS (2005)

    - by Marcin Rybacki
    Hello, I'm trying to track the error thrown by SQL Server 2005. The problem is SQL Server reports it in my native language so it's hard for me to google it. I think that the core issue would be avialable in English in SQL Server LOGS. I'm running SQL Server Management Studio Express, going to "Management" node, and then SQL Server Logs. I can see the list of logs but I cannot enter them, the only available option in context menu is Refresh. Could you help me to show the contents of those logs?

    Read the article

  • Soap Header Problem

    - by aju982007
    I have a Java Secured Webservice With Soap Header Protection Must Provide Username and Password. My Application is C# Client Application Can i call Java Secured Webservice using C# code what is the code for that ? When i connect this webservice its showing SoapHeader Element Required ..Please Give the Solution

    Read the article

  • Zero division does not throw exception in nunit

    - by Boris
    Running the following C# code through NUnit yields Test.ControllerTest.TestSanity: Expected: <System.DivideByZeroException> But was: null So either no DivideByZeroException is thrown, or NUnit does not catch it. Similar to this question, but the answers he got, do not seem to work for me. This is using NUnit 2.5.5.10112, and .NET 4.0.30319. [Test] public void TestSanity() { Assert.Throws<DivideByZeroException>(new TestDelegate(() => DivideByZero())); } private void DivideByZero() { // Parse "0" to make sure to get an error at run time, not compile time. var a = (1 / Double.Parse("0")); } Any ideas?

    Read the article

  • JSF Float Conversion

    - by Phill Sacre
    I'm using JSF 1.2 with IceFaces 1.8 in a project here. I have a page which is basically a big edit grid for a whole bunch of floating-point number fields. This is implemented with inputText fields on the page pointing at a value object with primitive float types Now, as a new requirement sees some of the fields be nullable, I wanted to change the value object to use Float objects rather than primitive types. I didn't think I'd need to do anything to the page to accomodate this. However, when I make the change I get the following error: /pages/page.xhtml @79,14 value="#{row.targetValue}": java.lang.IllegalArgumentException: argument type mismatch And /pages/page.xhtml @79,14 value="#{row.targetValue}": java.lang.IllegalArgumentException: java.lang.ClassCastException@1449aa1 The page looks like this: <ice:inputText value="#{row.targetValue}" size="4"> <f:convertNumber pattern="###.#" /> </ice:inputText> I've also tried adding in <f:convert convertId="javax.faces.Float" /> in there as well but that doesn't seem to work either! Neither does changing the value object types to Double. I'm sure I'm probably missing something really simple but I've been staring at this for a while now and no answers are immediately obvious!

    Read the article

  • REST API unauthenticated requests exception based on the User-Agent

    - by Shay Tsadok
    Hi All, I am developing a REST API that supports two kinds of authentication protocols: login form authentication - for browser based clients. Simple Basic authentication - for non-browser clients. I developed a flow in which unauthenticated requests redirected to the "login form", the problem is that this is an undesired behavior for non-borwser clients! I thought to solve it by decide according to the "User-Agent" what to do: browsers will be redirected to the "login form" and non-browser clients will get the standard 401:Basic Authentication. A. What do you think about this solution? B. Is there a standard way in Java to check if the request came from browser, or do i need to develop this kind of mechanism by my own? Thanks in advance!

    Read the article

  • Access violation exception from Delphi's Supports -> QueryInterface

    - by Sharon
    Hi, I have the following piece of code: for i := 0 to FControlList.Count - 1 do if Supports(IMyControl(FControlList[i]), IMyControlEx) then begin MyControlEx := IMyControl(FControlList[i]) as IMyControlEx; MyControlEx.DoYourMagic(Self, SomeData); end; This code is called many times during my application execution, but in some specific cases it fails inside the Supports() method. And more specifically - it seems to fall inside the QueryInterface() call within the Supports() method. I checked that FControlList is not nil and FControlList[i] is not nil and it still happens. Any idea will be appreciated!!!

    Read the article

  • Exception on malloc for a structure in C

    - by Derek
    Hi all, I have a structure defined like so: typedef struct { int n; int *n_p; void **list_pp; size_t rec_size; int n_buffs; size_t buff_size } fl_hdr_type; and in my code I Have a function for initlialization that has the following fl_hdr_type *fl_hdr; fl_hdr = malloc(sizeof(fl_hdr_type) + (buff_size_n * rec_size_n)); where those buffer size are passed in to the function to allow space for the buffers as well. The size is pretty small typically..100*50 or something like that..plenty of memory on this system to allocate it. Any ideas why this fails?

    Read the article

  • Redoundant code in exception handling

    - by Nicola Leoni
    Hi, I've a recurrent problem, I don't find an elegant solution to avoid the resource cleaning code duplication: resource allocation: try { f() } catch (...) { resource cleaning code; throw; } resource cleaning code; return rc; So, I know I can do a temporary class with cleaning up destructor, but I don't really like it because it breaks the code flow and I need to give the class the reference to the all stack vars to cleanup, the same problem with a function, and I don't figure out how does not exists an elegant solution to this recurring problem.

    Read the article

< Previous Page | 69 70 71 72 73 74 75 76 77 78 79 80  | Next Page >