Menu
  • HOME
  • TAGS

java.lang.ArrayStoreException with new JPanel

java,swing,exception,jpanel

See the API: Thrown to indicate that an attempt has been made to store the wrong type of object into an array of objects. For example, the following code generates an ArrayStoreException: Object x[] = new String[3]; x[0] = new Integer(0); To avoid this exception, define the body array as...

How to print the first line from a traceback stack

python,exception,stack-trace,traceback

The function traceback.format_exc is built primarily for this This is like print_exc(limit) but returns a string instead of printing to a file. >>> import traceback >>> try: ... x = 2/0 ... except: ... error = traceback.format_exc() ... >>> error 'Traceback (most recent call last):\n File "<stdin>", line 2, in...

C++ Have lone executable log exceptions?

c++,debugging,exception,logging

However, since the .exe is a standalone, how do I make it so it automatically creates a dump or a log of some sort if an exception happens? If your program crash it will automatically creates a core dump and you can collect core dump and analyze it. But...

Add user to LDAP using JAVA. Naming.InvalidNameException: Invalid Name

java,exception,ldap,openldap

For the attributes and the DN you need to use only the values (i.e. nowehere use the "DN:" LDIF syntax): String DN = "cn="+a.get("cn").replaceAll(" ","")+",ou=Users"+",dc=example,dc=com"; Attribute dn = new BasicAttribute("dn",DN); Attribute cn = new BasicAttribute("cn",a.get("cn")); Attribute objectClass = new BasicAttribute("objectClass", "inetOrgPerson"); ... Attributes atts = new BasicAttributes(); atts.put(dn); atts.put(cn); atts.put(objectClass);...

Try-Except block in python

python,exception

int(num) This returns an integer, but you aren't re-assigning num to this integer. You need to do num = int(num) for that line to have effect. Also note that you should just print the exception, to find out more information: try: num_int = int(num) total = total + num_int count...

Fatal Exception Main Android Null Pointer Exception

android,exception,nullpointerexception,main

The error is in this function public String getTimeZone() { return mTimeZone; } The mTimeZone variable in returning null, and so, the following code raiser an exception: TimeZone.getTimeZone(getTimeZone()) Also, in this function: private CurrentWeather getCurrentDetails(String jsonData) throws JSONException { JSONObject forecast = new JSONObject(jsonData); String timezone = forecast.getString("timezone"); Log.i(TAG, "From...

Getting InputMismatchException at runtime, but compiles fine

java,exception,runtime-error

Your issue is related to this section of your code: else if((input==2) && (input2==1)){ System.out.println("Is the angle inklsiv or exclusiv?"); String input3 = scanner.nextLine(); //input 3 for identification if the angle is inclusive or exclusive if(input3.equals("inklusiv")){ Since you are not requesting a full line here but just a token, use...

Making a layout clickable, and start an intent

java,android,xml,exception,android-intent

Do the change in your xml like below code: <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#0D47A1" android:id="@+id/mylayout"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:text="sometext"/> </RelativeLayout> And in your activity like this RelativeLayout relativeLayout; public class YourActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) {...

Android XML: RuntimeException: Failed to resolve attribute at index 6

android,xml,exception,android-studio,gradle

SOLVED: instead of ?attr/colorAccent there should be ?android:attr/colorAccent the reason can be seen here....

Android Build failed at ':app:dexDebug' with exception ( library and app project )

android,exception,gradle,build

Your app has reached a limit of the Android app methods number. You have to use Multidex (https://developer.android.com/tools/building/multidex.html#mdex-gradle)

String returned positive booleans, despite not fulfilling any [closed]

java,eclipse,exception

Change = to == in all the control flow statements. = is used for assignment and == is used for boolean comparison on integral types.

Linq to Entity - error on ICollection (code first)

c#,linq,entity-framework,exception,linq-to-entities

The "no foreign keys" rule eliminates one of the big advantages of relational databases, but you don't have to have foreign keys to join objects together in EF. However, you do need the foreign keys if you expect to use the navigation property feature of EF. You should be able...

Can C++ disambiguate the type of an exception object?

c++,exception,exception-handling

Yes, the C++ runtime will choose the appropriate catch block based on the type of the exception thrown. You can use multiple catch blocks to handle different types of exceptions try { throw E2(); } catch (E1) { std::cout << "Caught E1"; } catch (E2) { std::cout << "Caught E2";...

Java Ignoring an Exception and Continuing Loop

java,exception

Put the try/catch inside the loop: for (int i=0;i<100;i++) { try { URL url=findWebsite(); System.out.println(readURL(url)); } catch (Exception e) { } } Side note: Normally, silently ignoring exceptions is suspect, but there are some use cases....

Struts 2 add exception mapping for certain actions

java,exception,struts2,struts-config

You can use <global-exception-mappings> in struts.xml. Global exception mappings are per S2 package, so you can define different mappings for actions by putting them into separate packages. <package name="default"> ... <global-exception-mappings> <exception-mapping exception="java.lang.Exception" result="exception"/> </global-exception-mappings> ... </package> ...

All exceptions are objects in c++?

c++,object,exception

Q: "I want to ask why we call them objects, if sometimes they are not objects" Anything that occupies memory is an object. The point of object orientation is to shift the focus on to the data (object) by binding the operations the data accepts with the data itself....

Python exception for HTTP response codes

python,http,exception

The built-in Python exceptions are probably not a good fit for what you are doing. You will want to subclass the base class Exception, and throw your own custom exceptions based on each scenario you want to communicate. A good example is how the Python Requests HTTP library defines its...

I have a pdf from which I have to extract data and show but I am getting this exception, I'm not being able to figure out what is this Exception is?

java,exception,servlets,itext,pdf-reader

Finally, the problem is solved, I just added this one line of code in the beginning, before specifying the path - <% String relativePath = getServletContext().getRealPath("/"); String Source = relativePath +"Resource/text.pdf"; ... ... %> ...

exception catching for int divided by 0

c++,exception

Any integer when divided by zero is not an exception in standard C++. The section 5.6 of C++ states: If the second operand of / or % is zero, the behavior is undefined. You may also find it interesting to read this: Stroustrup says, in "The Design and Evolution of...

How do I read nothing else but a String using exceptions?

java,string,exception,letter

Simply throw an InputMismatchException if the data are not as you expected. Scanner sc = new Scanner(System.in); String answer = ""; boolean invalidInput = true; while(invalidInput){ try { answer = sc.nextLine().toUpperCase(); if (!answer.equals("A") && !answer.equals("B") && !answer.equals("C")) { throw new InputMismatchException(); } invalidInput = false; } catch (InputMismatchException e) {...

When writing a custom iterator, how can I avoid the compiler generating a Reset() method that throws an exception?

c#,exception,iterator

Nope, you can't. The assumption that the state machine can be reset does hold for your simple case, but be aware you can write iterators with side effects, and the compiler cannot assume the state machine is pure in the general case. So the safe bet is to simply disallow...

RoundingMode.UNNECESSARY throws exception

java,exception,number-formatting,bigdecimal

It's by design. See javadoc: Rounding mode to assert that the requested operation has an exact result, hence no rounding is necessary. If this rounding mode is specified on an operation that yields an inexact result, an {@code ArithmeticException} is thrown. This mode is made to specifically throw an exception...

What happens with duplicates when inserting multiple rows?

sql,postgresql,exception,duplicates,upsert

The INSERT will just insert all rows and nothing special will happen, unless you have some kind of constraint disallowing duplicate / overlapping values (PRIMARY KEY, UNIQUE, CHECK or EXCLUDE constraint) - which you did not mention in your question. But that's what you are probably worried about. Assuming a...

Error on AS3: TypeError: Error #1010: A term is undefined and has no properties

arrays,actionscript-3,exception,runtime-error

Most likely the issue is because of two things: You're splicing your array inside a loop that iterates over said array forwards. If you're going to do this, you should iterate backwards so it doesn't mess up the index. For example, let's say zombieCount has 3 elements. The first iteration...

How to check what constraint has been violated?

java,sql,postgresql,exception

something like below catch (ConstraintViolationException conEx) { if (conEx.getConstraintName().contains("xyz_fK")) { //TODO Project Entity is violating it's constrain } LOGGER.Info( "My log message", conEx.getConstraintName()); LOGGER.ERROR( "My log message", conEx); ...

Java ArrayIndexOutOfBound

java,arrays,exception,indexoutofboundsexception

if(c >= Playerlist.length) { c = 0; } else { c++; //ARRAY_INDEX_OUT_OF_BOUNDS ERROR !!!!!!!!!!!!!!!!!!!! while(wuerfelsummen[c] == null) You are first checking if c is at most the last index of the array, and afterwards increment it by 1, possibly pushing it over that limit....

Why does TestNG allow several expected exceptions?

java,unit-testing,exception,testng

Why does TestNG allow several expected exceptions? I think that the most likely reason is that people asked for the feature ... and it is a reasonable thing to provide. I can think of a few use-cases. It may be needed when writing tests for code that is non-deterministic,...

std::ostream to QString?

c++,qt,exception

You can use an std::stringstream as follows: std::stringstream out; // ^^^^^^ out << "Error in void Cat::eat(const Bird &bird): bird " << bird << " has negative weight" << std::endl; throw(QString::fromStdString(out.str())); // ^^^^^^^^^^^^^^^^^^^^^^^^^^ Specifically, the std::stringstream::str member function will get you an std::string, which you can then pass to the...

Replace backslash in string

java,regex,string,exception,replace

Use four backslashes to match a single backslash character. String texter = texthb.replaceAll("\\\\.+?\\\\", "\\\\"+String.valueOf(pertotal + initper)+"\\\\"); ...

Global Exception Handling in play framework java 2.3.7

java,exception,playframework

I had the same issue. Somehow the logging happens independent of the onError() method in Global. I solved this with Action composition. public class VerboseAction extends play.mvc.Action.Simple { public F.Promise<Result> call(Http.Context ctx) throws Throwable { Promise<Result> call; try { call = delegate.call(ctx); } catch (Exception e) { Logger.error("Exception during call...

SimpleMembershipProvider WebSecurity.InitializeDatabaseConnection The login from an untrusted domain

asp.net,database,exception,model-view-controller

I think that you are providing in your connection string UserName and password, so you can change from Integrated Security=True to Integrated Security=False and if the user 'DB_9CB321_Szklarnia_admin' has rights to connect it will work. When Integrated Security=True the userID and password will be ignored and attempt will be made...

_controlfp does not prevent DivideByZeroException

c#,exception,dllimport,divide-by-zero,floating-point-exceptions

int a = 0; var b = 5/a; You are performing integer arithmetic here and so masking floating point exceptions has no effect on this expression. ...

Hashing String (SHA-256) in an ActionListener class

java,exception,event-listener,checked-exceptions

You know in advance that MessageDigest.getInstance("SHA-256") and key.getBytes("UTF-8") will succeed, so the best solution is to wrap a try-catch around the impossible checked exceptions: try { MessageDigest digest = MessageDigest.getInstance("SHA-256"); byte[] hash = digest.digest(key.getBytes("UTF-8")); BigInteger HashValue = new BigInteger(javax.xml.bind.DatatypeConverter.printHexBinary(hash).toLowerCase(), 16); String HashValueString = HashValue.toString(); // ... The rest of your...

How to catch an exception and continue without stopping

python,exception

You can try the unicode_errors='ignore' option msgpack.loads(data, unicode_errors='ignore') ...

Exception when attempting to modify Dictionary

c#,exception,dictionary

you can not modify an IEnumerable while you are enumerating over it. you can do a simple hack and get a copy of what you are enumerating so changes in it does not result in System.InvalidOperationException. for example instead of foreach( Guid id in threads.Keys) use foreach( Guid id in...

BufferedWriter closed throws exception

java,android,exception,bufferedwriter

Closing out causes all underlying streams and writers to be closed as well, so the calls to: fw.flush(); fw.close(); are redundant after out.close() has been called because at that point fw is already closed. This leads to the second problem, which is calling fw.flush() when fw is already closed... calling...

Throwable constructors

java,exception,constructor,throwable

Because ArithmeticException is a unchecked exceptions and from RuntimeException RuntimeException and its subclasses are unchecked exceptions. Unchecked exceptions do not need to be declared in a method or constructor's throws clause if they can be thrown by the execution of the method or constructor and propagate outside the method or...

Any way to catch an exception occurring on a thread I don't own?

c#,multithreading,exception

The thing worrying me most in the described case is abnormal thread termination inside that 3rd-party lib. Once a thread is throwing, you can't catch the exception via correct way because you're not the owner of that thread invocation (and it has no idea it should propagate the exception to...

C - Windows Exception Handler Invalid Handle

c,windows,winapi,exception,exception-handling

The __except block is never entered because ReadFile does not throw exceptions. Remember that the Windows API is agnostic of programming language and needs to present an interface that can be consumed by any programming language. And not all languages have support for exceptions, and even those that do use...

Throwing an exception in constructor (java)

java,exception,constructor

Where you call your method Utwor, you have to put it in a try catch block. boolean zIsOk = false; do{ try{ Utwor(x, y, z); zIsOk = true; } catch(IllegalArgumentException e){ zIsOk = false; } while(!zIsOk) Maybe it's not the best answer, but it works :) If you have to...

Unauthorised access to folders when creating xml file

c#,xml,wpf,exception,unauthorizedaccessexcepti

The solution I found for this issue was to create a folder inside the target directory set by the user with the following code: DirectoryInfo info = Directory.CreateDirectory(myPath); Then, set the program to create the xml file inside that newly created folder....

A single exception handler for multiple possible exceptions

c#,exception

Maybe if (myDataTable != null && myDataTable.Rows.Count > 0) { myRow = myDataTable.Rows[0]; } else { throw new Exception("Problem obtaining data"); } You don't need to nest the if statements...

C# console application - Unhandled exception while finding the Available and free Ram space.Getting exact answer in windows forms application

c#,exception,memory,ram,unhandled

Now that you've added all your code, your error is in this line: Console.WriteLine("{0}\n{1}\n{2}\n{3}\n{4}\n{5}\n",drivename,drivetype,driveformat,max_space,Available_space); You have 6 parameters, and only fill 5 of them. Each parameter must have a corresponding value(0-based index for 5 values is 0-4). See String.format and Console.WriteLine in MSDN for more info. So that line should...

Exception error using C++ Thread Pool Library (CTPL)

c++,multithreading,exception,visual-studio-2013,threadpool

file ctpl_stl.h is fixed on the project web site. Try the new version (0.0.2) instead of the old one. It should work, it works for me. ctpl_stl.h was created as a modification of ctpl.h for convenience for the users who do not want to have dependancy on BOOST lockfree library....

Exception handler in Node.js

javascript,node.js,exception,exception-handling

JavaScript try/catch statement will not work in this case cause this operation performs asynchronously: client.post("http://WrongEndPoint", [], function (data, response) { console.log("data:", data, "response:", response.statusCode); }); To catch it you should use approach like this client.post("http://WrongEndPoint", [], function (data, response) { console.log("data:", data, "response:", response.statusCode); }).on('error', function(err){ console.log(err); }); But I'm...

Why Eclipse Debugger does not stop on scoped exception breakpoint (how to stop on handled exception)

java,eclipse,debugging,exception

After debugging Eclipse I understood that "scope" filters should match throwing location (in this case java.math.BigDecimal) and not the catch location. This is the original JVM debugger filtering on "scope", however JVM limits filter to one item (class or package), while Eclipse can process multiple items. The code that does...

Does throwing an Exception have side effects beyond just constructing the exception?

c#,exception

When an exception is thrown, the stack trace is "inserted" into the exception (that is what you can get through the StackTrace property). So yes, there is a side-effect in throwing an exception object. A problem of rethrowing an exception (even with throw; is that the stack trace is mangled...

Cannot access closed file during Reading/Writing operation - C#

c#,exception,binaryreader,binarywriter

What is causing the file to be closed at this point? Your call to R.Close() in writeDGVrowListToBinaryFile. You shouldn't be closing the writer in that method. You almost never want to close a file handle (or other disposable resource) which is passed into a method - typically you acquire...

Java ArrayIndexOutOfBounds

java,exception,indexoutofboundsexception

for(int i=0; i<=zahlen.length; i++) This is incorrect, as arrays are 0-indexed, meaning they reach from 0 to length-1. Change it to for(int i=0; i<zahlen.length; i++) Interestingly enough, your other loops avoid this pitfall, although you will still have to be careful about the j+1 later on. Make sure that this...

Exception calling “ExecuteNonQuery”

sql-server,powershell,exception

You are querying for the untrimmed group name, but when you insert, you call REPLACE() to trim "My Company" off $group. You should instead trim the $group first, then query and insert without calling REPLACE().

CInvalidArgumentException when checking class in PreTranslateMessage

c++,exception,visual-c++,mfc

CWnd::GetFocus returns a pointer to the window that has the current focus, or NULL if there is no focus window. pControl = this->GetFocus(); if ( pControl != NULL ) { if(!(pControl->IsKindOf(RUNTIME_CLASS(CEdit)))) ... } Another way is to compare pControl value with pointer to CEdit class member (or members) of the...

AuthenticationException LDAP using plain Java

java,authentication,exception,active-directory,ldap

So .. i did some further investigations and got some new details. It all has to do with the "Modes of Authenticating to LDAP". My client (maybe Apache Directory Studio or Websphere Application Server too) uses the simple Auth-Mode. environment.put( Context.SECURITY_AUTHENTICATION, "simple" ); If I change this to a more...

Repeating error message inside a while loop

java,loops,exception,exception-handling

A whitespace is actually considered a character, so the check of (length == 0) doesn't work for your purposes. Although the following code below is incomplete (ex: handles the potentially undesirable case of firstname=" foo", (see function .contains()), it does what the original post asks - when the user enters...

Spring JavaFX @Transactional entitymanager is closed

spring,exception,javafx,transactions,transactional

By reading logs, i've understood what's happened. A thread was closing the applicationContext, and implicitely all singletons beans including the entityManagerFactory ! The entityManagerFactory can only be open once per PersistenceUnit lifecycle. When the Transaction try to open an entityManager with a closed factory, it throw an exception....

Java 5 Multi threading, catch thread exceptions

java,multithreading,exception,concurrency,java-5

The most common approach is to submit a Callable to an Executor, and receive a Future. You can then call Future.get to find out if any exceptions were thrown. As for UncaughtExceptionHandler, you can only really use it with raw threads because Executors handle uncaught exceptions internally (thus you don't...

Throw Ignorable Exception

c#,exception

There are two ways to handle what you want to do: don't throw an exception. Instead just return without incurring any side effects. Of course this might not be possible to do, depending on what the purpose of your method is. throw the exception but also make it clear in...

Display a specific template when Django raises an exception

python,django,exception,django-templates

Most likely such errors will return HTTP 500 server error. In django you can write your own custom view to handle such cases and return your own page with the html that you like. The 500 (server error) view explains writing server error views. There are more types of errors...

FileNotFoundException EACCES (Permission Denied)

android,file,exception,filenotfoundexception

Android is case sensitive. Replace ANDROID.PERMISSION with android.permission: <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> Also, you should only need one of those permissions. If you are planning on writing to external storage, you should not also need READ_EXTERNAL_STORAGE....

Changing text of a TextView throws NullPointer Exception

java,android,exception,textview

The content is not set into the view, the findviewByid will return NULL if you do it BEFORE setContentView. move setContentView BEFORE findviewByid and it will work....

Proper use of custom exceptions

c#,exception,exception-handling

You should use custom exceptions in very few cases. Your first filter should be "Am I going to catch (MyCustomExc x) anywhere at all?" If the answer is "no" you don't need a custom one. The answer may be a bit trickier depending on how you log things, your catch...

How can I extract ALL the information of the JavaScript native exception?

javascript,exception,exception-handling

I would like to understand what is the real nature of the JavaScript exceptions (are they objects? why they look so different in the console?) Javascript exceptions are regular javascript objects. You can see the object definition here and why can't I loop though it with a for...in block...

Why is eclipse complaining when I try to close BufferedReader in finally block?

java,eclipse,exception,bufferedreader,try-catch-finally

Both code examples should have compiler errors complaining about an unhandled IOException. Eclipse shows these as errors in both code examples for me. The reason is that the close method throws an IOException, a checked exception, when called in the finally block, which is outside a try block. The fix...

How to get raw Exception Message without HTML in Laravel?

php,ajax,exception,laravel

In Laravel 5 you can catch exceptions by editing the render method in app/Exceptions/Handler.php. If you want to catch exceptions for all AJAX requests you can do this: public function render($request, Exception $e) { if ($request->ajax()) { return response()->json(['message' => $e->getMessage()]); } return parent::render($request, $e); } This will be applied...

Class with long name

java,android,exception,naming-conventions

If you are using PrimaryExternalStorage pretty often in your program, it seems ok to introduce (and document) an abbreviation like PES and use PESIsNotReadyToWriteException, WriteToPESPermissionException (or PesIsNotReadyToWriteException, WriteToPesPermissionException depending on your policy of using abbreviations in camelCased identifiers). Note that Is in your first exception is definitely redundant. See, for...

errors not being thrown after promise

javascript,exception,promise

The short answer is because you have neglected to include your error handler. Promises always require both success and error handling functions. This is a fundamental (and generally good) aspect of promises. Inside a promise handler (success or error), any thrown errors do not hit the window. Instead, the promise...

Java Error unreported exception IOException; must be caught or declared to be thrown

java,exception,ping

Your pingIp function throws exception, so when you call it in main you have to either handle the exception there, or throw the exceptions from main. In java you cant have unhandled exceptions. so you could do it like this: public static void main(String args[]) throws IOException, InterruptedException { pingIP("127.0.0.1");...

Program throws Stack Overflow Error

java,exception,stack-overflow

You have a field initialization code which is automatically added to the constructor body by javac compiler. Effectively your constructor looks like this: private Reluctant internalInstance; public Reluctant() throws Exception { internalInstance = new Reluctant(); throw new Exception("I’m not coming out"); } So it calls itself recursively....

java.util.NoSuchElementException when using Scanner.next()

java,exception,java.util.scanner

I think you meant to close in your finally. finally{ //finally begins input.next(); } should (almost certainly) be finally{ input.close(); } Or you could use try-with-resources to close your Scanner like public void populateData(String dataFile) { try { URL url = getClass().getResource(dataFile); File file = new File(url.toURI()); try (Scanner input...

how exception finds correct catch block

java,exception

If by "implemented" you mean "what is the bytecode generated for this", that part is of course covered by the language specification, and there is a good article about it. Basically, every code segment (method) can have an associated exception table. In this table, you have an entry for every...

Custom exception handling

c#,exception,windows-phone-8

If you set BackPressedEventArgs (e) parameter's Handled property to True , you will block the OS action on this event you can trigger your custom exception. When you set this property to true OS will stop to navigate back.However , you shouldn't prevent user from terminating your app.Otherwise your app...

signal() : any performance impact?

c++,c,exception,signals,sigsegv

If your time critical process catches signals, there is no "special" time wasting. Indeed, the kernel holds a table of signals and actions for your process which it has to walk through if a signal was send. But every way of sending a message to a process or invoking a...

Exception in async task gets intercepted in Visual Studio

c#,visual-studio,exception,asynchronous

Why does the debugger stop even though the exception is inside a try/catch? Technically, the code is throwing an exception that is not caught by any of your code on the current call stack. It's caught by the (compiler-generated) async state machine and placed on the returned task. Later,...

Java Threads with ConcurrentModificationException

java,multithreading,exception,arraylist,concurrentmodification

I was able to replicate the issue and fix it using Java implementation of a concurrent list CopyOnWriteArrayList Here's my main class public class PrimeRunnableMain { public static void main(String[] args) { PrimeRunnable.setUpperBorder(10); PrimeRunnable primeRunnable1 = new PrimeRunnable(); PrimeRunnable primeRunnable2 = new PrimeRunnable(); PrimeRunnable primeRunnable3 = new PrimeRunnable(); PrimeRunnable primeRunnable4...

May I modify the value of an exception inside a std::exception_ptr?

c++,exception,c++11,exception-handling

Your code is conforming and portable. But there be dragons here: If you obtain your exception_ptr via current_exception(), it is unspecified whether you get a reference to a copy of the current exception, or a reference to the current exception itself. Even if you call current_exception() twice in a row,...

What's the benefit of exceptions specification in Java?

java,c++,exception,specifications

You have to specify only checked exceptions (subclasses of the Exception class) in the method signature. Unchecked exceptions (subclasses of the RuntimeException class) don't need to be specified. Specifying exceptions in method signature is an inherent Java practice defined by the language semantics. But there is also much controversy about...

Exception not caught in try catch block

c++,exception

You're throwing a const char*. std::exception only catches std::exception and all derived classes of it. So in order to catch your throw, you should throw std::runtime_error("TEST THROW") instead. Or std::logic_error("TEST THROW"); whatever fits better. The derived classes of std::exception are listed here.

Exception thrown by 'stol' using Visual Studio but not gcc

c++,c++11,exception,visual-studio-2013,gcc4.9

Under Windows the type long is always 32-bits. Since long is a signed integer type this means that the range of long is between -2147483648 and 2147483647 inclusive. On Linux the size of long depends on whether you're compiling for 32-bits or 64-bits. Since std:stol converts a string to long...

Laravel 5 Customexception

php,exception,laravel-5

If you take a look at the render method annotations. /** * Render an exception into a response. * * @param \Illuminate\Http\Request $request * @param \Exception $e * @return \Illuminate\Http\Response */ You'll see that you have to return a \Illuminate\Htttp\Response. I made my own exception too, I handle my new...

Mule - Throw Exception with until-successful

java,exception,soap,exception-handling,mule

With the partial information you have provided, all I can say is that the source of the problem is located in: <spring-object bean="testIntegration" /> based on: Component that caused exception is: DefaultJavaComponent{Flow_test.component.1805940825} The main issue is that Mule can't locate a method to call on your custom component: there are...

Laravel MethodNotAllowedHttpException

php,forms,exception,laravel,request

It looks to me your problem is the url in our routes. You are repeating them. Firstly I would recommend using named routes as it will give you a bit more definition between routes. I'd change your routes to Route::put('jurors/submit',[ 'as' => 'jurors.submit', 'uses' => '[email protected]' ]); Route::get('jurors',[ 'as' =>...

Java: unhandled exception

java,eclipse,exception,exception-handling,try-catch

The issue is caused by the lambda function. The interface of the function that forEach requires doesn't declare any kind of checked exceptions: take a look at java.util.function.Consumer. That's the place where the first issue occurs, the second one is simply a result of the first one. Either you should...

throws x extends Exception method signature

java,exception,generics

Treat it like any other generic code you've read. Here's the formal signature from what I see in Java 8's source code: public <X extends Throwable> T orElseThrow(Supplier<? extends X> exceptionSupplier) throws X X has an upper bound of Throwable. This will be important later on. We return a type...

Error: Integers added together in successive uses of scanner class

java,exception,java.util.scanner

When you enter "2 3" (Two integers with a space between them) the scanner.nextInt() will pull in the 2 and leave the 3 still in the scanner. Now, when the next nextInt() is called it will pull in the 3 that was left without the user having to enter anymore...

How to instrument the byte code to tell when a catch clause is being executed?

java,exception,bytecode

There are two approaches, both require knowledge of how to manipulate Java Byte codes. Tools such as ASM exist for making manipulating byte codes a little easier. One would then wire in a Java Agent or write a custom class loader that modified the class bytes as they were loaded...

Exception message best practices when aligning messages

c#,.net,exception

Use first approach. Your exception should encapsulate building error message. Via constructor exception should recieve only context specific information from outside world.If your exception receive full error message via constructor, then client can create an instance of your exception as follows: class InvalidEmailException : Exception { public InvalidEmailException(string message) :...

android - No Activity found to handle intent action.VIEW

android,exception,android-intent,android-fragments,textview

This occur when user clicks URL in text In this case, the URL is malformed: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=href (has extras) } The URL is href. That is not a valid URL. Here is the part where I do TextView html settings: That...

C# array out of bounds exception error

c#,arrays,exception

Since you're debugging this in VS, set a breakpoint on "string file = File.ReadAllText(args[0]);" and you'll probably see that args has no length or is null. If this is so, then in the project settings => debug section, there is a command line arguments box that you can set a...

Handle unexpected exceptions that silently kill a thread

java,exception,exception-handling

I want to surround the operation with a try/catch block to find out what is going on without killing the thread. quick answer: you can't save the thread. once an exception is thrown, the most you can get as an outsider is the stack trace. The wrapping with runInternal...

Retry on database exception using php

php,exception,mysqli

It must have something to do with browser rendering while using ob_start and ob_flush under certain conditions. I noticed when i set php header("Content-Encoding: none") to disable gzip compression: UPDATE - added an example <?php header("Content-Encoding: none"); ob_end_clean(); ob_start(); for($i=0;$i<5;$i++) { echo 'No. '.$i."<br>"; ob_flush(); flush(); sleep(2); } ?> it...

Method name expected

c#,arrays,exception

This isn't how you construct an array; new Dictionary<string, int>[2]() You don't need the () at all - you're not calling a method or a constructor; you're creating an array instance. Just: new Dictionary<string, int>[2] You'll need to populate the array as well, of course, e.g. udemy[0] = new Dictionary<string,...