Skip to content

Commit

Permalink
Remove bogus IOExceptions from some methods as they interfere with using
Browse files Browse the repository at this point in the history
lambdas
  • Loading branch information
slacmshankar committed Dec 5, 2015
1 parent 2fb5fbc commit 459a5af
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 35 deletions.
22 changes: 9 additions & 13 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main"/>
<classpathentry kind="src" path="src/test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/protobuf-java-2.4.1.jar"/>
<classpathentry kind="lib" path="lib/test/junit-4.10.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main"/>
<classpathentry kind="src" path="src/test"/>
<classpathentry kind="lib" path="lib/protobuf-java-2.4.1.jar"/>
<classpathentry kind="lib" path="lib/test/junit-4.10.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.epics.archiverappliance.retrieval.client;

import java.io.IOException;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.HashMap;
Expand Down Expand Up @@ -48,7 +47,7 @@ public int getElementCount() {
}

@SuppressWarnings("unchecked")
public Number getNumberValue() throws IOException {
public Number getNumberValue() {
switch(info.getType()) {
case SCALAR_BYTE: {
return ((ByteString) message.getField(message.getDescriptorForType().findFieldByNumber(3))).toByteArray()[0];
Expand Down Expand Up @@ -93,15 +92,15 @@ public Number getNumberValue() throws IOException {
return Double.parseDouble(((List<String>) message.getField(message.getDescriptorForType().findFieldByNumber(3))).get(0));
}
case V4_GENERIC_BYTES: {
throw new IOException("Can't cast V4_GENERIC_BYTES to Number");
throw new UnsupportedOperationException("Can't cast V4_GENERIC_BYTES to Number");
}
default:
throw new IOException("Unknown type " + info.getType());
throw new UnsupportedOperationException("Unknown type " + info.getType());
}
}

@SuppressWarnings("unchecked")
public Number getNumberAt(int index) throws IOException {
public Number getNumberAt(int index) {
switch(info.getType()) {
case SCALAR_BYTE: {
return ((ByteString) message.getField(message.getDescriptorForType().findFieldByNumber(3))).toByteArray()[0];
Expand Down Expand Up @@ -146,64 +145,64 @@ public Number getNumberAt(int index) throws IOException {
return Double.parseDouble(((List<String>) message.getField(message.getDescriptorForType().findFieldByNumber(3))).get(index));
}
case V4_GENERIC_BYTES: {
throw new IOException("Can't cast V4_GENERIC_BYTES to Number");
throw new UnsupportedOperationException("Can't cast V4_GENERIC_BYTES to Number");
}
default:
throw new IOException("Unknown type " + info.getType());
throw new UnsupportedOperationException("Unknown type " + info.getType());
}
}

@SuppressWarnings("unchecked")
public String getStringValue() throws IOException {
public String getStringValue() {
String notSupportedMessage = "Conversion to string not supported yet";
switch(info.getType()) {
case SCALAR_BYTE: {
throw new IOException(notSupportedMessage);
throw new UnsupportedOperationException(notSupportedMessage);
}
case SCALAR_DOUBLE: {
throw new IOException(notSupportedMessage);
throw new UnsupportedOperationException(notSupportedMessage);
}
case SCALAR_ENUM: {
throw new IOException(notSupportedMessage);
throw new UnsupportedOperationException(notSupportedMessage);
}
case SCALAR_FLOAT: {
throw new IOException(notSupportedMessage);
throw new UnsupportedOperationException(notSupportedMessage);
}
case SCALAR_INT: {
throw new IOException(notSupportedMessage);
throw new UnsupportedOperationException(notSupportedMessage);
}
case SCALAR_SHORT: {
throw new IOException(notSupportedMessage);
throw new UnsupportedOperationException(notSupportedMessage);
}
case SCALAR_STRING: {
return (String) message.getField(message.getDescriptorForType().findFieldByNumber(3));
}
case WAVEFORM_BYTE: {
throw new IOException(notSupportedMessage);
throw new UnsupportedOperationException(notSupportedMessage);
}
case WAVEFORM_DOUBLE: {
throw new IOException(notSupportedMessage);
throw new UnsupportedOperationException(notSupportedMessage);
}
case WAVEFORM_ENUM: {
throw new IOException(notSupportedMessage);
throw new UnsupportedOperationException(notSupportedMessage);
}
case WAVEFORM_FLOAT: {
throw new IOException(notSupportedMessage);
throw new UnsupportedOperationException(notSupportedMessage);
}
case WAVEFORM_INT: {
throw new IOException(notSupportedMessage);
throw new UnsupportedOperationException(notSupportedMessage);
}
case WAVEFORM_SHORT: {
throw new IOException(notSupportedMessage);
throw new UnsupportedOperationException(notSupportedMessage);
}
case WAVEFORM_STRING: {
return ((List<String>) message.getField(message.getDescriptorForType().findFieldByNumber(3))).get(0);
}
case V4_GENERIC_BYTES: {
throw new IOException("Can't cast V4_GENERIC_BYTES to Number");
throw new UnsupportedOperationException("Can't cast V4_GENERIC_BYTES to Number");
}
default:
throw new IOException("Unknown type " + info.getType());
throw new UnsupportedOperationException("Unknown type " + info.getType());
}
}

Expand Down

0 comments on commit 459a5af

Please sign in to comment.