1. IllegalArgumentException or NullPointerException for a null parameter? stackoverflow.comI have a simple setter method for a Java property and null is not appropriate for this particular property. I have always been torn, in this situation: should I throw ... |
2. Possible causes of Java VM EXCEPTION_ACCESS_VIOLATION? stackoverflow.comWhen a Java VM crashes with an EXCEPTION_ACCESS_VIOLATION and produces an hs_err_pidXXX.log file, what does that indicate? The error itself is basically a null pointer exception. Is it always caused by ... |
3. Why String.indexOf do not use exception but return -1 when substring not found? stackoverflow.comWhy String.indexOf do not use exception but return -1 when substring not found? The purpose of this question is: when we start custom exception. I believe avoid the need to return special error ... |
4. Seeking explanation for Auto-Casting stackoverflow.comSo I just spent around an hour trying to unveil and resolve a very strange bug, one that I have never seen before. I am more or less asking for potential causes ... |
5. Getting full string stack trace including inner exception stackoverflow.comJava's e.printStackTrace() doesn't print all the details of the inner exception's stack trace. Is there a ready way to generate the complete stack trace in string form? (besides formatting it myself) Edit I just ... |
6. Java Class with string and a specified length stackoverflow.comI'm creating a java program that creates a file and fills it with data in string form with each field in the record limited to a specific length. What I think I ... |
7. Is returning null after exception is caught bad design stackoverflow.comI always come across the same problem that when an exception is caught in a function that has a non-void return value I don't know what to return. The following code ... |
8. java api design - NULL or Exception stackoverflow.comIs it better to return a null value or throw an exception from an API method? Returning a null requires ugly null checks all over, and cause a major quality problem if ... |
9. What is better to use for Exception output message dynamic generation String or StringBuilder or StringBuffer? stackoverflow.comWhat is better to use for Exception output message dynamic generation String or StringBuilder or StringBuffer? |
10. Java - JSON Null Exception stackoverflow.comI'm using JSON to deserialize an input string that contains a |
11. Throwing exception vs returning null value with switch statement stackoverflow.comSo I have function that formats a date to coerce to given enum DateType{CURRENT, START, END} what would be the best way to handling return value with cases that use switch ... |
12. Is it possible to call the main(String[] args) after catching an exception? stackoverflow.comI'm working on a Serpinski triangle program that asks the user for the levels of triangles to draw. In the interests of idiot-proofing my program, I put this in:
|
13. java.lang.NullPointerException stackoverflow.comI do a condition with a value when it is null and when it is not null.
The time where this value is null i got the |
14. Set reference = null in finally block? stackoverflow.comA colleague of mine sets reference to
|
15. Null check error message as "is null" or "was null" stackoverflow.comWhen doing null checks in Java code, and you throw IllegalArgumentExceptions for null values, what kind of message template do you use? We tend to use something like this
|
16. Java: check for null or allow exception handling stackoverflow.comI'm wondering about the cost of using a try/exception to handle nulls compared to using an if statement to check for nulls first. To provide more information. There's a > 50% chance ... |
17. Catching some exceptions but ignoring others - why doesn't this work? stackoverflow.comI have something similar to this.
|
18. Exception JNI (Ljava/lang/String;)Ljava/lang/String; stackoverflow.comI have made a little program in java that accepts a string as a user input. Now i have made a dll writing its code in Visual C++. when i run ... |
19. Shall I design the following API using null returned value, or checked exception, or possible null object pattern stackoverflow.comI come to an API |
20. Java- String index out of bounds exception " String index out of Range" stackoverflow.comI am new to java, and going to bite the bullet by asking what is I am sure, a dumb question. I created some methods, and simply wanted to call them ... |
21. Java newbie having problem with null point exception stackoverflow.comTrying to use StackLL method size() is returning a null pointer error. I cannot figure out why this is, as count is initialized to 0. My only guess is that I ... |
22. Java null pointer exceptions - don't understand why stackoverflow.comRun time error on main method in MovieList.java. I'm not sure my program design is fundamentally very good, but I'd like to know why it crashes. Thanks in advance.
|
23. Why do exception fault Strings differ on different environments? stackoverflow.comI have this snippet of code to deal with catching particular exceptions
|
24. Freemarker null exception even though checking for it first stackoverflow.comI have the following code:
It is supposed to protect from the situation in which dueDate is null but I still get the exception: Expression task.dueDate is undefined
Any ... |
25. Java Null Pointer stackoverflow.comDoes anyone know why I am getting a null pointer error when I call the getResultSet() method from MyServ2 class here is my DBClass (imports etc omitted)
|
26. Is NULL arguments a bad practice? stackoverflow.comIs it a bad practice to pass NULL argument to methods or in other words should we have method definitions which allow NULL argument as valid argument. Suppose i want two method 1. ... |
27. Return null or throw exception one more time stackoverflow.comI've already looked for the answer for this question, and I've found the following suggestions:
|
28. exception execution data flow, why is my object is null when exception thrown? stackoverflow.comI'm not sure of why this is happening, but I have a simple setup where a caller's return value is null. I call a function which might throw registered exceptions. When it ... |
29. Is Java UTF-8 Charset exception possible? stackoverflow.comCan Java possibly throw |
30. String index out of range: -1 stackoverflow.comI have a similar problem.This is a snippet of my source:
|
31. stackoverflow exception while using String match in java stackoverflow.comFor a little university project i'm doing, i need to extract code samples from html given as a string. To by more precise, i need to get from that html string, everything ... |
32. Count lexemes - string out of bounds exception stackoverflow.comI have a small program that is suppose to count lexemes. What I get is an erorr. I am fairly new to Java. Here is the error:
|
33. Json String can't decode using json-simple toolkit java stackoverflow.comJSON-Simple JSON-Simple Example
This throw a exception
Exception in thread "main" java.lang.ClassCastException: org.json.simple.JSONObject cannot be cast ... |
34. Substring with the loop stackoverflow.comIn below code I am trying to do substring based on start and end index,But in end of the string.System is throwing |
35. convert ExceptionDescribe to string stackoverflow.comI need to get the output of ExceptionDescribe() in JNI as string so I can write it afterwards in a file instead of writing it directly on command line. Is there ... |
36. Java - "String index out of range" exception stackoverflow.comI wrote this little function just for practice, but an exception ("String index out of range: 29") is thrown and I don't know why... (I know this isn't the best way to ... |
37. Why does Throwable.getMessage() occasionally return null? stackoverflow.comI have a method that sometimes throws an exception:
And I have a unit test that asserts that the exception that ought to be thrown is actually thrown:
|
38. CtClass.toClass throws an exception with message 'null' stackoverflow.comSteps i perform to create dynamic class is as follows:
|
39. String Index Out Of Bounds Exception stackoverflow.comI am really stuck on this exception
|
40. Simple exercice with exceptions in java stackoverflow.comHere's the problem to solve: a method of a class that represents a gas network. This class manages objects of type |
41. String.format using a exception.getMessage() as a format stackoverflow.comI have a question related to String.format in JAVA. My HibernateDao Class is responsible for persisting entities and will throw an exception in case I have any constrain violation. The message contains ... |
42. How would I go about fixing a NullPointerException of the following code? stackoverflow.comI have this code and when I run the script, I pass in valid parameters, but I keep on getting a NPE. Help? Code:
|
43. Null Pointer Exception after checking with 'if' statement stackoverflow.comI'm getting a really annoying error, saying I'm getting a null pointer exception but there's an if statement to check to see if the text is null before proceeding:
|
44. Why am i getting a String out of bounds exception stackoverflow.comI have the following code that reads in data from a file and stores it in a String variable, now when i run it, it gives me a string out of ... |
45. why do i get a nullpointerexception while getting an excel cell stackoverflow.comi'm getting this exception while getting a cell. This is what i'm doing:
|
46. Java, Parse JSON Objects that I know are null stackoverflow.comI have an array of JSON objects. To parse these arrays and store the simply data type values, I have to make assumptions of the key names and store them accordingly. I ... |
47. How to catch the exception caused by an absence of an object in Java? stackoverflow.comI have a very simple method:
The problem is that it can happens that game object or gameWindow do not exist. I do not ... |
48. Exception.getMessage() is null stackoverflow.comInside my Java code, it is checking for
|
49. Corba exceptions any String length limits? coderanch.comI am in the early feasability phase of looking at use cases for a Corba client written in Java which will need to occasionally catch exceptions generated by the server implementation which may contain quite verbose summaries of the failure which occurred (basically a report). One way of tackling this might be to have the client set a state which requires ... |
50. Slew of null pointer exceptions. coderanch.comBeen prototyping an Alice - looking glass class, no Phd in cs or anything like that. Program intent is to look through files for unauthorized use of email in business environments, printing out: badWord : lineNumber : fileName : the actual line in the file where found. I got enough of the program working that I got word frequencies in a ... |
51. Pattern ReplaceAll issue (Illegal Group exception) coderanch.comI believe Matcher.quoteReplacement() is for escaping the replacement string (the second argument in replaceAll()). To escape the target string (the first argument), use Pattern.quote() instead. Or you can use the new replace(CharSequence, CharSequence) in String, which treats both arguments literally (I think). Ugh. It's nice that they finally provided these methods, but putting them arbitrarily in different classes like that -ugh. ... |
52. Exception Null coderanch.comException Null (Java in General forum at JavaRanch) A friendly place for programming greenhorns! Register / Login Java Forums Java Java in General Exception Null Post by: rahul soni, Greenhorn on Oct 15, 2005 07:08:00 import java.sql.*; import javax.sql.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; import javax.crypto.Cipher; import java.security.Key; import javax.crypto.KeyGenerator; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; import java.security.InvalidKeyException; public class ... |
53. ways to deal with null poingt exceptions coderanch.comI'm doing a program for class. getting an average from acollection. We are using test Junits. one of the test involves null enteret into the collection. this causes a nullpointexception. I tried to use the try/catch thing to catch the null so it dosent crash the program but it dosen't work. Is there any way to deal with this thing so ... |
54. Grid Alignment and Null Exception coderanch.comHi Experts: I am working on a Minesweeper program, in a 3x3 grid. I have two major problems. First, I get a "java.lang.NullPointerException" at the statement "myApp.getPoint(e.getX(), e.getY());". I don't know why. Second, I have trouble getting my grid to divide up evenly. I have set up a Demension of 300x300 (html: |
55. String.equals() throws null exception coderanch.comHello, I try to compare 2 strings, but when they are different, I get a nullpointer exception: Here is the method: try { query = "select * from BLEQUEUX.REGISTRATION where RG_REG_ID = "+regId; rs = dbMgr.executeQuery(query); while (ok && rs.next()) { String frame = rs.getString("RG_VEHICLE_FRAME"); String plaat = rs.getString("RG_VEHICLE_PLATE"); System.out.println("Frame "+frame+" == "+frameNo+" Plate "+plaat+" == "+plateNo+" ."); if (frame.equals(frameNo)) { ... |
56. Passing string to exception coderanch.comThe code to create an exception is correct. While you might want to construct an exception within a catch block, normally the main reason is to construct an exception of a different type, and rethrow it instead. For example: try { // ... } catch (NumberFormatException e) { throw new ApplicationSpecificException(e.getMessage()); } If you're using 1.4 or later, a better solution ... |
57. Exception using split() method in java.lang.String coderanch.com |
58. Null'Pointer'Exception... coderanch.comReferences are really pointers to objects. But where a pointer can be directly manipulated (the dreaded pointer arithmetics in C), references cannot. Because of that no special syntax is needed to dereference them, the runtime environment/compiler/JVM understands that a call to the reference means to address the memory structure in the memory space referenced by the reference and not the raw ... |
59. Substring Exception coderanch.comYour arguments for the substring function are the last index of "/" and the length of the string (note: you can omit this one; if you only pass one argument, the remainder of the string is returned). Now, if the "/" cannot be found, lastIndexOf returns -1. Now here's a question for you: where in your string is the "/"? Basically, ... |
60. String index out of range exception coderanch.com |
61. String index out of range exception coderanch.comHello All, thanks for your helpful tips. I once again stumbled upon this index out of range exception. int[] encodeModulo; vob = new int[2]; String test = "Long string";// Length is 60 int q = 0; int j = pinCode.length(); int k = shortKey.length(); // length of shortKey is 60 int s1,s2,s3; StringBuffer cpt = new StringBuffer(); for(int i =0; i< ... |
62. Can getMessage() method of Exception class return Null? coderanch.com |
63. String Index Out Of Bounds Exception coderanch.comI'm really confused. I'm trying to read a matrices from a text file, and I keep getting errors. The error always comes out in the last line of that for loop with the charAt(z) part. The error says: java.lang.StringIndexOutOfBoundsException: String index out of range: 0. I want to read each individual character in each row. Notes: I've already read the column ... |
64. ReplaceAll function - Index out of bounds exception coderanch.com2010-07-14 13:31:28,363 [TP-Processor3] ERROR com.scb.conflict.email.service.impl.EmailComposer. - java.lang.IndexOutOfBoundsException: No group 5 at java.util.regex.Matcher.group(Matcher.java:463) at java.util.regex.Matcher.appendReplacement(Matcher.java:730) at java.util.regex.Matcher.replaceAll(Matcher.java:806) at java.lang.String.replaceAll(String.java:2000) at com.scb.conflict.email.service.impl.EmailComposer.composePADSStatusChangeToApprovedEmail(EmailComposer.java:2333) at com.scb.conflict.common.service.impl.AuditTrailServiceImpl.retrieveStatusChangeEmail(AuditTrailServiceImpl.java:796) at com.scb.conflict.conflictsearch.action.ConflictSearchAction.updateConflictSearch(ConflictSearchAction.java:2204) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229) at com.scb.conflict.commo Also this is the getter function private String getStringValue(String str) { if (str != null) { return str.trim(); } else ... |
65. Run-time exception from type-casting coderanch.comIt's simple. If the object returned is truely an object that is that type, the type cast will succeed. However, in your example, I am very sure that the Thread object returned is *not* your class type -- as your class type is not a Thread class type. Hence, it is not possible for you to use it to start a ... |
66. Exception while decrypting the string coderanch.comHi, here are routines i have written for encryption and decryption of string using key k, its giving me execption as javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipherdrd please help me out, to find error. thanks in advance. public static String chat_encrypt(String in,BigInteger k) { try { // Security.addProvider(new BouncyCastleProvider()); DHPrivateKeySpec d=new DHPrivateKeySpec(k,pg.p,new BigInteger("2")); DHPublicKeySpec ... |
67. String input with exceptions coderanch.comsorry about the name. anyway. here is what i have so far. public String inputName() { String name = ""; String firstName = ""; String lastName = ""; boolean done = false; do { try { System.out.println("Enter first name: "); firstName = console.nextLine(); done = true; } catch (Exception exp) { System.out.println("Invaild input: Enter name in alpha characters"); System.out.println(); } } ... |
68. How to return the detail message string of a custom exception coderanch.com |
69. null exception error dbforums.com |
70. Null point exception Error java-forums.orgi am using this following code to compare to columns from two different tables but i am getting null point exception because some of my fields in columns Like first_name is empty in few rows!!! are empty!!! how can i go beyond those null values and could print whatever there in the database! my code!! SpySearchServlet.java Java Code: import javax.servlet.*; import ... |
71. Need help with program that has null exception in main java-forums.orgNeed help with program that has null exception in main This is my program The error happens during running the application after counting words. My teacher says I am calling an unwritten array but I have no idea how. please help :o import java.util.Scanner; import java.io.*; public class WordProcessing { public static void main (String [] args) throws IOException ... |
72. Null pointer exceptions and linked lists java-forums.org |
73. exception: contentPane cannot be set to null. java-forums.orghey there, im a programmer thats new to the world of Java and im having an issue :S I'm trying to create a program, and it gives me the following error: " IllegalComponentStateException: contentPane cannot be set to null." i have no idea how i should be doin this, and dont know if its even possible the way ive programmed this ... |
74. Some help on this exception: java.lang.NullPointerException: src image is null java-forums.orgHello, As the title of the post says I'm wondering how to solve this problem with my code. I'm using netbeans and my goal is to open an image and then apply some effects (like blur, scale, etc). I have 5 classes: the frameimage (where I have the buttons), a class where I have the effects, a class for the JFilechooser ... |
75. Need help with exception handling for a string java-forums.orgI am writing a program that you have to enter either "R", "T", or "C" for some code to execute. I have everything running but cannot figure out how to handle if a different letter is entered or a number.....I want a reenter message to print and do again. I know how to use the numberFormat exception, but don't know how ... |
76. null value exceptions java-forums.orgimport java.util.Scanner; public class main { static String af; static String bf; public static void main(String args[]) { final double R = 1.0967 * (10000000); double lowest = Double.parseDouble(af); double highest = Double.parseDouble(bf); double answer; answer = R * (1 / (lowest * lowest) - 1 / (highest * highest)); System.out.println( "Insert the lowest Energy level"); Scanner obj = new Scanner(System.in); ... |
77. Exception handling for NULL? forums.oracle.comVarious options. a) Fix the bug in your code where you called that method without providing customer details. b) If it's from user input, catch the exception, prompt the user to enter the missing data, and loop until it's all good. b) Alternatively, if it's from user input, validate the customer input and loop until it's all good before even calling ... |
78. string index out of range:-8 exception while store procedure call forums.oracle.comi am working on the enchancement of the existing code. now we have to support utf16 format xml .So i found that parser is successfully parsing the xml but at the time of storing into the database(oracle9i), it is throwing "string index out of range:-8" exception.we are using store procedure for insert statement. If it is database issue then also our ... |
79. how does it work : String MethdName (argument) throws Exception {} forums.oracle.comYes, it will catch the exception whether you use 'throws Exception' or not. The difference is that, if you use 'throws Exception', the programmer will be forced to use a try-catch block in the caller method. If he does not do so, the code will not compile. If you don't use 'throws Exception', the programmer will not be force to use ... |
80. Strange Null Exception on Method Call forums.oracle.com |
81. Null Point Exception forums.oracle.comprivate class DrawListener implements MouseListener, MouseMotionListener { //-------------------------------------------------------------- /* Captures the initial position at which the mouse button is * */ public void mousePressed (MouseEvent event) { point1 = event.getPoint(); } /* *Gets the current position of the mouse as it is dragged and redraws the shape */ public void mouseDragged (MouseEvent event) { point2 = event.getPoint(); if (point1 != null ... |
82. String index out of bounds Exception forums.oracle.com |
83. Catch String Exception forums.oracle.comI want the user only to put in the string"n" and catch any other errors. If the the user enters the string "n", the screen will print "i". In this case, what should i put for the catch statement? that's what i did: try { System.out.println("Enter n"); Scanner input = new Scanner (System.in); String word = input.nextLine(); } catch (Exception e){ ... |
84. Substring exception: java.lang.StringIndexOutOfBoundsException forums.oracle.com |
85. null ptr exception forums.oracle.comException in thread "main" java.lang.NullPointerException at myclass2.launch(myclass2.java.29) at myclass2.main(myclass2.java:42) 1 import java.awt.*; 2 import java.awt.event.*; 3 class myclass2 implements ActionListener 4 { 5 private Frame[] f; 6 private Panel[] p; 7 private Label[] l; 8 private Button b; 9 private static int count; 10 11 myclass2() 12 { 13 count=0; 14 f=new Frame[5]; 15 p=new Panel[5]; 16 l=new Label[5]; 17 b=new ... |
86. Beginner's trouble: Null Point Exception forums.oracle.comIf you look at the stack trace it tells you which line number it was trying to execute when the exception was thrown. I have a feeling it happens on the frame.repaint() line inside the mouse listener. You have a class-level GoFrame called "frame" and a local JFrame called "frame", and the wrong one is being referenced. I suggest picking different ... |
87. Exception using charAt() forums.oracle.comprivate void setIV() { char c = word.charAt(0); if ((c == 'a') || (c == 'A') || (c == 'e') || (c == 'E') || (c == 'i') || (c == 'I') || (c == 'o') || (c == 'O') || (c == 'u') || (c == 'U')) IV = true; else IV = false; } |
88. Another null point exception problem forums.oracle.comDo you know what a NullPointerException means? Perhaps that is the real >source of the problem. Yes, so I want to know if can do anything about the fact they should stay null (since they are waiting for input) and if I can still have try catch statements in my code. The first one was from a file called Double.java [r/o]. ... |
89. String.format exception forums.oracle.com |
90. Passing arguments to String is causing exceptions, why? forums.oracle.comI'm using Netbeans. I go to run, set project configuration, and choose customize. Then I enter BlankFiller in the Main Class text field. In the arguments field, I enter fast red slower and clicked ok. So I've got 3 arguments in there that should be passed right? When I click run I still get the same output. |
91. StringIndexOutOfBound Exception : String index out of range: -1 forums.oracle.com |
92. HashMap-Returns null exception forums.oracle.com1.import java.util.HashMap; 2. 3. 4.public class hash 5.{ 6//private HashMap phoneBook 7.private HashMap phoneBook= new HashMap(); // PhoneBook Object is local to hash class But u declared it as a instance 8 public hash() 9. { 10. //HashMap |
93. Null Point Exception forums.oracle.com |
94. Can getMessage() method of Exception class return Null? forums.oracle.com |
95. Null Point Exception? forums.oracle.com/** A subclass of BasicGame in which the computer asks the user to choose a * whole number from 1 to 100, inclusive. The program then makes a number of * guesses. After each guess, the user tells whether the guess is too high, * too low, or exactly right. Once the computer "knows" what the correct * number is, the ... |
96. Out of Memory Exception for Java while storing large oject in string forums.oracle.comHi, Scenario:- Passing CLOB from Oracle function to Java method and parsing the CLOB received. I am trying to edit a CLOB that is passed from Oracle funtion to a Java method. while in process i am trying to store this CLOB object into a String variable. When the size of CLOB, that usually is between 100 - 600 Kb's, causes ... |
97. error-- null exception forums.oracle.comI'm glad you were able to find people willing to take the time to help you. However, you'll find in the future you'll get better, faster help if you're more forthcoming with details about what exactly you're doing and what exactly the problem was (full stack trace, clearly indicate which line caused the error, etc.). |
98. String OutOfBound exception forums.oracle.com |
99. null point exception forums.oracle.comI am doing my code recently but I got an null point exception error when i tried to run it. Can anyone solve it for me? Thanks. Below is my code: public class MyArrayList { private ListItem[] container; private int size = 0; public MyArrayList() { container = new ListItem[10]; } public String toString() { String temp = "["; for (int ... |
100. checking the content of a string using exception forums.oracle.com |