[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xalan-cvs
Subject:    [xalan-java] branch xalan-j_2_7_1_maint updated: improved error reporting for, xalanj integer trunca
From:       mukulg () apache ! org
Date:       2022-09-12 0:57:48
Message-ID: 166294426847.1772421.12621073011400555819 () gitbox2-he-fi ! apache ! org
[Download RAW message or body]

This is an automated email from the ASF dual-hosted git repository.

mukulg pushed a commit to branch xalan-j_2_7_1_maint
in repository https://gitbox.apache.org/repos/asf/xalan-java.git


The following commit(s) were added to refs/heads/xalan-j_2_7_1_maint by this push:
     new ab57211e improved error reporting for, xalanj integer truncation error bug \
fix ab57211e is described below

commit ab57211e5d2e97cbed06786f919fa9b749c83573
Author: Mukul Gandhi <gandhi.mukul@gmail.com>
AuthorDate: Mon Sep 12 06:27:00 2022 +0530

    improved error reporting for, xalanj integer truncation error bug fix
---
 src/org/apache/xalan/xsltc/compiler/XSLTC.java     | 102 ++++++++++-----------
 .../apache/xalan/xsltc/compiler/util/ErrorMsg.java |   7 +-
 2 files changed, 57 insertions(+), 52 deletions(-)

diff --git a/src/org/apache/xalan/xsltc/compiler/XSLTC.java \
b/src/org/apache/xalan/xsltc/compiler/XSLTC.java index 13fad89d..c548538f 100644
--- a/src/org/apache/xalan/xsltc/compiler/XSLTC.java
+++ b/src/org/apache/xalan/xsltc/compiler/XSLTC.java
@@ -377,7 +377,7 @@ public final class XSLTC {
 	    _parser.reportError(Constants.FATAL, new ErrorMsg(e));
 	}
 	catch (Error e) {
-	    if (_debug) e.printStackTrace();
+	    // if (_debug) e.printStackTrace();
 	    _parser.reportError(Constants.FATAL, new ErrorMsg(e));
 	}
 	finally {
@@ -825,56 +825,56 @@ public final class XSLTC {
 
     public void dumpClass(JavaClass clazz) {
 
-	if (_outputType == FILE_OUTPUT ||
-	    _outputType == BYTEARRAY_AND_FILE_OUTPUT)
-	{
-	    File outFile = getOutputFile(clazz.getClassName());
-	    String parentDir = outFile.getParent();
-	    if (parentDir != null) {
-	      	File parentFile = new File(parentDir);
-	      	if (!parentFile.exists())
-	            parentFile.mkdirs();
-	    }
-	}
-
-	try {
-	    switch (_outputType) {
-	    case FILE_OUTPUT:
-		clazz.dump(
-		    new BufferedOutputStream(
-			new FileOutputStream(
-			    getOutputFile(clazz.getClassName()))));
-		break;
-	    case JAR_OUTPUT:
-		_bcelClasses.addElement(clazz);
-		break;
-	    case BYTEARRAY_OUTPUT:
-	    case BYTEARRAY_AND_FILE_OUTPUT:
-	    case BYTEARRAY_AND_JAR_OUTPUT:
-	    case CLASSLOADER_OUTPUT:
-		ByteArrayOutputStream out = new ByteArrayOutputStream(2048);
-		clazz.dump(out);
-		_classes.addElement(out.toByteArray());
-
-		if (_outputType == BYTEARRAY_AND_FILE_OUTPUT) {
-		  // check that the, class to be serialized to filesystem, is of the valid format
-		  // check with the native JVM class loader
-		  byte[] classByteArray = clazz.getBytes();
-		  ByteArrayClassLoader classLoader = new ByteArrayClassLoader(classByteArray);
-		  Class clz = classLoader.findClass(clazz.getClassName());
-		  
-		  clazz.dump(new BufferedOutputStream(
-			new FileOutputStream(getOutputFile(clazz.getClassName()))));		  
-		}
-		else if (_outputType == BYTEARRAY_AND_JAR_OUTPUT)
-		  _bcelClasses.addElement(clazz);
-
-		break;
-	    }
-	}
-	catch (Exception e) {
-	    e.printStackTrace();
-	}
+    	if (_outputType == FILE_OUTPUT ||
+    	    _outputType == BYTEARRAY_AND_FILE_OUTPUT)
+    	{
+    	    File outFile = getOutputFile(clazz.getClassName());
+    	    String parentDir = outFile.getParent();
+    	    if (parentDir != null) {
+    	      	File parentFile = new File(parentDir);
+    	      	if (!parentFile.exists())
+    	            parentFile.mkdirs();
+    	    }
+    	}
+    
+    	try {
+    	    switch (_outputType) {
+    	    case FILE_OUTPUT:
+    		clazz.dump(
+    		    new BufferedOutputStream(
+    			new FileOutputStream(
+    			    getOutputFile(clazz.getClassName()))));
+    		break;
+    	    case JAR_OUTPUT:
+    		_bcelClasses.addElement(clazz);
+    		break;
+    	    case BYTEARRAY_OUTPUT:
+    	    case BYTEARRAY_AND_FILE_OUTPUT:
+    	    case BYTEARRAY_AND_JAR_OUTPUT:
+    	    case CLASSLOADER_OUTPUT:
+    		ByteArrayOutputStream out = new ByteArrayOutputStream(2048);
+    		clazz.dump(out);
+    		_classes.addElement(out.toByteArray());
+    
+    		if (_outputType == BYTEARRAY_AND_FILE_OUTPUT) {
+    		  // check that the, class to be serialized to filesystem, is of the valid \
format. +    		  // check with the native JVM class loader
+    		  byte[] classByteArray = clazz.getBytes();
+    		  ByteArrayClassLoader classLoader = new ByteArrayClassLoader(classByteArray);
+    		  Class clz = classLoader.findClass(clazz.getClassName());
+    		  
+    		  clazz.dump(new BufferedOutputStream(
+    			new FileOutputStream(getOutputFile(clazz.getClassName()))));		  
+    		}
+    		else if (_outputType == BYTEARRAY_AND_JAR_OUTPUT)
+    		  _bcelClasses.addElement(clazz);
+    
+    		break;
+    	    }
+    	}
+    	catch (Exception e) {
+    	    e.printStackTrace();
+    	}
     }
     
     public class ByteArrayClassLoader extends ClassLoader {
diff --git a/src/org/apache/xalan/xsltc/compiler/util/ErrorMsg.java \
b/src/org/apache/xalan/xsltc/compiler/util/ErrorMsg.java index 41106fa2..acd55a56 \
                100644
--- a/src/org/apache/xalan/xsltc/compiler/util/ErrorMsg.java
+++ b/src/org/apache/xalan/xsltc/compiler/util/ErrorMsg.java
@@ -184,7 +184,12 @@ public final class ErrorMsg {
 	
     public ErrorMsg(Throwable e) {
    	_code = null;
-	_message = e.getMessage();
+   	if (e instanceof ClassFormatError) {
+	  _message = "Aborting serializing the generated bytecode, because verification of \
generated bytecode failed. " + e.getMessage(); +   	}
+   	else {
+   	  _message = e.getMessage();  
+   	}
 	_line = 0;
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xalan.apache.org
For additional commands, e-mail: commits-help@xalan.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic