Minor bugs repaired
diff --git a/org.eclipse.opencert.apm.assurproj.edit/src/org/eclipse/opencert/apm/assurproj/assuranceproject/utils/CrossDomainUI.java b/org.eclipse.opencert.apm.assurproj.edit/src/org/eclipse/opencert/apm/assurproj/assuranceproject/utils/CrossDomainUI.java
index 5d714f7..862f639 100644
--- a/org.eclipse.opencert.apm.assurproj.edit/src/org/eclipse/opencert/apm/assurproj/assuranceproject/utils/CrossDomainUI.java
+++ b/org.eclipse.opencert.apm.assurproj.edit/src/org/eclipse/opencert/apm/assurproj/assuranceproject/utils/CrossDomainUI.java
@@ -2454,8 +2454,17 @@
//Copy the ArtefactModelData to destination model If it's empty
if(amT.getRepoUrl()==null || amT.getRepoUrl().equals("")){
- amT.setId(amF.getId());
- amT.setName(amF.getName());
+ if(amF.getId()!=null){
+ amT.setId(amF.getId());
+ }
+ if(amF.getName()!=null){
+ amT.setName(amF.getName());
+ }
+ else if (amT.getName()==null){
+ amT.setName ("NoNameSpecified");
+ }
+
+
amT.setRepoLocalPath(amF.getRepoLocalPath());
amT.setRepoPassword(amF.getRepoPassword());
amT.setRepoUrl(amF.getRepoUrl());
@@ -2479,6 +2488,9 @@
artefactModelFolderPath.mkdir();
}
+ if(amT.getArtefact().get(0).getName()==null){
+ amT.getArtefact().get(0).setName ("NoNameSpecified");
+ }
File artefactDefinitionFolderPath=new File(artefactModelFolderPath.getAbsolutePath() +"/" + amT.getArtefact().get(0).getName());
if(!artefactDefinitionFolderPath.exists()){
@@ -2494,7 +2506,13 @@
//Copy the resource to target artefact
org.eclipse.opencert.evm.evidspec.evidence.Resource copy = evidenceFactory.createResource();
copy.setId(fromFile.getId());
- copy.setName(fromFile.getName());
+ if (fromFile.getName()==null){
+ fromFile.setName ("NoNameSpecified");
+ }
+ else{
+ copy.setName(fromFile.getName());
+ }
+
copy.setDescription(fromFile.getDescription());
copy.setFormat(fromFile.getFormat());
@@ -2536,8 +2554,7 @@
String artefactModelFolderPath = "";
if(!repoLibrary.existsFolderRepo(projectFolderPath+"/" + amT.getName())){
- artefactModelFolderPath = repoLibrary.addFolderToRepo(projectFolderPath,amT.getName(), "");
- //String ArtefactDefFolderPath = repoLibrary.addFolderToRepo(ArtefactModelFolderPath,am.getArtefact().get(0).getName(), "");
+ artefactModelFolderPath = repoLibrary.addFolderToRepo(projectFolderPath,amT.getName(), "");
}
else{
artefactModelFolderPath =projectFolderPath+"/"+amT.getName();
@@ -2545,9 +2562,12 @@
String artefactDefinitionFolderPath = "";
+ if(amT.getArtefact().get(0).getName()==null){
+ amT.getArtefact().get(0).setName ("NoNameSpecified");
+ }
+
if(!repoLibrary.existsFolderRepo(artefactModelFolderPath + "/" + amT.getArtefact().get(0).getName())){
- artefactDefinitionFolderPath = repoLibrary.addFolderToRepo(artefactModelFolderPath,amT.getArtefact().get(0).getName(), "");
- //String ArtefactDefFolderPath = repoLibrary.addFolderToRepo(ArtefactModelFolderPath,am.getArtefact().get(0).getName(), "");
+ artefactDefinitionFolderPath = repoLibrary.addFolderToRepo(artefactModelFolderPath,amT.getArtefact().get(0).getName(), "");
}
else{
artefactDefinitionFolderPath =artefactModelFolderPath+"/"+amT.getArtefact().get(0).getName();
@@ -2557,7 +2577,7 @@
String artefactFolderPath="";
if(!repoLibrary.existsFolderRepo(artefactDefinitionFolderPath+"/" + artTo.getName())){
artefactFolderPath = repoLibrary.addFolderToRepo(artefactDefinitionFolderPath,artTo.getName(), "");
- //String ArtefactDefFolderPath = repoLibrary.addFolderToRepo(ArtefactModelFolderPath,am.getArtefact().get(0).getName(), "");
+
}
else{
artefactFolderPath =artefactDefinitionFolderPath+"/" + artTo.getName();
@@ -2567,7 +2587,14 @@
//Copy the resource to target artefact
org.eclipse.opencert.evm.evidspec.evidence.Resource copy = evidenceFactory.createResource();
copy.setId(fromFile.getId());
- copy.setName(fromFile.getName());
+
+ if (fromFile.getName()==null){
+ fromFile.setName ("NoNameSpecified");
+ }
+ else{
+ copy.setName(fromFile.getName());
+ }
+
copy.setDescription(fromFile.getDescription());
copy.setFormat(fromFile.getFormat());
diff --git a/org.eclipse.opencert.apm.assurproj.reuse/src/org/eclipse/opencert/apm/assurproj/reuse/views/ReuseAssistanceView.java b/org.eclipse.opencert.apm.assurproj.reuse/src/org/eclipse/opencert/apm/assurproj/reuse/views/ReuseAssistanceView.java
index 8e8b4fd..c86c626 100644
--- a/org.eclipse.opencert.apm.assurproj.reuse/src/org/eclipse/opencert/apm/assurproj/reuse/views/ReuseAssistanceView.java
+++ b/org.eclipse.opencert.apm.assurproj.reuse/src/org/eclipse/opencert/apm/assurproj/reuse/views/ReuseAssistanceView.java
Binary files differ
diff --git a/org.eclipse.opencert.infra.svnkit/src/org/eclipse/opencert/infra/svnkit/MainClass.java b/org.eclipse.opencert.infra.svnkit/src/org/eclipse/opencert/infra/svnkit/MainClass.java
index f8d090f..12640ed 100644
--- a/org.eclipse.opencert.infra.svnkit/src/org/eclipse/opencert/infra/svnkit/MainClass.java
+++ b/org.eclipse.opencert.infra.svnkit/src/org/eclipse/opencert/infra/svnkit/MainClass.java
@@ -26,56 +26,41 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.IOException;
import java.io.OutputStream;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashMap;
import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import org.eclipse.ui.PlatformUI;
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager;
import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory;
import org.tmatesoft.svn.core.internal.io.fs.FSRepositoryFactory;
import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl;
import org.tmatesoft.svn.core.io.ISVNEditor;
-import org.tmatesoft.svn.core.io.ISVNFileRevisionHandler;
-import org.tmatesoft.svn.core.io.SVNFileRevision;
+
import org.tmatesoft.svn.core.io.SVNRepository;
import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
import org.tmatesoft.svn.core.io.diff.SVNDeltaGenerator;
-import org.tmatesoft.svn.core.io.diff.SVNDiffWindow;
import org.tmatesoft.svn.core.wc.SVNWCUtil;
import org.tmatesoft.svn.core.*;
public class MainClass {
-
-
//private static final String LOCAL_REPO_PROTOCOL = "file:///";
private static final int EXCEPTION = 3;
private static final int URL_NOT_FILE = 2;
private static final int INCORRECT_URL = 1;
- private static final int NO_ERROR = 0;
- private static final String SVNInfo_REPOSITORY_TYPE = "OPENCERT_SVN_REPOSITORY_TYPE";
- private static final String SVNInfo_LOCAL_REPOSITORY_URL = "OPENCERT_SVN_LOCAL_REPOSITORY_URL";
- private static final String SVNInfo_REMOTE_REPOSITORY_URL = "OPENCERT_SVN_REMOTE_REPOSITORY_URL";
- private static final String SVNInfo_USER = "OPENCERT_SVN_USER";
- private static final String SVNInfo_PASS = "OPENCERT_SVN_PASS";
-
+ private static final int NO_ERROR = 0;
+
private SVNRepository repository=null;
-
-
+
public MainClass() {
}
-
+
public void deleteFile(String filePath) {
try {
@@ -87,28 +72,28 @@
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
}
public int connectRepository(String urlCon,String name, String password){
//boolean useLocalRepository = PlatformUI.getPreferenceStore().getBoolean(SVNInfo_REPOSITORY_TYPE);
-
+
//String name ="";
//String password ="";
-
-
-
+
+
+
//if(useLocalRepository){
// urlCon = LOCAL_REPO_PROTOCOL + urlCon;
//}
-
+
/*
* initializes the library (it must be done before ever using the
* library itself)
*/
setupLibrary();
-
+
try {
repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(urlCon));
@@ -123,13 +108,13 @@
ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(name, password);
repository.setAuthenticationManager(authManager);
-
-
+
+
return NO_ERROR;
}
-
+
public int checkPath(String urlCon){
-
+
/*
* Checks up if the specified path/to/repository part of the URL
* really corresponds to a directory. If doesn't the program exits.
@@ -150,12 +135,12 @@
// TODO Auto-generated catch block
return EXCEPTION;
}
-
+
}
-
-
+
+
public boolean existsFileRepo(String localPath){
-
+
// paranoia
if (repository == null) {
return false;
@@ -164,7 +149,7 @@
//Read the file Bytes
//File file = new File(localPath);
//String name=file.getName();
-
+
try {
SVNNodeKind nodeKind = repository.checkPath(localPath, -1);
if (nodeKind == SVNNodeKind.FILE) {
@@ -172,20 +157,20 @@
} else {
return false;
}
-
+
} catch (SVNException e) {
// TODO Auto-generated catch block
return true;
}
-
+
}
-
-public boolean existsFolderRepo(String localPath){
-
+
+ public boolean existsFolderRepo(String localPath){
+
//Read the file Bytes
//File file = new File(localPath);
//String name=file.getName();
-
+
try {
SVNNodeKind nodeKind = repository.checkPath(localPath, -1);
if (nodeKind == SVNNodeKind.DIR) {
@@ -193,14 +178,14 @@
} else {
return false;
}
-
+
} catch (SVNException e) {
// TODO Auto-generated catch block
return false;
}
-
+
}
-
+
public ArrayList<String> getFileHistory(String filePath) {
//Get file de history
ArrayList<String> entriesList=new ArrayList<String>();
@@ -218,7 +203,7 @@
entriesList.add(historyRev);
}
}
-
+
} catch (SVNException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -249,7 +234,7 @@
return fullPath;
}
return "";
-
+
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -257,25 +242,25 @@
}
}
-
+
public String copyFileFromRepo(String sourceURI, String targetFolderURI, String comment) {
String tempFile = getFileFromRepo(sourceURI);
if(tempFile.equals("exists")){
return tempFile;
}
String finalLocation= addFileToRepo(tempFile, targetFolderURI,comment);
-
+
return finalLocation;
}
-
-
+
+
public String updateFileFromRepo(String sourceURI, String targetFolderURI, String comment) {
String tempFile = getFileFromRepo(sourceURI);
if(tempFile.equals("exists")){
return tempFile;
}
String finalLocation= changeRepoFile(tempFile, targetFolderURI,comment);
-
+
return finalLocation;
}
@@ -283,7 +268,7 @@
ISVNEditor editor = null;
try {
editor = repository.getCommitEditor( comment , null );
-
+
//Read the file Bytes
File file = new File(localPath);
byte [] contentsNew = new byte[(int)file.length()];
@@ -291,7 +276,7 @@
dis.readFully(contentsNew);
dis.close();
String remotePath=destinationDir + "/" + file.getName();
-
+
editor.openRoot(-1);
//editor.openDir(destinationDir, -1);
editor.openFile(remotePath, -1);
@@ -310,7 +295,7 @@
return remotePath;
-
+
} catch ( Exception svne ) {
svne.printStackTrace();
try {
@@ -322,63 +307,57 @@
return "An error has occurred updating the file to the Repository";
}
- }
+ }
public String addFolderToRepo(String destinationDir, String newFolderName, String comment) {
-
+
ISVNEditor editor = null;
- try {
-
-
- if(existsFolderRepo(destinationDir + "/" + newFolderName)){
- return "exists";
- }
-
- editor = repository.getCommitEditor(comment , null );
-
- editor.openRoot(-1);
- editor.openDir(destinationDir, -1);
-
- editor.addDir(newFolderName,null, -1);
+ try {
- editor.closeDir();
+ editor = repository.getCommitEditor(comment , null );
- //Suuuper importante, sino se cierra no se genera nada en el Repo
- editor.closeEdit();
-
- //Erase the first / character
- String returnString = destinationDir + "/" + newFolderName;
- if(returnString.startsWith("/")){
- returnString= returnString.substring(1);
+ editor.openRoot(-1);
+ editor.openDir(destinationDir, -1);
+ //final long latestRevision = repository.getLatestRevision();
+ editor.addDir(newFolderName,null, -1);
+
+ editor.closeDir();
+
+ //Suuuper importante, sino se cierra no se genera nada en el Repo
+ editor.closeEdit();
+
+ //Erase the first / character
+ String returnString = destinationDir + "/" + newFolderName;
+ if(returnString.startsWith("/")){
+ returnString= returnString.substring(1);
+ }
+ return returnString;
+ } catch ( Exception svne ) {
+ svne.printStackTrace();
+ try {
+ editor.abortEdit( );
+ } catch (SVNException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return "An error has occurred adding the folder to the Repository";
}
- return returnString;
- } catch ( Exception svne ) {
- svne.printStackTrace();
- try {
- editor.abortEdit( );
- } catch (SVNException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return "An error has occurred adding the folder to the Repository";
}
-}
-
- public String addFileToRepo(String localPath, String destinationDir, String comment) {
-
- ISVNEditor editor = null;
+ public String addFileToRepo(String localPath, String destinationDir, String comment) {
+
+ ISVNEditor editor = null;
try {
File file = new File(localPath);
String remotePath= file.getName();
-
+
if(existsFileRepo(destinationDir + "/" + remotePath)){
return "exists";
}
-
+
editor = repository.getCommitEditor( comment , null );
-
+
//Read the file Bytes
//File file = new File(localPath);
byte [] fileData = new byte[(int)file.length()];
@@ -386,9 +365,9 @@
dis.readFully(fileData);
dis.close();
//String remotePath= file.getName();
-
+
//byte[] contents = "This is a new file".getBytes();
-
+
editor.openRoot(-1);
editor.openDir(destinationDir, -1);
//editor.addDir(dir,null, -1);
@@ -408,7 +387,7 @@
//Suuuper importante, sino se cierra no se genera nada en el Repo
editor.closeEdit();
-
+
//Erase the first / character
return destinationDir + "/" + remotePath;
} catch ( Exception svne ) {