#include <string>
#include <stdexcept>
+#include <new>
#include "glite/jobid/cjobid.h"
* \param[in] exception Error message describing the exception.
*/
std::string formatMessage(std::string const& exception) {
- std::ostringstream o;
-
- o << "JobId: bad argument ( " << exception << ")";
- return o.str();
+ return std::string("JobId: bad argument ( ") + exception + ")";
}
};
//@name Constructors/Destructor
//@{
- /**
- * Default constructor; creates a jobid of the form
- * https://localhost:<port>/<unique>
- * useful for internal processing.
- */
- JobId();
-
/**
* Constructor from string format.
* @param job_id_string
throw JobIdError(job_id_string);
case ENOMEM:
- throw std::bad_alloc;
+ throw std::bad_alloc();
default:
+ break;
}
}
throw JobIdError("negative port");
}
- int ret = glite_jobid_create(host.c_str(), port,
- unique.empty() ? NULL : unique.c_str(),
- &m_jobid);
+ int ret = glite_jobid_recreate(host.c_str(), port,
+ unique.empty() ? NULL : unique.c_str(),
+ &m_jobid);
switch(ret) {
case EINVAL:
- throw JobIdError(host);
-
+ throw JobIdError(host);
+
case ENOMEM:
- throw std::bad_alloc;
+ throw std::bad_alloc();
default:
+ break;
}
}
int ret = glite_jobid_dup(src.m_jobid,
&m_jobid);
if(ret) {
- throw std::bad_alloc;
+ throw std::bad_alloc();
}
}
int ret = glite_jobid_dup(src,
&m_jobid);
if(ret) {
- throw std::bad_alloc;
+ throw std::bad_alloc();
}
}
int ret = glite_jobid_dup(src.m_jobid,
&m_jobid);
if(ret) {
- throw std::bad_alloc;
+ throw std::bad_alloc();
}
return *this;
}
char *name;
unsigned int port;
- glite_jobid_getServerParts_internal(m_jobid.
+ glite_jobid_getServerParts_internal(m_jobid,
&name, &port);
return port;
}
char *unique = glite_jobid_getUnique_internal(m_jobid);
std::string res(unique);
- free(unique);
return res;
}