Questions tagged as 'try-catch'

1
answer

Doubt about Try-Catch nested in Java

This is a little doubt about the logic of having a Try-Catch inside another Try-Catch in Java, for example it would have something like this: try{ //codigo aqui try{ //Aqui ocurre el error }catch(Exception ex){ System.out.prin...
asked by 14.11.2018 / 21:34
2
answers

What is the try and catch for? in java

In the following code that function exerts the try and catch class? package Package; import java.io.*; public class Textos { public void leer (String nombreArchive) { try { FileReader r= new FileReader (nombreArchive...
asked by 21.08.2017 / 06:21
1
answer

How can I make an error-proof switch?

When I make a switch I usually have the worry that someone will introduce an unexpected value such as a letter or a special character, my question is: How can I force the program to only receive what is expected? I had heard that it can be done...
asked by 25.09.2017 / 21:34
1
answer

Error Exception Null

I have this section of code where I need to add those variables to my database, but once I send the data, it tells me the error null Here I make my connections package lavanderia.Modelo; import java.sql.Date; import java.util.ArrayList; /**...
asked by 20.04.2017 / 07:48
2
answers

Java read and write file

Good companions. I have some problems with a program that I want to do in java, from a file doc.txt created previously, ask the user a word to search the contents of the file and generate a new result.txt that has the text of the file doc.t...
asked by 08.05.2017 / 11:25
1
answer

How to capture the Primary Key Duplicated error in Android (java) with SQLServer?

Is it possible to know that the error that occurs when inserting a record is due to a duplicate key error? I have a user registry in which the user is the primary key and I have it in try catch but when the user already exists it jumps to...
asked by 28.11.2018 / 15:51
1
answer

How to know without a "remove" in my driver was rejected because of a foreign key violation?

how to tell the user that a record has not been deleted because it has other entities that inherit its primary key by means of try / catch? try { db.usuarios.Remove(usuario); } catch(?????) { ??????? }     
asked by 17.08.2016 / 23:13
2
answers

Stop JSON reading in node.js

I'm doing a Web Service in Node.js where I have to do several validations but if one of those validations gives an error I need the Web Service to continue running but stop validating, as if it were a Try ... catch alone I do not know if in my c...
asked by 02.09.2018 / 20:56
0
answers

Doubt about use of catch in Netbeans

I'm new when it comes to java and a doubt arose and I can not find anywhere to solve it. I'm doing a project to learn well how to use Netbeans and mysql. My question is the following: I am using a catch to show messages according to the error. M...
asked by 14.05.2018 / 00:21
0
answers

Restore connection with SMTPlib

Good afternoon: I have a Python program that what it does is read a Telegram message and send the same message but by email through the SMPT library. The problem is that by chance I send two messages from Telegram at the same time the program...
asked by 29.09.2017 / 17:44