Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

fixed some small bugs #37

Closed
wants to merge 4 commits into from

1 participant

Commits on Mar 13, 2012
  1. @lufeng1102
  2. @lufeng1102

    check the mongodb input uri

    lufeng1102 authored
  3. @lufeng1102
Commits on Mar 15, 2012
  1. @lufeng1102
This page is out of date. Refresh to see the latest.
View
2  core/src/main/java/com/mongodb/hadoop/input/MongoInputSplit.java
@@ -163,7 +163,7 @@ public String toString(){
return "MongoInputSplit{URI=" + _mongoURI + ", keyField=" + _keyField + ", query=" + _querySpec + ", sort=" + _sortSpec + ", fields=" + _fieldSpec + '}';
}
- public MongoInputSplit(){ }
+ MongoInputSplit(){ }
public MongoURI getMongoURI(){
return _mongoURI;
View
8 core/src/main/java/com/mongodb/hadoop/util/MongoConfigUtil.java
@@ -277,8 +277,10 @@ public static DBCollection getCollection( MongoURI uri ){
}
public static DBCollection getOutputCollection( Configuration conf ){
- try {
- final MongoURI _uri = getOutputURI( conf );
+ final MongoURI _uri = getOutputURI( conf );
+ if(_uri == null)
+ throw new IllegalArgumentException("Please set mongodb output uri.");
+ try{
return getCollection( _uri );
}
catch ( final Exception e ) {
@@ -471,7 +473,7 @@ public static boolean canReadSplitsFromSecondary( Configuration conf ) {
}
public static void setReadSplitsFromSecondary( Configuration conf, boolean value ) {
- conf.getBoolean( SPLITS_SLAVE_OK, value );
+ conf.setBoolean( SPLITS_SLAVE_OK, value );
}
public static boolean createInputSplits( Configuration conf ) {
View
3  core/src/main/java/com/mongodb/hadoop/util/MongoSplitter.java
@@ -40,6 +40,9 @@
* split; Actual querying will be done on the individual mappers.
*/
MongoURI uri = conf.getInputURI();
+
+ if(uri == null)
+ throw new IllegalArgumentException(" Please set the mongodb input uri.");
Mongo mongo;
try {
mongo = uri.connect();
Something went wrong with that request. Please try again.