[jruby~main:35664fa7] JRUBY-4624: NPE out of Tempfile.new in some cases

  • From: nicksieger@kenai.com
  • To: commits@jruby.kenai.com
  • Subject: [jruby~main:35664fa7] JRUBY-4624: NPE out of Tempfile.new in some cases
  • Date: Sat, 6 Mar 2010 14:28:39 +0000

Project:    jruby
Repository: main
Revision:   35664fa703024e187fe72b8f5ae32c3b191cd81d
Author:     nicksieger
Date:       2010-03-06 14:27:41 UTC
Link:       

Log Message:
------------
JRUBY-4624: NPE out of Tempfile.new in some cases


Revisions:
----------
35664fa703024e187fe72b8f5ae32c3b191cd81d


Modified Paths:
---------------
src/org/jruby/RubyTempfile.java


Diffs:
------
diff --git a/src/org/jruby/RubyTempfile.java b/src/org/jruby/RubyTempfile.java
index bec3b6b..4d01f68 100644
--- a/src/org/jruby/RubyTempfile.java
+++ b/src/org/jruby/RubyTempfile.java
@@ -126,7 +126,16 @@ public class RubyTempfile extends RubyFile {
                     if (tmp.createNewFile()) {
                         tmpFile = tmp;
                         path = tmp.getPath();
-                        tmpFile.deleteOnExit();
+                        try {
+                            tmpFile.deleteOnExit();
+                        } catch (NullPointerException npe) {
+                            // See JRUBY-4624.
+                            // Due to JDK bug, NPE could be thrown
+                            // when shutdown is in progress.
+                            // Do nothing.
+                        } catch (IllegalStateException ise) {
+                            // do nothing, shutdown in progress
+                        }
                         initializeOpen();
                         referenceSet.put(reaper = new Reaper(this, runtime, 
tmpFile, openFile), Boolean.TRUE);
                         return this;




[jruby~main:35664fa7] JRUBY-4624: NPE out of Tempfile.new in some cases

nicksieger 03/06/2010
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close