Results 1 to 20 of 20
  1. #1
    grashmi13 is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default Want to know line number from printstacktrace

    Hi,

    Sep 15 11:55:52 10.7.224.38 MYRIO: Error running mclient/MyrioClient, java/lang/NullPointerException.
    Sep 15 11:55:52 10.7.224.38 MYRIO: java.lang.NullPointerException
    Sep 15 11:55:52 10.7.224.38 MYRIO: at mclient/dtv/favorite/FavoriteManager$LockChannelHelper.initFavRec(Lmcli ent/dtv/favorite/Favorite$FavoriteRecord;)V (:0:159)
    Sep 15 11:55:52 10.7.224.38 MYRIO: at mclient/dtv/favorite/FavoriteManager$LockChannelHelper.initFavRecs([Lmclient/dtv/favorite/Favorite$FavoriteRecord;)V (:0:45)
    Sep 15 11:55:52 10.7.224.38 MYRIO: at mclient/dtv/favorite/FavoriteManager$LockChannelHelper.<init>(Lmclient/dtv/favorite/FavoriteManager;[Lmclient/dtv/favorite/Favorite$FavoriteRecord;[Lmclient/dtv/Channel;)V (:0:77)
    Sep 15 11:55:52 10.7.224.38 MYRIO: at mclient/dtv/favorite/FavoriteManager.refreshData([Lmclient/dtv/Channel;)V (:0:14)
    Sep 15 11:55:52 10.7.224.38 MYRIO: at mclient/dtv/favorite/FavoriteManager.initTheRest()V (:0:18)
    Sep 15 11:55:52 10.7.224.38 MYRIO: at mclient/screen/ScreenManager.initTheRestMembers()V (:0:71)
    Sep 15 11:55:52 10.7.224.38 MYRIO: at mclient/screen/ScreenManager.initAfterAuthenticate(ZZ)V (:0:92)
    Sep 15 11:55:52 10.7.224.38 MYRIO: at mclient/screen/ScreenManager.initAfterAuthenticate()V (:0:6)
    Sep 15 11:55:52 10.7.224.38 MYRIO: at mclient/ClientContainerHelper.start()V (:0:35)
    Sep 15 11:55:52 10.7.224.38 MYRIO: at mclient/MyrioClient.runMain()V (:0:571)
    Sep 15 11:55:52 10.7.224.38 MYRIO: at mclient/MyrioClient.main([Ljava/lang/String;)V (:0:19)





    in this exception printStackTrace, how do i know line number where excetion occurred. what does (:0:x) is representing here? LockChannelHelper is inner class of FavoriteManager. Seems exception occurred in initFavRec(FavoriteRecord f) method. But at which line number.



    here is decompiled LockChannelHelper class:
    package mclient.dtv.favorite;

    import com.myrio.common.util.StringBufferHelper;
    import java.util.ArrayList;
    import java.util.StringTokenizer;
    import mclient.dtv.Channel;
    import mclient.dtv.IPGDataManager;
    import mclient.logger.ILogger;
    import mclient.users.PersistentDataManager;

    public class LockChannelHelper
    {
    private boolean changePending;
    private boolean lineupUpdated;
    private Favorite.ChannelItem[] items;
    private Favorite.FavoriteRecord favRec;
    private final FavoriteManager this$0;

    public LockChannelHelper(, Favorite.FavoriteRecord[] paramArrayOfFavoriteRecord, Channel[] paramArrayOfChannel)
    {
    this.this$0 = paramFavoriteManager;
    this.items = new Favorite.ChannelItem[0];
    FavoriteManager.access$700().info("+LockChannelHel per.<init>");
    this.favRec = new Favorite.FavoriteRecord();
    this.favRec.id = -1L;
    this.favRec.name = FavoriteManager.access$800();
    this.favRec.channelIDNumbers = "";
    initLineup(paramArrayOfChannel);
    initFavRecs(paramArrayOfFavoriteRecord);
    }

    private void initLineup()
    {
    FavoriteManager.access$700().info("+LockChannelHel per.initLineup");
    if (paramArrayOfChannel == null)
    return;
    this.items = new Favorite.ChannelItem[paramArrayOfChannel.length];
    for (int i = 0; i < paramArrayOfChannel.length; ++i)
    this.items[i] = new Favorite.ChannelItem(paramArrayOfChannel[i], false);
    }

    private void updateFavRecs()
    {
    FavoriteManager.access$700().info("+LockChannelHel per.updateFavRecs");
    if (paramArrayOfFavoriteRecord == null)
    return;
    Object localObject = null;
    for (int i = 0; i < paramArrayOfFavoriteRecord.length; ++i)
    {
    Favorite.FavoriteRecord localFavoriteRecord = paramArrayOfFavoriteRecord[i];
    if (FavoriteManager.access$800().equals(localFavorite Record.name))
    {
    localObject = localFavoriteRecord;
    if (localFavoriteRecord.id != -1L)
    break;
    FavoriteManager.access$700().error("updateFavRecs - locked fav id is -1");
    break;
    }
    }
    if (localObject == null)
    {
    if (this.favRec.id != -1L)
    if (!(this.changePending))
    {
    this.favRec.id = -1L;
    this.favRec.channelIDNumbers = "";
    clearLockFlags();
    FavoriteManager.access$900(this.this$0);
    }
    else
    {
    this.favRec.id = -1L;
    }
    return;
    }
    if (this.favRec.id == -1L)
    {
    if (this.changePending)
    {
    this.favRec.id = localObject.id;
    }
    else
    {
    initFavRec(localObject);
    FavoriteManager.access$900(this.this$0);
    }
    }
    else if (this.changePending)
    {
    if (this.favRec.id != localObject.id)
    {
    FavoriteManager.access$700().warn("local lock fav id different from that on server, use server's");
    this.favRec.id = localObject.id;
    }
    }
    else
    {
    if (this.favRec.id != localObject.id)
    {
    FavoriteManager.access$700().warn("2 local lock fav id different from that on server, use server's");
    this.favRec.id = localObject.id;
    }
    if (!(this.favRec.channelIDNumbers.equals(localObject .channelIDNumbers)))
    {
    clearLockFlags();
    initFavRec(localObject);
    FavoriteManager.access$900(this.this$0);
    }
    }
    }

    private void updateChannelLineup()
    {
    FavoriteManager.access$700().info("+updateChannelL ineup");
    initLineup(paramArrayOfChannel);
    if (this.changePending)
    this.lineupUpdated = true;
    }

    private void initFavRecs()
    {
    FavoriteManager.access$700().info("+LockChannelHel per.initFavRecs");
    if (paramArrayOfFavoriteRecord == null)
    return;
    for (int i = 0; i < paramArrayOfFavoriteRecord.length; ++i)
    {
    Favorite.FavoriteRecord localFavoriteRecord = paramArrayOfFavoriteRecord[i];
    if (FavoriteManager.access$800().equals(localFavorite Record.name))
    {
    initFavRec(localFavoriteRecord);
    return;
    }
    }
    }

    private void clearLockFlags()
    {
    for (int i = 0; i < this.items.length; ++i)
    {
    Favorite.ChannelItem localChannelItem = this.items[i];
    localChannelItem.included = true;
    localChannelItem.channel.setLocked(false);
    FavoriteManager.access$1000(this.this$0).getChanne lByID(localChannelItem.channel.getChannelID()).set Locked(!(localChannelItem.included));
    }
    }

    private void initFavRec()
    {
    FavoriteManager.access$700().info("+LockChannelHel per.initFavRec");
    if (paramFavoriteRecord.id == -1L)
    FavoriteManager.access$700().error("initFavRec - id is -1");
    this.favRec = paramFavoriteRecord;
    ArrayList localArrayList = new ArrayList();
    Object localObject = new StringTokenizer(paramFavoriteRecord.channelIDNumbe rs, ",");
    while (((StringTokenizer)localObject).hasMoreTokens())
    localArrayList.add(((StringTokenizer)localObject). nextToken());
    localObject = new String[localArrayList.size()];
    localArrayList.toArray(localObject);
    for (int i = 0; i < this.items.length; ++i)
    {
    Favorite.ChannelItem localChannelItem = this.items[i];
    if (isChannelLocked(localChannelItem.channel, localObject))
    {
    localChannelItem.channel.setLocked(true);
    localChannelItem.included = false;
    FavoriteManager.access$1000(this.this$0).getChanne lByID(localChannelItem.channel.getChannelID()).set Locked(true);
    FavoriteManager.access$700().info("Locking channel: " + localChannelItem.channel.getVisibleNumber());
    }
    }
    }

    public boolean areAllChannelsLockedOrUnsubscribed()
    {
    for (int i = 0; i < this.items.length; ++i)
    {
    Favorite.ChannelItem localChannelItem = this.items[i];
    if ((!(localChannelItem.channel.isLocked())) && (localChannelItem.channel.isSubscribed()))
    return false;
    }
    return true;
    }

    public boolean areAllChannelsGoingToBeLockedOrUnsubscribedIfCommi t()
    {
    for (int i = 0; i < this.items.length; ++i)
    {
    Favorite.ChannelItem localChannelItem = this.items[i];
    if ((localChannelItem.included) && (localChannelItem.channel.isSubscribed()))
    return false;
    }
    return true;
    }

    public void commitChanges()
    {
    FavoriteManager.access$700().info("+LockChannelHel per.commitChanges");
    boolean bool = this.changePending;
    if (this.changePending)
    {
    FavoriteManager.access$700().info("change pending!");
    this.changePending = false;
    if ((syncLockFlags()) || (this.lineupUpdated))
    {
    FavoriteManager.access$700().info("sync lock flags indicated local modification exists");
    this.lineupUpdated = false;
    syncChannelIDStrings();
    syncChannelRefNumbersStrings();
    FavoriteManager.access$700().info("channel id strings is now:" + this.favRec.channelIDNumbers);
    FavoriteManager.access$700().info("channel ref strings is now:" + this.favRec.channelRefNumbers);
    FavoriteManager.access$900(this.this$0);
    if (this.favRec.id == -1L)
    {
    FavoriteManager.access$700().info("new");
    if (this.favRec.channelIDNumbers.length() != 0)
    {
    FavoriteManager.access$700().info("about to add to server");
    FavoriteManager.access$1100(this.this$0, this.favRec);
    FavoriteManager.access$700().info("done add to server - fav id is now: " + this.favRec.id);
    }
    }
    else
    {
    FavoriteManager.access$700().info("not new");
    if (this.favRec.channelIDNumbers.length() == 0)
    {
    FavoriteManager.access$700().info("delete");
    FavoriteManager.access$1200(this.this$0, this.favRec);
    this.favRec.id = -1L;
    }
    else
    {
    FavoriteManager.access$700().info("update");
    FavoriteManager.access$1300(this.this$0, this.favRec);
    FavoriteManager.access$700().info("done update to server");
    }
    }
    }
    }
    if ((bool) && (paramBoolean))
    FavoriteManager.access$1400(this.this$0);
    }

    private boolean syncLockFlags()
    {
    FavoriteManager.access$700().info("+LockChannelHel per.syncLockFlags");
    int i = 0;
    boolean bool = FavoriteManager.isLockingActivated();
    for (int j = 0; j < this.items.length; ++j)
    {
    Favorite.ChannelItem localChannelItem = this.items[j];
    if (localChannelItem.channel.isLocked() == localChannelItem.included)
    {
    localChannelItem.channel.setLocked(!(localChannelI tem.channel.isLocked()));
    if (localChannelItem.channel.isLocked())
    FavoriteManager.access$700().info("Locking channel: " + localChannelItem.channel.getVisibleNumber());
    i = 1;
    }
    }
    return i;
    }

    private void syncChannelIDStrings()
    {
    FavoriteManager.access$700().info("+LockChannelHel per.syncChannelIDStrings");
    int i = 1;
    StringBuffer localStringBuffer = new StringBuffer();
    for (int j = 0; j < this.items.length; ++j)
    {
    Favorite.ChannelItem localChannelItem = this.items[j];
    if (localChannelItem.included)
    break label79:
    if (i != 0)
    i = 0;
    else
    localStringBuffer.append(",");
    label79: localStringBuffer.append(localChannelItem.channel. getChannelID());
    }
    this.favRec.channelIDNumbers = StringBufferHelper.toString(localStringBuffer);
    }

    public void syncChannelRefNumbersStrings()
    {
    FavoriteManager.access$700().info("+LockChannelHel per.syncChannelRefNumbersStrings");
    int i = 1;
    StringBuffer localStringBuffer = new StringBuffer();
    for (int j = 0; j < this.items.length; ++j)
    {
    Favorite.ChannelItem localChannelItem = this.items[j];
    if (localChannelItem.included)
    break label79:
    if (i != 0)
    i = 0;
    else
    localStringBuffer.append(",");
    label79: localStringBuffer.append(localChannelItem.channel. getChannelReferenceNumber());
    }
    this.favRec.channelRefNumbers = StringBufferHelper.toString(localStringBuffer);
    }

    public void toggle()
    {
    Favorite.ChannelItem localChannelItem = this.items[paramInt];
    localChannelItem.included = (!(localChannelItem.included));
    this.changePending = true;
    }

    public void includeChannel(, boolean paramBoolean)
    {
    Favorite.ChannelItem localChannelItem = this.items[paramInt];
    if (localChannelItem.included != paramBoolean)
    {
    localChannelItem.included = paramBoolean;
    this.changePending = true;
    }
    }

    public boolean isChannelIncluded()
    {
    return this.items[paramInt].included;
    }

    public Favorite.ChannelItem getChannelItem()
    {
    return this.items[paramInt];
    }

    public int length()
    {
    return this.items.length;
    }

    private boolean isChannelLocked(, String[] paramArrayOfString)
    {
    int i = paramChannel.getChannelID();
    for (int j = 0; j < paramArrayOfString.length; ++j)
    if (i == Integer.parseInt(paramArrayOfString[j]))
    return true;
    return false;
    }

    public boolean isChannelSubscribed()
    {
    for (int i = 0; i < this.items.length; ++i)
    {
    Favorite.ChannelItem localChannelItem = this.items[i];
    if (paramInt == localChannelItem.channel.getVisibleNumber())
    {
    String[] arrayOfString = localChannelItem.channel.getPackages();
    for (int j = 0; j < arrayOfString.length; ++j)
    if (PersistentDataManager.getInstance().isSubscribed( arrayOfString[j]))
    return true;
    }
    }
    return false;
    }

    static void access$000(LockChannelHelper paramLockChannelHelper)
    {
    paramLockChannelHelper.updateFavRecs(paramArrayOfF avoriteRecord);
    }

    static void access$100(LockChannelHelper paramLockChannelHelper)
    {
    paramLockChannelHelper.updateChannelLineup(paramAr rayOfChannel);
    }

    static boolean access$300(LockChannelHelper paramLockChannelHelper)
    {
    return paramLockChannelHelper.changePending;
    }
    }



    Here is sourceCode of this class:
    /**
    * Helper class for hand
    *
    * @author $author$
    * @version $Date$
    */
    public class LockChannelHelper {

    /** DOCUMENT ME! */
    private boolean changePending;

    /** DOCUMENT ME! */
    private boolean lineupUpdated;

    /** hack - we reuse Favorite.ChannelItem class here, with 'included' flag meaning 'unlocked' */
    private Favorite.ChannelItem[] items = new Favorite.ChannelItem[0];

    /** DOCUMENT ME! */
    private Favorite.FavoriteRecord favRec;

    /**
    * Creates a new LockChannelHelper object.
    *
    * @param favRecs DOCUMENT ME!
    * @param channelLineup DOCUMENT ME!
    */
    public LockChannelHelper(Favorite.FavoriteRecord[] favRecs, Channel[] channelLineup) {
    logger.info("+LockChannelHelper.<init>");
    favRec = new Favorite.FavoriteRecord();
    favRec.id = -1;
    favRec.name = favLockName;
    favRec.channelIDNumbers = "";
    initLineup(channelLineup);
    initFavRecs(favRecs);
    }

    /**
    * DOCUMENT ME!
    *
    * @param channelLineup
    */
    private void initLineup(Channel[] channelLineup) {
    logger.info("+LockChannelHelper.initLineup");

    if (channelLineup == null) {
    return;
    }

    items = new Favorite.ChannelItem[channelLineup.length];

    for (int i = 0; i < channelLineup.length; i++) {
    items[i] = new Favorite.ChannelItem(channelLineup[i], !channelLineup[i].isLocked());
    }
    }

    /**
    * This can be called after favorite trigger or subscriber info trigger. In the case of subscriber info trigger,
    * updateChannelLineup() should be called after this.
    *
    * @param favRecs
    */
    private void updateFavRecs(Favorite.FavoriteRecord[] favRecs) {

    // TODO - implement
    logger.info("+LockChannelHelper.updateFavRecs");

    if (favRecs == null) {
    return;
    }

    Favorite.FavoriteRecord newFavRec = null;

    for (int i = 0; i < favRecs.length; i++) {
    Favorite.FavoriteRecord favRec = favRecs[i];

    if (favLockName.equals(favRec.name)) {
    newFavRec = favRec;

    if (favRec.id == -1) {
    logger.error("updateFavRecs - locked fav id is -1");
    }

    break;
    }
    }

    if (newFavRec == null) {

    if (favRec.id != -1) {

    // another STB cleared locked channels
    if (!changePending) {
    favRec.id = -1;
    logger.info("updateFavRecs set name="+favRec.getName()+",channelIDNumbers: "+favRec.channelIDNumbers +", afteris empty");
    favRec.channelIDNumbers = "";
    clearLockFlags();
    reinitFavoriteLocking();
    }
    else {

    // keep our change, but must clear id
    favRec.id = -1;
    }
    }
    else {
    // our favRec is local, doesn't matter we have changed it or not,
    // we will keep it by doing nothing here
    }

    return;
    }

    if (favRec.id == -1) {

    if (changePending) {

    // local change override others
    favRec.id = newFavRec.id;
    }
    else {
    initFavRec(newFavRec);
    reinitFavoriteLocking();
    }
    }
    else {

    if (changePending) {

    // it is possible that favRec.id != -1 && newFavRec.id != favRec.id
    // e.g., local change prevented a previous delete from another STB,
    // now that STB is re-doing an add. Thus we should replace our id with
    // their id
    if (favRec.id != newFavRec.id) {
    logger.warn("local lock fav id different from that on server, use server's");
    favRec.id = newFavRec.id;
    }
    }
    else {

    if (favRec.id != newFavRec.id) {
    logger.warn("2 local lock fav id different from that on server, use server's");
    favRec.id = newFavRec.id;
    }
    logger.info("name="+favRec.getName()+",favRec.chan nelIDNumbers="+favRec.channelIDNumbers+", name2="+newFavRec.getName()+",newFavRec.channelIDN umbers="+newFavRec.channelIDNumbers);
    if ((favRec.channelIDNumbers == null && newFavRec.channelIDNumbers == null) || ( favRec.channelIDNumbers != null && !favRec.channelIDNumbers.equals(newFavRec.channelI DNumbers))) {
    clearLockFlags();
    initFavRec(newFavRec);
    reinitFavoriteLocking();
    }
    }

    } // end if
    } // end method updateFavRecs

    /**
    * This can be called after channel lineup update / reparse to resync locking info to the new lineup
    *
    * @param channelLineup
    */
    private void updateChannelLineup(Channel[] channelLineup) {
    logger.info("+updateChannelLineup");

    // Favorite.ChannelItem[] olditems = items;
    initLineup(channelLineup);

    // for (int i = 0; i < olditems.length; i++) {
    // Favorite.ChannelItem oci = olditems[i];
    //
    // if (!oci.included) {
    //
    // for (int j = 0; j < items.length; j++) {
    // Favorite.ChannelItem ci = items[j];
    //
    // if (oci.channel.getChannelID() == ci.channel.getChannelID()) {
    // ci.channel.setLocked(true);
    // ci.included = false;
    // ipgDataManager.getChannelByID(ci.channel.getChanne lID()).setLocked(true);
    // logger.info("Locking channel: "
    // + ci.channel.getVisibleNumber());
    // break;
    // }
    // }
    // }
    // }

    if (changePending) {
    lineupUpdated = true;
    }
    } // end method updateChannelLineup

    /**
    * DOCUMENT ME!
    *
    * @param favRecs
    */
    private void initFavRecs(Favorite.FavoriteRecord[] favRecs) {
    logger.info("+LockChannelHelper.initFavRecs");

    if (favRecs == null) {
    return;
    }

    for (int i = 0; i < favRecs.length; i++) {
    Favorite.FavoriteRecord favRec = favRecs[i];

    if (favLockName.equals(favRec.name)) {
    initFavRec(favRec);
    return;
    }
    }
    }

    /**
    * DOCUMENT ME!
    */
    private void clearLockFlags() {

    for (int i = 0; i < items.length; i++) {
    Favorite.ChannelItem ci = items[i];
    ci.included = true;
    ci.channel.setLocked(false);
    ipgDataManager.getChannelByID(ci.channel.getChanne lID()).setLocked(!ci.included);
    }
    }

    /**
    * DOCUMENT ME!
    *
    * @param favRec
    */
    private void initFavRec(Favorite.FavoriteRecord favRec) {
    logger.info("+LockChannelHelper.initFavRec");

    if (favRec.id == -1) {
    logger.error("initFavRec - id is -1");
    }

    this.favRec = favRec;
    ArrayList al = new ArrayList();
    logger.info("+initFavRec favRec="+favRec.getName()+", favRec.channelIDNumbers="+favRec.channelIDNumbers) ;
    //favRec.channelIDNumbers = null;
    logger.info("+initFavRec favRec="+favRec.getName()+", favRec.channelIDNumbers="+favRec.channelIDNumbers) ;
    //if (favRec.channelIDNumbers != null) {
    logger.info("in not null block : "+favRec.channelIDNumbers+"\n"+favRec.channelRefNu mbers);
    for (StringTokenizer st = new StringTokenizer(favRec.channelIDNumbers, ","); st.hasMoreTokens();) {
    al.add(st.nextToken());
    }
    ///}
    String[] lockedChannels = new String[al.size()];
    al.toArray(lockedChannels);

    for (int i = 0; i < items.length; i++) {
    Favorite.ChannelItem ci = items[i];

    if (isChannelLocked(ci.channel, lockedChannels)) {
    ci.channel.setLocked(true);
    ci.included = false;
    ipgDataManager.getChannelByID(ci.channel.getChanne lID()).setLocked(true);
    logger.info("Locking channel: " + ci.channel.getVisibleNumber());
    }
    }
    } // end method initFavRec

    /**
    * DOCUMENT ME!
    *
    * @return
    */
    public boolean areAllChannelsLockedOrUnsubscribed() {

    for (int i = 0; i < items.length; i++) {
    Favorite.ChannelItem ci = items[i];

    if (!ci.channel.isLocked() && ci.channel.isSubscribed()) {
    return false;
    }
    }

    return true;
    }

    /**
    * This method allows us to check (before a commit) if there will be at least one Subscribed unhidden channel.
    *
    * @return
    */
    public boolean areAllChannelsGoingToBeLockedOrUnsubscribedIfCommi t() {

    for (int i = 0; i < items.length; i++) {
    Favorite.ChannelItem ci = items[i];

    if (ci.included && ci.channel.isSubscribed()) {
    return false;
    }
    }

    return true;
    }

    /**
    * DOCUMENT ME!
    *
    * @param notifyChanges
    */
    public void commitChanges(boolean notifyChanges) {
    logger.info("+LockChannelHelper.commitChanges");

    boolean changed = this.changePending;

    if (changePending) {
    logger.info("change pending!");
    changePending = false;

    if (syncLockFlags() || lineupUpdated) {
    logger.info("sync lock flags indicated local modification exists");
    lineupUpdated = false;
    syncChannelIDStrings();
    syncChannelRefNumbersStrings();
    logger.info("channel id strings is now:" + favRec.channelIDNumbers);
    logger.info("channel ref strings is now:" + favRec.channelRefNumbers);

    // we need to re-create all items_L in Favorites
    reinitFavoriteLocking();

    if (favRec.id == -1) {

    // new
    logger.info("new");

    if (favRec.channelIDNumbers != null && favRec.channelIDNumbers.length() != 0) {

    // add fav to server
    logger.info("about to add to server");
    addFavoriteToServer(favRec);
    logger.info("done add to server - fav id is now: " + favRec.id);
    }
    }
    else {

    // update or delete
    logger.info("not new");
    logger.info("+commitChanges favRec="+favRec.getName()+", favRec.channelIDNumbers="+favRec.channelIDNumbers) ;
    if (favRec.channelIDNumbers == null || favRec.channelIDNumbers.length() == 0) {

    // delete
    logger.info("delete");
    deleteFavoriteFromServer(favRec);
    favRec.id = -1;
    }
    else {

    // update
    logger.info("update");
    saveFavoriteToServer(favRec);
    logger.info("done update to server");
    }
    }

    } // end if
    } // end if

    if (changed && notifyChanges) {
    notifyFavoritesModified();
    }
    } // end method commitChanges

    /**
    * commit lock flags from items back to the channels themselves.
    *
    * @return
    */
    private boolean syncLockFlags() {
    logger.info("+LockChannelHelper.syncLockFlags");
    boolean modified = false;
    boolean lockingActive = FavoriteManager.isLockingActivated();

    for (int i = 0; i < items.length; i++) {
    Favorite.ChannelItem ci = items[i];

    if (ci.channel.isLocked() == ci.included) {
    ci.channel.setLocked(!ci.channel.isLocked());

    if (ci.channel.isLocked()) {
    logger.info("Locking channel: " + ci.channel.getVisibleNumber());
    }

    modified = true;
    }
    }

    return modified;
    }

    /**
    * DOCUMENT ME!
    */
    private void syncChannelIDStrings() {
    logger.info("+LockChannelHelper.syncChannelIDStrin gs");
    boolean first = true;
    StringBuffer sb = new StringBuffer();

    for (int i = 0; i < items.length; i++) {
    Favorite.ChannelItem ci = items[i];

    if (ci.included) {
    continue;
    }

    if (first) {
    first = false;
    }
    else {
    sb.append(",");
    }

    sb.append(ci.channel.getChannelID());
    }
    logger.info("+syncChannelIDStrings items="+items.length+", favRec.channelIDNumbers="+favRec.channelIDNumbers+ ", favRec.channelIDNumbers2="+StringBufferHelper.toSt ring(sb));
    favRec.channelIDNumbers = StringBufferHelper.toString(sb);
    }

    /**
    * *
    */
    public void syncChannelRefNumbersStrings() {
    logger.info("+LockChannelHelper.syncChannelRefNumb ersStrings");
    boolean first = true;
    StringBuffer sb = new StringBuffer();

    for (int i = 0; i < items.length; i++) {
    Favorite.ChannelItem ci = items[i];

    if (ci.included) {
    continue;
    }

    if (first) {
    first = false;
    }
    else {
    sb.append(",");
    }

    sb.append(ci.channel.getChannelReferenceNumber());
    }
    logger.info("+syncChannelRefNumbersStrings items="+items.length+", favRec.channelRefNumbers="+favRec.channelRefNumber s+", favRec.channelIDNumbers2="+StringBufferHelper.toSt ring(sb));
    favRec.channelRefNumbers = StringBufferHelper.toString(sb);
    }

    /**
    * DOCUMENT ME!
    *
    * @param index
    */
    public void toggle(int index) {
    Favorite.ChannelItem ci = items[index];
    ci.included = !ci.included;
    changePending = true;
    }

    /**
    * DOCUMENT ME!
    *
    * @param index
    * @param include
    */
    public void includeChannel(Channel channel, boolean include) {

    List itemList = Arrays.asList(items);
    int itemIndex = itemList.indexOf(new Favorite.ChannelItem(channel, !channel.isLocked()));

    if (logger.isDebugEnabled()) {
    logger.debug("itemIndex =" + itemIndex);
    }
    if (itemIndex != -1){
    Favorite.ChannelItem ci = items[itemIndex];

    if (ci.included != include) {
    ci.included = include;
    changePending = true;
    }
    }
    }

    /**
    * DOCUMENT ME!
    *
    * @param index
    *
    * @return boolean
    */
    public boolean isChannelIncluded(int index) {
    return items[index].included;

    }

    /**
    * Returns $param.name$
    *
    * @param index
    *
    * @return
    */
    public Favorite.ChannelItem getChannelItem(int index) {
    return items[index];
    }

    /**
    * DOCUMENT ME!
    *
    * @return
    */
    public int length() {
    return items.length;
    }

    /**
    * Returns $param.name$
    *
    * @param c
    * @param lockedChannels
    *
    * @return
    */
    private boolean isChannelLocked(Channel c, String[] lockedChannels) {
    int cid = c.getChannelID();

    for (int i = 0; i < lockedChannels.length; i++) {

    if (cid == Integer.parseInt(lockedChannels[i])) {
    return true;
    }
    }

    return false;
    }

    /**
    * DOCUMENT ME!
    *
    * @param chNum
    *
    * @return boolean
    */
    public boolean isChannelSubscribed(int chNum) {

    for (int i = 0; i < items.length; i++) {
    Favorite.ChannelItem ci = items[i];

    if (chNum == ci.channel.getVisibleNumber()) {
    String[] packageNames = ci.channel.getPackages();

    for (int j = 0; j < packageNames.length; j++) {

    if (PersistentDataManager.getInstance().isSubscribed( packageNames[j])) {
    return true;
    }
    }
    }
    }

    return false;
    }
    } // end class LockChannelHelper



    Please help. It is urgent.

    Rashmi

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  3. #3
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    804
    Rep Power
    6

    Default

    No one knows from the source code you have pasted what you are trying to acheive .

    You have to put some comments and meaningfull try catch block with your own friendly debug messages inside try catch.you have to add print statemenyt to trace the error.

    As far as the exception you have pasted is concerned,exception lying in initFavRec() method.You add print statement after every line to know where it got a problem.
    Might be arraylist or stringtokenizer object is empty resulted to nullpointer exception.
    Ramya:cool:

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Yes, organized stack gives you a proper result. If you've wrap a huge code from a single try-catch then it'll messup.

  5. #5
    grashmi13 is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default

    Thanks for your replies.

    Yes, this is complete printstackTrace which I found in my log file. Actually this log file is received from customer who faced problem. This is rarely reproducible. Because of some data mismatch this happened. We can not ask our customers to use new build having more logger statements. and it is also not sure, they will face same problem again.

    I just want to know what does V(:0:159) in below log statement?
    at mclient/dtv/favorite/FavoriteManager$LockChannelHelper.initFavRec(Lmcli ent/dtv/favorite/Favorite$FavoriteRecordV (:0:159)

    is V(:0:159) enough to get line number in LockChannelHelper class, specially in initFavRec method?

    Arraylist object is already initialized, it could not be null. yes, StringTockenizer may create NullPointerException. But i checked my whole code and found that the variable which is being used in StringTockenizer is not null so this could not be an issue. Items arrayList is also not null. That is why i want to know exact line number in given method which is creating this exception.

  6. #6
    grashmi13 is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default

    I just want to know what does this "V(:0:159)" says in below log statement? what is the meaning of this text?

  7. #7
    grashmi13 is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default

    I have provided decompiled class code and sourcecode, so that if you want to match line number by copying this code in editplus. so that if you want to relate number given in printstacktrace with code.

  8. #8
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Could be a version number. You should able to match with the code, if there are third party libraries and so on. Standard JDK trace don't have such version numbers.

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by grashmi13 View Post
    I have provided decompiled class code and sourcecode, so that if you want to match line number by copying this code in editplus. so that if you want to relate number given in printstacktrace with code.
    Why don't you give a try to run the code and test this?

  10. #10
    grashmi13 is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default

    We are using JDK 1.1. Nothing else. In case innerClass is not used, we get properLineNumber e.g. (FavoriteManager:100) with class name in printstacktrace. but here problem occurred in innerclass method and i am getting this type of V(:0:159) text. :(

  11. #11
    grashmi13 is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default

    yes, this is a good idea. i should forcefully throw nullpointerexception from this method, and i should check what printStackTrace says. Will get back to you in couple of minuted with my findings.

  12. #12
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  13. #13
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by grashmi13 View Post
    yes, this is a good idea. i should forcefully throw nullpointerexception from this method, and i should check what printStackTrace says. Will get back to you in couple of minuted with my findings.
    Try to wrap with classes first, and then with methods.

  14. #14
    grashmi13 is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default

    project need :)

  15. #15
    grashmi13 is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default

    Method code is :

    private void initFavRec(Favorite.FavoriteRecord favRec) {
    logger.info("+LockChannelHelper.initFavRec");

    if (favRec.id == -1) {

    logger.error("initFavRec - id is -1");
    }

    this.favRec = favRec;

    ArrayList al = new ArrayList();

    for (StringTokenizer st = new StringTokenizer(null, ","); st.hasMoreTokens()
    ;) {
    al.add(st.nextToken());
    }

    String[] lockedChannels = new String[al.size()];

    al.toArray(lockedChannels);

    for (int i = 0; i < items.length; i++) {

    Favorite.ChannelItem ci = items[i];

    if (isChannelLocked(ci.channel, lockedChannels)) {

    ci.channel.setLocked(true);
    ci.included = false;
    ipgDataManager.getChannelByID(ci.channel.getChanne lID()).setLocked(true);
    logger.info("Locking channel: " + ci.channel.getVisibleNumber());
    }
    }
    } // end method initFavRec





  16. #16
    grashmi13 is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default

    Quote Originally Posted by grashmi13 View Post
    Method code is :

    private void initFavRec(Favorite.FavoriteRecord favRec) {
    logger.info("+LockChannelHelper.initFavRec");

    if (favRec.id == -1) {

    logger.error("initFavRec - id is -1");
    }

    this.favRec = favRec;

    ArrayList al = new ArrayList();

    for (StringTokenizer st = new StringTokenizer(null, ","); st.hasMoreTokens()
    ;) {
    al.add(st.nextToken());
    }

    String[] lockedChannels = new String[al.size()];

    al.toArray(lockedChannels);

    for (int i = 0; i < items.length; i++) {

    Favorite.ChannelItem ci = items[i];

    if (isChannelLocked(ci.channel, lockedChannels)) {

    ci.channel.setLocked(true);
    ci.included = false;
    ipgDataManager.getChannelByID(ci.channel.getChanne lID()).setLocked(true);
    logger.info("Locking channel: " + ci.channel.getVisibleNumber());
    }
    }
    } // end method initFavRec





    In this case, printStackTrace is:


    java.lang.NullPointerException
    at java/util/StringTokenizer.<init>(Ljava/lang/String;Ljava/lang/String;Z)V (:0:39)
    at java/util/StringTokenizer.<init>(Ljava/lang/String;Ljava/lang/String;)V (:0:7)
    at mclient/dtv/favorite/FavoriteManager$LockChannelHelper.initFavRec(Lmcli ent/dtv/favorite/Favorite$FavoriteRecord;)V (FavoriteManager.java:3149:54)
    at mclient/dtv/favorite/FavoriteManager$LockChannelHelper.initFavRecs([Lmclient/dtv/favorite/Favorite$FavoriteRecord;)V (FavoriteManager.java:3116:45)
    at mclient/dtv/favorite/FavoriteManager$LockChannelHelper.<init>(Lmclient/dtv/favorite/FavoriteManager;[Lmclient/dtv/favorite/Favorite$FavoriteRecord;[L
    mclient/dtv/Channel;)V (FavoriteManager.java:2943:77)
    at mclient/dtv/favorite/FavoriteManager.refreshData([Lmclient/dtv/Channel;)V (FavoriteManager.java:279:41)
    at mclient/dtv/favorite/FavoriteManager.initTheRest()V (FavoriteManager.java:206:18)
    at mclient/screen/ScreenManager.initTheRestMembers()V (ScreenManager.java:1245:71)
    at mclient/screen/ScreenManager.initAfterAuthenticate(ZZ)V (ScreenManager.java:1031:104)
    at mclient/screen/ScreenManager.initAfterAuthenticate()V (ScreenManager.java:989:6)
    at mclient/ClientContainerHelper.start()V (ClientContainerHelper.java:158:35)
    at mclient/MyrioClient.runMain()V (MyrioClient.java:332:554)
    at mclient/MyrioClient.main([Ljava/lang/String;)V (MyrioClient.java:621:19)

  17. #17
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  18. #18
    grashmi13 is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default

    it is same line which is using StringTockenizer.

  19. #19
    grashmi13 is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default

    Quote Originally Posted by grashmi13 View Post
    Method code is :

    private void initFavRec(Favorite.FavoriteRecord favRec) {
    logger.info("+LockChannelHelper.initFavRec");

    if (favRec.id == -1) {

    logger.error("initFavRec - id is -1");
    }

    this.favRec = favRec;

    ArrayList al = new ArrayList();

    for (StringTokenizer st = new StringTokenizer(null, ","); st.hasMoreTokens()
    ;) {
    al.add(st.nextToken());
    }

    String[] lockedChannels = new String[al.size()];

    al.toArray(lockedChannels);

    for (int i = 0; i < items.length; i++) {

    Favorite.ChannelItem ci = items[i];

    if (isChannelLocked(ci.channel, lockedChannels)) {

    ci.channel.setLocked(true);
    ci.included = false;
    ipgDataManager.getChannelByID(ci.channel.getChanne lID()).setLocked(true);
    logger.info("Locking channel: " + ci.channel.getVisibleNumber());
    }
    }
    } // end method initFavRec




    Quote Originally Posted by Eranga View Post
    What you can find here,

    here 3149 is line number in complete favoriteManager source code and 59 is column number.

  20. #20
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,798
    Rep Power
    19

    Default

    Over 3000 lines in a single class??

    That was never a good idea...

    Anyway, since you seem to be having to decompile the code then I have to ask if you have the code at all? Could it be that this stack trace is essentially the equivalent of "no source code", or whatever it is it says these days.

Similar Threads

  1. How to get line number for a node?
    By XmisterIS in forum XML
    Replies: 0
    Last Post: 09-29-2010, 02:29 PM
  2. Get the Line number in log with Log4j Logger.
    By Anny_1985 in forum Web Frameworks
    Replies: 0
    Last Post: 07-24-2009, 01:18 PM
  3. [SOLVED] Line number: ?
    By Azndaddy in forum New To Java
    Replies: 1
    Last Post: 04-04-2008, 05:46 AM
  4. line number
    By kazitula in forum New To Java
    Replies: 3
    Last Post: 11-21-2007, 10:27 PM
  5. how to know the number of the line
    By simon in forum New To Java
    Replies: 3
    Last Post: 08-01-2007, 04:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •