Skip to content

Commit

Permalink
Use CoreArgCheck instead of ArgCheck
Browse files Browse the repository at this point in the history
* Replaces all uses of the teiid class ArgCheck with the designer class
  CoreArgCheck.
  • Loading branch information
Paul Richardson committed Oct 12, 2012
1 parent 9ef78ae commit 53fe9d8
Show file tree
Hide file tree
Showing 22 changed files with 201 additions and 201 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@ PluginUtilImpl.Error_while_running=Error while executing runnable from plugin {0
I18nUtil.The_object_reference_may_not_be_null=The object reference may not be null
UserCancelledException.User_cancelled_operation_msg=User canceled operation

ArgCheck.isNonNegativeInt=Expected argument to be non-negative but argument= {0}
ArgCheck.isNonPositiveInt=Expected argument to be non-positive but argument= {0}
ArgCheck.isNegativeInt=Expected argument to be negative but argument= {0}
ArgCheck.isPositiveInt=Expected argument to be positive but argument= {0}
ArgCheck.isStringNonZeroLength=Expected argument to have at least one character
ArgCheck.isNonNull=Expected argument to be non-null but got null
ArgCheck.isNull=Expected argument to be null but got non-null
ArgCheck.isInstanceOf=Expected argument to be an instance of {0}; was instance of {1}
ArgCheck.isCollectionNotEmpty=Expected collection to be non-empty
ArgCheck.isPropertiesNotEmpty=Expected properties to be non-empty
ArgCheck.isMapNotEmpty=Expected map to be non-empty
ArgCheck.isArrayNotEmpty=Expected array to be non-empty
ArgCheck.isNotSame={0} must not be the same as {1}.
ArgCheck.contains=Expected collection to contain value, but it did not
ArgCheck.containsKey=Expected map to contain key, but it did not
CoreArgCheck.isNonNegativeInt=Expected argument to be non-negative but argument= {0}
CoreArgCheck.isNonPositiveInt=Expected argument to be non-positive but argument= {0}
CoreArgCheck.isNegativeInt=Expected argument to be negative but argument= {0}
CoreArgCheck.isPositiveInt=Expected argument to be positive but argument= {0}
CoreArgCheck.isStringNonZeroLength=Expected argument to have at least one character
CoreArgCheck.isNonNull=Expected argument to be non-null but got null
CoreArgCheck.isNull=Expected argument to be null but got non-null
CoreArgCheck.isInstanceOf=Expected argument to be an instance of {0}; was instance of {1}
CoreArgCheck.isCollectionNotEmpty=Expected collection to be non-empty
CoreArgCheck.isPropertiesNotEmpty=Expected properties to be non-empty
CoreArgCheck.isMapNotEmpty=Expected map to be non-empty
CoreArgCheck.isArrayNotEmpty=Expected array to be non-empty
CoreArgCheck.isNotSame={0} must not be the same as {1}.
CoreArgCheck.contains=Expected collection to contain value, but it did not
CoreArgCheck.containsKey=Expected map to contain key, but it did not

FileUtils.The_name_of_the_file_may_not_be_null=The name of the file may not be null
FileUtils.The_file_extension_may_not_be_null=The file extension may not be null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static final void isNonNegative( int value ) {
public static final void isNonNegative( int value,
String message ) {
if (value < 0) {
final String msg = message != null ? message : CoreModelerPlugin.Util.getString("ArgCheck.isNonNegativeInt"); //$NON-NLS-1$
final String msg = message != null ? message : CoreModelerPlugin.Util.getString("CoreArgCheck.isNonNegativeInt"); //$NON-NLS-1$
throw new IllegalArgumentException(msg);
}
}
Expand All @@ -87,7 +87,7 @@ public static final void isPositive( int value ) {
public static final void isPositive( int value,
String message ) {
if (value <= 0) {
final String msg = message != null ? message : CoreModelerPlugin.Util.getString("ArgCheck.isPositiveInt"); //$NON-NLS-1$
final String msg = message != null ? message : CoreModelerPlugin.Util.getString("CoreArgCheck.isPositiveInt"); //$NON-NLS-1$
throw new IllegalArgumentException(msg);
}
}
Expand All @@ -113,7 +113,7 @@ public static final void isNotZeroLength( String value,
String message ) {
isNotNull(value);
if (value.length() <= 0) {
final String msg = message != null ? message : CoreModelerPlugin.Util.getString("ArgCheck.isStringNonZeroLength"); //$NON-NLS-1$
final String msg = message != null ? message : CoreModelerPlugin.Util.getString("CoreArgCheck.isStringNonZeroLength"); //$NON-NLS-1$
throw new IllegalArgumentException(msg);
}
}
Expand All @@ -138,7 +138,7 @@ public static final void isNotNull( Object value ) {
public static final void isNotNull( Object value,
String message ) {
if (value == null) {
final String msg = message != null ? message : CoreModelerPlugin.Util.getString("ArgCheck.isNonNull"); //$NON-NLS-1$
final String msg = message != null ? message : CoreModelerPlugin.Util.getString("CoreArgCheck.isNonNull"); //$NON-NLS-1$
throw new IllegalArgumentException(msg);
}
}
Expand Down Expand Up @@ -168,7 +168,7 @@ public static final void isInstanceOf( Class theClass,
String message ) {
isNotNull(value);
if (!theClass.isInstance(value)) {
final String msg = message != null ? message : CoreModelerPlugin.Util.getString("ArgCheck.isInstanceOf", theClass.getName(), value.getClass().getName()); //$NON-NLS-1$
final String msg = message != null ? message : CoreModelerPlugin.Util.getString("CoreArgCheck.isInstanceOf", theClass.getName(), value.getClass().getName()); //$NON-NLS-1$
throw new IllegalArgumentException(msg);
}
}
Expand All @@ -194,7 +194,7 @@ public static final void isNotEmpty( Collection collection,
String message ) {
isNotNull(collection);
if (collection.isEmpty()) {
final String msg = message != null ? message : CoreModelerPlugin.Util.getString("ArgCheck.isCollectionNotEmpty"); //$NON-NLS-1$
final String msg = message != null ? message : CoreModelerPlugin.Util.getString("CoreArgCheck.isCollectionNotEmpty"); //$NON-NLS-1$
throw new IllegalArgumentException(msg);
}
}
Expand All @@ -220,7 +220,7 @@ public static final void isNotEmpty( Properties properties,
String message ) {
isNotNull(properties);
if (properties.isEmpty()) {
final String msg = message != null ? message : CoreModelerPlugin.Util.getString("ArgCheck.isPropertiesNotEmpty"); //$NON-NLS-1$
final String msg = message != null ? message : CoreModelerPlugin.Util.getString("CoreArgCheck.isPropertiesNotEmpty"); //$NON-NLS-1$
throw new IllegalArgumentException(msg);
}
}
Expand Down Expand Up @@ -274,7 +274,7 @@ public static final void contains( Collection collection,
String message ) {
isNotNull(collection);
if (!collection.contains(value)) {
final String msg = message != null ? message : CoreModelerPlugin.Util.getString("ArgCheck.contains"); //$NON-NLS-1$
final String msg = message != null ? message : CoreModelerPlugin.Util.getString("CoreArgCheck.contains"); //$NON-NLS-1$
throw new IllegalArgumentException(msg);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import net.sf.saxon.sxpath.XPathExpression;
import net.sf.saxon.trans.XPathException;

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


/**
Expand Down Expand Up @@ -68,8 +68,8 @@ public static String getSingleMatchAsString(Reader documentReader, String xpath)
* @since 4.2
*/
public static Object getSingleMatch(Reader documentReader, String xpath) throws XPathException, IOException {
ArgCheck.isNotNull(documentReader);
ArgCheck.isNotNull(xpath);
CoreArgCheck.isNotNull(documentReader);
CoreArgCheck.isNotNull(xpath);

try {
Source s = new StreamSource(documentReader);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ public synchronized static Registry getRegistry() {
// * @return the Container in which the model object is loaded, or null if the model object is not loaded in a Container.
// */
// public static Container getContainer(final EObject modelObject) {
// ArgCheck.isNotNull(modelObject);
// CoreArgCheck.isNotNull(modelObject);
// final Resource rsrc = modelObject.eResource();
// if(rsrc )
// return ProxyUtilities.getContainer(modelObject);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ public String getPrimaryMetaModelUri(EObject eObject) {
// * @See org.teiid.designer.core.metamodel.aspect.ImportsAspect#setModelPath(org.eclipse.emf.ecore.EObject, org.eclipse.core.runtime.IPath)
// */
// public void setModelPath(EObject eObject, IPath modelPath) {
// ArgCheck.isInstanceOf(ModelImport.class, eObject);
// ArgCheck.isNotNull(modelPath);
// CoreArgCheck.isInstanceOf(ModelImport.class, eObject);
// CoreArgCheck.isNotNull(modelPath);
// // the modelImport object
// ModelImport modelImport = (ModelImport) eObject;
// modelImport.setPath(modelPath.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ protected ModelWorkspaceItemImpl( final int type,
throw new IllegalArgumentException(ModelerCore.Util.getString("element.invalidType")); //$NON-NLS-1$
}

// ArgCheck.isNotNull(name); // Should be done in subclasses, not here
// ArgCheck.isNotZeroLength(name); // Should be done in subclasses, not here
// CoreArgCheck.isNotNull(name); // Should be done in subclasses, not here
// CoreArgCheck.isNotZeroLength(name); // Should be done in subclasses, not here
fType = type;
fParent = (ModelWorkspaceItemImpl)parent;
fName = name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public DdlOptions getOptions() {
// * @see DdlWriter#setOptions(DdlOptions)
// */
// public void setOptions(final DdlOptions options) {
// ArgCheck.isNotNull(options);
// CoreArgCheck.isNotNull(options);
// this.options = options;
// }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.xml.sax.helpers.DefaultHandler;
import org.teiid.core.designer.TeiidDesignerException;
import org.teiid.core.designer.TeiidDesignerRuntimeException;
import org.teiid.core.util.ArgCheck;
import org.teiid.core.designer.util.CoreArgCheck;

/**
* @since 8.0
Expand Down Expand Up @@ -238,8 +238,8 @@ private static InputStream getManifestStreamFromVdbArchive( final ZipFile zipFil
*/
private static InputStream getEntryStreamFromArchive( final ZipFile zipFile,
final String zipEntryName ) {
ArgCheck.isNotNull(zipFile);
ArgCheck.isNotEmpty(zipEntryName);
CoreArgCheck.isNotNull(zipFile);
CoreArgCheck.isNotEmpty(zipEntryName);

// the zip file that would be initialized if the file being read is an archive
try {
Expand Down

0 comments on commit 53fe9d8

Please sign in to comment.