Author: rvesse
Date: Tue Nov 19 16:48:07 2013
New Revision: 1543489
URL: http://svn.apache.org/r1543489
Log:
Fix a NPE condition in BlankNodeAllocatorFixedSeedHash
Modified:
jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/BlankNodeAllocatorFixedSeedHash.java
jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/BlankNodeAllocatorHash.java
Modified:
jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/BlankNodeAllocatorFixedSeedHash.java
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/BlankNodeAllocatorFixedSeedHash.java?rev=1543489&r1=1543488&r2=1543489&view=diff
==============================================================================
---
jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/BlankNodeAllocatorFixedSeedHash.java
(original)
+++
jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/BlankNodeAllocatorFixedSeedHash.java
Tue Nov 19 16:48:07 2013
@@ -48,10 +48,14 @@ public class BlankNodeAllocatorFixedSeed
if (seed == null)
throw new NullPointerException("seed cannot be null");
this.seed = seed;
+ this.reset();
}
@Override
protected UUID freshSeed() {
- return this.seed;
+ // NB - The parent constructor calls reset() so we have to provide a
+ // fake value here temorarily which we then replace with the user
+ // specified seed by calling reset() again in our own constructor
+ return this.seed == null ? UUID.randomUUID() : this.seed;
}
}
Modified:
jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/BlankNodeAllocatorHash.java
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/BlankNodeAllocatorHash.java?rev=1543489&r1=1543488&r2=1543489&view=diff
==============================================================================
---
jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/BlankNodeAllocatorHash.java
(original)
+++
jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/BlankNodeAllocatorHash.java
Tue Nov 19 16:48:07 2013
@@ -78,6 +78,19 @@ public class BlankNodeAllocatorHash impl
/**
* Gets a fresh seed value
+ * <p>
+ * Note that this is called almost immediately by the constructor
+ * and on this initial call you will not yet have access to any
+ * implementation specific information used to select the seed.
+ * </p>
+ * <p>
+ * Implementations <strong>must</strong> return a non-null value
+ * so if you can't decide a seed prior to seeing your derived
+ * implementations constructor inputs you should return a temporary
+ * fake value initially. You can then call {@link #reset()} in your
+ * own constructor after you've taken the necessary steps that allow
+ * you to decide how to generate your own seed.
+ * </p>
* @return Seed value
*/
protected UUID freshSeed() {