public static void startEvent(String type, long startTime) throws UnsupportedOperationException { String key = type + String.valueOf(startTime); if (eventMap.containsKey(key)) { // event exists, try to start a new one if ((eventMap.get(key))[2] != 0) { // there is an unfinished event throw new UnsupportedOperationException(); } else { (eventMap.get(key))[2] = System.currentTimeMillis(); } } else { // new event, try to create Long[] newTuple = new Long[3]; newTuple[0] = (long)0; newTuple[1] = (long)0; newTuple[2] = System.currentTimeMillis(); eventMap.put(key, newTuple); } System.out.println("START: " + key + "," + String.valueOf((eventMap.get(key))[0]) + "," + String.valueOf((eventMap.get(key))[1])); }
public static void endEvent(String type, long startTime) throws UnsupportedOperationException { String key = type + String.valueOf(startTime); if (eventMap.containsKey(key)) { // end the event if ((eventMap.get(key))[2] != 0) { // try to finish the event (eventMap.get(key))[0] += 1; // counts increased by 1 (eventMap.get(key))[1] += (System.currentTimeMillis() - (eventMap.get(key))[2]); // total time increased by the duration (eventMap.get(key))[2] = (long)0; // reset the time buffer } else { // the event has not been started throw new UnsupportedOperationException(); } } else { // the event does not exist throw new UnsupportedOperationException(); } System.out.println("END:" + key + "," + String.valueOf((eventMap.get(key))[0]) + "," + String.valueOf((eventMap.get(key))[1])); if (type.equals("score")) scoringCalls++; }
public static ObjectInspector getDrillObjectInspector(DataMode mode, MinorType minorType) { try { if (mode == DataMode.REQUIRED) { if (OIMAP_REQUIRED.containsKey(minorType)) { return (ObjectInspector) OIMAP_REQUIRED.get(minorType).newInstance(); } } else if (mode == DataMode.OPTIONAL) { if (OIMAP_OPTIONAL.containsKey(minorType)) { return (ObjectInspector) OIMAP_OPTIONAL.get(minorType).newInstance(); } } else { throw new UnsupportedOperationException("Repeated types are not supported as arguement to Hive UDFs"); } } catch(InstantiationException | IllegalAccessException e) { throw new RuntimeException("Failed to instantiate ObjectInspector", e); } throw new UnsupportedOperationException( String.format("Type %s[%s] not supported as arguement to Hive UDFs", minorType.toString(), mode.toString())); }
public static MinorType getDrillType(ObjectInspector oi) { switch(oi.getCategory()) { case PRIMITIVE: { PrimitiveObjectInspector poi = (PrimitiveObjectInspector)oi; if (TYPE_HIVE2DRILL.containsKey(poi.getPrimitiveCategory())) { return TYPE_HIVE2DRILL.get(poi.getPrimitiveCategory()); } throw new UnsupportedOperationException(); } case MAP: case LIST: case STRUCT: default: throw new UnsupportedOperationException(); } }
public static MinorType getMinorType(ObjectInspector oi) { switch(oi.getCategory()) { case PRIMITIVE: { PrimitiveObjectInspector poi = (PrimitiveObjectInspector)oi; if (TYPE_HIVE2MINOR.containsKey(poi.getPrimitiveCategory())) { return TYPE_HIVE2MINOR.get(poi.getPrimitiveCategory()); } throw new UnsupportedOperationException(); } case MAP: case LIST: case STRUCT: default: throw new UnsupportedOperationException(); } }
@Override @SuppressWarnings("unchecked") protected <T> T as(Class<T> returnClass) { if (result == null && resultJson != null) { result = gson.toJsonTree(resultJson); } if(metadata.getContentType() == ContentType.Void) { return null; } else if(metadata.getContentType() == ContentType.Text) { return gson.fromJson(new JsonPrimitive(result.getAsString()), returnClass); } else if(metadata.getContentType() == ContentType.Json) { return gson.fromJson(result, returnClass); } else if(metadata.getContentType() == ContentType.Binary) { if(byte[].class == returnClass) { return (T)Base64.decodeBase64(result.getAsString()); } else { throw new UnsupportedOperationException("Only support returning as byte[] for Binary data"); } } else { throw new UnsupportedOperationException("Unknown ContentType in response: " + metadata.getContentType().toString()); } }
@Override @SuppressWarnings("unchecked") protected <T> T as(Type returnType) { if (result == null && resultJson != null) { result = gson.toJsonTree(resultJson); } if(metadata.getContentType() == ContentType.Void) { return null; } else if(metadata.getContentType() == ContentType.Text) { return gson.fromJson(new JsonPrimitive(result.getAsString()), returnType); } else if(metadata.getContentType() == ContentType.Json) { return gson.fromJson(result, returnType); } else if(metadata.getContentType() == ContentType.Binary) { if(byteType.equals(returnType)) { return (T)Base64.decodeBase64(result.getAsString()); } else { throw new UnsupportedOperationException("Only support returning as byte[] for Binary data"); } } else { throw new UnsupportedOperationException("Unknown ContentType in response: " + metadata.getContentType().toString()); } }
@Override @SuppressWarnings("unchecked") protected <T> T as(Class<T> returnClass) { if(metadata.getContentType() == ContentType.Void) { return null; } else if(metadata.getContentType() == ContentType.Text) { return gson.fromJson(new JsonPrimitive(result.getAsString()), returnClass); } else if(metadata.getContentType() == ContentType.Json) { return gson.fromJson(result, returnClass); } else if(metadata.getContentType() == ContentType.Binary) { if(byte[].class == returnClass) { return (T)Base64.decodeBase64(result.getAsString()); } else { throw new UnsupportedOperationException("Only support returning as byte[] for Binary data"); } } else { throw new UnsupportedOperationException("Unknown ContentType in response: " + metadata.getContentType().toString()); } }
@Override @SuppressWarnings("unchecked") protected <T> T as(Type returnType) { if(metadata.getContentType() == ContentType.Void) { return null; } else if(metadata.getContentType() == ContentType.Text) { return gson.fromJson(new JsonPrimitive(result.getAsString()), returnType); } else if(metadata.getContentType() == ContentType.Json) { return gson.fromJson(result, returnType); } else if(metadata.getContentType() == ContentType.Binary) { if(byteType.equals(returnType)) { return (T)Base64.decodeBase64(result.getAsString()); } else { throw new UnsupportedOperationException("Only support returning as byte[] for Binary data"); } } else { throw new UnsupportedOperationException("Unknown ContentType in response: " + metadata.getContentType().toString()); } }
/** * Runs the test using the specified harness. * * @param harness the test harness (<code>null</code> not permitted). */ public void test(TestHarness harness) { UnsupportedOperationException object1 = new UnsupportedOperationException(); harness.check(object1 != null); harness.check(object1.toString(), "java.lang.UnsupportedOperationException"); UnsupportedOperationException object2 = new UnsupportedOperationException("nothing happens"); harness.check(object2 != null); harness.check(object2.toString(), "java.lang.UnsupportedOperationException: nothing happens"); UnsupportedOperationException object3 = new UnsupportedOperationException((String)null); harness.check(object3 != null); harness.check(object3.toString(), "java.lang.UnsupportedOperationException"); }
public void caseASTNode( ASTNode node ) { int numChild = node.getNumChild(); for( int i = 0; i<numChild; i++ ){ rewrite( node.getChild(i) ); if( newNode != null ) if( newNode.isSingleNode() ) node.setChild( newNode.getSingleNode(), i ); else{ String msg = "Generic transformation case received non single nodes from " + "transforming a child node. This should only happen when the current " + "case is for a list or otherwise expects this behavior.\n" +"node:\n"+node.getPrettyPrinted() +"\nchild node transform:\n"+newNode.toString(); throw new UnsupportedOperationException(msg); } } newNode = null; }
@Override public void revokeUserRoles(VOUser user, List<UserRoleType> roles) throws ObjectNotFoundException, UserModificationConstraintException, UserActiveException, OperationNotPermittedException, UserRoleAssignmentException { throw new UnsupportedOperationException(); }
@Override public VOUserDetails createUser(VOUserDetails user, List<UserRoleType> roles, String marketplaceId) throws NonUniqueBusinessKeyException, MailOperationException, ValidationException, UserRoleAssignmentException, OperationPendingException { throw new UnsupportedOperationException(); }
@Override public VOUserDetails createUser(VOUserDetails user, String marketplaceId) throws NonUniqueBusinessKeyException, MailOperationException, ValidationException, UserRoleAssignmentException, OperationPendingException { throw new UnsupportedOperationException(); }
@Override public PlatformUser modifyUserData(PlatformUser existingUser, VOUserDetails tempUser, boolean modifyOwnUser, boolean sendMail) throws OperationNotPermittedException, NonUniqueBusinessKeyException, TechnicalServiceNotAliveException, TechnicalServiceOperationException { throw new UnsupportedOperationException(); }
@Override public void setUserRoles(VOUser user, List<UserRoleType> roles) throws ObjectNotFoundException, OperationNotPermittedException, UserModificationConstraintException, UserRoleAssignmentException, UserActiveException { throw new UnsupportedOperationException(); }
@Override public VOUserDetails createUserWithGroups(VOUserDetails user, List<UserRoleType> roles, String marketplaceId, Map<Long, UnitUserRole> groups) throws NonUniqueBusinessKeyException, MailOperationException, ValidationException, UserRoleAssignmentException, OperationPendingException { throw new UnsupportedOperationException(); }
private static Long getProcessId() { try { // Get the current process id return ProcessHandle.current().pid(); } catch(UnsupportedOperationException ex) { return null; } }
public static ObjectInspector getObjectInspector(DataMode mode, MinorType minorType, boolean varCharToStringReplacement) { try { if (mode == DataMode.REQUIRED) { if (OIMAP_REQUIRED.containsKey(minorType)) { if (varCharToStringReplacement && minorType == MinorType.VARCHAR) { return (ObjectInspector) ((Class) OIMAP_REQUIRED.get(minorType).toArray()[1]).newInstance(); } else { return (ObjectInspector) ((Class) OIMAP_REQUIRED.get(minorType).toArray()[0]).newInstance(); } } } else if (mode == DataMode.OPTIONAL) { if (OIMAP_OPTIONAL.containsKey(minorType)) { if (varCharToStringReplacement && minorType == MinorType.VARCHAR) { return (ObjectInspector) ((Class) OIMAP_OPTIONAL.get(minorType).toArray()[1]).newInstance(); } else { return (ObjectInspector) ((Class) OIMAP_OPTIONAL.get(minorType).toArray()[0]).newInstance(); } } } else { throw new UnsupportedOperationException("Repeated types are not supported as arguement to Hive UDFs"); } } catch(InstantiationException | IllegalAccessException e) { throw new RuntimeException("Failed to instantiate ObjectInspector", e); } throw new UnsupportedOperationException( String.format("Type %s[%s] not supported as arguement to Hive UDFs", minorType.toString(), mode.toString())); }
@Test public void initializerBlockUnsupportedExceptionOnInterface() { TypeSpec.Builder interfaceBuilder = TypeSpec.interfaceBuilder("Taco"); try { interfaceBuilder.addInitializerBlock(CodeBlock.builder().build()); fail("Exception expected"); } catch (UnsupportedOperationException e) { } }
@Test public void initializerBlockUnsupportedExceptionOnAnnotation() { TypeSpec.Builder annotationBuilder = TypeSpec.annotationBuilder("Taco"); try { annotationBuilder.addInitializerBlock(CodeBlock.builder().build()); fail("Exception expected"); } catch (UnsupportedOperationException e) { } }
private static void initWebServer(int port) throws IOException, URISyntaxException { WebServer server = new WebServer(port); if (!serverMode) { try { Desktop.getDesktop().browse(new URI("http://localhost:" + server.getPort())); } catch (UnsupportedOperationException e) { LOG.warn("Failed to open web browser for you. You can access LegendBrowser on http://localhost:" + server.getPort()); } } }
@Override public void configure(Binder binder) { // Bind SQLServer-specific properties with the configured driver. switch(sqlServerDriver) { case JTDS: JdbcHelper.SQL_Server_jTDS.configure(binder); break; case DATA_DIRECT: JdbcHelper.SQL_Server_DataDirect.configure(binder); break; case MICROSOFT_LEGACY: JdbcHelper.SQL_Server_MS_Driver.configure(binder); break; case MICROSOFT_2005: JdbcHelper.SQL_Server_2005_MS_Driver.configure(binder); break; default: throw new UnsupportedOperationException( "A driver has been specified that is not supported by this module." ); } // Bind MyBatis properties Names.bindProperties(binder, myBatisProperties); // Bind JDBC driver properties binder.bind(Properties.class) .annotatedWith(Names.named("JDBC.driverProperties")) .toInstance(driverProperties); }
public static ObjectInspector getDrillObjectInspector(DataMode mode, MinorType minorType, boolean varCharToStringReplacement) { try { if (mode == DataMode.REQUIRED) { if (OIMAP_REQUIRED.containsKey(minorType)) { if (varCharToStringReplacement && minorType == MinorType.VARCHAR) { return (ObjectInspector) ((Class) OIMAP_REQUIRED.get(minorType).toArray()[1]).newInstance(); } else { return (ObjectInspector) ((Class) OIMAP_REQUIRED.get(minorType).toArray()[0]).newInstance(); } } } else if (mode == DataMode.OPTIONAL) { if (OIMAP_OPTIONAL.containsKey(minorType)) { if (varCharToStringReplacement && minorType == MinorType.VARCHAR) { return (ObjectInspector) ((Class) OIMAP_OPTIONAL.get(minorType).toArray()[1]).newInstance(); } else { return (ObjectInspector) ((Class) OIMAP_OPTIONAL.get(minorType).toArray()[0]).newInstance(); } } } else { throw new UnsupportedOperationException("Repeated types are not supported as arguement to Hive UDFs"); } } catch(InstantiationException | IllegalAccessException e) { throw new RuntimeException("Failed to instantiate ObjectInspector", e); } throw new UnsupportedOperationException( String.format("Type %s[%s] not supported as arguement to Hive UDFs", minorType.toString(), mode.toString())); }
public ShakeMonitor(Context context) { mContext = context; mSensorManager = (SensorManager)mContext.getSystemService(Context.SENSOR_SERVICE); if (mSensorManager == null) { throw new UnsupportedOperationException("Sensors not supported"); } mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); }
/** * Set the null parent of this to newparent. * @throws UnsupportedOperationException if current parent is not null */ public void addParent(Node<T> newparent) throws UnsupportedOperationException { if (parent == null) { parent = newparent; } else { throw new UnsupportedOperationException("Tree: Adding new " + "parent to Node with non-null parent."); } }
/** * The instance of the HunspellManager, looks for the native lib in * the directory specified. * * @param libDir Optional absolute directory where the native lib can be found. */ public static Hunspell getInstance(String libDir) throws UnsatisfiedLinkError, UnsupportedOperationException { if (hunspell != null) { return hunspell; } hunspell = new Hunspell(libDir); return hunspell; }
/** * Calculate the filename of the native hunspell lib. * The files have completely different names to allow them to live * in the same directory and avoid confusion. */ public static String libName() throws UnsupportedOperationException { String os = System.getProperty("os.name").toLowerCase(); if (os.startsWith("windows")) { return libNameBare()+".dll"; } else if (os.startsWith("mac os x")) { // return libNameBare()+".dylib"; return libNameBare()+".jnilib"; } else { return "lib"+libNameBare()+".so"; } }
/** * Runs the test using the specified harness. * * @param harness the test harness (<code>null</code> not permitted). */ public void test(TestHarness harness) { // flag that is set when exception is caught boolean caught = false; try { throw new UnsupportedOperationException("UnsupportedOperationException"); } catch (UnsupportedOperationException e) { // correct exception was caught caught = true; } harness.check(caught); }
public void resume() { this.sensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE); if (this.sensorManager == null) { throw new UnsupportedOperationException("Sensors not supported"); } accelerationSensor = this.sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); sensorManager.registerListener(this, accelerationSensor, SensorManager.SENSOR_DELAY_NORMAL); }
public void testRemove() { try { iterator.remove(); fail("Expected UnsupportedOperationException on a remove."); } catch (UnsupportedOperationException e) { } }
public static SEXP sexpFromPointer(Object ptr) { // Currently, our GCC bridge doesn't support storing values // to fields, so we can be confident that no other references // to these pointers exist if(ptr instanceof DoublePtr) { return DoubleArrayVector.unsafe(((DoublePtr) ptr).array); } else if(ptr instanceof IntPtr) { return new IntArrayVector(((IntPtr) ptr).array); } else { throw new UnsupportedOperationException(ptr.toString()); } }
@Test public void typeVariables() throws Exception { TypeVariableName t = TypeVariableName.get("T"); TypeVariableName p = TypeVariableName.get("P", Number.class); ClassName location = ClassName.get(tacosPackage, "Location"); TypeSpec typeSpec = TypeSpec.classBuilder("Location") .addTypeVariable(t) .addTypeVariable(p) .addSuperinterface(ParameterizedTypeName.get(ClassName.get(Comparable.class), p)) .addField(t, "label") .addField(p, "x") .addField(p, "y") .addMethod(MethodSpec.methodBuilder("compareTo") .addAnnotation(Override.class) .addModifiers(Modifier.PUBLIC) .returns(int.class) .addParameter(p, "p") .addCode("return 0;\n") .build()) .addMethod(MethodSpec.methodBuilder("of") .addModifiers(Modifier.PUBLIC, Modifier.STATIC) .addTypeVariable(t) .addTypeVariable(p) .returns(ParameterizedTypeName.get(location, t, p)) .addParameter(t, "label") .addParameter(p, "x") .addParameter(p, "y") .addCode("throw new $T($S);\n", UnsupportedOperationException.class, "TODO") .build()) .build(); assertThat(toString(typeSpec)).isEqualTo("" + "package com.squareup.tacos;\n" + "\n" + "import java.lang.Comparable;\n" + "import java.lang.Number;\n" + "import java.lang.Override;\n" + "import java.lang.UnsupportedOperationException;\n" + "\n" + "class Location<T, P extends Number> implements Comparable<P> {\n" + " T label;\n" + "\n" + " P x;\n" + "\n" + " P y;\n" + "\n" + " @Override\n" + " public int compareTo(P p) {\n" + " return 0;\n" + " }\n" + "\n" + " public static <T, P extends Number> Location<T, P> of(T label, P x, P y) {\n" + " throw new UnsupportedOperationException(\"TODO\");\n" + " }\n" + "}\n"); }