@Override
    public String incomingCrypted(String st, HBCIMsgStatus msgStatus, String msgName) {
        int idx = st.indexOf("'");
        if (idx != -1) {
            try {
                String msghead_st = st.substring(0, idx);
                int plusidx = 0;
                for (int i = 0; i < 5; i++)
                    plusidx = msghead_st.indexOf("+", plusidx + 1);
                if (plusidx == -1) {
                    log.warn("MsgRef is missing, adding it");
                    String[] des = {"dialogid", "msgnum"};
                    for (int i = 0; i < 2; i++) {
                        String temp = (msgStatus.getData().get("orig_" + msgName + ".MsgHead." + des[i]));
                        log.warn("setting MsgRef." + des[i] + " to " + temp);
                        msghead_st += (i == 0 ? "+" : ":");
                        msghead_st += temp;
                    }
                    st = new StringBuffer(st).replace(0, idx, msghead_st).toString();
                }
            } catch (Exception ex) {
                throw new HBCI_Exception("*** error while fixing missing MsgRef", ex);
            }
        }
        return st;
    }
@ Override public String incomingCrypted ( String st , HBCIMsgStatus msgStatus , String msgName ) { int idx = st . indexOf ( "'" ) ; if ( idx != - 1 ) { try { String msghead_st = st . substring ( 0 , idx ) ; int plusidx = 0 ; for ( int i = 0 ; i < 5 ; i ++ ) plusidx = msghead_st . indexOf ( "+" , plusidx + 1 ) ; if ( plusidx == - 1 ) { log . warn ( "MsgRef is missing, adding it" ) ; String [ ] des = { "dialogid" , "msgnum" } ; for ( int i = 0 ; i < 2 ; i ++ ) { String temp = ( msgStatus . getData ( ) . get ( "orig_" + msgName + ".MsgHead." + des [ i ] ) ) ; log . warn ( "setting MsgRef." + des [ i ] + " to " + temp ) ; msghead_st += ( i == 0 ? "+" : ":" ) ; msghead_st += temp ; } st = new StringBuffer ( st ) . replace ( 0 , idx , msghead_st ) . toString ( ) ; } } catch ( Exception ex ) { throw new HBCI_Exception ( "*** error while fixing missing MsgRef" , ex ) ; } } return st ; }
TODO: msgsize muss angepasst werden