本文整理汇总了Java中org.apache.ivy.util.Message.error方法的典型用法代码示例。如果您正苦于以下问题:Java Message.error方法的具体用法?Java Message.error怎么用?Java Message.error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ivy.util.Message
的用法示例。
在下文中一共展示了Message.error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkStatusCode
import org.apache.ivy.util.Message; //导入方法依赖的package包/类
private boolean checkStatusCode(URL url, HttpURLConnection con) throws IOException {
final int status = con.getResponseCode();
if (status == HttpStatus.SC_OK) {
return true;
}
// IVY-1328: some servers return a 204 on a HEAD request
if ("HEAD".equals(con.getRequestMethod()) && (status == 204)) {
return true;
}
Message.debug("HTTP response status: " + status + " url=" + url);
if (status == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED) {
Message.warn("Your proxy requires authentication.");
} else if (String.valueOf(status).startsWith("4")) {
Message.verbose("CLIENT ERROR: " + con.getResponseMessage() + " url=" + url);
} else if (String.valueOf(status).startsWith("5")) {
Message.error("SERVER ERROR: " + con.getResponseMessage() + " url=" + url);
}
return false;
}
示例2: get
import org.apache.ivy.util.Message; //导入方法依赖的package包/类
/**
* Handles a request to retrieve a file from the repository.
*
* @param source Path to the resource to retrieve, including the repository root.
* @param destination The location where the file should be retrieved to.
* @throws IOException If an error occurs retrieving the file.
*/
public void get(String source, File destination) throws IOException {
fireTransferInitiated(getResource(source), TransferEvent.REQUEST_GET);
String repositorySource = source;
if (!source.startsWith(repositoryRoot)) {
repositorySource = getRepositoryRoot() + source;
}
Message.debug("Getting file for user " + userName + " from " + repositorySource + " [revision="
+ svnRetrieveRevision + "] to " + destination.getAbsolutePath());
try {
SVNURL url = SVNURL.parseURIEncoded(repositorySource);
SVNRepository repository = getRepository(url, true);
repository.setLocation(url, false);
Resource resource = getResource(source);
fireTransferInitiated(resource, TransferEvent.REQUEST_GET);
SvnDao svnDAO = new SvnDao(repository);
svnDAO.getFile(url, destination, svnRetrieveRevision);
fireTransferCompleted(destination.length());
} catch (SVNException e) {
Message.error("Error retrieving" + repositorySource + " [revision=" + svnRetrieveRevision + "]");
throw (IOException) new IOException().initCause(e);
}
}
示例3: resolveResource
import org.apache.ivy.util.Message; //导入方法依赖的package包/类
/**
* Fetch the needed file information for a given file (size, last modification time) and report it back in a
* SvnResource.
*
* @param repositorySource Full path to resource in subversion (including host, protocol etc.)
* @return SvnResource filled with the needed informations
*/
protected SvnResource resolveResource(String repositorySource) {
Message.debug("Resolving resource for " + repositorySource + " [revision=" + svnRetrieveRevision + "]");
SvnResource result = null;
try {
SVNURL url = SVNURL.parseURIEncoded(repositorySource);
SVNRepository repository = getRepository(url, true);
SVNNodeKind nodeKind = repository.checkPath("", svnRetrieveRevision);
if (nodeKind == SVNNodeKind.NONE) {
// log this on debug, NOT error, see http://code.google.com/p/ivysvn/issues/detail?id=21
Message.debug("No resource found at " + repositorySource + ", returning default resource");
result = new SvnResource();
} else {
Message.debug("Resource found at " + repositorySource + ", returning resolved resource");
SVNDirEntry entry = repository.info("", svnRetrieveRevision);
result = new SvnResource(this, repositorySource, true, entry.getDate().getTime(), entry.getSize());
}
} catch (SVNException e) {
Message.error("Error resolving resource " + repositorySource + ", " + e.getMessage());
Message.debug("Exception is: " + getStackTrace(e)); // useful for debugging network issues
result = new SvnResource();
}
return result;
}
示例4: getFile
import org.apache.ivy.util.Message; //导入方法依赖的package包/类
/**
* Gets a file from the repository.
*
* @param sourceURL The full path to the file, reachable via the read repository.
* @param destination The destination file.
* @param revision The subversion revision.
* @throws SVNException If an error occurs retrieving the file from Subversion.
* @throws IOException If an error occurs writing the file contents to disk.
*/
public void getFile(SVNURL sourceURL, File destination, long revision) throws SVNException, IOException {
readRepository.setLocation(sourceURL, false);
SVNNodeKind nodeKind = readRepository.checkPath("", revision);
SVNErrorMessage error = SvnUtils.checkNodeIsFile(nodeKind, sourceURL);
if (error != null) {
Message.error("Error retrieving" + sourceURL + " [revision=" + revision + "]");
throw new IOException(error.getMessage());
}
BufferedOutputStream output = null;
try {
output = new BufferedOutputStream(new FileOutputStream(destination));
readRepository.getFile("", revision, null, output);
} finally {
if (output != null) {
output.close();
}
}
}
示例5: checkStatusCode
import org.apache.ivy.util.Message; //导入方法依赖的package包/类
private boolean checkStatusCode(URL url, HttpURLConnection con) throws IOException {
int status = con.getResponseCode();
if (status == HttpStatus.SC_OK) {
return true;
}
// IVY-1328: some servers return a 204 on a HEAD request
if ("HEAD".equals(con.getRequestMethod()) && (status == 204)) {
return true;
}
Message.debug("HTTP response status: " + status + " url=" + url);
if (status == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED) {
Message.warn("Your proxy requires authentication.");
} else if (String.valueOf(status).startsWith("4")) {
Message.verbose("CLIENT ERROR: " + con.getResponseMessage() + " url=" + url);
} else if (String.valueOf(status).startsWith("5")) {
Message.error("SERVER ERROR: " + con.getResponseMessage() + " url=" + url);
}
return false;
}
示例6: checkStatusCode
import org.apache.ivy.util.Message; //导入方法依赖的package包/类
private boolean checkStatusCode(final String httpMethod, final URL sourceURL, final HttpResponse response) {
final int status = response.getStatusLine().getStatusCode();
if (status == HttpStatus.SC_OK) {
return true;
}
// IVY-1328: some servers return a 204 on a HEAD request
if (HttpHead.METHOD_NAME.equals(httpMethod) && (status == 204)) {
return true;
}
Message.debug("HTTP response status: " + status + " url=" + sourceURL);
if (status == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED) {
Message.warn("Your proxy requires authentication.");
} else if (String.valueOf(status).startsWith("4")) {
Message.verbose("CLIENT ERROR: " + response.getStatusLine().getReasonPhrase() + " url=" + sourceURL);
} else if (String.valueOf(status).startsWith("5")) {
Message.error("SERVER ERROR: " + response.getStatusLine().getReasonPhrase() + " url=" + sourceURL);
}
return false;
}
示例7: saveResolvers
import org.apache.ivy.util.Message; //导入方法依赖的package包/类
/**
* Saves the information of which resolver was used to resolve a md, so that this info can be
* retrieve later (even after a jvm restart) by getSavedArtResolverName(ModuleDescriptor md)
*
* @param md
* the module descriptor resolved
* @param metadataResolverName
* metadata resolver name
* @param artifactResolverName
* artifact resolver name
*/
public void saveResolvers(ModuleDescriptor md, String metadataResolverName,
String artifactResolverName) {
ModuleRevisionId mrid = md.getResolvedModuleRevisionId();
if (!lockMetadataArtifact(mrid)) {
Message.error("impossible to acquire lock for " + mrid);
return;
}
try {
PropertiesFile cdf = getCachedDataFile(md);
cdf.setProperty("resolver", metadataResolverName);
cdf.setProperty("artifact.resolver", artifactResolverName);
cdf.save();
} finally {
unlockMetadataArtifact(mrid);
}
}
示例8: saveResolvedRevision
import org.apache.ivy.util.Message; //导入方法依赖的package包/类
public void saveResolvedRevision(String resolverName, ModuleRevisionId mrid, String revision) {
if (!lockMetadataArtifact(mrid)) {
Message.error("impossible to acquire lock for " + mrid);
return;
}
try {
PropertiesFile cachedResolvedRevision;
if (resolverName == null) {
cachedResolvedRevision = getCachedDataFile(mrid);
} else {
cachedResolvedRevision = getCachedDataFile(resolverName, mrid);
}
cachedResolvedRevision.setProperty("resolved.time",
String.valueOf(System.currentTimeMillis()));
cachedResolvedRevision.setProperty("resolved.revision", revision);
if (resolverName != null) {
cachedResolvedRevision.setProperty("resolver", resolverName);
}
cachedResolvedRevision.save();
} finally {
unlockMetadataArtifact(mrid);
}
}
示例9: getDependencyMgtExclusions
import org.apache.ivy.util.Message; //导入方法依赖的package包/类
private static List<ModuleId> getDependencyMgtExclusions(ModuleDescriptor descriptor,
String groupId, String artifactId) {
if (descriptor instanceof PomModuleDescriptor) {
PomDependencyMgt dependencyMgt = ((PomModuleDescriptor) descriptor)
.getDependencyManagementMap().get(ModuleId.newInstance(groupId, artifactId));
if (dependencyMgt != null) {
return dependencyMgt.getExcludedModules();
}
}
String exclusionPrefix = getDependencyMgtExtraInfoPrefixForExclusion(groupId, artifactId);
List<ModuleId> exclusionIds = new LinkedList<>();
for (ExtraInfoHolder extraInfoHolder : descriptor.getExtraInfos()) {
String key = extraInfoHolder.getName();
if (key.startsWith(exclusionPrefix)) {
String fullExclusion = extraInfoHolder.getContent();
String[] exclusionParts = fullExclusion.split(EXTRA_INFO_DELIMITER);
if (exclusionParts.length != 2) {
Message.error(WRONG_NUMBER_OF_PARTS_MSG + exclusionParts.length + " : "
+ fullExclusion);
continue;
}
exclusionIds.add(ModuleId.newInstance(exclusionParts[0], exclusionParts[1]));
}
}
return exclusionIds;
}
示例10: unlock
import org.apache.ivy.util.Message; //导入方法依赖的package包/类
public void unlock(File file) {
synchronized (this) {
LockData data = locks.get(file);
if (data == null) {
throw new IllegalArgumentException("file not previously locked: " + file);
}
try {
locks.remove(file);
data.l.release();
data.raf.close();
} catch (IOException e) {
Message.error("problem while releasing lock on " + file + ": " + e.getMessage());
}
}
}
示例11: finalizeTask
import org.apache.ivy.util.Message; //导入方法依赖的package包/类
/**
* Called when task is about to finish Should clean up all state related information (stacks for
* example)
*/
protected void finalizeTask() {
if (!IvyContext.getContext().pop(ANT_PROJECT_CONTEXT_KEY, getProject())) {
Message.error("ANT project popped from stack not equals current! Ignoring");
}
IvyContext.popContext();
}
示例12: populate
import org.apache.ivy.util.Message; //导入方法依赖的package包/类
public void populate(Iterator<ManifestAndLocation> it) {
while (it.hasNext()) {
ManifestAndLocation manifestAndLocation = it.next();
try {
BundleInfo bundleInfo = ManifestParser.parseManifest(manifestAndLocation
.getManifest());
bundleInfo
.addArtifact(new BundleArtifact(false, manifestAndLocation.getUri(), null));
addBundle(bundleInfo);
} catch (ParseException e) {
Message.error("Rejected " + manifestAndLocation.getUri() + ": " + e.getMessage());
}
}
}
示例13: getResolver
import org.apache.ivy.util.Message; //导入方法依赖的package包/类
public synchronized DependencyResolver getResolver(String resolverName) {
DependencyResolver r = getDictatorResolver();
if (r != null) {
return r;
}
DependencyResolver resolver = resolversMap.get(resolverName);
if (resolver == null) {
Message.error("unknown resolver " + resolverName);
} else if (workspaceResolver != null && !(resolver instanceof WorkspaceChainResolver)) {
resolver = new WorkspaceChainResolver(this, resolver, workspaceResolver);
resolversMap.put(resolver.getName(), resolver);
resolversMap.put(resolverName, resolver);
}
return resolver;
}
示例14: parseURI
import org.apache.ivy.util.Message; //导入方法依赖的package包/类
/**
* Just check the uri for sanity
*
* @param source
* String of the uri
* @return URI object of the String or null
*/
private URI parseURI(String source) {
try {
URI uri = new URI(source);
if (uri.getScheme() != null
&& !uri.getScheme().toLowerCase(Locale.US)
.equals(getRepositoryScheme().toLowerCase(Locale.US))) {
throw new URISyntaxException(source, "Wrong scheme in URI. Expected "
+ getRepositoryScheme() + " as scheme!");
}
if (uri.getHost() == null && getHost() == null) {
throw new URISyntaxException(source, "Missing host in URI or in resolver");
}
if (uri.getPath() == null) {
throw new URISyntaxException(source, "Missing path in URI");
}
// if (uri.getUserInfo() == null && getUser() == null) {
// throw new URISyntaxException(source, "Missing username in URI or in resolver");
// }
return uri;
} catch (URISyntaxException e) {
Message.error(e.getMessage());
Message.error("The uri '" + source + "' is in the wrong format.");
Message.error("Please use " + getRepositoryScheme()
+ "://user:[email protected]/path/to/repository");
return null;
}
}
示例15: list
import org.apache.ivy.util.Message; //导入方法依赖的package包/类
public List<String> list(String parent) throws IOException {
Message.debug("SShRepository:list called: " + parent);
List<String> result = new ArrayList<>();
Session session = null;
ChannelExec channel = null;
session = getSession(parent);
channel = getExecChannel(session);
URI parentUri = null;
try {
parentUri = new URI(parent);
} catch (URISyntaxException e) {
throw new IOException("The uri '" + parent + "' is not valid!", e);
}
String fullCmd = replaceArgument(listCommand, parentUri.getPath());
channel.setCommand(fullCmd);
StringBuilder stdOut = new StringBuilder();
StringBuilder stdErr = new StringBuilder();
readSessionOutput(channel, stdOut, stdErr);
if (channel.getExitStatus() != 0) {
Message.error("Ssh ListCommand exited with status != 0");
Message.error(stdErr.toString());
return null;
} else {
BufferedReader br = new BufferedReader(new StringReader(stdOut.toString()));
String line = null;
while ((line = br.readLine()) != null) {
result.add(line);
}
}
return result;
}