when i try to access a property which does not exit my loop and programm stops without exception.
Here is my code:
for (Object o : calendar.getComponents("VEVENT")) {
Component c = (Component)o;
//Location is not set / does not exist
c.getProperty("LOCATION").getValue();
}
How can i handle this? c.getProperty("LOCATION").isCalendarProperty() doesnt seem to return a value. It "crashes" like the getValue.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi!
By the way you should use constants. And I don't think your programm stops without exception, it is a java.lang.NullPointerException.
for (Object o : calendar.getComponents(Component.VEVENT)) {
Component c = (Component)o;
//Location is not set / does not exist
Property p = c.getProperty(Property.LOCATION);
//Check for null
if(p != null) {
String value = p.getValue();
}
}
Lukas
Last edit: Lukas Aichbauer 2014-03-19
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
when i try to access a property which does not exit my loop and programm stops without exception.
Here is my code:
for (Object o : calendar.getComponents("VEVENT")) {
Component c = (Component)o;
//Location is not set / does not exist
c.getProperty("LOCATION").getValue();
}
How can i handle this? c.getProperty("LOCATION").isCalendarProperty() doesnt seem to return a value. It "crashes" like the getValue.
Hi!
By the way you should use constants. And I don't think your programm stops without exception, it is a java.lang.NullPointerException.
Lukas
Last edit: Lukas Aichbauer 2014-03-19