Java Code Examples for java.rmi.UnexpectedException

The following are top voted examples for showing how to use java.rmi.UnexpectedException. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: cloud-native-microservice-strangler-example   File: Receiver.java   View source code 7 votes vote down vote up
@RabbitListener(queues = {"customer.update"})
public void updateCustomer(String message) throws InterruptedException, IOException {
    Profile profile = objectMapper.readValue(message, Profile.class);

    try {
        // Update the customer service for the profile
        UpdateCustomerResponse response =
                customerClient.updateCustomerResponse(profile);

        if (!response.isSuccess()) {
            String errorMsg =
                    String.format("Could not update customer from profile for %s",
                            profile.getUsername());
            log.error(errorMsg);
            throw new UnexpectedException(errorMsg);
        }
    } catch (Exception ex) {
        // Throw AMQP exception and redeliver the message
        throw new AmqpIllegalStateException("Customer service update failed", ex);
    }
}
 
Example 2
Project: OpenJSharp   File: Util.java   View source code 6 votes vote down vote up
/**
 * Wraps an exception thrown by an implementation
 * method.  It returns the corresponding client-side exception.
 * @param orig the exception to wrap.
 * @return the wrapped exception.
 */
public RemoteException wrapException(Throwable orig)
{
    if (orig instanceof SystemException) {
        return mapSystemException((SystemException)orig);
    }

    if (orig instanceof Error) {
        return new ServerError("Error occurred in server thread",(Error)orig);
    } else if (orig instanceof RemoteException) {
        return new ServerException("RemoteException occurred in server thread",
                                   (Exception)orig);
    } else if (orig instanceof RuntimeException) {
        throw (RuntimeException) orig;
    }

    if (orig instanceof Exception)
        return new UnexpectedException( orig.toString(), (Exception)orig );
    else
        return new UnexpectedException( orig.toString());
}
 
Example 3
Project: OpenJSharp   File: ExceptionHandlerImpl.java   View source code 6 votes vote down vote up
public Exception readException( ApplicationException ae )
{
    // Note that the exception ID is present in both ae
    // and in the input stream from ae.  The exception
    // reader must actually read the exception ID from
    // the stream.
    InputStream is = (InputStream)ae.getInputStream() ;
    String excName = ae.getId() ;
    int index = findDeclaredException( excName ) ;
    if (index < 0) {
        excName = is.read_string() ;
        Exception res = new UnexpectedException( excName ) ;
        res.initCause( ae ) ;
        return res ;
    }

    return rws[index].read( is ) ;
}
 
Example 4
Project: openjdk-jdk10   File: Util.java   View source code 6 votes vote down vote up
/**
 * Wraps an exception thrown by an implementation
 * method.  It returns the corresponding client-side exception.
 * @param orig the exception to wrap.
 * @return the wrapped exception.
 */
public RemoteException wrapException(Throwable orig)
{
    if (orig instanceof SystemException) {
        return mapSystemException((SystemException)orig);
    }

    if (orig instanceof Error) {
        return new ServerError("Error occurred in server thread",(Error)orig);
    } else if (orig instanceof RemoteException) {
        return new ServerException("RemoteException occurred in server thread",
                                   (Exception)orig);
    } else if (orig instanceof RuntimeException) {
        throw (RuntimeException) orig;
    }

    if (orig instanceof Exception)
        return new UnexpectedException( orig.toString(), (Exception)orig );
    else
        return new UnexpectedException( orig.toString());
}
 
Example 5
Project: openjdk-jdk10   File: ExceptionHandlerImpl.java   View source code 6 votes vote down vote up
public Exception readException( ApplicationException ae )
{
    // Note that the exception ID is present in both ae
    // and in the input stream from ae.  The exception
    // reader must actually read the exception ID from
    // the stream.
    InputStream is = (InputStream)ae.getInputStream() ;
    String excName = ae.getId() ;
    int index = findDeclaredException( excName ) ;
    if (index < 0) {
        excName = is.read_string() ;
        Exception res = new UnexpectedException( excName ) ;
        res.initCause( ae ) ;
        return res ;
    }

    return rws[index].read( is ) ;
}
 
Example 6
Project: Planchester   File: PlanchesterGUI.java   View source code 6 votes vote down vote up
private static void showPlanchesterGUI() {
    try {
        primaryStage = new Stage();
        primaryStage.setTitle("Planchester");
        //primaryStage.setResizable(false);
        primaryStage.setMaximized(true);

        primaryStage.setOnCloseRequest(t -> {
            closePlanchester();
        });

        scene = new Scene(FXMLLoader.load(PlanchesterGUI.class.getResource("PlanchesterFrame.fxml")));

        URL url = PlanchesterGUI.class.getResource("CSS/stylesheet.css");
        if (url == null) {
            throw new UnexpectedException("CSS Resource not found. Aborting.");
        }
        String css = url.toExternalForm();
        scene.getStylesheets().add(css);

        primaryStage.setScene(scene);
        primaryStage.getIcons().add(new Image("file:src/Presentation/Images/logoplanchester.png"));
        primaryStage.show();
    } catch (IOException exception) {
        exception.printStackTrace();
    }
}
 
Example 7
Project: openjdk9   File: Util.java   View source code 6 votes vote down vote up
/**
 * Wraps an exception thrown by an implementation
 * method.  It returns the corresponding client-side exception.
 * @param orig the exception to wrap.
 * @return the wrapped exception.
 */
public RemoteException wrapException(Throwable orig)
{
    if (orig instanceof SystemException) {
        return mapSystemException((SystemException)orig);
    }

    if (orig instanceof Error) {
        return new ServerError("Error occurred in server thread",(Error)orig);
    } else if (orig instanceof RemoteException) {
        return new ServerException("RemoteException occurred in server thread",
                                   (Exception)orig);
    } else if (orig instanceof RuntimeException) {
        throw (RuntimeException) orig;
    }

    if (orig instanceof Exception)
        return new UnexpectedException( orig.toString(), (Exception)orig );
    else
        return new UnexpectedException( orig.toString());
}
 
Example 8
Project: openjdk9   File: ExceptionHandlerImpl.java   View source code 6 votes vote down vote up
public Exception readException( ApplicationException ae )
{
    // Note that the exception ID is present in both ae
    // and in the input stream from ae.  The exception
    // reader must actually read the exception ID from
    // the stream.
    InputStream is = (InputStream)ae.getInputStream() ;
    String excName = ae.getId() ;
    int index = findDeclaredException( excName ) ;
    if (index < 0) {
        excName = is.read_string() ;
        Exception res = new UnexpectedException( excName ) ;
        res.initCause( ae ) ;
        return res ;
    }

    return rws[index].read( is ) ;
}
 
Example 9
Project: lookaside_java-1.8.0-openjdk   File: Util.java   View source code 6 votes vote down vote up
/**
 * Wraps an exception thrown by an implementation
 * method.  It returns the corresponding client-side exception.
 * @param orig the exception to wrap.
 * @return the wrapped exception.
 */
public RemoteException wrapException(Throwable orig)
{
    if (orig instanceof SystemException) {
        return mapSystemException((SystemException)orig);
    }

    if (orig instanceof Error) {
        return new ServerError("Error occurred in server thread",(Error)orig);
    } else if (orig instanceof RemoteException) {
        return new ServerException("RemoteException occurred in server thread",
                                   (Exception)orig);
    } else if (orig instanceof RuntimeException) {
        throw (RuntimeException) orig;
    }

    if (orig instanceof Exception)
        return new UnexpectedException( orig.toString(), (Exception)orig );
    else
        return new UnexpectedException( orig.toString());
}
 
Example 10
Project: lookaside_java-1.8.0-openjdk   File: ExceptionHandlerImpl.java   View source code 6 votes vote down vote up
public Exception readException( ApplicationException ae )
{
    // Note that the exception ID is present in both ae
    // and in the input stream from ae.  The exception
    // reader must actually read the exception ID from
    // the stream.
    InputStream is = (InputStream)ae.getInputStream() ;
    String excName = ae.getId() ;
    int index = findDeclaredException( excName ) ;
    if (index < 0) {
        excName = is.read_string() ;
        Exception res = new UnexpectedException( excName ) ;
        res.initCause( ae ) ;
        return res ;
    }

    return rws[index].read( is ) ;
}
 
Example 11
Project: jdk8u_corba   File: Util.java   View source code 6 votes vote down vote up
/**
 * Wraps an exception thrown by an implementation
 * method.  It returns the corresponding client-side exception.
 * @param orig the exception to wrap.
 * @return the wrapped exception.
 */
public RemoteException wrapException(Throwable orig)
{
    if (orig instanceof SystemException) {
        return mapSystemException((SystemException)orig);
    }

    if (orig instanceof Error) {
        return new ServerError("Error occurred in server thread",(Error)orig);
    } else if (orig instanceof RemoteException) {
        return new ServerException("RemoteException occurred in server thread",
                                   (Exception)orig);
    } else if (orig instanceof RuntimeException) {
        throw (RuntimeException) orig;
    }

    if (orig instanceof Exception)
        return new UnexpectedException( orig.toString(), (Exception)orig );
    else
        return new UnexpectedException( orig.toString());
}
 
Example 12
Project: jdk8u_corba   File: ExceptionHandlerImpl.java   View source code 6 votes vote down vote up
public Exception readException( ApplicationException ae )
{
    // Note that the exception ID is present in both ae
    // and in the input stream from ae.  The exception
    // reader must actually read the exception ID from
    // the stream.
    InputStream is = (InputStream)ae.getInputStream() ;
    String excName = ae.getId() ;
    int index = findDeclaredException( excName ) ;
    if (index < 0) {
        excName = is.read_string() ;
        Exception res = new UnexpectedException( excName ) ;
        res.initCause( ae ) ;
        return res ;
    }

    return rws[index].read( is ) ;
}
 
Example 13
Project: HIndex   File: MemStore.java   View source code 6 votes vote down vote up
/**
 * The passed snapshot was successfully persisted; it can be let go.
 * @param ss The snapshot to clean out.
 * @throws UnexpectedException
 * @see #snapshot()
 */
void clearSnapshot(final SortedSet<KeyValue> ss)
throws UnexpectedException {
  MemStoreLAB tmpAllocator = null;
  if (this.snapshot != ss) {
    throw new UnexpectedException("Current snapshot is " +
        this.snapshot + ", was passed " + ss);
  }
  // OK. Passed in snapshot is same as current snapshot.  If not-empty,
  // create a new snapshot and let the old one go.
  if (!ss.isEmpty()) {
    this.snapshot = new KeyValueSkipListSet(this.comparator);
    this.snapshotTimeRangeTracker = new TimeRangeTracker();
  }
  this.snapshotSize = 0;
  if (this.snapshotAllocator != null) {
    tmpAllocator = this.snapshotAllocator;
    this.snapshotAllocator = null;
  }
  if (tmpAllocator != null) {
    tmpAllocator.close();
  }
}
 
Example 14
Project: infobip-open-jdk-8   File: Util.java   View source code 6 votes vote down vote up
/**
 * Wraps an exception thrown by an implementation
 * method.  It returns the corresponding client-side exception.
 * @param orig the exception to wrap.
 * @return the wrapped exception.
 */
public RemoteException wrapException(Throwable orig)
{
    if (orig instanceof SystemException) {
        return mapSystemException((SystemException)orig);
    }

    if (orig instanceof Error) {
        return new ServerError("Error occurred in server thread",(Error)orig);
    } else if (orig instanceof RemoteException) {
        return new ServerException("RemoteException occurred in server thread",
                                   (Exception)orig);
    } else if (orig instanceof RuntimeException) {
        throw (RuntimeException) orig;
    }

    if (orig instanceof Exception)
        return new UnexpectedException( orig.toString(), (Exception)orig );
    else
        return new UnexpectedException( orig.toString());
}
 
Example 15
Project: infobip-open-jdk-8   File: ExceptionHandlerImpl.java   View source code 6 votes vote down vote up
public Exception readException( ApplicationException ae )
{
    // Note that the exception ID is present in both ae
    // and in the input stream from ae.  The exception
    // reader must actually read the exception ID from
    // the stream.
    InputStream is = (InputStream)ae.getInputStream() ;
    String excName = ae.getId() ;
    int index = findDeclaredException( excName ) ;
    if (index < 0) {
        excName = is.read_string() ;
        Exception res = new UnexpectedException( excName ) ;
        res.initCause( ae ) ;
        return res ;
    }

    return rws[index].read( is ) ;
}
 
Example 16
Project: txtUML   File: Exporter.java   View source code 6 votes vote down vote up
/**
 * Populates model with the diagrams to be exported
 * 
 * @throws ModelMapException
 * @throws ArrangeException
 * @throws UnknownDiagramTypeException
 * @throws UnexpectedEndException
 */
private void createModel() throws ModelMapException, ArrangeException, UnexpectedDiagramTypeException,
		UnexpectedEndException, UnexpectedException {

	for (Pair<String, DiagramExportationReport> report : layout.getReportsWithDiagramNames()) {
		String name = report.getFirst();
		DiagramExportationReport der = report.getSecond();

		// map connects the layout information to the EMF-UML model
		// informations
		ModelMapProvider map = new ModelMapProvider(URI.createFileURI(genFolder), der.getModelName());

		model.createDiagram(name, report.getSecond(), map);

	}

}
 
Example 17
Project: openjdk-source-code-learn   File: Util.java   View source code 6 votes vote down vote up
/**
 * Wraps an exception thrown by an implementation
 * method.  It returns the corresponding client-side exception.
 * @param orig the exception to wrap.
 * @return the wrapped exception.
 */
public RemoteException wrapException(Throwable orig)
{
    if (orig instanceof SystemException) {
        return mapSystemException((SystemException)orig);
    }

    if (orig instanceof Error) {
        return new ServerError("Error occurred in server thread",(Error)orig);
    } else if (orig instanceof RemoteException) {
        return new ServerException("RemoteException occurred in server thread",
                                   (Exception)orig);
    } else if (orig instanceof RuntimeException) {
        throw (RuntimeException) orig;
    }

    if (orig instanceof Exception)
        return new UnexpectedException( orig.toString(), (Exception)orig );
    else
        return new UnexpectedException( orig.toString());
}
 
Example 18
Project: openjdk-source-code-learn   File: ExceptionHandlerImpl.java   View source code 6 votes vote down vote up
public Exception readException( ApplicationException ae )
{
    // Note that the exception ID is present in both ae
    // and in the input stream from ae.  The exception
    // reader must actually read the exception ID from
    // the stream.
    InputStream is = (InputStream)ae.getInputStream() ;
    String excName = ae.getId() ;
    int index = findDeclaredException( excName ) ;
    if (index < 0) {
        excName = is.read_string() ;
        Exception res = new UnexpectedException( excName ) ;
        res.initCause( ae ) ;
        return res ;
    }

    return rws[index].read( is ) ;
}
 
Example 19
Project: RStore   File: MemStore.java   View source code 6 votes vote down vote up
/**
 * The passed snapshot was successfully persisted; it can be let go.
 * @param ss The snapshot to clean out.
 * @throws UnexpectedException
 * @see {@link #snapshot()}
 */
void clearSnapshot(final SortedSet<KeyValue> ss)
throws UnexpectedException {
  this.lock.writeLock().lock();
  try {
    if (this.snapshot != ss) {
      throw new UnexpectedException("Current snapshot is " +
        this.snapshot + ", was passed " + ss);
    }
    // OK. Passed in snapshot is same as current snapshot.  If not-empty,
    // create a new snapshot and let the old one go.
    if (!ss.isEmpty()) {
      this.snapshot = new KeyValueSkipListSet(this.comparator);
      this.snapshotTimeRangeTracker = new TimeRangeTracker();
    }
  } finally {
    this.lock.writeLock().unlock();
  }
}
 
Example 20
Project: OLD-OpenJDK8   File: Util.java   View source code 6 votes vote down vote up
/**
 * Wraps an exception thrown by an implementation
 * method.  It returns the corresponding client-side exception.
 * @param orig the exception to wrap.
 * @return the wrapped exception.
 */
public RemoteException wrapException(Throwable orig)
{
    if (orig instanceof SystemException) {
        return mapSystemException((SystemException)orig);
    }

    if (orig instanceof Error) {
        return new ServerError("Error occurred in server thread",(Error)orig);
    } else if (orig instanceof RemoteException) {
        return new ServerException("RemoteException occurred in server thread",
                                   (Exception)orig);
    } else if (orig instanceof RuntimeException) {
        throw (RuntimeException) orig;
    }

    if (orig instanceof Exception)
        return new UnexpectedException( orig.toString(), (Exception)orig );
    else
        return new UnexpectedException( orig.toString());
}
 
Example 21
Project: OLD-OpenJDK8   File: ExceptionHandlerImpl.java   View source code 6 votes vote down vote up
public Exception readException( ApplicationException ae )
{
    // Note that the exception ID is present in both ae
    // and in the input stream from ae.  The exception
    // reader must actually read the exception ID from
    // the stream.
    InputStream is = (InputStream)ae.getInputStream() ;
    String excName = ae.getId() ;
    int index = findDeclaredException( excName ) ;
    if (index < 0) {
        excName = is.read_string() ;
        Exception res = new UnexpectedException( excName ) ;
        res.initCause( ae ) ;
        return res ;
    }

    return rws[index].read( is ) ;
}
 
Example 22
Project: cn1   File: RemoteObjectInvocationHandler.java   View source code 6 votes vote down vote up
private Object invokeRemoteMethod(Object proxy, Method m, Object[] args)
        throws Throwable {
    try {
        return ref.invoke((Remote) proxy, m, args,
                RMIHash.getMethodHash(m));
    } catch (RuntimeException re) {
        throw re;
    } catch (Exception ex) {
        Method m1 = proxy.getClass().getMethod(m.getName(),
                m.getParameterTypes());
        Class[] declaredEx = m1.getExceptionTypes();

        for (int i = 0; i < declaredEx.length; ++i) {
            if (declaredEx[i].isAssignableFrom(ex.getClass())) {
                throw ex;
            }
        }
        // rmi.24=Unexpected exception
        throw new UnexpectedException(Messages.getString("rmi.24"), ex); //$NON-NLS-1$
    }
}
 
Example 23
Project: varsim   File: VCFInfo.java   View source code 6 votes vote down vote up
/**
 * parse comma separated value and store it
 * in proper types
 * @param id
 * @param vcfIdValue
 */
public VCFInfoElement(final String id, String vcfIdValue) throws UnexpectedException {
    this.type = getType(id);
    String[] valueArray = vcfIdValue.split(",");
    if (type == int[].class) {
        int[] nums = new int[valueArray.length];
        for (int i = 0; i < valueArray.length; i++) {
            nums[i] = Integer.parseInt(valueArray[i]);
        }
        this.value = type.cast(nums);
    } else if (type == String[].class) {
            this.value = type.cast(valueArray);
    } else {
        throw new UnexpectedException("ERROR: only Integer and String supported for INFO field (" + id + ").");
    }
}
 
Example 24
Project: varsim   File: VCFparserTest.java   View source code 6 votes vote down vote up
@Before
public void setup() throws UnexpectedException{
    parser = new VCFparser();
    parser.processLine("##fileformat=VCFv4.1");
    parser.processLine("##reference=src/test/resources/DuplicationTest/oneDuplicationTest.fa");
    parser.processLine("##INFO=<ID=SVLEN,Number=.,Type=Integer,Description=\"Length of variant\">");
    parser.processLine("##INFO=<ID=SVTYPE,Number=1,Type=String,Description=\"Type of structural variant\">");
    parser.processLine("##FORMAT=<ID=GT,Number=1,Type=String,Description=\"Genotype\">");
    parser.processLine("##ALT=<ID=DEL,Description=\"Deletion\">");
    parser.processLine("##ALT=<ID=DEL:ME:ALU,Description=\"Deletion of ALU element\">");
    parser.processLine("##ALT=<ID=DEL:ME:L1,Description=\"Deletion of L1 element\">");
    parser.processLine("##ALT=<ID=DUP,Description=\"Duplication\">");
    parser.processLine("##ALT=<ID=DUP:TANDEM,Description=\"Tandem Duplication\">");
    parser.processLine("##ALT=<ID=INS,Description=\"Insertion of novel sequence\">");
    parser.processLine("##ALT=<ID=INS:ME:ALU,Description=\"Insertion of ALU element\">");
    parser.processLine("##ALT=<ID=INS:ME:L1,Description=\"Insertion of L1 element\">");
    parser.processLine("##ALT=<ID=INV,Description=\"Inversion\">");
    parser.processLine("##ALT=<ID=CNV,Description=\"Copy number variable region\">");
    parser.processLine("##ALT=<ID=ITX,Description=\"Intra-chromosomal translocation\">");
    parser.processLine("##ALT=<ID=CTX,Description=\"Inter-chromosomal translocation\">");
    parser.processLine("#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	test");
}
 
Example 25
Project: c5   File: MemStore.java   View source code 6 votes vote down vote up
/**
 * The passed snapshot was successfully persisted; it can be let go.
 * @param ss The snapshot to clean out.
 * @throws UnexpectedException
 * @see #snapshot()
 */
void clearSnapshot(final SortedSet<KeyValue> ss)
throws UnexpectedException {
  MemStoreLAB tmpAllocator = null;
  if (this.snapshot != ss) {
    throw new UnexpectedException("Current snapshot is " +
        this.snapshot + ", was passed " + ss);
  }
  // OK. Passed in snapshot is same as current snapshot.  If not-empty,
  // create a new snapshot and let the old one go.
  if (!ss.isEmpty()) {
    this.snapshot = new KeyValueSkipListSet(this.comparator);
    this.snapshotTimeRangeTracker = new TimeRangeTracker();
  }
  if (this.snapshotAllocator != null) {
    tmpAllocator = this.snapshotAllocator;
    this.snapshotAllocator = null;
  }
  if (tmpAllocator != null) {
    tmpAllocator.close();
  }
}
 
Example 26
Project: openjdk-orb   File: Util.java   View source code 6 votes vote down vote up
/**
 * Wraps an exception thrown by an implementation
 * method.  It returns the corresponding client-side exception.
 * @param orig the exception to wrap.
 * @return the wrapped exception.
 */
public RemoteException wrapException(Throwable orig)
{
    if (orig instanceof SystemException) {
        return mapSystemException((SystemException)orig);
    }

    if (orig instanceof Error) {
        return new ServerError("Error occurred in server thread",(Error)orig);
    } else if (orig instanceof RemoteException) {
        return new ServerException("RemoteException occurred in server thread",
                                   (Exception)orig);
    } else if (orig instanceof RuntimeException) {
        throw (RuntimeException) orig;
    }

    if (orig instanceof Exception)
        return new UnexpectedException( orig.toString(), (Exception)orig );
    else
        return new UnexpectedException( orig.toString());
}
 
Example 27
Project: openjdk-orb   File: ExceptionHandlerImpl.java   View source code 6 votes vote down vote up
public Exception readException( ApplicationException ae )
{
    // Note that the exception ID is present in both ae
    // and in the input stream from ae.  The exception
    // reader must actually read the exception ID from
    // the stream.
    InputStream is = (InputStream)ae.getInputStream() ;
    String excName = ae.getId() ;
    int index = findDeclaredException( excName ) ;
    if (index < 0) {
        excName = is.read_string() ;
        Exception res = new UnexpectedException( excName ) ;
        res.initCause( ae ) ;
        return res ;
    }

    return rws[index].read( is ) ;
}
 
Example 28
Project: freeVM   File: RemoteObjectInvocationHandler.java   View source code 6 votes vote down vote up
private Object invokeRemoteMethod(Object proxy, Method m, Object[] args)
        throws Throwable {
    try {
        return ref.invoke((Remote) proxy, m, args,
                RMIHash.getMethodHash(m));
    } catch (RuntimeException re) {
        throw re;
    } catch (Exception ex) {
        Method m1 = proxy.getClass().getMethod(m.getName(),
                m.getParameterTypes());
        Class[] declaredEx = m1.getExceptionTypes();

        for (int i = 0; i < declaredEx.length; ++i) {
            if (declaredEx[i].isAssignableFrom(ex.getClass())) {
                throw ex;
            }
        }
        // rmi.24=Unexpected exception
        throw new UnexpectedException(Messages.getString("rmi.24"), ex); //$NON-NLS-1$
    }
}
 
Example 29
Project: freeVM   File: RemoteObjectInvocationHandler.java   View source code 6 votes vote down vote up
private Object invokeRemoteMethod(Object proxy, Method m, Object[] args)
        throws Throwable {
    try {
        return ref.invoke((Remote) proxy, m, args,
                RMIHash.getMethodHash(m));
    } catch (RuntimeException re) {
        throw re;
    } catch (Exception ex) {
        Method m1 = proxy.getClass().getMethod(m.getName(),
                m.getParameterTypes());
        Class[] declaredEx = m1.getExceptionTypes();

        for (int i = 0; i < declaredEx.length; ++i) {
            if (declaredEx[i].isAssignableFrom(ex.getClass())) {
                throw ex;
            }
        }
        // rmi.24=Unexpected exception
        throw new UnexpectedException(Messages.getString("rmi.24"), ex); //$NON-NLS-1$
    }
}
 
Example 30
Project: aegisthus   File: AegisthusLoadCaster.java   View source code 6 votes vote down vote up
private long getNumber(byte[] arg0) throws Exception {
	byte[] by = hex.decode(arg0);
	ByteBuffer bb = ByteBuffer.allocate(by.length);
	bb.put(by);
	bb.position(0);
	switch(by.length) {
	case 1:
		return (long)bb.get();
	case 2:
		return (long)bb.getShort();
	case 4:
		return (long)bb.getInt();
	case 8:
		return (long)bb.getLong();
	}
	throw new UnexpectedException("couldn't determine datatype");
}
 
Example 31
Project: openjdk-icedtea7   File: Util.java   View source code 6 votes vote down vote up
/**
 * Wraps an exception thrown by an implementation
 * method.  It returns the corresponding client-side exception.
 * @param orig the exception to wrap.
 * @return the wrapped exception.
 */
public RemoteException wrapException(Throwable orig)
{
    if (orig instanceof SystemException) {
        return mapSystemException((SystemException)orig);
    }

    if (orig instanceof Error) {
        return new ServerError("Error occurred in server thread",(Error)orig);
    } else if (orig instanceof RemoteException) {
        return new ServerException("RemoteException occurred in server thread",
                                   (Exception)orig);
    } else if (orig instanceof RuntimeException) {
        throw (RuntimeException) orig;
    }

    if (orig instanceof Exception)
        return new UnexpectedException( orig.toString(), (Exception)orig );
    else
        return new UnexpectedException( orig.toString());
}
 
Example 32
Project: openjdk-icedtea7   File: ExceptionHandlerImpl.java   View source code 6 votes vote down vote up
public Exception readException( ApplicationException ae )
{
    // Note that the exception ID is present in both ae
    // and in the input stream from ae.  The exception
    // reader must actually read the exception ID from
    // the stream.
    InputStream is = (InputStream)ae.getInputStream() ;
    String excName = ae.getId() ;
    int index = findDeclaredException( excName ) ;
    if (index < 0) {
        excName = is.read_string() ;
        Exception res = new UnexpectedException( excName ) ;
        res.initCause( ae ) ;
        return res ;
    }

    return rws[index].read( is ) ;
}
 
Example 33
Project: HBase-Research   File: MemStore.java   View source code 6 votes vote down vote up
/**
 * The passed snapshot was successfully persisted; it can be let go.
 * @param ss The snapshot to clean out.
 * @throws UnexpectedException
 * @see {@link #snapshot()}
 */
void clearSnapshot(final SortedSet<KeyValue> ss)
throws UnexpectedException {
  this.lock.writeLock().lock();
  try {
    if (this.snapshot != ss) {
      throw new UnexpectedException("Current snapshot is " +
        this.snapshot + ", was passed " + ss);
    }
    // OK. Passed in snapshot is same as current snapshot.  If not-empty,
    // create a new snapshot and let the old one go.
    if (!ss.isEmpty()) {
      this.snapshot = new KeyValueSkipListSet(this.comparator);
      this.snapshotTimeRangeTracker = new TimeRangeTracker();
    }
  } finally {
    this.lock.writeLock().unlock();
  }
}
 
Example 34
Project: hbase-0.94.8-qod   File: MemStore.java   View source code 6 votes vote down vote up
/**
 * The passed snapshot was successfully persisted; it can be let go.
 * @param ss The snapshot to clean out.
 * @throws UnexpectedException
 * @see {@link #snapshot()}
 */
void clearSnapshot(final SortedSet<KeyValue> ss)
throws UnexpectedException {
  this.lock.writeLock().lock();
  try {
    if (this.snapshot != ss) {
      throw new UnexpectedException("Current snapshot is " +
        this.snapshot + ", was passed " + ss);
    }
    // OK. Passed in snapshot is same as current snapshot.  If not-empty,
    // create a new snapshot and let the old one go.
    if (!ss.isEmpty()) {
      this.snapshot = new KeyValueSkipListSet(this.comparator);
      this.snapshotTimeRangeTracker = new TimeRangeTracker();
    }
  } finally {
    this.lock.writeLock().unlock();
  }
}
 
Example 35
Project: hbase-0.94.8-qod   File: MemStore.java   View source code 6 votes vote down vote up
/**
 * The passed snapshot was successfully persisted; it can be let go.
 * @param ss The snapshot to clean out.
 * @throws UnexpectedException
 * @see {@link #snapshot()}
 */
void clearSnapshot(final SortedSet<KeyValue> ss)
throws UnexpectedException {
  this.lock.writeLock().lock();
  try {
    if (this.snapshot != ss) {
      throw new UnexpectedException("Current snapshot is " +
        this.snapshot + ", was passed " + ss);
    }
    // OK. Passed in snapshot is same as current snapshot.  If not-empty,
    // create a new snapshot and let the old one go.
    if (!ss.isEmpty()) {
      this.snapshot = new KeyValueSkipListSet(this.comparator);
      this.snapshotTimeRangeTracker = new TimeRangeTracker();
    }
  } finally {
    this.lock.writeLock().unlock();
  }
}
 
Example 36
Project: DominoHBase   File: MemStore.java   View source code 6 votes vote down vote up
/**
 * The passed snapshot was successfully persisted; it can be let go.
 * @param ss The snapshot to clean out.
 * @throws UnexpectedException
 * @see {@link #snapshot()}
 */
void clearSnapshot(final SortedSet<KeyValue> ss)
throws UnexpectedException {
  this.lock.writeLock().lock();
  try {
    if (this.snapshot != ss) {
      throw new UnexpectedException("Current snapshot is " +
        this.snapshot + ", was passed " + ss);
    }
    // OK. Passed in snapshot is same as current snapshot.  If not-empty,
    // create a new snapshot and let the old one go.
    if (!ss.isEmpty()) {
      this.snapshot = new KeyValueSkipListSet(this.comparator);
      this.snapshotTimeRangeTracker = new TimeRangeTracker();
    }
  } finally {
    this.lock.writeLock().unlock();
  }
}
 
Example 37
Project: hindex   File: MemStore.java   View source code 6 votes vote down vote up
/**
 * The passed snapshot was successfully persisted; it can be let go.
 * @param ss The snapshot to clean out.
 * @throws UnexpectedException
 * @see {@link #snapshot()}
 */
void clearSnapshot(final SortedSet<KeyValue> ss)
throws UnexpectedException {
  this.lock.writeLock().lock();
  try {
    if (this.snapshot != ss) {
      throw new UnexpectedException("Current snapshot is " +
        this.snapshot + ", was passed " + ss);
    }
    // OK. Passed in snapshot is same as current snapshot.  If not-empty,
    // create a new snapshot and let the old one go.
    if (!ss.isEmpty()) {
      this.snapshot = new KeyValueSkipListSet(this.comparator);
      this.snapshotTimeRangeTracker = new TimeRangeTracker();
    }
  } finally {
    this.lock.writeLock().unlock();
  }
}
 
Example 38
Project: LCIndex-HBase-0.94.16   File: MemStore.java   View source code 5 votes vote down vote up
/**
 * The passed snapshot was successfully persisted; it can be let go.
 * @param ss The snapshot to clean out.
 * @throws UnexpectedException
 * @see {@link #snapshot()}
 */
void clearSnapshot(final SortedSet<KeyValue> ss)
throws UnexpectedException {
  if (this.snapshot != ss) {
    throw new UnexpectedException("Current snapshot is " +
      this.snapshot + ", was passed " + ss);
  }
  // OK. Passed in snapshot is same as current snapshot.  If not-empty,
  // create a new snapshot and let the old one go.
  if (!ss.isEmpty()) {
    this.snapshot = new KeyValueSkipListSet(this.comparator);
    this.snapshotTimeRangeTracker = new TimeRangeTracker();
  }
}
 
Example 39
Project: LCIndex-HBase-0.94.16   File: TestMemStore.java   View source code 5 votes vote down vote up
private long runSnapshot(final MemStore hmc) throws UnexpectedException {
  // Save off old state.
  int oldHistorySize = hmc.getSnapshot().size();
  hmc.snapshot();
  KeyValueSkipListSet ss = hmc.getSnapshot();
  // Make some assertions about what just happened.
  assertTrue("History size has not increased", oldHistorySize < ss.size());
  long t = memstore.timeOfOldestEdit();
  assertTrue("Time of oldest edit is not Long.MAX_VALUE", t == Long.MAX_VALUE);
  hmc.clearSnapshot(ss);
  return t;
}
 
Example 40
Project: HIndex   File: TestMemStore.java   View source code 5 votes vote down vote up
private long runSnapshot(final MemStore hmc) throws UnexpectedException {
  // Save off old state.
  int oldHistorySize = hmc.getSnapshot().size();
  hmc.snapshot();
  KeyValueSkipListSet ss = hmc.getSnapshot();
  // Make some assertions about what just happened.
  assertTrue("History size has not increased", oldHistorySize < ss.size());
  long t = memstore.timeOfOldestEdit();
  assertTrue("Time of oldest edit is not Long.MAX_VALUE", t == Long.MAX_VALUE);
  hmc.clearSnapshot(ss);
  return t;
}