// Path: src/main/java/com/qoomon/banking/swift/message/block/exception/BlockParseException.java
// public class BlockParseException extends Exception {
// 
//     private final int lineNumber;
// 
//     public BlockParseException(Throwable cause) {
//         super(cause);
//         this.lineNumber = 0;
//     }
// 
//     public BlockParseException(String message) {
//         super(message);
//         this.lineNumber = 0;
//     }
// 
//     public BlockParseException(String message, int lineNumber) {
//         super(message + " at line " + lineNumber);
//         this.lineNumber = lineNumber;
//     }
// 
//     public BlockParseException(String message, int lineNumber, Throwable cause) {
//         super(message + " at line " + lineNumber, cause);
//         this.lineNumber = lineNumber;
//     }
// 
//     public int getLineNumber() {
//         return lineNumber;
//     }
// }


import com.google.common.base.Preconditions;
import com.qoomon.banking.swift.message.block.exception.BlockParseException;
import java.io.IOException;
import java.io.Reader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static java.lang.Character.isWhitespace;
                        } else {
                            throw new BlockParseException("Unexpected block structure start", lineNumber);
                        }
                    }

                    String blockId = blockMatcher.group("id");
                    String blockContent = blockMatcher.group("content");
                    block = new GeneralBlock(blockId, blockContent);

                    //reset block building
                    blockBuilder = new StringBuilder();
                    openingBrackets = 0;
                    closingBrackets = 0;
                }
            }
        } catch (IOException e) {
            throw new BlockParseException(e);
        }

        if (openingBrackets != closingBrackets) {
            throw new BlockParseException("Unclosed '{'", lineNumber);
        }

        return block;
    }

    public int getLineNumber() {
        return lineNumber;
    }

// Path: src/main/java/com/qoomon/banking/swift/message/block/exception/BlockParseException.java
// public class BlockParseException extends Exception {
// 
//     private final int lineNumber;
// 
//     public BlockParseException(Throwable cause) {
//         super(cause);
//         this.lineNumber = 0;
//     }
// 
//     public BlockParseException(String message) {
//         super(message);
//         this.lineNumber = 0;
//     }
// 
//     public BlockParseException(String message, int lineNumber) {
//         super(message + " at line " + lineNumber);
//         this.lineNumber = lineNumber;
//     }
// 
//     public BlockParseException(String message, int lineNumber, Throwable cause) {
//         super(message + " at line " + lineNumber, cause);
//         this.lineNumber = lineNumber;
//     }
// 
//     public int getLineNumber() {
//         return lineNumber;
//     }
// }


// Path: src/main/java/com/qoomon/banking/swift/message/block/SwiftBlockReader.java
import com.google.common.base.Preconditions;
import com.qoomon.banking.swift.message.block.exception.BlockParseException;
import java.io.IOException;
import java.io.Reader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static java.lang.Character.isWhitespace;

                        } else {
                            throw new BlockParseException("Unexpected block structure start", lineNumber);
                        }
                    }

                    String blockId = blockMatcher.group("id");
                    String blockContent = blockMatcher.group("content");
                    block = new GeneralBlock(blockId, blockContent);

                    //reset block building
                    blockBuilder = new StringBuilder();
                    openingBrackets = 0;
                    closingBrackets = 0;
                }
            }
        } catch (IOException e) {
            throw new BlockParseException(e);
        }

        if (openingBrackets != closingBrackets) {
            throw new BlockParseException("Unclosed '{'", lineNumber);
        }

        return block;
    }

    public int getLineNumber() {
        return lineNumber;
    }

    public int getLineCharIndex() {