Hi,

the included Test.java give a segfault in Velocity.  I confirmed this 
with my java 1.3.1
on Redhat 7.0 and Redhat 7.1. I used the prebuild velocity-1.1.jar .

he included patch to commons-collections  solves this  (You have only 
include the
commons collection jar. So you need to get and to rebuild it.)
I do not know why this works.
The program expects a null-pointer exception, but it gets a segfault. 
Doing it my
way works.

( LD_ASSUME_KERNEL=2.2.5 does not help anything.)

- dietmar

Segfaults on Redhat 7.0 / 7.1
--------------------
java -version
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
import org.apache.velocity.app.Velocity;
 
public class
Test
{
 
public static void
main(String[] args)
{
  // Erzeugt einen Segfault unter Redhat 7.0
  try {
    Velocity.init();
  } catch ( Exception ex ) {
    System.out.println(ex.toString());
  }
 
}
 
}
diff -u --recursive 
commons-collections-1.0-src/collections/src/java/org/apache/commons/collections/ExtendedProperties.java
 
commons-collections-1.0-src.modified/collections/src/java/org/apache/commons/collections/ExtendedProperties.java
--- 
commons-collections-1.0-src/collections/src/java/org/apache/commons/collections/ExtendedProperties.java
     Sun May 13 23:46:22 2001
+++ 
+commons-collections-1.0-src.modified/collections/src/java/org/apache/commons/collections/ExtendedProperties.java
+    Sun Jul 29 15:35:58 2001
@@ -247,7 +247,10 @@
             {
                 while (true)
                 {
-                    String line = readLine().trim();
+                    String line = readLine();
+                   if ( line == null ) 
+                       throw new NullPointerException();
+                   line.trim();
                     if ((line.length() != 0) && (line.charAt(0) != '#'))
                     {
                         if (line.endsWith("\\"))
@@ -465,6 +468,9 @@
             while (true)
             {
                 String line = reader.readProperty();
+               if ( line == null ) 
+                       throw new NullPointerException();
+        
                 int equalSign = line.indexOf('=');
 
                 if (equalSign > 0)

Reply via email to