diff options
3 files changed, 55 insertions, 33 deletions
diff --git a/javatoscachecker/checker/src/main/java/org/onap/tosca/checker/CommonLocator.java b/javatoscachecker/checker/src/main/java/org/onap/tosca/checker/CommonLocator.java index f650f9e..e71eaa4 100644 --- a/javatoscachecker/checker/src/main/java/org/onap/tosca/checker/CommonLocator.java +++ b/javatoscachecker/checker/src/main/java/org/onap/tosca/checker/CommonLocator.java @@ -97,7 +97,16 @@ public class CommonLocator implements TargetLocator { catch (IOException iox) { log.log(Level.WARNING, "The path " + theName + " is an absolute uri but it canont be opened", iox); return null; - } + }finally { + if (pis!= null) { + try { + pis.close(); + } + catch (IOException iox) { + log.log(Level.FINER,"Error while closing input stream",iox); + } + } + } } } catch(URISyntaxException urisx) { @@ -123,6 +132,7 @@ public class CommonLocator implements TargetLocator { pis.close(); } catch (IOException iox) { + log.log(Level.FINER,"Error while closing input stream",iox); } } } @@ -135,6 +145,7 @@ public class CommonLocator implements TargetLocator { return new Target(theName, purl.toURI()); } catch (URISyntaxException urisx) { + log.log(Level.FINER,"Error while creating Target",urisx); } } diff --git a/javatoscachecker/kwalify/src/main/java/kwalify/BaseException.java b/javatoscachecker/kwalify/src/main/java/kwalify/BaseException.java index cc40f58..f12d63d 100644 --- a/javatoscachecker/kwalify/src/main/java/kwalify/BaseException.java +++ b/javatoscachecker/kwalify/src/main/java/kwalify/BaseException.java @@ -52,38 +52,47 @@ package kwalify; */ public abstract class BaseException extends KwalifyRuntimeException implements Comparable { - String _ypath; - transient Object _value; - transient Rule _rule; - String _errorSymbol; - int _linenum = -1; - + final String ypath; + final transient Object value; + final transient Rule rule; + final String errorSymbol; + int linenum = -1; + public BaseException(String message, String ypath, Object value, Rule rule, String errorSymbol) { super(message); - _ypath = ypath; - _value = value; - _rule = rule; - _errorSymbol = errorSymbol; + this.ypath = ypath; + this.value = value; + this.rule = rule; + this.errorSymbol = errorSymbol; } - public String getPath() { return _ypath.equals("") ? "/" : _ypath; } - //public void setPath(String ypath) { _ypath = ypath; } + public String getPath() { + return ypath.isEmpty() ? "/" : ypath; + } - public Object getValue() { return _value; } - //public void setValue(Object value) { _value = value; } + public Object getValue() { + return value; + } - public Rule getRule() { return _rule; } - // - //public void setRule(Rule rule) { _rule = rule; } + public Rule getRule() { + return rule; + } - public String getErrorSymbol() { return _errorSymbol; } - //public void setErrorSymbol(String errorSymbol) { _errorSymbol = errorSymbol; } + public String getErrorSymbol() { + return errorSymbol; + } - public int getLineNumber() { return _linenum; } - public void setLineNumber(int linenum) { _linenum = linenum; } + public int getLineNumber() { + return linenum; + } + + public void setLineNumber(int linenum) { + this.linenum = linenum; + } public int compareTo(Object obj) { - int n = ((ValidationException)obj).getLineNumber(); - return _linenum - n; + int n = ((ValidationException) obj).getLineNumber(); + return linenum - n; } + } diff --git a/javatoscachecker/kwalify/src/main/java/kwalify/CommandOptionException.java b/javatoscachecker/kwalify/src/main/java/kwalify/CommandOptionException.java index 2e6e9a5..6d8ae4d 100644 --- a/javatoscachecker/kwalify/src/main/java/kwalify/CommandOptionException.java +++ b/javatoscachecker/kwalify/src/main/java/kwalify/CommandOptionException.java @@ -53,19 +53,21 @@ package kwalify; public class CommandOptionException extends KwalifyException { private static final long serialVersionUID = 6433387612335104714L; - private String _error_symbol = null; - private char _option; + private final String errorSymbol; + private final char option; - public CommandOptionException(String message, char option, String error_symbol) { + public CommandOptionException(String message, char option, String errorSymbol) { super(message); - _option = option; - _error_symbol = error_symbol; + this.option = option; + this.errorSymbol = errorSymbol; } - public String getErrorSymbol() { return _error_symbol; } - public void setErrorSymbol(String error_symbol) { _error_symbol = error_symbol; } + public String getErrorSymbol() { + return errorSymbol; + } - public char getOption() { return _option; } - public void setOption(char option) { _option = option; } + public char getOption() { + return option; + } } |