Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed [Issue-5], NPE with Generators.randomBasedGenerator().generate()

  • Loading branch information...
commit 3ce44a9868376a68f8436973c123ee98aeeeb795 1 parent 01fd569
Tatu authored
View
34 release-notes/VERSION
@@ -1,9 +1,20 @@
-Version: 3.1.0
+Version: 3.1.1
-Release date: 14-Oct-2010
+Release date: xx-Apr-2011
Description:
+Patch version to address following issues
+
+* [#5]: NPE when calling "Generators.randomBasedGenerator().generate()" second time
+ (reported by oswaldo)
+
+============================================================================
+
+History:
+
+3.1.0 (14-Oct-2010):
+
Rewrite of Java Uuid Generator, to bring it up to date. Changes include:
* Use Maven for build
@@ -15,19 +26,16 @@ Rewrite of Java Uuid Generator, to bring it up to date. Changes include:
EthernetAddress class)
* Made generators fully synchronized
-============================================================================
-
-History:
- 2.0.0 (29-Oct-2005):
+2.0.0 (29-Oct-2005):
- The official 2.0 release. No functional changes since rc6, just
- documentation updates.
+The official 2.0 release. No functional changes since rc6, just
+documentation updates.
- 2.0-rc6: (25-Sep-2005):
+2.0-rc6: (25-Sep-2005):
- Added simple logger wrappers for log4j and java.util.logging: now it
- should be trivial to make JUG use either of these logging sub-systems,
- when integrating it to an existing system.
+Added simple logger wrappers for log4j and java.util.logging: now it
+should be trivial to make JUG use either of these logging sub-systems,
+when integrating it to an existing system.
2.0-rc5: (05-Sep-2005):
@@ -65,7 +73,7 @@ History:
(of Jug command-line functionality) from jar.
1.1.1: Minor fixes:
- - Added FreeBSD recognition check suggested by Jonas F�gedi.
+ - Added FreeBSD recognition check suggested by Jonas F�gedi.
1.1: Better native support, full unit test suite.
- Fixed a bug in Windows MAC address access, which would cause
View
3  src/main/java/com/fasterxml/uuid/impl/RandomBasedGenerator.java
@@ -55,7 +55,8 @@ public RandomBasedGenerator(Random rnd)
* of which all but one are dumped) let's not add synchronization
* overhead.
*/
- if (_sharedRandom == null) {
+ rnd = _sharedRandom;
+ if (rnd == null) {
_sharedRandom = rnd = new SecureRandom();
}
_secureRandom = true;
View
18 src/test/java/com/fasterxml/uuid/SimpleGenerationTest.java
@@ -0,0 +1,18 @@
+package com.fasterxml.uuid;
+
+import java.util.UUID;
+
+import junit.framework.TestCase;
+
+public class SimpleGenerationTest extends TestCase
+{
+ public void testIssue5() throws Exception
+ {
+ UUID uuid = Generators.randomBasedGenerator().generate();
+ assertNotNull(uuid);
+
+ // but second time's the charm...
+ uuid = Generators.randomBasedGenerator().generate();
+ assertNotNull(uuid);
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.