auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void scheduleTtl(String key, MapEntryValue value) { if (value.ttl() > 0) { value.timer = scheduler().schedule(Duration.ofMillis(value.ttl() - value.created()), () -> { <START> entries().remove(key); <END> publish(new MapEvent<>(MapEvent.Type.REMOVE, "", key, null, toVersioned(value))); }); } }</code><technical_language>remove(key, value) safer</technical_language>

Target:
protected void scheduleTtl(String key, MapEntryValue value) { if (value.ttl() > 0) { value.timer = scheduler().schedule(Duration.ofMillis(value.ttl() - value.created()), () -> { entries().remove(key, value); publish(new MapEvent<>(MapEvent.Type.REMOVE, "", key, null, toVersioned(value))); }); } }
Source:
<code>private boolean requestSuccess(String url) throws IOException { for (int i = 0; i < 60; ++i) { HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); <START> connection.connect(); <END> if (connection.getResponseCode() == 200) { return true; } SdkContext.sleep(5000); } return false; }</code><technical_language>Need close somewhere. <LINK_0></technical_language>

Target:
private boolean requestSuccess(String url) throws IOException { for (int i = 0; i < 60; ++i) { HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); try { connection.connect(); if (connection.getResponseCode() == 200) { connection.getInputStream().close(); return true; } System.out.printf("Do request to %s with response code %d%n", url, connection.getResponseCode()); } finally { connection.disconnect(); SdkContext.sleep(5000); } } return false; }
Source:
<code>public void setUp() throws CTFReaderException { <START> fixture = new BitBuffer(testMemory(java.nio.ByteBuffer.allocateDirect(1))); <END> fixture.setByteOrder(ByteOrder.BIG_ENDIAN); fixture.position(1); }</code><technical_language>import ByteBuffer, need full package path</technical_language>

Target:
public void setUp() throws CTFReaderException { fixture = new BitBuffer(Util.testMemory(java.nio.ByteBuffer.allocateDirect(1))); fixture.setByteOrder(ByteOrder.BIG_ENDIAN); fixture.position(1); }
Source:
<code>CloudPublisherOptions(final Map<String, Object> properties) { <START> requireNonNull(properties, "Properties cannot be null."); <END> this.properties = properties; }</code><technical_language>Add this WireMessages localization resource</technical_language>

Target:
CloudPublisherOptions(final Map<String, Object> properties) { requireNonNull(properties, message.propertiesNonNull()); this.properties = properties; }
Source:
<code>protected void Perform() { <START> log.infoFormat("Entered (VM {0}).", getVm().getName()); <END> final int secondsToWait = getParameters().getGracefulTimeout() == null ? Config.<Integer>GetValue(ConfigValues.VmGracefulShutdownTimeout) : getParameters().getGracefulTimeout(); if (hasVmConfigurationChanged() || getVm().isRunOnce()) { log.infoFormat("VM {0} configuration has changed. Destroying and recreating with new configuration.", getVm().getName()); Backend.getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.ShutdownVm, new ShutdownVmVDSCommandParameters(getVdsId(), getVmId(), secondsToWait, false, true)) .getReturnValue(); RunVmParams runVmParams = new RunVmParams(getVmId()); runVmParams.setSessionId(getParameters().getSessionId()); Backend.getInstance().runInternalAction(VdcActionType.RunVm, new RunVmParams(getVmId())); } else { log.infoFormat("Sending reboot command for VM {0}.", getVm().getName()); setActionReturnValue(Backend .getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.ShutdownVm, new ShutdownVmVDSCommandParameters(getVdsId(), getVmId(), secondsToWait, true, getParameters().isForceAsFallback())) .getReturnValue()); } }</code><technical_language>do need this info logged? commad is executed is log for (with id type of related object)</technical_language>

Target:
protected void Perform() { log.infoFormat("Entered (VM {0}).", getVm().getName()); final int secondsToWait = getParameters().getGracefulTimeout() == null ? Config.<Integer>GetValue(ConfigValues.VmGracefulShutdownTimeout) : getParameters().getGracefulTimeout(); if (hasVmConfigurationChanged() || getVm().isRunOnce()) { log.infoFormat("VM {0} configuration has changed. Destroying and recreating with new configuration.", getVm().getName()); Backend.getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.ShutdownVm, new ShutdownVmVDSCommandParameters(getVdsId(), getVmId(), secondsToWait, false, true)) .getReturnValue(); RunVmParams runVmParams = new RunVmParams(getVmId()); runVmParams.setSessionId(getParameters().getSessionId()); Backend.getInstance().runInternalAction(VdcActionType.RunVm, new RunVmParams(getVmId())); } else { log.infoFormat("Sending reboot command for VM {0}.", getVm().getName()); setActionReturnValue(Backend .getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.ShutdownVm, new ShutdownVmVDSCommandParameters(getVdsId(), getVmId(), secondsToWait, true, getParameters().isForceAsFallback())) .getReturnValue()); } setSucceeded(true); }
Source:
<code><START> public HttpRequest _copyHeaders() { <END> return _copyHeaders(headers.uri(), headers.method()); }</code><technical_language>I prefer this private, reason want public</technical_language>

Target:
private HttpRequest _copyHeaders() { return _copyHeaders(headers.uri(), headers.method()); }
Source:
<code>public Type getValidatedValueType(Type valueType) { Class<?> propertyClass = (Class<?>) valueType; if ( propertyClass.isAssignableFrom( ReadOnlyBooleanWrapper.class ) ) { return Boolean.class; } if ( propertyClass.isAssignableFrom( ReadOnlyDoubleWrapper.class ) ) { return Double.class; } if ( propertyClass.isAssignableFrom( ReadOnlyFloatWrapper.class ) ) { return Float.class; } if ( propertyClass.isAssignableFrom( ReadOnlyIntegerWrapper.class ) ) { return Integer.class; } if ( propertyClass.isAssignableFrom( ReadOnlyListWrapper.class ) ) { return List.class; } if ( propertyClass.isAssignableFrom( ReadOnlyLongWrapper.class ) ) { return Long.class; } if ( propertyClass.isAssignableFrom( ReadOnlyMapWrapper.class ) ) { return Map.class; } if ( propertyClass.isAssignableFrom( ReadOnlyObjectWrapper.class ) ) { return Object.class; } if ( propertyClass.isAssignableFrom( ReadOnlySetWrapper.class ) ) { return Set.class; } if ( propertyClass.isAssignableFrom( SimpleStringProperty.class ) ) { return String.class; } <START> throw log.getTypeNotSupportedForUnwrappingException( propertyClass ); <END> }</code><technical_language>Ah yes, in example (which raw type of Property) type parameter resolved Object. support declarations following: Property<String> stringProp = new SimpleStringProperty( "hello" ); Here, deduct String wrapped type declaration allow apply string constraints. I a quick type hierarchy of JavaFX properties, if unwrapper for ObservableValue is upmost type in hierachy wraps a value. WDYT</technical_language>

Target:
public Type getValidatedValueType(Type valueType) { ResolvedType resolvedType = typeResolver.resolve( valueType ); return resolvedType.typeParametersFor( ObservableValue.class ).get( 0 ).getErasedType(); }
Source:
<code>public Set<ResourceType<?>> getResourceTypes() { <START> Set<ResourceType<?>> resourceType = new HashSet<>(3); <END> resourceType.add(ClusteredResourceType.Types.DEDICATED); resourceType.add(ClusteredResourceType.Types.SHARED); resourceType.add(ClusteredResourceType.Types.UNKNOWN); return Collections.unmodifiableSet(resourceType); }</code><technical_language>I doCollections.unmodifiableSet(new HashSet<>(Arrays.asList(ClusteredResourceType.values()));. this code move ClusteredResourceType</technical_language>

Target:
public Set<ResourceType<?>> getResourceTypes() { return Collections.unmodifiableSet(new HashSet<>(Arrays.asList(ClusteredResourceType.Types.values()))); }
Source:
<code>public final static String decodedTemplate(AbstractBuild<?, ?> build, String template) { try { if (build != null) { return TokenMacro.expandAll(build, TaskListener.NULL, template); } } catch (MacroEvaluationException e) { <START> e.printStackTrace(); <END> } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } return ""; }</code><technical_language>printStackTrace directs output console replaced logger debugging</technical_language>

Target:
public final static String decodedTemplate(AbstractBuild<?, ?> build, String template) { try { if (build != null) { return TokenMacro.expandAll(build, TaskListener.NULL, template); } } catch (MacroEvaluationException e) { LOG.log(Level.WARNING, e.getMessage()); } catch (Exception e) { LOG.log(Level.WARNING, TokenUtils.MESSAGE + e.getMessage()); } return ""; }
Source:
<code>private ListenableFuture<ServiceDescriptors> refresh() { final ServiceDescriptors oldDescriptors = this.serviceDescriptors.get(); final ListenableFuture<ServiceDescriptors> future; if (oldDescriptors == null) { future = discoveryClient.getServices(type, pool); } else { future = discoveryClient.refreshServices(oldDescriptors); } return chainedCallback(future, new FutureCallback<ServiceDescriptors>() { @Override @SuppressFBWarnings("NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE") public void onSuccess(ServiceDescriptors newDescriptors) { Duration delay = null; <START> if(serviceDescriptors.compareAndSet(null, newDescriptors)){ <END> target.updateServiceDescriptors(newDescriptors.getServiceDescriptors()); delay = newDescriptors.getMaxAge(); } else if(!newDescriptors.getServiceDescriptors().isEmpty()) { serviceDescriptors.set(newDescriptors); target.updateServiceDescriptors(newDescriptors.getServiceDescriptors()); delay = newDescriptors.getMaxAge(); } errorBackOff.success(); if (delay == null) { delay = DEFAULT_DELAY; } scheduleRefresh(delay); } @Override public void onFailure(Throwable t) { Duration duration = errorBackOff.failed(t); scheduleRefresh(duration); } }, executor); }</code><technical_language>Please format Proofpoint style</technical_language>

Target:
private ListenableFuture<ServiceDescriptors> refresh() { final ServiceDescriptors oldDescriptors = this.serviceDescriptors.get(); final ListenableFuture<ServiceDescriptors> future; if (oldDescriptors == null) { future = discoveryClient.getServices(type, pool); } else { future = discoveryClient.refreshServices(oldDescriptors); } return chainedCallback(future, new FutureCallback<ServiceDescriptors>() { @Override @SuppressFBWarnings("NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE") public void onSuccess(ServiceDescriptors newDescriptors) { Duration delay = null; if (serviceDescriptors.get() == null || !newDescriptors.getServiceDescriptors().isEmpty()) { serviceDescriptors.set(newDescriptors); target.updateServiceDescriptors(newDescriptors.getServiceDescriptors()); delay = newDescriptors.getMaxAge(); } errorBackOff.success(); if (delay == null) { delay = DEFAULT_DELAY; } scheduleRefresh(delay); } @Override public void onFailure(Throwable t) { Duration duration = errorBackOff.failed(t); scheduleRefresh(duration); } }, executor); }
Source:
<code>protected void showInterstitial() { onLog("showInterstitial " + placementName); try { if (TextUtils.isEmpty(placementName)) { <START> IronSource.showInterstitial(); <END> } else { IronSource.showInterstitial(placementName); } } catch (Exception e) { onLog(e.toString()); sHandler.post(new Runnable() { @Override public void run() { if (mMoPubListener != null) { mMoPubListener.onInterstitialFailed(MoPubErrorCode.INTERNAL_ERROR); } } }); } }</code><technical_language>@artemkuzmenko Need check if (IronSource.isInterstitialReady()) calling showInterstitial(). in "else" statement, dispatch MoPub's onInterstitialFailed</technical_language>

Target:
protected void showInterstitial() { onLog("showInterstitial " + mPlacementName); try { if (IronSource.isISDemandOnlyInterstitialReady(mInstanceId)) { if (TextUtils.isEmpty(mPlacementName)) { IronSource.showISDemandOnlyInterstitial(mInstanceId); } else { IronSource.showISDemandOnlyInterstitial(mInstanceId,mPlacementName); } } else { sendMoPubInterstitialFailed(MoPubErrorCode.NO_FILL); } } catch (Exception e) { onLog(e.toString()); sendMoPubInterstitialFailed(MoPubErrorCode.INTERNAL_ERROR); } }
Source:
<code>public @Nonnull AuthorizationStrategy newInstance(StaplerRequest req, JSONObject formData) { return UNSECURED; <START> } <END></code><technical_language>unrelated</technical_language>

Target:
public @Nonnull AuthorizationStrategy newInstance(StaplerRequest req, JSONObject formData) throws FormException { return UNSECURED; }
Source:
<code>public void stop() { super.stop(); _shutdown = true; <START> _partitionDiscoveryThreadMap.values().forEach(Thread::interrupt); <END> }</code><technical_language>introduce shutdown() _PartitionDiscoveryThread class. shutdown method call thread.interrupt() other mechanism shut down</technical_language>

Target:
public void stop() { super.stop(); _shutdown = true; _partitionDiscoveryThreadMap.values().forEach(PartitionDiscoveryThread::shutdown); }
Source:
<code>public Chassis(Motor... motors) <START> { <END> this.motors = motors; motorSpeeds = new double[motors.length]; }</code><technical_language>format</technical_language>

Target:
public Chassis(Motor... motors) { this("Chassis", motors); }
Source:
<code>private void updateInboundProvisioningConfiguration(int applicationId, InboundProvisioningConfig inBoundProvisioningConfig, Connection connection) throws SQLException { int tenantID = CarbonContext.getThreadLocalCarbonContext().getTenantId(); PreparedStatement inboundProConfigPrepStmt = null; try { if (inBoundProvisioningConfig == null || inBoundProvisioningConfig.getProvisioningUserStore() == null) { return; } inboundProConfigPrepStmt = connection .prepareStatement(ApplicationMgtDBQueries.UPDATE_BASIC_APPINFO_WITH_PRO_PROPERTIES); inboundProConfigPrepStmt.setString(1, CharacterEncoder .getSafeText(inBoundProvisioningConfig.getProvisioningUserStore())); <START> inboundProConfigPrepStmt.setString(2, inBoundProvisioningConfig.isDumbMode()?"1":"0"); <END> inboundProConfigPrepStmt.setInt(3, tenantID); inboundProConfigPrepStmt.setInt(4, applicationId); inboundProConfigPrepStmt.execute(); } finally { IdentityApplicationManagementUtil.closeStatement(inboundProConfigPrepStmt); } }</code><technical_language>formatted</technical_language>

Target:
private void updateInboundProvisioningConfiguration(int applicationId, InboundProvisioningConfig inBoundProvisioningConfig, Connection connection) throws SQLException { int tenantID = CarbonContext.getThreadLocalCarbonContext().getTenantId(); PreparedStatement inboundProConfigPrepStmt = null; try { if (inBoundProvisioningConfig == null || inBoundProvisioningConfig.getProvisioningUserStore() == null) { return; } inboundProConfigPrepStmt = connection .prepareStatement(ApplicationMgtDBQueries.UPDATE_BASIC_APPINFO_WITH_PRO_PROPERTIES); inboundProConfigPrepStmt.setString(1, inBoundProvisioningConfig.getProvisioningUserStore()); inboundProConfigPrepStmt.setString(2, inBoundProvisioningConfig.isDumbMode() ? "1" : "0"); inboundProConfigPrepStmt.setInt(3, tenantID); inboundProConfigPrepStmt.setInt(4, applicationId); inboundProConfigPrepStmt.execute(); } finally { IdentityApplicationManagementUtil.closeStatement(inboundProConfigPrepStmt); } }
Source:
<code>private Message forkliftToJms(ForkliftMessage message) throws ProducerException { try { final Message msg = session.createTextMessage(message.getMsg()); <START> if (message.getId() != null && !message.getId().trim().equals("")) <END> msg.setJMSCorrelationID(message.getId()); setMessageHeaders(msg, message.getHeaders()); setMessageProperties(msg, message.getProperties()); return msg; } catch (Exception e) { throw new ProducerException("Error creating JMS Message, or Forklift message was null", e); } }</code><technical_language>Opinion: isEmpty() is equals("")</technical_language>

Target:
private Message forkliftToJms(ForkliftMessage message) throws ProducerException { try { final Message msg = session.createTextMessage(message.getMsg()); if (message.getId() != null && !message.getId().trim().isEmpty()) msg.setJMSCorrelationID(message.getId()); setMessageHeaders(msg, message.getHeaders()); setMessageProperties(msg, message.getProperties()); return msg; } catch (Exception e) { throw new ProducerException("Error creating JMS Message", e); } }
Source:
<code>private String getMatchingNumber(String inputtedNumber) { int newNumber = Integer.parseInt(inputtedNumber); double offset = (double) settings.getNameListSize() / newNumber; <START> checkGroupBalance(offset); <END> int matchingNumber = (int) Math.ceil(offset); return String.valueOf(matchingNumber); }</code><technical_language>In general, want do single responsibility design. module, class, API (like this one) is responsible for 1 thing. This code clean, compact, easy understand. checkGroupBalance() fire this method seemingly calculates a string name, this feels a side effect violates single responsibility design. I feel fire this in onAfterTextChanged() block for of EditTexts. lead redundant calls, this operation is cheap code readability is more important</technical_language>

Target:
private String getMatchingNumber(String inputtedNumber) { int newNumber = Integer.parseInt(inputtedNumber); double offset = (double) settings.getNameListSize() / newNumber; int matchingNumber = (int) Math.ceil(offset); return String.valueOf(matchingNumber); }
Source:
<code>protected void addAdditionalResult(int taskId, int resultId, Object value) { MapSqlParameterSource parameters = new MapSqlParameterSource(); parameters.addValue("taskId", taskId); parameters.addValue("resultId", resultId); if(value instanceof Integer){ parameters.addValue("value", (int)value); this.template.update(INSERT_RESULT_INT, parameters); <START> } if(value instanceof Double){ <END> parameters.addValue("value", (double)value); this.template.update(INSERT_RESULT_DOUBLE, parameters); } }</code><technical_language>if else better</technical_language>

Target:
protected void addAdditionalResult(int taskId, int resultId, Object value) { MapSqlParameterSource parameters = new MapSqlParameterSource(); parameters.addValue("taskId", taskId); parameters.addValue("resultId", resultId); if(value instanceof Integer){ parameters.addValue("value", (int)value); this.template.update(INSERT_RESULT_INT, parameters); } else { parameters.addValue("value", (double)value); this.template.update(INSERT_RESULT_DOUBLE, parameters); } }
Source:
<code>public void start() { GlobalConfiguration globalCfg = gcr.getGlobalConfiguration(); classLoader = globalCfg.classLoader(); internalExts = InternalExternalizers.load(gcr, cmdFactory); reverseInternalExts = internalExts.reverseMap(Ids.MAX_ID); if (trace) { log.tracef("Internal class to externalizer ids: %s", internalExts); log.tracef("Internal reverse externalizers: %s", reverseInternalExts); } externalExts = ExternalExternalizers.load(globalCfg); reverseExternalExts = externalExts.reverseMap(); if (trace) { log.tracef("External class to externalizer ids: %s", externalExts); log.tracef("External reverse externalizers: %s", reverseExternalExts); } classIdentifiers = ClassIdentifiers.load(globalCfg); <START> external = persistenceMarshaller; <END> }</code><technical_language>is reason for external variable now? replace references persistenceMarshaller</technical_language>

Target:
public void start() { GlobalConfiguration globalCfg = gcr.getGlobalConfiguration(); classLoader = globalCfg.classLoader(); internalExts = InternalExternalizers.load(gcr, cmdFactory); reverseInternalExts = internalExts.reverseMap(Ids.MAX_ID); if (trace) { log.tracef("Internal class to externalizer ids: %s", internalExts); log.tracef("Internal reverse externalizers: %s", reverseInternalExts); } externalExts = ExternalExternalizers.load(globalCfg); reverseExternalExts = externalExts.reverseMap(); if (trace) { log.tracef("External class to externalizer ids: %s", externalExts); log.tracef("External reverse externalizers: %s", reverseExternalExts); } classIdentifiers = ClassIdentifiers.load(globalCfg); }
Source:
<code>public void shutdownAndAwaitTerminationWithTimeoutExpireTest() throws InterruptedException { SingleThreadScheduler sts = new SingleThreadScheduler(); executeTestRunnables(sts, 1000 * 10); long start = Clock.accurateForwardProgressingMillis(); assertFalse(sts.shutdownAndAwaitTermination(DELAY_TIME)); <START> System.out.println(Clock.accurateForwardProgressingMillis() - start); <END> assertTrue(Clock.accurateForwardProgressingMillis() - start >= (DELAY_TIME - ALLOWED_VARIANCE)); }</code><technical_language>Please remove System.out calls</technical_language>

Target:
public void shutdownAndAwaitTerminationWithTimeoutExpireTest() throws InterruptedException { SingleThreadScheduler sts = new SingleThreadScheduler(); executeTestRunnables(sts, 1000 * 10); long start = Clock.accurateForwardProgressingMillis(); assertFalse(sts.shutdownAndAwaitTermination(DELAY_TIME)); assertTrue(Clock.accurateForwardProgressingMillis() - start >= (DELAY_TIME - ALLOWED_VARIANCE)); }
Source:
<code>public int size() <START> { <END> return properties.size(); }</code><technical_language>Seriously dude, reformat code for reason</technical_language>

Target:
@Override public int size(){ return properties.size(); }
Source:
<code>public void closed(CommandContext commandContext) { CommandContext currentCommandContext = Context.getCommandContext(); @SuppressWarnings("unchecked") List<ProcessEngineEvent> events = (List<ProcessEngineEvent>) currentCommandContext .getAttribute(PROCESS_ENGINE_EVENTS); if (events != null && events.size() != 0) { <START> producer.auditProducer().send(MessageBuilder.withPayload(events.toArray(new ProcessEngineEvent[events <END> .size()])) .build()); } }</code><technical_language>list instead of converting array</technical_language>

Target:
public void closed(CommandContext commandContext) { CommandContext currentCommandContext = Context.getCommandContext(); List<ProcessEngineEvent> events = currentCommandContext .getGenericAttribute(PROCESS_ENGINE_EVENTS); if (events != null && events.size() != 0) { producer.auditProducer().send(MessageBuilder.withPayload(events.toArray(new ProcessEngineEvent[events .size()])) .build()); } }
Source:
<code>public Operation receiveJupiterActivity(JupiterActivity jupiterActivity) throws TransformationException { Timestamp timestamp = jupiterActivity.getTimestamp(); if (!(timestamp instanceof JupiterVectorTime)) { throw new IllegalArgumentException("Jupiter expects timestamps of type JupiterVectorTime"); <START> } <END> checkPreconditions((JupiterVectorTime) timestamp); discardAcknowledgedOperations((JupiterVectorTime) timestamp); if (jupiterActivity.getOperation() instanceof TimestampOperation) { return new NoOperation(); } Operation newOp = transform(jupiterActivity.getOperation()); this.vectorTime = this.vectorTime.incrementRemoteOperationCount(); return newOp; }</code><technical_language>I see: A dedicated class / component turned on/off some thread hidden client class "magic heartbeats". heartbeat firing done in EDT. is in this setup fire a heartbeat for a existing file (Eclipse filesystem is concurrent). is wrong generating NOPs ? do trick. Of this easy fire special TextActivities translated NOPs</technical_language>

Target:
public Operation receiveJupiterActivity(JupiterActivity jupiterActivity) throws TransformationException { if (jupiterActivity.getOperation() instanceof TimestampOperation) { log.warn("Timestamp operations are not tested at the moment"); updateVectorTime(jupiterActivity.getTimestamp()); return new NoOperation(); } Timestamp timestamp = jupiterActivity.getTimestamp(); if (!(timestamp instanceof JupiterVectorTime)) { throw new IllegalArgumentException("Jupiter expects timestamps of type JupiterVectorTime"); } checkPreconditions((JupiterVectorTime) timestamp); discardAcknowledgedOperations((JupiterVectorTime) timestamp); Operation newOp = transform(jupiterActivity.getOperation()); this.vectorTime = this.vectorTime.incrementRemoteOperationCount(); return newOp; }
Source:
<code>private RexNode convertItem( @UnknownInitialization StandardConvertletTable this, SqlRexContext cx, SqlCall call) { <START> assert call.operandCount() == 2; <END> final RexBuilder rexBuilder = cx.getRexBuilder(); final SqlOperator op = call.getOperator(); SqlOperandTypeChecker operandTypeChecker = op.getOperandTypeChecker(); final SqlOperandTypeChecker.Consistency consistency = operandTypeChecker == null ? SqlOperandTypeChecker.Consistency.NONE : operandTypeChecker.getConsistency(); final List<RexNode> exprs = convertOperands(cx, call, consistency); final RelDataType collectionType = exprs.get(0).getType(); final boolean isRowTypeField = SqlTypeUtil.isRow(collectionType); final boolean isNumericIndex = SqlTypeUtil.isIntType(exprs.get(1).getType()); if (isRowTypeField && isNumericIndex) { final SqlOperatorBinding opBinding = new RexCallBinding( cx.getTypeFactory(), op, exprs, ImmutableList.of()); final RelDataType operandType = opBinding.getOperandType(0); final Integer index = opBinding.getOperandLiteralValue(1, Integer.class); if (index == null || index < 1 || index > operandType.getFieldCount()) { throw new AssertionError("Cannot access field at position " + index + " within ROW type: " + operandType); } else { RelDataTypeField relDataTypeField = collectionType.getFieldList().get(index - 1); return rexBuilder.makeFieldAccess( exprs.get(0), relDataTypeField.getName(), false); } } RelDataType type = rexBuilder.deriveReturnType(op, exprs); return rexBuilder.makeCall(type, op, RexUtil.flatten(exprs, op)); }</code><technical_language>ensures this assert fails? in case user types x[2, 3, 4] in SQL? error user-friendly</technical_language>

Target:
private RexNode convertItem( @UnknownInitialization StandardConvertletTable this, SqlRexContext cx, SqlCall call) { final RexBuilder rexBuilder = cx.getRexBuilder(); final SqlOperator op = call.getOperator(); SqlOperandTypeChecker operandTypeChecker = op.getOperandTypeChecker(); final SqlOperandTypeChecker.Consistency consistency = operandTypeChecker == null ? SqlOperandTypeChecker.Consistency.NONE : operandTypeChecker.getConsistency(); final List<RexNode> exprs = convertOperands(cx, call, consistency); final RelDataType collectionType = exprs.get(0).getType(); final boolean isRowTypeField = SqlTypeUtil.isRow(collectionType); final boolean isNumericIndex = SqlTypeUtil.isIntType(exprs.get(1).getType()); if (isRowTypeField && isNumericIndex) { final SqlOperatorBinding opBinding = new RexCallBinding( cx.getTypeFactory(), op, exprs, ImmutableList.of()); final RelDataType operandType = opBinding.getOperandType(0); final Integer index = opBinding.getOperandLiteralValue(1, Integer.class); if (index == null || index < 1 || index > operandType.getFieldCount()) { throw new AssertionError("Cannot access field at position " + index + " within ROW type: " + operandType); } else { RelDataTypeField relDataTypeField = collectionType.getFieldList().get(index - 1); return rexBuilder.makeFieldAccess( exprs.get(0), relDataTypeField.getName(), false); } } RelDataType type = rexBuilder.deriveReturnType(op, exprs); return rexBuilder.makeCall(type, op, RexUtil.flatten(exprs, op)); }
Source:
<code>private ProtocolRequestMessage createProtocolRequestMessage(final ScheduledTask scheduledTask) { final Device device = this.deviceRepository.findByDeviceIdentification(scheduledTask.getDeviceIdentification()); return new ProtocolRequestMessage.Builder() .domain(scheduledTask.getDomain()) .domainVersion(scheduledTask.getDomainVersion()) .messageType(scheduledTask.getMessageType()) .correlationUid(scheduledTask.getCorrelationId()) .organisationIdentification(scheduledTask.getOrganisationIdentification()) .deviceIdentification(scheduledTask.getDeviceIdentification()) .ipAddress(device.getNetworkAddress().getHostAddress()) .request(scheduledTask.getMessageData()) .scheduled(true) <START> .messagePriority(scheduledTask.getMessagePriority()) <END> .build(); }</code><technical_language>scheduledTask.getMessagePriority() null, while ProtocolRequestMessage.Builder#.messagePriority takes int, lead NullPointerExceptions</technical_language>

Target:
private ProtocolRequestMessage createProtocolRequestMessage(final ScheduledTask scheduledTask) { final Device device = this.deviceRepository.findByDeviceIdentification(scheduledTask.getDeviceIdentification()); final DeviceMessageMetadata deviceMessageMetadata = new DeviceMessageMetadata( scheduledTask.getDeviceIdentification(), scheduledTask.getOrganisationIdentification(), scheduledTask.getCorrelationId(), scheduledTask.getMessageType(), scheduledTask.getMessagePriority()); return new ProtocolRequestMessage.Builder() .deviceMessageMetadata(deviceMessageMetadata) .domain(scheduledTask.getDomain()) .domainVersion(scheduledTask.getDomainVersion()) .ipAddress(device.getNetworkAddress().getHostAddress()) .request(scheduledTask.getMessageData()) .scheduled(true) .build(); }
Source:
<code>int getAddIndex(final WiresShape wiresShape, final WiresContainer container) { Node parent = WiresUtils.getNode(getCanvasHandler(), container); if (parent.getInEdges().size() == 0) { final double shapeX = wiresShape.getComputedLocation().getX(); final List<WiresShape> children = container.getChildShapes().toList().stream() .filter(s -> !((WiresShapeView) s).getUUID().equals(((WiresShapeView) wiresShape).getUUID())) .collect(Collectors.toList()); int targetIndex = children.size(); for (int idx = 0; idx < children.size(); idx++) { final WiresShape child = children.get(idx); if (shapeX < child.getComputedLocation().getX()) { targetIndex = idx; break; } } return targetIndex; } if (state.getOriginalParent().isPresent() && state.getOriginalParent().get().equals(container)) { return parent.getOutEdges().size() - 1; <START> } else { <END> return parent.getOutEdges().size(); } }</code><technical_language>Else statement removed well</technical_language>

Target:
int getAddIndex(final WiresShape wiresShape, final WiresContainer container) { Node parent = WiresUtils.getNode(getCanvasHandler(), container); if (parent.getInEdges().size() == 0) { final double shapeX = wiresShape.getComputedLocation().getX(); final List<WiresShape> children = container.getChildShapes().toList().stream() .filter(s -> !((WiresShapeView) s).getUUID().equals(((WiresShapeView) wiresShape).getUUID())) .collect(Collectors.toList()); int targetIndex = children.size(); for (int idx = 0; idx < children.size(); idx++) { final WiresShape child = children.get(idx); if (shapeX < child.getComputedLocation().getX()) { targetIndex = idx; break; } } return targetIndex; } if (state.getOriginalParent().isPresent() && state.getOriginalParent().get().equals(container)) { return parent.getOutEdges().size() - 1; } return parent.getOutEdges().size(); }
Source:
<code>public abstract void toJson(JsonWriter writer, T value) throws IOException; public final void toJson(Sink sink, T value) throws IOException { JsonWriter writer = new JsonWriter(sink); toJson(writer, value); <START> writer.close(); <END> }</code><technical_language>Closing is odd choice. if writing JSON a file contains mixed data</technical_language>

Target:
public abstract void toJson(JsonWriter writer, T value) throws IOException; public final void toJson(Sink sink, T value) throws IOException { JsonWriter writer = new JsonWriter(sink); toJson(writer, value); writer.flush(); }
Source:
<code>public void storeSettings() { <START> String inFilePath = getImageFilePath(); <END> if (null != inFilePath) { String imagePath = inFilePath.substring(0, inFilePath.lastIndexOf(File.separator) + 1); ModuleSettings.setConfigSetting(contextName, PROP_LASTINPUT_PATH, imagePath); } }</code><technical_language>this method need public</technical_language>

Target:
void storeSettings() { String inFilePath = getImageFilePath(); if (null != inFilePath) { String imagePath = inFilePath.substring(0, inFilePath.lastIndexOf(File.separator) + 1); ModuleSettings.setConfigSetting(contextName, PROP_LASTINPUT_PATH, imagePath); } }
Source:
<code>public ConfigXml(Context context) throws OpenConfigException { mContext = context; mConfigFile = getConfigFile(context); <START> mPreferences = PreferenceManager.getDefaultSharedPreferences(mContext); <END> boolean isFirstStart = !mConfigFile.exists(); if (isFirstStart) { Log.i(TAG, "App started for the first time. Generating keys and config."); generateKeysConfig(context); } readConfig(); if (isFirstStart) { changeLocalDeviceName(); changeDefaultFolder(); } }</code><technical_language>unused now</technical_language>

Target:
public ConfigXml(Context context) throws OpenConfigException { mContext = context; mConfigFile = getConfigFile(context); boolean isFirstStart = !mConfigFile.exists(); if (isFirstStart) { Log.i(TAG, "App started for the first time. Generating keys and config."); generateKeysConfig(context); } readConfig(); if (isFirstStart) { changeLocalDeviceName(); changeDefaultFolder(); } }
Source:
<code>public String getGID(URL url) throws MalformedURLException { Pattern p = Pattern.compile("^https?://sinnercomics.com/comic/([a-zA-Z0-9-]*)/?$"); Matcher m = p.matcher(url.toExternalForm()); if (m.matches()) { return m.group(1); } <START> throw new MalformedURLException("Expected imgur.com URL format: " + <END> "<LINK_0> - got " + url + " instead"); }</code><technical_language>Replace imgur.com</technical_language>

Target:
public String getGID(URL url) throws MalformedURLException { Pattern p = Pattern.compile("^https?://sinnercomics.com/comic/([a-zA-Z0-9-]*)/?$"); Matcher m = p.matcher(url.toExternalForm()); if (m.matches()) { return m.group(1); } throw new MalformedURLException("Expected sinnercomics.com URL format: " + "sinnercomics.com/comic/albumName - got " + url + " instead"); }
Source:
<code><START> public <J> Builder<C> put(Class<J> javaType, ColumnType<J, ?, ?, ?> columnType) { <END> @SuppressWarnings("unchecked") final C columnTypeResolved = (C) columnType; final Class<J> wrapped = Primitives.wrap(javaType); columnTypeMap.put(wrapped, columnTypeResolved); return this; }</code><technical_language>check for nulls least. else well. aim is ensure ColumnTypeRegistry is built correctly, fail fast</technical_language>

Target:
public <J> Builder<C> put(Class<J> javaType, ColumnType<J, ?, ?, ?> columnType) { checkNotNull(javaType); checkNotNull(columnType); @SuppressWarnings("unchecked") final C columnTypeResolved = (C) columnType; final Class<J> wrapped = Primitives.wrap(javaType); columnTypeMap.put(wrapped, columnTypeResolved); return this; }
Source:
<code>public RegexTestResult(boolean match, boolean lookingAt, String result, String capture) { <START> this(match, lookingAt, result, capture, new ArrayList<>()); <END> }</code><technical_language>This Collections.emptyList()</technical_language>

Target:
public RegexTestResult(boolean match, boolean lookingAt, String result, String capture) { this(match, lookingAt, result, capture, Collections.emptyList()); }
Source:
<code>public Future<String> putBlob(BlobProperties blobProperties, byte[] userMetadata, ReadableStreamChannel channel, PutBlobOptions options, Callback<String> callback) { lock.lock(); try { FutureResult<String> future = new FutureResult<>(); long size = channel.getSize(); try { InputStream input = new ReadableStreamChannelInputStream(channel); byte[] bytes = Utils.readBytesFromStream(input, (int) size); BlobInfoAndData blob = new BlobInfoAndData(new BlobInfo(blobProperties, userMetadata), bytes); String id = null; <START> for (; ; ) { <END> id = UtilsTest.getRandomString(10); if (allBlobs.putIfAbsent(id, blob) == null) { break; } } future.done(id, null); if (callback != null) { callback.onCompletion(id, null); } return future; } catch (Exception e) { logger.error("Failed to put blob", e); future.done(null, e); if (callback != null) { callback.onCompletion(null, e); } return future; } } finally { lock.unlock(); } }</code><technical_language>change this while(true)</technical_language>

Target:
public Future<String> putBlob(BlobProperties blobProperties, byte[] userMetadata, ReadableStreamChannel channel, PutBlobOptions options, Callback<String> callback) { lock.lock(); try { FutureResult<String> future = new FutureResult<>(); long size = channel.getSize(); try { InputStream input = new ReadableStreamChannelInputStream(channel); byte[] bytes = Utils.readBytesFromStream(input, (int) size); BlobInfoAndData blob = new BlobInfoAndData(new BlobInfo(blobProperties, userMetadata), bytes); String id = null; while (true) { id = UtilsTest.getRandomString(10); if (allBlobs.putIfAbsent(id, blob) == null) { break; } } future.done(id, null); if (callback != null) { callback.onCompletion(id, null); } return future; } catch (Exception e) { logger.error("Failed to put blob", e); future.done(null, e); if (callback != null) { callback.onCompletion(null, e); } return future; } } finally { lock.unlock(); } }
Source:
<code>public static Credentials from(String username, String password) { if (!(TextUtils.isEmpty(username) || TextUtils.isEmpty(password))) { return new Credentials(username, password); } else { <START> return null; <END> } }</code><technical_language>need throw a BriefcaseException here. Returning null sense in a ValueObject</technical_language>

Target:
public static Credentials from(String username, String password) { if (TextUtils.isEmpty(username) || TextUtils.isEmpty(password)) throw new IllegalArgumentException("You need to provide non-empty username and password."); return new Credentials(username, password); }
Source:
<code>public ClusterFeature get() { Cluster cluster = parent.getClusterEntity(); <START> for (SupportedAdditionalClusterFeature feature : cluster.getAddtionalFeaturesSupported()) { if (feature.getFeature().getId().equals(asGuid(id))) { return ClusterFeaturesMapper.map(feature.getFeature(), null); } } <END> throw new WebApplicationException(Response.Status.NOT_FOUND); }</code><technical_language>This in functional form</technical_language>

Target:
public ClusterFeature get() { Cluster cluster = parent.getClusterEntity(); SupportedAdditionalClusterFeature feature = cluster.getAddtionalFeaturesSupported() .stream() .filter(f -> f.getFeature().getId().equals(asGuid(id))) .findFirst() .orElseThrow(() -> new WebApplicationException(Response.Status.NOT_FOUND)); return ClusterFeaturesMapper.map(feature.getFeature(), null); }
Source:
<code>public SoundPlayer() { try { SoundSystemConfig.setCodec("ogg", CodecJOrbis.class); } catch (SoundSystemException ex) { oggPlaybackSupport = false; } try { SoundSystemConfig.setCodec("wav", CodecWav.class); } catch (SoundSystemException ex) { wavPlaybackSupport = false; } <START> boolean aLCompatible = false; END> if (aLCompatible) { libraryType = LibraryLWJGLOpenAL.class; } else { libraryType = LibraryJavaSound.class; } try { setSoundSystem(new SoundSystem(libraryType)); } catch (SoundSystemException ex) { setSoundSystem(null); } if (getSoundSystem() != null) { getSoundSystem().setMasterVolume(volume); getSoundSystem().setVolume(BACKGROUND_TRACK, musicVolume); } }</code><technical_language>undo this</technical_language>

Target:
public SoundPlayer() { try { SoundSystemConfig.setCodec("ogg", CodecJOrbis.class); } catch (SoundSystemException ex) { oggPlaybackSupport = false; } try { SoundSystemConfig.setCodec("wav", CodecWav.class); } catch (SoundSystemException ex) { wavPlaybackSupport = false; } boolean isOPenAL = Options.getAsBoolean(Options.OPEN_AL, Options.VALUE_TRUE); if (isOPenAL) { boolean aLCompatible = SoundSystem.libraryCompatible(LibraryLWJGLOpenAL.class); if (aLCompatible) { libraryType = LibraryLWJGLOpenAL.class; } else { libraryType = LibraryJavaSound.class; } } else { libraryType = LibraryJavaSound.class; } try { setSoundSystem(new SoundSystem(libraryType)); } catch (SoundSystemException ex) { setSoundSystem(null); } if (getSoundSystem() != null) { getSoundSystem().setMasterVolume(volume); getSoundSystem().setVolume(BACKGROUND_TRACK, musicVolume); } }
Source:
<code>public void should_create_error_message() { factory = shouldNotEndWith(newArrayList("Yoda", "Luke"), newArrayList("Han", "Leia")); String message = factory.create(new TextDescription("Test"), new StandardRepresentation()); <START> assertEquals("[Test] \nExpecting:\n <[\"Yoda\", \"Luke\"]>\nto not end with:\n <[\"Han\", \"Leia\"]>\n", <END> message); }</code><technical_language>assertThat instead of assertEquals :)</technical_language>

Target:
public void should_create_error_message() { factory = shouldNotEndWith(newArrayList("Yoda", "Luke"), newArrayList("Han", "Leia")); String message = factory.create(new TextDescription("Test"), new StandardRepresentation()); assertThat(message).isEqualTo("[Test] \nExpecting:\n <[\"Yoda\", \"Luke\"]>\nto not end with:\n " + "<[\"Han\", \"Leia\"]>\n"); }
Source:
<code>public static void updateMaxMemorySize(VmBase vmBase, Version effectiveCompatibilityVersion) { final int <START> maxMaxMemorySize = <END> VmCommonUtils.maxMemorySizeWithHotplugInMb(vmBase.getOsId(), effectiveCompatibilityVersion); if (vmBase.getMaxMemorySizeMb() == 0 || vmBase.getMaxMemorySizeMb() > maxMaxMemorySize) { vmBase.setMaxMemorySizeMb(maxMaxMemorySize); } }</code><technical_language>reason for double 'max'</technical_language>

Target:
public static void updateMaxMemorySize(VmBase vmBase, Version effectiveCompatibilityVersion) { final int maxOfMaxMemorySize = VmCommonUtils.maxMemorySizeWithHotplugInMb(vmBase.getOsId(), effectiveCompatibilityVersion); if (vmBase.getMaxMemorySizeMb() == 0 || vmBase.getMaxMemorySizeMb() > maxOfMaxMemorySize) { vmBase.setMaxMemorySizeMb(maxOfMaxMemorySize); } }
Source:
<code>public void setup(Context.OperatorContext context) { this.setLogFileFormat(schema); super.setup(context); <START> super.setClazz(pojoClass); <END> }</code><technical_language>simply do super.setClazz(CommonLog.class)... need a vaeiable pojoClass</technical_language>

Target:
public void setup(Context.OperatorContext context) { this.setLogFileFormat(schema); super.setup(context); super.setClazz(CommonLog.class); }
Source:
<code><START> public PresenceChannel getPresenceChannel(String channelName){ <END> return getChannelFromList(channelName, presenceChannels); }</code><technical_language>~~this working if channel name starts "presence-", throw exception, similar for private public channels.~~ Nevermind, channels bucketed</technical_language>

Target:
public PresenceChannel getPresenceChannel(String channelName){ return channelManager.getPresenceChannel(channelName); }
Source:
<code>public Response add(ImageTransfer imageTransfer) { TransferDiskImageParameters params = new TransferDiskImageParameters(); if (imageTransfer.isSetDirection() && <START> imageTransfer.getDirection().equals(ImageTransferDirection.DOWNLOAD)) <END> { params.setTransferType(TransferType.Download); } params.setImageId(GuidUtils.asGuid(imageTransfer.getImage().getId())); params.setKeepaliveInterval(ConfigurationValues.UploadImageUiInactivityTimeoutInSeconds.getValue()); return performCreate(VdcActionType.TransferDiskImage, params, new QueryIdResolver<Guid>(VdcQueryType.GetImageTransferById, IdQueryParameters.class)); }</code><technical_language>For enum comparison == is typically</technical_language>

Target:
public Response add(ImageTransfer imageTransfer) { TransferDiskImageParameters params = new TransferDiskImageParameters(); if (imageTransfer.isSetDirection() && imageTransfer.getDirection() == ImageTransferDirection.DOWNLOAD) { params.setTransferType(TransferType.Download); } params.setImageId(GuidUtils.asGuid(imageTransfer.getImage().getId())); params.setKeepaliveInterval(ConfigurationValues.UploadImageUiInactivityTimeoutInSeconds.getValue()); return performCreate(VdcActionType.TransferDiskImage, params, new QueryIdResolver<Guid>(VdcQueryType.GetImageTransferById, IdQueryParameters.class)); }
Source:
<code>public IterateExpression(Element element) throws CoreException { String opValue= element.getAttribute(ATT_OPERATOR); initializeOperatorValue(opValue.isEmpty() ? <START> opValue : <END> null); String ifEmpty= element.getAttribute(ATT_IF_EMPTY); initializeEmptyResultValue(ifEmpty.isEmpty() ? null : ifEmpty); }</code><technical_language>bug</technical_language>

Target:
public IterateExpression(Element element) throws CoreException { String opValue= element.getAttribute(ATT_OPERATOR); initializeOperatorValue(opValue.isEmpty() ? null : opValue); String ifEmpty= element.getAttribute(ATT_IF_EMPTY); initializeEmptyResultValue(ifEmpty.isEmpty() ? null : ifEmpty); }
Source:
<code>public static byte[] encode(Password password) throws NoSuchAlgorithmException, InvalidKeySpecException { PasswordFactory passwordFactory = PasswordFactory.getInstance(password.getAlgorithm()); <START> if (ClearPassword.class.isInstance(password)) { <END> return encodeClearPasswordSpec(passwordFactory.getKeySpec(password, ClearPasswordSpec.class)); } else if (DigestPassword.class.isInstance(password)) { return encodeDigestPasswordSpec(passwordFactory.getKeySpec(password, DigestPasswordSpec.class)); } else { try { return encodeSaltedHashPasswordSpec(passwordFactory.getKeySpec(password, SaltedHashPasswordSpec.class)); } catch (InvalidKeySpecException ignore) try { return encodeIteratedSaltedHashSpec(passwordFactory.getKeySpec(password, IteratedSaltedHashPasswordSpec.class)); } catch (InvalidKeySpecException ignore) try { return encodeHashPasswordSpec(passwordFactory.getKeySpec(password, HashPasswordSpec.class)); } catch (InvalidKeySpecException ignore) } return null; }</code><technical_language>note previous diff here: passwordFactory queried convertibleToKeySpec method instead of instanceof checks</technical_language>

Target:
public static byte[] encode(Password password) throws NoSuchAlgorithmException, InvalidKeySpecException { PasswordFactory passwordFactory = PasswordFactory.getInstance(password.getAlgorithm()); if (passwordFactory.convertibleToKeySpec(password, ClearPasswordSpec.class)) { return encodeClearPasswordSpec(passwordFactory.getKeySpec(password, ClearPasswordSpec.class)); } else if (passwordFactory.convertibleToKeySpec(password, DigestPasswordSpec.class)) { return encodeDigestPasswordSpec(passwordFactory.getKeySpec(password, DigestPasswordSpec.class)); } else if (passwordFactory.convertibleToKeySpec(password, SaltedHashPasswordSpec.class)) { return encodeSaltedHashPasswordSpec(passwordFactory.getKeySpec(password, SaltedHashPasswordSpec.class)); } else if (passwordFactory.convertibleToKeySpec(password, IteratedSaltedHashPasswordSpec.class)) { return encodeIteratedSaltedHashSpec(passwordFactory.getKeySpec(password, IteratedSaltedHashPasswordSpec.class)); } else if (passwordFactory.convertibleToKeySpec(password, HashPasswordSpec.class)) { return encodeHashPasswordSpec(passwordFactory.getKeySpec(password, HashPasswordSpec.class)); } return null; }
Source:
<code>public KeyMaterial materialize() throws IOException, InterruptedException { KeyMaterial[] keyMaterials = new KeyMaterial[factories.length]; EnvVars env = new EnvVars(); try { for (int index = 0; index < factories.length; index++) { keyMaterials[index] = factories[index].materialize(); env.putAll(keyMaterials[index].env()); } return new CompositeKeyMaterial(env, keyMaterials); } catch (Exception e) { for (int index = keyMaterials.length - 1; index >= 0; index--) { try { if (keyMaterials[index] != null) { keyMaterials[index].close(); } <START> } catch (IOException ioe) { <END> } } if (e instanceof IOException) { throw (IOException) e; } else if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { throw new IOException("Error materializing credentials.", e); } } }</code><technical_language>want widen scope of caught ensure closed</technical_language>

Target:
public KeyMaterial materialize() throws IOException, InterruptedException { KeyMaterial[] keyMaterials = new KeyMaterial[factories.length]; EnvVars env = new EnvVars(); try { for (int index = 0; index < factories.length; index++) { keyMaterials[index] = factories[index].materialize(); env.putAll(keyMaterials[index].env()); } return new CompositeKeyMaterial(env, keyMaterials); } catch (Throwable e) { for (int index = keyMaterials.length - 1; index >= 0; index--) { try { if (keyMaterials[index] != null) { keyMaterials[index].close(); } } catch (IOException ioe) { } catch (Throwable t) { } } if (e instanceof IOException) { throw (IOException) e; } else if (e instanceof InterruptedException) { throw (InterruptedException) e; } else if (e instanceof RuntimeException) { throw (RuntimeException) e; } else { throw new IOException("Error materializing credentials.", e); } } }