diff --git a/src/main/java/com/beanit/openiec61850/HexConverter.java b/src/main/java/com/beanit/openiec61850/HexConverter.java index a7722b3..de8d1a2 100644 --- a/src/main/java/com/beanit/openiec61850/HexConverter.java +++ b/src/main/java/com/beanit/openiec61850/HexConverter.java @@ -1,3 +1,16 @@ +/* + * Copyright 2018 beanit + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package com.beanit.openiec61850; public class HexConverter { @@ -89,8 +102,8 @@ public class HexConverter { public static String toShortHexString(byte[] bytes, int offset, int length) { char[] hexChars = new char[length * 2]; - for (int j = offset; j < (offset + length); j++) { - int v = bytes[j] & 0xff; + for (int j = 0; j < length; j++) { + int v = bytes[j + offset] & 0xff; hexChars[j * 2] = hexArray[v >>> 4]; hexChars[j * 2 + 1] = hexArray[v & 0x0f]; } diff --git a/src/main/java/com/beanit/openiec61850/internal/NamedDefaultThreadFactory.java b/src/main/java/com/beanit/openiec61850/internal/NamedDefaultThreadFactory.java index c8871d8..157f12a 100644 --- a/src/main/java/com/beanit/openiec61850/internal/NamedDefaultThreadFactory.java +++ b/src/main/java/com/beanit/openiec61850/internal/NamedDefaultThreadFactory.java @@ -1,3 +1,16 @@ +/* + * Copyright 2018 beanit + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package com.beanit.openiec61850.internal; import java.util.concurrent.Executors; diff --git a/src/main/java/com/beanit/openiec61850/internal/cli/Action.java b/src/main/java/com/beanit/openiec61850/internal/cli/Action.java index e10d858..05f18cc 100644 --- a/src/main/java/com/beanit/openiec61850/internal/cli/Action.java +++ b/src/main/java/com/beanit/openiec61850/internal/cli/Action.java @@ -1,3 +1,16 @@ +/* + * Copyright 2018 beanit + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package com.beanit.openiec61850.internal.cli; public class Action { diff --git a/src/main/java/com/beanit/openiec61850/internal/cli/ActionException.java b/src/main/java/com/beanit/openiec61850/internal/cli/ActionException.java index 4104136..b3d2ab8 100644 --- a/src/main/java/com/beanit/openiec61850/internal/cli/ActionException.java +++ b/src/main/java/com/beanit/openiec61850/internal/cli/ActionException.java @@ -1,3 +1,16 @@ +/* + * Copyright 2018 beanit + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package com.beanit.openiec61850.internal.cli; public final class ActionException extends Exception { diff --git a/src/main/java/com/beanit/openiec61850/internal/cli/ActionListener.java b/src/main/java/com/beanit/openiec61850/internal/cli/ActionListener.java index cf91055..6208927 100644 --- a/src/main/java/com/beanit/openiec61850/internal/cli/ActionListener.java +++ b/src/main/java/com/beanit/openiec61850/internal/cli/ActionListener.java @@ -1,8 +1,21 @@ +/* + * Copyright 2018 beanit + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package com.beanit.openiec61850.internal.cli; public interface ActionListener { - public void actionCalled(String actionKey) throws ActionException, FatalActionException; + void actionCalled(String actionKey) throws ActionException; - public void quit(); + void quit(); } diff --git a/src/main/java/com/beanit/openiec61850/internal/cli/ActionProcessor.java b/src/main/java/com/beanit/openiec61850/internal/cli/ActionProcessor.java index 11d1a6a..c31dd90 100644 --- a/src/main/java/com/beanit/openiec61850/internal/cli/ActionProcessor.java +++ b/src/main/java/com/beanit/openiec61850/internal/cli/ActionProcessor.java @@ -1,3 +1,16 @@ +/* + * Copyright 2018 beanit + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package com.beanit.openiec61850.internal.cli; import static java.lang.System.exit; @@ -82,11 +95,7 @@ public class ActionProcessor { return; } - try { - actionListener.actionCalled(actionKey); - } catch (ActionException e) { - System.err.println(e.getMessage() + "\n"); - } + actionListener.actionCalled(actionKey); } } catch (Exception e) { diff --git a/src/main/java/com/beanit/openiec61850/internal/cli/CliParameter.java b/src/main/java/com/beanit/openiec61850/internal/cli/CliParameter.java index 1cdbc90..e7aa39b 100644 --- a/src/main/java/com/beanit/openiec61850/internal/cli/CliParameter.java +++ b/src/main/java/com/beanit/openiec61850/internal/cli/CliParameter.java @@ -1,3 +1,16 @@ +/* + * Copyright 2018 beanit + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package com.beanit.openiec61850.internal.cli; public abstract class CliParameter { diff --git a/src/main/java/com/beanit/openiec61850/internal/cli/CliParameterBuilder.java b/src/main/java/com/beanit/openiec61850/internal/cli/CliParameterBuilder.java index 4cd55ae..98529bc 100644 --- a/src/main/java/com/beanit/openiec61850/internal/cli/CliParameterBuilder.java +++ b/src/main/java/com/beanit/openiec61850/internal/cli/CliParameterBuilder.java @@ -1,3 +1,16 @@ +/* + * Copyright 2018 beanit + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package com.beanit.openiec61850.internal.cli; import java.util.List; diff --git a/src/main/java/com/beanit/openiec61850/internal/cli/CliParseException.java b/src/main/java/com/beanit/openiec61850/internal/cli/CliParseException.java index 82e7ad7..00b9702 100644 --- a/src/main/java/com/beanit/openiec61850/internal/cli/CliParseException.java +++ b/src/main/java/com/beanit/openiec61850/internal/cli/CliParseException.java @@ -1,3 +1,16 @@ +/* + * Copyright 2018 beanit + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package com.beanit.openiec61850.internal.cli; public final class CliParseException extends Exception { diff --git a/src/main/java/com/beanit/openiec61850/internal/cli/CliParser.java b/src/main/java/com/beanit/openiec61850/internal/cli/CliParser.java index 0c872b1..1e825d7 100644 --- a/src/main/java/com/beanit/openiec61850/internal/cli/CliParser.java +++ b/src/main/java/com/beanit/openiec61850/internal/cli/CliParser.java @@ -1,3 +1,16 @@ +/* + * Copyright 2018 beanit + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package com.beanit.openiec61850.internal.cli; import java.util.ArrayList; diff --git a/src/main/java/com/beanit/openiec61850/internal/cli/FatalActionException.java b/src/main/java/com/beanit/openiec61850/internal/cli/FatalActionException.java deleted file mode 100644 index 518f6af..0000000 --- a/src/main/java/com/beanit/openiec61850/internal/cli/FatalActionException.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.beanit.openiec61850.internal.cli; - -public final class FatalActionException extends Exception { - - private static final long serialVersionUID = -8134353678567694515L; - - public FatalActionException() { - super(); - } - - public FatalActionException(String s) { - super(s); - } - - public FatalActionException(Throwable cause) { - super(cause); - } - - public FatalActionException(String s, Throwable cause) { - super(s, cause); - } -} diff --git a/src/main/java/com/beanit/openiec61850/internal/cli/FlagCliParameter.java b/src/main/java/com/beanit/openiec61850/internal/cli/FlagCliParameter.java index b747bc8..9672d65 100644 --- a/src/main/java/com/beanit/openiec61850/internal/cli/FlagCliParameter.java +++ b/src/main/java/com/beanit/openiec61850/internal/cli/FlagCliParameter.java @@ -1,3 +1,16 @@ +/* + * Copyright 2018 beanit + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package com.beanit.openiec61850.internal.cli; public class FlagCliParameter extends CliParameter { diff --git a/src/main/java/com/beanit/openiec61850/internal/cli/IntCliParameter.java b/src/main/java/com/beanit/openiec61850/internal/cli/IntCliParameter.java index 3fa0fde..1f72d30 100644 --- a/src/main/java/com/beanit/openiec61850/internal/cli/IntCliParameter.java +++ b/src/main/java/com/beanit/openiec61850/internal/cli/IntCliParameter.java @@ -1,3 +1,16 @@ +/* + * Copyright 2018 beanit + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package com.beanit.openiec61850.internal.cli; public class IntCliParameter extends ValueCliParameter { diff --git a/src/main/java/com/beanit/openiec61850/internal/cli/LongCliParameter.java b/src/main/java/com/beanit/openiec61850/internal/cli/LongCliParameter.java index 71d9500..e9f2663 100644 --- a/src/main/java/com/beanit/openiec61850/internal/cli/LongCliParameter.java +++ b/src/main/java/com/beanit/openiec61850/internal/cli/LongCliParameter.java @@ -1,3 +1,16 @@ +/* + * Copyright 2018 beanit + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package com.beanit.openiec61850.internal.cli; public class LongCliParameter extends ValueCliParameter { diff --git a/src/main/java/com/beanit/openiec61850/internal/cli/StringCliParameter.java b/src/main/java/com/beanit/openiec61850/internal/cli/StringCliParameter.java index 86651bc..2dde263 100644 --- a/src/main/java/com/beanit/openiec61850/internal/cli/StringCliParameter.java +++ b/src/main/java/com/beanit/openiec61850/internal/cli/StringCliParameter.java @@ -1,3 +1,16 @@ +/* + * Copyright 2018 beanit + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package com.beanit.openiec61850.internal.cli; public class StringCliParameter extends ValueCliParameter { diff --git a/src/main/java/com/beanit/openiec61850/internal/cli/StringListCliParameter.java b/src/main/java/com/beanit/openiec61850/internal/cli/StringListCliParameter.java index b65e85d..427cbb0 100644 --- a/src/main/java/com/beanit/openiec61850/internal/cli/StringListCliParameter.java +++ b/src/main/java/com/beanit/openiec61850/internal/cli/StringListCliParameter.java @@ -1,3 +1,16 @@ +/* + * Copyright 2018 beanit + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package com.beanit.openiec61850.internal.cli; import java.util.ArrayList; diff --git a/src/main/java/com/beanit/openiec61850/internal/cli/ValueCliParameter.java b/src/main/java/com/beanit/openiec61850/internal/cli/ValueCliParameter.java index dabd7c5..46c6120 100644 --- a/src/main/java/com/beanit/openiec61850/internal/cli/ValueCliParameter.java +++ b/src/main/java/com/beanit/openiec61850/internal/cli/ValueCliParameter.java @@ -1,3 +1,16 @@ +/* + * Copyright 2018 beanit + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ package com.beanit.openiec61850.internal.cli; abstract class ValueCliParameter extends CliParameter {