On 1/3/2012 5:34 PM, Jukka Zitting wrote:
Hi,

On Tue, Jan 3, 2012 at 12:56 PM, Vineet<[email protected]>  wrote:
"org.apache.jackrabbit.rmi.client.ClientNode cannot be cast to
net.fortuna.ical4j.model.Component"
Sounds more like an ical4j problem than a Jackrabbit one.

BR,

Jukka Zitting


Hi
I have tried reading a normal file (create using FileInputStream) and that is working perfectly fine. I am able to read the data from the ics file, even from the remote machine if I have rights.
Thats why I was wondering that the problem is at which end
Below is the sample code, it is working absolutely fine

public static void main(String[] args) {

        try {
            int a;
            int i = 1;
            String s="";

FileInputStream fin = new FileInputStream("E://downloads//AA.ics");

            while((a = fin.read())!=-1){
                s = s + (char)a;
            }

            byte b[] = s.getBytes();
            fin.close();

//FileOutputStream fos = new FileOutputStream("\\\\192.16.17.52//shared//vin.ics");
            //fos.write(b);

FileInputStream fileInputStream = new FileInputStream("\\\\192.16.17.52//shared//vin.ics");
            CalendarBuilder builder = new CalendarBuilder();

            Calendar calendar = builder.build(fileInputStream);

            List list = calendar.getComponents("VEVENT");
            System.out.println(list.size());

for (Iterator iterator = list.iterator(); iterator.hasNext();) {
                String eventName = null;
                String eventStartDate = null;
                String eventEndDate = null;
                String eventRepeatPattern = null;

                Component component = (Component) iterator.next();

                System.out.println(i + "> " + component.getName());
                eventName = component.getProperty("SUMMARY").getValue();
eventStartDate = component.getProperty("DTSTART").getValue();
                eventEndDate = component.getProperty("DTEND").getValue();
                if(component.getProperty("RRULE")!= null){
eventRepeatPattern = component.getProperty("RRULE").getValue();
                }

                System.out.println(eventName);
                System.out.println(eventStartDate);
                System.out.println(eventEndDate);
                if(eventRepeatPattern != null){

                    System.out.println(eventRepeatPattern);
                }

                System.out.println("...End...");
                System.out.println();
                i++;
            }

            /*
             * for (Iterator i = calendar.getComponents().iterator();
             * i.hasNext();) { Component component = (Component) i.next();
* System.out.println("Component [" + component.getName() + "]");
             * System.out.println();
             *
             * component.getProperty("SUMMARY").getValue
             *
             * for (Iterator j = component.getProperties().iterator();
             * j.hasNext();) { String eventName=null; String
             * eventStartDate=null; String eventEndDate=null; String
* eventYear=null; String eventMonth=null; String eventDate=null;
             *
             * Property property = (Property) j.next();
             *
             * if(property.getName().equalsIgnoreCase("summary")){
             *  } Property property = (Property) j.next();
             *
* System.out.println("Property [" + property.getName() + ", " +
             * property.getValue() + "]"); } System.out.println(); }
             */

        } catch (Exception e) {
            System.out.println("Execption ---> " + e.getMessage());
        }
    }


Reply via email to