org.eclipse.team.cvs.core_3.3.400.I20110510-0800

= new ArrayList();
  private Command currentCommand;
  
  public Session(ICVSRepositoryLocation location, ICVSFolder localRoot)
  {
    this(location, localRoot, true);
  }
  
  public Session(ICVSRepositoryLocation location, ICVSFolder localRoot, boolean outputToConsole)
  {
    this.location = ((CVSRepositoryLocation)location);
    this.localRoot = localRoot;
    this.outputToConsole = outputToConsole;
  }
  
  protected void addModuleExpansion(String expansion)
  {
    expansions.add(expansion);
  }
  
  protected void resetModuleExpansion()
  {
    if (expansions == null) {
      expansions = new ArrayList();
    } else {
      expansions.clear();
    }
  }
  
  public void open(IProgressMonitor monitor)
    throws CVSException
  {
    open(monitor, true);
  }
  
  /* Error */
  public void open(IProgressMonitor monitor, boolean writeAccess)
    throws CVSException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 717	org/eclipse/team/internal/ccvs/core/client/Session:connection	Lorg/eclipse/team/internal/ccvs/core/connection/Connection;
    //   4: ifnull +11 -> 15
    //   7: new 373	java/lang/IllegalStateException
    //   10: dup
    //   11: invokespecial 723	java/lang/IllegalStateException:<init>	()V
    //   14: athrow
    //   15: aload_1
    //   16: invokestatic 768	org/eclipse/team/internal/ccvs/core/Policy:monitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   19: astore_1
    //   20: aload_1
    //   21: aconst_null
    //   22: bipush 100
    //   24: invokeinterface 848 3 0
    //   29: iconst_0
    //   30: istore_3
    //   31: aload_0
    //   32: aload_0
    //   33: iload_2
    //   34: invokespecial 798	org/eclipse/team/internal/ccvs/core/client/Session:getLocationForConnection	(Z)Lorg/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation;
    //   37: aload_1
    //   38: bipush 50
    //   40: invokestatic 769	org/eclipse/team/internal/ccvs/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   43: invokevirtual 813	org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation:openConnection	(Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/team/internal/ccvs/core/connection/Connection;
    //   46: putfield 717	org/eclipse/team/internal/ccvs/core/client/Session:connection	Lorg/eclipse/team/internal/ccvs/core/connection/Connection;
    //   49: aload_0
    //   50: getfield 716	org/eclipse/team/internal/ccvs/core/client/Session:location	Lorg/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation;
    //   53: invokevirtual 811	org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation:getServerPlatform	()I
    //   56: iconst_1
    //   57: if_icmpne +7 -> 64
    //   60: iconst_0
    //   61: goto +4 -> 65
    //   64: iconst_1
    //   65: istore 4
    //   67: iload 4
    //   69: ifne +9 -> 78
    //   72: aload_0
    //   73: ldc 4
    //   75: invokevirtual 790	org/eclipse/team/internal/ccvs/core/client/Session:removeResponseHandler	(Ljava/lang/String;)V
    //   78: aload_0
    //   79: getfield 717	org/eclipse/team/internal/ccvs/core/client/Session:connection	Lorg/eclipse/team/internal/ccvs/core/connection/Connection;
    //   82: new 379	java/lang/StringBuffer
    //   85: dup
    //   86: ldc 6
    //   88: invokespecial 742	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   91: aload_0
    //   92: invokespecial 788	org/eclipse/team/internal/ccvs/core/client/Session:makeResponseList	()Ljava/lang/String;
    //   95: invokevirtual 744	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   98: invokevirtual 741	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   101: invokevirtual 820	org/eclipse/team/internal/ccvs/core/connection/Connection:writeLine	(Ljava/lang/String;)V
    //   104: aload_0
    //   105: getfield 717	org/eclipse/team/internal/ccvs/core/client/Session:connection	Lorg/eclipse/team/internal/ccvs/core/connection/Connection;
    //   108: invokevirtual 815	org/eclipse/team/internal/ccvs/core/connection/Connection:flush	()V
    //   111: getstatic 700	org/eclipse/team/internal/ccvs/core/client/Request:VALID_REQUESTS	Lorg/eclipse/team/internal/ccvs/core/client/ValidRequests;
    //   114: aload_0
    //   115: aload_1
    //   116: bipush 40
    //   118: invokestatic 769	org/eclipse/team/internal/ccvs/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   121: invokevirtual 809	org/eclipse/team/internal/ccvs/core/client/ValidRequests:execute	(Lorg/eclipse/team/internal/ccvs/core/client/Session;Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/core/runtime/IStatus;
    //   124: astore 5
    //   126: aload 5
    //   128: invokeinterface 849 1 0
    //   133: ifne +13 -> 146
    //   136: new 398	org/eclipse/team/internal/ccvs/core/CVSException
    //   139: dup
    //   140: aload 5
    //   142: invokespecial 756	org/eclipse/team/internal/ccvs/core/CVSException:<init>	(Lorg/eclipse/core/runtime/IStatus;)V
    //   145: athrow
    //   146: aload_0
    //   147: getfield 717	org/eclipse/team/internal/ccvs/core/client/Session:connection	Lorg/eclipse/team/internal/ccvs/core/connection/Connection;
    //   150: new 379	java/lang/StringBuffer
    //   153: dup
    //   154: ldc 5
    //   156: invokespecial 742	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   159: aload_0
    //   160: invokevirtual 786	org/eclipse/team/internal/ccvs/core/client/Session:getRepositoryRoot	()Ljava/lang/String;
    //   163: invokevirtual 744	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   166: invokevirtual 741	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   169: invokevirtual 820	org/eclipse/team/internal/ccvs/core/connection/Connection:writeLine	(Ljava/lang/String;)V
    //   172: aload_0
    //   173: invokestatic 764	org/eclipse/team/internal/ccvs/core/CVSProviderPlugin:getPlugin	()Lorg/eclipse/team/internal/ccvs/core/CVSProviderPlugin;
    //   176: invokevirtual 758	org/eclipse/team/internal/ccvs/core/CVSProviderPlugin:getCompressionLevel	()I
    //   179: putfield 701	org/eclipse/team/internal/ccvs/core/client/Session:compressionLevel	I
    //   182: aload_0
    //   183: getfield 701	org/eclipse/team/internal/ccvs/core/client/Session:compressionLevel	I
    //   186: ifeq +44 -> 230
    //   189: aload_0
    //   190: ldc 7
    //   192: invokevirtual 793	org/eclipse/team/internal/ccvs/core/client/Session:isValidRequest	(Ljava/lang/String;)Z
    //   195: ifeq +35 -> 230
    //   198: aload_0
    //   199: getfield 717	org/eclipse/team/internal/ccvs/core/client/Session:connection	Lorg/eclipse/team/internal/ccvs/core/connection/Connection;
    //   202: new 379	java/lang/StringBuffer
    //   205: dup
    //   206: ldc 8
    //   208: invokespecial 742	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   211: aload_0
    //   212: getfield 701	org/eclipse/team/internal/ccvs/core/client/Session:compressionLevel	I
    //   215: invokestatic 724	java/lang/Integer:toString	(I)Ljava/lang/String;
    //   218: invokevirtual 744	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   221: invokevirtual 741	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   224: invokevirtual 820	org/eclipse/team/internal/ccvs/core/connection/Connection:writeLine	(Ljava/lang/String;)V
    //   227: goto +8 -> 235
    //   230: aload_0
    //   231: iconst_0
    //   232: putfield 701	org/eclipse/team/internal/ccvs/core/client/Session:compressionLevel	I
    //   235: invokestatic 764	org/eclipse/team/internal/ccvs/core/CVSProviderPlugin:getPlugin	()Lorg/eclipse/team/internal/ccvs/core/CVSProviderPlugin;
    //   238: invokevirtual 759	org/eclipse/team/internal/ccvs/core/CVSProviderPlugin:isDetermineVersionEnabled	()Z
    //   241: ifeq +31 -> 272
    //   244: aload_0
    //   245: getfield 716	org/eclipse/team/internal/ccvs/core/client/Session:location	Lorg/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation;
    //   248: invokevirtual 811	org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation:getServerPlatform	()I
    //   251: ifne +21 -> 272
    //   254: getstatic 699	org/eclipse/team/internal/ccvs/core/client/Command:VERSION	Lorg/eclipse/team/internal/ccvs/core/client/Version;
    //   257: aload_0
    //   258: aload_0
    //   259: getfield 716	org/eclipse/team/internal/ccvs/core/client/Session:location	Lorg/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation;
    //   262: aload_1
    //   263: bipush 10
    //   265: invokestatic 769	org/eclipse/team/internal/ccvs/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   268: invokevirtual 810	org/eclipse/team/internal/ccvs/core/client/Version:execute	(Lorg/eclipse/team/internal/ccvs/core/client/Session;Lorg/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation;Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/core/runtime/IStatus;
    //   271: pop
    //   272: iconst_1
    //   273: istore_3
    //   274: goto +29 -> 303
    //   277: astore 6
    //   279: aload_0
    //   280: getfield 717	org/eclipse/team/internal/ccvs/core/client/Session:connection	Lorg/eclipse/team/internal/ccvs/core/connection/Connection;
    //   283: ifnull +11 -> 294
    //   286: iload_3
    //   287: ifne +7 -> 294
    //   290: aload_0
    //   291: invokevirtual 782	org/eclipse/team/internal/ccvs/core/client/Session:close	()V
    //   294: aload_1
    //   295: invokeinterface 846 1 0
    //   300: aload 6
    //   302: athrow
    //   303: aload_0
    //   304: getfield 717	org/eclipse/team/internal/ccvs/core/client/Session:connection	Lorg/eclipse/team/internal/ccvs/core/connection/Connection;
    //   307: ifnull +11 -> 318
    //   310: iload_3
    //   311: ifne +7 -> 318
    //   314: aload_0
    //   315: invokevirtual 782	org/eclipse/team/internal/ccvs/core/client/Session:close	()V
    //   318: aload_1
    //   319: invokeinterface 846 1 0
    //   324: return
    // Line number table:
    //   Java source line #153	-> byte code offset #0
    //   Java source line #154	-> byte code offset #15
    //   Java source line #155	-> byte code offset #20
    //   Java source line #156	-> byte code offset #29
    //   Java source line #159	-> byte code offset #31
    //   Java source line #163	-> byte code offset #49
    //   Java source line #164	-> byte code offset #67
    //   Java source line #165	-> byte code offset #72
    //   Java source line #169	-> byte code offset #78
    //   Java source line #171	-> byte code offset #104
    //   Java source line #174	-> byte code offset #111
    //   Java source line #175	-> byte code offset #126
    //   Java source line #176	-> byte code offset #136
    //   Java source line #180	-> byte code offset #146
    //   Java source line #183	-> byte code offset #172
    //   Java source line #184	-> byte code offset #182
    //   Java source line #191	-> byte code offset #198
    //   Java source line #193	-> byte code offset #230
    //   Java source line #197	-> byte code offset #235
    //   Java source line #198	-> byte code offset #254
    //   Java source line #200	-> byte code offset #272
    //   Java source line #201	-> byte code offset #277
    //   Java source line #202	-> byte code offset #279
    //   Java source line #203	-> byte code offset #290
    //   Java source line #205	-> byte code offset #294
    //   Java source line #206	-> byte code offset #300
    //   Java source line #202	-> byte code offset #303
    //   Java source line #203	-> byte code offset #314
    //   Java source line #205	-> byte code offset #318
    //   Java source line #207	-> byte code offset #324
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	325	0	this	Session
    //   0	325	1	monitor	IProgressMonitor
    //   0	325	2	writeAccess	boolean
    //   30	281	3	opened	boolean
    //   65	3	4	useMT	boolean
    //   124	17	5	status	IStatus
    //   277	24	6	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   31	277	277	finally
  }
  
  private CVSRepositoryLocation getLocationForConnection(boolean writeAccess)
  {
    return location;
  }
  
  public void close()
  {
    if (connection != null)
    {
      connection.close();
      connection = null;
      validRequests = null;
    }
  }
  
  public boolean isValidRequest(String request)
  {
    return (validRequests == null) || (validRequests.indexOf(" " + request + " ") != -1);
  }
  
  public boolean isCVSNT()
  {
    if (location.getServerPlatform() == 0) {
      return location.getRootDirectory().indexOf(':') == 1;
    }
    return location.getServerPlatform() == 2;
  }
  
  public ICVSFolder getLocalRoot()
  {
    return localRoot;
  }
  
  public String[] getModuleExpansions()
  {
    if (expansions == null) {
      return new String[0];
    }
    return (String[])expansions.toArray(new String[expansions.size()]);
  }
  
  public String getRepositoryRoot()
  {
    return location.getRootDirectory();
  }
  
  public ICVSRepositoryLocation getCVSRepositoryLocation()
  {
    return location;
  }
  
  public String readLine()
    throws CVSException
  {
    return connection.readLine();
  }
  
  public void writeLine(String line)
    throws CVSException
  {
    connection.writeLine(line);
  }
  
  public void sendArgument(String arg)
    throws CVSException
  {
    connection.write("Argument ");
    int oldPos = 0;
    for (;;)
    {
      int pos = arg.indexOf('\n', oldPos);
      if (pos == -1) {
        break;
      }
      connection.writeLine(stripTrainingCR(arg.substring(oldPos, pos)));
      connection.write("Argumentx ");
      oldPos = pos + 1;
    }
    connection.writeLine(stripTrainingCR(arg.substring(oldPos)));
  }
  
  private String stripTrainingCR(String string)
  {
    if (string.endsWith("\r")) {
      return string.substring(0, string.length() - 1);
    }
    return string;
  }
  
  public void sendRequest(String requestId)
    throws CVSException
  {
    connection.writeLine(requestId);
    connection.flush();
  }
  
  public void sendIsModified(ICVSFile file, boolean isBinary, IProgressMonitor monitor)
    throws CVSException
  {
    if (isValidRequest("Is-modified")) {
      connection.writeLine("Is-modified " + file.getName());
    } else {
      sendModified(file, isBinary, monitor);
    }
  }
  
  public void sendStaticDirectory()
    throws CVSException
  {
    connection.writeLine("Static-directory");
  }
  
  public void sendConstructedDirectory(String localDir)
    throws CVSException
  {
    String path = Util.appendPath(getRepositoryRoot(), localDir);
    sendDirectory(localDir, path);
  }
  
  public void sendDirectory(String localDir, String remoteDir)
    throws CVSException
  {
    if (localDir.length() == 0) {
      localDir = ".";
    }
    connection.writeLine("Directory " + localDir);
    connection.writeLine(remoteDir);
  }
  
  public void sendLocalRootDirectory()
    throws CVSException
  {
    sendDirectory(".", localRoot.getRemoteLocation(localRoot));
  }
  
  public void sendConstructedRootDirectory()
    throws CVSException
  {
    sendConstructedDirectory("");
  }
  
  public void sendEntry(byte[] syncBytes, String serverTimestamp)
    throws CVSException
  {
    connection.write("Entry ");
    if (serverTimestamp == null) {
      serverTimestamp = "";
    }
    int start = Util.getOffsetOfDelimeter(syncBytes, (byte)47, 0, 3);
    if (start == -1)
    {
      connection.writeLine(new String(syncBytes));
      return;
    }
    int end = Util.getOffsetOfDelimeter(syncBytes, (byte)47, start + 1, 1);
    if (end == -1)
    {
      connection.writeLine(new String(syncBytes));
      return;
    }
    connection.write(new String(syncBytes, 0, start + 1));
    connection.write(serverTimestamp);
    connection.writeLine(new String(syncBytes, end, syncBytes.length - end));
  }
  
  public void sendGlobalOption(String option)
    throws CVSException
  {
    connection.writeLine("Global_option " + option);
  }
  
  public void sendUnchanged(ICVSFile file)
    throws CVSException
  {
    connection.writeLine("Unchanged " + file.getName());
  }
  
  public void sendNotify(ICVSFolder parent, NotifyInfo info)
    throws CVSException
  {
    String filename = info.getName();
    connection.writeLine("Notify " + filename);
    connection.writeLine(info.getServerLine(parent));
  }
  
  public void sendQuestionable(ICVSResource resource)
    throws CVSException
  {
    connection.writeLine("Questionable " + resource.getName());
  }
  
  public void sendSticky(String tag)
    throws CVSException
  {
    connection.writeLine("Sticky " + tag);
  }
  
  public void sendModified(ICVSFile file, boolean isBinary, IProgressMonitor monitor)
    throws CVSException
  {
    sendModified(file, isBinary, true, monitor);
  }
  
  public void sendModified(ICVSFile file, boolean isBinary, boolean sendBinary, IProgressMonitor monitor)
    throws CVSException
  {
    String filename = file.getName();
    connection.writeLine("Modified " + filename);
    if (file.isExecutable()) {
      connection.writeLine(ResourceSyncInfo.getDefaultExecutablePermissions());
    } else {
      connection.writeLine(ResourceSyncInfo.getDefaultPermissions());
    }
    sendFile(file, isBinary, sendBinary, monitor);
  }
  
  /* Error */
  public void sendFile(ICVSStorage file, boolean isBinary, boolean sendBinary, IProgressMonitor monitor)
    throws CVSException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 709	org/eclipse/team/internal/ccvs/core/client/Session:textTransferOverrideSet	Ljava/util/Collection;
    //   4: ifnull +18 -> 22
    //   7: aload_0
    //   8: getfield 709	org/eclipse/team/internal/ccvs/core/client/Session:textTransferOverrideSet	Ljava/util/Collection;
    //   11: aload_1
    //   12: invokeinterface 831 2 0
    //   17: ifeq +5 -> 22
    //   20: iconst_0
    //   21: istore_2
    //   22: aload_0
    //   23: invokevirtual 787	org/eclipse/team/internal/ccvs/core/client/Session:getSendFileTitleMessage	()Ljava/lang/String;
    //   26: iconst_1
    //   27: anewarray 377	java/lang/Object
    //   30: dup
    //   31: iconst_0
    //   32: aload_1
    //   33: aload_0
    //   34: getfield 714	org/eclipse/team/internal/ccvs/core/client/Session:localRoot	Lorg/eclipse/team/internal/ccvs/core/ICVSFolder;
    //   37: iconst_3
    //   38: invokestatic 827	org/eclipse/team/internal/ccvs/core/util/Util:toTruncatedPath	(Lorg/eclipse/team/internal/ccvs/core/ICVSStorage;Lorg/eclipse/team/internal/ccvs/core/ICVSFolder;I)Ljava/lang/String;
    //   41: aastore
    //   42: invokestatic 754	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    //   45: astore 5
    //   47: aload 4
    //   49: getstatic 696	org/eclipse/team/internal/ccvs/core/CVSMessages:Session_transferNoSize	Ljava/lang/String;
    //   52: iconst_1
    //   53: anewarray 378	java/lang/String
    //   56: dup
    //   57: iconst_0
    //   58: aload 5
    //   60: aastore
    //   61: invokestatic 754	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    //   64: invokeinterface 847 2 0
    //   69: aconst_null
    //   70: astore 6
    //   72: iload_2
    //   73: ifeq +43 -> 116
    //   76: iload_3
    //   77: ifne +39 -> 116
    //   80: ldc_w 364
    //   83: invokevirtual 729	java/lang/String:getBytes	()[B
    //   86: astore 9
    //   88: aload_0
    //   89: new 369	java/io/ByteArrayInputStream
    //   92: dup
    //   93: aload 9
    //   95: invokespecial 718	java/io/ByteArrayInputStream:<init>	([B)V
    //   98: aload 9
    //   100: arraylength
    //   101: i2l
    //   102: invokespecial 785	org/eclipse/team/internal/ccvs/core/client/Session:sendUncompressedBytes	(Ljava/io/InputStream;J)V
    //   105: aload 6
    //   107: ifnull +8 -> 115
    //   110: aload 6
    //   112: invokevirtual 719	java/io/InputStream:close	()V
    //   115: return
    //   116: aload_0
    //   117: getfield 701	org/eclipse/team/internal/ccvs/core/client/Session:compressionLevel	I
    //   120: ifne +162 -> 282
    //   123: aload_1
    //   124: invokeinterface 857 1 0
    //   129: astore 6
    //   131: iload_2
    //   132: ifne +111 -> 243
    //   135: getstatic 702	org/eclipse/team/internal/ccvs/core/client/Session:IS_CRLF_PLATFORM	Z
    //   138: ifeq +105 -> 243
    //   141: sipush 8192
    //   144: newarray <illegal type>
    //   146: astore 9
    //   148: new 428	org/eclipse/team/internal/core/streams/CRLFtoLFInputStream
    //   151: dup
    //   152: aload 6
    //   154: invokespecial 828	org/eclipse/team/internal/core/streams/CRLFtoLFInputStream:<init>	(Ljava/io/InputStream;)V
    //   157: astore 6
    //   159: new 408	org/eclipse/team/internal/ccvs/core/client/ByteCountOutputStream
    //   162: dup
    //   163: invokespecial 771	org/eclipse/team/internal/ccvs/core/client/ByteCountOutputStream:<init>	()V
    //   166: astore 10
    //   168: goto +13 -> 181
    //   171: aload 10
    //   173: aload 9
    //   175: iconst_0
    //   176: iload 11
    //   178: invokevirtual 773	org/eclipse/team/internal/ccvs/core/client/ByteCountOutputStream:write	([BII)V
    //   181: aload 6
    //   183: aload 9
    //   185: invokevirtual 720	java/io/InputStream:read	([B)I
    //   188: dup
    //   189: istore 11
    //   191: iconst_m1
    //   192: if_icmpne -21 -> 171
    //   195: goto +13 -> 208
    //   198: astore 12
    //   200: aload 10
    //   202: invokevirtual 772	org/eclipse/team/internal/ccvs/core/client/ByteCountOutputStream:close	()V
    //   205: aload 12
    //   207: athrow
    //   208: aload 10
    //   210: invokevirtual 772	org/eclipse/team/internal/ccvs/core/client/ByteCountOutputStream:close	()V
    //   213: aload 6
    //   215: invokevirtual 719	java/io/InputStream:close	()V
    //   218: aload 10
    //   220: invokevirtual 770	org/eclipse/team/internal/ccvs/core/client/ByteCountOutputStream:getSize	()J
    //   223: lstore 7
    //   225: new 428	org/eclipse/team/internal/core/streams/CRLFtoLFInputStream
    //   228: dup
    //   229: aload_1
    //   230: invokeinterface 857 1 0
    //   235: invokespecial 828	org/eclipse/team/internal/core/streams/CRLFtoLFInputStream:<init>	(Ljava/io/InputStream;)V
    //   238: astore 6
    //   240: goto +11 -> 251
    //   243: aload_1
    //   244: invokeinterface 856 1 0
    //   249: lstore 7
    //   251: new 418	org/eclipse/team/internal/ccvs/core/client/Session$1
    //   254: dup
    //   255: aload_0
    //   256: aload 6
    //   258: lload 7
    //   260: ldc 1
    //   262: aload 4
    //   264: aload 5
    //   266: invokespecial 806	org/eclipse/team/internal/ccvs/core/client/Session$1:<init>	(Lorg/eclipse/team/internal/ccvs/core/client/Session;Ljava/io/InputStream;JILorg/eclipse/core/runtime/IProgressMonitor;Ljava/lang/String;)V
    //   269: astore 6
    //   271: aload_0
    //   272: aload 6
    //   274: lload 7
    //   276: invokespecial 785	org/eclipse/team/internal/ccvs/core/client/Session:sendUncompressedBytes	(Ljava/io/InputStream;J)V
    //   279: goto +220 -> 499
    //   282: aload 4
    //   284: getstatic 693	org/eclipse/team/internal/ccvs/core/CVSMessages:Session_calculatingCompressedSize	Ljava/lang/String;
    //   287: iconst_1
    //   288: anewarray 378	java/lang/String
    //   291: dup
    //   292: iconst_0
    //   293: aload_1
    //   294: aload_0
    //   295: getfield 714	org/eclipse/team/internal/ccvs/core/client/Session:localRoot	Lorg/eclipse/team/internal/ccvs/core/ICVSFolder;
    //   298: iconst_3
    //   299: invokestatic 827	org/eclipse/team/internal/ccvs/core/util/Util:toTruncatedPath	(Lorg/eclipse/team/internal/ccvs/core/ICVSStorage;Lorg/eclipse/team/internal/ccvs/core/ICVSFolder;I)Ljava/lang/String;
    //   302: aastore
    //   303: invokestatic 754	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    //   306: invokeinterface 847 2 0
    //   311: aload_1
    //   312: invokeinterface 857 1 0
    //   317: astore 6
    //   319: sipush 8192
    //   322: newarray <illegal type>
    //   324: astore 9
    //   326: new 408	org/eclipse/team/internal/ccvs/core/client/ByteCountOutputStream
    //   329: dup
    //   330: invokespecial 771	org/eclipse/team/internal/ccvs/core/client/ByteCountOutputStream:<init>	()V
    //   333: astore 10
    //   335: new 389	java/util/zip/GZIPOutputStream
    //   338: dup
    //   339: aload 10
    //   341: invokespecial 751	java/util/zip/GZIPOutputStream:<init>	(Ljava/io/OutputStream;)V
    //   344: astore 11
    //   346: iload_2
    //   347: ifne +33 -> 380
    //   350: getstatic 702	org/eclipse/team/internal/ccvs/core/client/Session:IS_CRLF_PLATFORM	Z
    //   353: ifeq +27 -> 380
    //   356: new 428	org/eclipse/team/internal/core/streams/CRLFtoLFInputStream
    //   359: dup
    //   360: aload 6
    //   362: invokespecial 828	org/eclipse/team/internal/core/streams/CRLFtoLFInputStream:<init>	(Ljava/io/InputStream;)V
    //   365: astore 6
    //   367: goto +13 -> 380
    //   370: aload 11
    //   372: aload 9
    //   374: iconst_0
    //   375: iload 12
    //   377: invokevirtual 722	java/io/OutputStream:write	([BII)V
    //   380: aload 6
    //   382: aload 9
    //   384: invokevirtual 720	java/io/InputStream:read	([B)I
    //   387: dup
    //   388: istore 12
    //   390: iconst_m1
    //   391: if_icmpne -21 -> 370
    //   394: goto +13 -> 407
    //   397: astore 13
    //   399: aload 11
    //   401: invokevirtual 721	java/io/OutputStream:close	()V
    //   404: aload 13
    //   406: athrow
    //   407: aload 11
    //   409: invokevirtual 721	java/io/OutputStream:close	()V
    //   412: aload 6
    //   414: invokevirtual 719	java/io/InputStream:close	()V
    //   417: aload_1
    //   418: invokeinterface 857 1 0
    //   423: astore 6
    //   425: new 419	org/eclipse/team/internal/ccvs/core/client/Session$2
    //   428: dup
    //   429: aload_0
    //   430: aload 6
    //   432: aload_1
    //   433: invokeinterface 856 1 0
    //   438: ldc 1
    //   440: aload 4
    //   442: aload 5
    //   444: invokespecial 807	org/eclipse/team/internal/ccvs/core/client/Session$2:<init>	(Lorg/eclipse/team/internal/ccvs/core/client/Session;Ljava/io/InputStream;JILorg/eclipse/core/runtime/IProgressMonitor;Ljava/lang/String;)V
    //   447: astore 6
    //   449: iload_2
    //   450: ifne +20 -> 470
    //   453: getstatic 702	org/eclipse/team/internal/ccvs/core/client/Session:IS_CRLF_PLATFORM	Z
    //   456: ifeq +14 -> 470
    //   459: new 428	org/eclipse/team/internal/core/streams/CRLFtoLFInputStream
    //   462: dup
    //   463: aload 6
    //   465: invokespecial 828	org/eclipse/team/internal/core/streams/CRLFtoLFInputStream:<init>	(Ljava/io/InputStream;)V
    //   468: astore 6
    //   470: aload_0
    //   471: aload 6
    //   473: aload 10
    //   475: invokevirtual 770	org/eclipse/team/internal/ccvs/core/client/ByteCountOutputStream:getSize	()J
    //   478: invokespecial 784	org/eclipse/team/internal/ccvs/core/client/Session:sendCompressedBytes	(Ljava/io/InputStream;J)V
    //   481: goto +18 -> 499
    //   484: astore 14
    //   486: aload 6
    //   488: ifnull +8 -> 496
    //   491: aload 6
    //   493: invokevirtual 719	java/io/InputStream:close	()V
    //   496: aload 14
    //   498: athrow
    //   499: aload 6
    //   501: ifnull +19 -> 520
    //   504: aload 6
    //   506: invokevirtual 719	java/io/InputStream:close	()V
    //   509: goto +11 -> 520
    //   512: astore 6
    //   514: aload 6
    //   516: invokestatic 757	org/eclipse/team/internal/ccvs/core/CVSException:wrapException	(Ljava/lang/Exception;)Lorg/eclipse/team/internal/ccvs/core/CVSException;
    //   519: athrow
    //   520: return
    // Line number table:
    //   Java source line #617	-> byte code offset #0
    //   Java source line #618	-> byte code offset #7
    //   Java source line #621	-> byte code offset #22
    //   Java source line #622	-> byte code offset #47
    //   Java source line #624	-> byte code offset #69
    //   Java source line #627	-> byte code offset #72
    //   Java source line #628	-> byte code offset #80
    //   Java source line #629	-> byte code offset #88
    //   Java source line #685	-> byte code offset #105
    //   Java source line #630	-> byte code offset #115
    //   Java source line #633	-> byte code offset #116
    //   Java source line #634	-> byte code offset #123
    //   Java source line #635	-> byte code offset #131
    //   Java source line #637	-> byte code offset #141
    //   Java source line #638	-> byte code offset #148
    //   Java source line #639	-> byte code offset #159
    //   Java source line #641	-> byte code offset #168
    //   Java source line #642	-> byte code offset #198
    //   Java source line #643	-> byte code offset #200
    //   Java source line #644	-> byte code offset #205
    //   Java source line #643	-> byte code offset #208
    //   Java source line #645	-> byte code offset #213
    //   Java source line #646	-> byte code offset #218
    //   Java source line #647	-> byte code offset #225
    //   Java source line #650	-> byte code offset #243
    //   Java source line #652	-> byte code offset #251
    //   Java source line #659	-> byte code offset #271
    //   Java source line #661	-> byte code offset #282
    //   Java source line #662	-> byte code offset #311
    //   Java source line #663	-> byte code offset #319
    //   Java source line #664	-> byte code offset #326
    //   Java source line #665	-> byte code offset #335
    //   Java source line #666	-> byte code offset #346
    //   Java source line #668	-> byte code offset #367
    //   Java source line #669	-> byte code offset #397
    //   Java source line #670	-> byte code offset #399
    //   Java source line #671	-> byte code offset #404
    //   Java source line #670	-> byte code offset #407
    //   Java source line #672	-> byte code offset #412
    //   Java source line #673	-> byte code offset #417
    //   Java source line #674	-> byte code offset #425
    //   Java source line #681	-> byte code offset #449
    //   Java source line #682	-> byte code offset #470
    //   Java source line #684	-> byte code offset #484
    //   Java source line #685	-> byte code offset #486
    //   Java source line #686	-> byte code offset #496
    //   Java source line #685	-> byte code offset #499
    //   Java source line #687	-> byte code offset #512
    //   Java source line #688	-> byte code offset #514
    //   Java source line #690	-> byte code offset #520
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	521	0	this	Session
    //   0	521	1	file	ICVSStorage
    //   0	521	2	isBinary	boolean
    //   0	521	3	sendBinary	boolean
    //   0	521	4	monitor	IProgressMonitor
    //   45	398	5	title	String
    //   70	435	6	in	InputStream
    //   512	3	6	e	IOException
    //   223	3	7	length	long
    //   249	26	7	length	long
    //   86	13	9	bytes	byte[]
    //   146	38	9	buffer	byte[]
    //   324	59	9	buffer	byte[]
    //   166	53	10	counter	ByteCountOutputStream
    //   333	141	10	counter	ByteCountOutputStream
    //   171	6	11	count	int
    //   189	3	11	count	int
    //   344	64	11	zout	OutputStream
    //   198	8	12	localObject1	Object
    //   370	6	12	count	int
    //   388	3	12	count	int
    //   397	8	13	localObject2	Object
    //   484	13	14	localObject3	Object
    // Exception table:
    //   from	to	target	type
    //   168	198	198	finally
    //   367	397	397	finally
    //   72	105	484	finally
    //   116	484	484	finally
    //   69	115	512	java/io/IOException
    //   116	509	512	java/io/IOException
  }
  
  private void sendCompressedBytes(InputStream in, long length)
    throws IOException, CVSException
  {
    String sizeLine = "z" + Long.toString(length);
    writeLine(sizeLine);
    OutputStream out = connection.getOutputStream();
    GZIPOutputStream zo = new GZIPOutputStream(out);
    byte[] buffer = new byte['?'];
    int count;
    while ((count = in.read(buffer)) != -1)
    {
      int count;
      zo.write(buffer, 0, count);
    }
    zo.finish();
  }
  
  private void sendUncompressedBytes(InputStream in, long length)
    throws IOException, CVSException
  {
    OutputStream out = connection.getOutputStream();
    String sizeLine = Long.toString(length);
    writeLine(sizeLine);
    byte[] buffer = new byte['?'];
    int count;
    while ((count = in.read(buffer)) != -1)
    {
      int count;
      out.write(buffer, 0, count);
    }
  }
  
  public void receiveFile(ICVSStorage file, boolean isBinary, int responseType, IProgressMonitor monitor)
    throws CVSException
  {
    if ((textTransferOverrideSet != null) && 
      (textTransferOverrideSet.contains(file))) {
      isBinary = false;
    }
    String title = NLS.bind(CVSMessages.Session_receiving, new Object[] { Util.toTruncatedPath(file, localRoot, 3) });
    monitor.subTask(NLS.bind(CVSMessages.Session_transferNoSize, new String[] { title }));
    
    boolean compressed = false;
    String sizeLine = null;
    try
    {
      sizeLine = readLine();
      if (sizeLine.charAt(0) == 'z')
      {
        compressed = true;
        sizeLine = sizeLine.substring(1);
      }
      size = Long.parseLong(sizeLine, 10);
    }
    catch (NumberFormatException e)
    {
      long size;
      if ((sizeLine != null) && (sizeLine.startsWith("E")))
      {
        handleErrorLine(sizeLine.substring(1).trim(), Status.OK_STATUS);
        return;
      }
      IStatus status = new CVSStatus(4, 4, CVSMessages.Session_badInt, e, localRoot);
      throw new CVSException(status);
    }
    long size;
    InputStream in = new SizeConstrainedInputStream(connection.getInputStream(), size, true);
    
    in = new ProgressMonitorInputStream(in, size, 32768, monitor)
    {
      private final String val$title;
      
      protected void updateMonitor(long bytesRead, long bytesTotal, IProgressMonitor monitor)
      {
        if (bytesRead == 0L) {
          return;
        }
        monitor.subTask(NLS.bind(CVSMessages.Session_transfer, new Object[] { val$title, Long.toString(bytesRead >> 10), Long.toString(bytesTotal >> 10) }));
      }
    };
    if (compressed) {
      try
      {
        in = new GZIPInputStream(in);
      }
      catch (IOException e)
      {
        throw CVSException.wrapException(e);
      }
    }
    if (!isBinary) {
      if ((IS_CRLF_PLATFORM) && (CVSProviderPlugin.getPlugin().isUsePlatformLineend()))
      {
        in = new CRLFtoLFInputStream(in);
        
        in = new LFtoCRLFInputStream(in);
      }
      else
      {
        in = new CRLFDetectInputStream(in, file);
      }
    }
    file.setContents(in, responseType, true, new NullProgressMonitor());
  }
  
  void setModTime(Date modTime)
  {
    this.modTime = modTime;
  }
  
  Date getModTime()
  {
    return modTime;
  }
  
  void setNoLocalChanges(boolean noLocalChanges)
  {
    this.noLocalChanges = noLocalChanges;
  }
  
  boolean isNoLocalChanges()
  {
    return noLocalChanges;
  }
  
  void setValidRequests(String validRequests)
  {
    this.validRequests = (" " + validRequests + " ");
  }
  
  public boolean isOutputToConsole()
  {
    return outputToConsole;
  }
  
  void setCreateBackups(boolean createBackups)
  {
    this.createBackups = createBackups;
  }
  
  boolean isCreateBackups()
  {
    return createBackups;
  }
  
  String getSendFileTitleMessage()
  {
    if (sendFileTitleMessage == null) {
      return CVSMessages.Session_sending;
    }
    return sendFileTitleMessage;
  }
  
  public void setSendFileTitleKey(String sendFileTitleMessage)
  {
    this.sendFileTitleMessage = sendFileTitleMessage;
  }
  
  public void setTextTransferOverride(Collection textTransferOverrideSet)
  {
    this.textTransferOverrideSet = textTransferOverrideSet;
  }
  
  protected Command.GlobalOption[] filterGlobalOptions(Command.GlobalOption[] globalOptions)
  {
    if (!Command.DO_NOT_CHANGE.isElementOf(globalOptions))
    {
      Command.QuietOption quietOption = CVSProviderPlugin.getPlugin().getQuietness();
      if (quietOption != null) {
        globalOptions = quietOption.addToEnd(globalOptions);
      }
      if ((isWatchEditEnabled()) && 
        (!Command.MAKE_READ_ONLY.isElementOf(globalOptions))) {
        globalOptions = Command.MAKE_READ_ONLY.addToEnd(globalOptions);
      }
    }
    return globalOptions;
  }
  
  private boolean isWatchEditEnabled()
  {
    if (CVSProviderPlugin.getPlugin().getPluginPreferences().getBoolean("cvs.read.only")) {
      return true;
    }
    try
    {
      IResource resource = getLocalRoot().getIResource();
      if ((resource != null) && (resource.getType() != 8))
      {
        RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId());
        if (provider != null) {
          return ((CVSTeamProvider)provider).isWatchEditEnabled();
        }
      }
    }
    catch (CVSException e)
    {
      CVSProviderPlugin.log(e);
    }
    return false;
  }
  
  protected void setIgnoringLocalChanges(boolean b)
  {
    ignoringLocalChanges = b;
  }
  
  protected boolean isIgnoringLocalChanges()
  {
    return ignoringLocalChanges;
  }
  
  protected Map getReponseHandlers()
  {
    if (responseHandlers == null) {
      responseHandlers = Request.getReponseHandlerMap();
    }
    return responseHandlers;
  }
  
  private String makeResponseList()
  {
    StringBuffer result = new StringBuffer("ok error M E");
    Iterator elements = getReponseHandlers().keySet().iterator();
    while (elements.hasNext())
    {
      result.append(' ');
      result.append((String)elements.next());
    }
    return result.toString();
  }
  
  public void registerResponseHandler(ResponseHandler handler)
  {
    getReponseHandlers().put(handler.getResponseID(), handler);
  }
  
  public void removeResponseHandler(String responseID)
  {
    getReponseHandlers().remove(responseID);
  }
  
  public ResponseHandler getResponseHandler(String responseID)
  {
    return (ResponseHandler)getReponseHandlers().get(responseID);
  }
  
  public void addError(IStatus status)
  {
    if (!status.isOK()) {
      errors.add(status);
    }
  }
  
  public boolean hasErrors()
  {
    return !errors.isEmpty();
  }
  
  public IStatus[] getErrors()
  {
    return (IStatus[])errors.toArray(new IStatus[errors.size()]);
  }
  
  public void clearErrors()
  {
    errors.clear();
  }
  
  public void setCurrentCommand(Command c)
  {
    currentCommand = c;
  }
  
  public Command getCurrentCommand()
  {
    return currentCommand;
  }
  
  public void handleErrorLine(String line, IStatus status)
  {
    ConsoleListeners.getInstance().errorLineReceived(this, line, status);
  }
  
  public void handleResponseError(IStatus status)
  {
    addError(status);
    handleErrorLine(NLS.bind(CVSMessages.Session_0, new String[] { status.getMessage() }), status);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ccvs.core.client.Session
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ccvs.core.client;

import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.MutableFolderSyncInfo;

class StaticHandler
  extends ResponseHandler
{
  private final boolean setStaticDirectory;
  
  public StaticHandler(boolean setStaticDirectory)
  {
   
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd