List of usage examples for java.lang NoClassDefFoundError printStackTrace
public void printStackTrace()
From source file:org.koboc.collect.android.activities.GeoPointMapActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) { mLocationCount = savedInstanceState.getInt(LOCATION_COUNT); }/* w w w . j a va2 s . co m*/ requestWindowFeature(Window.FEATURE_NO_TITLE); try { setContentView(R.layout.geopoint_layout); } catch (NoClassDefFoundError e) { e.printStackTrace(); Toast.makeText(getBaseContext(), getString(R.string.google_play_services_error_occured), Toast.LENGTH_SHORT).show(); finish(); return; } Intent intent = getIntent(); mLocationAccuracy = GeoPointWidget.DEFAULT_LOCATION_ACCURACY; if (intent != null && intent.getExtras() != null) { if (intent.hasExtra(GeoPointWidget.LOCATION)) { double[] location = intent.getDoubleArrayExtra(GeoPointWidget.LOCATION); mLatLng = new LatLng(location[0], location[1]); } if (intent.hasExtra(GeoPointWidget.ACCURACY_THRESHOLD)) { mLocationAccuracy = intent.getDoubleExtra(GeoPointWidget.ACCURACY_THRESHOLD, GeoPointWidget.DEFAULT_LOCATION_ACCURACY); } mCaptureLocation = !intent.getBooleanExtra(GeoPointWidget.READ_ONLY, false); mRefreshLocation = mCaptureLocation; } /* Set up the map and the marker */ mMarkerOption = new MarkerOptions(); mLocationStatus = (TextView) findViewById(R.id.location_status); /*Zoom only if there's a previous location*/ if (mLatLng != null) { mLocationStatus.setVisibility(View.GONE); mMarkerOption.position(mLatLng); mRefreshLocation = false; // just show this position; don't change it... mZoomed = true; } mCancelLocation = (Button) findViewById(R.id.cancel_location); mCancelLocation.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Collect.getInstance().getActivityLogger().logInstanceAction(this, "cancelLocation", "cancel"); finish(); } }); mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); // make sure we have a good location provider before continuing List<String> providers = mLocationManager.getProviders(true); for (String provider : providers) { if (provider.equalsIgnoreCase(LocationManager.GPS_PROVIDER)) { mGPSOn = true; } if (provider.equalsIgnoreCase(LocationManager.NETWORK_PROVIDER)) { mNetworkOn = true; } } if (!mGPSOn && !mNetworkOn) { Toast.makeText(getBaseContext(), getString(R.string.provider_disabled_error), Toast.LENGTH_SHORT) .show(); finish(); } if (mGPSOn) { Location loc = mLocationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (loc != null) { InfoLogger.geolog("GeoPointMapActivity: " + System.currentTimeMillis() + " lastKnownLocation(GPS) lat: " + loc.getLatitude() + " long: " + loc.getLongitude() + " acc: " + loc.getAccuracy()); } else { InfoLogger.geolog("GeoPointMapActivity: " + System.currentTimeMillis() + " lastKnownLocation(GPS) null location"); } } if (mNetworkOn) { Location loc = mLocationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); if (loc != null) { InfoLogger.geolog("GeoPointMapActivity: " + System.currentTimeMillis() + " lastKnownLocation(Network) lat: " + loc.getLatitude() + " long: " + loc.getLongitude() + " acc: " + loc.getAccuracy()); } else { InfoLogger.geolog("GeoPointMapActivity: " + System.currentTimeMillis() + " lastKnownLocation(Network) null location"); } } mAcceptLocation = (Button) findViewById(R.id.accept_location); if (mCaptureLocation) { mAcceptLocation.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Collect.getInstance().getActivityLogger().logInstanceAction(this, "acceptLocation", "OK"); returnLocation(); } }); } else { mAcceptLocation.setVisibility(View.GONE); } mReloadLocation = (Button) findViewById(R.id.reload_location); if (mCaptureLocation) { mReloadLocation.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mRefreshLocation = true; mReloadLocation.setVisibility(View.GONE); mLocationStatus.setVisibility(View.VISIBLE); if (mGPSOn) { mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, GeoPointMapActivity.this); } if (mNetworkOn) { mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, GeoPointMapActivity.this); } } }); mReloadLocation.setVisibility(!mRefreshLocation ? View.VISIBLE : View.GONE); } else { mReloadLocation.setVisibility(View.GONE); } // Focuses on marked location mShowLocation = ((Button) findViewById(R.id.show_location)); mShowLocation.setVisibility(View.VISIBLE); mShowLocation.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Collect.getInstance().getActivityLogger().logInstanceAction(this, "showLocation", "onClick"); mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(mLatLng, 16)); } }); // not clickable until we have a marker set.... mShowLocation.setClickable(false); }
From source file:org.odk.collect.android.activities.GeoPointMapActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); if (savedInstanceState != null) { mLocationCount = savedInstanceState.getInt(LOCATION_COUNT); }//w w w . j ava2 s . c om try { setContentView(R.layout.geopoint_layout); } catch (NoClassDefFoundError e) { e.printStackTrace(); Toast.makeText(getBaseContext(), getString(R.string.google_play_services_error_occured), Toast.LENGTH_SHORT).show(); finish(); return; } mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap(); if (mMap == null) { Toast.makeText(getBaseContext(), getString(R.string.google_play_services_error_occured), Toast.LENGTH_SHORT).show(); finish(); return; } mMap.setMyLocationEnabled(true); mMap.getUiSettings().setCompassEnabled(true); mMap.getUiSettings().setMyLocationButtonEnabled(false); mMap.getUiSettings().setZoomControlsEnabled(false); mMarkerOption = new MarkerOptions(); mHelper = new MapHelper(this, mMap); mLocationAccuracy = GeoPointWidget.DEFAULT_LOCATION_ACCURACY; mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); mLocationStatus = (TextView) findViewById(R.id.location_status); mlocationInfo = (TextView) findViewById(R.id.location_info); mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); mAcceptLocation = (Button) findViewById(R.id.accept_location); mAcceptLocation.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Collect.getInstance().getActivityLogger().logInstanceAction(this, "acceptLocation", "OK"); returnLocation(); } }); mReloadLocation = (Button) findViewById(R.id.reload_location); mReloadLocation.setEnabled(false); mReloadLocation.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mMarker != null) { mMarker.remove(); } mLatLng = null; mMarker = null; setClear = false; mLatLng = new LatLng(mLocation.getLatitude(), mLocation.getLongitude()); mMarkerOption.position(mLatLng); if (mMarker == null) { mMarker = mMap.addMarker(mMarkerOption); if (draggable && !read_only) { mMarker.setDraggable(true); } } mCaptureLocation = true; mIsDragged = false; zoomToPoint(); } }); // Focuses on marked location mShowLocation = ((Button) findViewById(R.id.show_location)); // mShowLocation.setClickable(false); mShowLocation.setEnabled(false); mShowLocation.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { showZoomDialog(); } }); // Menu Layer Toggle mLayers = ((Button) findViewById(R.id.layer_menu)); mLayers.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mHelper.showLayersDialog(); } }); zoomDialogView = getLayoutInflater().inflate(R.layout.geopoint_zoom_dialog, null); zoomLocationButton = (Button) zoomDialogView.findViewById(R.id.zoom_location); zoomLocationButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { zoomToLocation(); zoomDialog.dismiss(); } }); zoomPointButton = (Button) zoomDialogView.findViewById(R.id.zoom_point); zoomPointButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { zoomToPoint(); zoomDialog.dismiss(); } }); clearPointButton = (Button) findViewById(R.id.clear); clearPointButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mMarker != null) { mMarker.remove(); } if (mLocation != null) { mReloadLocation.setEnabled(true); // mLocationStatus.setVisibility(View.VISIBLE); } // mReloadLocation.setEnabled(true); mlocationInfo.setVisibility(View.VISIBLE); mLocationStatus.setVisibility(View.VISIBLE); mLatLng = null; mMarker = null; setClear = true; mIsDragged = false; mCaptureLocation = false; draggable = intent_draggable; location_from_intent = false; overlayMyLocationLayers(); } }); Intent intent = getIntent(); if (intent != null && intent.getExtras() != null) { if (intent.hasExtra(GeoPointWidget.DRAGGABLE_ONLY)) { draggable = intent.getBooleanExtra(GeoPointWidget.DRAGGABLE_ONLY, false); intent_draggable = draggable; if (!intent_draggable) { // Not Draggable, set text for Map else leave as placement-map text mlocationInfo.setText(getString(R.string.geopoint_no_draggable_instruction)); } } if (intent.hasExtra(GeoPointWidget.READ_ONLY)) { read_only = intent.getBooleanExtra(GeoPointWidget.READ_ONLY, false); if (read_only) { mCaptureLocation = true; clearPointButton.setEnabled(false); } } if (intent.hasExtra(GeoPointWidget.LOCATION)) { double[] location = intent.getDoubleArrayExtra(GeoPointWidget.LOCATION); mLatLng = new LatLng(location[0], location[1]); mCaptureLocation = true; mReloadLocation.setEnabled(false); draggable = false; // If data loaded, must clear first location_from_intent = true; } if (intent.hasExtra(GeoPointWidget.ACCURACY_THRESHOLD)) { mLocationAccuracy = intent.getDoubleExtra(GeoPointWidget.ACCURACY_THRESHOLD, GeoPointWidget.DEFAULT_LOCATION_ACCURACY); } } /*Zoom only if there's a previous location*/ if (mLatLng != null) { mlocationInfo.setVisibility(View.GONE); mLocationStatus.setVisibility(View.GONE); mShowLocation.setEnabled(true); mMarkerOption.position(mLatLng); mMarker = mMap.addMarker(mMarkerOption); mCaptureLocation = true; foundFirstLocation = true; mZoomed = true; zoomToPoint(); } }
From source file:org.odk.collect.android.activities.GeoPointOsmMapActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); if (savedInstanceState != null) { mLocationCount = savedInstanceState.getInt(LOCATION_COUNT); }//from ww w .ja v a 2 s.co m try { setContentView(R.layout.geopoint_osm_layout); } catch (NoClassDefFoundError e) { e.printStackTrace(); Toast.makeText(getBaseContext(), getString(R.string.google_play_services_error_occured), Toast.LENGTH_SHORT).show(); finish(); return; } mMap = (MapView) findViewById(R.id.omap); mHelper = new MapHelper(this, mMap, GeoPointOsmMapActivity.this); mMap.setMultiTouchControls(true); mMap.setBuiltInZoomControls(true); mMarker = new Marker(mMap); mMarker.setIcon(getResources().getDrawable(R.drawable.ic_place_black_36dp)); mMyLocationOverlay = new MyLocationNewOverlay(this, mMap); handler.postDelayed(new Runnable() { public void run() { GeoPoint point = new GeoPoint(34.08145, -39.85007); mMap.getController().setZoom(4); mMap.getController().setCenter(point); } }, 100); mLocationAccuracy = GeoPointWidget.DEFAULT_LOCATION_ACCURACY; mLocationStatus = (TextView) findViewById(R.id.location_status); mlocationInfo = (TextView) findViewById(R.id.location_info); mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); mSaveLocationButton = (Button) findViewById(R.id.accept_location); mSaveLocationButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Collect.getInstance().getActivityLogger().logInstanceAction(this, "acceptLocation", "OK"); returnLocation(); } }); mReloadLocationButton = (Button) findViewById(R.id.reload_location); mReloadLocationButton.setEnabled(false); mReloadLocationButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mMap.getOverlays().add(mMarker); setClear = false; mLatLng = new GeoPoint(mLocation.getLatitude(), mLocation.getLongitude()); mMarker.setPosition(mLatLng); mCaptureLocation = true; mIsDragged = false; zoomToPoint(); } }); // Focuses on marked location mShowLocationButton = ((Button) findViewById(R.id.show_location)); mShowLocationButton.setVisibility(View.VISIBLE); mShowLocationButton.setEnabled(false); mShowLocationButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Collect.getInstance().getActivityLogger().logInstanceAction(this, "showLocation", "onClick"); showZoomDialog(); } }); // not clickable until we have a marker set.... mShowLocationButton.setClickable(false); // Menu Layer Toggle mLayersButton = ((Button) findViewById(R.id.layer_menu)); mLayersButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mHelper.showLayersDialog(); } }); zoomDialogView = getLayoutInflater().inflate(R.layout.geopoint_zoom_dialog, null); zoomLocationButton = (Button) zoomDialogView.findViewById(R.id.zoom_location); zoomLocationButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { zoomToLocation(); mMap.invalidate(); zoomDialog.dismiss(); } }); zoomPointButton = (Button) zoomDialogView.findViewById(R.id.zoom_point); zoomPointButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { zoomToPoint(); mMap.invalidate(); zoomDialog.dismiss(); } }); clearPointButton = (Button) findViewById(R.id.clear); clearPointButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mMap.getOverlays().remove(mMarker); mMarker.remove(mMap); if (mLocation != null) { mReloadLocationButton.setEnabled(true); // mLocationStatus.setVisibility(View.VISIBLE); } mLocationStatus.setVisibility(View.VISIBLE); mMap.getOverlays().remove(mMarker); mMarker.remove(mMap); setClear = true; mIsDragged = false; mCaptureLocation = false; draggable = intent_draggable; location_from_intent = false; overlayMyLocationLayers(); mMap.invalidate(); } }); Intent intent = getIntent(); if (intent != null && intent.getExtras() != null) { if (intent.hasExtra(GeoPointWidget.DRAGGABLE_ONLY)) { draggable = intent.getBooleanExtra(GeoPointWidget.DRAGGABLE_ONLY, false); intent_draggable = draggable; if (!intent_draggable) { // Not Draggable, set text for Map else leave as placement-map text mlocationInfo.setText(getString(R.string.geopoint_no_draggable_instruction)); } } if (intent.hasExtra(GeoPointWidget.READ_ONLY)) { read_only = intent.getBooleanExtra(GeoPointWidget.READ_ONLY, false); if (read_only) { mCaptureLocation = true; clearPointButton.setEnabled(false); } } if (intent.hasExtra(GeoPointWidget.LOCATION)) { double[] location = intent.getDoubleArrayExtra(GeoPointWidget.LOCATION); mLatLng = new GeoPoint(location[0], location[1]); mReloadLocationButton.setEnabled(false); mCaptureLocation = true; mIsDragged = true; draggable = false; // If data loaded, must clear first location_from_intent = true; } if (intent.hasExtra(GeoPointWidget.ACCURACY_THRESHOLD)) { mLocationAccuracy = intent.getDoubleExtra(GeoPointWidget.ACCURACY_THRESHOLD, GeoPointWidget.DEFAULT_LOCATION_ACCURACY); } } if (mLatLng != null) { mMarker.setPosition(mLatLng); mMap.getOverlays().add(mMarker); mMap.invalidate(); mCaptureLocation = true; foundFirstLocation = true; mZoomed = true; zoomToPoint(); } }
From source file:com.github.kongchen.swagger.docgen.mavenplugin.SpringMavenDocumentSource.java
@Override public void loadDocuments() throws GenerateException { Map<String, SpringResource> resourceMap = new HashMap<String, SpringResource>(); SwaggerConfig swaggerConfig = new SwaggerConfig(); swaggerConfig.setApiVersion(apiSource.getApiVersion()); swaggerConfig.setSwaggerVersion(SwaggerSpec.version()); List<ApiListingReference> apiListingReferences = new ArrayList<ApiListingReference>(); List<AuthorizationType> authorizationTypes = new ArrayList<AuthorizationType>(); //relate all methods to one base request mapping if multiple controllers exist for that mapping //get all methods from each controller & find their request mapping //create map - resource string (after first slash) as key, new SpringResource as value for (Class<?> c : apiSource.getValidClasses()) { RequestMapping requestMapping = (RequestMapping) c.getAnnotation(RequestMapping.class); String description = ""; if (c.isAnnotationPresent(Api.class)) { description = ((Api) c.getAnnotation(Api.class)).value(); }/* w w w. ja va2 s . c om*/ if (requestMapping != null && requestMapping.value().length != 0) { //This try/catch block is to stop a bamboo build from failing due to NoClassDefFoundError //This occurs when a class or method loaded by reflections contains a type that has no dependency try { resourceMap = analyzeController(c, resourceMap, description); List<Method> mList = new ArrayList<Method>(Arrays.asList(c.getMethods())); if (c.getSuperclass() != null) { mList.addAll(Arrays.asList(c.getSuperclass().getMethods())); } for (Method m : mList) { if (m.isAnnotationPresent(RequestMapping.class)) { RequestMapping methodReq = m.getAnnotation(RequestMapping.class); //isolate resource name - attempt first by the first part of the mapping if (methodReq != null && methodReq.value().length != 0) { for (int i = 0; i < methodReq.value().length; i++) { String resourceKey = ""; String resourceName = Utils.parseResourceName(methodReq.value()[i]); if (!(resourceName.equals(""))) { String version = Utils.parseVersion(requestMapping.value()[0]); //get version - first try by class mapping, then method if (version.equals("")) { //class mapping failed - use method version = Utils.parseVersion(methodReq.value()[i]); } resourceKey = Utils.createResourceKey(resourceName, version); if ((!(resourceMap.containsKey(resourceKey)))) { resourceMap.put(resourceKey, new SpringResource(c, resourceName, resourceKey, description)); } resourceMap.get(resourceKey).addMethod(m); } } } } } } catch (NoClassDefFoundError e) { LOG.error(e.getMessage()); LOG.info(c.getName()); //exception occurs when a method type or annotation is not recognized by the plugin } catch (ClassNotFoundException e) { LOG.error(e.getMessage()); LOG.info(c.getName()); } } } for (String str : resourceMap.keySet()) { ApiListing doc = null; SpringResource resource = resourceMap.get(str); try { doc = getDocFromSpringResource(resource, swaggerConfig); setBasePath(doc.basePath()); } catch (Exception e) { LOG.error("DOC NOT GENERATED FOR: " + resource.getResourceName()); e.printStackTrace(); } if (doc == null) continue; ApiListingReference apiListingReference = new ApiListingReference(doc.resourcePath(), doc.description(), doc.position()); apiListingReferences.add(apiListingReference); acceptDocument(doc); } // sort apiListingRefernce by position Collections.sort(apiListingReferences, new Comparator<ApiListingReference>() { @Override public int compare(ApiListingReference o1, ApiListingReference o2) { if (o1 == null && o2 == null) return 0; if (o1 == null && o2 != null) return -1; if (o1 != null && o2 == null) return 1; return o1.position() - o2.position(); } }); serviceDocument = new ResourceListing(swaggerConfig.apiVersion(), swaggerConfig.swaggerVersion(), scala.collection.immutable.List .fromIterator(JavaConversions.asScalaIterator(apiListingReferences.iterator())), scala.collection.immutable.List.fromIterator( JavaConversions.asScalaIterator(authorizationTypes.iterator())), swaggerConfig.info()); }