本文整理汇总了Java中java.io.IOException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java IOException.getMessage方法的具体用法?Java IOException.getMessage怎么用?Java IOException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.IOException
的用法示例。
在下文中一共展示了IOException.getMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processPath
import java.io.IOException; //导入方法依赖的package包/类
@Override
protected void processPath(PathData item) throws IOException {
//Should we do case insensitive match?
String newOwner = (owner == null || owner.equals(item.stat.getOwner())) ?
null : owner;
String newGroup = (group == null || group.equals(item.stat.getGroup())) ?
null : group;
if (newOwner != null || newGroup != null) {
try {
item.fs.setOwner(item.path, newOwner, newGroup);
} catch (IOException e) {
LOG.debug("Error changing ownership of " + item, e);
throw new IOException(
"changing ownership of '" + item + "': " + e.getMessage());
}
}
}
示例2: getForfeitInfoById
import java.io.IOException; //导入方法依赖的package包/类
public String getForfeitInfoById(){
HttpServletResponse response = ServletActionContext.getResponse();
response.setContentType("application/json;charset=utf-8");
ForfeitInfo forfeitInfo = new ForfeitInfo();
forfeitInfo.setBorrowId(borrowId);
ForfeitInfo newForfeitInfo = forfeitService.getForfeitInfoById(forfeitInfo);
JsonConfig jsonConfig = new JsonConfig();
jsonConfig.setJsonPropertyFilter(new PropertyFilter() {
public boolean apply(Object obj, String name, Object value) {
if(obj instanceof Authorization||name.equals("authorization") || obj instanceof Set || name.equals("borrowInfos")){
return true;
}else{
return false;
}
}
});
JSONObject jsonObject = JSONObject.fromObject(newForfeitInfo,jsonConfig);
try {
response.getWriter().print(jsonObject);
} catch (IOException e) {
throw new RuntimeException(e.getMessage());
}
return null;
}
示例3: handle
import java.io.IOException; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public List<JuiceTask> handle(String requestUrl) {
Map<String, String> map = getTaskIdsStr(taskIdList);
Result<List<JuiceTask>> result = null;
try {
result = Restty.create(requestUrl, map)
.addMediaType(Restty.jsonBody())
.get(new ParameterTypeReference<Result<List<JuiceTask>>>() {
});
} catch (IOException e) {
throw new JuiceClientException(ErrorCode.HTTP_REQUEST_ERROR.getCode(), e.getMessage());
}
return result != null ? result.getData() : null;
}
示例4: copy
import java.io.IOException; //导入方法依赖的package包/类
/** Used by child copy constructors. */
protected synchronized void copy(Writable other) {
if (other != null) {
try {
DataOutputBuffer out = new DataOutputBuffer();
other.write(out);
DataInputBuffer in = new DataInputBuffer();
in.reset(out.getData(), out.getLength());
readFields(in);
} catch (IOException e) {
throw new IllegalArgumentException("map cannot be copied: " +
e.getMessage());
}
} else {
throw new IllegalArgumentException("source map cannot be null");
}
}
示例5: submitRemote
import java.io.IOException; //导入方法依赖的package包/类
private void submitRemote(ThreePidSession session, String token) {
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(
Arrays.asList(
new BasicNameValuePair("sid", session.getRemoteId()),
new BasicNameValuePair("client_secret", session.getRemoteSecret()),
new BasicNameValuePair("token", token)
), StandardCharsets.UTF_8);
HttpPost submitReq = new HttpPost(session.getRemoteServer() + "/_matrix/identity/api/v1/submitToken");
submitReq.setEntity(entity);
try (CloseableHttpResponse response = client.execute(submitReq)) {
JsonObject o = new GsonParser().parse(response.getEntity().getContent());
if (!o.has("success") || !o.get("success").getAsBoolean()) {
String errcode = o.get("errcode").getAsString();
throw new RemoteIdentityServerException(errcode + ": " + o.get("error").getAsString());
}
log.info("Successfully submitted validation token for {} to {}", session.getThreePid(), session.getRemoteServer());
} catch (IOException e) {
throw new RemoteIdentityServerException(e.getMessage());
}
}
示例6: writeBinaryStream
import java.io.IOException; //导入方法依赖的package包/类
/**
* Writes a stream of uninterpreted bytes to this <code>SQLOutputImpl</code>
* object.
*
* @param x the value to pass to the database
* @throws SQLException if the <code>SQLOutputImpl</code> object is in
* use by a <code>SQLData</code> object attempting to write the attribute
* values of a UDT to the database.
*/
@SuppressWarnings("unchecked")
public void writeBinaryStream(java.io.InputStream x) throws SQLException {
BufferedReader bufReader = new BufferedReader(new InputStreamReader(x));
try {
int i;
while( (i=bufReader.read()) != -1 ) {
char ch = (char)i;
StringBuffer strBuf = new StringBuffer();
strBuf.append(ch);
String str = new String(strBuf);
String strLine = bufReader.readLine();
writeString(str.concat(strLine));
}
} catch(IOException ioe) {
throw new SQLException(ioe.getMessage());
}
}
示例7: getCharacterCrafting
import java.io.IOException; //导入方法依赖的package包/类
/**
* For more info on character crafting API go <a href="https://wiki.guildwars2.com/wiki/API:2/characters#Crafting">here</a><br/>
*
* @param API API key
* @param name name of character
* @return list of character crafting info
* @throws GuildWars2Exception see {@link ErrorCode} for detail
* @see CharacterCraftingLevel character crafting info
*/
public CharacterCraftingLevel getCharacterCrafting(String API, String name) throws GuildWars2Exception {
isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name));
try {
Response<CharacterCraftingLevel> response = gw2API.getCharacterCrafting(name, API).execute();
if (!response.isSuccessful()) throwError(response.code(), response.errorBody());
return response.body();
} catch (IOException e) {
throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage());
}
}
示例8: serialize
import java.io.IOException; //导入方法依赖的package包/类
public static <T> byte[] serialize(T obj){
ByteArrayOutputStream os = new ByteArrayOutputStream();
HessianOutput ho = new HessianOutput(os);
try {
ho.writeObject(obj);
} catch (IOException e) {
throw new IllegalStateException(e.getMessage(), e);
}
return os.toByteArray();
}
示例9: exchange
import java.io.IOException; //导入方法依赖的package包/类
@Override
public TokenResponseAttributes exchange(
AuthorizationCodeAuthenticationToken authorizationCodeAuthenticationToken)
throws OAuth2AuthenticationException {
ClientRegistration clientRegistration = authorizationCodeAuthenticationToken.getClientRegistration();
AuthorizationCode authorizationCode = new AuthorizationCode(
authorizationCodeAuthenticationToken.getAuthorizationCode());
AuthorizationGrant authorizationCodeGrant = new AuthorizationCodeGrant(
authorizationCode, URI.create(clientRegistration.getRedirectUri()));
URI tokenUri = URI.create(clientRegistration.getProviderDetails().getTokenUri());
ClientID clientId = new ClientID(clientRegistration.getClientId());
Secret clientSecret = new Secret(clientRegistration.getClientSecret());
ClientAuthentication clientAuthentication = new ClientSecretGet(clientId, clientSecret);
try {
HTTPRequest httpRequest = createTokenRequest(
clientRegistration, authorizationCodeGrant,
tokenUri, clientAuthentication);
TokenResponse tokenResponse = TokenResponse.parse(httpRequest.send());
if (!tokenResponse.indicatesSuccess()) {
OAuth2Error errorObject = new OAuth2Error("invalid_token_response");
throw new OAuth2AuthenticationException(errorObject, "error");
}
return createTokenResponse((AccessTokenResponse) tokenResponse);
} catch (MalformedURLException e) {
throw new SerializeException(e.getMessage(), e);
} catch (ParseException pe) {
throw new OAuth2AuthenticationException(new OAuth2Error("invalid_token_response"), pe);
} catch (IOException ioe) {
throw new AuthenticationServiceException(
"An error occurred while sending the Access Token Request: " +
ioe.getMessage(), ioe);
}
}
开发者ID:PacktPublishing,项目名称:OAuth-2.0-Cookbook,代码行数:43,代码来源:FacebookAuthorizationGrantTokenExchanger.java
示例10: encodeBytes
import java.io.IOException; //导入方法依赖的package包/类
public static String encodeBytes(byte[] source, int off, int len) {
String encoded = null;
try {
encoded = encodeBytes(source, off, len, 0);
} catch (IOException ex) {
if (!$assertionsDisabled) {
throw new AssertionError(ex.getMessage());
}
}
if ($assertionsDisabled || encoded != null) {
return encoded;
}
throw new AssertionError();
}
示例11: toASN1Primitive
import java.io.IOException; //导入方法依赖的package包/类
public ASN1Primitive toASN1Primitive()
{
try
{
return getLoadedObject();
}
catch (IOException e)
{
throw new IllegalStateException(e.getMessage());
}
}
示例12: decodeAll
import java.io.IOException; //导入方法依赖的package包/类
@Override
public void decodeAll(AsnInputStream ansIS) throws MAPParsingComponentException {
try {
int length = ansIS.readLength();
this._decode(ansIS, length);
} catch (IOException e) {
throw new MAPParsingComponentException("IOException when decoding " + _PrimitiveName + ": " + e.getMessage(), e,
MAPParsingComponentExceptionReason.MistypedParameter);
}
}
示例13: end
import java.io.IOException; //导入方法依赖的package包/类
public Object end(Object obj, boolean isValue) throws ParseException
{
mStack.clear();
try {
return mConverter.readValue(mType, obj);
} catch (IOException e) {
throw new IllegalStateException(e.getMessage(), e);
}
}
示例14: doRedirect
import java.io.IOException; //导入方法依赖的package包/类
/**
* Redirect to the given url converting exceptions to JspException.
* @param url The path to redirect to.
* @throws JspException
* @since Struts 1.2
*/
protected void doRedirect(String url) throws JspException {
HttpServletResponse response =
(HttpServletResponse) pageContext.getResponse();
try {
response.sendRedirect(url);
} catch (IOException e) {
TagUtils.getInstance().saveException(pageContext, e);
throw new JspException(e.getMessage());
}
}
示例15: ClassPathJarEntry
import java.io.IOException; //导入方法依赖的package包/类
public ClassPathJarEntry(Path root) {
super(root);
if (!Files.exists(root)) {
throw new Error(root + " file not found");
}
try {
jarFile = new JarFile(root.toFile());
} catch (IOException e) {
throw new Error("can not read " + root + " : " + e.getMessage(), e);
}
}