JDK-8154448 : I am uploading a .java file through UI and this file is complied and loading successfully in web application. But, when I give it to Quartz
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8
  • Priority: P4
  • Status: Closed
  • Resolution: Incomplete
  • OS: windows_8
  • CPU: x86
  • Submitted: 2016-03-28
  • Updated: 2016-12-12
  • Resolved: 2016-12-12
Related Reports
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_73"
java(TM) SE Runtime Environment (build 1.8.0_73-b02)
java HotSpot(TM) 64-Bit Server VM (build 25.73-b02, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft windows [6.3.9600]

A DESCRIPTION OF THE PROBLEM :
An exception has occurred in the compiler (1.8.0_25). Please file a bug at the J
ava Developer Connection (http://java.sun.com/webapps/bugreport)  after checking
 the Bug Parade for duplicates. Include your program and the following diagnosti
c in your report.  Thank you.
java.lang.NullPointerException
        at com.sun.tools.javac.main.CommandLine.parse(CommandLine.java:60)
        at com.sun.tools.javac.main.Main.compile(Main.java:414)
        at com.sun.tools.javac.main.Main.compile(Main.java:381)
        at com.sun.tools.javac.main.Main.compile(Main.java:370)
        at com.sun.tools.javac.main.Main.compile(Main.java:361)
        at com.sun.tools.javac.Main.compile(Main.java:56)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run web application in tomcat, upload a .java file, then compile it and create object using Class.forName().


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
expecting an object of the uploaded file
ACTUAL -
An exception has occurred in the compiler (1.8.0_25). Please file a bug at the J
ava Developer Connection (http://java.sun.com/webapps/bugreport)  after checking
 the Bug Parade for duplicates. Include your program and the following diagnosti
c in your report.  Thank you.
java.lang.NullPointerException
        at com.sun.tools.javac.main.CommandLine.parse(CommandLine.java:60)
        at com.sun.tools.javac.main.Main.compile(Main.java:414)
        at com.sun.tools.javac.main.Main.compile(Main.java:381)
        at com.sun.tools.javac.main.Main.compile(Main.java:370)
        at com.sun.tools.javac.main.Main.compile(Main.java:361)
        at com.sun.tools.javac.Main.compile(Main.java:56)

ERROR MESSAGES/STACK TRACES THAT OCCUR :
An exception has occurred in the compiler (1.8.0_25). Please file a bug at the J
ava Developer Connection (http://java.sun.com/webapps/bugreport)  after checking
 the Bug Parade for duplicates. Include your program and the following diagnosti
c in your report.  Thank you.
java.lang.NullPointerException
        at com.sun.tools.javac.main.CommandLine.parse(CommandLine.java:60)
        at com.sun.tools.javac.main.Main.compile(Main.java:414)
        at com.sun.tools.javac.main.Main.compile(Main.java:381)
        at com.sun.tools.javac.main.Main.compile(Main.java:370)
        at com.sun.tools.javac.main.Main.compile(Main.java:361)
        at com.sun.tools.javac.Main.compile(Main.java:56)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
		
		int errorCode = com.sun.tools.javac.Main.compile(new String[] { "-classpath", "bin", "-cp",
				".;"+PATHCONST.TOOLS + ";" + PATHCONST.QUARTZ + ";" + PATHCONST.JUNIT + ";" + PATHCONST.SELENIUM_JAVA + ";" + PATHCONST.SELENIUM_SERVER + ";"
						+ System.getProperty("java.class.path"),
				"-d", PATHCONST.TOMCAT_CLASSES_PATH, className });

		Method method = URLClassLoader.class.getDeclaredMethod("addURL", new Class[]{URL.class});
	    method.setAccessible(true);
	    method.invoke(ClassLoader.getSystemClassLoader(), new Object[]{new File(ClassFilePath).toURI().toURL()});
//		ClassLoader cload = new URLClassLoader(new URL[] { new File(PATHCONST.TOMCAT_CLASSES_PATH).toURI().toURL() },
//				Thread.currentThread().getContextClassLoader()); 
		
		System.out.println("errorcode and cload : "+errorCode+" "+method+"\njars n file path"+PATHCONST.JUNIT);
		
		Class c1= Class.forName(fileN);
		System.out.println("class is :"+c1);
		return c1;
---------- END SOURCE ----------

SUPPORT :
YES


Comments
As there is not complete information in this report to make headway it is being closed. If this issue is seen, please open a new report with all necessary information. This report ID can be referenced. Meaning of JBS status can be viewed at https://wiki.openjdk.java.net/display/general/JBS+Overview.
12-12-2016

Email sent to submitter: ======================================================================== In the reported file, it is not having the complete test case. So,could you please send us a complete test case and confirm the version of tomcat server? ========================================================================
12-12-2016