خرید بک لینک

Vote count: 0

Hi I am a very new to Java and I am facing problems with ruing the Autoingestion.class file provided by Apple. (I am trying to download the sales report from iTunes Coect programatically)

I first decomplied the .class file and saved it as java. Then I created a new folder and imported the .class and .java file into it. However, I faced this error when ruing the file and I dont understand how to resolve the error:

Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
        localObject2 caot be resolved to a variable
        localObject2 caot be resolved to a variable
        localObject2 caot be resolved to a variable
        localObject1 caot be resolved to a variable
        localObject2 caot be resolved to a variable
        localObject1 caot be resolved to a variable
        localObject2 caot be resolved to a variable
        localObject1 caot be resolved to a variable

        at Autoingestion.main(Autoingestion.java:33)

Here's the java script:

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.net.HttpURLCoection;
import java.net.URL;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Properties;

public class Autoingestion
{
  public static void main(String[] paramArrayOfString)
  {
    int i = 0;
    String str1 = null;
    String str2 = "";
    String str3 = null;
    String str4 = null;
    String str5 = null;
    String str6 = null;
    
    File localFile1 = new File(".");
    try
    {
      String str7 = localFile1.getCanonicalPath();
      str6 = paramArrayOfString[0];
      localObject2 = str7 + "/" + str6;
      boolean bool1 = str6.endsWith(".properties");
      
      File localFile2 = new File((String)localObject2);
      boolean bool2 = localFile2.exists();
      if ((bool1) && (bool2))
      {
        Properties localProperties = new Properties();
        localProperties.load(new FileInputStream((String)localObject2));
        str3 = localProperties.getProperty("userID");
        str4 = localProperties.getProperty("password");
        str5 = paramArrayOfString[1];
        if ((str3.isEmpty()) || (null == str3) || (null == str4) || (str4.isEmpty()))
        {
          System.out.println("Please check the parameters in properties file ");
          
          retu;
        }
        if ((paramArrayOfString.length < 5) || (paramArrayOfString.length > 6))
        {
          System.out.println("Please enter all the required parameters.  For help, please download the latest User Guide from the Sales and Trends module in iTunes Coect.");
          
          retu;
        }
        i = 1;
      }
      else
      {
        if (bool1)
        {
          System.out.println("Property file missing");
          retu;
        }
        if ((bool2) && (!bool1))
        {
          System.out.println("Property File missing. Please use the properties file for user credentials");
          retu;
        }
      }
      if (!bool1)
      {
        System.out.println("The useame and password parameters have been deprecated. Please use the properties file for user credentials.");
        if ((paramArrayOfString.length < 6) || (paramArrayOfString.length > 7))
        {
          System.out.println("Please enter all the required parameters.  For help, please download the latest User Guide from the Sales and Trends module in iTunes Coect.");
          
          retu;
        }
        str3 = paramArrayOfString[0];
        str4 = paramArrayOfString[1];
        str5 = paramArrayOfString[2];
      }
    }
    catch (Exception localException1)
    {
      System.out.println("Exception is =" + localException1.getMessage());
    }
    if ((i == 1) && (paramArrayOfString.length == 6) && (null != paramArrayOfString[5]))
    {
      str1 = paramArrayOfString[5];
    }
    else if ((i == 0) && (paramArrayOfString.length == 7) && (null != paramArrayOfString[6]))
    {
      str1 = paramArrayOfString[6];
    }
    else
    {
      localObject1 = Calendar.getInstance();
      localObject2 = new SimpleDateFormat("yyyyMMdd");
      ((Calendar)localObject1).add(5, -1);
      str1 = ((SimpleDateFormat)localObject2).format(((Calendar)localObject1).getTime()).toString();
    }
    Object localObject1 = null;
    Object localObject2 = null;
    try
    {
      str2 = "USERNAME=" + URLEncoder.encode(str3, "UTF-8");
      str2 = str2 + "&PASSWORD=" + URLEncoder.encode(str4, "UTF-8");
      str2 = str2 + "&VNDNUMBER=" + URLEncoder.encode(str5, "UTF-8");
      if (i == 1)
      {
        str2 = str2 + "&TYPEOFREPORT=" + URLEncoder.encode(paramArrayOfString[2], "UTF-8");
        
        str2 = str2 + "&DATETYPE=" + URLEncoder.encode(paramArrayOfString[3], "UTF-8");
        str2 = str2 + "&REPORTTYPE=" + URLEncoder.encode(paramArrayOfString[4], "UTF-8");
        
        str2 = str2 + "&REPORTDATE=" + URLEncoder.encode(str1, "UTF-8");
      }
      else
      {
        str2 = str2 + "&TYPEOFREPORT=" + URLEncoder.encode(paramArrayOfString[3], "UTF-8");
        
        str2 = str2 + "&DATETYPE=" + URLEncoder.encode(paramArrayOfString[4], "UTF-8");
        str2 = str2 + "&REPORTTYPE=" + URLEncoder.encode(paramArrayOfString[5], "UTF-8");
        
        str2 = str2 + "&REPORTDATE=" + URLEncoder.encode(str1, "UTF-8");
      }
    }
    catch (Exception localException2)
    {
      System.out.println("Some problem occured." + localException2);
    }
    try
    {
      localObject2 = new URL("https://reportingitc.apple.com/autoingestion.tft?");
      
      localObject1 = (HttpURLCoection)((URL)localObject2).openCoection();
      
      ((HttpURLCoection)localObject1).setRequestMethod("POST");
      ((HttpURLCoection)localObject1).setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
      ((HttpURLCoection)localObject1).setDoOutput(true);
      OutputStreamWriter localOutputStreamWriter = new OutputStreamWriter(((HttpURLCoection)localObject1).getOutputStream());
      
      localOutputStreamWriter.write(str2);
      localOutputStreamWriter.flush();
      localOutputStreamWriter.close();
      if (((HttpURLCoection)localObject1).getHeaderField("ERRORMSG") != null) {
        System.out.println(((HttpURLCoection)localObject1).getHeaderField("ERRORMSG"));
      } else if (((HttpURLCoection)localObject1).getHeaderField("filename") != null) {
        getFile((HttpURLCoection)localObject1);
      }
    }
    catch (Exception localException3)
    {
      System.out.println("The report you requested is not available at this time.  Please try again in a few minutes.");
    }
    finally
    {
      if (localObject1 != null)
      {
        ((HttpURLCoection)localObject1).discoect();
        localObject1 = null;
      }
    }
  }
  
  private static void getFile(HttpURLCoection paramHttpURLCoection)
    throws IOException
  {
    String str = paramHttpURLCoection.getHeaderField("filename");
    System.out.println(str);
    int i = 0;
    
    BufferedInputStream localBufferedInputStream = new BufferedInputStream(paramHttpURLCoection.getInputStream());
    
    BufferedOutputStream localBufferedOutputStream = new BufferedOutputStream(new FileOutputStream(str));
    
    byte[] arrayOfByte = new byte['Ѐ'];
    while ((i = localBufferedInputStream.read(arrayOfByte)) != -1) {
      localBufferedOutputStream.write(arrayOfByte, 0, i);
    }
    localBufferedInputStream.close();
    localBufferedOutputStream.close();
    
    System.out.println("File Downloaded Successfully ");
  }
}
asked 34 secs ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 11 خرداد 1395 ساعت: 8:38

صفحه بندی