branch feature/GIT updated (236f350 -> 81dcd78)
This is an automated email from the git hooks/post-receive script. New change to branch feature/GIT in repository scmwebeditor. See http://git.nuiton.org/scmwebeditor.git from 236f350 Add documentation in the code new 81dcd78 Fix authentication problems for the upload of a new file The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 81dcd781eb7cc15404f72067e1da2cbd672c3a61 Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Fri May 15 14:02:06 2015 +0200 Fix authentication problems for the upload of a new file Summary of changes: .../org/nuiton/scmwebeditor/git/GitConnection.java | 14 +++++- .../scmwebeditor/api/ScmWebEditorConfig.java | 10 ++--- .../org/nuiton/scmwebeditor/svn/SvnConnection.java | 8 ++-- .../scmwebeditor/uiweb/actions/UploadAction.java | 12 ++--- swe-ui-web/src/main/resources/log4j.properties | 51 +++++++++++----------- 5 files changed, 53 insertions(+), 42 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/GIT in repository scmwebeditor. See http://git.nuiton.org/scmwebeditor.git commit 81dcd781eb7cc15404f72067e1da2cbd672c3a61 Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Fri May 15 14:02:06 2015 +0200 Fix authentication problems for the upload of a new file --- .../org/nuiton/scmwebeditor/git/GitConnection.java | 14 +++++- .../scmwebeditor/api/ScmWebEditorConfig.java | 10 ++--- .../org/nuiton/scmwebeditor/svn/SvnConnection.java | 8 ++-- .../scmwebeditor/uiweb/actions/UploadAction.java | 12 ++--- swe-ui-web/src/main/resources/log4j.properties | 51 +++++++++++----------- 5 files changed, 53 insertions(+), 42 deletions(-) diff --git a/swe-git/src/main/java/org/nuiton/scmwebeditor/git/GitConnection.java b/swe-git/src/main/java/org/nuiton/scmwebeditor/git/GitConnection.java index 398b9e2..a69440a 100644 --- a/swe-git/src/main/java/org/nuiton/scmwebeditor/git/GitConnection.java +++ b/swe-git/src/main/java/org/nuiton/scmwebeditor/git/GitConnection.java @@ -588,6 +588,7 @@ public class GitConnection implements ScmConnection { log.error("Can not push : the Git repository has no HEAD reference", e); } + file.delete(); resultDto.setError(UploadResultDto.ERROR); return resultDto; } catch (UnmergedPathsException e) { @@ -595,6 +596,7 @@ public class GitConnection implements ScmConnection { log.error("Can not push : conflicts found (unmerged paths)", e); } + file.delete(); resultDto.setError(UploadResultDto.ERROR); return resultDto; } catch (ConcurrentRefUpdateException e) { @@ -602,6 +604,7 @@ public class GitConnection implements ScmConnection { log.error("Can not push : someone else is updating the HEAD or the branch", e); } + file.delete(); resultDto.setError(UploadResultDto.ERROR); return resultDto; } catch (WrongRepositoryStateException e) { @@ -609,6 +612,7 @@ public class GitConnection implements ScmConnection { log.error("Can not push : the repository is not in the right state", e); } + file.delete(); resultDto.setError(UploadResultDto.ERROR); return resultDto; } catch (RejectCommitException e) { @@ -616,6 +620,7 @@ public class GitConnection implements ScmConnection { log.error("Can not push : commit rejected", e); } + file.delete(); resultDto.setError(UploadResultDto.ERROR); return resultDto; } catch (GitAPIException e) { @@ -623,7 +628,13 @@ public class GitConnection implements ScmConnection { log.error("Can not push", e); } - resultDto.setError(UploadResultDto.ERROR); + file.delete(); + if (e.getMessage().endsWith("not authorized")) { + resultDto.setError(UploadResultDto.AUTH_ERROR); + } else { + resultDto.setError(UploadResultDto.ERROR); + } + return resultDto; } } catch (IOException e) { @@ -631,6 +642,7 @@ public class GitConnection implements ScmConnection { log.error("Can not open git local repository : " + localDirectory.getAbsolutePath(), e); } + file.delete(); resultDto.setError(UploadResultDto.ERROR); return resultDto; } diff --git a/swe-scm-api/src/main/java/org/nuiton/scmwebeditor/api/ScmWebEditorConfig.java b/swe-scm-api/src/main/java/org/nuiton/scmwebeditor/api/ScmWebEditorConfig.java index 1f7efc7..2294591 100644 --- a/swe-scm-api/src/main/java/org/nuiton/scmwebeditor/api/ScmWebEditorConfig.java +++ b/swe-scm-api/src/main/java/org/nuiton/scmwebeditor/api/ScmWebEditorConfig.java @@ -82,14 +82,12 @@ public class ScmWebEditorConfig { String key = ScmWebEditorConfigOption.PROVIDERS.getKey(); Properties options = getConfig().getOptionStartsWith(key); - if (log.isDebugEnabled()) { - for (String propertyName : options.stringPropertyNames()) { + for (String propertyName : options.stringPropertyNames()) { - String providerKey = propertyName.substring(propertyName.lastIndexOf('.') + 1); - String providerClass = getConfig().getOption(propertyName); + String providerKey = propertyName.substring(propertyName.lastIndexOf('.') + 1); + String providerClass = getConfig().getOption(propertyName); - providers.put(providerKey, providerClass); - } + providers.put(providerKey, providerClass); } return providers; diff --git a/swe-svn/src/main/java/org/nuiton/scmwebeditor/svn/SvnConnection.java b/swe-svn/src/main/java/org/nuiton/scmwebeditor/svn/SvnConnection.java index 71d46f7..6e880a5 100644 --- a/swe-svn/src/main/java/org/nuiton/scmwebeditor/svn/SvnConnection.java +++ b/swe-svn/src/main/java/org/nuiton/scmwebeditor/svn/SvnConnection.java @@ -499,7 +499,7 @@ public class SvnConnection implements ScmConnection { delTempDirectory(checkoutdir); //redirect to a login page - resultDto.setError(UploadResultDto.ERROR); + resultDto.setError(UploadResultDto.AUTH_ERROR); return resultDto; } catch (SVNException e) { @@ -553,7 +553,7 @@ public class SvnConnection implements ScmConnection { } catch (SVNException e) { if (log.isErrorEnabled()) { - log.error("Erreur SVN Add : " + e.getMessage() + " ; " + e.toString(), e); + log.error("Error SVN Add : " + e.getMessage() + " ; " + e.toString(), e); } // deleting the temporary directory delTempDirectory(checkoutdir); @@ -580,11 +580,11 @@ public class SvnConnection implements ScmConnection { // deleting the temporary directory delTempDirectory(checkoutdir); - resultDto.setError(UploadResultDto.CONNECTION_FAILED); + resultDto.setError(UploadResultDto.AUTH_ERROR); return resultDto; } catch (SVNException e) { if (log.isErrorEnabled()) { - log.error("Erreur SVN commit", e); + log.error("Error SVN commit", e); } // deleting the temporary directory delTempDirectory(checkoutdir); diff --git a/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/UploadAction.java b/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/UploadAction.java index 58bfb74..a005074 100644 --- a/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/UploadAction.java +++ b/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/UploadAction.java @@ -172,11 +172,6 @@ public class UploadAction extends AbstractScmWebEditorAction implements ServletR ScmProvider provider = ScmWebEditorConfig.getProvider(scmType); - if (provider == null) { - error = true; - return ERROR; - } - ScmConnection scmConn = provider.getConnection(address, pathToLocalRepos); // if the repository is not protected for writing, we get its UUID @@ -206,6 +201,11 @@ public class UploadAction extends AbstractScmWebEditorAction implements ServletR scmRoot = resultDto.getScmRoot(); } + if (upload == null) { + username = null; + pw = null; + } + if (resultDto.getError() != null) { String errorMessage = resultDto.getError(); @@ -222,6 +222,8 @@ public class UploadAction extends AbstractScmWebEditorAction implements ServletR } else if (errorMessage.equals(UploadResultDto.AUTH_ERROR)) { badLogin = true; + username = null; + pw = null; getScmSession().delScmUser(scmConn.getRepositoryId()); return LOGIN; diff --git a/swe-ui-web/src/main/resources/log4j.properties b/swe-ui-web/src/main/resources/log4j.properties index 86b4c81..378ac23 100644 --- a/swe-ui-web/src/main/resources/log4j.properties +++ b/swe-ui-web/src/main/resources/log4j.properties @@ -2,26 +2,25 @@ # #%L # ScmWebEditor # %% -# Copyright (C) 2009 - 2011 CodeLutin +# Copyright (C) 2009 - 2015 CodeLutin # %% # This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as -# published by the Free Software Foundation, either version 3 of the +# it under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Lesser Public License for more details. -# -# You should have received a copy of the GNU General Lesser Public +# +# You should have received a copy of the GNU General Lesser Public # License along with this program. If not, see # <http://www.gnu.org/licenses/lgpl-3.0.html>. # #L% ### # Global logging configuration -log4j.rootLogger=DEBUG, stdout, fileout -#log4j.rootLogger=INFO, stdout +log4j.rootLogger=INFO, stdout # Console output... log4j.appender.stdout=org.apache.log4j.ConsoleAppender @@ -29,26 +28,26 @@ log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{yyyy/MM/dd hh:mm:ss} %5p (%F:%L) %m%n # File output... -log4j.appender.fileout=org.apache.log4j.FileAppender -log4j.appender.fileout.File=jtimer.log -log4j.appender.fileout.Append=true -log4j.appender.fileout.Threshold=DEBUG -log4j.appender.fileout.layout=org.apache.log4j.PatternLayout -log4j.appender.fileout.layout.ConversionPattern=%5p (%F:%L) %m%n +#log4j.appender.fileout=org.apache.log4j.FileAppender +#log4j.appender.fileout.File=jtimer.log +#log4j.appender.fileout.Append=true +#log4j.appender.fileout.Threshold=DEBUG +#log4j.appender.fileout.layout=org.apache.log4j.PatternLayout +#log4j.appender.fileout.layout.ConversionPattern=%5p (%F:%L) %m%n # Rolling appender -log4j.appender.rolling=org.apache.log4j.RollingFileAppender -log4j.appender.rolling.File=jtimer.log -log4j.appender.rolling.MaxFileSize=100KB -log4j.appender.rolling.Append=true -log4j.appender.rolling.MaxBackupIndex=30 -log4j.appender.rolling.Threshold=INFO -log4j.appender.rolling.layout=org.apache.log4j.PatternLayout -log4j.appender.rolling.layout.ConversionPattern=%d{yyyy/MM/dd hh:mm:ss} %5p (%F:%L) %m%n +#log4j.appender.rolling=org.apache.log4j.RollingFileAppender +#log4j.appender.rolling.File=jtimer.log +#log4j.appender.rolling.MaxFileSize=100KB +#log4j.appender.rolling.Append=true +#log4j.appender.rolling.MaxBackupIndex=30 +#log4j.appender.rolling.Threshold=INFO +#log4j.appender.rolling.layout=org.apache.log4j.PatternLayout +#log4j.appender.rolling.layout.ConversionPattern=%d{yyyy/MM/dd hh:mm:ss} %5p (%F:%L) %m%n # package level -log4j.logger.org.nuiton.scmwebeditor.uiweb.actions.SaveAction=DEBUG +#log4j.logger.org.nuiton.scmwebeditor.uiweb.actions.SaveAction=DEBUG -log4j.logger.org.chorem.jtimer=DEBUG -log4j.logger.org.chorem.jtimer.ws=DEBUG -log4j.logger.org.chorem.jtimer.ui.report=DEBUG +#log4j.logger.org.chorem.jtimer=DEBUG +#log4j.logger.org.chorem.jtimer.ws=DEBUG +#log4j.logger.org.chorem.jtimer.ui.report=DEBUG \ No newline at end of file -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm