[MediaWiki-commits] [Gerrit] Remove MWException use from UIDGenerator - change (mediawiki/core)

2015-11-25 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Remove MWException use from UIDGenerator
..


Remove MWException use from UIDGenerator

Change-Id: Ib0ad346c6c8c4f515b388f63840db4a03b99facb
---
M includes/utils/UIDGenerator.php
1 file changed, 22 insertions(+), 21 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/utils/UIDGenerator.php b/includes/utils/UIDGenerator.php
index f6f3c5f..10e4334 100644
--- a/includes/utils/UIDGenerator.php
+++ b/includes/utils/UIDGenerator.php
@@ -82,6 +82,7 @@
}
 
/**
+* @todo: move to MW-specific factory class and inject temp dir
 * @return UIDGenerator
 */
protected static function singleton() {
@@ -105,7 +106,7 @@
 *
 * @param int $base Specifies a base other than 10
 * @return string Number
-* @throws MWException
+* @throws RuntimeException
 */
public static function newTimestampedUID88( $base = 10 ) {
Assert::parameterType( 'integer', $base, '$base' );
@@ -121,7 +122,7 @@
/**
 * @param array $info (UIDGenerator::millitime(), counter, clock 
sequence)
 * @return string 88 bits
-* @throws MWException
+* @throws RuntimeException
 */
protected function getTimestampedID88( array $info ) {
list( $time, $counter ) = $info;
@@ -133,7 +134,7 @@
$id_bin .= $this->nodeId32;
// Convert to a 1-27 digit integer string
if ( strlen( $id_bin ) !== 88 ) {
-   throw new MWException( "Detected overflow for 
millisecond timestamp." );
+   throw new RuntimeException( "Detected overflow for 
millisecond timestamp." );
}
 
return $id_bin;
@@ -151,7 +152,7 @@
 *
 * @param int $base Specifies a base other than 10
 * @return string Number
-* @throws MWException
+* @throws RuntimeException
 */
public static function newTimestampedUID128( $base = 10 ) {
Assert::parameterType( 'integer', $base, '$base' );
@@ -167,7 +168,7 @@
/**
 * @param array $info (UIDGenerator::millitime(), counter, clock 
sequence)
 * @return string 128 bits
-* @throws MWException
+* @throws RuntimeException
 */
protected function getTimestampedID128( array $info ) {
list( $time, $counter, $clkSeq ) = $info;
@@ -181,7 +182,7 @@
$id_bin .= $this->nodeId48;
// Convert to a 1-39 digit integer string
if ( strlen( $id_bin ) !== 128 ) {
-   throw new MWException( "Detected overflow for 
millisecond timestamp." );
+   throw new RuntimeException( "Detected overflow for 
millisecond timestamp." );
}
 
return $id_bin;
@@ -192,7 +193,7 @@
 *
 * @param int $flags Bitfield (supports UIDGenerator::QUICK_RAND)
 * @return string
-* @throws MWException
+* @throws RuntimeException
 */
public static function newUUIDv4( $flags = 0 ) {
$hex = ( $flags & self::QUICK_RAND )
@@ -218,7 +219,7 @@
 *
 * @param int $flags Bitfield (supports UIDGenerator::QUICK_RAND)
 * @return string 32 hex characters with no hyphens
-* @throws MWException
+* @throws RuntimeException
 */
public static function newRawUUIDv4( $flags = 0 ) {
return str_replace( '-', '', self::newUUIDv4( $flags ) );
@@ -265,15 +266,15 @@
 * @param int $count Number of IDs to return (1 to 1)
 * @param int $flags (supports UIDGenerator::QUICK_VOLATILE)
 * @return array Ordered list of float integer values
-* @throws MWException
+* @throws RuntimeException
 */
protected function getSequentialPerNodeIDs( $bucket, $bits, $count, 
$flags ) {
if ( $count <= 0 ) {
return array(); // nothing to do
} elseif ( $count > 1 ) {
-   throw new MWException( "Number of requested IDs 
($count) is too high." );
+   throw new RuntimeException( "Number of requested IDs 
($count) is too high." );
} elseif ( $bits < 16 || $bits > 48 ) {
-   throw new MWException( "Requested bit size ($bits) is 
out of range." );
+   throw new RuntimeException( "Requested bit size ($bits) 
is out of range." );
}
 
$counter = null; // post-increment persistent counter value
@@ -288,7 +289,7 @@
$counter = $cache->incr( $bucket, $count );
if ( $counter === false ) {
   

[MediaWiki-commits] [Gerrit] Remove MWException use from UIDGenerator - change (mediawiki/core)

2015-11-24 Thread Aaron Schulz (Code Review)
Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/255285

Change subject: Remove MWException use from UIDGenerator
..

Remove MWException use from UIDGenerator

Change-Id: Ib0ad346c6c8c4f515b388f63840db4a03b99facb
---
M includes/utils/UIDGenerator.php
1 file changed, 22 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/85/255285/1

diff --git a/includes/utils/UIDGenerator.php b/includes/utils/UIDGenerator.php
index f6f3c5f..10e4334 100644
--- a/includes/utils/UIDGenerator.php
+++ b/includes/utils/UIDGenerator.php
@@ -82,6 +82,7 @@
}
 
/**
+* @todo: move to MW-specific factory class and inject temp dir
 * @return UIDGenerator
 */
protected static function singleton() {
@@ -105,7 +106,7 @@
 *
 * @param int $base Specifies a base other than 10
 * @return string Number
-* @throws MWException
+* @throws RuntimeException
 */
public static function newTimestampedUID88( $base = 10 ) {
Assert::parameterType( 'integer', $base, '$base' );
@@ -121,7 +122,7 @@
/**
 * @param array $info (UIDGenerator::millitime(), counter, clock 
sequence)
 * @return string 88 bits
-* @throws MWException
+* @throws RuntimeException
 */
protected function getTimestampedID88( array $info ) {
list( $time, $counter ) = $info;
@@ -133,7 +134,7 @@
$id_bin .= $this->nodeId32;
// Convert to a 1-27 digit integer string
if ( strlen( $id_bin ) !== 88 ) {
-   throw new MWException( "Detected overflow for 
millisecond timestamp." );
+   throw new RuntimeException( "Detected overflow for 
millisecond timestamp." );
}
 
return $id_bin;
@@ -151,7 +152,7 @@
 *
 * @param int $base Specifies a base other than 10
 * @return string Number
-* @throws MWException
+* @throws RuntimeException
 */
public static function newTimestampedUID128( $base = 10 ) {
Assert::parameterType( 'integer', $base, '$base' );
@@ -167,7 +168,7 @@
/**
 * @param array $info (UIDGenerator::millitime(), counter, clock 
sequence)
 * @return string 128 bits
-* @throws MWException
+* @throws RuntimeException
 */
protected function getTimestampedID128( array $info ) {
list( $time, $counter, $clkSeq ) = $info;
@@ -181,7 +182,7 @@
$id_bin .= $this->nodeId48;
// Convert to a 1-39 digit integer string
if ( strlen( $id_bin ) !== 128 ) {
-   throw new MWException( "Detected overflow for 
millisecond timestamp." );
+   throw new RuntimeException( "Detected overflow for 
millisecond timestamp." );
}
 
return $id_bin;
@@ -192,7 +193,7 @@
 *
 * @param int $flags Bitfield (supports UIDGenerator::QUICK_RAND)
 * @return string
-* @throws MWException
+* @throws RuntimeException
 */
public static function newUUIDv4( $flags = 0 ) {
$hex = ( $flags & self::QUICK_RAND )
@@ -218,7 +219,7 @@
 *
 * @param int $flags Bitfield (supports UIDGenerator::QUICK_RAND)
 * @return string 32 hex characters with no hyphens
-* @throws MWException
+* @throws RuntimeException
 */
public static function newRawUUIDv4( $flags = 0 ) {
return str_replace( '-', '', self::newUUIDv4( $flags ) );
@@ -265,15 +266,15 @@
 * @param int $count Number of IDs to return (1 to 1)
 * @param int $flags (supports UIDGenerator::QUICK_VOLATILE)
 * @return array Ordered list of float integer values
-* @throws MWException
+* @throws RuntimeException
 */
protected function getSequentialPerNodeIDs( $bucket, $bits, $count, 
$flags ) {
if ( $count <= 0 ) {
return array(); // nothing to do
} elseif ( $count > 1 ) {
-   throw new MWException( "Number of requested IDs 
($count) is too high." );
+   throw new RuntimeException( "Number of requested IDs 
($count) is too high." );
} elseif ( $bits < 16 || $bits > 48 ) {
-   throw new MWException( "Requested bit size ($bits) is 
out of range." );
+   throw new RuntimeException( "Requested bit size ($bits) 
is out of range." );
}
 
$counter = null; // post-increment persistent counter value
@@ -288,7 +289,7 @@
$counter = $cache->incr( $bucket, $count );
if (