JDK 1.2 Bug sigsegv and swing sizeing
I have submitted this as bug 552 but I wondered if anyone can help:
Full_Name: Trevor Harris
JDK_Version: 1.2 pre 1
JDK_Arch: i386 (x86)
Linux_Dist: Caldera
Linux_Dist_Ver: Open Ingres 1.0
Libc_Ver: libc.so.5.4.44
Ld_Ver: 1.7.14
Dyn_Java: no
Toolkit: Motif
Toolkit_Ver: Swim 2.0 1e
Bug_Example: http://
Submission from: host1.trevan.u-net.com (194.119.136.142)
I have major intermitant problems with swing programs. Sometimes I get a
segment
violation as shown by the dump below. Sometimes I get a frame which fills my
screen vertically which displays only a stretched header for the table.
Sometimes
it works correctly. So I guess there is a race condition somewhere.
Please find below a test program, a dump, and my ldconfig -D output.
I am using Xfree 3.3.2. with tvwm window manager.
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
public class Test1 extends JFrame{
public Test1(){
super("Invoices");
AbstractTableModel tm = new AbstractTableModel(){
public int getColumnCount() { return 7; }
public int getRowCount() { return 3; }
public Object getValueAt( int row, int col ) {
return (Object)"XXX" ;
}
};
JTable t = new JTable(tm);
JScrollPane s = new JScrollPane(t);
Container p = getContentPane();
p.add(s);
}
public static void main(String[] args){
Test1 i = new Test1();
i.pack();
i.setVisible(true);
}
}
SIGSEGV 11* segmentation violation
stackpointer=0xb2a8
Full thread dump Classic VM (Linux_JDK_1.2_pre-release-v1, native threads):
"AWT-Motif" (TID:0x4107b0b8, sys_thread_t:0x44713010, state:R, native ID:0x1
806) prio=5
at sun.awt.motif.MToolkit.run(Native Method)
at java.lang.Thread.run(Compiled Code)
"SunToolkit.PostEventQueue-0" (TID:0x4107b588, sys_thread_t:0x44706258, stat
e:CW, native ID:0x1405) prio=5
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Compiled Code)
at sun.awt.PostEventQueue.run(Compiled Code)
"AWT-EventQueue-0" (TID:0x4107b558, sys_thread_t:0x83b9410, state:CW, native
ID:0x1004) prio=6
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Compiled Code)
at java.awt.EventQueue.getNextEvent(Compiled Code)
at java.awt.EventDispatchThread.run(Compiled Code)
"Finalizer" (TID:0x4105e320, sys_thread_t:0x81c3428, state:CW, native ID:0xc
03) prio=8
at java.lang.Object.wait(Native Method)
at java.lang.ref.ReferenceQueue.remove(Compiled Code)
at java.lang.ref.ReferenceQueue.remove(Compiled Code)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:174)
"Reference Handler" (TID:0x4105e3b0, sys_thread_t:0x81bebc8, state:CW, nativ
e ID:0x802) prio=10
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Compiled Code)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:114)
"SIGQUIT handler" (TID:0x4105e3e0, sys_thread_t:0x81b75c8, state:R, native I
D:0x401) prio=5
"main" (TID:0x4105e1e0, sys_thread_t:0x8143018, state:R, native ID:0x400) pr
io=5
at java.text.NumberFormat.getInstance(Compiled Code)
at java.text.NumberFormat.getInstance(Compiled Code)
at javax.swing.JTable$7.(Compiled Code)
at javax.swing.JTable.createDefaultRenderers(Compiled Code)
at javax.swing.JTable.initializeLocalVars(Compiled Code)
at javax.swing.JTable.(Compiled Code)
at javax.swing.JTable.(Compiled Code)
at Test1.(Compiled Code)
at Test1.main(Compiled Code)
Monitor Cache Dump:
java.lang.ref.ReferenceQueue$Lock@4105E338/41093D78:
Waiting to be notified:
"Finalizer" (0x81c3428)
java.awt.EventQueue@4107B508/410CA5B8:
Waiting to be notified:
"AWT-EventQueue-0" (0x83b9410)
sun.awt.PostEventQueue@4107B588/410CA7F8:
Waiting to be notified:
"SunToolkit.PostEventQueue-0" (0x44706258)
java.lang.ref.Reference$Lock@4105E3C0/410938A8:
Waiting to be notified:
"Reference Handler" (0x81bebc8)
Registered Monitor Dump:
PCMap lock:
utf8 hash table:
JNI pinning lock:
JNI global reference lock:
BinClass lock:
Class linking lock:
System class loader lock:
Code rewrite lock:
Heap lock:
Monitor cache lock: owner "main" (0x8143018) 1 entry
Thread queue lock: owner "main" (0x8143018) 1 entry
Dynamic loading lock:
Monitor registry: owner "main" (0x8143018) 1 entry
ldconfig: version 1.7.14
/usr/i486-linuxlibc5/lib:
libm.so.5 => libm.so.5.0.9
libc.so.5 => libc.so.5.4.46
/usr/X11R6/lib:
libMagick.so.4 => libMagick.so.4.0.4
libXm.so.2 =&
Re: Signing Applets
Absolutely not! What sort of security would there be if anyone could sign any old applet? That would defeat the entire purpose of signing. I suggest you read up on what exactly code-signing is. Check out the security sites at javasoft.com, microsoft.com, and verisign.com. Trevor On Wed, 12 Aug 1998, Laura L. Evangelista wrote: > Java People, > > Can I sign an applet (JAR file) without "purchasing"/needing > a certificate (digital ID)? > > -- Laura > >
Re: MS Access....
I don't know about Access, but I have been using Sybase's jConnect (a pure-Java JDBC driver) under Linux for some time now with great success. You might want to try getting your ISP to switch from Access to Sybase. After all, mixing just about anything from Microsoft with either Linux or Java is probably NAGI (not a good idea). Trevor On Thu, 17 Sep 1998, Molenda, Mark P wrote: > Has anyone out there used a JDBC dirver or ODBC driver on Linux to access a > Microsoft Access file (mdb file)? > Where can I get it? We are trying to setup an ISP's WebServer to handle > Access databases on Linux. > >
My source code crashes javac
I am trying to compile the attached program in javac. I've tested it
under Sun's JDK 1.1.5 on Solaris, Symantec's Visual Cafe (forgot which
version, but it's based on JDK 1.1.3) on Windows NT, and Blackdown's JDK
1.1.6v5 on Linux. All of them give the exact same result:
java.lang.NullPointerException:
at java.util.Hashtable.get(Hashtable.java)
at sun.tools.asm.ConstantPool.put(ConstantPool.java)
at sun.tools.asm.Instruction.collect(Instruction.java)
at sun.tools.asm.Assembler.collect(Assembler.java)
at sun.tools.javac.SourceClass.compileClass(SourceClass.java)
at sun.tools.javac.SourceClass.compile(SourceClass.java)
at sun.tools.javac.Main.compile(Main.java)
at sun.tools.javac.Main.main(Main.java)
The problem appears to be related somehow to the System.out.println
statements, probably the combination of the println's with the ?:
operator. If you take out the println's, then the program compiles fine.
I've sent this in as a bug using Sun's bug-report form, but I've posted
it here because I'm curious to know why javac is having problems with
this. Maybe somebody who has the javac source code has some spare time
to check this out and let us know what's going on. (Note that I have not
tried compiling the code using Sun's JDK 1.1.7.)
Thanks,
Trevor Harmon
import java.awt.*;
import java.awt.image.*;
import java.io.*;
/**
This program converts a GIF image containing font data
to a Motorola 68K assembly source code format.
The GIF image must be in 8-bit (256-color) format.
*/
public class GIF2EPROM
{
private static final int FONT_WIDTH = 16;
private static final int FONT_HEIGHT = 16;
private static final int CHARACTER_COUNT = 10 * 4;
/**
This function takes an RGB (direct color model) image and obtains
its palette information and an array of bytes which are indexes
into the palette. The implementation supports only 8-bit (256 color)
images.
*/
private static void getIndexColorData(Image img, byte[] pixels, byte[] byReds,
byte[] byGreens, byte[] byBlues)
{
Panel dummy = new Panel();
int width= img.getWidth(dummy);
int height = img.getHeight(dummy);
int nPaletteIndex = 0;
int[] nPixels = new int[width * height];
int[] nPalette = new int[256];
PixelGrabber pg = new PixelGrabber(img, 0, 0, width, height, nPixels,
0, width);
try
{
pg.grabPixels();
}
catch (InterruptedException e) {}
// Loop through each pixel in the image...
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
int nIndex = -1;
// Search for the palette index of the current pixel's
color...
for (int i = 0; i <= nPaletteIndex; i++)
{
if ( nPalette[i] == nPixels[y * width + x] )
{
nIndex = i;
break;
}
}
// If the current pixel's color is not in the palette,
add it
// to the palette.
if ( nIndex == -1 )
{
nPalette[nPaletteIndex] = nPixels[y * width +
x];
nIndex = nPaletteIndex;
nPaletteIndex++;
}
// Change the pixel from a color value to an index
value.
pixels[y * width + x] = (byte) nIndex;
}
}
for (int i = 0; i < 256; i++)
{
int red = (nPalette[i] >> 16) & 0xff;
int green = (nPalette[i] >> 8 ) & 0xff;
int blue = (nPalette[i] ) & 0xff;
byReds[i] = (byte)red;
byGreens[i] = (byte)green;
byBlues[i] = (byte)blue;
}
}
private static String toHexString(int value)
{
String hex = Integer.toHexString(value);
switch (hex.length())
{
Re: jdk1.2 testing
Gabe Hamilton wrote: > If you need people to test jdk 1.2, I would be happy to help out. Me too... It would be great if the Blackdown team could put out a pre-release of 1.2, since their web page claims that the port is at least "running". Anyone know if this is a possibility? The page also says, "Before we can release, we have to make sure that it passes the tests in the Java Compatibility Kit." Is this a requirement of Sun's source code licensing, or is it just something that was decided on by the Blackdown team? Trevor
Re: JCK licensing restriction (was: JDK1.2)
I disagree on that last point, and I was wondering if anyone else feels the same. (I'm referring to the part about not releasing any version of the Linux JDK 1.2 until passing compatibility tests being a good thing.) I think it's not such a good thing because, as I understand it, it prevents any form of public beta testing. Think about it this way: If the JDK doesn't pass the JCK, then it means there are bugs somewhere, but the developer community can't help the Blackdown team find/kill those bugs if a public beta isn't released. So, although one might think that forcing the JDK to pass the JCK would reduce bugs in the final release, I would guess that it actually produces *more* bugs since the thousands and thousands of Java-Linux developers out there are prevented from helping out with the beta test cycle. It also means that the beta cycle might take longer since the pre-releases can only be tested by members of Blackdown. Am I missing something here, or is the JCK restriction of the license really not such a great thing after all? Trevor Nathan Meyers wrote: > The answer is that it's being worked on, it'll be out soon (no date > promised), and the Blackdown team is forbidden by the license to release > anything until it has passed the compatibility tests (this is a good > thing).
Re: Making an Java Application "wait" to be called
If you need to make the same connection pool accessible from multiple
instances of the Java Virtual Machine, then yes, RMI is about the only
solution.
If, however, your connection pool can be unique for each launch of a VM, then
you could solve your problem quite easily with the good old fashioned
Singleton pattern combined with Java's static initializer. (If you are
unfamiliar with the Singleton pattern, buy, read, and memorize "Design
Patterns" by Gamma, et.al. or any other decent book on patterns.)
Something like this:
public class MyApp extends JFrame
{
private static ConnectionPool connectionPool = ConnectionPool.getPool();
.
}
public class ConnectionPool
{
private static ConnectionPool instance;
private ConnectionPool()
{
// Set up connections
}
public static ConnectionPool getPool()
{
if (instance == null) instance = new ConnectionPool();
return instance;
}
}
Trevor
P.S. In the future, please post questions like these to a JDBC or RMI mailing
list or one of the newsgroups. This list should be reserved for Linux-specific
Java questions.
Ernst de Haan wrote:
> Check out the RMI docs. Especially the part about the Naming service.
> Should answer your question.
>
> If ya have JDK docs installed, check the RMI guide.
>
> Christopher Rowan wrote:
> >
> > Heya Hiya Ho!
> >
> > I want to make a database connection pool class that starts up,
> > preconnects n jdbc connections, then waits to be called by various apps.
> >
> > How do I make Java wait without exiting and without putting it into a
> > cycle sucking loop?
> >
> > I've checked the API docs and a few books (my due dilligence) but can't
> > find an answer.
> >
> > It's got to be ez - I just can't find it.
> >
> > Also, is CORBA/RMI the only way to call the connections? Is this even
> > possible?
> >
> > Suggestions?
> >
> > Chris Rowan
> > This mail is CopyLeft
Re: graphics problems
Gary Mart (GAM22) admin0 wrote: > I have 2 problems: >1) drawLines()ith XORmMode set does not work correctly and, >2) I want to move the mouse pointer under program control > Warping pointers in Java 1.1.x is impossible, so you'll have to write a native function. As for passing Java graphics contexts to native functions, I'm not sure if that's even possible. Trevor
