Github user srdo commented on a diff in the pull request:

    https://github.com/apache/storm/pull/2588#discussion_r173634917
  
    --- Diff: 
external/storm-eventhubs/src/main/java/org/apache/storm/eventhubs/core/OffsetFilter.java
 ---
    @@ -1,31 +1,40 @@
    
-/*******************************************************************************
    - * Licensed to the Apache Software Foundation (ASF) under one
    - * or more contributor license agreements.  See the NOTICE file
    - * distributed with this work for additional information
    - * regarding copyright ownership.  The ASF licenses this file
    - * to you 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 org.apache.storm.eventhubs.spout;
    -
    -import java.io.Serializable;
    -
    -public interface IStateStore extends Serializable {
    -
    -  public void open();
    -
    -  public void close();
    -
    -  public void saveData(String path, String data);
    -
    -  public String readData(String path);
    -}
    
+/*******************************************************************************
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you 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 org.apache.storm.eventhubs.core;
    +
    +public class OffsetFilter implements IEventFilter {
    +    String offset = null;
    +
    +    public OffsetFilter(String offset) {
    +        this.offset = offset;
    +    }
    +
    +    public String getOffset() {
    +        return offset;
    +    }
    +
    +    @Override
    +    public String toString() {
    +        if (offset != null) {
    +            return offset;
    +        }
    +
    +        return null;
    --- End diff --
    
    I don't think returning null from toString is a good idea. Consider using 
Apache Commons Lang's ToStringBuilder, or manually provide a toString that 
prints this class name + property values instead. I think this applies to the 
other toStrings as well, it's easier to use toString for debugging if you print 
the class name + properties instead of just the wrapped property value.


---

Reply via email to