auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
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.compareAndSet(null, newDescriptors)){ 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); }

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:
protected void showInterstitial() { onLog("showInterstitial " + placementName); try { if (TextUtils.isEmpty(placementName)) { IronSource.showInterstitial(); } 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); } } }); } }

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:
public @Nonnull AuthorizationStrategy newInstance(StaplerRequest req, JSONObject formData) { return UNSECURED; }

Target:
public @Nonnull AuthorizationStrategy newInstance(StaplerRequest req, JSONObject formData) throws FormException { return UNSECURED; }
Source:
public void stop() { super.stop(); _shutdown = true; _partitionDiscoveryThreadMap.values().forEach(Thread::interrupt); }

Target:
public void stop() { super.stop(); _shutdown = true; _partitionDiscoveryThreadMap.values().forEach(PartitionDiscoveryThread::shutdown); }
Source:
public Chassis(Motor... motors) { this.motors = motors; motorSpeeds = new double[motors.length]; }

Target:
public Chassis(Motor... motors) { this("Chassis", motors); }
Source:
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())); inboundProConfigPrepStmt.setString(2, inBoundProvisioningConfig.isDumbMode()?"1":"0"); inboundProConfigPrepStmt.setInt(3, tenantID); inboundProConfigPrepStmt.setInt(4, applicationId); inboundProConfigPrepStmt.execute(); } finally { IdentityApplicationManagementUtil.closeStatement(inboundProConfigPrepStmt); } }

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:
private Message forkliftToJms(ForkliftMessage message) throws ProducerException { try { final Message msg = session.createTextMessage(message.getMsg()); if (message.getId() != null && !message.getId().trim().equals("")) 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); } }

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:
private String getMatchingNumber(String inputtedNumber) { int newNumber = Integer.parseInt(inputtedNumber); double offset = (double) settings.getNameListSize() / newNumber; checkGroupBalance(offset); int matchingNumber = (int) Math.ceil(offset); return String.valueOf(matchingNumber); }

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:
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); } if(value instanceof Double){ parameters.addValue("value", (double)value); this.template.update(INSERT_RESULT_DOUBLE, parameters); } }

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:
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); external = persistenceMarshaller; }

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:
public void shutdownAndAwaitTerminationWithTimeoutExpireTest() throws InterruptedException { SingleThreadScheduler sts = new SingleThreadScheduler(); executeTestRunnables(sts, 1000 * 10); long start = Clock.accurateForwardProgressingMillis(); assertFalse(sts.shutdownAndAwaitTermination(DELAY_TIME)); System.out.println(Clock.accurateForwardProgressingMillis() - start); assertTrue(Clock.accurateForwardProgressingMillis() - start >= (DELAY_TIME - ALLOWED_VARIANCE)); }

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:
public int size() { return properties.size(); }

Target:
@Override public int size(){ return properties.size(); }
Source:
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) { producer.auditProducer().send(MessageBuilder.withPayload(events.toArray(new ProcessEngineEvent[events .size()])) .build()); } }

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:
public Operation receiveJupiterActivity(JupiterActivity jupiterActivity) throws TransformationException { Timestamp timestamp = jupiterActivity.getTimestamp(); if (!(timestamp instanceof JupiterVectorTime)) { throw new IllegalArgumentException("Jupiter expects timestamps of type JupiterVectorTime"); } 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; }

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:
private RexNode convertItem( @UnknownInitialization StandardConvertletTable this, SqlRexContext cx, SqlCall call) { assert call.operandCount() == 2; 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)); }

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:
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) .messagePriority(scheduledTask.getMessagePriority()) .build(); }

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:
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; } else { return parent.getOutEdges().size(); } }

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:
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.close(); }

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:
public 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); } }

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:
public void adaptersHelper() throws Throwable { try { Class<?> moduleClass = compileAndLoadGoloModule(SRC, "adapters-helper.golo"); Method serializable = moduleClass.getMethod("serializable"); Object result = serializable.invoke(null); assertThat(result, notNullValue()); assertThat(result, instanceOf(Serializable.class)); Method runnable = moduleClass.getMethod("runnable"); result = runnable.invoke(null); assertThat(result, notNullValue()); assertThat(result, instanceOf(Object[].class)); Object[] array = (Object[]) result; assertThat(array, both(arrayWithSize(3)).and(arrayContaining((Object) 11, (Object) 12, (Object) 13))); Method override_toString = moduleClass.getMethod("override_toString"); result = override_toString.invoke(null); assertThat(result, notNullValue()); String str = result.toString(); assertThat(str, both(startsWith(">>>")).and(containsString("@"))); Method construct_arraylist = moduleClass.getMethod("construct_arraylist"); result = construct_arraylist.invoke(null); assertThat(result, notNullValue()); assertThat(result, instanceOf(ArrayList.class)); ArrayList<String> arrayList = (ArrayList<String>) result; assertThat(arrayList.size(), is(3)); assertThat(arrayList, contains("foo", "bar", "baz")); if (!bootstraping()) { Method add_arraylist = moduleClass.getMethod("add_arraylist"); result = add_arraylist.invoke(null); assertThat(result, instanceOf(List.class)); List<String> strList = (List<String>) result; assertThat(strList.size(), is(3)); assertThat(strList, contains("foo", "bar", "baz")); } } catch (Throwable t) { t.getCause().printStackTrace(); } }

Target:
public void adaptersHelper() throws Throwable { if (bootstraping()) { return; } Class<?> moduleClass = compileAndLoadGoloModule(SRC, "adapters-helper.golo"); Method serializable = moduleClass.getMethod("serializable"); Object result = serializable.invoke(null); assertThat(result, notNullValue()); assertThat(result, instanceOf(Serializable.class)); Method runnable = moduleClass.getMethod("runnable"); result = runnable.invoke(null); assertThat(result, notNullValue()); assertThat(result, instanceOf(Object[].class)); Object[] array = (Object[]) result; assertThat(array, both(arrayWithSize(3)).and(arrayContaining((Object) 11, (Object) 12, (Object) 13))); Method override_toString = moduleClass.getMethod("override_toString"); result = override_toString.invoke(null); assertThat(result, notNullValue()); String str = result.toString(); assertThat(str, both(startsWith(">>>")).and(containsString("@"))); Method construct_arraylist = moduleClass.getMethod("construct_arraylist"); result = construct_arraylist.invoke(null); assertThat(result, notNullValue()); assertThat(result, instanceOf(ArrayList.class)); ArrayList<String> arrayList = (ArrayList<String>) result; assertThat(arrayList.size(), is(3)); assertThat(arrayList, contains("foo", "bar", "baz")); Method add_arraylist = moduleClass.getMethod("add_arraylist"); result = add_arraylist.invoke(null); assertThat(result, instanceOf(List.class)); List<String> strList = (List<String>) result; assertThat(strList.size(), is(3)); assertThat(strList, contains("foo", "bar", "baz")); }
Source:
public ConfigXml(Context context) throws OpenConfigException { mContext = context; mConfigFile = getConfigFile(context); mPreferences = PreferenceManager.getDefaultSharedPreferences(mContext); 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(); } }

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:
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 imgur.com URL format: " + "<LINK_0> - got " + url + " instead"); }

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:
public <J> Builder<C> put(Class<J> javaType, ColumnType<J, ?, ?, ?> columnType) { @SuppressWarnings("unchecked") final C columnTypeResolved = (C) columnType; final Class<J> wrapped = Primitives.wrap(javaType); columnTypeMap.put(wrapped, columnTypeResolved); return this; }

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:
public RegexTestResult(boolean match, boolean lookingAt, String result, String capture) { this(match, lookingAt, result, capture, new ArrayList<>()); }

Target:
public RegexTestResult(boolean match, boolean lookingAt, String result, String capture) { this(match, lookingAt, result, capture, Collections.emptyList()); }
Source:
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; for (; ; ) { 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(); } }

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:
public static Credentials from(String username, String password) { if (!(TextUtils.isEmpty(username) || TextUtils.isEmpty(password))) { return new Credentials(username, password); } else { return null; } }

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:
public ClusterFeature get() { Cluster cluster = parent.getClusterEntity(); for (SupportedAdditionalClusterFeature feature : cluster.getAddtionalFeaturesSupported()) { if (feature.getFeature().getId().equals(asGuid(id))) { return ClusterFeaturesMapper.map(feature.getFeature(), null); } } throw new WebApplicationException(Response.Status.NOT_FOUND); }

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:
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 aLCompatible = false; 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); } }

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:
public void should_create_error_message() { factory = shouldNotEndWith(newArrayList("Yoda", "Luke"), newArrayList("Han", "Leia")); String message = factory.create(new TextDescription("Test"), new StandardRepresentation()); assertEquals("[Test] \nExpecting:\n <[\"Yoda\", \"Luke\"]>\nto not end with:\n <[\"Han\", \"Leia\"]>\n", message); }

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:
public static void updateMaxMemorySize(VmBase vmBase, Version effectiveCompatibilityVersion) { final int maxMaxMemorySize = VmCommonUtils.maxMemorySizeWithHotplugInMb(vmBase.getOsId(), effectiveCompatibilityVersion); if (vmBase.getMaxMemorySizeMb() == 0 || vmBase.getMaxMemorySizeMb() > maxMaxMemorySize) { vmBase.setMaxMemorySizeMb(maxMaxMemorySize); } }

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:
public void setup(Context.OperatorContext context) { this.setLogFileFormat(schema); super.setup(context); super.setClazz(pojoClass); }

Target:
public void setup(Context.OperatorContext context) { this.setLogFileFormat(schema); super.setup(context); super.setClazz(CommonLog.class); }
Source:
public PresenceChannel getPresenceChannel(String channelName){ return getChannelFromList(channelName, presenceChannels); }

Target:
public PresenceChannel getPresenceChannel(String channelName){ return channelManager.getPresenceChannel(channelName); }
Source:
public Response add(ImageTransfer imageTransfer) { TransferDiskImageParameters params = new TransferDiskImageParameters(); if (imageTransfer.isSetDirection() && imageTransfer.getDirection().equals(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)); }

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:
public IterateExpression(Element element) throws CoreException { String opValue= element.getAttribute(ATT_OPERATOR); initializeOperatorValue(opValue.isEmpty() ? opValue : null); String ifEmpty= element.getAttribute(ATT_IF_EMPTY); initializeEmptyResultValue(ifEmpty.isEmpty() ? null : ifEmpty); }

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:
public static byte[] encode(Password password) throws NoSuchAlgorithmException, InvalidKeySpecException { PasswordFactory passwordFactory = PasswordFactory.getInstance(password.getAlgorithm()); if (ClearPassword.class.isInstance(password)) { 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; }

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:
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(); } } catch (IOException ioe) { } } if (e instanceof IOException) { throw (IOException) e; } else if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { throw new IOException("Error materializing credentials.", e); } } }

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); } } }
Source:
public long getResultSize() { try { return searchQuery.executeCount(); } catch (QueryExecutionRequestException | ArithmeticException e) { throw new IllegalStateException( e ); } catch (TypeMismatchException e) { throw new IllegalArgumentException( e ); } catch (HibernateException he) { throw getExceptionConverter().convert( he ); } }

Target:
public long getResultSize() { try { return searchQuery.executeCount(); } catch (QueryExecutionRequestException e) { throw new IllegalStateException( e ); } catch (TypeMismatchException e) { throw new IllegalArgumentException( e ); } catch (HibernateException he) { throw getExceptionConverter().convert( he ); } }
Source:
private void showSoftKeyboard() { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,InputMethodManager.HIDE_IMPLICIT_ONLY); }

Target:
private void showSoftKeyboard() { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT,InputMethodManager.HIDE_IMPLICIT_ONLY); }
Source:
private Map<String, String> removeSuffixEditFromKeys(Map<String, String> map) { Map<String, String> result = new HashMap<>(); for (Map.Entry<String, String> entry : map.entrySet()) { if (entry.getKey().endsWith(EDIT_FORM_ITEM_SUFFIX)) { result.put(entry.getKey().substring(0, entry.getKey().length() - EDIT_FORM_ITEM_SUFFIX.length()), entry.getValue()); } else { result.put(entry.getKey(), entry.getValue()); } } return result; }

Target:
private Map<String, String> removeSuffixEditFromKeys(Map<String, String> map) { Map<String, String> result = new HashMap<>(map.size()); for (Map.Entry<String, String> entry : map.entrySet()) { if (entry.getKey().endsWith(EDIT_FORM_ITEM_SUFFIX)) { result.put(entry.getKey().substring(0, entry.getKey().length() - EDIT_FORM_ITEM_SUFFIX.length()), entry.getValue()); } else { result.put(entry.getKey(), entry.getValue()); } } return result; }
Source:
private String getLogInfoForTableRowAsHtml(){ StringBuilder str = new StringBuilder(); str.append("<tr class=\"log\">"); str.append("<td>" + this.receiver + "</td>"); str.append("<td>" + this.subject + "</td>"); str.append("<td>" + this.getTimeForDisplay() + "</td>"); str.append("</tr>"); str.append("<tr id=\"small\">"); str.append("<td colspan=\"3\">"); str.append("<ul class=\"list-group\">"); str.append("<li class=\"list-group-item list-group-item-info\">"); str.append("<input type=\"text\" value=\"" + this.getContent() + "\" class=\"form-control\""); str.append(" readonly"); str.append("</li>"); str.append("</ul> "); str.append("</td>"); str.append("</tr>"); str.append("<tr id=\"big\" style=\"display:none;\">"); str.append("<td colspan=\"3\">"); str.append("<div class=\"well\">"); str.append("<ul class=\"list-group\">"); str.append("<li class=\"list-group-item list-group-item-success\"><small>"); str.append(this.content + "</small>"); str.append("</li>"); str.append("</ul>"); str.append("</div>"); str.append("</td>"); str.append("</tr>"); return str.toString(); }

Target:
private String getLogInfoForTableRowAsHtml(){ StringBuilder str = new StringBuilder(); str.append("<tr class=\"log\">"); str.append("<td>" + this.receiver + "</td>"); str.append("<td>" + this.subject + "</td>"); str.append("<td>" + this.getTimeForDisplay() + "</td>"); str.append("</tr>"); str.append("<tr id=\"small\">"); str.append("<td colspan=\"3\">"); str.append("<ul class=\"list-group\">"); str.append("<li class=\"list-group-item list-group-item-info\">"); str.append("<input type=\"text\" value=\"" + this.getContent() + "\" class=\"form-control\""); str.append(" readonly>"); str.append("</li>"); str.append("</ul> "); str.append("</td>"); str.append("</tr>"); str.append("<tr id=\"big\" style=\"display:none;\">"); str.append("<td colspan=\"3\">"); str.append("<div class=\"well\">"); str.append("<ul class=\"list-group\">"); str.append("<li class=\"list-group-item list-group-item-success\"><small>"); str.append(this.content + "</small>"); str.append("</li>"); str.append("</ul>"); str.append("</div>"); str.append("</td>"); str.append("</tr>"); return str.toString(); }
Source:
public DoubleUiColumn( final List<HeaderMetaData> headerMetaData, final double width, final boolean isResizable, final boolean isVisible, final GuidedDecisionTablePresenter.Access access, final TextBoxDoubleSingletonDOMElementFactory factory ) { super( headerMetaData, new CellRenderer<Double, NumericDoubleTextBox, TextBoxDOMElement<Double, NumericDoubleTextBox>>( factory ) { @Override protected void doRenderCellContent( final Text t, final Double value, final GridBodyCellRenderContext context ) { t.setText( value.toString() ); } }, width, isResizable, isVisible, access, factory ); }

Target:
public DoubleUiColumn( final List<HeaderMetaData> headerMetaData, final double width, final boolean isResizable, final boolean isVisible, final GuidedDecisionTablePresenter.Access access, final TextBoxDoubleSingletonDOMElementFactory factory ) { super( headerMetaData, new CellRenderer<Double, NumericDoubleTextBox, TextBoxDOMElement<Double, NumericDoubleTextBox>>( factory ) { @Override protected void doRenderCellContent( final Text t, final Double value, final GridBodyCellRenderContext context ) { t.setText( ( (TextBoxDoubleSingletonDOMElementFactory) factory ).convert( value ) ); } }, width, isResizable, isVisible, access, factory ); }
Source:
public Response waitForResponse(long timeout) throws InterruptedException { long before = System.currentTimeMillis(); long expired = timeout > 0 ? (before + timeout) : 0; synchronized (this) { while (this.response == null && !isCanceled() && !isTimedOut() && !isRejected()) { wait(timeout); long now = System.currentTimeMillis(); if (timeout > 0) { timeout = expired - now; if (0 >= timeout) { break; } } } Response r = this.response; this.response = null; return r; } }

Target:
public Response waitForResponse(long timeout) throws InterruptedException { long before = TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); long expired = timeout > 0 ? (before + timeout) : 0; long leftTimeout = timeout; synchronized (this) { while (this.response == null && !isCanceled() && !isTimedOut() && !isRejected()) { wait(leftTimeout); long now = TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); if (timeout > 0) { leftTimeout = expired - now; if (0 >= leftTimeout) { break; } } } System.currentTimeMillis(); Response r = this.response; this.response = null; return r; } }
Source:
public String getMediaUrl(HostInfo hostInfo) { String pathforUrl = fileName.replaceAll(" ", "%20").replaceAll("'","%27"); String credentials = hostInfo.getPassword().isEmpty() ? "" : String.format("%s:%s@", hostInfo.getUsername(), hostInfo.getPassword()); String videoUrl = String.format("http://%s%s:%d/vfs/%s", credentials, hostInfo.getAddress(), hostInfo.getHttpPort(), pathforUrl); return videoUrl; }

Target:
public String getMediaUrl(HostInfo hostInfo) { String pathforUrl = fileName.replaceAll(" ", "%20").replaceAll("'","%27"); String credentials = (hostInfo.getPassword() == null || hostInfo.getPassword().isEmpty()) ? "" : String.format("%s:%s@", hostInfo.getUsername(), hostInfo.getPassword()); String videoUrl = String.format("http://%s%s:%d/vfs/%s", credentials, hostInfo.getAddress(), hostInfo.getHttpPort(), pathforUrl); return videoUrl; }
Source:
private static GroupType buildProjectedGroupType( GroupType originalType, List<Type> types) { return new GroupType(originalType.getRepetition(), originalType.getName(), types); }

Target:
private static GroupType buildProjectedGroupType( GroupType originalType, List<Type> types) { if (types == null || types.isEmpty()) { return null; } return new GroupType(originalType.getRepetition(), originalType.getName(), types); }
Source:
private void cleanup() { logger.info("Shutting down Terasology..."); shuttingDown = true; changeStatus(StandardGameStatus.SHUTTING_DOWN); Iterator<EngineSubsystem> iter = subsystems.descendingIterator(); while (iter.hasNext()) { EngineSubsystem subsystem = iter.next(); subsystem.shutdown(config); } config.save(); if (currentState != null) { currentState.dispose(); currentState = null; } }

Target:
private void cleanup() { logger.info("Shutting down Terasology..."); changeStatus(StandardGameStatus.SHUTTING_DOWN); Iterator<EngineSubsystem> shutdownIter = subsystems.descendingIterator(); while (shutdownIter.hasNext()) { EngineSubsystem subsystem = shutdownIter.next(); subsystem.shutdown(config); } config.save(); if (currentState != null) { currentState.dispose(); currentState = null; } Iterator<EngineSubsystem> disposeIter = subsystems.descendingIterator(); while (disposeIter.hasNext()) { EngineSubsystem subsystem = disposeIter.next(); try { subsystem.dispose(); } catch (RuntimeException t) { logger.error("Unable to dispose subsystem {}", subsystem, t); } } }
Source:
ConsumerSustainedConnection() { this.topicName = SustainedConnectionWorker.this.spec.topicName(); this.consumer = null; this.consumerGroup = UUID.randomUUID().toString(); this.activePartition = null; this.rand = new Random(); this.refreshRate = SustainedConnectionWorker.this.spec.refreshRateMs(); this.props = new Properties(); this.props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, SustainedConnectionWorker.this.spec.bootstrapServers()); this.props.put(ConsumerConfig.GROUP_ID_CONFIG, this.consumerGroup); this.props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "latest"); this.props.put(ConsumerConfig.MAX_POLL_RECORDS_CONFIG, 1); this.props.put(ConsumerConfig.FETCH_MAX_BYTES_CONFIG, 1024); WorkerUtils.addConfigsToProperties( this.props, SustainedConnectionWorker.this.spec.commonClientConf(), SustainedConnectionWorker.this.spec.consumerConf()); }

Target:
ConsumerSustainedConnection() { this.topicName = SustainedConnectionWorker.this.spec.topicName(); this.consumer = null; this.activePartition = null; this.rand = new Random(); this.refreshRate = SustainedConnectionWorker.this.spec.refreshRateMs(); this.props = new Properties(); this.props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, SustainedConnectionWorker.this.spec.bootstrapServers()); this.props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "latest"); this.props.put(ConsumerConfig.MAX_POLL_RECORDS_CONFIG, 1); this.props.put(ConsumerConfig.FETCH_MAX_BYTES_CONFIG, 1024); WorkerUtils.addConfigsToProperties( this.props, SustainedConnectionWorker.this.spec.commonClientConf(), SustainedConnectionWorker.this.spec.consumerConf()); }