public inbox for rhug-rhats@sourceware.org
 help / color / mirror / Atom feed
* BCEL AssertionViolatedException, Ant, Xerces, Xalan - part II
@ 2003-01-04 23:25 Dhek Bhun Kho
  0 siblings, 0 replies; only message in thread
From: Dhek Bhun Kho @ 2003-01-04 23:25 UTC (permalink / raw)
  To: Rhug

[-- Attachment #1: Type: text/plain, Size: 3390 bytes --]

Hi there,

I saw the BCEL in the source repository but at the moment the toplevel
make from RHUG won't build breaking on something from gnu.readline and
haven't had time to inspect the rest yet.

Some time ago there was a question about the
AssertionViolationException.java I delved into the code and there are
some notes from the authors stating it is only meant for internal use.
Furthermore it only occurs once in the Pass1Verifier.java. I included
two diffs that remove the offending method (something of an internal
name clash that GCJ can't resolve), and a diff that removes the only
call to the method in the whole sourcecode.

Applying these patches and removing: 
VerifierAppFrame.java VerifyDialog.java VerifierFactoryListModel.java
GraphicalVerifier.java

Will get it to compile. I looked into the RHUG cvs and saw that those
sources have been already removed.

I am well on my way compiling Tomcat at the moment, but am still bugged
by resourcefiles. Currently I fix this by dumping resource files into a
jar and placing them in the classpath

compiling using

gcj --resource xx/xx/xxx/xx/resource xx/xx/xxx/xx/resource -o
xx/xx/xxx/xxx/resource_res.o

does compile but the code will not find the resource in question. if it
doesn't take too much of your time, can anybody point out the code where
the core:// protocol in handled in the GCJ sources or what I am doing
wrong?

Xerces and Xalan compile without problems, except for 1 source file the
DTMDefaultTraverser where there is a bit of unreachable code, I have
posted a diff before but that one seemed incorrect, becuase in one case
of the for(;;) loops where the increment (last term of the for-loop) was
unreachable in some cases my modification of the code prevented
reexecution of the loop. I included the diff for that too. I know it's
all peanuts work, but hopefull it's of some use.

One worty thing to mention is that compiling directly from java sources
to native code seems to be the way to go with GCJ. A lot of the problems
I reported in the weeks before due to try{} catch {} loops etc. are only
encountered when generating classfiles from java sources and
subsequently generating native code from those classfiles. Generating
the native code from java sources directly also result in a smaller
number of object files because the inner classes are integrated into the
same object file.

Java_cup and regexp don't need any modifications at all.

Ant does have problems: 
The diff for GET solves the depedency on com.sun. packages for a Base64
encoder which is already implemented in the classfile itself.
The ImplementationSpecificArgument has problems resolving the
superclass, the diff extends the superclass with it's FQN instead of
it's short name.
The DateUtils diff prevents calling a format method that is broken in
GCJ 3.2.1 and cvs last time I checked.
Ant will not run correctly as long as the StringTokenizer.java isn't
fixed in GCJ and as such will not run correctly with GCJ 3.2.1. Oddly
enought the version from Classpath is correct and GCJ's version seems to
be an older version.
Rhug's version of Ant is very unlikely to build as it contains sun.*
dependent code for Get.java. I think it's not necessary to remove all
optional packages especially the xml tasks, as Ant depends on xerces
anyway and sourcecode for javax.xml.* interfaces of xerces and xalan
supplement each other.

Greets, Bhun.

[-- Attachment #2: org.apache.bcel.verifier.exc.AssertionViolatedException.diff --]
[-- Type: text/plain, Size: 844 bytes --]

--- AssertionViolatedException.java	2003-01-04 21:29:13.000000000 +0100
+++ /home/cvs/salvation/salvation/base/src/org/apache/bcel/verifier/exc/AssertionViolatedException.java	2003-01-04 21:33:10.000000000 +0100
@@ -95,21 +95,12 @@
 		return detailMessage;
 	}
 
-	/** 
-	 * DO NOT USE. It's for experimental testing during development only.
-	 */
-	public static void main(String[] args){
-		AssertionViolatedException ave = new AssertionViolatedException("Oops!");
-		ave.extendMessage("\nFOUND:\n\t","\nExiting!!\n");
-		throw ave;
-	}
-
 	/**
 	 * Returns the backtrace of this AssertionViolatedException as a String.
 	 * @return The backtrace of this AssertionViolatedException as a String.
 	 */
 	public String getStackTrace(){
-		return Utility.getStackTrace(this);
+		return "Unsupported operation";
 	}
 
 }

[-- Attachment #3: org.apache.bcel.verifier.statics.Pass1Verifier.diff --]
[-- Type: text/plain, Size: 1129 bytes --]

--- diff/org.apache.bcel.verifier.statics.Pass1Verifier.java	2003-01-04 23:35:30.000000000 +0100
+++ salvation/base/src/org/apache/bcel/verifier/statics/Pass1Verifier.java	2003-01-04 22:00:06.000000000 +0100
@@ -67,7 +67,7 @@
  * More detailed information is to be found at the do_verify() method's
  * documentation.
  *
- * @version $Id: Pass1Verifier.java,v 1.1.1.1 2001/10/29 20:00:35 jvanzyl Exp $
+ * @version $Id: Pass1Verifier.java,v 1.1 2003/01/04 18:21:22 bhun Exp $
  * @author <A HREF="http://www.inf.fu-berlin.de/~ehaase"/>Enver Haase</A>
  * @see #do_verify()
  */
@@ -183,7 +183,7 @@
 		catch(RuntimeException e){
 			// BCEL does not catch every possible RuntimeException; e.g. if
 			// a constant pool index is referenced that does not exist.
-			return new VerificationResult(VerificationResult.VERIFIED_REJECTED, "Parsing via BCEL did not succeed. "+e.getClass().getName()+" occured:\n"+Utility.getStackTrace(e));
+			return new VerificationResult(VerificationResult.VERIFIED_REJECTED, "Parsing via BCEL did not succeed. "+e.getClass().getName()+" occured:\n");
 		}
 
 		if (jc != null){

[-- Attachment #4: org.apache.xml.dtm.ref.DTMDefaultBaseTraversers.diff --]
[-- Type: text/x-patch, Size: 4267 bytes --]

*** src/org/apache/xml/dtm/ref/DTMDefaultBaseTraversers.java	2002-12-30 13:03:46.000000000 +0100
--- diff/DTMDefaultBaseTraversers.java	2002-12-30 12:52:09.000000000 +0100
*************** public abstract class DTMDefaultBaseTrav
*** 717,728 ****
        {
          int type = _type(current);  // may call nextNode()
  
!         if (!isDescendant(subtreeRootIdent, current)) {
            return NULL;
! 				} 
!         if (ATTRIBUTE_NODE != type && NAMESPACE_NODE != type) {
!           return makeNodeHandle(current);  // make handle.
! 				}
        }
      }
  
--- 717,729 ----
        {
          int type = _type(current);  // may call nextNode()
  
!         if (!isDescendant(subtreeRootIdent, current))
            return NULL;
! 
!         if (ATTRIBUTE_NODE == type || NAMESPACE_NODE == type)
!           continue;
! 
!         return makeNodeHandle(current);  // make handle.
        }
      }
  
*************** public abstract class DTMDefaultBaseTrav
*** 755,763 ****
          if (!isDescendant(subtreeRootIdent, current))
            return NULL;
  
!         if (exptype == expandedTypeID) {
!           return makeNodeHandle(current);  // make handle.
! 				}
        }
      }
    }
--- 756,765 ----
          if (!isDescendant(subtreeRootIdent, current))
            return NULL;
  
!         if (exptype != expandedTypeID)
!           continue;
! 
!         return makeNodeHandle(current);  // make handle.
        }
      }
    }
*************** public abstract class DTMDefaultBaseTrav
*** 815,821 ****
  
        int subtreeRootIdent = makeNodeIdentity(context);
  
!       for (current = makeNodeIdentity(current) + 1; ; )
        {
          // Trickological code: _exptype() has the side-effect of
          // running nextNode until the specified node has been loaded,
--- 817,823 ----
  
        int subtreeRootIdent = makeNodeIdentity(context);
  
!       for (current = makeNodeIdentity(current) + 1; ; current++)
        {
          // Trickological code: _exptype() has the side-effect of
          // running nextNode until the specified node has been loaded,
*************** public abstract class DTMDefaultBaseTrav
*** 943,954 ****
  				// %REVIEW% Are we using handles or indexes?
          int type = _type(current);  // may call nextNode()
  
!         if (NULL == type) {
            return NULL;
! 				} 
! 				if (ATTRIBUTE_NODE != type && NAMESPACE_NODE != type) {
!         	return makeNodeHandle(current);  // make handle.
! 				}
        }
      }
  
--- 945,957 ----
  				// %REVIEW% Are we using handles or indexes?
          int type = _type(current);  // may call nextNode()
  
!         if (NULL == type)
            return NULL;
! 
!         if (ATTRIBUTE_NODE == type || NAMESPACE_NODE == type)
!           continue;
! 
!         return makeNodeHandle(current);  // make handle.
        }
      }
  
*************** public abstract class DTMDefaultBaseTrav
*** 1513,1519 ****
  			// Compute in ID space
        int subtreeRootIdent = makeNodeIdentity(context);
  
!       for (current = makeNodeIdentity(current) + 1; ; )
        {
  				// Kluge test: Just make sure +1 yielded a real node
          int type = _type(current);  // may call nextNode()
--- 1516,1522 ----
  			// Compute in ID space
        int subtreeRootIdent = makeNodeIdentity(context);
  
!       for (current = makeNodeIdentity(current) + 1; ; current++)
        {
  				// Kluge test: Just make sure +1 yielded a real node
          int type = _type(current);  // may call nextNode()
*************** public abstract class DTMDefaultBaseTrav
*** 1546,1554 ****
          if (exptype == NULL)
            return NULL;
  
!         if (exptype == expandedTypeID) {
!           return makeNodeHandle(current);  // make handle.
! 				}
        }
      }
    }
--- 1549,1558 ----
          if (exptype == NULL)
            return NULL;
  
!         if (exptype != expandedTypeID)
!           continue;
! 
!         return makeNodeHandle(current);  // make handle.
        }
      }
    }

[-- Attachment #5: org.apache.tools.ant.util.DateUtils.diff --]
[-- Type: text/plain, Size: 860 bytes --]

--- jakarta-ant-1.5.1/src/main/org/apache/tools/ant/util/DateUtils.java	2002-10-02 17:08:51.000000000 +0200
+++ src/org/apache/tools/ant/util/DateUtils.java	2002-12-14 20:16:21.000000000 +0100
@@ -159,10 +159,11 @@
      * @return the formatted text in minutes/seconds.
      */
     public static String formatElapsedTime(long millis) {
-        long seconds = millis / 1000;
-        long minutes = seconds / 60;
-        Object[] args = {new Long(minutes), new Long(seconds % 60)};
-        return MINUTE_SECONDS.format(args);
+		//long seconds = millis / 1000;
+        	//long minutes = seconds / 60;
+        	//Object[] args = {new Long(minutes), new Long(seconds % 60)};
+        	//str = MINUTE_SECONDS.format(args);
+ 	return millis/1000 + " seconds"; // HACK: MessageFormat has errors in CLASSPATH
     }
 
     /**

[-- Attachment #6: org.apache.tools.ant.util.facade.ImplementationSpecificArgument.diff --]
[-- Type: text/plain, Size: 543 bytes --]

--- ImplementationSpecificArgument.java	2003-01-04 21:30:25.000000000 +0100
+++ /home/cvs/salvation/salvation/base/src/org/apache/tools/ant/util/facade/ImplementationSpecificArgument.java	2003-01-04 21:31:05.000000000 +0100
@@ -66,7 +66,7 @@
  *
  * @since Ant 1.5
  */
-public class ImplementationSpecificArgument extends Commandline.Argument {
+public class ImplementationSpecificArgument extends org.apache.tools.ant.types.Commandline.Argument {
     private String impl;
 
     public ImplementationSpecificArgument() {

[-- Attachment #7: org.apache.tools.ant.taskdefs.Get.diff --]
[-- Type: text/plain, Size: 1676 bytes --]

--- jakarta-ant-1.5.1/src/main/org/apache/tools/ant/taskdefs/Get.java	2002-10-02 17:08:53.000000000 +0200
+++ src/org/apache/tools/ant/taskdefs/Get.java	2002-12-14 01:19:50.000000000 +0100
@@ -145,18 +145,18 @@
                 String up = uname + ":" + pword;
                 String encoding;
                 // check to see if sun's Base64 encoder is available.
-                try {
-                    sun.misc.BASE64Encoder encoder =
-                        (sun.misc.BASE64Encoder)
-                        Class.forName("sun.misc.BASE64Encoder").newInstance();
-                    encoding = encoder.encode (up.getBytes());
-
-                } catch (Exception ex) { // sun's base64 encoder isn't available
+                //try {
+                  //  sun.misc.BASE64Encoder encoder =
+                    //    (sun.misc.BASE64Encoder)
+                      //  Class.forName("sun.misc.BASE64Encoder").newInstance();
+//                    encoding = encoder.encode (up.getBytes());
+//
+  //              } catch (Exception ex) { // sun's base64 encoder isn't available
                     Base64Converter encoder = new Base64Converter();
                     encoding = encoder.encode(up.getBytes());
-                }
-                connection.setRequestProperty ("Authorization",
-                                               "Basic " + encoding);
+    //            }
+      //          connection.setRequestProperty ("Authorization",
+       //                                        "Basic " + encoding);
             }
 
             //connect to the remote site (may take some time)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-01-04 23:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-04 23:25 BCEL AssertionViolatedException, Ant, Xerces, Xalan - part II Dhek Bhun Kho

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).