Alexander Rubinov

Greenhorn
+ Follow
since Jul 16, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Alexander Rubinov

Hello, who could help me?
Application hangs itself up.
Procedure:
1. It comes NullPointerException exception.
2. Exception intercepted with catch(NullPointerException e)
3. with e.printStackTrace() comes only java.lang.NullPointerException, without stack !!!
4. The next step should be the actualization of the JLabel with
SwingUtilities.invokeLater( new Runnable(){ public void run(){label.setText("text");} } );
Application hangs itself up completely
Described procedure runs in the separate Thread. Error meets only if application for a long time runs (over 20 hours).
Run time environment: jre 1.3_02 von Oracle; Oracle 8i (8.1.7) and Oracle 9i Lite (5.0.2)
best regards
Sasha.
17 years ago
I have a function that encode and immediatelly decode the same JPEG-data.
There are (not all) a image that will be black after redecode.
Function is running in multithread environment.
source code:
------------------------------------------------
static public byte[] decode_encode_jpeg( byte[] source ) throws IOException
{
ByteArrayOutputStream os = null;
try
{
Image image = new ImageIcon( source ).getImage() ;
int width = image.getWidth(null);
int height = image.getHeight(null);
Dimension d = new Dimension(width,height);
BufferedImage bufferedImg = new BufferedImage( width, height, BufferedImage.TYPE_INT_RGB );
Graphics2D g2 = bufferedImg.createGraphics();
g2.drawImage(image, null, null);
os = new ByteArrayOutputStream();
JPEGImageEncoder jpegImgEncoder = JPEGCodec.createJPEGEncoder( os );
jpegImgEncoder.encode(bufferedImg);
return os.toByteArray();
}
finally
{
try{ if( os != null ) os.close(); } catch( Exception e ){};
}
}
------------------------------------------------
Is JPEGImageEncoder threadesave ? when yes, what is the problem?
Thanks,
Alexander.
18 years ago