Questions tagged as 'java'

1
answer

How not to include the finally and still close IO Streams, Connections, Statements, and other Resources?

We know of the need to close resources (files, connections, also called resources ) consumed in Java, such as OutputStream and InputStream . When we do not close them, we create performance issues and prevent the Garbage Collector...
asked by 28.06.2015 / 17:04
1
answer

Sorting list

I'm doing a work that I need to create a linked list and sort it in ascending order, doing my tests, I realized that I'm missing a reference to a node, the problem may be logical but I can not find my error. > method to add and sort: public...
asked by 28.06.2015 / 22:34
1
answer

AsyncTask Android

I have a "Runnable" method that executes on a new Thread a certain method to update my list. Every time I call this "Runnable", I'm creating a new Thread, which for me is not very positive ... How can I do the same thing using an AsyncTask...
asked by 29.06.2015 / 21:11
2
answers

Validation of byte through array of bits of an image

I'm trying to validate an incoming image in an FTP folder. The images begin with the "FFD8" bytes and end with the "FFD9" sequence so that you can perform the scan. I'm getting the image in a BufferedImage and converting it to an array...
asked by 29.06.2015 / 22:17
1
answer

How to set the background color in multiple lines of a JTable?

I would like to know how to set the color of the background of multiple rows in the table. In the code below it simply directs the background in just one line, that is, in the last element of the vector. The idea is to pass a list of strings, an...
asked by 18.02.2015 / 17:09
2
answers

@Autowired bean in Filter

I'm trying to inject a bean into a filter but with no success, it always gets null causing error. Below is the code for bean : @Named @Scope("session") public class LoginBean { filter : @Component("filtroAutenticacao") publi...
asked by 15.02.2015 / 03:00
1
answer

My List is not updated correctly with bank data

I have a dataTable and a button that selects the object on each line of dataTable . When I click this button a Dialog is opened with some data and a Send button, when I click on that button, the selected line is edited in the...
asked by 26.06.2015 / 13:29
1
answer

Get array values returned from another class

I need to pass the value of the variable sgEstado to the other class but I can not, the value is in return when debug , but I can not make the value quit in the other class. p> ArrayList estados; try {...
asked by 16.10.2014 / 14:17
1
answer

java.lang.NullPointerException Error in JDBC Connection with WS + Postgres

I'm creating a WS that connects to a PostgreSQL DB and performs a query on a single table. I try to run it locally, but the problem is when I run the application it gives the following error:    HTTP 500 Status - Internal Server Error   ...
asked by 04.09.2014 / 16:40
1
answer

try / catch not "catching" Exception

I'm using JPA and was trying to create an EntityManager, and was testing some expcetions treatments in a class of mine. However, I'm having a problem, that the exception is not being caught by the catch. public static boolean openConnection(...
asked by 03.08.2014 / 07:44