Skip to content

Commit

Permalink
Remove references to Assertion and AssertionUtil
Browse files Browse the repository at this point in the history
* Replaces references with CoreArgCheck
  • Loading branch information
Paul Richardson committed Dec 7, 2012
1 parent 3141bb0 commit 8a97fe9
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 486 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
package org.teiid.core.designer.id;

import java.io.Serializable;

import org.teiid.core.util.Assertion;
import org.teiid.core.designer.util.CoreArgCheck;


/**
Expand Down Expand Up @@ -90,7 +89,7 @@ public boolean equals(Object obj) {
@Override
public int compareTo(Object obj) {
IntegerID that = (IntegerID) obj; // May throw ClassCastException
Assertion.isNotNull(obj);
CoreArgCheck.isNotNull(obj);

long diff = this.id - that.id;
if ( diff < 0 ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
package org.teiid.core.designer.id;

import java.io.Serializable;

import org.teiid.core.util.Assertion;
import org.teiid.core.designer.util.CoreArgCheck;


/**
Expand Down Expand Up @@ -90,7 +89,7 @@ public boolean equals(Object obj) {
@Override
public int compareTo(Object obj) {
LongID that = (LongID) obj; // May throw ClassCastException
Assertion.isNotNull(obj);
CoreArgCheck.isNotNull(obj);

long diff = this.id - that.id;
if ( diff < 0 ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
package org.teiid.core.designer.id;

import java.io.Serializable;

import org.teiid.core.util.Assertion;
import org.teiid.core.designer.util.CoreArgCheck;


/**
Expand Down Expand Up @@ -93,7 +92,8 @@ public boolean equals(Object obj) {
@Override
public int compareTo(Object obj) {
StringID that = (StringID) obj; // May throw ClassCastException
Assertion.isNotNull(obj);
CoreArgCheck.isNotNull(obj);

return this.id.compareTo(that.id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import java.io.Serializable;
import org.teiid.core.designer.CoreModelerPlugin;
import org.teiid.core.util.Assertion;
import org.teiid.core.designer.util.CoreArgCheck;


/**
Expand Down Expand Up @@ -82,8 +82,8 @@ public UUID(java.util.UUID uuid) {
* @return first part of the UUID as a long
*/
public static long getPart1(ObjectID id) {
Assertion.assertTrue((id instanceof UUID), UNPARSABLE_MESSAGE);
CoreArgCheck.isInstanceOf(UUID.class, id, UNPARSABLE_MESSAGE);

UUID uuid = (UUID)id;
return uuid.uuid.getMostSignificantBits();
}
Expand All @@ -93,22 +93,22 @@ public static long getPart1(ObjectID id) {
* @return first part of the UUID as a long
*/
public static long getPart2(ObjectID id) {
Assertion.assertTrue((id instanceof UUID), UNPARSABLE_MESSAGE);
CoreArgCheck.isInstanceOf(UUID.class, id, UNPARSABLE_MESSAGE);

UUID uuid = (UUID)id;
return uuid.uuid.getLeastSignificantBits();
}

public static int getVariant(ObjectID id ) {
Assertion.assertTrue((id instanceof UUID), NOT_UUID_MESSAGE);
CoreArgCheck.isInstanceOf(UUID.class, id, NOT_UUID_MESSAGE);

UUID uuid = (UUID)id;
return uuid.uuid.variant();
}

public static int getVersion(ObjectID id ) {
Assertion.assertTrue((id instanceof UUID), NOT_UUID_MESSAGE);
CoreArgCheck.isInstanceOf(UUID.class, id, NOT_UUID_MESSAGE);

UUID uuid = (UUID)id;
return uuid.uuid.version();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1105,8 +1105,8 @@ protected void processReferenceValue( final Resource eResource,
}

// protected URI getAbsoluteLocation(final URI baseLocationUri, final String location) {
// Assertion.isNotNull(baseLocationUri);
// Assertion.isNotNull(location);
// CoreArgCheck.isNotNull(baseLocationUri);
// CoreArgCheck.isNotNull(location);
//
// // If the base resource URI was created as a file URI then it's path is encoded so before we
// // resolve the referenced resource we need to encode it's relative path
Expand All @@ -1115,8 +1115,8 @@ protected void processReferenceValue( final Resource eResource,
// }
//
// protected URI getAbsoluteLocation(final URI baseLocationUri, final URI relativeLocationUri) {
// Assertion.isNotNull(baseLocationUri);
// Assertion.isNotNull(relativeLocationUri);
// CoreArgCheck.isNotNull(baseLocationUri);
// CoreArgCheck.isNotNull(relativeLocationUri);
//
// URI locationUri = relativeLocationUri;
// if (baseLocationUri.isHierarchical() && !baseLocationUri.isRelative() && locationUri.isRelative()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ protected void performExecute( final Context context,
// // if ( parentNode != null ) {
// // // Find the existing(!) model object that corresponds to the parent
// // parent = (RelationalEntity)nodesToModelObjects.get(parentNode);
// // Assertion.isNotNull(parent);
// // CoreArgCheck.isNotNull(parent);
// // }
// //
// // // Create the real object ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
import org.teiid.core.designer.util.CoreArgCheck;
import org.teiid.core.designer.util.CoreStringUtil;
import org.teiid.core.designer.util.FileUtils;
import org.teiid.core.util.Assertion;
import org.teiid.designer.core.util.AssertionUtil;
import org.teiid.designer.core.util.FileUtil;
import org.teiid.designer.core.util.TempDirectory;
import org.teiid.designer.metadata.runtime.RuntimeMetadataPlugin;
Expand Down Expand Up @@ -81,7 +79,8 @@ public class RuntimeIndexSelector extends AbstractIndexSelector {
public RuntimeIndexSelector( final String filePath ) {
CoreArgCheck.isNotNull(filePath);
this.vdbFile = new File(filePath);
Assertion.assertTrue(this.vdbFile.exists(), "No file/directory exists at the given location " + filePath); //$NON-NLS-1$

CoreArgCheck.isTrue(this.vdbFile.exists(), "No file/directory exists at the given location " + filePath); //$NON-NLS-1$
checkForValidFile();
}

Expand Down Expand Up @@ -110,7 +109,7 @@ public RuntimeIndexSelector( final String vdbName,

private void checkForValidFile() {
if (this.vdbFile.isFile()) {
Assertion.assertTrue(checkValidType(this.vdbFile),
CoreArgCheck.isTrue(checkValidType(this.vdbFile),
"Invalid file type, expected an archive file or an index file " + vdbFile); //$NON-NLS-1$
}
}
Expand Down Expand Up @@ -503,7 +502,7 @@ public InputStream getFileContent( final String path,
final String[] tokenReplacements ) {
CoreArgCheck.isNotNull(tokens);
CoreArgCheck.isNotNull(tokenReplacements);
AssertionUtil.isEqual(tokens.length, tokenReplacements.length);
CoreArgCheck.isEqual(tokens.length, tokenReplacements.length);
String fileContents = getFileContentAsString(path);
if (fileContents != null) {
for (int i = 0; i < tokens.length; i++) {
Expand Down

0 comments on commit 8a97fe9

Please sign in to comment.