ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1306949 - in /ace/trunk: ace-deployment-provider-repositorybased/src/main/java/org/apache/ace/deployment/provider/repositorybased/ ace-repository-ext/src/main/java/org/apache/ace/repository/ext/impl/
Date Thu, 29 Mar 2012 16:04:08 GMT
Author: jawi
Date: Thu Mar 29 16:04:07 2012
New Revision: 1306949

URL: http://svn.apache.org/viewvc?rev=1306949&view=rev
Log:
ACE-240: fix the redudant exceptions when unregistered targets try to retrieve information
about their deployment packages.

Modified:
    ace/trunk/ace-deployment-provider-repositorybased/src/main/java/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java
    ace/trunk/ace-repository-ext/src/main/java/org/apache/ace/repository/ext/impl/CachedRepositoryImpl.java

Modified: ace/trunk/ace-deployment-provider-repositorybased/src/main/java/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java
URL: http://svn.apache.org/viewvc/ace/trunk/ace-deployment-provider-repositorybased/src/main/java/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java?rev=1306949&r1=1306948&r2=1306949&view=diff
==============================================================================
--- ace/trunk/ace-deployment-provider-repositorybased/src/main/java/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java
(original)
+++ ace/trunk/ace-deployment-provider-repositorybased/src/main/java/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java
Thu Mar 29 16:04:07 2012
@@ -96,7 +96,9 @@ public class RepositoryBasedProvider imp
 
         List<XmlDeploymentArtifact>[] pairs = null;
         try {
-            input = getRepositoryStream();
+            // ACE-240: do NOT allow local/remote repositories to be empty. If we're 
+            // asking for real artifacts, it means we must have a repository...
+            input = getRepositoryStream(true /* fail */);
             if (versionFrom == null) {
                 pairs = getDeploymentArtifactPairs(input, targetId, new String[] { versionTo
});
             }
@@ -149,7 +151,9 @@ public class RepositoryBasedProvider imp
         InputStream input = null;
 
         try {
-            input = getRepositoryStream();
+            // ACE-240: allow local/remote repositories to be empty; as the target 
+            // might be new & unregistered, it can have no repository yet... 
+            input = getRepositoryStream(false /* fail */);
             List<Version> versionList = getAvailableVersions(input, targetId);
             if (versionList.isEmpty()) {
                 m_log.log(LogService.LOG_DEBUG, "No versions found for target: " + targetId);
@@ -311,7 +315,7 @@ public class RepositoryBasedProvider imp
      * @return An input stream to the repository document. Will return an empty stream if
none can be found.
      * @throws java.io.IOException if there is a problem communicating with the local or
remote repository.
      */
-    private InputStream getRepositoryStream() throws IOException {
+    private InputStream getRepositoryStream(boolean fail) throws IOException {
         // cache the repositories, since we do not want them to change while we're in this
method.
         CachedRepository cachedRepository = m_cachedRepository;
         Repository repository = m_directRepository;
@@ -320,10 +324,10 @@ public class RepositoryBasedProvider imp
         if (cachedRepository != null) {
             // we can use the cached repository
             if (cachedRepository.isCurrent()) {
-                result = cachedRepository.getLocal(true);
+                result = cachedRepository.getLocal(fail);
             }
             else {
-                result = cachedRepository.checkout(true);
+                result = cachedRepository.checkout(fail);
             }
         }
         else {

Modified: ace/trunk/ace-repository-ext/src/main/java/org/apache/ace/repository/ext/impl/CachedRepositoryImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/ace-repository-ext/src/main/java/org/apache/ace/repository/ext/impl/CachedRepositoryImpl.java?rev=1306949&r1=1306948&r2=1306949&view=diff
==============================================================================
--- ace/trunk/ace-repository-ext/src/main/java/org/apache/ace/repository/ext/impl/CachedRepositoryImpl.java
(original)
+++ ace/trunk/ace-repository-ext/src/main/java/org/apache/ace/repository/ext/impl/CachedRepositoryImpl.java
Thu Mar 29 16:04:07 2012
@@ -132,6 +132,8 @@ public class CachedRepositoryImpl implem
     }
 
     public InputStream getLocal(boolean fail) throws IllegalArgumentException, IOException
{
+        // ACE-240: only fail in case there is no local version available; when mostRecentVersion

+        // equals to 0, it means that nothing has been committed locally...
         if ((m_mostRecentVersion <= 0) && fail) {
             throw new IOException("No local version available of " + m_local + ", remote
" + m_remote);
         }



Mime
View raw message